1e48a877cSbeveloper /* 21d19f96fSMarcus Overhagen * Copyright 2008 Haiku Inc. All Rights Reserved. 31d19f96fSMarcus Overhagen * Distributed under the terms of the MIT License. 4e48a877cSbeveloper */ 50cb1c46aSshatty #ifndef _WCHAR_H 60cb1c46aSshatty #define _WCHAR_H 7e48a877cSbeveloper 8404a0feaSIngo Weinhold #include <stddef.h> 9e589b330SAxel Dörfler #include <stdio.h> 100cb1c46aSshatty 11b9320128SIngo Weinhold /* stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does. 12b9320128SIngo Weinhold * In all other cases we will do that. */ 13404a0feaSIngo Weinhold #ifndef _WINT_T 14abd010bcSJérôme Duval #define _WINT_T 15404a0feaSIngo Weinhold 16404a0feaSIngo Weinhold #ifndef __WINT_TYPE__ 17404a0feaSIngo Weinhold #define __WINT_TYPE__ unsigned int 18404a0feaSIngo Weinhold #endif 19404a0feaSIngo Weinhold 20404a0feaSIngo Weinhold typedef __WINT_TYPE__ wint_t; 21404a0feaSIngo Weinhold 22b9320128SIngo Weinhold #endif /* _WINT_T */ 23404a0feaSIngo Weinhold 24a34963f3SJérôme Duval typedef int wctype_t; 25abd010bcSJérôme Duval 26abd010bcSJérôme Duval typedef struct { 27abd010bcSJérôme Duval int __count; 28abd010bcSJérôme Duval wint_t __value; 29abd010bcSJérôme Duval } mbstate_t; 30abd010bcSJérôme Duval 310cb1c46aSshatty 32*510c100aSOliver Tappe #define WEOF ((wint_t)(-1)) 33*510c100aSOliver Tappe 34*510c100aSOliver Tappe #define WCHAR_MIN 0x00000000UL 35*510c100aSOliver Tappe #define WCHAR_MAX 0x7FFFFFFFUL 36*510c100aSOliver Tappe 37*510c100aSOliver Tappe 3830589be5SIngo Weinhold #ifdef __cplusplus 3930589be5SIngo Weinhold extern "C" { 4030589be5SIngo Weinhold #endif 4130589be5SIngo Weinhold 42*510c100aSOliver Tappe extern wint_t btowc(int); 43*510c100aSOliver Tappe 44a34963f3SJérôme Duval extern wint_t fgetwc(FILE *); 45a34963f3SJérôme Duval extern wchar_t *fgetws(wchar_t *, int, FILE *); 46a34963f3SJérôme Duval extern wint_t fputwc(wchar_t, FILE *); 47a34963f3SJérôme Duval extern int fputws(const wchar_t *, FILE *); 48*510c100aSOliver Tappe extern int fwide(FILE *, int); 49*510c100aSOliver Tappe extern int fwprintf(FILE *, const wchar_t *, ...); 50*510c100aSOliver Tappe /*extern int fwscanf(FILE *, const wchar_t *, ...);*/ 51a34963f3SJérôme Duval extern wint_t getwc(FILE *); 52a34963f3SJérôme Duval extern wint_t getwchar(void); 53a34963f3SJérôme Duval 54a34963f3SJérôme Duval extern int iswalnum(wint_t); 55a34963f3SJérôme Duval extern int iswalpha(wint_t); 56a34963f3SJérôme Duval extern int iswcntrl(wint_t); 57*510c100aSOliver Tappe extern int iswctype(wint_t, wctype_t); 58a34963f3SJérôme Duval extern int iswdigit(wint_t); 59a34963f3SJérôme Duval extern int iswgraph(wint_t); 60a34963f3SJérôme Duval extern int iswlower(wint_t); 61a34963f3SJérôme Duval extern int iswprint(wint_t); 62a34963f3SJérôme Duval extern int iswpunct(wint_t); 63a34963f3SJérôme Duval extern int iswspace(wint_t); 64a34963f3SJérôme Duval extern int iswupper(wint_t); 65a34963f3SJérôme Duval extern int iswxdigit(wint_t); 66*510c100aSOliver Tappe 67*510c100aSOliver Tappe extern size_t mbrlen(const char *s, size_t n, mbstate_t *ps); 68*510c100aSOliver Tappe extern size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps); 69*510c100aSOliver Tappe extern int mbsinit(const mbstate_t *); 70*510c100aSOliver Tappe extern size_t mbsrtowcs(wchar_t *dst, const char **src, size_t len, 71*510c100aSOliver Tappe mbstate_t *ps); 72a34963f3SJérôme Duval 73a34963f3SJérôme Duval extern wint_t putwc(wchar_t, FILE *); 74a34963f3SJérôme Duval extern wint_t putwchar(wchar_t); 75a34963f3SJérôme Duval 76*510c100aSOliver Tappe extern int swprintf(wchar_t *, size_t, const wchar_t *, ...); 77*510c100aSOliver Tappe /*extern int swscanf(const wchar_t *, const wchar_t *, ...);*/ 78a34963f3SJérôme Duval 79a34963f3SJérôme Duval extern wint_t towlower(wint_t); 80a34963f3SJérôme Duval extern wint_t towupper(wint_t); 81a34963f3SJérôme Duval extern wint_t ungetwc(wint_t, FILE *); 82a34963f3SJérôme Duval 83*510c100aSOliver Tappe extern int vfwprintf(FILE *, const wchar_t *, va_list); 84*510c100aSOliver Tappe /*extern int vfwscanf(FILE *, const wchar_t *, va_list);*/ 85*510c100aSOliver Tappe extern int vswprintf(wchar_t *, size_t, const wchar_t *, va_list); 86*510c100aSOliver Tappe /*extern int vswscanf(const wchar_t *, const wchar_t *, va_list);*/ 87*510c100aSOliver Tappe extern int vwprintf(const wchar_t *, va_list); 88*510c100aSOliver Tappe /*extern int vwscanf(const wchar_t *, va_list);*/ 89*510c100aSOliver Tappe 90a34963f3SJérôme Duval extern size_t wcrtomb(char *, wchar_t, mbstate_t *); 91a34963f3SJérôme Duval extern wchar_t *wcscat(wchar_t *, const wchar_t *); 92a34963f3SJérôme Duval extern wchar_t *wcschr(const wchar_t *, wchar_t); 93a34963f3SJérôme Duval extern int wcscmp(const wchar_t *ws1, const wchar_t *ws2); 94a34963f3SJérôme Duval extern int wcscoll(const wchar_t *ws1, const wchar_t *ws2); 95a34963f3SJérôme Duval extern wchar_t *wcscpy(wchar_t *, const wchar_t *); 96a34963f3SJérôme Duval extern size_t wcscspn(const wchar_t *, const wchar_t *); 97a34963f3SJérôme Duval extern size_t wcsftime(wchar_t *, size_t, const wchar_t *, 98a34963f3SJérôme Duval const struct tm *); 99a34963f3SJérôme Duval extern size_t wcslen(const wchar_t *); 100a34963f3SJérôme Duval extern wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t); 101a34963f3SJérôme Duval extern int wcsncmp(const wchar_t *, const wchar_t *, size_t); 102a34963f3SJérôme Duval extern wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t); 103a34963f3SJérôme Duval extern wchar_t *wcspbrk(const wchar_t *, const wchar_t *); 104a34963f3SJérôme Duval extern wchar_t *wcsrchr(const wchar_t *, wchar_t); 105a34963f3SJérôme Duval extern size_t wcsrtombs(char *dst, const wchar_t **src, size_t len, 106e0f9a4e8SJérôme Duval mbstate_t *ps); 107a34963f3SJérôme Duval extern size_t wcsspn(const wchar_t *, const wchar_t *); 108a34963f3SJérôme Duval extern double wcstod(const wchar_t *, wchar_t **); 109*510c100aSOliver Tappe extern float wcstof(const wchar_t *, wchar_t **); 110a34963f3SJérôme Duval extern wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **); 111a34963f3SJérôme Duval extern long int wcstol(const wchar_t *, wchar_t **, int); 112*510c100aSOliver Tappe extern long double wcstold(const wchar_t *, wchar_t **); 113*510c100aSOliver Tappe extern long long wcstoll(const wchar_t *, wchar_t **, int); 114*510c100aSOliver Tappe extern unsigned long wcstoul(const wchar_t *, wchar_t **, int); 115*510c100aSOliver Tappe extern unsigned long long wcstoull(const wchar_t *, wchar_t **, int); 116a34963f3SJérôme Duval extern unsigned long int wcstoul(const wchar_t *, wchar_t **, int); 117a34963f3SJérôme Duval extern wchar_t *wcswcs(const wchar_t *, const wchar_t *); 118a34963f3SJérôme Duval extern int wcswidth(const wchar_t *, size_t); 119a34963f3SJérôme Duval extern size_t wcsxfrm(wchar_t *, const wchar_t *, size_t); 120*510c100aSOliver Tappe extern int wctob(wint_t); 121a34963f3SJérôme Duval extern wctype_t wctype(const char *); 122a34963f3SJérôme Duval extern int wcwidth(wchar_t); 123*510c100aSOliver Tappe extern wchar_t *wmemchr(const wchar_t *, wchar_t, size_t); 124*510c100aSOliver Tappe extern int wmemcmp(const wchar_t *, const wchar_t *, size_t); 125*510c100aSOliver Tappe extern wchar_t *wmemcpy(wchar_t *, const wchar_t *, size_t); 126*510c100aSOliver Tappe extern wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); 127*510c100aSOliver Tappe extern wchar_t *wmemset(wchar_t *, wchar_t, size_t); 128*510c100aSOliver Tappe extern int wprintf(const wchar_t *, ...); 129*510c100aSOliver Tappe /*extern int wscanf(const wchar_t *, ...);*/ 130e0f9a4e8SJérôme Duval 13130589be5SIngo Weinhold #ifdef __cplusplus 13230589be5SIngo Weinhold } 13330589be5SIngo Weinhold #endif 13430589be5SIngo Weinhold 1350cb1c46aSshatty #endif /* _WCHAR_H */ 136