1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00
freebsd/usr.bin/colldef/colldef.1
Andrey A. Chernov a1c128ae2a collate tables compiler
Submitted by: alex@elvisti.kiev.ua
1995-02-17 17:29:50 +00:00

195 lines
5.4 KiB
Groff

.\" Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
.\" at Electronni Visti IA, Kiev, Ukraine.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd January, 27 1995
.Dt COLLDEF 1
.Os
.Sh NAME
.Nm colldef
.Nd convert collation sequence source definition
.Sh SYNOPSIS
.Nm colldef
.Ar [-o out_file] [filename]
.Sh DESCRIPTION
.Ar colldef
converts a collation sequence source definition
into a format usable by the
.Fn strxfrm
and
.Fn strcoll
functions. It is used to define the many ways in which
strings can be ordered and collated.
.Fn strxfrm
transforms
its first argument and places the result in its second
argument. The transformed string is such that it can be
correctly ordered with other transformed strings by using
.Fn strcmp ,
.Fn strncmp ,
or
.Fn memcmp .
.Fn strcoll
transforms its arguments and does a
comparison.
.Pp
.Ar colldef
reads the collation sequence source definition
from the standard input and stores the converted definition in filename.
The output file produced contains the
database with collating sequence information in a form
usable by system commands and routines.
.Pp
The collation sequence definition specifies a set of collating elements and
the rules defining how strings containing these should be ordered.
This is most useful for different language definitions.
.Pp
The specification file can consist of three statements:
.Ar charmap
,
.Ar substitute
, and
.Ar order
. Of these, only the order
statement is required. When charmap or substitute is
supplied, these statements must be ordered as above. Any
statements after the order statement are ignored.
.Pp
Lines in the specification file beginning with a # are
treated as comments and are ignored. Blank lines are also
ignored.
.Pp
.Ar charmap charmapfile
.Ar charmap
defines where a mapping of the character
and collating element symbols to the actual
character encoding can be found.
.Pp
The format of
.Ar charmapfile
is shown below. Symbol
names are separated from their values by TAB or
SPACE characters. symbol-value can be specified in
a hexadecimal (\ex??) or octal (\e???)
representation, and can be only one character in length.
.Pp
.Ar symbol-name1 symbol-value1
.Ar symbol-name2 symbol-value2
.Ar ...
.Pp
Symbol names cannot be specified in substitute
fields. Symbol names also cannot be combined with
any other representation, such as, <c>h, c<h>,
<c>\ex68, or <c><h>. Symbol names can be used with
primary and secondary ordering as in the following
example.
.Pp
The charmap statement is optional.
.Pp
.Ar substitute char with repl
The
.Ar substitute
statement substitutes the character
.Ar char
with the string
.Ar repl
.
.Pp
The substitute statement is optional.
.Pp
.Ar order order_list
.Ar order_list
is a list of symbols, separated by semi colons, that defines the collating sequence. The
special symbol,
.Ar ...
, specifies, in a short-hand
form, symbols that are sequential in machine code
order.
.Pp
A symbol can be up to two characters in length and
can be represented in any one of the following
ways:
.Bl -tag -width XX
.It o The symbol itself (for example,
.Ar a
for the lower-case letter
.Ar a
).
.It o The symbol chain (for example,
.Ar abc
)
.It o In octal representation (for example,
.Ar \e141
for the letter
.Ar a
).
.It o In hexadecimal representation (for example,
.Ar \ex61
for the letter
.Ar a
).
.It o The symbol name as defined in the charmap file (for example,
.Ar <abc>
for
.Ar \e023 abc
record in
.Ar charmapfile
).
.It o Symbols
.Ar \ea, \eb, \ef, \en, \er, \ev
are permitted in its usual C-language meaning.
.El
.Pp
The backslash character,
.Ar \e
, is used for continuation. In this case, no characters are permitted
after the backslash character. And as a quotation mark.
.Pp
Symbols enclosed in parentheses are assigned the
same primary ordering but different secondary
ordering. Symbols enclosed in curly brackets are
assigned only the same primary ordering
and different secondary ordering.
.Sh EXIT STATUS
.Ar colldef
exits with the following values:
.Ar 0
No errors were found and the output was successfully created.
.Ar !=0
Errors were found.
.Sh FILES
.Ar /usr/share/locale/<language>/LC_COLLATE
standard shared location for collation orders
under the locale locale
.Sh SEE ALSO
.Xr mklocale 1 ,
.Xr strcoll 3 ,
.Xr strxfrm 3