17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright (c) 1996, by Sun Microsystems, Inc. 247c478bd9Sstevel@tonic-gate * All rights reserved. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* 28*1da57d55SToomas Soome * collate.h 297c478bd9Sstevel@tonic-gate * 307c478bd9Sstevel@tonic-gate * MKS extension to ANSI/POSIX to retrieve additional locale information. 317c478bd9Sstevel@tonic-gate * Specifically collation information. 327c478bd9Sstevel@tonic-gate * 337c478bd9Sstevel@tonic-gate * Copyright 1989, 1993 by Mortice Kern Systems Inc. All rights reserved. 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * $Header: /rd/h/rcs/collate.h 1.16 1993/12/02 21:54:23 mark Exp $ 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate #ifndef __COLLATE_H__ 387c478bd9Sstevel@tonic-gate #define __COLLATE_H__ 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate #include <mks.h> 417c478bd9Sstevel@tonic-gate #include <limits.h> 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * include prototypes of the MKS i18n routines 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate #include <m_collat.h> 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* 497c478bd9Sstevel@tonic-gate * constants and structure definitions used in MKS internal implementation 507c478bd9Sstevel@tonic-gate * 517c478bd9Sstevel@tonic-gate * -- used by strxfrm(), localedef. 527c478bd9Sstevel@tonic-gate */ 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* string length limitations */ 557c478bd9Sstevel@tonic-gate #define _M_COLLATE_MAX 32 /* max length of a collation string */ 567c478bd9Sstevel@tonic-gate #define _M_COTOM_MAX 4 /* max length of one to many map */ 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* forward, backward... -- or'ed into cmode */ 597c478bd9Sstevel@tonic-gate #define _M_FORWARD_MODE 1 /* compare based on string forward */ 607c478bd9Sstevel@tonic-gate #define _M_BACKWARD_MODE 2 /* compare based on string backward */ 617c478bd9Sstevel@tonic-gate #define _M_POSITION_MODE 4 /* consider relative position of non-IGNOREd */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* flags used in cord.cflag */ 647c478bd9Sstevel@tonic-gate #define _M_NOCOLLSTR 0 657c478bd9Sstevel@tonic-gate #define _M_MANYTOONEF 1 /* Potential many-to-one mapping in forward */ 667c478bd9Sstevel@tonic-gate #define _M_MANYTOONEB 2 /* Potential many-to-one mapping in backward */ 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* typedef's */ 697c478bd9Sstevel@tonic-gate typedef short _m_weight_t; 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* collate database file header */ 727c478bd9Sstevel@tonic-gate struct _m_cinfo { 737c478bd9Sstevel@tonic-gate int cnstr; /* number of collate strings */ 747c478bd9Sstevel@tonic-gate int cnotom; /* number of one to many maps */ 757c478bd9Sstevel@tonic-gate int cnweight; /* Number of weights in cmode */ 767c478bd9Sstevel@tonic-gate unsigned char cmode[COLL_WEIGHTS_MAX];/* order mode: forward... */ 777c478bd9Sstevel@tonic-gate struct _m_cstr *cstr; /* Pointer to collating strs */ 787c478bd9Sstevel@tonic-gate struct _m_cord *cord; /* weight tables */ 797c478bd9Sstevel@tonic-gate struct _m_cotom *cotom; /* one-to-many mapping tables */ 807c478bd9Sstevel@tonic-gate m_collel_t *cindex, /* index to range table map */ 817c478bd9Sstevel@tonic-gate *range; /* Range table */ 827c478bd9Sstevel@tonic-gate m_collel_t *equivo, /* equiv class offsets */ 837c478bd9Sstevel@tonic-gate *cequiv; /* equiv class table */ 847c478bd9Sstevel@tonic-gate }; 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate /* Per character and per collating-sequence structure */ 877c478bd9Sstevel@tonic-gate struct _m_cord { /* order */ 887c478bd9Sstevel@tonic-gate unsigned char cflag; /* =1, beginning of a collation string */ 897c478bd9Sstevel@tonic-gate _m_weight_t cweight[COLL_WEIGHTS_MAX]; /* relative weight */ 907c478bd9Sstevel@tonic-gate }; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /*l 937c478bd9Sstevel@tonic-gate * The _m_cstr structure is per many-to-one mapping (collating element from...) 947c478bd9Sstevel@tonic-gate * Pointed at by _m_cinfo.cstr, indexed by (m_collel_t - M_CSETSIZE). 957c478bd9Sstevel@tonic-gate * Stored both forwards and backwards to make it easy for strxfrm parsing 967c478bd9Sstevel@tonic-gate * for order_start backward. 977c478bd9Sstevel@tonic-gate */ 987c478bd9Sstevel@tonic-gate struct _m_cstr { /* collating-element */ 997c478bd9Sstevel@tonic-gate char csf[_M_COLLATE_MAX]; /* collating string forward */ 1007c478bd9Sstevel@tonic-gate char csb[_M_COLLATE_MAX]; /* collating string backward */ 1017c478bd9Sstevel@tonic-gate }; 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /*l 1047c478bd9Sstevel@tonic-gate * Per one-to-many mapping entry. A cweight entry in the _cord structure 1057c478bd9Sstevel@tonic-gate * which is negative, will index into this table. 1067c478bd9Sstevel@tonic-gate * Pointed at by _m_cinfo.cotom. 1077c478bd9Sstevel@tonic-gate */ 1087c478bd9Sstevel@tonic-gate struct _m_cotom { /* one to many map */ 1097c478bd9Sstevel@tonic-gate _m_weight_t weight[_M_COTOM_MAX]; 1107c478bd9Sstevel@tonic-gate }; 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #ifdef I18N 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate extern struct _m_cinfo _m_cinfo; 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #endif /* I18N */ 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate #endif /* __COLLATE_H_ */ 119