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/head/wctype.h
          +++ new/usr/src/head/wctype.h
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*      wctype.h        1.13 89/11/02 SMI; JLE  */
  23   23  /*      from AT&T JAE 2.1                       */
  24   24  /*      definitions for international functions */
  25   25  
  26   26  /*
       27 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  27   28   * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  28   29   * Use is subject to license terms.
  29   30   */
  30   31  
  31   32  #ifndef _WCTYPE_H
  32   33  #define _WCTYPE_H
  33   34  
  34      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  35      -
       35 +#include <sys/feature_tests.h>
  36   36  #include <iso/wctype_iso.h>
  37      -#if !defined(__XOPEN_OR_POSIX) && !defined(_STRICT_STDC) || \
  38      -        defined(__EXTENSIONS__)
       37 +#ifndef _STRICT_SYMBOLS
  39   38  #include <ctype.h>
  40   39  #include <wchar.h>
  41   40  #endif
  42   41  
  43   42  /*
  44   43   * Allow global visibility for symbols defined in
  45   44   * C++ "std" namespace in <iso/wctype_iso.h>.
  46   45   */
  47   46  #if __cplusplus >= 199711L
  48   47  using std::wint_t;
↓ open down ↓ 8 lines elided ↑ open up ↑
  57   56  using std::iswpunct;
  58   57  using std::iswspace;
  59   58  using std::iswupper;
  60   59  using std::iswxdigit;
  61   60  using std::towlower;
  62   61  using std::towupper;
  63   62  using std::wctrans;
  64   63  using std::towctrans;
  65   64  using std::iswctype;
  66   65  using std::wctype;
       66 +#if __cplusplus >= 201103L
       67 +using std::iswblank;
  67   68  #endif
       69 +#endif
  68   70  
  69      -/*
  70      - * This header needs to be included here because it relies on the global
  71      - * visibility of wint_t in the C++ environment.
  72      - */
  73      -
  74      -#include <iso/wctype_c99.h>
  75      -
  76   71  #ifdef  __cplusplus
  77   72  extern "C" {
  78   73  #endif
  79   74  
  80   75  /* do not allow any of the following in a strictly conforming application */
  81      -#if !defined(__XOPEN_OR_POSIX) && !defined(_STRICT_STDC) || \
  82      -        defined(__EXTENSIONS__)
       76 +#ifndef _STRICT_SYMBOLS
  83   77  
  84   78  /*
  85   79   * data structure for supplementary code set
  86   80   * for character class and conversion
  87   81   */
  88   82  struct  _wctype {
  89   83          wchar_t tmin;           /* minimum code for wctype */
  90   84          wchar_t tmax;           /* maximum code for wctype */
  91   85          unsigned char  *index;  /* class index */
  92   86          unsigned int   *type;   /* class type */
↓ open down ↓ 11 lines elided ↑ open up ↑
 104   98  #endif
 105   99  
 106  100  /* character classification functions */
 107  101  
 108  102  /* iswascii is still a macro */
 109  103  #define iswascii(c)     isascii(c)
 110  104  
 111  105  /* isw*, except iswascii(), are not macros any more.  They become functions */
 112  106  #ifdef __STDC__
 113  107  
 114      -extern  unsigned _iswctype(wchar_t, int);
 115      -extern  wchar_t _trwctype(wchar_t, int);
 116  108  /* is* also become functions */
 117  109  extern  int isphonogram(wint_t);
 118  110  extern  int isideogram(wint_t);
 119  111  extern  int isenglish(wint_t);
 120  112  extern  int isnumber(wint_t);
 121  113  extern  int isspecial(wint_t);
 122      -#else
      114 +/* From BSD/MacOS */
      115 +extern  int iswideogram(wint_t);
      116 +extern  int iswphonogram(wint_t);
      117 +extern  int iswnumber(wint_t);
      118 +extern  int iswhexnumber(wint_t);
      119 +extern  int iswspecial(wint_t);
 123  120  
 124      -extern  unsigned _iswctype();
 125      -extern  wchar_t _trwctype();
      121 +#else   /* __STDC__ */
      122 +
 126  123  /* is* also become functions */
 127  124  extern  int isphonogram();
 128  125  extern  int isideogram();
 129  126  extern  int isenglish();
 130  127  extern  int isnumber();
 131  128  extern  int isspecial();
      129 +/* From BSD/MacOS */
      130 +extern  int iswideogram();
      131 +extern  int iswphonogram();
      132 +extern  int iswnumber();
      133 +extern  int iswspecial();
 132  134  #endif
 133  135  
 134  136  #define iscodeset0(c)   isascii(c)
 135  137  #define iscodeset1(c)   (((c) & WCHAR_CSMASK) == WCHAR_CS1)
 136  138  #define iscodeset2(c)   (((c) & WCHAR_CSMASK) == WCHAR_CS2)
 137  139  #define iscodeset3(c)   (((c) & WCHAR_CSMASK) == WCHAR_CS3)
 138  140  
 139      -#endif /* !defined(__XOPEN_OR_POSIX)... */
      141 +#endif /* !defined(_STRICT_SYMBOLS)... */
 140  142  
      143 +
      144 +/* XPG7 extended locale support */
      145 +#if defined(_XPG7) || !defined(_STRICT_SYMBOLS)
      146 +
      147 +#ifndef _LOCALE_T
      148 +#define _LOCALE_T
      149 +typedef struct locale *locale_t;
      150 +#endif
      151 +
      152 +#if     defined(__STDC__)
      153 +extern wint_t towlower_l(wint_t, locale_t);
      154 +extern wint_t towupper_l(wint_t, locale_t);
      155 +extern wint_t towctrans_l(wint_t, wctrans_t, locale_t);
      156 +extern int iswctype_l(wint_t, wctype_t, locale_t);
      157 +extern int iswalnum_l(wint_t, locale_t);
      158 +extern int iswalpha_l(wint_t, locale_t);
      159 +extern int iswcntrl_l(wint_t, locale_t);
      160 +extern int iswdigit_l(wint_t, locale_t);
      161 +extern int iswgraph_l(wint_t, locale_t);
      162 +extern int iswlower_l(wint_t, locale_t);
      163 +extern int iswprint_l(wint_t, locale_t);
      164 +extern int iswpunct_l(wint_t, locale_t);
      165 +extern int iswspace_l(wint_t, locale_t);
      166 +extern int iswupper_l(wint_t, locale_t);
      167 +extern int iswxdigit_l(wint_t, locale_t);
      168 +extern wctrans_t wctrans_l(const char *, locale_t);
      169 +extern wctype_t wctype_l(const char *, locale_t);
      170 +#else   /* __STDC__ */
      171 +extern wint_t towlower_l();
      172 +extern wint_t towupper_l();
      173 +extern wint_t towctrans_l();
      174 +extern int iswctype_l();
      175 +extern int iswalnum_l();
      176 +extern int iswalpha_l();
      177 +extern int iswcntrl_l();
      178 +extern int iswdigit_l();
      179 +extern int iswgraph_l();
      180 +extern int iswlower_l();
      181 +extern int iswprint_l();
      182 +extern int iswpunct_l();
      183 +extern int iswspace_l();
      184 +extern int iswupper_l();
      185 +extern int iswxdigit_l();
      186 +extern wctrans_t wctrans_l();
      187 +extern wctype_t wctype_l();
      188 +#endif  /* __STDC__ */
      189 +#endif /* defined(_XPG7) || !defined(_STRICT_SYMBOLS) */
      190 +
 141  191  #ifdef  __cplusplus
 142  192  }
 143  193  #endif
 144  194  
 145  195  #endif  /* _WCTYPE_H */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX