1 /* 2 * Copyright (C) 2002 Marcus Overhagen 3 * All rights reserved. 4 * 5 * Distributed under the terms of the MIT license 6 */ 7 #ifndef _WCHAR_H 8 #define _WCHAR_H 9 10 #include <wchar_t.h> 11 #include <stdio.h> 12 13 #define _WINT_T 14 typedef unsigned int wint_t; 15 typedef int wctype_t; 16 17 typedef struct { 18 int __count; 19 wint_t __value; 20 } mbstate_t; 21 22 #include <size_t.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 extern wint_t fgetwc(FILE *); 29 extern wchar_t *fgetws(wchar_t *, int, FILE *); 30 extern wint_t fputwc(wchar_t, FILE *); 31 extern int fputws(const wchar_t *, FILE *); 32 extern wint_t getwc(FILE *); 33 extern wint_t getwchar(void); 34 35 extern int iswalnum(wint_t); 36 extern int iswalpha(wint_t); 37 extern int iswcntrl(wint_t); 38 extern int iswdigit(wint_t); 39 extern int iswgraph(wint_t); 40 extern int iswlower(wint_t); 41 extern int iswprint(wint_t); 42 extern int iswpunct(wint_t); 43 extern int iswspace(wint_t); 44 extern int iswupper(wint_t); 45 extern int iswxdigit(wint_t); 46 extern int iswctype(wint_t, wctype_t); 47 48 extern wint_t putwc(wchar_t, FILE *); 49 extern wint_t putwchar(wchar_t); 50 51 extern size_t mbrlen(const char *s, size_t n, mbstate_t *ps); 52 extern size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); 53 extern size_t mbsrtowcs(wchar_t *dst, const char **src, size_t len, 54 mbstate_t *ps); 55 extern int mbsinit(const mbstate_t *); 56 57 extern wint_t towlower(wint_t); 58 extern wint_t towupper(wint_t); 59 extern wint_t ungetwc(wint_t, FILE *); 60 61 extern size_t wcrtomb(char *, wchar_t, mbstate_t *); 62 extern wchar_t *wcscat(wchar_t *, const wchar_t *); 63 extern wchar_t *wcschr(const wchar_t *, wchar_t); 64 extern int wcscmp(const wchar_t *ws1, const wchar_t *ws2); 65 extern int wcscoll(const wchar_t *ws1, const wchar_t *ws2); 66 extern wchar_t *wcscpy(wchar_t *, const wchar_t *); 67 extern size_t wcscspn(const wchar_t *, const wchar_t *); 68 extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, 69 const struct tm *); 70 extern size_t wcslen(const wchar_t *); 71 extern wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t); 72 extern int wcsncmp(const wchar_t *, const wchar_t *, size_t); 73 extern wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t); 74 extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *); 75 extern wchar_t *wcsrchr(const wchar_t *, wchar_t); 76 extern size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, 77 mbstate_t *ps); 78 extern size_t wcsspn(const wchar_t *, const wchar_t *); 79 extern double wcstod(const wchar_t *, wchar_t **); 80 extern wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **); 81 extern long int wcstol(const wchar_t *, wchar_t **, int); 82 extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int); 83 extern wchar_t *wcswcs(const wchar_t *, const wchar_t *); 84 extern int wcswidth(const wchar_t *, size_t); 85 extern size_t wcsxfrm(wchar_t *, const wchar_t *, size_t); 86 extern wctype_t wctype(const char *); 87 extern int wcwidth(wchar_t); 88 89 #ifdef __cplusplus 90 } 91 #endif 92 93 #define WEOF ((wint_t)(-1)) 94 95 #endif /* _WCHAR_H */ 96