[libc][NFC] Move aligned access implementations to separate header
[llvm-project.git] / libc / spec / stdc.td
blobcbb3015d0f0c4c4bbca7ef30a511ab4e616377f6
1 def StdC : StandardSpec<"stdc"> {
3   NamedType StructTmType = NamedType<"struct tm">;
4   PtrType StructTmPtr = PtrType<StructTmType>;
5   PtrType TimeTTypePtr = PtrType<TimeTType>;
6   NamedType ClockT = NamedType<"clock_t">;
8   NamedType DivTType = NamedType<"div_t">;
9   NamedType LDivTType = NamedType<"ldiv_t">;
10   NamedType LLDivTType = NamedType<"lldiv_t">;
12   NamedType JmpBuf = NamedType<"jmp_buf">;
14   NamedType TssTType = NamedType<"tss_t">;
15   PtrType TssTPtr = PtrType<TssTType>;
16   NamedType TssDtorTType = NamedType<"tss_dtor_t">;
18   HeaderSpec Assert = HeaderSpec<
19       "assert.h",
20       [
21           Macro<"static_assert">,
22           Macro<"assert">,
23       ],
24       [], // Types
25       [], // Enumerations
26       []
27   >;
29   HeaderSpec CType = HeaderSpec<
30       "ctype.h",
31       [], // Macros
32       [], // Types
33       [], // Enumerations
34       [
35           FunctionSpec<
36               "isalnum",
37               RetValSpec<IntType>,
38               [ArgSpec<IntType>]
39           >,
40           FunctionSpec<
41               "isalpha",
42               RetValSpec<IntType>,
43               [ArgSpec<IntType>]
44           >,
45           FunctionSpec<
46               "isblank",
47               RetValSpec<IntType>,
48               [ArgSpec<IntType>]
49           >,
50           FunctionSpec<
51               "iscntrl",
52               RetValSpec<IntType>,
53               [ArgSpec<IntType>]
54           >,
55           FunctionSpec<
56               "isdigit",
57               RetValSpec<IntType>,
58               [ArgSpec<IntType>]
59           >,
60           FunctionSpec<
61               "isgraph",
62               RetValSpec<IntType>,
63               [ArgSpec<IntType>]
64           >,
65           FunctionSpec<
66               "islower",
67               RetValSpec<IntType>,
68               [ArgSpec<IntType>]
69           >,
70           FunctionSpec<
71               "isprint",
72               RetValSpec<IntType>,
73               [ArgSpec<IntType>]
74           >,
75           FunctionSpec<
76               "ispunct",
77               RetValSpec<IntType>,
78               [ArgSpec<IntType>]
79           >,
80           FunctionSpec<
81               "isspace",
82               RetValSpec<IntType>,
83               [ArgSpec<IntType>]
84           >,
85           FunctionSpec<
86               "isupper",
87               RetValSpec<IntType>,
88               [ArgSpec<IntType>]
89           >,
90           FunctionSpec<
91               "isxdigit",
92               RetValSpec<IntType>,
93               [ArgSpec<IntType>]
94           >,
95           FunctionSpec<
96               "tolower",
97               RetValSpec<IntType>,
98               [ArgSpec<IntType>]
99           >,
100           FunctionSpec<
101               "toupper",
102               RetValSpec<IntType>,
103               [ArgSpec<IntType>]
104           >,
105       ]
106   >;
108   NamedType FEnvT = NamedType<"fenv_t">;
109   PtrType FEnvTPtr = PtrType<FEnvT>;
110   ConstType ConstFEnvTPtr = ConstType<FEnvTPtr>;
111   NamedType FExceptT = NamedType<"fexcept_t">;
112   PtrType FExceptTPtr = PtrType<FExceptT>;
113   ConstType ConstFExceptTPtr = ConstType<FExceptTPtr>;
114   HeaderSpec Fenv = HeaderSpec<
115       "fenv.h",
116       [
117           Macro<"FE_DIVBYZERO">,
118           Macro<"FE_INEXACT">,
119           Macro<"FE_INVALID">,
120           Macro<"FE_OVERFLOW">,
121           Macro<"FE_UNDERFLOW">,
122           Macro<"FE_ALL_EXCEPT">,
124           Macro<"FE_DOWNWARD">,
125           Macro<"FE_TONEAREST">,
126           Macro<"FE_TOWARDZERO">,
127           Macro<"FE_UPWARD">,
129           Macro<"FE_DFL_ENV">
130       ],
131       [
132           NamedType<"fenv_t">,
133           NamedType<"fexcept_t">,
134       ], // Types
135       [], // Enumerations
136       [
137           FunctionSpec<
138               "feclearexcept",
139               RetValSpec<IntType>,
140               [ArgSpec<IntType>]
141           >,
142           FunctionSpec<
143               "fetestexcept",
144               RetValSpec<IntType>,
145               [ArgSpec<IntType>]
146           >,
147           FunctionSpec<
148               "feraiseexcept",
149               RetValSpec<IntType>,
150               [ArgSpec<IntType>]
151           >,
152           FunctionSpec<
153               "fesetround",
154               RetValSpec<IntType>,
155               [ArgSpec<IntType>]
156           >,
157           FunctionSpec<
158               "fegetround",
159               RetValSpec<IntType>,
160               []
161           >,
162           FunctionSpec<
163               "fegetenv",
164               RetValSpec<IntType>,
165               [ArgSpec<FEnvTPtr>]
166           >,
167           FunctionSpec<
168               "fesetenv",
169               RetValSpec<IntType>,
170               [ArgSpec<ConstFEnvTPtr>]
171           >,
172           FunctionSpec<
173               "fegetexceptflag",
174               RetValSpec<IntType>,
175               [ArgSpec<FExceptTPtr>, ArgSpec<IntType>]
176           >,
177           FunctionSpec<
178               "fesetexceptflag",
179               RetValSpec<IntType>,
180               [ArgSpec<ConstFExceptTPtr>, ArgSpec<IntType>]
181           >,
182           FunctionSpec<
183               "feholdexcept",
184               RetValSpec<IntType>,
185               [ArgSpec<FEnvTPtr>]
186           >,
187           FunctionSpec<
188               "feupdateenv",
189               RetValSpec<IntType>,
190               [ArgSpec<ConstFEnvTPtr>]
191           >,
192       ]
193   >;
195   HeaderSpec String = HeaderSpec<
196       "string.h",
197       [
198           Macro<"NULL">,
199       ],
200       [
201           SizeTType,
202       ],
203       [], // Enumerations
204       [
205           FunctionSpec<
206               "memcpy",
207               RetValSpec<VoidPtr>,
208               [ArgSpec<VoidRestrictedPtr>,
209                ArgSpec<ConstVoidRestrictedPtr>,
210                ArgSpec<SizeTType>]
211           >,
212           FunctionSpec<
213               "memmove",
214               RetValSpec<VoidPtr>,
215               [ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
216           >,
217           FunctionSpec<
218               "memcmp",
219               RetValSpec<IntType>,
220               [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
221           >,
222           FunctionSpec<
223               "memchr",
224               RetValSpec<VoidPtr>,
225               [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
226           >,
227           FunctionSpec<
228               "memset",
229               RetValSpec<VoidPtr>,
230               [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
231           >,
232           FunctionSpec<
233               "strcpy",
234               RetValSpec<CharPtr>,
235               [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
236           >,
237           FunctionSpec<
238               "strncpy",
239               RetValSpec<CharPtr>,
240               [ArgSpec<CharRestrictedPtr>,
241                ArgSpec<ConstCharRestrictedPtr>,
242                ArgSpec<SizeTType>]
243           >,
244           FunctionSpec<
245               "strcat",
246               RetValSpec<CharPtr>,
247               [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
248           >,
249           FunctionSpec<
250               "strncat",
251               RetValSpec<CharPtr>,
252               [ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
253           >,
254           FunctionSpec<
255               "strcmp",
256               RetValSpec<IntType>,
257               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
258           >,
259           FunctionSpec<
260               "strcoll",
261               RetValSpec<IntType>,
262               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
263           >,
264           FunctionSpec<
265               "strncmp",
266               RetValSpec<IntType>,
267               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
268           >,
269           FunctionSpec<
270               "strxfrm",
271               RetValSpec<SizeTType>,
272               [ArgSpec<CharRestrictedPtr>,
273                ArgSpec<ConstCharRestrictedPtr>,
274                ArgSpec<SizeTType>]
275           >,
276           FunctionSpec<
277               "strchr",
278               RetValSpec<CharPtr>,
279               [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
280           >,
281           FunctionSpec<
282               "strcspn",
283               RetValSpec<SizeTType>,
284               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
285           >,
286           FunctionSpec<
287               "strdup",
288               RetValSpec<CharPtr>,
289               [ArgSpec<ConstCharPtr>]
290           >,
291           FunctionSpec<
292               "strndup",
293               RetValSpec<CharPtr>,
294               [ArgSpec<ConstCharPtr>,ArgSpec<SizeTType>]
295           >,
296           FunctionSpec<
297               "strpbrk",
298               RetValSpec<CharPtr>,
299               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
300           >,
301           FunctionSpec<
302               "strrchr",
303               RetValSpec<CharPtr>,
304               [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
305           >,
306           FunctionSpec<
307               "strspn",
308               RetValSpec<SizeTType>,
309               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
310           >,
311           FunctionSpec<
312               "strstr",
313               RetValSpec<CharPtr>,
314               [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
315           >,
316           FunctionSpec<
317               "strtok",
318               RetValSpec<CharPtr>,
319               [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
320           >,
321           FunctionSpec<
322               "strerror",
323               RetValSpec<CharPtr>,
324               [ArgSpec<IntType>]
325           >,
326           FunctionSpec<
327               "strlen",
328               RetValSpec<SizeTType>,
329               [ArgSpec<ConstCharPtr>]
330           >,
331       ]
332   >;
334   HeaderSpec Math = HeaderSpec<
335       "math.h",
336       [
337           Macro<"MATH_ERRNO">,
338           Macro<"MATH_ERREXCEPT">,
339           Macro<"math_errhandling">,
341           Macro<"HUGE_VAL">,
342           Macro<"INFINITY">,
343           Macro<"NAN">,
345           Macro<"FP_ILOGB0">,
346           Macro<"FP_ILOGBNAN">,
348           Macro<"isfinite">,
349           Macro<"isinf">,
350           Macro<"isnan">,
351       ],
352       [
353           NamedType<"float_t">,
354           NamedType<"double_t">,
355       ],
356       [], // Enumerations
357       [
358           FunctionSpec<"copysign", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
359           FunctionSpec<"copysignf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
360           FunctionSpec<"copysignl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
362           FunctionSpec<"ceil", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
363           FunctionSpec<"ceilf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
364           FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
366           FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
367           FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
368           FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
370           FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
371           FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
372           FunctionSpec<"fdiml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
374           FunctionSpec<"floor", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
375           FunctionSpec<"floorf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
376           FunctionSpec<"floorl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
378           FunctionSpec<"fmin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
379           FunctionSpec<"fminf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
380           FunctionSpec<"fminl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
382           FunctionSpec<"fmax", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
383           FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
384           FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
386           FunctionSpec<"fma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
387           FunctionSpec<"fmaf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>]>,
389           FunctionSpec<"fmod", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
391           FunctionSpec<"fmodf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
393           FunctionSpec<"frexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
394           FunctionSpec<"frexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
395           FunctionSpec<"frexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
397           FunctionSpec<"hypot", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
398           FunctionSpec<"hypotf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
400           FunctionSpec<"ilogb", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
401           FunctionSpec<"ilogbf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
402           FunctionSpec<"ilogbl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
404           FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
405           FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
406           FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
408           FunctionSpec<"log10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
409           FunctionSpec<"log10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
411           FunctionSpec<"log1p", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
412           FunctionSpec<"log1pf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
414           FunctionSpec<"log2", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
415           FunctionSpec<"log2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
417           FunctionSpec<"log", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
418           FunctionSpec<"logf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
420           FunctionSpec<"logb", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
421           FunctionSpec<"logbf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
422           FunctionSpec<"logbl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
424           FunctionSpec<"modf", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoublePtr>]>,
425           FunctionSpec<"modff", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatPtr>]>,
426           FunctionSpec<"modfl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoublePtr>]>,
428           FunctionSpec<"cos", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
429           FunctionSpec<"cosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
430           FunctionSpec<"sin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
431           FunctionSpec<"sinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
432           FunctionSpec<"tan", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
433           FunctionSpec<"tanf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
435           FunctionSpec<"erff", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
437           FunctionSpec<"expf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
438           FunctionSpec<"exp2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
439           FunctionSpec<"expm1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
441           FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
442           FunctionSpec<"remainder", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
443           FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
445           FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
446           FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
447           FunctionSpec<"remquol", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
449           FunctionSpec<"round", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
450           FunctionSpec<"roundf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
451           FunctionSpec<"roundl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
453           FunctionSpec<"lround", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
454           FunctionSpec<"lroundf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
455           FunctionSpec<"lroundl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
457           FunctionSpec<"llround", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
458           FunctionSpec<"llroundf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
459           FunctionSpec<"llroundl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
461           FunctionSpec<"rint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
462           FunctionSpec<"rintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
463           FunctionSpec<"rintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
465           FunctionSpec<"lrint", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
466           FunctionSpec<"lrintf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
467           FunctionSpec<"lrintl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
469           FunctionSpec<"llrint", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
470           FunctionSpec<"llrintf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
471           FunctionSpec<"llrintl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
473           FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
474           FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
475           FunctionSpec<"sqrtl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
477           FunctionSpec<"trunc", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
478           FunctionSpec<"truncf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
479           FunctionSpec<"truncl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
481           FunctionSpec<"nearbyint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
482           FunctionSpec<"nearbyintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
483           FunctionSpec<"nearbyintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
485           FunctionSpec<"nextafterf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
486           FunctionSpec<"nextafter", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
487           FunctionSpec<"nextafterl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
489           FunctionSpec<"pow", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
491           FunctionSpec<"coshf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
492           FunctionSpec<"sinhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
493           FunctionSpec<"tanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
495           FunctionSpec<"acosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
496           FunctionSpec<"asinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
497           FunctionSpec<"asin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
498           FunctionSpec<"atanf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
500           FunctionSpec<"acoshf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
501           FunctionSpec<"asinhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
502           FunctionSpec<"atanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
504           FunctionSpec<"scalbn", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
505           FunctionSpec<"scalbnf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
506           FunctionSpec<"scalbnl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
507       ]
508   >;
510   HeaderSpec StdIO = HeaderSpec<
511       "stdio.h",
512       [
513           Macro<"stdin">,
514           Macro<"stderr">,
515           Macro<"stdout">,
516           Macro<"_IOFBF">,
517           Macro<"_IOLBF">,
518           Macro<"_IONBF">,
519           Macro<"EOF">,
520       ], // Macros
521       [ // Types
522           SizeTType,
523           FILE,
524       ],
525       [], // Enumerations
526       [
527           FunctionSpec<
528               "clearerr",
529               RetValSpec<VoidType>,
530               [ArgSpec<FILEPtr>]
531           >,
532           FunctionSpec<
533               "fclose",
534               RetValSpec<IntType>,
535               [ArgSpec<FILEPtr>]
536           >,
537           FunctionSpec<
538               "feof",
539               RetValSpec<IntType>,
540               [ArgSpec<FILEPtr>]
541           >,
542           FunctionSpec<
543               "ferror",
544               RetValSpec<IntType>,
545               [ArgSpec<FILEPtr>]
546           >,
547           FunctionSpec<
548               "fgetc",
549               RetValSpec<IntType>,
550               [ArgSpec<FILEPtr>]
551           >,
552           FunctionSpec<
553               "fgets",
554               RetValSpec<CharPtr>,
555               [
556                 ArgSpec<CharRestrictedPtr>,
557                 ArgSpec<IntType>,
558                 ArgSpec<FILERestrictedPtr>,
559               ]
560           >,
561           FunctionSpec<
562               "fflush",
563               RetValSpec<IntType>,
564               [ArgSpec<FILEPtr>]
565           >,
566           FunctionSpec<
567               "fopen",
568               RetValSpec<FILEPtr>,
569               [ArgSpec<ConstCharPtr>,
570                ArgSpec<ConstCharPtr>]
571           >,
572           FunctionSpec<
573               "fputc",
574               RetValSpec<IntType>,
575               [ArgSpec<IntType>,
576                ArgSpec<FILEPtr>]
577           >,
578           FunctionSpec<
579               "ftell",
580               RetValSpec<LongType>,
581               [ArgSpec<FILEPtr>]
582           >,
583           FunctionSpec<
584               "getc",
585               RetValSpec<IntType>,
586               [ArgSpec<FILEPtr>]
587           >,
588           FunctionSpec<
589               "getchar",
590               RetValSpec<IntType>,
591               [ArgSpec<VoidType>]
592           >,
593           FunctionSpec<
594               "putc",
595               RetValSpec<IntType>,
596               [ArgSpec<IntType>,
597                ArgSpec<FILEPtr>]
598           >,
599           FunctionSpec<
600               "putchar",
601               RetValSpec<IntType>,
602               [ArgSpec<IntType>]
603           >,
604           FunctionSpec<
605               "fputs",
606               RetValSpec<IntType>,
607               [ArgSpec<ConstCharRestrictedPtr>,
608                ArgSpec<FILERestrictedPtr>]
609           >,
610           FunctionSpec<
611               "puts",
612               RetValSpec<IntType>,
613               [ArgSpec<ConstCharRestrictedPtr>]
614           >,
615           FunctionSpec<
616               "fread",
617               RetValSpec<SizeTType>,
618               [ArgSpec<VoidRestrictedPtr>,
619                ArgSpec<SizeTType>,
620                ArgSpec<SizeTType>,
621                ArgSpec<FILERestrictedPtr>]
622           >,
623           FunctionSpec<
624               "fseek",
625               RetValSpec<IntType>,
626               [ArgSpec<FILEPtr>,
627                ArgSpec<LongType>,
628                ArgSpec<IntType>]
629           >,
630           FunctionSpec<
631               "fwrite",
632               RetValSpec<SizeTType>,
633               [ArgSpec<ConstVoidRestrictedPtr>,
634                ArgSpec<SizeTType>,
635                ArgSpec<SizeTType>,
636                ArgSpec<FILERestrictedPtr>]
637           >,
638           FunctionSpec<
639               "remove",
640               RetValSpec<IntType>,
641               [ArgSpec<ConstCharPtr>]
642           >,
643           FunctionSpec<
644               "setbuf",
645               RetValSpec<VoidType>,
646               [ArgSpec<FILERestrictedPtr>, ArgSpec<CharRestrictedPtr>]
647           >,
648           FunctionSpec<
649               "setvbuf",
650               RetValSpec<IntType>,
651               [ArgSpec<FILERestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
652           >,
653           FunctionSpec<
654               "sscanf",
655               RetValSpec<IntType>,
656               [ArgSpec<ConstCharRestrictedPtr>,
657                ArgSpec<ConstCharRestrictedPtr>,
658                ArgSpec<VarArgType>]
659           >,
660           FunctionSpec<
661               "scanf",
662               RetValSpec<IntType>,
663               [ArgSpec<ConstCharRestrictedPtr>,
664                ArgSpec<VarArgType>]
665           >,
666           FunctionSpec<
667               "fscanf",
668               RetValSpec<IntType>,
669               [ArgSpec<FILERestrictedPtr>,
670                ArgSpec<ConstCharRestrictedPtr>,
671                ArgSpec<VarArgType>]
672           >,
673           FunctionSpec<
674               "sprintf",
675               RetValSpec<IntType>,
676               [ArgSpec<CharRestrictedPtr>,
677                ArgSpec<ConstCharRestrictedPtr>,
678                ArgSpec<VarArgType>]
679           >,
680           FunctionSpec<
681               "snprintf",
682               RetValSpec<IntType>,
683               [ArgSpec<CharRestrictedPtr>,
684                ArgSpec<SizeTType>,
685                ArgSpec<ConstCharRestrictedPtr>,
686                ArgSpec<VarArgType>]
687           >,
688           FunctionSpec<
689               "printf",
690               RetValSpec<IntType>,
691               [ArgSpec<ConstCharRestrictedPtr>,
692                ArgSpec<VarArgType>]
693           >,
694           FunctionSpec<
695               "fprintf",
696               RetValSpec<IntType>,
697               [ArgSpec<FILERestrictedPtr>,
698                ArgSpec<ConstCharRestrictedPtr>,
699                ArgSpec<VarArgType>]
700           >,
701           FunctionSpec<
702               "ungetc",
703               RetValSpec<IntType>,
704               [ArgSpec<IntType>, ArgSpec<FILEPtr>]
705           >,
706       ],
707       [
708           ObjectSpec<
709               "stdin",
710               "FILE *"
711           >,
712           ObjectSpec<
713               "stdout",
714               "FILE *"
715           >,
716           ObjectSpec<
717               "stderr",
718               "FILE *"
719           >,
720       ]
721   >;
723   HeaderSpec StdLib = HeaderSpec<
724       "stdlib.h",
725       [], // Macros
726       [
727           DivTType,
728           LDivTType,
729           LLDivTType,
730           SizeTType,
731           BSearchCompareT,
732           QSortCompareT,
733           AtexitHandlerT,
734       ], // Types
735       [], // Enumerations
736       [
737           FunctionSpec<"abort", RetValSpec<NoReturn>, [ArgSpec<VoidType>]>,
739           FunctionSpec<"bsearch", RetValSpec<VoidPtr>, [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<BSearchCompareT>]>,
741           FunctionSpec<"abs", RetValSpec<IntType>, [ArgSpec<IntType>]>,
742           FunctionSpec<"labs", RetValSpec<LongType>, [ArgSpec<LongType>]>,
743           FunctionSpec<"llabs", RetValSpec<LongLongType>, [ArgSpec<LongLongType>]>,
745           FunctionSpec<"atof", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>]>,
746           FunctionSpec<"atoi", RetValSpec<IntType>, [ArgSpec<ConstCharPtr>]>,
747           FunctionSpec<"atol", RetValSpec<LongType>, [ArgSpec<ConstCharPtr>]>,
748           FunctionSpec<"atoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharPtr>]>,
750           FunctionSpec<"div", RetValSpec<DivTType>, [ArgSpec<IntType>, ArgSpec<IntType>]>,
751           FunctionSpec<"ldiv", RetValSpec<LDivTType>, [ArgSpec<LongType>, ArgSpec<LongType>]>,
752           FunctionSpec<"lldiv", RetValSpec<LLDivTType>, [ArgSpec<LongLongType>, ArgSpec<LongLongType>]>,
754           FunctionSpec<"qsort", RetValSpec<VoidType>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<QSortCompareT>]>,
756           FunctionSpec<"rand", RetValSpec<IntType>, [ArgSpec<VoidType>]>,
757           FunctionSpec<"srand", RetValSpec<VoidType>, [ArgSpec<UnsignedIntType>]>,
759           FunctionSpec<"strtof", RetValSpec<FloatType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
760           FunctionSpec<"strtod", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
761           FunctionSpec<"strtold", RetValSpec<LongDoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
762           FunctionSpec<"strtol", RetValSpec<LongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
763           FunctionSpec<"strtoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
764           FunctionSpec<"strtoul", RetValSpec<UnsignedLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
765           FunctionSpec<"strtoull", RetValSpec<UnsignedLongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
767           FunctionSpec<"malloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>]>,
768           FunctionSpec<"calloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
769           FunctionSpec<"realloc", RetValSpec<VoidPtr>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]>,
770           FunctionSpec<"aligned_alloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
771           FunctionSpec<"free", RetValSpec<VoidType>, [ArgSpec<VoidPtr>]>,
773           FunctionSpec<"_Exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
774           FunctionSpec<"exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
775           FunctionSpec<"atexit", RetValSpec<IntType>, [ArgSpec<AtexitHandlerT>]>,
776       ]
777   >;
779   NamedType IMaxDivTType = NamedType<"imaxdiv_t">;
781   HeaderSpec IntTypes = HeaderSpec<
782       "inttypes.h",
783       [], // Macros
784       [
785         IMaxDivTType,
786       ], // Types
787       [], // Enumerations
788       [
789           FunctionSpec<"imaxabs", RetValSpec<IntMaxTType>, [ArgSpec<IntMaxTType>]>,
790           FunctionSpec<"imaxdiv", RetValSpec<IMaxDivTType>, [ArgSpec<IntMaxTType>, ArgSpec<IntMaxTType>]>,
791           FunctionSpec<"strtoimax", RetValSpec<IntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
792           FunctionSpec<"strtoumax", RetValSpec<UIntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
793       ]
794   >;
796   HeaderSpec Errno = HeaderSpec<
797       "errno.h",
798       [
799         Macro<"errno">,
800         Macro<"EDOM">,
801         Macro<"EILSEQ">,
802         Macro<"ERANGE">,
803       ]
804   >;
806   NamedType SigAtomicT = NamedType<"sig_atomic_t">;
807   HeaderSpec Signal = HeaderSpec<
808       "signal.h",
809       [
810         Macro<"SIG_BLOCK">,
811         Macro<"SIG_UNBLOCK">,
812         Macro<"SIG_SETMASK">,
814         Macro<"SIGABRT">,
815         Macro<"SIGFPE">,
816         Macro<"SIGILL">,
817         Macro<"SIGINT">,
818         Macro<"SIGSEGV">,
819         Macro<"SIGTERM">
820       ],
821       [
822         SizeTType,
823         SigAtomicT,
824         SigHandlerT,
825       ],
826       [], // Enumerations
827       [
828         FunctionSpec<"raise", RetValSpec<IntType>, [ArgSpec<IntType>]>,
829         FunctionSpec<
830           "signal",
831           RetValSpec<SigHandlerT>,
832           [ArgSpec<IntType>, ArgSpec<SigHandlerT>]
833         >,
834       ]
835   >;
837   HeaderSpec Threads = HeaderSpec<
838       "threads.h",
839       [
840           Macro<"ONCE_FLAG_INIT">,
841       ],
842       [
843           OnceFlagType,
844           CallOnceFuncType,
845           CndTType,
846           MtxTType,
847           ThrdStartTType,
848           ThrdTType,
849           TssTType,
850           TssDtorTType,
851       ],
852       [
853           EnumeratedNameValue<"mtx_plain">,
854           EnumeratedNameValue<"mtx_recursive">,
855           EnumeratedNameValue<"mtx_timed">,
856           EnumeratedNameValue<"thrd_timedout">,
857           EnumeratedNameValue<"thrd_success">,
858           EnumeratedNameValue<"thrd_busy">,
859           EnumeratedNameValue<"thrd_error">,
860           EnumeratedNameValue<"thrd_nomem">,
861       ],
862       [
863           FunctionSpec<
864               "call_once",
865               RetValSpec<VoidType>,
866               [
867                   ArgSpec<OnceFlagTypePtr>,
868                   ArgSpec<CallOnceFuncType>,
869               ]
870           >,
871           FunctionSpec<
872               "cnd_broadcast",
873               RetValSpec<IntType>,
874               [
875                   ArgSpec<CndTTypePtr>,
876               ]
877           >,
878           FunctionSpec<
879               "cnd_destroy",
880               RetValSpec<VoidType>,
881               [
882                   ArgSpec<CndTTypePtr>,
883               ]
884           >,
885           FunctionSpec<
886               "cnd_init",
887               RetValSpec<IntType>,
888               [
889                   ArgSpec<CndTTypePtr>,
890               ]
891           >,
892           FunctionSpec<
893               "cnd_signal",
894               RetValSpec<IntType>,
895               [
896                   ArgSpec<CndTTypePtr>,
897               ]
898           >,
899           FunctionSpec<
900               "cnd_wait",
901               RetValSpec<IntType>,
902               [
903                   ArgSpec<CndTTypePtr>,
904                   ArgSpec<MtxTTypePtr>,
905               ]
906           >,
907           FunctionSpec<
908               "mtx_init",
909               RetValSpec<IntType>,
910               [
911                   ArgSpec<MtxTTypePtr>,
912                   ArgSpec<IntType>,
913               ]
914           >,
915           FunctionSpec<
916               "mtx_destroy",
917               RetValSpec<IntType>,
918               [
919                   ArgSpec<VoidType>,
920               ]
921           >,
922           FunctionSpec<
923               "mtx_lock",
924               RetValSpec<IntType>,
925               [
926                   ArgSpec<MtxTTypePtr>,
927               ]
928           >,
929           FunctionSpec<
930               "mtx_unlock",
931               RetValSpec<IntType>,
932               [
933                   ArgSpec<MtxTTypePtr>,
934               ]
935           >,
936           FunctionSpec<
937               "thrd_create",
938               RetValSpec<IntType>,
939               [
940                   ArgSpec<ThrdTTypePtr>,
941                   ArgSpec<ThrdStartTType>,
942                   ArgSpec<VoidPtr>,
943               ]
944           >,
945           FunctionSpec<
946               "thrd_join",
947               RetValSpec<IntType>,
948               [
949                   ArgSpec<ThrdTType>,
950                   ArgSpec<IntPtr>,
951               ]
952           >,
953           FunctionSpec<
954               "thrd_detach",
955               RetValSpec<IntType>,
956               [ArgSpec<ThrdTType>]
957           >,
958           FunctionSpec<
959               "thrd_current",
960               RetValSpec<ThrdTType>,
961               [ArgSpec<VoidType>]
962           >,
963           FunctionSpec<
964               "thrd_equal",
965               RetValSpec<IntType>,
966               [ArgSpec<ThrdTType>, ArgSpec<ThrdTType>]
967           >,
968           FunctionSpec<
969               "thrd_exit",
970               RetValSpec<VoidType>,
971               [ArgSpec<IntType>]
972           >,
973           FunctionSpec<
974               "tss_create",
975               RetValSpec<IntType>,
976               [ArgSpec<TssTPtr>, ArgSpec<TssDtorTType>]
977           >,
978           FunctionSpec<
979               "tss_delete",
980               RetValSpec<IntType>,
981               [ArgSpec<TssTType>]
982           >,
983           FunctionSpec<
984               "tss_get",
985               RetValSpec<VoidPtr>,
986               [ArgSpec<TssTType>]
987           >,
988           FunctionSpec<
989               "tss_set",
990               RetValSpec<IntType>,
991               [ArgSpec<TssTType>, ArgSpec<VoidPtr>]
992           >,
993       ]
994   >;
996   HeaderSpec Time = HeaderSpec<
997       "time.h",
998       [], // Macros
999       [ // Types
1000          ClockT,
1001          StructTmType,
1002          TimeTType,
1003       ],
1004       [], // Enumerations
1005       [
1006           FunctionSpec<
1007               "asctime",
1008               RetValSpec<CharPtr>,
1009               [ArgSpec<StructTmPtr>]
1010           >,
1011           FunctionSpec<
1012               "asctime_r",
1013               RetValSpec<CharPtr>,
1014               [
1015                   ArgSpec<StructTmPtr>,
1016                   ArgSpec<CharPtr>,
1017               ]
1018           >,
1019           FunctionSpec<
1020               "clock",
1021               RetValSpec<ClockT>,
1022               [ArgSpec<VoidType>]
1023           >,
1024           FunctionSpec<
1025               "difftime",
1026               RetValSpec<DoubleType>,
1027               [
1028                   ArgSpec<TimeTType>,
1029                   ArgSpec<TimeTType>,
1030               ]
1031           >,
1032           FunctionSpec<
1033               "gmtime",
1034               RetValSpec<StructTmPtr>,
1035               [ArgSpec<TimeTTypePtr>]
1036           >,
1037           FunctionSpec<
1038               "gmtime_r",
1039               RetValSpec<StructTmPtr>,
1040               [
1041                   ArgSpec<TimeTTypePtr>,
1042                   ArgSpec<StructTmPtr>,
1043               ]
1044           >,
1045           FunctionSpec<
1046               "mktime",
1047               RetValSpec<TimeTType>,
1048               [ArgSpec<StructTmPtr>]
1049           >,
1050           FunctionSpec<
1051               "time",
1052               RetValSpec<TimeTType>,
1053               [ArgSpec<TimeTTypePtr>]
1054           >,
1055       ]
1056   >;
1058   HeaderSpec SetJmp = HeaderSpec<
1059       "setjmp.h",
1060       [], // Macros
1061       [JmpBuf],
1062       [], // Enumerations
1063       [
1064           FunctionSpec<
1065               "longjmp",
1066               RetValSpec<NoReturn>,
1067               [ArgSpec<JmpBuf>, ArgSpec<IntType>]
1068           >,
1069           FunctionSpec<
1070               "setjmp",
1071               RetValSpec<IntType>,
1072               [ArgSpec<JmpBuf>]
1073           >,
1074           FunctionSpec<
1075               "longjmp",
1076               RetValSpec<VoidType>,
1077               [ArgSpec<JmpBuf>, ArgSpec<IntType>]
1078           >,
1079       ]
1080   >;
1082   HeaderSpec WChar = HeaderSpec<
1083       "wchar.h",
1084       [ // Macros
1085         Macro<"WEOF">,
1086       ], 
1087       [ //Types
1088         SizeTType,
1089         WIntType,
1090         WCharType,
1091       ],
1092       [], // Enumerations
1093       [
1094           FunctionSpec<
1095               "wctob",
1096               RetValSpec<IntType>,
1097               [ArgSpec<WIntType>]
1098           >,
1099       ]
1100   >;
1103   let Headers = [
1104     Assert,
1105     CType,
1106     Errno,
1107     Fenv,
1108     Math,
1109     String,
1110     StdIO,
1111     StdLib,
1112     IntTypes,
1113     SetJmp,
1114     Signal,
1115     Threads,
1116     Time,
1117     WChar,
1118   ];