65816-llvm-mos/runtime/include/wchar.h
Scott Duensing f338d93bae Checkpoint
2026-05-02 18:30:15 -05:00

38 lines
1.2 KiB
C

// Minimal wchar.h for the W65816 runtime.
//
// wchar_t is 16-bit (matches `int` on this target). No real
// multi-byte / locale support — mbtowc/wctomb assume a one-byte =
// one-wchar mapping (essentially Latin-1). The wcs* functions
// mirror the str* family.
#ifndef _WCHAR_H
#define _WCHAR_H
typedef unsigned short wchar_t;
typedef unsigned int size_t;
typedef long wint_t;
#define WEOF ((wint_t)-1)
#ifndef NULL
#define NULL ((void *)0)
#endif
size_t wcslen (const wchar_t *s);
int wcscmp (const wchar_t *a, const wchar_t *b);
int wcsncmp(const wchar_t *a, const wchar_t *b, size_t n);
wchar_t *wcscpy (wchar_t *dst, const wchar_t *src);
wchar_t *wcsncpy(wchar_t *dst, const wchar_t *src, size_t n);
wchar_t *wcscat (wchar_t *dst, const wchar_t *src);
wchar_t *wcschr (const wchar_t *s, wchar_t c);
wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
// Multi-byte conversion. Trivial 1:1 in our impl: each byte maps
// to the wide char with the same numeric value (zero-extended).
int mbtowc (wchar_t *pwc, const char *s, size_t n);
int wctomb (char *s, wchar_t wc);
size_t mbstowcs(wchar_t *pwcs, const char *s, size_t n);
size_t wcstombs(char *s, const wchar_t *pwcs, size_t n);
int mblen (const char *s, size_t n);
#endif