4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1996, by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
32 * MKS extension to ANSI/POSIX to retrieve additional locale information.
33 * Specifically collation information.
35 * Copyright 1989, 1993 by Mortice Kern Systems Inc. All rights reserved.
37 * $Header: /rd/h/rcs/collate.h 1.16 1993/12/02 21:54:23 mark Exp $
46 * include prototypes of the MKS i18n routines
51 * constants and structure definitions used in MKS internal implementation
53 * -- used by strxfrm(), localedef.
56 /* string length limitations */
57 #define _M_COLLATE_MAX 32 /* max length of a collation string */
58 #define _M_COTOM_MAX 4 /* max length of one to many map */
60 /* forward, backward... -- or'ed into cmode */
61 #define _M_FORWARD_MODE 1 /* compare based on string forward */
62 #define _M_BACKWARD_MODE 2 /* compare based on string backward */
63 #define _M_POSITION_MODE 4 /* consider relative position of non-IGNOREd */
65 /* flags used in cord.cflag */
66 #define _M_NOCOLLSTR 0
67 #define _M_MANYTOONEF 1 /* Potential many-to-one mapping in forward */
68 #define _M_MANYTOONEB 2 /* Potential many-to-one mapping in backward */
71 typedef short _m_weight_t
;
73 /* collate database file header */
75 int cnstr
; /* number of collate strings */
76 int cnotom
; /* number of one to many maps */
77 int cnweight
; /* Number of weights in cmode */
78 unsigned char cmode
[COLL_WEIGHTS_MAX
];/* order mode: forward... */
79 struct _m_cstr
*cstr
; /* Pointer to collating strs */
80 struct _m_cord
*cord
; /* weight tables */
81 struct _m_cotom
*cotom
; /* one-to-many mapping tables */
82 m_collel_t
*cindex
, /* index to range table map */
83 *range
; /* Range table */
84 m_collel_t
*equivo
, /* equiv class offsets */
85 *cequiv
; /* equiv class table */
88 /* Per character and per collating-sequence structure */
89 struct _m_cord
{ /* order */
90 unsigned char cflag
; /* =1, beginning of a collation string */
91 _m_weight_t cweight
[COLL_WEIGHTS_MAX
]; /* relative weight */
95 * The _m_cstr structure is per many-to-one mapping (collating element from...)
96 * Pointed at by _m_cinfo.cstr, indexed by (m_collel_t - M_CSETSIZE).
97 * Stored both forwards and backwards to make it easy for strxfrm parsing
98 * for order_start backward.
100 struct _m_cstr
{ /* collating-element */
101 char csf
[_M_COLLATE_MAX
]; /* collating string forward */
102 char csb
[_M_COLLATE_MAX
]; /* collating string backward */
106 * Per one-to-many mapping entry. A cweight entry in the _cord structure
107 * which is negative, will index into this table.
108 * Pointed at by _m_cinfo.cotom.
110 struct _m_cotom
{ /* one to many map */
111 _m_weight_t weight
[_M_COTOM_MAX
];
116 extern struct _m_cinfo _m_cinfo
;
120 #endif /* __COLLATE_H_ */