Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/collate.h
          +++ new/usr/src/lib/libc/port/locale/collate.h
   1    1  /*
        2 + * Copyright 2013 Garrett D'Amore <garrett@damore.org>
   2    3   * Copyright 2010 Nexenta Systmes, Inc.  All rights reserved.
   3    4   * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
   4    5   *              at Electronni Visti IA, Kiev, Ukraine.
   5    6   *                      All rights reserved.
   6    7   *
   7    8   * Redistribution and use in source and binary forms, with or without
   8    9   * modification, are permitted provided that the following conditions
   9   10   * are met:
  10   11   * 1. Redistributions of source code must retain the above copyright
  11   12   *    notice, this list of conditions and the following disclaimer.
↓ open down ↓ 12 lines elided ↑ open up ↑
  24   25   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25   26   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26   27   * SUCH DAMAGE.
  27   28   */
  28   29  
  29   30  #ifndef _COLLATE_H_
  30   31  #define _COLLATE_H_
  31   32  
  32   33  #include <sys/types.h>
  33   34  #include <limits.h>
       35 +#include <locale.h>
       36 +#include "localeimpl.h"
  34   37  
  35   38  #define COLLATE_STR_LEN         24              /* should be 64-bit multiple */
  36   39  #define COLLATE_VERSION         "IllumosCollate2\n"
  37   40  
  38   41  #define COLLATE_MAX_PRIORITY    (0x7fffffff)    /* max signed value */
  39   42  #define COLLATE_SUBST_PRIORITY  (0x40000000)    /* bit indicates subst table */
  40   43  
  41   44  #define DIRECTIVE_UNDEF         0x00
  42   45  #define DIRECTIVE_FORWARD       0x01
  43   46  #define DIRECTIVE_BACKWARD      0x02
↓ open down ↓ 41 lines elided ↑ open up ↑
  85   88  typedef struct collate_large {
  86   89          int32_t val;
  87   90          collate_char_t pri;
  88   91  } collate_large_t;
  89   92  
  90   93  typedef struct collate_subst {
  91   94          int32_t key;
  92   95          int32_t pri[COLLATE_STR_LEN];
  93   96  } collate_subst_t;
  94   97  
  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);
       98 +struct lc_collate {
       99 +        int             lc_is_posix;
 100  100  
 101      -extern int _collate_load_error;
 102      -extern int _collate_substitute_nontrivial;
 103      -extern collate_info_t *_collate_info;
      101 +        uint8_t         lc_directive_count;
      102 +        uint8_t         lc_directive[COLL_WEIGHTS_MAX];
      103 +        int32_t         lc_pri_count[COLL_WEIGHTS_MAX];
      104 +        int32_t         lc_flags;
      105 +        int32_t         lc_chain_count;
      106 +        int32_t         lc_large_count;
      107 +        int32_t         lc_subst_count[COLL_WEIGHTS_MAX];
      108 +        int32_t         lc_undef_pri[COLL_WEIGHTS_MAX];
 104  109  
      110 +        collate_info_t  *lc_info;
      111 +        collate_char_t  *lc_char_table;
      112 +        collate_large_t *lc_large_table;
      113 +        collate_chain_t *lc_chain_table;
      114 +        collate_subst_t *lc_subst_table[COLL_WEIGHTS_MAX];
      115 +};
      116 +
      117 +void    _collate_lookup(const struct lc_collate *, const wchar_t *,
      118 +    int *, int *, int, const int **);
      119 +size_t  _collate_wxfrm(const struct lc_collate *, const wchar_t *,
      120 +    wchar_t *, size_t);
      121 +size_t  _collate_sxfrm(const wchar_t *, char *, size_t, locale_t);
      122 +int     _collate_range_cmp(wchar_t, wchar_t, locale_t);
      123 +
 105  124  #endif /* !_COLLATE_H_ */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX