home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / i18nv104.zip / INCLUDE / WCHAR.H < prev   
C/C++ Source or Header  |  1996-02-13  |  9KB  |  307 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. **/
  18. /** Constants NLS DataTypes and Constants
  19. *
  20. ** Notes:
  21. *
  22. *) The wchar_t datatype is 16-bits in this implementation, however the
  23. *  the X/OPEN XPG4 standard allows other sizes.
  24. **/
  25.  
  26. #ifndef __H_WCHAR
  27. #define __H_WCHAR
  28.  
  29. #include <errno.h>
  30. #include <stdarg.h>
  31. #include <limits.h>
  32. #include <stdio.h>
  33. #include <time.h>
  34. #include <stddef.h>
  35. #include <nl_types.h>
  36.  
  37. #ifndef     _WCTYPE_T
  38.     #define _WCTYPE_T
  39.       typedef unsigned int wctype_t;
  40. #endif
  41.  
  42.  
  43. #ifndef     _WINT_T
  44.     #define _WINT_T
  45.       typedef int wint_t;
  46. #endif
  47.  
  48.  
  49. #ifndef     fcvt                       /* floating point conversion */
  50.     #define fcvt _fcvt
  51. #endif
  52.  
  53. typedef unsigned  char  uchar_t;
  54. typedef unsigned short ushort_t;
  55. typedef unsigned   int   uint_t;
  56. typedef unsigned  long  ulong_t;
  57.  
  58. typedef   signed   int  ssize_t;
  59.  
  60. #define _ISALPHA  0x001
  61. #define _ISALNUM  0x002
  62. #define _ISBLANK  0x004
  63. #define _ISCNTRL  0x008
  64. #define _ISDIGIT  0x010
  65. #define _ISGRAPH  0x020
  66. #define _ISLOWER  0x040
  67. #define _ISPRINT  0x080
  68. #define _ISPUNCT  0x100
  69. #define _ISSPACE  0x200
  70. #define _ISUPPER  0x400
  71. #define _ISXDIGIT 0x800
  72.  
  73.  
  74. /** Error codes
  75. *
  76. ** Notes:
  77. *
  78. *      The ANSI, POSIX, and XOPEN standards require that certain values be
  79. *      in errno.h.  The standards allow additional macro definitions,
  80. *      beginning with an E and an uppercase letter.
  81. *
  82. **/
  83.  
  84.  
  85. extern int errno;
  86.  
  87. #undef EILSEQ
  88. #define EILSEQ         52
  89. #undef E2BIG
  90. #define E2BIG          53
  91. #undef ENAMETOOLONG
  92. #define ENAMETOOLONG    86      /* File name too long           */
  93. #define ECLONEME  ERESTART /* this is the way we clone a stream ... */
  94.  
  95. #define _IOUNGETWC  0x0008      /* UNGETWC flag mask            */
  96.  
  97. #define MB_MAX_LEN  4
  98.  
  99. #undef MB_LEN_MAX
  100. #define  MB_LEN_MAX 4
  101.  
  102. #undef MB_CUR_MAX
  103. #define MB_CUR_MAX (__getmbcurmax())
  104.  
  105. #ifndef EOF
  106.         #define EOF             (-1)
  107. #endif
  108.  
  109. #ifndef WEOF
  110.         #define WEOF             (-1)
  111. #endif
  112.  
  113. /** Prototypes **/
  114.  
  115. #ifdef __cplusplus
  116. extern "C" {
  117. #endif
  118.  
  119. extern int __getmbcurmax(void);
  120.  
  121. /***************************/
  122. /* Runtime Locale Function */
  123. /***************************/
  124. char * setlocale(int, const char *);
  125.  
  126.  
  127. /*************************************/
  128. /* Date, Time and Monetary Functions */
  129. /*************************************/
  130. size_t  strftime(char *s, size_t maxsize, const char *format,
  131.                  const struct tm *timeptr);
  132. ssize_t  strfmon(char *s, size_t maxsize, const char *format, ...);
  133. char *  strptime(const char *buf, const char *fmt, struct tm *tm);
  134. size_t  wcsftime(wchar_t *ws, size_t maxsize,
  135.                  const char *format, const struct tm *timeptr);
  136. double  wcstod ( const wchar_t *nptr, wchar_t **endptr );
  137. long    wcstol (const wchar_t *nptr, wchar_t **endptr, int base);
  138. unsigned long  wcstoul (const wchar_t *nptr, wchar_t **endptr, int base);
  139.  
  140. #undef    _strtodieee
  141. #define   _strtodieee _strtod
  142.  
  143. /* CSET++ defines strtod differently in <stdlib.h> than */
  144. /*  does CSET/2.  This requires the conditional define below.                 */
  145. #ifndef strtod
  146. #define strtod( p1, p2 )  _strtodieee( (p1), (p2) )
  147. #endif
  148.  
  149. /*********************************/
  150. /* String Manipulation Functions */
  151. /*********************************/
  152. size_t   wcscspn (const wchar_t *ws1, const wchar_t *ws2);
  153. size_t   wcslen  (const wchar_t *ws);
  154. wchar_t *wcscat  (wchar_t       *ws1, const wchar_t *ws2);
  155. wchar_t *wcscpy  (wchar_t       *ws1, const wchar_t *ws2);
  156. int      wcscmp  (const wchar_t *ws1, const wchar_t *ws2);
  157. int      wcsncmp (const wchar_t *ws1, const wchar_t *ws2, size_t n);
  158. wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
  159. wchar_t *wcsncpy (wchar_t       *ws1, const wchar_t *ws2, size_t n);
  160. size_t   wcsspn  (const wchar_t *ws1, const wchar_t *ws2);
  161. wchar_t *wcschr  (wchar_t       *ws1, wint_t         wc);
  162. wchar_t *wcsncat (wchar_t       *ws1, const wchar_t *ws2, size_t n);
  163. wchar_t *wcsrchr (wchar_t       *ws1, wint_t         wc);
  164. wchar_t *wcstok  (wchar_t       *ws1, const wchar_t *ws2);
  165. wchar_t *wcswcs  (const wchar_t *ws1, const wchar_t *ws2);
  166.  
  167. /***************************/
  168. /* Formatted I/O Functions */
  169. /***************************/
  170. #undef printf
  171. #undef sprintf
  172. #undef fprintf
  173. #undef vprintf
  174. #undef vsprintf
  175. #undef vfprintf
  176.  
  177. #define printf   wprintf
  178. #define sprintf  wsprintf
  179. #define fprintf  wfprintf
  180. #define vprintf   nls_vprintf
  181. #define vsprintf  nls_vsprintf
  182. #define vfprintf  nls_vfprintf
  183.  
  184. #undef scanf
  185. #undef sscanf
  186. #undef fscanf
  187.  
  188. #define scanf   wscanf
  189. #define sscanf  wsscanf
  190. #define fscanf  wfscanf
  191.  
  192. int  _xprint(char print_type, void * ostream, char * oformat,va_list oargs);
  193. int  _xscan(char scan_type, void * ostream, char * oformat, va_list oargs );
  194. double _strtod (const char *nptr, char **endptr);
  195. int  wprintf   (const char * oformat, ...);
  196. int  wsprintf  (char * ostring, const char * oformat, ...);
  197. int  wfprintf  (FILE * ostream, const char * oformat, ...);
  198. int  nls_vprintf (const char *format, va_list args);
  199. int  nls_vsprintf (char *outp, const char * format, va_list args);
  200. int  nls_vfprintf (FILE *outp, const char * format, va_list args);
  201. int  wscanf   (char * oformat, ...);
  202. int  wsscanf  (char * ostring, char * oformat, ...);
  203. int  wfscanf  (FILE * ostream, char * oformat, ...);
  204.  
  205. /**********************/
  206. /* File I/O Functions */
  207. /**********************/
  208. wint_t   fgetwc(FILE *stream);
  209. wchar_t *fgetws(wchar_t *s, int n, FILE *stream);
  210. wint_t   fputwc(const wint_t c, FILE *stream);
  211. int      fputws(const wchar_t *s,FILE *stream);
  212. int      getw(register FILE *stream);
  213. wint_t   getwc (FILE *stream);
  214. wint_t   getwchar (void);
  215. int      putw(int w, register FILE *stream);
  216. wint_t   putwc(wint_t c, FILE *stream);
  217. wint_t   putwchar(wint_t c);
  218. wint_t   ungetwc(wint_t c, FILE *stream);
  219.  
  220. /**********************************/
  221. /* Character Conversion Functions */
  222. /**********************************/
  223. size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
  224. int    mbtowc(wchar_t *pwc, const char *s, size_t len);
  225. int    mblen(const char *s, size_t n);
  226. int    wcswidth(wchar_t *wcs, size_t n);
  227. int    wctomb(char *s, wchar_t pwc);
  228. int    wcwidth(wchar_t wc);
  229. size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
  230.  
  231. /***********************/
  232. /* Collation Functions */
  233. /***********************/
  234. int strcoll(const char *s1, const char *s2);
  235. int wcscoll(const wchar_t *wcs1, const wchar_t *wcs2);
  236. size_t wcsxfrm(wchar_t *ws1, const wchar_t *ws2, size_t n);
  237. size_t strxfrm(char *s1, const char *s2, size_t n);
  238.  
  239. /*****************************************/
  240. /* Character Attribute Testing Functions */
  241. /*****************************************/
  242. #undef isalnum
  243. #undef isalpha
  244. #undef iscntrl
  245. #undef isdigit
  246. #undef isgraph
  247. #undef islower
  248. #undef isprint
  249. #undef ispunct
  250. #undef isspace
  251. #undef isupper
  252. #undef isxdigit
  253. int isalnum(int c);
  254. int isalpha(int c);
  255. int iscntrl(int c);
  256. int isdigit(int c);
  257. int isgraph(int c);
  258. int islower(int c);
  259. int isprint(int c);
  260. int ispunct(int c);
  261. int isspace(int c);
  262. int isupper(int c);
  263. int isxdigit(int c);
  264.  
  265. int iswalnum(wint_t pc);
  266. int iswalpha(wint_t pc);
  267. int iswcntrl(wint_t pc);
  268. int iswdigit(wint_t pc);
  269. int iswgraph(wint_t pc);
  270. int iswlower(wint_t pc);
  271. int iswprint(wint_t pc);
  272. int iswpunct(wint_t pc);
  273. int iswspace(wint_t pc);
  274. int iswupper(wint_t pc);
  275. int iswxdigit(wint_t pc);
  276. int iswctype(wint_t wc, wctype_t mask);
  277. wctype_t wctype(char *name);
  278.  
  279. #undef tolower
  280. #undef toupper
  281. int tolower(int c);
  282. int toupper(int c);
  283.  
  284. wint_t towlower(wint_t wc);
  285. wint_t towupper(wint_t wc);
  286.  
  287.  
  288. /**********************************************
  289. ** helper functions which work for 16/32 bit **
  290. **********************************************/
  291.  
  292. double get_i18n_version(void);
  293.  
  294.  
  295. #ifdef __cplusplus
  296. }
  297. #endif
  298.  
  299.  
  300. #ifdef   _OS2_CORE
  301.     #include <lc_core.h>
  302.     #include <locale.h>
  303.     #include <langinfo.h>
  304. #endif
  305.  
  306. #endif
  307.