1def StdC : StandardSpec<"stdc"> { 2 3 NamedType FILE = NamedType<"FILE">; 4 PtrType FILEPtr = PtrType<FILE>; 5 RestrictedPtrType FILERestrictedPtr = RestrictedPtrType<FILE>; 6 NamedType StructTmType = NamedType<"struct tm">; 7 PtrType StructTmPtr = PtrType<StructTmType>; 8 9 HeaderSpec Assert = HeaderSpec< 10 "assert.h", 11 [ 12 Macro<"static_assert">, 13 Macro<"assert">, 14 ], 15 [], // Types 16 [], // Enumerations 17 [] 18 >; 19 20 HeaderSpec CType = HeaderSpec< 21 "ctype.h", 22 [], // Macros 23 [], // Types 24 [], // Enumerations 25 [ 26 FunctionSpec< 27 "isalnum", 28 RetValSpec<IntType>, 29 [ArgSpec<IntType>] 30 >, 31 FunctionSpec< 32 "isalpha", 33 RetValSpec<IntType>, 34 [ArgSpec<IntType>] 35 >, 36 FunctionSpec< 37 "isblank", 38 RetValSpec<IntType>, 39 [ArgSpec<IntType>] 40 >, 41 FunctionSpec< 42 "iscntrl", 43 RetValSpec<IntType>, 44 [ArgSpec<IntType>] 45 >, 46 FunctionSpec< 47 "isdigit", 48 RetValSpec<IntType>, 49 [ArgSpec<IntType>] 50 >, 51 FunctionSpec< 52 "isgraph", 53 RetValSpec<IntType>, 54 [ArgSpec<IntType>] 55 >, 56 FunctionSpec< 57 "islower", 58 RetValSpec<IntType>, 59 [ArgSpec<IntType>] 60 >, 61 FunctionSpec< 62 "isprint", 63 RetValSpec<IntType>, 64 [ArgSpec<IntType>] 65 >, 66 FunctionSpec< 67 "ispunct", 68 RetValSpec<IntType>, 69 [ArgSpec<IntType>] 70 >, 71 FunctionSpec< 72 "isspace", 73 RetValSpec<IntType>, 74 [ArgSpec<IntType>] 75 >, 76 FunctionSpec< 77 "isupper", 78 RetValSpec<IntType>, 79 [ArgSpec<IntType>] 80 >, 81 FunctionSpec< 82 "isxdigit", 83 RetValSpec<IntType>, 84 [ArgSpec<IntType>] 85 >, 86 FunctionSpec< 87 "tolower", 88 RetValSpec<IntType>, 89 [ArgSpec<IntType>] 90 >, 91 FunctionSpec< 92 "toupper", 93 RetValSpec<IntType>, 94 [ArgSpec<IntType>] 95 >, 96 ] 97 >; 98 99 HeaderSpec Fenv = HeaderSpec< 100 "fenv.h", 101 [ 102 Macro<"FE_DIVBYZERO">, 103 Macro<"FE_INEXACT">, 104 Macro<"FE_INVALID">, 105 Macro<"FE_OVERFLOW">, 106 Macro<"FE_UNDERFLOW">, 107 Macro<"FE_ALL_EXCEPT">, 108 109 Macro<"FE_DOWNWARD">, 110 Macro<"FE_TONEAREST">, 111 Macro<"FE_TOWARDZERO">, 112 Macro<"FE_UPWARD"> 113 ], 114 [], // Types 115 [], // Enumerations 116 [ 117 FunctionSpec< 118 "feclearexcept", 119 RetValSpec<IntType>, 120 [ArgSpec<IntType>] 121 >, 122 FunctionSpec< 123 "fetestexcept", 124 RetValSpec<IntType>, 125 [ArgSpec<IntType>] 126 >, 127 FunctionSpec< 128 "feraiseexcept", 129 RetValSpec<IntType>, 130 [ArgSpec<IntType>] 131 >, 132 FunctionSpec< 133 "fesetround", 134 RetValSpec<IntType>, 135 [ArgSpec<IntType>] 136 >, 137 FunctionSpec< 138 "fegetround", 139 RetValSpec<IntType>, 140 [] 141 >, 142 ] 143 >; 144 145 HeaderSpec String = HeaderSpec< 146 "string.h", 147 [ 148 Macro<"NULL">, 149 ], 150 [ 151 SizeTType, 152 ], 153 [], // Enumerations 154 [ 155 FunctionSpec< 156 "memcpy", 157 RetValSpec<VoidPtr>, 158 [ArgSpec<VoidRestrictedPtr>, 159 ArgSpec<ConstVoidRestrictedPtr>, 160 ArgSpec<SizeTType>] 161 >, 162 FunctionSpec< 163 "memmove", 164 RetValSpec<VoidPtr>, 165 [ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>] 166 >, 167 FunctionSpec< 168 "memcmp", 169 RetValSpec<IntType>, 170 [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>] 171 >, 172 FunctionSpec< 173 "memchr", 174 RetValSpec<VoidPtr>, 175 [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>] 176 >, 177 FunctionSpec< 178 "memset", 179 RetValSpec<VoidPtr>, 180 [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>] 181 >, 182 FunctionSpec< 183 "strcpy", 184 RetValSpec<CharPtr>, 185 [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>] 186 >, 187 FunctionSpec< 188 "strncpy", 189 RetValSpec<CharPtr>, 190 [ArgSpec<CharRestrictedPtr>, 191 ArgSpec<ConstCharRestrictedPtr>, 192 ArgSpec<SizeTType>] 193 >, 194 FunctionSpec< 195 "strcat", 196 RetValSpec<CharPtr>, 197 [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>] 198 >, 199 FunctionSpec< 200 "strncat", 201 RetValSpec<CharPtr>, 202 [ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>] 203 >, 204 FunctionSpec< 205 "strcmp", 206 RetValSpec<IntType>, 207 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>] 208 >, 209 FunctionSpec< 210 "strcoll", 211 RetValSpec<IntType>, 212 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>] 213 >, 214 FunctionSpec< 215 "strncmp", 216 RetValSpec<IntType>, 217 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>] 218 >, 219 FunctionSpec< 220 "strxfrm", 221 RetValSpec<SizeTType>, 222 [ArgSpec<CharRestrictedPtr>, 223 ArgSpec<ConstCharRestrictedPtr>, 224 ArgSpec<SizeTType>] 225 >, 226 FunctionSpec< 227 "strchr", 228 RetValSpec<CharPtr>, 229 [ArgSpec<ConstCharPtr>, ArgSpec<IntType>] 230 >, 231 FunctionSpec< 232 "strcspn", 233 RetValSpec<SizeTType>, 234 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>] 235 >, 236 FunctionSpec< 237 "strpbrk", 238 RetValSpec<CharPtr>, 239 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>] 240 >, 241 FunctionSpec< 242 "strrchr", 243 RetValSpec<CharPtr>, 244 [ArgSpec<ConstCharPtr>, ArgSpec<IntType>] 245 >, 246 FunctionSpec< 247 "strspn", 248 RetValSpec<SizeTType>, 249 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>] 250 >, 251 FunctionSpec< 252 "strstr", 253 RetValSpec<CharPtr>, 254 [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>] 255 >, 256 FunctionSpec< 257 "strtok", 258 RetValSpec<CharPtr>, 259 [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>] 260 >, 261 FunctionSpec< 262 "strerror", 263 RetValSpec<CharPtr>, 264 [ArgSpec<IntType>] 265 >, 266 FunctionSpec< 267 "strlen", 268 RetValSpec<SizeTType>, 269 [ArgSpec<ConstCharPtr>] 270 >, 271 ] 272 >; 273 274 HeaderSpec Math = HeaderSpec< 275 "math.h", 276 [ 277 Macro<"MATH_ERRNO">, 278 Macro<"MATH_ERREXCEPT">, 279 Macro<"math_errhandling">, 280 281 Macro<"INFINITY">, 282 Macro<"NAN">, 283 284 Macro<"FP_ILOGB0">, 285 Macro<"FP_ILOGBNAN">, 286 287 Macro<"isfinite">, 288 Macro<"isinf">, 289 Macro<"isnan">, 290 ], 291 [ 292 NamedType<"float_t">, 293 NamedType<"double_t">, 294 ], 295 [], // Enumerations 296 [ 297 FunctionSpec<"copysign", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>, 298 FunctionSpec<"copysignf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>, 299 FunctionSpec<"copysignl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>, 300 301 FunctionSpec<"ceil", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 302 FunctionSpec<"ceilf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 303 FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 304 305 FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 306 FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 307 FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 308 309 FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>, 310 FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>, 311 FunctionSpec<"fdiml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>, 312 313 FunctionSpec<"floor", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 314 FunctionSpec<"floorf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 315 FunctionSpec<"floorl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 316 317 FunctionSpec<"fmin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>, 318 FunctionSpec<"fminf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>, 319 FunctionSpec<"fminl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>, 320 321 FunctionSpec<"fmax", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>, 322 FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>, 323 FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>, 324 325 FunctionSpec<"frexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntPtr>]>, 326 FunctionSpec<"frexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntPtr>]>, 327 FunctionSpec<"frexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>, 328 329 FunctionSpec<"hypot", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>, 330 FunctionSpec<"hypotf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>, 331 332 FunctionSpec<"ilogb", RetValSpec<IntType>, [ArgSpec<DoubleType>]>, 333 FunctionSpec<"ilogbf", RetValSpec<IntType>, [ArgSpec<FloatType>]>, 334 FunctionSpec<"ilogbl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>, 335 336 FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>, 337 FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>, 338 FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>, 339 340 FunctionSpec<"logb", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 341 FunctionSpec<"logbf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 342 FunctionSpec<"logbl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 343 344 FunctionSpec<"modf", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoublePtr>]>, 345 FunctionSpec<"modff", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatPtr>]>, 346 FunctionSpec<"modfl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoublePtr>]>, 347 348 FunctionSpec<"cosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 349 FunctionSpec<"sinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 350 351 FunctionSpec<"expf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 352 FunctionSpec<"exp2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 353 354 FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>, 355 FunctionSpec<"remainder", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>, 356 FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>, 357 358 FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>, 359 FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>, 360 FunctionSpec<"remquol", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>, 361 362 FunctionSpec<"round", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 363 FunctionSpec<"roundf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 364 FunctionSpec<"roundl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 365 366 FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 367 FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 368 FunctionSpec<"sqrtl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 369 370 FunctionSpec<"trunc", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>, 371 FunctionSpec<"truncf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, 372 FunctionSpec<"truncl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>, 373 ] 374 >; 375 376 HeaderSpec StdIO = HeaderSpec< 377 "stdio.h", 378 [], // Macros 379 [ // Types 380 SizeTType, 381 FILE, 382 ], 383 [], // Enumerations 384 [ 385 FunctionSpec< 386 "fwrite", 387 RetValSpec<SizeTType>, 388 [ArgSpec<ConstVoidRestrictedPtr>, 389 ArgSpec<SizeTType>, 390 ArgSpec<SizeTType>, 391 ArgSpec<FILERestrictedPtr>] 392 >, 393 ] 394 >; 395 396 HeaderSpec StdLib = HeaderSpec< 397 "stdlib.h", 398 [], // Macros 399 [], // Types 400 [], // Enumerations 401 [ 402 FunctionSpec<"abort", RetValSpec<NoReturn>, [ArgSpec<VoidType>]>, 403 FunctionSpec<"_Exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>, 404 ] 405 >; 406 407 HeaderSpec Errno = HeaderSpec< 408 "errno.h", 409 [ 410 Macro<"errno">, 411 Macro<"EDOM">, 412 Macro<"EILSEQ">, 413 Macro<"ERANGE">, 414 ] 415 >; 416 417 HeaderSpec Signal = HeaderSpec< 418 "signal.h", 419 [ 420 Macro<"SIG_BLOCK">, 421 Macro<"SIG_UNBLOCK">, 422 Macro<"SIG_SETMASK">, 423 424 Macro<"SIGABRT">, 425 Macro<"SIGFPE">, 426 Macro<"SIGILL">, 427 Macro<"SIGINT">, 428 Macro<"SIGSEGV">, 429 Macro<"SIGTERM"> 430 ], 431 [ 432 SizeTType, 433 SigHandlerT, 434 ], 435 [], // Enumerations 436 [ 437 FunctionSpec<"raise", RetValSpec<IntType>, [ArgSpec<IntType>]>, 438 FunctionSpec< 439 "signal", 440 RetValSpec<SigHandlerT>, 441 [ArgSpec<IntType>, ArgSpec<SigHandlerT>] 442 >, 443 ] 444 >; 445 446 HeaderSpec Threads = HeaderSpec< 447 "threads.h", 448 [ 449 Macro<"ONCE_FLAG_INIT">, 450 ], 451 [ 452 OnceFlagType, 453 CallOnceFuncType, 454 MtxTType, 455 ThrdStartTType, 456 ThrdTType, 457 ], 458 [ 459 EnumeratedNameValue<"mtx_plain">, 460 EnumeratedNameValue<"mtx_recursive">, 461 EnumeratedNameValue<"mtx_timed">, 462 EnumeratedNameValue<"thrd_timedout">, 463 EnumeratedNameValue<"thrd_success">, 464 EnumeratedNameValue<"thrd_busy">, 465 EnumeratedNameValue<"thrd_error">, 466 EnumeratedNameValue<"thrd_nomem">, 467 ], 468 [ 469 FunctionSpec< 470 "call_once", 471 RetValSpec<VoidType>, 472 [ 473 ArgSpec<OnceFlagTypePtr>, 474 ArgSpec<CallOnceFuncType>, 475 ] 476 >, 477 FunctionSpec< 478 "mtx_init", 479 RetValSpec<IntType>, 480 [ 481 ArgSpec<MtxTTypePtr>, 482 ArgSpec<IntType>, 483 ] 484 >, 485 FunctionSpec< 486 "mtx_lock", 487 RetValSpec<IntType>, 488 [ 489 ArgSpec<MtxTTypePtr>, 490 ] 491 >, 492 FunctionSpec< 493 "mtx_unlock", 494 RetValSpec<IntType>, 495 [ 496 ArgSpec<MtxTTypePtr>, 497 ] 498 >, 499 FunctionSpec< 500 "thrd_create", 501 RetValSpec<IntType>, 502 [ 503 ArgSpec<ThrdTTypePtr>, 504 ArgSpec<ThrdStartTType>, 505 ArgSpec<VoidPtr>, 506 ] 507 >, 508 FunctionSpec< 509 "thrd_join", 510 RetValSpec<IntType>, 511 [ 512 ArgSpec<ThrdTTypePtr>, 513 ArgSpec<IntPtr>, 514 ] 515 > 516 ] 517 >; 518 519 HeaderSpec Time = HeaderSpec< 520 "time.h", 521 [], // Macros 522 [ // Types 523 StructTmType, 524 TimeTType, 525 ], 526 [], // Enumerations 527 [ 528 FunctionSpec< 529 "mktime", 530 RetValSpec<TimeTType>, 531 [ArgSpec<StructTmPtr>] 532 >, 533 ] 534 >; 535 536 let Headers = [ 537 Assert, 538 CType, 539 Errno, 540 Fenv, 541 Math, 542 String, 543 StdIO, 544 StdLib, 545 Signal, 546 Threads, 547 Time, 548 ]; 549} 550