home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / include / wchar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  6.1 KB  |  212 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ifndef _WCHAR_H
  12. #define _WCHAR_H
  13. #ident    "@(#)sgs-head:common/head/wchar.h    1.18"
  14.  
  15. #ifndef _WCHAR_T
  16. #   define _WCHAR_T
  17.     typedef long    wchar_t;
  18. #endif
  19.  
  20. #if __STDC__ - 0 == 0 && !defined(_WUCHAR_T)
  21. #   define _WUCHAR_T
  22.     typedef unsigned long    wuchar_t;
  23. #endif
  24.  
  25. #ifndef _SIZE_T
  26. #   define _SIZE_T
  27.     typedef unsigned int    size_t;
  28. #endif
  29.  
  30. #ifndef _WINT_T
  31. #   define _WINT_T
  32.     typedef long    wint_t;
  33. #endif
  34.  
  35. #ifndef _MBSTATE_T
  36. #   define _MBSTATE_T
  37.     typedef struct
  38.     {
  39.         unsigned char    __rule[4];
  40.         wchar_t        __mbwc;
  41.         wchar_t        __mbst;
  42.     } mbstate_t;
  43. #endif
  44.  
  45. #ifndef NULL
  46. #   define NULL    0
  47. #endif
  48.  
  49. #ifndef WEOF
  50. #   define WEOF    (-1)
  51. #endif
  52.  
  53. struct _FILE_;        /* completed in <stdio.h> */
  54. struct tm;        /* completed in <time.h> */
  55.  
  56. #ifdef _XOPEN_SOURCE
  57. #include <stdio.h>    /* it requires FILE to be completed! */
  58. #include <wctype.h>    /* it specifies the older draft MSE */
  59. #else /*!_XOPEN_SOURCE*/
  60. #ifndef WCHAR_MAX
  61. #   define WCHAR_MAX    2147483647    /*INT_MAX*/
  62. #endif
  63. #ifndef WCHAR_MIN
  64. #   define WCHAR_MIN    (-2147483647-1)    /*INT_MIN*/
  65. #endif
  66. #endif /*_XOPEN_SOURCE*/
  67.  
  68. #ifndef _VA_LIST
  69. #   if #machine(i860)
  70.     struct _va_list
  71.     {
  72.         unsigned _ireg_used, _freg_used;
  73.         long    *_reg_base, *_mem_ptr;
  74.     };
  75. #    define _VA_LIST struct _va_list
  76. #   else
  77. #    define _VA_LIST void *
  78. #   endif
  79. #endif
  80.  
  81. #ifdef __cplusplus
  82. extern "C" {
  83. #endif
  84.  
  85. extern wint_t    fgetwc(struct _FILE_ *);
  86. extern wchar_t    *fgetws(wchar_t *, int, struct _FILE_ *);
  87. extern wint_t    fputwc(wint_t, struct _FILE_ *);
  88. extern int    fputws(const wchar_t *, struct _FILE_ *);
  89. extern wint_t    getwc(struct _FILE_ *);
  90. extern wint_t    getwchar(void);
  91. extern wint_t    putwc(wint_t, struct _FILE_ *);
  92. extern wint_t    putwchar(wint_t);
  93. extern wint_t    ungetwc(wint_t, struct _FILE_ *);
  94.  
  95. extern wchar_t    *wcscat(wchar_t *, const wchar_t *);
  96. extern wchar_t    *wcschr(const wchar_t *, wint_t);
  97. extern int    wcscmp(const wchar_t *, const wchar_t *);
  98. extern int    wcscoll(const wchar_t *, const wchar_t *);
  99. extern size_t    wcsxfrm(wchar_t *, const wchar_t *, size_t);
  100. extern wchar_t    *wcscpy(wchar_t *, const wchar_t *);
  101. extern size_t    wcscspn(const wchar_t *, const wchar_t *);
  102. extern size_t    wcslen(const wchar_t *);
  103. extern wchar_t    *wcsncat(wchar_t *, const wchar_t *, size_t);
  104. extern int    wcsncmp(const wchar_t *, const wchar_t *, size_t);
  105. extern wchar_t    *wcsncpy(wchar_t *, const wchar_t *, size_t);
  106. extern wchar_t    *wcspbrk(const wchar_t *, const wchar_t *);
  107. extern wchar_t    *wcsrchr(const wchar_t *, wint_t);
  108. extern size_t    wcsspn(const wchar_t *, const wchar_t *);
  109. extern wchar_t    *_wcstok(wchar_t *, const wchar_t *, wchar_t **);
  110. extern wchar_t    *wcsstr(const wchar_t *, const wchar_t *);
  111.  
  112. extern double    wcstod(const wchar_t *, wchar_t **);
  113.     /*LINTED*/
  114. extern float    wcstof(const wchar_t *, wchar_t **);
  115. extern long    wcstol(const wchar_t *, wchar_t **, int);
  116. long double    wcstold(const wchar_t *, wchar_t **);
  117. long long    wcstoll(const wchar_t *, wchar_t **, int);
  118. unsigned long    wcstoul(const wchar_t *, wchar_t **, int);
  119. unsigned long long wcstoull(const wchar_t *, wchar_t **, int);
  120. extern int    wcswidth(const wchar_t *, size_t);
  121.  
  122. #ifdef _XOPEN_SOURCE
  123.  
  124. static size_t
  125. wcsftime(wchar_t *__1, size_t __2, const char *__3, const struct tm *__4)
  126. {
  127.     extern size_t strftime(), mbstowcs();
  128.     char __5[1024]; /* probably big enough */
  129.     size_t __6;
  130.  
  131.     if (strftime(__5, sizeof(__5), __3, __4) == 0
  132.         || (__6 = mbstowcs(__1, __5, __2)) >= __2)
  133.     {
  134.         if (__2 != 0)
  135.             __1[0] = 0;
  136.         __6 = 0;
  137.     }
  138.     return __6;
  139. }
  140.  
  141. extern wchar_t    *__wcstok_ptr_;
  142.  
  143. static wchar_t *
  144. wcstok(wchar_t *__d, const wchar_t *__s) /* matches XPG4 spec. */
  145. {
  146.     return _wcstok(__d, __s, &__wcstok_ptr_);
  147. }
  148.  
  149. static wchar_t *
  150. wcswcs(const wchar_t *__s1, const wchar_t *__s2) /* XPG4 didn't change name */
  151. {
  152.     return wcsstr(__s1, __s2);
  153. }
  154.  
  155. extern int    wcwidth(wint_t);
  156. extern int    wcswidth(const wchar_t *, size_t);
  157.  
  158. #else /*!_XOPEN_SOURCE*/
  159.  
  160. extern size_t    wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *);
  161.  
  162. extern wchar_t    *wcstok(wchar_t *, const wchar_t *, wchar_t **);
  163.  
  164. extern int    fwide(struct _FILE_ *, int);
  165.         /*WPRINTFLIKE2*/
  166. extern int    fwprintf(struct _FILE_ *, const wchar_t *, ...);
  167.         /*WSCANFLIKE2*/
  168. extern int    fwscanf(struct _FILE_ *, const wchar_t *, ...);
  169.         /*WPRINTFLIKE1*/
  170. extern int    wprintf(const wchar_t *, ...);
  171.         /*WSCANFLIKE1*/
  172. extern int    wscanf(const wchar_t *, ...);
  173.         /*WPRINTFLIKE3*/
  174. extern int    swprintf(wchar_t *, size_t, const wchar_t *, ...);
  175.         /*WSCANFLIKE2*/
  176. extern int    swscanf(const wchar_t *, const wchar_t *, ...);
  177. extern int    vfwprintf(struct _FILE_ *, const wchar_t *, _VA_LIST);
  178. extern int    vwprintf(const wchar_t *, _VA_LIST);
  179. extern int    vswprintf(wchar_t *, size_t, const wchar_t *, _VA_LIST);
  180.  
  181. extern wint_t    btowc(int);
  182. extern int    wctob(wint_t);
  183. extern int    mbrlen(const char *, size_t, mbstate_t *);
  184. extern int    mbrtowc(wchar_t *, const char *, size_t, mbstate_t *);
  185. extern int    wcrtomb(char *, wchar_t, mbstate_t *);
  186. extern size_t    mbsrtowcs(wchar_t *, const char **, size_t, mbstate_t *);
  187. extern size_t    wcsrtombs(char *, const wchar_t **, size_t, mbstate_t *);
  188. extern int    mbsinit(const mbstate_t *);
  189.  
  190. #define mbrlen(x, n, p)    mbrtowc((wchar_t *)0, x, n, p)
  191.  
  192. extern wchar_t    *wmemchr(const wchar_t *, wchar_t, size_t);
  193. extern int    wmemcmp(const wchar_t *, const wchar_t *, size_t);
  194. extern wchar_t    *wmemcpy(wchar_t *, const wchar_t *, size_t);
  195. extern wchar_t    *wmemmove(wchar_t *, const wchar_t *, size_t);
  196. extern wchar_t    *wmemset(wchar_t *, wchar_t, size_t);
  197.  
  198. #endif /*_XOPEN_SOURCE*/
  199.  
  200. #if __STDC__ - 0 == 0 && !defined(_XOPEN_SOURCE)
  201. extern int    wcwidth(wint_t);
  202. extern int    vfwscanf(struct _FILE_ *, const wchar_t *, _VA_LIST);
  203. extern int    vwscanf(const wchar_t *, _VA_LIST);
  204. extern int    vswscanf(const wchar_t *, const wchar_t *, _VA_LIST);
  205. #endif
  206.  
  207. #ifdef __cplusplus
  208. }
  209. #endif
  210.  
  211. #endif /*_WCHAR_H*/
  212.