xref: /llvm-project-15.0.7/libc/spec/stdc.td (revision 643dfd97)
1def StdC : StandardSpec<"stdc"> {
2
3  NamedType StructTmType = NamedType<"struct tm">;
4  PtrType StructTmPtr = PtrType<StructTmType>;
5  PtrType TimeTTypePtr = PtrType<TimeTType>;
6
7  NamedType DivTType = NamedType<"div_t">;
8  NamedType LDivTType = NamedType<"ldiv_t">;
9  NamedType LLDivTType = NamedType<"lldiv_t">;
10
11  HeaderSpec Assert = HeaderSpec<
12      "assert.h",
13      [
14          Macro<"static_assert">,
15          Macro<"assert">,
16      ],
17      [], // Types
18      [], // Enumerations
19      []
20  >;
21
22  HeaderSpec CType = HeaderSpec<
23      "ctype.h",
24      [], // Macros
25      [], // Types
26      [], // Enumerations
27      [
28          FunctionSpec<
29              "isalnum",
30              RetValSpec<IntType>,
31              [ArgSpec<IntType>]
32          >,
33          FunctionSpec<
34              "isalpha",
35              RetValSpec<IntType>,
36              [ArgSpec<IntType>]
37          >,
38          FunctionSpec<
39              "isblank",
40              RetValSpec<IntType>,
41              [ArgSpec<IntType>]
42          >,
43          FunctionSpec<
44              "iscntrl",
45              RetValSpec<IntType>,
46              [ArgSpec<IntType>]
47          >,
48          FunctionSpec<
49              "isdigit",
50              RetValSpec<IntType>,
51              [ArgSpec<IntType>]
52          >,
53          FunctionSpec<
54              "isgraph",
55              RetValSpec<IntType>,
56              [ArgSpec<IntType>]
57          >,
58          FunctionSpec<
59              "islower",
60              RetValSpec<IntType>,
61              [ArgSpec<IntType>]
62          >,
63          FunctionSpec<
64              "isprint",
65              RetValSpec<IntType>,
66              [ArgSpec<IntType>]
67          >,
68          FunctionSpec<
69              "ispunct",
70              RetValSpec<IntType>,
71              [ArgSpec<IntType>]
72          >,
73          FunctionSpec<
74              "isspace",
75              RetValSpec<IntType>,
76              [ArgSpec<IntType>]
77          >,
78          FunctionSpec<
79              "isupper",
80              RetValSpec<IntType>,
81              [ArgSpec<IntType>]
82          >,
83          FunctionSpec<
84              "isxdigit",
85              RetValSpec<IntType>,
86              [ArgSpec<IntType>]
87          >,
88          FunctionSpec<
89              "tolower",
90              RetValSpec<IntType>,
91              [ArgSpec<IntType>]
92          >,
93          FunctionSpec<
94              "toupper",
95              RetValSpec<IntType>,
96              [ArgSpec<IntType>]
97          >,
98      ]
99  >;
100
101  NamedType FEnvT = NamedType<"fenv_t">;
102  PtrType FEnvTPtr = PtrType<FEnvT>;
103  ConstType ConstFEnvTPtr = ConstType<FEnvTPtr>;
104  NamedType FExceptT = NamedType<"fexcept_t">;
105  PtrType FExceptTPtr = PtrType<FExceptT>;
106  ConstType ConstFExceptTPtr = ConstType<FExceptTPtr>;
107  HeaderSpec Fenv = HeaderSpec<
108      "fenv.h",
109      [
110          Macro<"FE_DIVBYZERO">,
111          Macro<"FE_INEXACT">,
112          Macro<"FE_INVALID">,
113          Macro<"FE_OVERFLOW">,
114          Macro<"FE_UNDERFLOW">,
115          Macro<"FE_ALL_EXCEPT">,
116
117          Macro<"FE_DOWNWARD">,
118          Macro<"FE_TONEAREST">,
119          Macro<"FE_TOWARDZERO">,
120          Macro<"FE_UPWARD">,
121
122          Macro<"FE_DFL_ENV">
123      ],
124      [
125          NamedType<"fenv_t">,
126          NamedType<"fexcept_t">,
127      ], // Types
128      [], // Enumerations
129      [
130          FunctionSpec<
131              "feclearexcept",
132              RetValSpec<IntType>,
133              [ArgSpec<IntType>]
134          >,
135          FunctionSpec<
136              "fetestexcept",
137              RetValSpec<IntType>,
138              [ArgSpec<IntType>]
139          >,
140          FunctionSpec<
141              "feraiseexcept",
142              RetValSpec<IntType>,
143              [ArgSpec<IntType>]
144          >,
145          FunctionSpec<
146              "fesetround",
147              RetValSpec<IntType>,
148              [ArgSpec<IntType>]
149          >,
150          FunctionSpec<
151              "fegetround",
152              RetValSpec<IntType>,
153              []
154          >,
155          FunctionSpec<
156              "fegetenv",
157              RetValSpec<IntType>,
158              [ArgSpec<FEnvTPtr>]
159          >,
160          FunctionSpec<
161              "fesetenv",
162              RetValSpec<IntType>,
163              [ArgSpec<ConstFEnvTPtr>]
164          >,
165          FunctionSpec<
166              "fegetexceptflag",
167              RetValSpec<IntType>,
168              [ArgSpec<FExceptTPtr>, ArgSpec<IntType>]
169          >,
170          FunctionSpec<
171              "fesetexceptflag",
172              RetValSpec<IntType>,
173              [ArgSpec<ConstFExceptTPtr>, ArgSpec<IntType>]
174          >,
175          FunctionSpec<
176              "feholdexcept",
177              RetValSpec<IntType>,
178              [ArgSpec<FEnvTPtr>]
179          >,
180          FunctionSpec<
181              "feupdateenv",
182              RetValSpec<IntType>,
183              [ArgSpec<ConstFEnvTPtr>]
184          >,
185      ]
186  >;
187
188  HeaderSpec String = HeaderSpec<
189      "string.h",
190      [
191          Macro<"NULL">,
192      ],
193      [
194          SizeTType,
195      ],
196      [], // Enumerations
197      [
198          FunctionSpec<
199              "memcpy",
200              RetValSpec<VoidPtr>,
201              [ArgSpec<VoidRestrictedPtr>,
202               ArgSpec<ConstVoidRestrictedPtr>,
203               ArgSpec<SizeTType>]
204          >,
205          FunctionSpec<
206              "memmove",
207              RetValSpec<VoidPtr>,
208              [ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
209          >,
210          FunctionSpec<
211              "memcmp",
212              RetValSpec<IntType>,
213              [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
214          >,
215          FunctionSpec<
216              "memchr",
217              RetValSpec<VoidPtr>,
218              [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
219          >,
220          FunctionSpec<
221              "memset",
222              RetValSpec<VoidPtr>,
223              [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
224          >,
225          FunctionSpec<
226              "strcpy",
227              RetValSpec<CharPtr>,
228              [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
229          >,
230          FunctionSpec<
231              "strncpy",
232              RetValSpec<CharPtr>,
233              [ArgSpec<CharRestrictedPtr>,
234               ArgSpec<ConstCharRestrictedPtr>,
235               ArgSpec<SizeTType>]
236          >,
237          FunctionSpec<
238              "strcat",
239              RetValSpec<CharPtr>,
240              [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
241          >,
242          FunctionSpec<
243              "strncat",
244              RetValSpec<CharPtr>,
245              [ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
246          >,
247          FunctionSpec<
248              "strcmp",
249              RetValSpec<IntType>,
250              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
251          >,
252          FunctionSpec<
253              "strcoll",
254              RetValSpec<IntType>,
255              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
256          >,
257          FunctionSpec<
258              "strncmp",
259              RetValSpec<IntType>,
260              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
261          >,
262          FunctionSpec<
263              "strxfrm",
264              RetValSpec<SizeTType>,
265              [ArgSpec<CharRestrictedPtr>,
266               ArgSpec<ConstCharRestrictedPtr>,
267               ArgSpec<SizeTType>]
268          >,
269          FunctionSpec<
270              "strchr",
271              RetValSpec<CharPtr>,
272              [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
273          >,
274          FunctionSpec<
275              "strcspn",
276              RetValSpec<SizeTType>,
277              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
278          >,
279          FunctionSpec<
280              "strdup",
281              RetValSpec<CharPtr>,
282              [ArgSpec<ConstCharPtr>]
283          >,
284          FunctionSpec<
285              "strndup",
286              RetValSpec<CharPtr>,
287              [ArgSpec<ConstCharPtr>,ArgSpec<SizeTType>]
288          >,
289          FunctionSpec<
290              "strpbrk",
291              RetValSpec<CharPtr>,
292              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
293          >,
294          FunctionSpec<
295              "strrchr",
296              RetValSpec<CharPtr>,
297              [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
298          >,
299          FunctionSpec<
300              "strspn",
301              RetValSpec<SizeTType>,
302              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
303          >,
304          FunctionSpec<
305              "strstr",
306              RetValSpec<CharPtr>,
307              [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
308          >,
309          FunctionSpec<
310              "strtok",
311              RetValSpec<CharPtr>,
312              [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
313          >,
314          FunctionSpec<
315              "strerror",
316              RetValSpec<CharPtr>,
317              [ArgSpec<IntType>]
318          >,
319          FunctionSpec<
320              "strlen",
321              RetValSpec<SizeTType>,
322              [ArgSpec<ConstCharPtr>]
323          >,
324      ]
325  >;
326
327  HeaderSpec Math = HeaderSpec<
328      "math.h",
329      [
330          Macro<"MATH_ERRNO">,
331          Macro<"MATH_ERREXCEPT">,
332          Macro<"math_errhandling">,
333
334          Macro<"INFINITY">,
335          Macro<"NAN">,
336
337          Macro<"FP_ILOGB0">,
338          Macro<"FP_ILOGBNAN">,
339
340          Macro<"isfinite">,
341          Macro<"isinf">,
342          Macro<"isnan">,
343      ],
344      [
345          NamedType<"float_t">,
346          NamedType<"double_t">,
347      ],
348      [], // Enumerations
349      [
350          FunctionSpec<"copysign", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
351          FunctionSpec<"copysignf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
352          FunctionSpec<"copysignl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
353
354          FunctionSpec<"ceil", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
355          FunctionSpec<"ceilf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
356          FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
357
358          FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
359          FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
360          FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
361
362          FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
363          FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
364          FunctionSpec<"fdiml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
365
366          FunctionSpec<"floor", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
367          FunctionSpec<"floorf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
368          FunctionSpec<"floorl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
369
370          FunctionSpec<"fmin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
371          FunctionSpec<"fminf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
372          FunctionSpec<"fminl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
373
374          FunctionSpec<"fmax", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
375          FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
376          FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
377
378          FunctionSpec<"fma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
379          FunctionSpec<"fmaf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>]>,
380
381          FunctionSpec<"fmod", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
382
383          FunctionSpec<"fmodf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
384
385          FunctionSpec<"frexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
386          FunctionSpec<"frexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
387          FunctionSpec<"frexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
388
389          FunctionSpec<"hypot", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
390          FunctionSpec<"hypotf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
391
392          FunctionSpec<"ilogb", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
393          FunctionSpec<"ilogbf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
394          FunctionSpec<"ilogbl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
395
396          FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
397          FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
398          FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
399
400          FunctionSpec<"log10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
401
402          FunctionSpec<"log1pf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
403
404          FunctionSpec<"log2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
405
406          FunctionSpec<"logf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
407
408          FunctionSpec<"logb", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
409          FunctionSpec<"logbf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
410          FunctionSpec<"logbl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
411
412          FunctionSpec<"modf", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoublePtr>]>,
413          FunctionSpec<"modff", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatPtr>]>,
414          FunctionSpec<"modfl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoublePtr>]>,
415
416          FunctionSpec<"cos", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
417          FunctionSpec<"cosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
418          FunctionSpec<"sin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
419          FunctionSpec<"sinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
420          FunctionSpec<"tan", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
421
422          FunctionSpec<"expf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
423          FunctionSpec<"exp2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
424          FunctionSpec<"expm1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
425
426          FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
427          FunctionSpec<"remainder", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
428          FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
429
430          FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
431          FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
432          FunctionSpec<"remquol", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
433
434          FunctionSpec<"round", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
435          FunctionSpec<"roundf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
436          FunctionSpec<"roundl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
437
438          FunctionSpec<"lround", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
439          FunctionSpec<"lroundf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
440          FunctionSpec<"lroundl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
441
442          FunctionSpec<"llround", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
443          FunctionSpec<"llroundf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
444          FunctionSpec<"llroundl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
445
446          FunctionSpec<"rint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
447          FunctionSpec<"rintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
448          FunctionSpec<"rintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
449
450          FunctionSpec<"lrint", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
451          FunctionSpec<"lrintf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
452          FunctionSpec<"lrintl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
453
454          FunctionSpec<"llrint", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
455          FunctionSpec<"llrintf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
456          FunctionSpec<"llrintl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
457
458          FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
459          FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
460          FunctionSpec<"sqrtl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
461
462          FunctionSpec<"trunc", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
463          FunctionSpec<"truncf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
464          FunctionSpec<"truncl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
465
466          FunctionSpec<"nearbyint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
467          FunctionSpec<"nearbyintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
468          FunctionSpec<"nearbyintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
469
470          FunctionSpec<"nextafterf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
471          FunctionSpec<"nextafter", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
472          FunctionSpec<"nextafterl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
473      ]
474  >;
475
476  HeaderSpec StdIO = HeaderSpec<
477      "stdio.h",
478      [
479          Macro<"stderr">,
480          Macro<"stdout">,
481          Macro<"_IOFBF">,
482          Macro<"_IOLBF">,
483          Macro<"_IONBF">,
484      ], // Macros
485      [ // Types
486          SizeTType,
487          FILE,
488      ],
489      [], // Enumerations
490      [
491          FunctionSpec<
492              "clearerr",
493              RetValSpec<VoidType>,
494              [ArgSpec<FILEPtr>]
495          >,
496          FunctionSpec<
497              "fclose",
498              RetValSpec<IntType>,
499              [ArgSpec<FILEPtr>]
500          >,
501          FunctionSpec<
502              "feof",
503              RetValSpec<IntType>,
504              [ArgSpec<FILEPtr>]
505          >,
506          FunctionSpec<
507              "ferror",
508              RetValSpec<IntType>,
509              [ArgSpec<FILEPtr>]
510          >,
511          FunctionSpec<
512              "fflush",
513              RetValSpec<IntType>,
514              [ArgSpec<FILEPtr>]
515          >,
516          FunctionSpec<
517              "fopen",
518              RetValSpec<FILEPtr>,
519              [ArgSpec<ConstCharPtr>,
520               ArgSpec<ConstCharPtr>]
521          >,
522          FunctionSpec<
523              "fread",
524              RetValSpec<SizeTType>,
525              [ArgSpec<VoidRestrictedPtr>,
526               ArgSpec<SizeTType>,
527               ArgSpec<SizeTType>,
528               ArgSpec<FILERestrictedPtr>]
529          >,
530          FunctionSpec<
531              "fseek",
532              RetValSpec<IntType>,
533              [ArgSpec<FILEPtr>,
534               ArgSpec<LongType>,
535               ArgSpec<IntType>]
536          >,
537          FunctionSpec<
538              "fwrite",
539              RetValSpec<SizeTType>,
540              [ArgSpec<ConstVoidRestrictedPtr>,
541               ArgSpec<SizeTType>,
542               ArgSpec<SizeTType>,
543               ArgSpec<FILERestrictedPtr>]
544          >,
545          FunctionSpec<
546              "sprintf",
547              RetValSpec<IntType>,
548              [ArgSpec<CharRestrictedPtr>,
549               ArgSpec<ConstCharRestrictedPtr>,
550               ArgSpec<VarArgType>]
551          >,
552          FunctionSpec<
553              "snprintf",
554              RetValSpec<IntType>,
555              [ArgSpec<CharRestrictedPtr>,
556               ArgSpec<SizeTType>,
557               ArgSpec<ConstCharRestrictedPtr>,
558               ArgSpec<VarArgType>]
559          >,
560          FunctionSpec<
561              "printf",
562              RetValSpec<IntType>,
563              [ArgSpec<ConstCharRestrictedPtr>,
564               ArgSpec<VarArgType>]
565          >,
566          FunctionSpec<
567              "fprintf",
568              RetValSpec<IntType>,
569              [ArgSpec<FILERestrictedPtr>,
570               ArgSpec<ConstCharRestrictedPtr>,
571               ArgSpec<VarArgType>]
572          >,
573      ],
574      [
575          ObjectSpec<
576              "stdout",
577              "FILE *"
578          >,
579          ObjectSpec<
580              "stderr",
581              "FILE *"
582          >,
583      ]
584  >;
585
586  HeaderSpec StdLib = HeaderSpec<
587      "stdlib.h",
588      [], // Macros
589      [
590          DivTType,
591          LDivTType,
592          LLDivTType,
593          SizeTType,
594          BSearchCompareT,
595          QSortCompareT,
596          AtexitHandlerT,
597      ], // Types
598      [], // Enumerations
599      [
600          FunctionSpec<"abort", RetValSpec<NoReturn>, [ArgSpec<VoidType>]>,
601
602          FunctionSpec<"bsearch", RetValSpec<VoidPtr>, [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<BSearchCompareT>]>,
603
604          FunctionSpec<"abs", RetValSpec<IntType>, [ArgSpec<IntType>]>,
605          FunctionSpec<"labs", RetValSpec<LongType>, [ArgSpec<LongType>]>,
606          FunctionSpec<"llabs", RetValSpec<LongLongType>, [ArgSpec<LongLongType>]>,
607
608          FunctionSpec<"atof", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>]>,
609          FunctionSpec<"atoi", RetValSpec<IntType>, [ArgSpec<ConstCharPtr>]>,
610          FunctionSpec<"atol", RetValSpec<LongType>, [ArgSpec<ConstCharPtr>]>,
611          FunctionSpec<"atoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharPtr>]>,
612
613          FunctionSpec<"div", RetValSpec<DivTType>, [ArgSpec<IntType>, ArgSpec<IntType>]>,
614          FunctionSpec<"ldiv", RetValSpec<LDivTType>, [ArgSpec<LongType>, ArgSpec<LongType>]>,
615          FunctionSpec<"lldiv", RetValSpec<LLDivTType>, [ArgSpec<LongLongType>, ArgSpec<LongLongType>]>,
616
617          FunctionSpec<"qsort", RetValSpec<VoidType>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<QSortCompareT>]>,
618
619          FunctionSpec<"strtof", RetValSpec<FloatType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
620          FunctionSpec<"strtod", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
621          FunctionSpec<"strtold", RetValSpec<LongDoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
622          FunctionSpec<"strtol", RetValSpec<LongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
623          FunctionSpec<"strtoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
624          FunctionSpec<"strtoul", RetValSpec<UnsignedLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
625          FunctionSpec<"strtoull", RetValSpec<UnsignedLongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
626
627          FunctionSpec<"malloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>]>,
628          FunctionSpec<"calloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
629          FunctionSpec<"realloc", RetValSpec<VoidPtr>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]>,
630          FunctionSpec<"aligned_alloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
631          FunctionSpec<"free", RetValSpec<VoidType>, [ArgSpec<VoidPtr>]>,
632
633          FunctionSpec<"_Exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
634          FunctionSpec<"exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
635          FunctionSpec<"atexit", RetValSpec<IntType>, [ArgSpec<AtexitHandlerT>]>,
636      ]
637  >;
638
639  NamedType IMaxDivTType = NamedType<"imaxdiv_t">;
640
641  HeaderSpec IntTypes = HeaderSpec<
642      "inttypes.h",
643      [], // Macros
644      [
645        IMaxDivTType,
646      ], // Types
647      [], // Enumerations
648      [
649          FunctionSpec<"imaxabs", RetValSpec<IntMaxTType>, [ArgSpec<IntMaxTType>]>,
650          FunctionSpec<"imaxdiv", RetValSpec<IMaxDivTType>, [ArgSpec<IntMaxTType>, ArgSpec<IntMaxTType>]>,
651          FunctionSpec<"strtoimax", RetValSpec<IntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
652          FunctionSpec<"strtoumax", RetValSpec<UIntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
653      ]
654  >;
655
656  HeaderSpec Errno = HeaderSpec<
657      "errno.h",
658      [
659        Macro<"errno">,
660        Macro<"EDOM">,
661        Macro<"EILSEQ">,
662        Macro<"ERANGE">,
663      ]
664  >;
665
666  HeaderSpec Signal = HeaderSpec<
667      "signal.h",
668      [
669        Macro<"SIG_BLOCK">,
670        Macro<"SIG_UNBLOCK">,
671        Macro<"SIG_SETMASK">,
672
673        Macro<"SIGABRT">,
674        Macro<"SIGFPE">,
675        Macro<"SIGILL">,
676        Macro<"SIGINT">,
677        Macro<"SIGSEGV">,
678        Macro<"SIGTERM">
679      ],
680      [
681        SizeTType,
682        SigHandlerT,
683      ],
684      [], // Enumerations
685      [
686        FunctionSpec<"raise", RetValSpec<IntType>, [ArgSpec<IntType>]>,
687        FunctionSpec<
688          "signal",
689          RetValSpec<SigHandlerT>,
690          [ArgSpec<IntType>, ArgSpec<SigHandlerT>]
691        >,
692      ]
693  >;
694
695  HeaderSpec Threads = HeaderSpec<
696      "threads.h",
697      [
698          Macro<"ONCE_FLAG_INIT">,
699      ],
700      [
701          OnceFlagType,
702          CallOnceFuncType,
703          CndTType,
704          MtxTType,
705          ThrdStartTType,
706          ThrdTType,
707      ],
708      [
709          EnumeratedNameValue<"mtx_plain">,
710          EnumeratedNameValue<"mtx_recursive">,
711          EnumeratedNameValue<"mtx_timed">,
712          EnumeratedNameValue<"thrd_timedout">,
713          EnumeratedNameValue<"thrd_success">,
714          EnumeratedNameValue<"thrd_busy">,
715          EnumeratedNameValue<"thrd_error">,
716          EnumeratedNameValue<"thrd_nomem">,
717      ],
718      [
719          FunctionSpec<
720              "call_once",
721              RetValSpec<VoidType>,
722              [
723                  ArgSpec<OnceFlagTypePtr>,
724                  ArgSpec<CallOnceFuncType>,
725              ]
726          >,
727          FunctionSpec<
728              "cnd_broadcast",
729              RetValSpec<IntType>,
730              [
731                  ArgSpec<CndTTypePtr>,
732              ]
733          >,
734          FunctionSpec<
735              "cnd_destroy",
736              RetValSpec<VoidType>,
737              [
738                  ArgSpec<CndTTypePtr>,
739              ]
740          >,
741          FunctionSpec<
742              "cnd_init",
743              RetValSpec<IntType>,
744              [
745                  ArgSpec<CndTTypePtr>,
746              ]
747          >,
748          FunctionSpec<
749              "cnd_signal",
750              RetValSpec<IntType>,
751              [
752                  ArgSpec<CndTTypePtr>,
753              ]
754          >,
755          FunctionSpec<
756              "cnd_wait",
757              RetValSpec<IntType>,
758              [
759                  ArgSpec<CndTTypePtr>,
760                  ArgSpec<MtxTTypePtr>,
761              ]
762          >,
763          FunctionSpec<
764              "mtx_init",
765              RetValSpec<IntType>,
766              [
767                  ArgSpec<MtxTTypePtr>,
768                  ArgSpec<IntType>,
769              ]
770          >,
771          FunctionSpec<
772              "mtx_destroy",
773              RetValSpec<IntType>,
774              [
775                  ArgSpec<VoidType>,
776              ]
777          >,
778          FunctionSpec<
779              "mtx_lock",
780              RetValSpec<IntType>,
781              [
782                  ArgSpec<MtxTTypePtr>,
783              ]
784          >,
785          FunctionSpec<
786              "mtx_unlock",
787              RetValSpec<IntType>,
788              [
789                  ArgSpec<MtxTTypePtr>,
790              ]
791          >,
792          FunctionSpec<
793              "thrd_create",
794              RetValSpec<IntType>,
795              [
796                  ArgSpec<ThrdTTypePtr>,
797                  ArgSpec<ThrdStartTType>,
798                  ArgSpec<VoidPtr>,
799              ]
800          >,
801          FunctionSpec<
802              "thrd_join",
803              RetValSpec<IntType>,
804              [
805                  ArgSpec<ThrdTTypePtr>,
806                  ArgSpec<IntPtr>,
807              ]
808          >,
809          FunctionSpec<
810              "thrd_detach",
811              RetValSpec<IntType>,
812              [ArgSpec<ThrdTType>]
813          >,
814          FunctionSpec<
815              "thrd_current",
816              RetValSpec<ThrdTType>,
817              [ArgSpec<VoidType>]
818          >,
819          FunctionSpec<
820              "thrd_equal",
821              RetValSpec<IntType>,
822              [ArgSpec<ThrdTType>, ArgSpec<ThrdTType>]
823          >
824      ]
825  >;
826
827  HeaderSpec Time = HeaderSpec<
828      "time.h",
829      [], // Macros
830      [ // Types
831       StructTmType,
832       TimeTType,
833      ],
834      [], // Enumerations
835      [
836          FunctionSpec<
837              "asctime",
838              RetValSpec<CharPtr>,
839              [ArgSpec<StructTmPtr>]
840          >,
841          FunctionSpec<
842              "asctime_r",
843              RetValSpec<CharPtr>,
844              [
845                  ArgSpec<StructTmPtr>,
846                  ArgSpec<CharPtr>,
847              ]
848          >,
849          FunctionSpec<
850              "gmtime",
851              RetValSpec<StructTmPtr>,
852              [ArgSpec<TimeTTypePtr>]
853          >,
854          FunctionSpec<
855              "gmtime_r",
856              RetValSpec<StructTmPtr>,
857              [
858                  ArgSpec<TimeTTypePtr>,
859                  ArgSpec<StructTmPtr>,
860              ]
861          >,
862          FunctionSpec<
863              "mktime",
864              RetValSpec<TimeTType>,
865              [ArgSpec<StructTmPtr>]
866          >,
867      ]
868  >;
869
870  let Headers = [
871    Assert,
872    CType,
873    Errno,
874    Fenv,
875    Math,
876    String,
877    StdIO,
878    StdLib,
879    IntTypes,
880    Signal,
881    Threads,
882    Time,
883  ];
884}
885