2002-10-23 22:47:12 +04:00
|
|
|
/*
|
2011-05-30 22:44:22 +04:00
|
|
|
* Copyright 2008-2011 Haiku Inc. All Rights Reserved.
|
2008-08-19 23:28:41 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
2002-10-23 22:47:12 +04:00
|
|
|
*/
|
2003-12-30 10:37:08 +03:00
|
|
|
#ifndef _WCHAR_H
|
|
|
|
#define _WCHAR_H
|
2002-10-23 22:47:12 +04:00
|
|
|
|
2009-11-09 11:43:32 +03:00
|
|
|
|
2011-11-22 20:23:04 +04:00
|
|
|
#include <limits.h>
|
2008-03-16 20:21:37 +03:00
|
|
|
#include <stddef.h>
|
2006-03-16 17:42:04 +03:00
|
|
|
#include <stdio.h>
|
2003-12-30 10:37:08 +03:00
|
|
|
|
2009-11-09 11:43:32 +03:00
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
/* stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does.
|
|
|
|
* In all other cases we will do that. */
|
2008-03-16 20:21:37 +03:00
|
|
|
#ifndef _WINT_T
|
2005-02-22 21:06:35 +03:00
|
|
|
#define _WINT_T
|
2008-03-16 20:21:37 +03:00
|
|
|
|
|
|
|
#ifndef __WINT_TYPE__
|
|
|
|
#define __WINT_TYPE__ unsigned int
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef __WINT_TYPE__ wint_t;
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
#endif /* _WINT_T */
|
2008-03-16 20:21:37 +03:00
|
|
|
|
2006-03-16 14:09:43 +03:00
|
|
|
typedef int wctype_t;
|
2005-02-22 21:06:35 +03:00
|
|
|
|
|
|
|
typedef struct {
|
2011-12-15 16:10:26 +04:00
|
|
|
void* converter;
|
|
|
|
char charset[64];
|
2011-11-22 20:23:04 +04:00
|
|
|
unsigned int count;
|
2011-12-15 16:10:26 +04:00
|
|
|
char data[1024 + 8]; // 1024 bytes for data, 8 for alignment space
|
2005-02-22 21:06:35 +03:00
|
|
|
} mbstate_t;
|
|
|
|
|
2003-12-30 10:37:08 +03:00
|
|
|
|
2009-06-22 23:48:36 +04:00
|
|
|
#define WEOF ((wint_t)(-1))
|
|
|
|
|
|
|
|
#define WCHAR_MIN 0x00000000UL
|
|
|
|
#define WCHAR_MAX 0x7FFFFFFFUL
|
|
|
|
|
2010-07-24 03:13:00 +04:00
|
|
|
/*
|
|
|
|
* Haiku is always using UTF32 in wchars, other encodings can be handled
|
2011-12-07 20:52:20 +04:00
|
|
|
* by converting to/from wchar by means of mbrtowc() or wcrtomb().
|
2010-07-24 03:13:00 +04:00
|
|
|
*/
|
|
|
|
|
2009-06-22 23:48:36 +04:00
|
|
|
|
2007-03-04 05:31:43 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2009-06-22 23:48:36 +04:00
|
|
|
extern wint_t btowc(int);
|
|
|
|
|
2012-01-08 01:02:48 +04:00
|
|
|
extern wint_t fgetwc(FILE *stream);
|
|
|
|
extern wchar_t *fgetws(wchar_t *dest, int destLength, FILE *stream);
|
|
|
|
extern wint_t fputwc(wchar_t wc, FILE *stream);
|
|
|
|
extern int fputws(const wchar_t *wcs, FILE *stream);
|
|
|
|
extern int fwide(FILE *stream, int mode);
|
|
|
|
extern int fwprintf(FILE *stream, const wchar_t *format, ...);
|
|
|
|
extern int fwscanf(FILE *stream, const wchar_t *format, ...);
|
|
|
|
extern wint_t getwc(FILE *stream);
|
2006-03-16 14:09:43 +03:00
|
|
|
extern wint_t getwchar(void);
|
|
|
|
|
2012-01-08 01:02:48 +04:00
|
|
|
extern size_t mbrlen(const char *s, size_t n, mbstate_t *mbState);
|
2012-01-08 02:51:04 +04:00
|
|
|
extern size_t mbrtowc(wchar_t *dest, const char *src, size_t srcLength,
|
2012-01-08 01:02:48 +04:00
|
|
|
mbstate_t *mbState);
|
|
|
|
extern int mbsinit(const mbstate_t *mbState);
|
|
|
|
extern size_t mbsnrtowcs(wchar_t *dest, const char **src, size_t srcLength,
|
|
|
|
size_t destLength, mbstate_t *mbState);
|
|
|
|
extern size_t mbsrtowcs(wchar_t *dest, const char **src, size_t destLength,
|
|
|
|
mbstate_t *mbState);
|
|
|
|
|
|
|
|
extern wint_t putwc(wchar_t wc, FILE *stream);
|
|
|
|
extern wint_t putwchar(wchar_t wc);
|
|
|
|
|
|
|
|
extern int swprintf(wchar_t *dest, size_t destLength,
|
|
|
|
const wchar_t *format, ...);
|
|
|
|
extern int swscanf(const wchar_t *wcs, const wchar_t *format, ...);
|
|
|
|
|
|
|
|
extern wint_t ungetwc(wint_t wc, FILE *stream);
|
|
|
|
|
|
|
|
extern int vfwprintf(FILE *stream, const wchar_t *format, va_list arg);
|
|
|
|
extern int vfwscanf(FILE *stream, const wchar_t *format, va_list arg);
|
|
|
|
extern int vswprintf(wchar_t *dest, size_t destLength,
|
|
|
|
const wchar_t *format, va_list arg);
|
|
|
|
extern int vswscanf(const wchar_t *wcs, const wchar_t *format,
|
|
|
|
va_list arg);
|
|
|
|
extern int vwprintf(const wchar_t *format, va_list arg);
|
|
|
|
extern int vwscanf(const wchar_t *format, va_list arg);
|
|
|
|
|
|
|
|
extern wchar_t *wcpcpy(wchar_t *dest, const wchar_t *src);
|
|
|
|
extern wchar_t *wcpncpy(wchar_t *dest, const wchar_t *src, size_t srcLength);
|
|
|
|
extern size_t wcrtomb(char *dest, wchar_t wc, mbstate_t *mbState);
|
|
|
|
extern int wcscasecmp(const wchar_t *wcs1, const wchar_t *wcs2);
|
|
|
|
extern wchar_t *wcscat(wchar_t *dest, const wchar_t *src);
|
|
|
|
extern wchar_t *wcschr(const wchar_t *wcs, wchar_t wc);
|
|
|
|
#ifdef __USE_GNU
|
|
|
|
extern wchar_t *wcschrnul(const wchar_t *wcs, wchar_t wc);
|
|
|
|
#endif
|
|
|
|
extern int wcscmp(const wchar_t *wcs1, const wchar_t *wcs2);
|
|
|
|
extern int wcscoll(const wchar_t *wcs1, const wchar_t *wcs2);
|
|
|
|
extern wchar_t *wcscpy(wchar_t *dest, const wchar_t *src);
|
|
|
|
extern size_t wcscspn(const wchar_t *wcs, const wchar_t *reject);
|
|
|
|
extern wchar_t *wcsdup(const wchar_t *wcs);
|
|
|
|
extern size_t wcsftime(wchar_t *dest, size_t destLength,
|
|
|
|
const wchar_t *format, const struct tm *time);
|
|
|
|
extern size_t wcslcat(wchar_t *dest, const wchar_t *src, size_t maxLength);
|
|
|
|
extern size_t wcslcpy(wchar_t *dest, const wchar_t *src, size_t maxLength);
|
|
|
|
extern size_t wcslen(const wchar_t *wcs);
|
|
|
|
extern int wcsncasecmp(const wchar_t *wcs1, const wchar_t *wcs2,
|
|
|
|
size_t maxLength);
|
|
|
|
extern wchar_t *wcsncat(wchar_t *dest, const wchar_t *src, size_t srcLength);
|
|
|
|
extern int wcsncmp(const wchar_t *wcs1, const wchar_t *wcs2,
|
|
|
|
size_t length);
|
|
|
|
extern wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t srcLength);
|
|
|
|
extern size_t wcsnlen(const wchar_t *wcs, size_t maxLength);
|
|
|
|
extern size_t wcsnrtombs(char *dest, const wchar_t **src, size_t srcLength,
|
|
|
|
size_t destLength, mbstate_t *mbState);
|
|
|
|
extern wchar_t *wcspbrk(const wchar_t *wcs, const wchar_t *accept);
|
|
|
|
extern wchar_t *wcsrchr(const wchar_t *wcs, wchar_t wc);
|
|
|
|
extern size_t wcsrtombs(char *dest, const wchar_t **src, size_t destLength,
|
|
|
|
mbstate_t *mbState);
|
|
|
|
extern size_t wcsspn(const wchar_t *wcs, const wchar_t *accept);
|
|
|
|
extern wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle);
|
|
|
|
extern double wcstod(const wchar_t *wcs, wchar_t **endPtr);
|
|
|
|
extern float wcstof(const wchar_t *wcs, wchar_t **endPtr);
|
|
|
|
extern wchar_t *wcstok(wchar_t *wcs1, const wchar_t *wcs2, wchar_t **ptr);
|
|
|
|
extern long wcstol(const wchar_t *wcs, wchar_t **endPtr, int base);
|
|
|
|
extern long double wcstold(const wchar_t *wcs, wchar_t **endPtr);
|
|
|
|
extern long long wcstoll(const wchar_t *wcs, wchar_t **endPtr, int base);
|
|
|
|
extern unsigned long wcstoul(const wchar_t *wcs, wchar_t **endPtr,
|
|
|
|
int base);
|
|
|
|
extern unsigned long long wcstoull(const wchar_t *wcs, wchar_t **endPtr,
|
|
|
|
int base);
|
|
|
|
extern wchar_t *wcswcs(const wchar_t *haystack, const wchar_t *needle);
|
|
|
|
extern int wcswidth(const wchar_t *wcs, size_t length);
|
|
|
|
extern size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t destLength);
|
|
|
|
extern int wctob(wint_t wc);
|
|
|
|
extern int wcwidth(wchar_t wc);
|
|
|
|
extern wchar_t *wmemchr(const wchar_t *wcs, wchar_t wc, size_t n);
|
|
|
|
extern int wmemcmp(const wchar_t *wcs1, const wchar_t *wcs2, size_t n);
|
|
|
|
extern wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t n);
|
|
|
|
extern wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t n);
|
|
|
|
#ifdef __USE_GNU
|
|
|
|
extern wchar_t *wmempcpy(wchar_t *dest, const wchar_t *src, size_t n);
|
|
|
|
#endif
|
|
|
|
extern wchar_t *wmemset(wchar_t *dest, wchar_t wc, size_t n);
|
|
|
|
|
|
|
|
extern int wprintf(const wchar_t *format, ...);
|
|
|
|
extern int wscanf(const wchar_t *format, ...);
|
2006-03-15 02:18:32 +03:00
|
|
|
|
2007-03-04 05:31:43 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-12-30 10:37:08 +03:00
|
|
|
#endif /* _WCHAR_H */
|