2019-11-06 03:40:26 +08:00
|
|
|
def StdC : StandardSpec<"stdc"> {
|
|
|
|
ConstType ConstVoidPtr = ConstType<VoidPtr>;
|
|
|
|
RestrictedPtrType VoidRestrictedPtr = RestrictedPtrType<VoidType>;
|
|
|
|
ConstType ConstVoidRestrictedPtr = ConstType<VoidRestrictedPtr>;
|
|
|
|
|
|
|
|
PtrType CharPtr = PtrType<CharType>;
|
|
|
|
ConstType ConstCharPtr = ConstType<CharPtr>;
|
|
|
|
RestrictedPtrType CharRestrictedPtr = RestrictedPtrType<CharType>;
|
|
|
|
ConstType ConstCharRestrictedPtr = ConstType<CharRestrictedPtr>;
|
|
|
|
|
2020-02-28 06:30:24 +08:00
|
|
|
NamedType MtxTType = NamedType<"mtx_t">;
|
|
|
|
PtrType MtxTTypePtr = PtrType<MtxTType>;
|
|
|
|
NamedType ThrdStartTType = NamedType<"thrd_start_t">;
|
|
|
|
NamedType ThrdTType = NamedType<"thrd_t">;
|
|
|
|
PtrType ThrdTTypePtr = PtrType<ThrdTType>;
|
|
|
|
|
|
|
|
PtrType IntPtr = PtrType<IntType>;
|
|
|
|
|
2020-03-12 11:45:58 +08:00
|
|
|
HeaderSpec Assert = HeaderSpec<
|
|
|
|
"assert.h",
|
|
|
|
[
|
|
|
|
Macro<"static_assert">,
|
|
|
|
Macro<"assert">,
|
|
|
|
],
|
|
|
|
[], // Types
|
|
|
|
[], // Enumerations
|
|
|
|
[]
|
|
|
|
>;
|
|
|
|
|
2019-11-06 03:40:26 +08:00
|
|
|
HeaderSpec String = HeaderSpec<
|
|
|
|
"string.h",
|
|
|
|
[
|
|
|
|
Macro<"NULL">,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
SizeTType,
|
|
|
|
],
|
2020-02-28 06:30:24 +08:00
|
|
|
[], // Enumerations
|
2019-11-06 03:40:26 +08:00
|
|
|
[
|
|
|
|
FunctionSpec<
|
|
|
|
"memcpy",
|
|
|
|
RetValSpec<VoidPtr>,
|
|
|
|
[ArgSpec<VoidRestrictedPtr>,
|
|
|
|
ArgSpec<ConstVoidRestrictedPtr>,
|
|
|
|
ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"memmove",
|
|
|
|
RetValSpec<VoidPtr>,
|
|
|
|
[ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"memcmp",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"memchr",
|
|
|
|
RetValSpec<VoidPtr>,
|
|
|
|
[ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"memset",
|
|
|
|
RetValSpec<VoidPtr>,
|
|
|
|
[ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strcpy",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strncpy",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<CharRestrictedPtr>,
|
|
|
|
ArgSpec<ConstCharRestrictedPtr>,
|
|
|
|
ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strcat",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strncat",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strcmp",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strcoll",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strncmp",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strxfrm",
|
|
|
|
RetValSpec<SizeTType>,
|
|
|
|
[ArgSpec<CharRestrictedPtr>,
|
|
|
|
ArgSpec<ConstCharRestrictedPtr>,
|
|
|
|
ArgSpec<SizeTType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strchr",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strcspn",
|
|
|
|
RetValSpec<SizeTType>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strpbrk",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strrchr",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strspn",
|
|
|
|
RetValSpec<SizeTType>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strstr",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strtok",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strerror",
|
|
|
|
RetValSpec<CharPtr>,
|
|
|
|
[ArgSpec<IntType>]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"strlen",
|
|
|
|
RetValSpec<SizeTType>,
|
|
|
|
[ArgSpec<ConstCharPtr>]
|
|
|
|
>,
|
|
|
|
]
|
|
|
|
>;
|
|
|
|
|
|
|
|
HeaderSpec Math = HeaderSpec<
|
|
|
|
"math.h",
|
|
|
|
[], // Macros
|
|
|
|
[
|
|
|
|
NamedType<"float_t">,
|
|
|
|
NamedType<"double_t">,
|
|
|
|
],
|
2020-02-28 06:30:24 +08:00
|
|
|
[], // Enumerations
|
2019-11-06 03:40:26 +08:00
|
|
|
[
|
|
|
|
FunctionSpec<"acos", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
|
|
|
|
FunctionSpec<"acosl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
|
|
|
|
]
|
|
|
|
>;
|
|
|
|
|
|
|
|
HeaderSpec StdIO = HeaderSpec<
|
|
|
|
"stdio.h",
|
|
|
|
[], // Macros
|
|
|
|
[ // Types
|
|
|
|
SizeTType,
|
|
|
|
],
|
2020-02-28 06:30:24 +08:00
|
|
|
[], // Enumerations
|
2019-11-06 03:40:26 +08:00
|
|
|
[
|
|
|
|
FunctionSpec<
|
|
|
|
"snprintf",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[ArgSpec<CharPtr>,
|
|
|
|
ArgSpec<SizeTType>,
|
|
|
|
ArgSpec<ConstCharRestrictedPtr>,
|
|
|
|
ArgSpec<VarArgType>]
|
|
|
|
>,
|
|
|
|
]
|
|
|
|
>;
|
|
|
|
|
2020-03-06 03:21:18 +08:00
|
|
|
HeaderSpec StdLib = HeaderSpec<
|
|
|
|
"stdlib.h",
|
|
|
|
[], // Macros
|
|
|
|
[], // Types
|
|
|
|
[], // Enumerations
|
|
|
|
[
|
|
|
|
FunctionSpec<"abort", RetValSpec<NoReturn>, [ArgSpec<VoidType>]>,
|
|
|
|
FunctionSpec<"_Exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
|
|
|
|
]
|
|
|
|
>;
|
|
|
|
|
2019-12-06 04:09:24 +08:00
|
|
|
HeaderSpec Errno = HeaderSpec<
|
|
|
|
"errno.h",
|
|
|
|
[
|
|
|
|
Macro<"errno">,
|
|
|
|
Macro<"EDOM">,
|
|
|
|
Macro<"EILSEQ">,
|
|
|
|
Macro<"ERANGE">,
|
2020-02-28 06:30:24 +08:00
|
|
|
]
|
2019-12-06 04:09:24 +08:00
|
|
|
>;
|
|
|
|
|
2020-02-21 03:05:34 +08:00
|
|
|
HeaderSpec Signal = HeaderSpec<
|
|
|
|
"signal.h",
|
|
|
|
[
|
|
|
|
Macro<"SIG_BLOCK">,
|
|
|
|
Macro<"SIG_UNBLOCK">,
|
|
|
|
Macro<"SIG_SETMASK">,
|
|
|
|
|
|
|
|
Macro<"SIGABRT">,
|
|
|
|
Macro<"SIGFPE">,
|
|
|
|
Macro<"SIGILL">,
|
|
|
|
Macro<"SIGINT">,
|
|
|
|
Macro<"SIGSEGV">,
|
|
|
|
Macro<"SIGTERM">
|
|
|
|
],
|
|
|
|
[
|
|
|
|
SizeTType,
|
|
|
|
],
|
2020-02-28 06:30:24 +08:00
|
|
|
[], // Enumerations
|
2020-02-21 03:05:34 +08:00
|
|
|
[
|
|
|
|
FunctionSpec<"raise", RetValSpec<IntType>, [ArgSpec<IntType>]>,
|
|
|
|
]
|
|
|
|
>;
|
|
|
|
|
2020-02-28 06:30:24 +08:00
|
|
|
HeaderSpec Threads = HeaderSpec<
|
|
|
|
"threads.h",
|
|
|
|
[], // Macros
|
|
|
|
[
|
|
|
|
MtxTType,
|
|
|
|
ThrdStartTType,
|
|
|
|
ThrdTType,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
EnumeratedNameValue<"mtx_plain">,
|
|
|
|
EnumeratedNameValue<"mtx_recursive">,
|
|
|
|
EnumeratedNameValue<"mtx_timed">,
|
|
|
|
EnumeratedNameValue<"thrd_timedout">,
|
|
|
|
EnumeratedNameValue<"thrd_success">,
|
|
|
|
EnumeratedNameValue<"thrd_busy">,
|
|
|
|
EnumeratedNameValue<"thrd_error">,
|
|
|
|
EnumeratedNameValue<"thrd_nomem">,
|
|
|
|
],
|
|
|
|
[
|
|
|
|
FunctionSpec<
|
|
|
|
"mtx_init",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[
|
|
|
|
ArgSpec<MtxTTypePtr>,
|
|
|
|
ArgSpec<IntType>,
|
|
|
|
]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"mtx_lock",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[
|
|
|
|
ArgSpec<MtxTTypePtr>,
|
|
|
|
]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"mtx_unlock",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[
|
|
|
|
ArgSpec<MtxTTypePtr>,
|
|
|
|
]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"thrd_create",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[
|
|
|
|
ArgSpec<ThrdTTypePtr>,
|
|
|
|
ArgSpec<ThrdStartTType>,
|
|
|
|
ArgSpec<VoidPtr>,
|
|
|
|
]
|
|
|
|
>,
|
|
|
|
FunctionSpec<
|
|
|
|
"thrd_join",
|
|
|
|
RetValSpec<IntType>,
|
|
|
|
[
|
|
|
|
ArgSpec<ThrdTTypePtr>,
|
|
|
|
ArgSpec<IntPtr>,
|
|
|
|
]
|
|
|
|
>
|
|
|
|
]
|
|
|
|
>;
|
|
|
|
|
2019-11-06 03:40:26 +08:00
|
|
|
let Headers = [
|
2020-03-12 11:45:58 +08:00
|
|
|
Assert,
|
2019-12-06 04:09:24 +08:00
|
|
|
Errno,
|
2019-11-06 03:40:26 +08:00
|
|
|
Math,
|
|
|
|
String,
|
|
|
|
StdIO,
|
2020-03-06 03:21:18 +08:00
|
|
|
StdLib,
|
2020-02-21 03:05:34 +08:00
|
|
|
Signal,
|
2020-02-28 06:30:24 +08:00
|
|
|
Threads,
|
2019-11-06 03:40:26 +08:00
|
|
|
];
|
|
|
|
}
|