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