14297a3b0SGarrett D'Amore /* 2*bc09504fSGordon Ross * Copyright 2015 Nexenta Systmes, Inc. All rights reserved. 32d08521bSGarrett D'Amore * Copyright 2013 Garrett D'Amore <garrett@damore.org> 44297a3b0SGarrett D'Amore * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua> 54297a3b0SGarrett D'Amore * at Electronni Visti IA, Kiev, Ukraine. 64297a3b0SGarrett D'Amore * All rights reserved. 74297a3b0SGarrett D'Amore * 84297a3b0SGarrett D'Amore * Redistribution and use in source and binary forms, with or without 94297a3b0SGarrett D'Amore * modification, are permitted provided that the following conditions 104297a3b0SGarrett D'Amore * are met: 114297a3b0SGarrett D'Amore * 1. Redistributions of source code must retain the above copyright 124297a3b0SGarrett D'Amore * notice, this list of conditions and the following disclaimer. 134297a3b0SGarrett D'Amore * 2. Redistributions in binary form must reproduce the above copyright 144297a3b0SGarrett D'Amore * notice, this list of conditions and the following disclaimer in the 154297a3b0SGarrett D'Amore * documentation and/or other materials provided with the distribution. 164297a3b0SGarrett D'Amore * 174297a3b0SGarrett D'Amore * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND 184297a3b0SGarrett D'Amore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 194297a3b0SGarrett D'Amore * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 204297a3b0SGarrett D'Amore * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE 214297a3b0SGarrett D'Amore * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 224297a3b0SGarrett D'Amore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 234297a3b0SGarrett D'Amore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 244297a3b0SGarrett D'Amore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 254297a3b0SGarrett D'Amore * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 264297a3b0SGarrett D'Amore * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 274297a3b0SGarrett D'Amore * SUCH DAMAGE. 284297a3b0SGarrett D'Amore */ 294297a3b0SGarrett D'Amore 304297a3b0SGarrett D'Amore #ifndef _COLLATE_H_ 314297a3b0SGarrett D'Amore #define _COLLATE_H_ 324297a3b0SGarrett D'Amore 336b5e5868SGarrett D'Amore /* 34*bc09504fSGordon Ross * This file defines the libc interface to LC_COLLATE data. 356b5e5868SGarrett D'Amore */ 366b5e5868SGarrett D'Amore 37*bc09504fSGordon Ross #include <sys/types.h> 38*bc09504fSGordon Ross #include <limits.h> 39*bc09504fSGordon Ross #include "collatefile.h" 40*bc09504fSGordon Ross #include "localeimpl.h" 416b5e5868SGarrett D'Amore 42*bc09504fSGordon Ross /* 43*bc09504fSGordon Ross * This is the run-time (in-memory) form of LC_COLLATE data. 44*bc09504fSGordon Ross */ 452d08521bSGarrett D'Amore struct lc_collate { 462d08521bSGarrett D'Amore int lc_is_posix; 476b5e5868SGarrett D'Amore 482d08521bSGarrett D'Amore uint8_t lc_directive_count; 492d08521bSGarrett D'Amore uint8_t lc_directive[COLL_WEIGHTS_MAX]; 502d08521bSGarrett D'Amore int32_t lc_pri_count[COLL_WEIGHTS_MAX]; 512d08521bSGarrett D'Amore int32_t lc_flags; 522d08521bSGarrett D'Amore int32_t lc_chain_count; 532d08521bSGarrett D'Amore int32_t lc_large_count; 542d08521bSGarrett D'Amore int32_t lc_subst_count[COLL_WEIGHTS_MAX]; 552d08521bSGarrett D'Amore int32_t lc_undef_pri[COLL_WEIGHTS_MAX]; 562d08521bSGarrett D'Amore 572d08521bSGarrett D'Amore collate_info_t *lc_info; 582d08521bSGarrett D'Amore collate_char_t *lc_char_table; 592d08521bSGarrett D'Amore collate_large_t *lc_large_table; 602d08521bSGarrett D'Amore collate_chain_t *lc_chain_table; 612d08521bSGarrett D'Amore collate_subst_t *lc_subst_table[COLL_WEIGHTS_MAX]; 622d08521bSGarrett D'Amore }; 632d08521bSGarrett D'Amore 642d08521bSGarrett D'Amore void _collate_lookup(const struct lc_collate *, const wchar_t *, 652d08521bSGarrett D'Amore int *, int *, int, const int **); 662d08521bSGarrett D'Amore size_t _collate_wxfrm(const struct lc_collate *, const wchar_t *, 672d08521bSGarrett D'Amore wchar_t *, size_t); 682d08521bSGarrett D'Amore size_t _collate_sxfrm(const wchar_t *, char *, size_t, locale_t); 692d08521bSGarrett D'Amore int _collate_range_cmp(wchar_t, wchar_t, locale_t); 704297a3b0SGarrett D'Amore 714297a3b0SGarrett D'Amore #endif /* !_COLLATE_H_ */ 72