Print this page
2964 need POSIX 2008 locale object support


  15  *
  16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
  17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
  20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26  * SUCH DAMAGE.
  27  */
  28 
  29 #ifndef _COLLATE_H_
  30 #define _COLLATE_H_
  31 
  32 #include <sys/types.h>
  33 #include <limits.h>
  34 


  35 #define COLLATE_STR_LEN         24              /* should be 64-bit multiple */
  36 #define COLLATE_VERSION         "IllumosCollate2\n"
  37 
  38 #define COLLATE_MAX_PRIORITY    (0x7fffffff)    /* max signed value */
  39 #define COLLATE_SUBST_PRIORITY  (0x40000000)    /* bit indicates subst table */
  40 
  41 #define DIRECTIVE_UNDEF         0x00
  42 #define DIRECTIVE_FORWARD       0x01
  43 #define DIRECTIVE_BACKWARD      0x02
  44 #define DIRECTIVE_POSITION      0x04
  45 #define DIRECTIVE_UNDEFINED     0x08    /* special last weight for UNDEFINED */
  46 
  47 #define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
  48 
  49 /*
  50  * The collate file format is as follows:
  51  *
  52  * char         version[COLLATE_STR_LEN];       // must be COLLATE_VERSION
  53  * collate_info_t       info;                   // see below, includes padding
  54  * collate_char_pri_t   char_data[256];         // 8 bit char values


  75 
  76 typedef struct collate_char {
  77         int32_t pri[COLL_WEIGHTS_MAX];
  78 } collate_char_t;
  79 
  80 typedef struct collate_chain {
  81         wchar_t str[COLLATE_STR_LEN];
  82         int32_t pri[COLL_WEIGHTS_MAX];
  83 } collate_chain_t;
  84 
  85 typedef struct collate_large {
  86         int32_t val;
  87         collate_char_t pri;
  88 } collate_large_t;
  89 
  90 typedef struct collate_subst {
  91         int32_t key;
  92         int32_t pri[COLLATE_STR_LEN];
  93 } collate_subst_t;
  94 








  95 int     _collate_load_tables(const char *);
  96 void    _collate_lookup(const wchar_t *, int *, int *, int, int **);
  97 size_t  _collate_wxfrm(const wchar_t *, wchar_t *, size_t);
  98 size_t  _collate_sxfrm(const wchar_t *, char *, size_t);
  99 int     _collate_range_cmp(wchar_t, wchar_t);
 100 
 101 extern int _collate_load_error;
 102 extern int _collate_substitute_nontrivial;
 103 extern collate_info_t *_collate_info;
 104 
 105 #endif /* !_COLLATE_H_ */


  15  *
  16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
  17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
  20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26  * SUCH DAMAGE.
  27  */
  28 
  29 #ifndef _COLLATE_H_
  30 #define _COLLATE_H_
  31 
  32 #include <sys/types.h>
  33 #include <limits.h>
  34 
  35 #include "xlocale_private.h"
  36 
  37 #define COLLATE_STR_LEN         24              /* should be 64-bit multiple */
  38 #define COLLATE_VERSION         "IllumosCollate2\n"
  39 
  40 #define COLLATE_MAX_PRIORITY    (0x7fffffff)    /* max signed value */
  41 #define COLLATE_SUBST_PRIORITY  (0x40000000)    /* bit indicates subst table */
  42 
  43 #define DIRECTIVE_UNDEF         0x00
  44 #define DIRECTIVE_FORWARD       0x01
  45 #define DIRECTIVE_BACKWARD      0x02
  46 #define DIRECTIVE_POSITION      0x04
  47 #define DIRECTIVE_UNDEFINED     0x08    /* special last weight for UNDEFINED */
  48 
  49 #define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD)
  50 
  51 /*
  52  * The collate file format is as follows:
  53  *
  54  * char         version[COLLATE_STR_LEN];       // must be COLLATE_VERSION
  55  * collate_info_t       info;                   // see below, includes padding
  56  * collate_char_pri_t   char_data[256];         // 8 bit char values


  77 
  78 typedef struct collate_char {
  79         int32_t pri[COLL_WEIGHTS_MAX];
  80 } collate_char_t;
  81 
  82 typedef struct collate_chain {
  83         wchar_t str[COLLATE_STR_LEN];
  84         int32_t pri[COLL_WEIGHTS_MAX];
  85 } collate_chain_t;
  86 
  87 typedef struct collate_large {
  88         int32_t val;
  89         collate_char_t pri;
  90 } collate_large_t;
  91 
  92 typedef struct collate_subst {
  93         int32_t key;
  94         int32_t pri[COLLATE_STR_LEN];
  95 } collate_subst_t;
  96 
  97 struct xlocale_collate {
  98         struct xlocale_component header;
  99         int __collate_load_error;
 100         int __collate_substitute_nontrivial;
 101 
 102         /* XXX */
 103 };
 104 
 105 int     _collate_load_tables(const char *);
 106 void    _collate_lookup(const wchar_t *, int *, int *, int, int **);
 107 size_t  _collate_wxfrm(const wchar_t *, wchar_t *, size_t);
 108 size_t  _collate_sxfrm(const wchar_t *, char *, size_t);
 109 int     _collate_range_cmp(wchar_t, wchar_t);
 110 
 111 extern int _collate_load_error;
 112 extern int _collate_substitute_nontrivial;
 113 extern collate_info_t *_collate_info;
 114 
 115 #endif /* !_COLLATE_H_ */