1 /* 2 * CDDL HEADER START 3 * 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 7 * with the License. 8 * 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. 13 * 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] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1996, by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 /* 30 * collate.h 31 * 32 * MKS extension to ANSI/POSIX to retrieve additional locale information. 33 * Specifically collation information. 34 * 35 * Copyright 1989, 1993 by Mortice Kern Systems Inc. All rights reserved. 36 * 37 * $Header: /rd/h/rcs/collate.h 1.16 1993/12/02 21:54:23 mark Exp $ 38 */ 39 #ifndef __COLLATE_H__ 40 #define __COLLATE_H__ 41 42 #include <mks.h> 43 #include <limits.h> 44 45 /* 46 * include prototypes of the MKS i18n routines 47 */ 48 #include <m_collat.h> 49 50 /* 51 * constants and structure definitions used in MKS internal implementation 52 * 53 * -- used by strxfrm(), localedef. 54 */ 55 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 */ 59 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 */ 64 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 */ 69 70 /* typedef's */ 71 typedef short _m_weight_t; 72 73 /* collate database file header */ 74 struct _m_cinfo { 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 */ 86 }; 87 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 */ 92 }; 93 94 /*l 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. 99 */ 100 struct _m_cstr { /* collating-element */ 101 char csf[_M_COLLATE_MAX]; /* collating string forward */ 102 char csb[_M_COLLATE_MAX]; /* collating string backward */ 103 }; 104 105 /*l 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. 109 */ 110 struct _m_cotom { /* one to many map */ 111 _m_weight_t weight[_M_COTOM_MAX]; 112 }; 113 114 #ifdef I18N 115 116 extern struct _m_cinfo _m_cinfo; 117 118 #endif /* I18N */ 119 120 #endif /* __COLLATE_H_ */ 121