00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef P99_C99_DEFAULT_H_
00015 # define P99_C99_DEFAULT_H_
00016
00017 #include "p99_defarg.h"
00018
00019 #define P00_C99_DEFARG_DOCU(NAME, RET, ...) \
00020 \
00021 \
00022
00023 P99_MACRO_END(C99_DEFARG_DOCU);
00024
00025 P00_C99_DEFARG_DOCU(strerror, char*, int errnum)
00027 #define strerror(...) P99_CALL_DEFARG(strerror, 1, __VA_ARGS__)
00028 #define strerror_defarg_0() 0
00029
00030 P00_C99_DEFARG_DOCU(calloc, void*, size_t rec_num, size_t rec_size)
00036 #define calloc(...) P99_CALL_DEFARG(calloc, 2, __VA_ARGS__)
00037 #define calloc_defarg_1() 1u
00038
00039 P00_C99_DEFARG_DOCU(longjmp, void, jmp_buf env, int val)
00043 #ifdef longjmp
00044 # pragma message "warning longjmp defined as a macro, overwriting"
00045 # undef longjmp
00046 #endif
00047 # define longjmp(...) P99_CALL_DEFARG(longjmp, 2, __VA_ARGS__)
00048 # define longjmp_defarg_1() 1
00049
00050
00093 P00_C99_DEFARG_DOCU(wcstol, long, wchar_t const *p00_nptr, wchar_t **p00_eptr, int p00_base)
00097 #define wcstol(...) P99_CALL_DEFARG(wcstol, 3, __VA_ARGS__)
00098 #define wcstol_defarg_1() 0
00099 #define wcstol_defarg_2() 0
00100
00101 P00_C99_DEFARG_DOCU(wcstoll, long long, wchar_t const *p00_nptr, wchar_t **p00_eptr, int p00_base)
00102
00103
00106 #define wcstoll(...) P99_CALL_DEFARG(wcstoll, 3, __VA_ARGS__)
00107 #define wcstoll_defarg_1() 0
00108 #define wcstoll_defarg_2() 0
00109
00110 P00_C99_DEFARG_DOCU(wcstoimax, intmax_t, wchar_t const *p00_nptr, wchar_t **p00_eptr, int p00_base)
00114 #define wcstoimax(...) P99_CALL_DEFARG(wcstoimax, 3, __VA_ARGS__)
00115 #define wcstoimax_defarg_1() 0
00116 #define wcstoimax_defarg_2() 0
00117
00118 P00_C99_DEFARG_DOCU(wcstoul, unsigned long, wchar_t const *p00_nptr, wchar_t **p00_eptr, int p00_base)
00122 #define wcstoul(...) P99_CALL_DEFARG(wcstoul, 3, __VA_ARGS__)
00123 #define wcstoul_defarg_1() 0
00124 #define wcstoul_defarg_2() 0
00125
00126 P00_C99_DEFARG_DOCU(wcstoull, unsigned long long, wchar_t const *p00_nptr, wchar_t **p00_eptr, int p00_base)
00130 #define wcstoull(...) P99_CALL_DEFARG(wcstoull, 3, __VA_ARGS__)
00131 #define wcstoull_defarg_1() 0
00132 #define wcstoull_defarg_2() 0
00133
00134 P00_C99_DEFARG_DOCU(wcstoumax, uintmax_t, wchar_t const *p00_nptr, wchar_t **p00_eptr, int p00_base)
00138 #define wcstoumax(...) P99_CALL_DEFARG(wcstoumax, 3, __VA_ARGS__)
00139 #define wcstoumax_defarg_1() 0
00140 #define wcstoumax_defarg_2() 0
00141
00142 P00_C99_DEFARG_DOCU(wcstof, float, wchar_t const *p00_nptr, wchar_t **p00_eptr)
00145 #define wcstof(...) P99_CALL_DEFARG(wcstof, 2, __VA_ARGS__)
00146 #define wcstof_defarg_1() 0
00147
00148 P00_C99_DEFARG_DOCU(wcstod, double, wchar_t const *p00_nptr, wchar_t **p00_eptr)
00151 #define wcstod(...) P99_CALL_DEFARG(wcstod, 2, __VA_ARGS__)
00152 #define wcstod_defarg_1() 0
00153
00154 P00_C99_DEFARG_DOCU(wcstold, long double, wchar_t const *p00_nptr, wchar_t **p00_eptr)
00157 #define wcstold(...) P99_CALL_DEFARG(wcstold, 2, __VA_ARGS__)
00158 #define wcstold_defarg_1() 0
00159
00160 P00_C99_DEFARG_DOCU(strtol, long, char const *p00_nptr, char **p00_eptr, int p00_base)
00169 #define strtol(...) P99_CALL_DEFARG(strtol, 3, __VA_ARGS__)
00170 #define strtol_defarg_1() 0
00171 #define strtol_defarg_2() 0
00172
00173 P00_C99_DEFARG_DOCU(strtoll, long long, char const *p00_nptr, char **p00_eptr, int p00_base)
00182 #define strtoll(...) P99_CALL_DEFARG(strtoll, 3, __VA_ARGS__)
00183 #define strtoll_defarg_1() 0
00184 #define strtoll_defarg_2() 0
00185
00186 P00_C99_DEFARG_DOCU(strtoimax, intmax_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00190 #define strtoimax(...) P99_CALL_DEFARG(strtoimax, 3, __VA_ARGS__)
00191 #define strtoimax_defarg_1() 0
00192 #define strtoimax_defarg_2() 0
00193
00194 P00_C99_DEFARG_DOCU(strtoul, unsigned long, char const *p00_nptr, char **p00_eptr, int p00_base)
00198 #define strtoul(...) P99_CALL_DEFARG(strtoul, 3, __VA_ARGS__)
00199 #define strtoul_defarg_1() 0
00200 #define strtoul_defarg_2() 0
00201
00202 P00_C99_DEFARG_DOCU(strtoull, unsigned long long, char const *p00_nptr, char **p00_eptr, int p00_base)
00206 #define strtoull(...) P99_CALL_DEFARG(strtoull, 3, __VA_ARGS__)
00207 #define strtoull_defarg_1() 0
00208 #define strtoull_defarg_2() 0
00209
00210 P00_C99_DEFARG_DOCU(strtoumax, uintmax_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00214 #define strtoumax(...) P99_CALL_DEFARG(strtoumax, 3, __VA_ARGS__)
00215 #define strtoumax_defarg_1() 0
00216 #define strtoumax_defarg_2() 0
00217
00218 P00_C99_DEFARG_DOCU(strtof, float, char const *p00_nptr, char **p00_eptr)
00221 #define strtof(...) P99_CALL_DEFARG(strtof, 2, __VA_ARGS__)
00222 #define strtof_defarg_1() 0
00223
00224 P00_C99_DEFARG_DOCU(strtod, double, char const *p00_nptr, char **p00_eptr)
00227 #define strtod(...) P99_CALL_DEFARG(strtod, 2, __VA_ARGS__)
00228 #define strtod_defarg_1() 0
00229
00230 P00_C99_DEFARG_DOCU(strtold, long double, char const *p00_nptr, char **p00_eptr)
00233 #define strtold(...) P99_CALL_DEFARG(strtold, 2, __VA_ARGS__)
00234 #define strtold_defarg_1() 0
00235
00236 #define P00_DECLARE_STRTO(SUFF) \
00237 \
00238 \
00239 p99_inline \
00240 P99_BUILTIN_TYPE(SUFF) \
00241 P99_PASTE2(p99_strto, SUFF)(char const *p00_nptr, char **p00_eptr, int p00_base) { \
00242 long long p00_ret = (strtoll)(p00_nptr, p00_eptr, p00_base); \
00243 if ((p00_ret > P99_BUILTIN_MAX(SUFF) || p00_ret < P99_BUILTIN_MIN(SUFF)) \
00244 && (!errno)) errno = ERANGE; \
00245 if (p00_ret > P99_BUILTIN_MAX(SUFF)) p00_ret = P99_BUILTIN_MAX(SUFF); \
00246 if (p00_ret < P99_BUILTIN_MIN(SUFF)) p00_ret = P99_BUILTIN_MIN(SUFF); \
00247 return p00_ret; \
00248 } \
00249 P99_MACRO_END(p99_strto, SUFF)
00250
00251
00252 #define P00_DECLARE_STRTOU(SUFF) \
00253 \
00254 \
00255 p99_inline \
00256 P99_BUILTIN_TYPE(SUFF) \
00257 P99_PASTE2(p99_strto, SUFF)(char const *p00_nptr, char **p00_eptr, int p00_base) { \
00258 unsigned long long p00_ret = (strtoull)(p00_nptr, p00_eptr, p00_base); \
00259 if (p00_ret > P99_BUILTIN_MAX(SUFF)) { \
00260 if (!errno) errno = ERANGE; \
00261 p00_ret = P99_BUILTIN_MAX(SUFF); \
00262 } \
00263 return p00_ret; \
00264 } \
00265 P99_MACRO_END(p99_strto, SUFF)
00266
00267 #define P00_I_LIST c, hh, , h, t, j, i8, i16, i32, i64
00268
00269 P99_SEP(P00_DECLARE_STRTO, P00_I_LIST);
00270
00271 #define P00_U_LIST uhh, u, uh, uz, uj, u8, u16, u32, u64
00272 P99_SEP(P00_DECLARE_STRTOU, P00_U_LIST);
00273
00279 P00_C99_DEFARG_DOCU(p99_strto, signed, char const *p00_nptr, char **p00_eptr, int p00_base)
00283 #define p99_strto(...) P99_CALL_DEFARG(p99_strto, 3, __VA_ARGS__)
00284 #define p99_strto_defarg_1() 0
00285 #define p99_strto_defarg_2() 0
00286
00287
00288 P00_C99_DEFARG_DOCU(p99_strtoc, char, char const *p00_nptr, char **p00_eptr, int p00_base)
00292 #define p99_strtoc(...) P99_CALL_DEFARG(p99_strtoc, 3, __VA_ARGS__)
00293 #define p99_strtoc_defarg_1() 0
00294 #define p99_strtoc_defarg_2() 0
00295
00296 P00_C99_DEFARG_DOCU(p99_strtohh, signed char, char const *p00_nptr, char **p00_eptr, int p00_base)
00300 #define p99_strtohh(...) P99_CALL_DEFARG(p99_strtohh, 3, __VA_ARGS__)
00301 #define p99_strtohh_defarg_1() 0
00302 #define p99_strtohh_defarg_2() 0
00303
00304 P00_C99_DEFARG_DOCU(p99_strtouhh, unsigned char, char const *p00_nptr, char **p00_eptr, int p00_base)
00308 #define p99_strtouhh(...) P99_CALL_DEFARG(p99_strtouhh, 3, __VA_ARGS__)
00309 #define p99_strtouhh_defarg_1() 0
00310 #define p99_strtouhh_defarg_2() 0
00311
00312
00313 P00_C99_DEFARG_DOCU(p99_strtoh, signed short, char const *p00_nptr, char **p00_eptr, int p00_base)
00317 #define p99_strtoh(...) P99_CALL_DEFARG(p99_strtoh, 3, __VA_ARGS__)
00318 #define p99_strtoh_defarg_1() 0
00319 #define p99_strtoh_defarg_2() 0
00320
00321 P00_C99_DEFARG_DOCU(p99_strtouh, unsigned short, char const *p00_nptr, char **p00_eptr, int p00_base)
00325 #define p99_strtouh(...) P99_CALL_DEFARG(p99_strtouh, 3, __VA_ARGS__)
00326 #define p99_strtouh_defarg_1() 0
00327 #define p99_strtouh_defarg_2() 0
00328
00329
00337 P00_C99_DEFARG_DOCU(p99_strtou, unsinged, char const *p00_nptr, char **p00_eptr, int p00_base)
00341 #define p99_strtou(...) P99_CALL_DEFARG(p99_strtou, 3, __VA_ARGS__)
00342 #define p99_strtou_defarg_1() 0
00343 #define p99_strtou_defarg_2() 0
00344
00345 P00_C99_DEFARG_DOCU(p99_strtoi8, int_least8_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00349 #define p99_strtoi8(...) P99_CALL_DEFARG(p99_strtoi8, 3, __VA_ARGS__)
00350 #define p99_strtoi8_defarg_1() 0
00351 #define p99_strtoi8_defarg_2() 0
00352
00353 P00_C99_DEFARG_DOCU(p99_strtot, ptrdiff_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00357 #define p99_strtot(...) P99_CALL_DEFARG(p99_strtot, 3, __VA_ARGS__)
00358 #define p99_strtot_defarg_1() 0
00359 #define p99_strtot_defarg_2() 0
00360
00361 P00_C99_DEFARG_DOCU(p99_strtouz, size_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00365 #define p99_strtouz(...) P99_CALL_DEFARG(p99_strtouz, 3, __VA_ARGS__)
00366 #define p99_strtouz_defarg_1() 0
00367 #define p99_strtouz_defarg_2() 0
00368
00369
00370 P00_C99_DEFARG_DOCU(p99_strtou8, uint_least8_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00374 #define p99_strtou8(...) P99_CALL_DEFARG(p99_strtou8, 3, __VA_ARGS__)
00375 #define p99_strtou8_defarg_1() 0
00376 #define p99_strtou8_defarg_2() 0
00377
00378 P00_C99_DEFARG_DOCU(p99_strtoi16, int_least16_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00382 #define p99_strtoi16(...) P99_CALL_DEFARG(p99_strtoi16, 3, __VA_ARGS__)
00383 #define p99_strtoi16_defarg_1() 0
00384 #define p99_strtoi16_defarg_2() 0
00385
00386
00387 P00_C99_DEFARG_DOCU(p99_strtou16, uint_least16_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00391 #define p99_strtou16(...) P99_CALL_DEFARG(p99_strtou16, 3, __VA_ARGS__)
00392 #define p99_strtou16_defarg_1() 0
00393 #define p99_strtou16_defarg_2() 0
00394
00395 P00_C99_DEFARG_DOCU(p99_strtoi32, int_least32_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00399 #define p99_strtoi32(...) P99_CALL_DEFARG(p99_strtoi32, 3, __VA_ARGS__)
00400 #define p99_strtoi32_defarg_1() 0
00401 #define p99_strtoi32_defarg_2() 0
00402
00403
00404 P00_C99_DEFARG_DOCU(p99_strtou32, uint_least32_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00408 #define p99_strtou32(...) P99_CALL_DEFARG(p99_strtou32, 3, __VA_ARGS__)
00409 #define p99_strtou32_defarg_1() 0
00410 #define p99_strtou32_defarg_2() 0
00411
00412
00413 P00_C99_DEFARG_DOCU(p99_strtoi64, int_least64_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00417 #define p99_strtoi64(...) P99_CALL_DEFARG(p99_strtoi64, 3, __VA_ARGS__)
00418 #define p99_strtoi64_defarg_1() 0
00419 #define p99_strtoi64_defarg_2() 0
00420
00421
00422 P00_C99_DEFARG_DOCU(p99_strtou64, uint_least64_t, char const *p00_nptr, char **p00_eptr, int p00_base)
00426 #define p99_strtou64(...) P99_CALL_DEFARG(p99_strtou64, 3, __VA_ARGS__)
00427 #define p99_strtou64_defarg_1() 0
00428 #define p99_strtou64_defarg_2() 0
00429
00430 #ifndef strtoc
00431 # define strtoc p99_strtoc
00432 #endif
00433
00434 #ifndef strtohh
00435 # define strtohh p99_strtohh
00436 #endif
00437 #ifndef strtoh
00438 # define strtoh p99_strtoh
00439 #endif
00440 #ifndef strto
00441 # define strto p99_strto
00442 #endif
00443 #ifndef strtot
00444 # define strtot p99_strtot
00445 #endif
00446 #ifndef strtoj
00447 # define strtoj p99_strtoj
00448 #endif
00449
00450 #ifndef strtouhh
00451 # define strtouhh p99_strtouhh
00452 #endif
00453 #ifndef strtouh
00454 # define strtouh p99_strtouh
00455 #endif
00456 #ifndef strtou
00457 # define strtou p99_strtou
00458 #endif
00459 #ifndef strtouz
00460 # define strtouz p99_strtouz
00461 #endif
00462 #ifndef strtouj
00463 # define strtouj p99_strtouj
00464 #endif
00465
00466 #ifndef strtoi8
00467 # define strtoi8 p99_strtoi8
00468 #endif
00469 #ifndef strtoi16
00470 # define strtoi16 p99_strtoi16
00471 #endif
00472 #ifndef strtoi32
00473 # define strtoi32 p99_strtoi32
00474 #endif
00475 #ifndef strtoi64
00476 # define strtoi64 p99_strtoi64
00477 #endif
00478
00479 #ifndef strtou8
00480 # define strtou8 p99_strtou8
00481 #endif
00482 #ifndef strtou16
00483 # define strtou16 p99_strtou16
00484 #endif
00485 #ifndef strtou32
00486 # define strtou32 p99_strtou32
00487 #endif
00488 #ifndef strtou64
00489 # define strtou64 p99_strtou64
00490 #endif
00491
00492
00497 #endif