wchar.h header formatting

This commit is contained in:
bumbread 2022-07-29 16:46:16 +11:00
parent 828672b615
commit 0ab396ffc9
3 changed files with 120 additions and 83 deletions

View File

@ -1,3 +1,4 @@
nasm src\_win\chkstk.asm -ochkstk.o -fwin64
clang src\ciabatta.c -o ciabatta.obj -c -DCIABATTA_WIN -I inc -I src\_win -nodefaultlibs -g -mfma
lib /nologo /out:ciabatta.lib ciabatta.obj src\fdec64\fdec64.lib src\unicope\unicope.lib
lib /nologo /out:ciabatta.lib chkstk.o ciabatta.obj src\fdec64\fdec64.lib src\unicope\unicope.lib

View File

@ -103,6 +103,7 @@ int ungetc (int c, FILE *stream);
char *fgets (char *restrict s, int n, FILE *restrict stream);
size_t fread (void *restrict ptr, size_t size, size_t nmemb, FILE *restrict stream);
// File writing
#define putc fputc
int fputc (int c, FILE *stream);
int putchar(int c);

View File

@ -11,93 +11,128 @@ typedef int wint_t;
#define WCHAR_MAX 0xffff
#ifndef WEOF
#define WEOF 0
#define WEOF -1
#endif
int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...);
int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...);
int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...);
int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...);
int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
int vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg);
int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg);
int vwprintf(const wchar_t * restrict format, va_list arg);
int vwscanf(const wchar_t * restrict format, va_list arg);
int wprintf(const wchar_t * restrict format, ...);
int wscanf(const wchar_t * restrict format, ...);
// String length
size_t wcslen(const wchar_t *s);
// Copying
wchar_t *wmemset (wchar_t *s, wchar_t c, size_t n);
wchar_t *wmemmove(wchar_t *s1, wchar_t const *s2, size_t n);
wchar_t *wmemcpy (wchar_t *restrict s1, wchar_t const *restrict s2, size_t n);
wchar_t *wcsncpy (wchar_t *restrict s1, wchar_t const *restrict s2, size_t n);
wchar_t *wcscpy (wchar_t *restrict s1, wchar_t const *restrict s2);
// Concat
wchar_t *wcscat (wchar_t *restrict s1, wchar_t const *restrict s2);
wchar_t *wcsncat(wchar_t *restrict s1, wchar_t const *restrict s2, size_t n);
// Comparison
int wcscmp (wchar_t const *s1, wchar_t const *s2);
int wcsncmp(wchar_t const *s1, wchar_t const *s2, size_t n);
int wmemcmp(wchar_t const *s1, wchar_t const *s2, size_t n);
// Localization
int wcscoll (wchar_t const *s1, wchar_t const *s2);
size_t wcsxfrm (wchar_t *restrict s1, wchar_t const *restrict s2, size_t n);
// Tokenization and stuff
wchar_t *wmemchr(wchar_t const *s, wchar_t c, size_t n);
wchar_t *wcschr (wchar_t const *s, wchar_t c);
wchar_t *wcsrchr(wchar_t const *s, wchar_t c);
wchar_t *wcspbrk(wchar_t const *s1, wchar_t const *s2);
size_t wcscspn(wchar_t const *s1, wchar_t const *s2);
size_t wcsspn (wchar_t const *s1, wchar_t const *s2);
wchar_t *wcsstr (wchar_t const *s1, wchar_t const *s2);
wchar_t *wcstok (wchar_t *restrict s1, wchar_t const *restrict s2, wchar_t **restrict ptr);
// Formatted print
int vfwprintf(FILE *restrict stream, const wchar_t *restrict format, va_list arg);
int fwprintf (FILE *restrict stream, const wchar_t *restrict format, ...);
int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict format, va_list arg);
int swprintf (wchar_t *restrict s, size_t n, const wchar_t *restrict format, ...);
int vwprintf (wchar_t const *restrict format, va_list arg);
int wprintf (wchar_t const *restrict format, ...);
// Formatted scan
int vfwscanf(FILE *restrict stream, const wchar_t *restrict format, va_list arg);
int fwscanf (FILE *restrict stream, const wchar_t *restrict format, ...);
int vswscanf(const wchar_t *restrict s, const wchar_t *restrict format, va_list arg);
int swscanf (const wchar_t *restrict s, const wchar_t *restrict format, ...);
int vwscanf (const wchar_t *restrict format, va_list arg);
int wscanf (const wchar_t *restrict format, ...);
// File reading
wint_t fgetwc(FILE *stream);
wchar_t *fgetws(wchar_t * restrict s, int n, FILE * restrict stream);
wint_t fputwc(wchar_t c, FILE *stream);
int fputws(const wchar_t * restrict s, FILE * restrict stream);
int fwide(FILE *stream, int mode);
wchar_t *fgetws(wchar_t *restrict s, int n, FILE *restrict stream);
wint_t getwc(FILE *stream);
wint_t getwchar(void);
wint_t ungetwc(wint_t c, FILE *stream);
wint_t fputwc(wchar_t c, FILE *stream);
// File writing
int fputws(const wchar_t *restrict s, FILE *restrict stream);
wint_t putwc(wchar_t c, FILE *stream);
wint_t putwchar(wchar_t c);
wint_t ungetwc(wint_t c, FILE *stream);
double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
float wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
long int wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
long long int wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
unsigned long int wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
unsigned long long int wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
wchar_t *wcscpy(wchar_t * restrict s1, const wchar_t * restrict s2);
wchar_t *wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
wchar_t *wmemcpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2, size_t n);
wchar_t *wcscat(wchar_t * restrict s1, const wchar_t * restrict s2);
wchar_t *wcsncat(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
int wcscmp(const wchar_t *s1, const wchar_t *s2);
int wcscoll(const wchar_t *s1, const wchar_t *s2);
int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
size_t wcsxfrm(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n);
wchar_t *wcschr(const wchar_t *s, wchar_t c);
size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
wchar_t *wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t ** restrict ptr);
wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
size_t wcslen(const wchar_t *s);
wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
size_t wcsftime(wchar_t * restrict s, size_t maxsize, const wchar_t * restrict format, const struct tm * restrict timeptr);
// Switch stream mode to wide
int fwide(FILE *stream, int mode);
// Float conversions
double wcstod (wchar_t const *restrict nptr, wchar_t **restrict endptr);
float wcstof (wchar_t const *restrict nptr, wchar_t **restrict endptr);
// Integer conversions
long double wcstold (wchar_t const *restrict nptr, wchar_t **restrict endptr);
long int wcstol (wchar_t const *restrict nptr, wchar_t **restrict endptr, int base);
long long int wcstoll (wchar_t const *restrict nptr, wchar_t **restrict endptr, int base);
unsigned long int wcstoul (wchar_t const *restrict nptr, wchar_t **restrict endptr, int base);
unsigned long long int wcstoull(wchar_t const *restrict nptr, wchar_t **restrict endptr, int base);
// Character conversions
wint_t btowc(int c);
int wctob(wint_t c);
int mbsinit(const mbstate_t *ps);
size_t mbrlen(const char * restrict s, size_t n, mbstate_t * restrict ps);
size_t mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps);
size_t wcrtomb(char * restrict s, wchar_t wc, mbstate_t * restrict ps);
size_t mbsrtowcs(wchar_t * restrict dst, const char ** restrict src, size_t len, mbstate_t * restrict ps);
size_t wcsrtombs(char * restrict dst, const wchar_t ** restrict src, size_t len, mbstate_t * restrict ps);
// Ftime conversion
size_t wcsftime(wchar_t *restrict s, size_t maxsize, const wchar_t *restrict format, const struct tm *restrict timeptr);
// Multibyte conversions
int mbsinit (mbstate_t const *ps);
size_t mbrlen (char const *restrict s, size_t n, mbstate_t *restrict ps);
size_t mbrtowc (wchar_t *restrict pwc, char const *restrict s, size_t n, mbstate_t *restrict ps);
size_t mbsrtowcs(wchar_t *restrict dst, char const **restrict src, size_t len, mbstate_t *restrict ps);
size_t wcrtomb (char *restrict s, wchar_t wc, mbstate_t *restrict ps);
size_t wcsrtombs(char *restrict dst, wchar_t const **restrict src, size_t len, mbstate_t *restrict ps);
#ifdef __STDC_WANT_LIB_EXT1__
int fwprintf_s(FILE * restrict stream, const wchar_t * restrict format, ...);
int fwscanf_s(FILE * restrict stream, const wchar_t * restrict format, ...);
int snwprintf_s(wchar_t * restrict s, rsize_t n, const wchar_t * restrict format, ...);
int swprintf_s(wchar_t * restrict s, rsize_t n, const wchar_t * restrict format, ...);
int swscanf_s(const wchar_t * restrict s, const wchar_t * restrict format, ...);
int vfwprintf_s(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
int vfwscanf_s(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
int vsnwprintf_s(wchar_t * restrict s, rsize_t n, const wchar_t * restrict format, va_list arg);
int vswprintf_s(wchar_t * restrict s, rsize_t n, const wchar_t * restrict format, va_list arg);
int vswscanf_s(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg);
int vwprintf_s(const wchar_t * restrict format, va_list arg);
int vwscanf_s(const wchar_t * restrict format, va_list arg);
int wprintf_s(const wchar_t * restrict format, ...);
int wscanf_s(const wchar_t * restrict format, ...);
errno_t wcscpy_s(wchar_t * restrict s1, rsize_t s1max, const wchar_t * restrict s2);
errno_t wcsncpy_s(wchar_t * restrict s1, rsize_t s1max, const wchar_t * restrict s2, rsize_t n);
errno_t wmemcpy_s(wchar_t * restrict s1, rsize_t s1max, const wchar_t * restrict s2, rsize_t n);
int vfwprintf_s (FILE *restrict stream, const wchar_t *restrict format, va_list arg);
int fwprintf_s (FILE *restrict stream, const wchar_t *restrict format, ...);
int vsnwprintf_s(wchar_t *restrict s, rsize_t n, const wchar_t *restrict format, va_list arg);
int vswprintf_s (wchar_t *restrict s, rsize_t n, const wchar_t *restrict format, va_list arg);
int snwprintf_s (wchar_t *restrict s, rsize_t n, const wchar_t *restrict format, ...);
int swprintf_s (wchar_t *restrict s, rsize_t n, const wchar_t *restrict format, ...);
int vwprintf_s (wchar_t const *restrict format, va_list arg);
int wprintf_s (wchar_t const *restrict format, ...);
int vfwscanf_s(FILE *restrict stream, const wchar_t *restrict format, va_list arg);
int fwscanf_s (FILE *restrict stream, const wchar_t *restrict format, ...);
int vswscanf_s(const wchar_t *restrict s, const wchar_t *restrict format, va_list arg);
int swscanf_s (const wchar_t *restrict s, const wchar_t *restrict format, ...);
int vwscanf_s (const wchar_t *restrict format, va_list arg);
int wscanf_s (const wchar_t *restrict format, ...);
errno_t wcscpy_s (wchar_t *restrict s1, rsize_t s1max, const wchar_t *restrict s2);
errno_t wcsncpy_s (wchar_t *restrict s1, rsize_t s1max, const wchar_t *restrict s2, rsize_t n);
errno_t wmemcpy_s (wchar_t *restrict s1, rsize_t s1max, const wchar_t *restrict s2, rsize_t n);
errno_t wmemmove_s(wchar_t *s1, rsize_t s1max, const wchar_t *s2, rsize_t n);
errno_t wcscat_s(wchar_t * restrict s1, rsize_t s1max, const wchar_t * restrict s2);
errno_t wcsncat_s(wchar_t * restrict s1, rsize_t s1max, const wchar_t * restrict s2, rsize_t n);
wchar_t *wcstok_s(wchar_t * restrict s1, rsize_t * restrict s1max, const wchar_t * restrict s2, wchar_t ** restrict ptr);
size_t wcsnlen_s(const wchar_t *s, size_t maxsize);
errno_t wcrtomb_s(size_t * restrict retval, char * restrict s, rsize_t smax, wchar_t wc, mbstate_t * restrict ps);
errno_t mbsrtowcs_s(size_t * restrict retval, wchar_t * restrict dst, rsize_t dstmax, const char ** restrict src, rsize_t len, mbstate_t * restrict ps);
errno_t wcsrtombs_s(size_t * restrict retval, char * restrict dst, rsize_t dstmax, const wchar_t ** restrict src, rsize_t len, mbstate_t * restrict ps);
errno_t wcscat_s (wchar_t *restrict s1, rsize_t s1max, const wchar_t *restrict s2);
errno_t wcsncat_s (wchar_t *restrict s1, rsize_t s1max, const wchar_t *restrict s2, rsize_t n);
wchar_t *wcstok_s (wchar_t *restrict s1, rsize_t *restrict s1max, const wchar_t *restrict s2, wchar_t **restrict ptr);
size_t wcsnlen_s (const wchar_t *s, size_t maxsize);
errno_t wcrtomb_s (size_t *restrict retval, char *restrict s, rsize_t smax, wchar_t wc, mbstate_t *restrict ps);
errno_t mbsrtowcs_s(size_t *restrict retval, wchar_t *restrict dst, rsize_t dstmax, const char **restrict src, rsize_t len, mbstate_t *restrict ps);
errno_t wcsrtombs_s(size_t *restrict retval, char *restrict dst, rsize_t dstmax, const wchar_t **restrict src, rsize_t len, mbstate_t *restrict ps);
#endif