50 lines
1.5 KiB
C
50 lines
1.5 KiB
C
// Minimal limits.h for the W65816 runtime. Standalone (does not
|
|
// include the host clang's limits.h, which pulls in glibc headers
|
|
// and breaks the build). Sizes per the W65816 backend's view:
|
|
// char = 8 bits
|
|
// short = 16 bits
|
|
// int = 16 bits
|
|
// long = 32 bits
|
|
// long long = 64 bits
|
|
|
|
#ifndef _LIMITS_H
|
|
#define _LIMITS_H
|
|
|
|
#define CHAR_BIT 8
|
|
#define MB_LEN_MAX 1
|
|
|
|
#define SCHAR_MIN (-128)
|
|
#define SCHAR_MAX 127
|
|
#define UCHAR_MAX 255
|
|
// `char` is signed by default on this target.
|
|
#define CHAR_MIN SCHAR_MIN
|
|
#define CHAR_MAX SCHAR_MAX
|
|
|
|
#define SHRT_MIN (-32768)
|
|
#define SHRT_MAX 32767
|
|
#define USHRT_MAX 65535U
|
|
|
|
#define INT_MIN (-32768)
|
|
#define INT_MAX 32767
|
|
#define UINT_MAX 65535U
|
|
|
|
#define LONG_MIN (-2147483647L - 1)
|
|
#define LONG_MAX 2147483647L
|
|
#define ULONG_MAX 4294967295UL
|
|
|
|
#define LLONG_MIN (-9223372036854775807LL - 1)
|
|
#define LLONG_MAX 9223372036854775807LL
|
|
#define ULLONG_MAX 18446744073709551615ULL
|
|
|
|
// Path limits. PATH_MAX is bounded by GS/OS GSString.length being u16
|
|
// (theoretical max 65535), but the practical convention on the IIgs is
|
|
// "a NUL-terminated path that fits in a 256-byte buffer". We pick 256
|
|
// here so the GSString.text[] body + a trailing NUL fits exactly in a
|
|
// single 256-byte block — matching the existing __gsosPathBuf storage
|
|
// in libc.c. NAME_MAX is the ProDOS component limit (15 chars in
|
|
// classic, 32 in ProDOS 16/GS/OS — but the GS/OS file-system manager
|
|
// caps it at 64 across all FSTs, which is the value we expose).
|
|
#define PATH_MAX 256
|
|
#define NAME_MAX 64
|
|
|
|
#endif
|