home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / xpg4 / include / wchar.h < prev   
Encoding:
C/C++ Source or Header  |  1993-11-10  |  25.3 KB  |  836 lines

  1. /** WCHAR.H National Language Support OS2 Include File
  2. *.
  3. *.      (C) COPYRIGHT International Business Machines Corp. 1985, 1990
  4. *.      All Rights Reserved
  5. *.      Licensed Materials - Property of IBM
  6. *.
  7. *.      US Government Users Restricted Rights - Use, duplication or
  8. *.      disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *.
  10. ** Description:
  11. *
  12. *       The WCHAR.H file is part of the National Language Support
  13. *       system for OS/2 and AIX operating systems. Programmers
  14. *       interested in writing NLS enabled applications would include
  15. *       this file in their source files.
  16. *
  17. ** Notes:
  18. *
  19. *) For OS/2 development the NLS libraries must precede any C Set/2
  20. *  libraries, in order to supercede C Set/2 obsolete NLS routines.
  21. *
  22. *) For AIX development, this file is not needed since NLS is imbedded
  23. *  in all AIX system include files.
  24. *
  25. *) Future versions of C Set/2 will support this version of NLS and at
  26. *  that time this include file, and its associated libraries may be removed
  27. *  from the build process (the make file).
  28. *
  29. **/
  30. /** Constants NLS DataTypes and Constants
  31. *
  32. ** Notes:
  33. *
  34. *) The wchar_t datatype is 16-bits in this implementation, however the
  35. *  the X/OPEN XPG4 standard allows other sizes.
  36. **/
  37.  
  38. /*  Compiler specific defines/macros */
  39. #if (_MSC_VER >= 600)
  40.   #define _MSC 
  41.   #define SYSTEM _far _cdecl
  42.   #define OPTLINK _far _pascal
  43. #endif
  44.  
  45. #if (defined __IBMC__) || (defined __IBMCPP__)
  46.  #ifdef __32BIT__
  47.   #define _IBMC32
  48.   #define SYSTEM _System
  49.   #define OPTLINK _Optlink
  50.  #endif
  51. #endif
  52.  
  53. #ifndef __stdarg_h 
  54.   #include <stdarg.h>
  55. #endif         /* __stdarg_h */
  56.  
  57. #ifndef __stdio_h
  58.   #include <stdio.h>
  59. #endif         /* __stdio_h  */
  60.  
  61. #ifndef __time_h
  62.   #include <time.h>
  63. #endif         /* __time_h   */
  64.  
  65. #ifndef     NULL
  66.   #if (defined(__EXTENDED__) || defined(__cplusplus))
  67.     #define NULL 0
  68.   #else  
  69.     #define NULL ((void *)0)
  70.   #endif
  71. #endif
  72.  
  73. #ifndef     _SIZE_T                    /* preempt standard definition */
  74.     #define _SIZE_T
  75. #endif
  76.  
  77.  
  78. #ifndef     __size_t                   /* NLS definition */
  79.     #define __size_t
  80.       #ifndef _MSC
  81.        typedef unsigned long size_t;
  82.       #endif
  83. #endif
  84.  
  85. #ifndef     _WCHAR_T                   /* preempt standard definition */
  86.     #define _WCHAR_T
  87. #endif
  88.  
  89. #ifndef     __wchar_t                  /* NLS definition */
  90.     #define __wchar_t
  91.     typedef unsigned short wchar_t;
  92. #endif
  93.  
  94. #ifndef     _WCTYPE_T
  95.     #define _WCTYPE_T
  96.     #ifdef _MSC
  97.       typedef unsigned long wctype_t;
  98.     #else
  99.       typedef unsigned int wctype_t;
  100.     #endif
  101. #endif
  102.  
  103.  
  104. #ifndef     _WINT_T
  105.     #define _WINT_T
  106.     #ifdef _MSC
  107.       typedef long wint_t;
  108.     #else
  109.       typedef int wint_t;
  110.     #endif
  111. #endif
  112.  
  113.  
  114. #ifndef     fcvt                       /* floating point conversion */
  115.     #define fcvt _fcvt
  116. #endif
  117.  
  118. #ifndef     TRUE
  119.     #define TRUE 1
  120. #endif
  121.  
  122. #ifndef     FALSE
  123.     #define FALSE 0
  124. #endif
  125.  
  126. #define     True     TRUE
  127. #define     False     FALSE
  128. #define        FROM    0
  129. #define        TO        1
  130.  
  131.  
  132. #ifdef _MSC
  133.   typedef long nl_item;
  134. #else
  135.   typedef int nl_item;
  136. #endif
  137.  
  138.  
  139. typedef unsigned  char  uchar_t;
  140. typedef unsigned short ushort_t;
  141. typedef unsigned   int   uint_t;
  142. typedef unsigned  long  ulong_t;
  143.  
  144. #ifdef _MSC
  145.     typedef   signed   long  ssize_t;
  146. #else
  147.     typedef   signed   int  ssize_t;
  148. #endif 
  149.  
  150.  
  151. #define _ISALPHA  0x001
  152. #define _ISALNUM  0x002
  153. #define _ISBLANK  0x004
  154. #define _ISCNTRL  0x008
  155. #define _ISDIGIT  0x010
  156. #define _ISGRAPH  0x020
  157. #define _ISLOWER  0x040
  158. #define _ISPRINT  0x080
  159. #define _ISPUNCT  0x100
  160. #define _ISSPACE  0x200
  161. #define _ISUPPER  0x400
  162. #define _ISXDIGIT 0x800
  163.  
  164.  
  165. /** Error codes
  166. *
  167. ** Notes:
  168. *
  169. *      The ANSI, POSIX, and XOPEN standards require that certain values be
  170. *      in errno.h.  The standards allow additional macro definitions,
  171. *      beginning with an E and an uppercase letter.
  172. *
  173. **/
  174.  
  175.  
  176. #ifndef _MSC
  177.   extern int errno;
  178. #endif
  179.  
  180. #ifndef __errno_h
  181.  #define EBADF         9    /* Bad file descriptor        */
  182.  #define EINVAL        22    /* Invalid argument        */
  183.  #define ERANGE        34    /* Result too large        */
  184. #endif
  185.  
  186. #ifndef  ENOMEM
  187.  #define ENOMEM        12    /* Not enough space        */
  188. #endif
  189.  
  190. #define    E2BIG         7    /* Arg list too long        */
  191.  
  192. #define    ENAMETOOLONG    86    /* File name too long        */
  193. #define EILSEQ         116    /* Invalid wide character    */
  194. #define ECLONEME  ERESTART /* this is the way we clone a stream ... */
  195.  
  196. #define _IOUNGETWC  0x0008    /* UNGETWC flag mask        */
  197.  
  198. #define MB_MAX_LEN  4
  199.  
  200. #ifdef MB_LEN_MAX
  201.   #undef MB_LEN_MAX
  202. #endif
  203. #define  MB_LEN_MAX 4
  204.  
  205. #ifndef MB_CUR_MAX
  206.   #define MB_CUR_MAX 4
  207. #endif
  208.  
  209. /** Prototypes Available NLS Functions
  210. *
  211. ** Notes:
  212. *
  213. *) These functions are based on the X/OPEN XPG4 specification
  214. *
  215. **/
  216.  
  217. #ifdef __cplusplus
  218. extern "C" {
  219. #endif
  220.  
  221. #ifdef _MSC
  222.   #define setlocale(a,b) setlocale16(a,b)
  223.   char  _FAR_ * _far _cdecl setlocale16(short, const char _FAR_ *);
  224.  
  225.   #define strftime(a,b,c,d) strftime16(a,b,c,d)
  226.   size_t _far _cdecl strftime16(char  _FAR_ * s, 
  227.                 size_t maxsize, 
  228.                      const char _FAR_ * format, 
  229.                 const struct tm _FAR_ * timeptr);
  230.  
  231.   #define  strfmon  strfmon16
  232.   ssize_t  _far _cdecl strfmon16(char _FAR_ *s, 
  233.                 size_t maxsize, 
  234.                 const char _FAR_ *format, va_list _FAR_ va); 
  235.  
  236.   #define  strptime(buf,fmt,tm)  strptime16(buf,fmt,tm)
  237.   char  _FAR_ * _far _cdecl strptime16(const char _FAR_ *buf, 
  238.                 const char _FAR_ *fmt, 
  239.                 struct tm _FAR_ *tm);
  240.  
  241.   #define wcsftime(ws,maxsize,format,timeptr) wcsftime16(ws,maxsize,format,timeptr);
  242.   size_t _far _cdecl wcsftime16(wchar_t *ws, 
  243.                 size_t maxsize, 
  244.                      const char _FAR_ * format, 
  245.                 const struct tm _FAR_ * timeptr);
  246.  
  247.   #define  wcscspn(ws1,ws2) wcscspn16(ws1,ws2 )
  248.   size_t _far _cdecl  wcscspn16 (const wchar_t _FAR_ *ws1, 
  249.                  const wchar_t _FAR_ *ws2);
  250.  
  251.   #define  wcslen(ws)  wcslen16(ws)
  252.   size_t _far _cdecl  wcslen16  (const wchar_t _FAR_ *ws);
  253.  
  254.   #define  wcscat(ws1,ws2) wcscat16(ws1,ws2)
  255.   wchar_t  _FAR_ * _far _cdecl wcscat16  (wchar_t _FAR_ *ws1, 
  256.                   const wchar_t _FAR_ *ws2);
  257.  
  258.   #define  wcscpy(ws1,ws2) wcscpy16(ws1,ws2)
  259.   wchar_t  _FAR_ * _far _cdecl wcscpy16  (wchar_t _FAR_ *ws1, 
  260.                   const wchar_t _FAR_ *ws2);
  261.  
  262.   #define  wcscmp(ws1,ws2) wcscmp16(ws1,ws2)
  263.   short  _far _cdecl wcscmp16  (const wchar_t _FAR_ *ws1, 
  264.                 const wchar_t _FAR_ *ws2);
  265.  
  266.   #define  wcsncmp(ws1,ws2,n) wcsncmp16(ws1,ws2,n)
  267.   short  _far _cdecl wcsncmp16 (const wchar_t _FAR_ * ws1, 
  268.                 const wchar_t _FAR_ * ws2, 
  269.                 size_t n);
  270.  
  271.   #define wcspbrk(ws1,ws2) wcspbrk16(ws1,ws2)
  272.   wchar_t  _FAR_ * _far _cdecl wcspbrk (const wchar_t _FAR_ *ws1, 
  273.                 const wchar_t _FAR_ *ws2);
  274.  
  275.   #define wcsncpy(ws1,ws2,n)  wcsncpy16(ws1,ws2,n)
  276.   wchar_t  _FAR_ *_far _cdecl wcsncpy16 (wchar_t _FAR_ *ws1, 
  277.                   const wchar_t _FAR_ *ws2, 
  278.                   size_t n);
  279.  
  280.   #define wcsspn(ws1,ws2) wcsspn16(ws1,ws2)
  281.   size_t  _far _cdecl wcsspn16  (const wchar_t  _FAR_ *ws1, 
  282.                 const wchar_t  _FAR_ *ws2);
  283.  
  284.   #define wcschr(ws1,wc)  wcschr16(ws1,wc)
  285.   wchar_t  _FAR_ * _far _cdecl wcschr16 (wchar_t _FAR_ *ws1, 
  286.                  wint_t     wc);
  287.  
  288.   #define wcsncat(ws1,ws2,n)  wcsncat16(ws1,ws2,n) 
  289.   wchar_t  _FAR_ * _far _cdecl wcsncat16 (wchar_t _FAR_ *ws1, 
  290.                   const wchar_t _FAR_ *ws2, 
  291.                   size_t n);
  292.  
  293.   #define wcsrchr(ws1,wc)  wcsrchr16(ws1,wc)
  294.   wchar_t  _FAR_ * _far _cdecl wcsrchr16 (wchar_t _FAR_ *ws1, 
  295.                  wint_t     wc);
  296.  
  297.   #define wcstok(ws1,ws2)  wcstok16(ws1,ws2)
  298.   wchar_t  _FAR_ * _far _cdecl wcstok16  (wchar_t _FAR_ *ws1, 
  299.                   const wchar_t _FAR_ *ws2);
  300.  
  301.   #define wcswcs(ws1,ws2)  wcswcs16(ws1,ws2)
  302.   wchar_t  _FAR_ * _far _cdecl wcswcs16  (const wchar_t _FAR_ *ws1, 
  303.                   const wchar_t _FAR_ *ws2);
  304.  
  305.   #define wcstol(nptr,endptr,base)  wcstol16(nptr,endptr,base)
  306.   long int  _far _cdecl wcstol (const wchar_t _FAR_ *nptr, 
  307.                 wchar_t _FAR_ * _FAR_ *endptr, 
  308.                 short base);
  309.  
  310.   #define wcstoul(nptr,endptr,base)  wcstoul16(nptr,endptr,base)
  311.   unsigned long  _far _cdecl wcstoul16 (const wchar_t _FAR_ *nptr, 
  312.                     wchar_t _FAR_ *  _FAR_ *endptr, 
  313.                     short base);
  314.  
  315. #endif
  316.  
  317.  
  318. #ifdef _IBMC32
  319.   char * setlocale(int, const char *);
  320.   char * _Seg16 _Far16 _Cdecl setlocale16(short, const char * _Seg16);
  321.  
  322.   size_t strftime(char *s, size_t maxsize, const char *format,
  323.             const struct tm *timeptr);
  324.   short _Far16 _Cdecl strftime16(char * _Seg16 s, short maxsize, 
  325.              const char * _Seg16 format, const struct tm * _Seg16 timeptr);
  326.  
  327.   ssize_t strfmon(char *s, size_t maxsize, const char *format, ...); 
  328.  
  329.   ssize_t _Far16 _Cdecl strfmon16(char * _Seg16 s, 
  330.                 short maxsize, 
  331.                 const char * _Seg16 format, va_list _Seg16 va); 
  332.  
  333.   char * strptime(const char *buf, const char *fmt, struct tm *tm);
  334.   char * _Seg16 _Far16 _Cdecl strptime16(const char * _Seg16 buf, 
  335.                 const char * _Seg16 fmt, 
  336.                 struct tm * _Seg16 tm);
  337.  
  338.   size_t  wcsftime(wchar_t *ws, size_t maxsize,
  339.                  const char *format, const struct tm *timeptr);
  340.   short _Far16 _Cdecl wcsftime16(wchar_t * _Seg16 ws, 
  341.                 short maxsize,
  342.                              const char * _Seg16 format, 
  343.                 const struct tm * _Seg16 timeptr);
  344.  
  345.   size_t   wcscspn (const wchar_t *ws1, const wchar_t *ws2);
  346.   short _Far16 _Cdecl  wcscspn16 (const wchar_t * _Seg16 ws1, 
  347.                   const wchar_t * _Seg16 ws2);
  348.  
  349.   size_t   wcslen  (const wchar_t *ws);
  350.   short _Far16 _Cdecl  wcslen16  (const wchar_t * _Seg16 ws);
  351.  
  352.   wchar_t *wcscat  (wchar_t       *ws1, const wchar_t *ws2);
  353.   wchar_t * _Seg16 _Far16 _Cdecl  wcscat16  (wchar_t * _Seg16 ws1, 
  354.                              const wchar_t * _Seg16 ws2);
  355.  
  356.   wchar_t *wcscpy  (wchar_t       *ws1, const wchar_t *ws2);
  357.   wchar_t * _Seg16 _Far16 _Cdecl  wcscpy16  (wchar_t * _Seg16 ws1, 
  358.                          const wchar_t * _Seg16 ws2);
  359.  
  360.   int      wcscmp  (const wchar_t *ws1, const wchar_t *ws2);
  361.   short _Far16 _Cdecl wcscmp16 (const wchar_t * _Seg16 ws1, 
  362.                 const wchar_t * _Seg16 ws2);
  363.  
  364.   int      wcsncmp (const wchar_t *ws1, const wchar_t *ws2, size_t n);
  365.   short _Far16 _Cdecl wcsncmp16 (const wchar_t * _Seg16 ws1, 
  366.                  const wchar_t * _Seg16 ws2, 
  367.                  short n);
  368.  
  369.   wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
  370.   wchar_t * _Seg16 _Far16 _Cdecl wcspbrk16 (const wchar_t * _Seg16 ws1, 
  371.                         const wchar_t * _Seg16 ws2);
  372.  
  373.   wchar_t *wcsncpy (wchar_t       *ws1, const wchar_t *ws2, size_t n);
  374.   wchar_t * _Seg16 _Far16 _Cdecl wcsncpy16 (  wchar_t * _Seg16 ws1, 
  375.                     const wchar_t * _Seg16 ws2, 
  376.                     short n);
  377.  
  378.   size_t   wcsspn  (const wchar_t *ws1, const wchar_t *ws2);
  379.   short _Far16 _Cdecl wcsspn16  (const wchar_t * _Seg16 ws1, 
  380.                  const wchar_t * _Seg16 ws2);
  381.  
  382.   wchar_t *wcschr  (wchar_t       *ws1, wint_t         wc);
  383.   wchar_t * _Seg16 _Far16 _Cdecl wcschr16 (wchar_t * _Seg16 ws1, wint_t wc);
  384.  
  385.   wchar_t *wcsncat (wchar_t       *ws1, const wchar_t *ws2, size_t n);
  386.   wchar_t * _Seg16 _Far16 _Cdecl wcsncat16 (wchar_t * _Seg16 ws1, 
  387.                     const wchar_t * _Seg16 ws2, 
  388.                     short n);
  389.  
  390.   wchar_t *wcsrchr (wchar_t       *ws1, wint_t         wc);
  391.   wchar_t * _Seg16 _Far16 _Cdecl wcsrchr16 (wchar_t * _Seg16 ws1, wint_t wc);
  392.  
  393.   wchar_t *wcstok  (wchar_t       *ws1, const wchar_t *ws2);
  394.   wchar_t * _Seg16 _Far16 _Cdecl wcstok16  (wchar_t * _Seg16 ws1, 
  395.                      const wchar_t * _Seg16 ws2);
  396.  
  397.   wchar_t *wcswcs  (const wchar_t *ws1, const wchar_t *ws2);
  398.   wchar_t * _Seg16 _Far16 _Cdecl wcswcs16  (const wchar_t * _Seg16 ws1, 
  399.                          const wchar_t * _Seg16 ws2);
  400.  
  401.   long  wcstol (const wchar_t *nptr, wchar_t **endptr, int base);
  402.   long  _Far16 _Cdecl wcstol16 (const wchar_t * _Seg16 nptr, 
  403.                 wchar_t * _Seg16 * _Seg16 endptr, 
  404.                 short base);
  405.  
  406.   unsigned long  wcstoul (const wchar_t *nptr, wchar_t **endptr, int base);
  407.   unsigned long  _Far16 _Cdecl wcstoul16 (const wchar_t * _Seg16 nptr, 
  408.                 wchar_t * _Seg16 * _Seg16 endptr, 
  409.                 short base);
  410.  
  411. #endif
  412.  
  413.                        
  414.  #pragma checkout( suspend )              
  415.   #undef printf                           
  416.   #undef sprintf                          
  417.   #undef fprintf                          
  418.                                           
  419.   #define printf   wprintf                
  420.   #define sprintf  wsprintf               
  421.   #define fprintf  wfprintf     
  422.  
  423.   #undef scanf                           
  424.   #undef sscanf                          
  425.   #undef fscanf                          
  426.                                           
  427.   #define scanf   wscanf                
  428.   #define sscanf  wsscanf               
  429.   #define fscanf  wfscanf           
  430.  #pragma checkout( resume )
  431.  
  432.  int _xprint(char print_type, void * ostream, char * oformat,va_list oargs);
  433.  
  434.  int _xscan(char scan_type, void * ostream, char * oformat, va_list oargs );
  435.  
  436.  #ifdef _MSC
  437.  
  438.   #define wprintf  wprintf16
  439.   short _far _cdecl wprintf16   (char * _FAR_ oformat,...);
  440.  
  441.   #define wsprintf  wsprintf16
  442.   short _far _cdecl wsprintf16  (char * _FAR_ ostring, char * _FAR_ oformat, ...);
  443.  
  444.   #define wfprintf  wfprintf16
  445.   short _far _cdecl wfprintf16  (FILE * _FAR_ ostream, char * _FAR_ oformat, ...);
  446.  
  447.   #define wscanf  wscanf16
  448.   short _far _cdecl wscanf16   (char * _FAR_ oformat,...);
  449.  
  450.   #define wsscanf  wsscanf16
  451.   short _far _cdecl wsscanf16  (char * _FAR_ ostring, char * _FAR_ oformat, ...);
  452.  
  453.   #define wfscanf  wfscanf16
  454.   short _far _cdecl wfscanf16  (FILE * _FAR_ ostream, char * _FAR_ oformat, ...);
  455.  
  456.   #define fgetwc(stream)  fgetwc16(stream)
  457.   wint_t _far _cdecl      fgetwc16(FILE * _FAR_ stream);
  458.  
  459.   #define fgetws(s,n,stream) fgetws16(s,n,stream)
  460.   wchar_t _FAR_ * _far _cdecl fgetws16(wchar_t * _FAR_ s, int n, FILE * _FAR_ stream);
  461.  
  462.   #define fputwc(c,stream)  fputwc16(c,stream)
  463.   wint_t _far _cdecl fputwc16(const wint_t c, FILE * _FAR_ stream);
  464.  
  465.   #define fputws(s,stream) fputws16(s,stream)
  466.   int _far _cdecl fputws(const wchar_t * _FAR_ s,FILE * _FAR_ stream);
  467.  
  468.   #define getw(stream) getw16(stream)
  469.   int _far _cdecl  getw16(register FILE * _FAR_ stream);
  470.  
  471.   #define getwc(stream)  getwc16(stream)
  472.   wint_t _far _cdecl  getwc16 (stream);
  473.  
  474.   #define    getwchar  getwchar16
  475.   wint_t  _far _cdecl  getwchar16(void);
  476.  
  477.   #define    getws(s)  getws16(s)
  478.   wchar_t _FAR_ *  _far _cdecl  getws16(wchar_t * _FAR_ s);
  479.  
  480.   #define putw(w,stream) putw16(w,stream)
  481.   int _far _cdecl  putw16(int w, register FILE * _FAR_ stream);
  482.  
  483.   #define putwc(c,stream)  putwc16(c,stream)
  484.   wint_t _far _cdecl  putwc16(wint_t c, FILE * _FAR_ stream);
  485.  
  486.   #define putwchar(c)  putwchar16(c)
  487.   wint_t _far _cdecl  putwchar16(wint_t c);
  488.  
  489.   #define putws(s) putws16(s)
  490.   short _far _cdecl  putws16(const wchar_t * _FAR_ s);
  491.  
  492.   #define ungetwc(c,stream)  ungetwc16(c,stream)
  493.   wint_t _far _cdecl  ungetwc16(wint_t c, FILE * _FAR_ stream);
  494.  
  495.  
  496.  #define localeconv(void)  localeconv16(void)
  497.  struct lconv _FAR_ * _far _cdecl  localeconv16(void);
  498.  
  499.  #define nl_langinfo(item) nl_langinfo16(item)
  500.  char _FAR_ *  _far _cdecl  nl_langinfo16(nl_item item);
  501.  
  502.  #define mbstowcs(pwcs,s,n) mbstowcs16(pwcs,s,n)
  503.  short  _far _cdecl mbstowcs16(wchar_t * _FAR_ pwcs, 
  504.                 const char * _FAR_ s, short n);
  505.  
  506.  #define mbtowc(pwc,s,len) mbtowc16(pwc,s,len)
  507.  short  _far _cdecl mbtowc16(wchar_t * _FAR_ pwc, 
  508.                 const char * _FAR_ s, short len);
  509.  
  510.  #define mblen(s,n) mblen16(s,n)
  511.  short  _far _cdecl mblen16(const char * _FAR_ s, short n);
  512.  
  513.  #define wcswidth(wcs,n) wcswidth16(wcs,n)
  514.  short  _far _cdecl wcswidth16(wchar_t * _FAR_ wcs, short n);
  515.  
  516.  #define wctomb(s,pwc) wctomb16(s,pwc)
  517.  short  _far _cdecl wctomb16(char * _FAR_ s, wchar_t pwc);
  518.  
  519.  #define wcwidth(wc) wcwidth16(wc)
  520.  short  _far _cdecl wcwidth16(wchar_t wc);
  521.  
  522.  #define wcstombs(s,pwcs,n) wcstombs16(s,pwcs,n)
  523.  short  _far _cdecl wcstombs16(char * _FAR_ s, 
  524.                 const wchar_t * _FAR_ pwcs, short n);
  525.  
  526.  #define strcoll(s1,s2) strcoll16(s1,s2)
  527.  short  _far _cdecl strcoll16(const char * _FAR_ s1, 
  528.                 const char * _FAR_ s2);
  529.  
  530.  #define towlower(wc)  towlower16(wc)
  531.  wint_t  _far _cdecl towlower16(wint_t wc);
  532.  
  533.  #define wcscoll(wcs1,wcs2) wcscoll16(wcs1,wcs2)
  534.  short  _far _cdecl wcscoll16(const wchar_t * _FAR_ wcs1, 
  535.                 const wchar_t * _FAR_ wcs2);
  536.  
  537.  #define wcsxfrm(ws1,ws2,n) wcsxfrm16(ws1,ws2,n)
  538.  short  _far _cdecl wcsxfrm16(wchar_t * _FAR_ ws1, 
  539.                 const wchar_t * _FAR_ ws2, short n);
  540.  
  541.  #define isalnum(c) isalnum16(c)
  542.  #define isalpha(c) isalpha16(c)
  543.  #define iscntrl(c) iscntrl16(c)
  544.  #define isdigit(c) isdigit16(c)
  545.  #define isgraph(c) isgraph16(c)
  546.  #define islower(c) islower16(c)
  547.  #define isprint(c) isprint16(c)
  548.  #define ispunct(c) ispunct16(c)
  549.  #define isspace(c) isspace16(c) 
  550.  #define isupper(c) isupper16(c) 
  551.  #define iswalnum(pc) iswalnum16(pc) 
  552.  #define iswalpha(pc) iswalpha16(pc)
  553.  #define iswcntrl(pc) iswcntrl16(pc)
  554.  #define iswdigit(pc) iswdigit16(pc)
  555.  #define iswgraph(pc) iswgraph16(pc) 
  556.  #define iswlower(pc) iswlower16(pc)
  557.  #define iswprint(pc) iswprint16(pc) 
  558.  #define iswpunct(pc) iswpunct16(pc)
  559.  #define iswspace(pc) iswspace16(pc)
  560.  #define iswupper(pc) iswupper16(pc) 
  561.  #define iswxdigit(pc) iswxdigit16(pc) 
  562.  #define isxdigit(c) isxdigit16(c)
  563.  #define iswctype(wc,mask) is_wctype16(wc,mask)
  564.  
  565.  short  _far _cdecl  isalnum16(short c);
  566.  short  _far _cdecl  isalpha16(short c);
  567.  short  _far _cdecl  iscntrl16(short c);
  568.  short  _far _cdecl  isdigit16(short c);
  569.  short  _far _cdecl  isgraph16(short c);
  570.  short  _far _cdecl  islower16(short c);
  571.  short  _far _cdecl  isprint16(short c);
  572.  short  _far _cdecl  ispunct16(short c);
  573.  short  _far _cdecl  isspace16(short c);
  574.  short  _far _cdecl  isupper16(short c);
  575.  short  _far _cdecl  iswalnum16(wint_t pc);
  576.  short  _far _cdecl  iswalpha16(wint_t pc);
  577.  short  _far _cdecl  iswcntrl16(wint_t pc);
  578.  short  _far _cdecl  iswdigit16(wint_t pc);
  579.  short  _far _cdecl  iswgraph16(wint_t pc);
  580.  short  _far _cdecl  iswlower16(wint_t pc);
  581.  short  _far _cdecl  iswprint16(wint_t pc);
  582.  short  _far _cdecl  iswpunct16(wint_t pc);
  583.  short  _far _cdecl  iswspace16(wint_t pc);
  584.  short  _far _cdecl  iswupper16(wint_t pc);
  585.  short  _far _cdecl  iswxdigit16(wint_t pc);
  586.  short  _far _cdecl  isxdigit16(short c);
  587.  short  _far _cdecl  is_wctype16(wint_t wc, wctype_t mask);
  588.  
  589.  #define wctype(name) get_wctype16(name)
  590.  #define wcsid(wc) wcsid16(wc)
  591.  #define tolower(c) tolower16(c)
  592.  #define toupper(c) toupper16(c)
  593.  #define towlower(wc) towlower16(wc)
  594.  #define towupper(wc) towupper16(wc)
  595.  #define csid(mbs) csid16(mbs)
  596.  
  597.  wctype_t _far _cdecl get_wctype16(char * _FAR_ name);
  598.  short  _far _cdecl wcsid16(wchar_t wc);
  599.  short  _far _cdecl tolower16(short c);
  600.  short  _far _cdecl toupper16(short c);
  601.  wint_t _far _cdecl towlower16(wint_t wc);
  602.  wint_t _far _cdecl towupper16(wint_t wc);
  603.  short  _far _cdecl csid16(char * _FAR_ mbs);
  604.  
  605.  
  606.  #endif /* MSC */
  607.  
  608.  
  609.  #ifdef _IBMC32
  610.  
  611.   int  wprintf   (char * oformat, ...);
  612.  
  613.   short _Far16 _Cdecl  wprintf16   (char * _Seg16 oformat, ...);
  614.  
  615.   int  wsprintf  (char * ostring, char * oformat, ...);
  616.   short _Far16 _Cdecl  wsprintf16  (char * _Seg16 ostring, char * _Seg16 oformat, ...);
  617.  
  618.   int  wfprintf  (FILE * ostream, char * oformat, ...);
  619.  
  620.   int  wscanf   (char * oformat, ...);
  621.  
  622.   short _Far16 _Cdecl  wscanf16   (char * _Seg16 oformat, ...);
  623.  
  624.   int  wsscanf  (char * ostring, char * oformat, ...);
  625.   short _Far16 _Cdecl  wsscanf16  (char * _Seg16 ostring, char * _Seg16 oformat, ...);
  626.  
  627.   int  wfscanf  (FILE * ostream, char * oformat, ...);
  628.  
  629.   wint_t          fgetwc(FILE *stream);
  630.  
  631.   wchar_t *       fgetws(wchar_t *s, int n, FILE *stream);
  632.  
  633.   wint_t          fputwc(const wint_t c, FILE *stream);
  634.  
  635.   int             fputws(const wchar_t *s,FILE *stream);
  636.  
  637.   int             getw(register FILE *stream);
  638.  
  639.   wint_t          getwc (FILE *stream);
  640.  
  641.   wint_t          getwchar (void);
  642.   wint_t  _Far16 _Cdecl getwchar16(void);
  643.  
  644.   wchar_t *       getws(wchar_t *s);
  645.   wchar_t * _Far16 _Cdecl getws16(wchar_t * _Seg16 s);
  646.  
  647.   int             putw(int w, register FILE *stream);
  648.  
  649.   wint_t          putwc(wint_t c, FILE *stream);
  650.  
  651.   wint_t          putwchar(wint_t c);
  652.   short _Far16 _Cdecl  putwchar16(short c);
  653.  
  654.   int             putws(const wchar_t *s);
  655.   short _Far16 _Cdecl  putws16(const wchar_t * _Seg16 s);
  656.  
  657.   wint_t          ungetwc(wint_t c, FILE *stream);
  658.  
  659.  
  660.  struct lconv *  localeconv(void);
  661.  struct lconv * _Seg16 _Far16 _Cdecl  localeconv16(void);
  662.  
  663.  char *          nl_langinfo(nl_item item);
  664.  char * _Seg16  _Far16 _Cdecl  nl_langinfo16(nl_item item);
  665.  
  666.  size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
  667.  short  _Far16 _Cdecl mbstowcs16(wchar_t * _Seg16 pwcs, 
  668.                 const char * _Seg16 s, short n);
  669.  
  670.  int mbtowc(wchar_t *pwc, const char *s, size_t len);
  671.  short  _Far16 _Cdecl mbtowc16(wchar_t * _Seg16 pwc, 
  672.                 const char * _Seg16 s, short len);
  673.  
  674.  int mblen(const char *s, size_t n);
  675.  short  _Far16 _Cdecl mblen16(const char * _Seg16 s, short n);
  676.  
  677.  int wcswidth(wchar_t *wcs, size_t n);
  678.  short  _Far16 _Cdecl wcswidth16(wchar_t * _Seg16 wcs, short n);
  679.  
  680.  int wctomb(char *s, wchar_t pwc);
  681.  short  _Far16 _Cdecl wctomb16(char * _Seg16 s, wchar_t pwc);
  682.  
  683.  int wcwidth(wchar_t wc);
  684.  short  _Far16 _Cdecl wcwidth16(wchar_t wc);
  685.  
  686.  size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
  687.  short  _Far16 _Cdecl wcstombs16(char * _Seg16 s, 
  688.                 const wchar_t * _Seg16 pwcs, short n);
  689.  
  690.  int strcoll(const char *s1, const char *s2);
  691.  short _Far16 _Cdecl strcoll16(const char * _Seg16 s1, 
  692.                 const char * _Seg16 s2);
  693.  
  694.  wint_t towlower(wint_t wc);
  695.  wint_t  _Far16 _Cdecl towlower16(wint_t wc);
  696.  
  697.  int wcscoll(const wchar_t *wcs1, const wchar_t *wcs2);
  698.  short  _Far16 _Cdecl wcscoll16(const wchar_t * _Seg16 wcs1, 
  699.             const wchar_t * _Seg16 wcs2);
  700.  
  701.  size_t wcsxfrm(wchar_t *ws1, const wchar_t *ws2, size_t n);
  702.  short  _Far16 _Cdecl wcsxfrm16(wchar_t * _Seg16 ws1, 
  703.             const wchar_t * _Seg16 ws2, short n);
  704.  
  705.  int isalnum(int c);
  706.  int isalpha(int c);
  707.  int iscntrl(int c);
  708.  int isdigit(int c);
  709.  int isgraph(int c);
  710.  int islower(int c);
  711.  int isprint(int c);
  712.  int ispunct(int c);
  713.  int isspace(int c);
  714.  int isupper(int c);
  715.  int iswalnum(wint_t pc);
  716.  int iswalpha(wint_t pc);
  717.  int iswcntrl(wint_t pc);
  718.  int iswdigit(wint_t pc);
  719.  int iswgraph(wint_t pc);
  720.  int iswlower(wint_t pc);
  721.  int iswprint(wint_t pc);
  722.  int iswpunct(wint_t pc);
  723.  int iswspace(wint_t pc);
  724.  int iswupper(wint_t pc);
  725.  int iswxdigit(wint_t pc);
  726.  int isxdigit(int c);
  727.  int iswctype(wint_t wc, wctype_t mask);
  728.  
  729.  short _Far16 _Cdecl isalnum16(short c);
  730.  short _Far16 _Cdecl isalpha16(short c);
  731.  short _Far16 _Cdecl iscntrl16(short c);
  732.  short _Far16 _Cdecl isdigit16(short c);
  733.  short _Far16 _Cdecl isgraph16(short c);
  734.  short _Far16 _Cdecl islower16(short c);
  735.  short _Far16 _Cdecl isprint16(short c);
  736.  short _Far16 _Cdecl ispunct16(short c);
  737.  short _Far16 _Cdecl isspace16(short c);
  738.  short _Far16 _Cdecl isupper16(short c);
  739.  short _Far16 _Cdecl iswalnum16(wint_t pc);
  740.  short _Far16 _Cdecl iswalpha16(wint_t pc);
  741.  short _Far16 _Cdecl iswcntrl16(wint_t pc);
  742.  short _Far16 _Cdecl iswdigit16(wint_t pc);
  743.  short _Far16 _Cdecl iswgraph16(wint_t pc);
  744.  short _Far16 _Cdecl iswlower16(wint_t pc);
  745.  short _Far16 _Cdecl iswprint16(wint_t pc);
  746.  short _Far16 _Cdecl iswpunct16(wint_t pc);
  747.  short _Far16 _Cdecl iswspace16(wint_t pc);
  748.  short _Far16 _Cdecl iswupper16(wint_t pc);
  749.  short _Far16 _Cdecl iswxdigit16(wint_t pc);
  750.  short _Far16 _Cdecl isxdigit16(short c);
  751.  short _Far16 _Cdecl is_wctype16(wint_t wc, wctype_t mask);
  752.  
  753.  wctype_t wctype(char *name);
  754.  int wcsid(wchar_t wc);
  755.  int tolower(int c);
  756.  int toupper(int c);
  757.  wint_t towlower(wint_t wc);
  758.  wint_t towupper(wint_t wc);
  759.  int csid(char *mbs);
  760.  
  761.  wctype_t  _Far16 _Cdecl get_wctype16(char * _Seg16 name);
  762.  short _Far16 _Cdecl wcsid16(wchar_t wc);
  763.  short _Far16 _Cdecl tolower16(short c);
  764.  short _Far16 _Cdecl toupper16(short c);
  765.  wint_t   _Far16 _Cdecl towlower16(wint_t wc);
  766.  wint_t   _Far16 _Cdecl towupper16(wint_t wc);
  767.  short _Far16 _Cdecl csid16(char * _Seg16 mbs);
  768.  
  769. #endif  /* IBMC32 */
  770.  
  771.  
  772.     /******************************************************
  773.     ** replacement prototype for the AIX load subroutine **
  774.     ******************************************************/
  775.  
  776.     int *load(char *FilePath, int Flags, char *LibraryPath);
  777.  
  778.  
  779.  
  780. /*******************************************************
  781. * the following was added to support the cat functions *
  782. ********************************************************/
  783.  
  784. typedef struct _catalog_descriptor *nl_catd;
  785.  
  786. nl_catd catopen(const char *catname, int oflag);
  787. char *catgets(nl_catd catd, int setno, int msgno, const char *def);
  788. nl_catd _do_open(nl_catd);
  789. static FILE *opencatfile(char*);
  790. static void add_open_cat(nl_catd);
  791. static void cat_hard_close(nl_catd);    /*---- phyically closes the cat ----*/
  792. static nl_catd cat_already_open(char*);    /*---- used to see if the cat has
  793.                                                already been opened ----*/
  794. nl_catd NLcatopen(char *cat, int dummy);
  795.  
  796.  
  797.  
  798. #define ERR         (-1)
  799. #define TRUE         1
  800. #define FALSE         0
  801.  
  802. #define QTSTR        "$quote"
  803. #define SETSTR        "$set"
  804.  
  805. /* #define PATH_FORMAT "/usr/lpp/msg/%L/%N:/usr/lpp/msg/prime/%N" */
  806. #define PATH_C        "/usr/lpp/msg/C/%N"
  807. #define DEFAULT_LANG    "C"
  808.  
  809. #define MSGMIN        0
  810. #define MSGMAX         65535
  811. #define SETMIN        1
  812. #define SETMAX      65535
  813.  
  814. extern int errno;
  815. #define    RETURN(s)    return((errno = errno_save), s)
  816.  
  817. #define skip_to_white(s)     while (*s && *s > ' ') s++
  818. #define skip_to_nwhite(s)     while (*s && (*s == ' ' || *s == '\t')) s++
  819. #define die(s)            puts(s), exit(1)
  820.  
  821. char *NLgetamsg(char *cat, int setno, int msgno, char* def); 
  822.  
  823. /********************************************************/
  824.  
  825. #ifdef __cplusplus
  826. }
  827. #endif
  828.  
  829.  
  830. #ifdef   _OS2_CORE
  831.     #include <LC_CORE.H>
  832.     #include <LOCALE.H>
  833.     #include <LANGINFO.H>
  834.    /* #include <CATIO.H> */
  835. #endif
  836.