musl_freebsd_386.go (182202B)
1 // Code generated by 'ccgo -export-externs X -export-fields F -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6,getnameinfo,gethostbyaddr_r, -nostdinc -nostdlib -o ../musl_freebsd_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c ../freebsd/table.cpp.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isupper.c src/ctype/isxdigit.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strnlen.c src/string/strspn.c', DO NOT EDIT. 2 3 package libc 4 5 import ( 6 "math" 7 "reflect" 8 "sync/atomic" 9 "unsafe" 10 ) 11 12 var _ = math.Pi 13 var _ reflect.Kind 14 var _ atomic.Value 15 var _ unsafe.Pointer 16 17 // musl as a whole is licensed under the following standard MIT license: 18 // 19 // ---------------------------------------------------------------------- 20 // Copyright © 2005-2020 Rich Felker, et al. 21 // 22 // Permission is hereby granted, free of charge, to any person obtaining 23 // a copy of this software and associated documentation files (the 24 // "Software"), to deal in the Software without restriction, including 25 // without limitation the rights to use, copy, modify, merge, publish, 26 // distribute, sublicense, and/or sell copies of the Software, and to 27 // permit persons to whom the Software is furnished to do so, subject to 28 // the following conditions: 29 // 30 // The above copyright notice and this permission notice shall be 31 // included in all copies or substantial portions of the Software. 32 // 33 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 34 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 35 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 36 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 37 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 38 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 39 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 40 // ---------------------------------------------------------------------- 41 // 42 // Authors/contributors include: 43 // 44 // A. Wilcox 45 // Ada Worcester 46 // Alex Dowad 47 // Alex Suykov 48 // Alexander Monakov 49 // Andre McCurdy 50 // Andrew Kelley 51 // Anthony G. Basile 52 // Aric Belsito 53 // Arvid Picciani 54 // Bartosz Brachaczek 55 // Benjamin Peterson 56 // Bobby Bingham 57 // Boris Brezillon 58 // Brent Cook 59 // Chris Spiegel 60 // Clément Vasseur 61 // Daniel Micay 62 // Daniel Sabogal 63 // Daurnimator 64 // David Carlier 65 // David Edelsohn 66 // Denys Vlasenko 67 // Dmitry Ivanov 68 // Dmitry V. Levin 69 // Drew DeVault 70 // Emil Renner Berthing 71 // Fangrui Song 72 // Felix Fietkau 73 // Felix Janda 74 // Gianluca Anzolin 75 // Hauke Mehrtens 76 // He X 77 // Hiltjo Posthuma 78 // Isaac Dunham 79 // Jaydeep Patil 80 // Jens Gustedt 81 // Jeremy Huntwork 82 // Jo-Philipp Wich 83 // Joakim Sindholt 84 // John Spencer 85 // Julien Ramseier 86 // Justin Cormack 87 // Kaarle Ritvanen 88 // Khem Raj 89 // Kylie McClain 90 // Leah Neukirchen 91 // Luca Barbato 92 // Luka Perkov 93 // M Farkas-Dyck (Strake) 94 // Mahesh Bodapati 95 // Markus Wichmann 96 // Masanori Ogino 97 // Michael Clark 98 // Michael Forney 99 // Mikhail Kremnyov 100 // Natanael Copa 101 // Nicholas J. Kain 102 // orc 103 // Pascal Cuoq 104 // Patrick Oppenlander 105 // Petr Hosek 106 // Petr Skocik 107 // Pierre Carrier 108 // Reini Urban 109 // Rich Felker 110 // Richard Pennington 111 // Ryan Fairfax 112 // Samuel Holland 113 // Segev Finer 114 // Shiz 115 // sin 116 // Solar Designer 117 // Stefan Kristiansson 118 // Stefan O'Rear 119 // Szabolcs Nagy 120 // Timo Teräs 121 // Trutz Behn 122 // Valentin Ochs 123 // Will Dietz 124 // William Haddon 125 // William Pitcock 126 // 127 // Portions of this software are derived from third-party works licensed 128 // under terms compatible with the above MIT license: 129 // 130 // The TRE regular expression implementation (src/regex/reg* and 131 // src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed 132 // under a 2-clause BSD license (license text in the source files). The 133 // included version has been heavily modified by Rich Felker in 2012, in 134 // the interests of size, simplicity, and namespace cleanliness. 135 // 136 // Much of the math library code (src/math/* and src/complex/*) is 137 // Copyright © 1993,2004 Sun Microsystems or 138 // Copyright © 2003-2011 David Schultz or 139 // Copyright © 2003-2009 Steven G. Kargl or 140 // Copyright © 2003-2009 Bruce D. Evans or 141 // Copyright © 2008 Stephen L. Moshier or 142 // Copyright © 2017-2018 Arm Limited 143 // and labelled as such in comments in the individual source files. All 144 // have been licensed under extremely permissive terms. 145 // 146 // The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 147 // The Android Open Source Project and is licensed under a two-clause BSD 148 // license. It was taken from Bionic libc, used on Android. 149 // 150 // The AArch64 memcpy and memset code (src/string/aarch64/*) are 151 // Copyright © 1999-2019, Arm Limited. 152 // 153 // The implementation of DES for crypt (src/crypt/crypt_des.c) is 154 // Copyright © 1994 David Burren. It is licensed under a BSD license. 155 // 156 // The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was 157 // originally written by Solar Designer and placed into the public 158 // domain. The code also comes with a fallback permissive license for use 159 // in jurisdictions that may not recognize the public domain. 160 // 161 // The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 162 // Valentin Ochs and is licensed under an MIT-style license. 163 // 164 // The x86_64 port was written by Nicholas J. Kain and is licensed under 165 // the standard MIT terms. 166 // 167 // The mips and microblaze ports were originally written by Richard 168 // Pennington for use in the ellcc project. The original code was adapted 169 // by Rich Felker for build system and code conventions during upstream 170 // integration. It is licensed under the standard MIT terms. 171 // 172 // The mips64 port was contributed by Imagination Technologies and is 173 // licensed under the standard MIT terms. 174 // 175 // The powerpc port was also originally written by Richard Pennington, 176 // and later supplemented and integrated by John Spencer. It is licensed 177 // under the standard MIT terms. 178 // 179 // All other files which have no copyright comments are original works 180 // produced specifically for use as part of this library, written either 181 // by Rich Felker, the main author of the library, or by one or more 182 // contibutors listed above. Details on authorship of individual files 183 // can be found in the git version control history of the project. The 184 // omission of copyright and license comments in each file is in the 185 // interest of source tree size. 186 // 187 // In addition, permission is hereby granted for all public header files 188 // (include/* and arch/*/bits/*) and crt files intended to be linked into 189 // applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit 190 // the copyright notice and permission notice otherwise required by the 191 // license, and to use these files without any requirement of 192 // attribution. These files include substantial contributions from: 193 // 194 // Bobby Bingham 195 // John Spencer 196 // Nicholas J. Kain 197 // Rich Felker 198 // Richard Pennington 199 // Stefan Kristiansson 200 // Szabolcs Nagy 201 // 202 // all of whom have explicitly granted such permission. 203 // 204 // This file previously contained text expressing a belief that most of 205 // the files covered by the above exception were sufficiently trivial not 206 // to be subject to copyright, resulting in confusion over whether it 207 // negated the permissions granted in the license. In the spirit of 208 // permissive licensing, and of not having licensing issues being an 209 // obstacle to adoption, that text has been removed. 210 const ( /* copyright.c:194:1: */ 211 __musl__copyright__ = 0 212 ) 213 214 const ( /* nameser.h:117:1: */ 215 ns_uop_delete = 0 216 ns_uop_add = 1 217 ns_uop_max = 2 218 ) 219 220 const ( /* nameser.h:147:1: */ 221 ns_t_invalid = 0 222 ns_t_a = 1 223 ns_t_ns = 2 224 ns_t_md = 3 225 ns_t_mf = 4 226 ns_t_cname = 5 227 ns_t_soa = 6 228 ns_t_mb = 7 229 ns_t_mg = 8 230 ns_t_mr = 9 231 ns_t_null = 10 232 ns_t_wks = 11 233 ns_t_ptr = 12 234 ns_t_hinfo = 13 235 ns_t_minfo = 14 236 ns_t_mx = 15 237 ns_t_txt = 16 238 ns_t_rp = 17 239 ns_t_afsdb = 18 240 ns_t_x25 = 19 241 ns_t_isdn = 20 242 ns_t_rt = 21 243 ns_t_nsap = 22 244 ns_t_nsap_ptr = 23 245 ns_t_sig = 24 246 ns_t_key = 25 247 ns_t_px = 26 248 ns_t_gpos = 27 249 ns_t_aaaa = 28 250 ns_t_loc = 29 251 ns_t_nxt = 30 252 ns_t_eid = 31 253 ns_t_nimloc = 32 254 ns_t_srv = 33 255 ns_t_atma = 34 256 ns_t_naptr = 35 257 ns_t_kx = 36 258 ns_t_cert = 37 259 ns_t_a6 = 38 260 ns_t_dname = 39 261 ns_t_sink = 40 262 ns_t_opt = 41 263 ns_t_apl = 42 264 ns_t_tkey = 249 265 ns_t_tsig = 250 266 ns_t_ixfr = 251 267 ns_t_axfr = 252 268 ns_t_mailb = 253 269 ns_t_maila = 254 270 ns_t_any = 255 271 ns_t_zxfr = 256 272 ns_t_max = 65536 273 ) 274 275 const ( /* nameser.h:210:1: */ 276 ns_c_invalid = 0 277 ns_c_in = 1 278 ns_c_2 = 2 279 ns_c_chaos = 3 280 ns_c_hs = 4 281 ns_c_none = 254 282 ns_c_any = 255 283 ns_c_max = 65536 284 ) 285 286 const ( /* nameser.h:221:1: */ 287 ns_kt_rsa = 1 288 ns_kt_dh = 2 289 ns_kt_dsa = 3 290 ns_kt_private = 254 291 ) 292 293 const ( /* nameser.h:228:1: */ 294 cert_t_pkix = 1 295 cert_t_spki = 2 296 cert_t_pgp = 3 297 cert_t_url = 253 298 cert_t_oid = 254 299 ) 300 301 const ( /* nameser.h:28:1: */ 302 ns_s_qd = 0 303 ns_s_zn = 0 304 ns_s_an = 1 305 ns_s_pr = 1 306 ns_s_ns = 2 307 ns_s_ud = 2 308 ns_s_ar = 3 309 ns_s_max = 4 310 ) 311 312 const ( /* nameser.h:75:1: */ 313 ns_f_qr = 0 314 ns_f_opcode = 1 315 ns_f_aa = 2 316 ns_f_tc = 3 317 ns_f_rd = 4 318 ns_f_ra = 5 319 ns_f_z = 6 320 ns_f_ad = 7 321 ns_f_cd = 8 322 ns_f_rcode = 9 323 ns_f_max = 10 324 ) 325 326 const ( /* nameser.h:89:1: */ 327 ns_o_query = 0 328 ns_o_iquery = 1 329 ns_o_status = 2 330 ns_o_notify = 4 331 ns_o_update = 5 332 ns_o_max = 6 333 ) 334 335 const ( /* nameser.h:98:1: */ 336 ns_r_noerror = 0 337 ns_r_formerr = 1 338 ns_r_servfail = 2 339 ns_r_nxdomain = 3 340 ns_r_notimpl = 4 341 ns_r_refused = 5 342 ns_r_yxdomain = 6 343 ns_r_yxrrset = 7 344 ns_r_nxrrset = 8 345 ns_r_notauth = 9 346 ns_r_notzone = 10 347 ns_r_max = 11 348 ns_r_badvers = 16 349 ns_r_badsig = 16 350 ns_r_badkey = 17 351 ns_r_badtime = 18 352 ) 353 354 type ptrdiff_t = int32 /* <builtin>:3:26 */ 355 356 type size_t = uint32 /* <builtin>:9:23 */ 357 358 type wchar_t = int32 /* <builtin>:15:24 */ 359 360 /// typedef __ct_rune_t __wint_t; 361 /// 362 /// 363 /// 364 /// typedef __uint_least16_t __char16_t; 365 /// typedef __uint_least32_t __char32_t; 366 /// 367 /// 368 /// 369 /// 370 /// 371 /// 372 /// 373 /// typedef struct { 374 /// long long __max_align1 __attribute__((__aligned__(_Alignof(long long)))); 375 /// 376 /// long double __max_align2 __attribute__((__aligned__(_Alignof(long double)))); 377 /// 378 /// } __max_align_t; 379 /// 380 /// typedef __uint64_t __dev_t; 381 /// 382 /// typedef __uint32_t __fixpt_t; 383 /// 384 /// 385 /// 386 /// 387 /// 388 /// typedef union { 389 /// char __mbstate8[128]; 390 /// __int64_t _mbstateL; 391 /// } __mbstate_t; 392 /// 393 /// typedef __uintmax_t __rman_res_t; 394 /// 395 /// 396 /// 397 /// 398 /// 399 /// 400 /// typedef __builtin_va_list __va_list; 401 /// 402 /// 403 /// 404 /// 405 /// 406 /// 407 /// typedef __va_list __gnuc_va_list; 408 /// 409 /// 410 /// 411 /// 412 /// unsigned long ___runetype(__ct_rune_t) __attribute__((__pure__)); 413 /// __ct_rune_t ___tolower(__ct_rune_t) __attribute__((__pure__)); 414 /// __ct_rune_t ___toupper(__ct_rune_t) __attribute__((__pure__)); 415 /// 416 /// 417 /// extern int __mb_sb_limit; 418 419 type _RuneEntry = struct { 420 F__min int32 421 F__max int32 422 F__map int32 423 F__types uintptr 424 } /* table.cpp.c:290:3 */ 425 426 type _RuneRange = struct { 427 F__nranges int32 428 F__ranges uintptr 429 } /* table.cpp.c:295:3 */ 430 431 type _RuneLocale = struct { 432 F__magic [8]int8 433 F__encoding [32]int8 434 F__sgetrune uintptr 435 F__sputrune uintptr 436 F__invalid_rune int32 437 F__runetype [256]uint32 438 F__maplower [256]int32 439 F__mapupper [256]int32 440 F__runetype_ext _RuneRange 441 F__maplower_ext _RuneRange 442 F__mapupper_ext _RuneRange 443 F__variable uintptr 444 F__variable_len int32 445 } /* table.cpp.c:320:3 */ 446 /// 447 /// extern const _RuneLocale _DefaultRuneLocale; 448 /// extern const _RuneLocale *_CurrentRuneLocale; 449 /// 450 /// 451 /// 452 /// extern _Thread_local const _RuneLocale *_ThreadRuneLocale; 453 /// static __inline const _RuneLocale *__getCurrentRuneLocale(void) 454 /// { 455 /// 456 /// if (_ThreadRuneLocale) 457 /// return _ThreadRuneLocale; 458 /// return _CurrentRuneLocale; 459 /// } 460 /// 461 /// 462 /// 463 /// 464 /// 465 /// static __inline int 466 /// __maskrune(__ct_rune_t _c, unsigned long _f) 467 /// { 468 /// return ((_c < 0 || _c >= (1 <<8 )) ? ___runetype(_c) : 469 /// (__getCurrentRuneLocale())->__runetype[_c]) & _f; 470 /// } 471 /// 472 /// static __inline int 473 /// __sbmaskrune(__ct_rune_t _c, unsigned long _f) 474 /// { 475 /// return (_c < 0 || _c >= __mb_sb_limit) ? 0 : 476 /// (__getCurrentRuneLocale())->__runetype[_c] & _f; 477 /// } 478 /// 479 /// static __inline int 480 /// __istype(__ct_rune_t _c, unsigned long _f) 481 /// { 482 /// return (!!__maskrune(_c, _f)); 483 /// } 484 /// 485 /// static __inline int 486 /// __sbistype(__ct_rune_t _c, unsigned long _f) 487 /// { 488 /// return (!!__sbmaskrune(_c, _f)); 489 /// } 490 /// 491 /// static __inline int 492 /// __isctype(__ct_rune_t _c, unsigned long _f) 493 /// { 494 /// return (_c < 0 || _c >= 128) ? 0 : 495 /// !!(_DefaultRuneLocale.__runetype[_c] & _f); 496 /// } 497 /// 498 /// static __inline __ct_rune_t 499 /// __toupper(__ct_rune_t _c) 500 /// { 501 /// return (_c < 0 || _c >= (1 <<8 )) ? ___toupper(_c) : 502 /// (__getCurrentRuneLocale())->__mapupper[_c]; 503 /// } 504 /// 505 /// static __inline __ct_rune_t 506 /// __sbtoupper(__ct_rune_t _c) 507 /// { 508 /// return (_c < 0 || _c >= __mb_sb_limit) ? _c : 509 /// (__getCurrentRuneLocale())->__mapupper[_c]; 510 /// } 511 /// 512 /// static __inline __ct_rune_t 513 /// __tolower(__ct_rune_t _c) 514 /// { 515 /// return (_c < 0 || _c >= (1 <<8 )) ? ___tolower(_c) : 516 /// (__getCurrentRuneLocale())->__maplower[_c]; 517 /// } 518 /// 519 /// static __inline __ct_rune_t 520 /// __sbtolower(__ct_rune_t _c) 521 /// { 522 /// return (_c < 0 || _c >= __mb_sb_limit) ? _c : 523 /// (__getCurrentRuneLocale())->__maplower[_c]; 524 /// } 525 /// 526 /// static __inline int 527 /// __wcwidth(__ct_rune_t _c) 528 /// { 529 /// unsigned int _x; 530 /// 531 /// if (_c == 0) 532 /// return (0); 533 /// _x = (unsigned int)__maskrune(_c, 0xe0000000L|0x00040000L); 534 /// if ((_x & 0xe0000000L) != 0) 535 /// return ((_x & 0xe0000000L) >> 30); 536 /// return ((_x & 0x00040000L) != 0 ? 1 : -1); 537 /// } 538 /// 539 /// 540 /// 541 /// int isalnum(int); 542 /// int isalpha(int); 543 /// int iscntrl(int); 544 /// int isdigit(int); 545 /// int isgraph(int); 546 /// int islower(int); 547 /// int isprint(int); 548 /// int ispunct(int); 549 /// int isspace(int); 550 /// int isupper(int); 551 /// int isxdigit(int); 552 /// int tolower(int); 553 /// int toupper(int); 554 /// 555 /// 556 /// int isascii(int); 557 /// int toascii(int); 558 /// 559 /// 560 /// 561 /// int isblank(int); 562 /// 563 /// 564 /// 565 /// int digittoint(int); 566 /// int ishexnumber(int); 567 /// int isideogram(int); 568 /// int isnumber(int); 569 /// int isphonogram(int); 570 /// int isrune(int); 571 /// int isspecial(int); 572 /// 573 /// 574 /// 575 /// 576 /// 577 /// typedef struct _xlocale *locale_t; 578 /// 579 /// 580 /// 581 /// 582 /// unsigned long ___runetype_l(__ct_rune_t, locale_t) __attribute__((__pure__)); 583 /// __ct_rune_t ___tolower_l(__ct_rune_t, locale_t) __attribute__((__pure__)); 584 /// __ct_rune_t ___toupper_l(__ct_rune_t, locale_t) __attribute__((__pure__)); 585 /// _RuneLocale *__runes_for_locale(locale_t, int*); 586 /// 587 /// inline int 588 /// __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); 589 /// inline int 590 /// __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc); 591 /// 592 /// inline int 593 /// __sbmaskrune_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) 594 /// { 595 /// int __limit; 596 /// _RuneLocale *runes = __runes_for_locale(__loc, &__limit); 597 /// return (__c < 0 || __c >= __limit) ? 0 : 598 /// runes->__runetype[__c] & __f; 599 /// } 600 /// 601 /// inline int 602 /// __sbistype_l(__ct_rune_t __c, unsigned long __f, locale_t __loc) 603 /// { 604 /// return (!!__sbmaskrune_l(__c, __f, __loc)); 605 /// } 606 /// 607 /// 608 /// 609 /// 610 /// 611 /// 612 /// 613 /// inline int isalnum_l(int, locale_t); inline int isalnum_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000100L|0x00000400L|0x00400000L, __l); } 614 /// inline int isalpha_l(int, locale_t); inline int isalpha_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000100L, __l); } 615 /// inline int isblank_l(int, locale_t); inline int isblank_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00020000L, __l); } 616 /// inline int iscntrl_l(int, locale_t); inline int iscntrl_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000200L, __l); } 617 /// inline int isdigit_l(int, locale_t); inline int isdigit_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000400L, __l); } 618 /// inline int isgraph_l(int, locale_t); inline int isgraph_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000800L, __l); } 619 /// inline int ishexnumber_l(int, locale_t); inline int ishexnumber_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00010000L, __l); } 620 /// inline int isideogram_l(int, locale_t); inline int isideogram_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00080000L, __l); } 621 /// inline int islower_l(int, locale_t); inline int islower_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00001000L, __l); } 622 /// inline int isnumber_l(int, locale_t); inline int isnumber_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00000400L|0x00400000L, __l); } 623 /// inline int isphonogram_l(int, locale_t); inline int isphonogram_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00200000L, __l); } 624 /// inline int isprint_l(int, locale_t); inline int isprint_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00040000L, __l); } 625 /// inline int ispunct_l(int, locale_t); inline int ispunct_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00002000L, __l); } 626 /// inline int isrune_l(int, locale_t); inline int isrune_l(int __c, locale_t __l) { return __sbistype_l(__c, 0xFFFFFF00L, __l); } 627 /// inline int isspace_l(int, locale_t); inline int isspace_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00004000L, __l); } 628 /// inline int isspecial_l(int, locale_t); inline int isspecial_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00100000L, __l); } 629 /// inline int isupper_l(int, locale_t); inline int isupper_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00008000L, __l); } 630 /// inline int isxdigit_l(int, locale_t); inline int isxdigit_l(int __c, locale_t __l) { return __sbistype_l(__c, 0x00010000L, __l); } 631 /// 632 /// inline int digittoint_l(int, locale_t); 633 /// inline int tolower_l(int, locale_t); 634 /// inline int toupper_l(int, locale_t); 635 /// 636 /// inline int digittoint_l(int __c, locale_t __l) 637 /// { return __sbmaskrune_l((__c), 0xFF, __l); } 638 /// 639 /// inline int tolower_l(int __c, locale_t __l) 640 /// { 641 /// int __limit; 642 /// _RuneLocale *__runes = __runes_for_locale(__l, &__limit); 643 /// return (__c < 0 || __c >= __limit) ? __c : 644 /// __runes->__maplower[__c]; 645 /// } 646 /// inline int toupper_l(int __c, locale_t __l) 647 /// { 648 /// int __limit; 649 /// _RuneLocale *__runes = __runes_for_locale(__l, &__limit); 650 /// return (__c < 0 || __c >= __limit) ? __c : 651 /// __runes->__mapupper[__c]; 652 /// } 653 /// 654 /// 655 /// 656 /// 657 /// 658 /// 659 /// 660 /// 661 /// 662 /// 663 /// 664 /// 665 /// 666 /// 667 /// 668 /// typedef __mbstate_t mbstate_t; 669 /// 670 /// 671 /// 672 /// 673 /// typedef __size_t size_t; 674 /// 675 /// 676 /// 677 /// 678 /// 679 /// typedef __va_list va_list; 680 /// 681 /// 682 /// 683 /// 684 /// 685 /// 686 /// typedef ___wchar_t wchar_t; 687 /// 688 /// 689 /// 690 /// 691 /// 692 /// typedef __wint_t wint_t; 693 /// 694 /// typedef struct __sFILE FILE; 695 /// 696 /// struct tm; 697 /// 698 /// 699 /// wint_t btowc(int); 700 /// wint_t fgetwc(FILE *); 701 /// wchar_t * 702 /// fgetws(wchar_t * restrict, int, FILE * restrict); 703 /// wint_t fputwc(wchar_t, FILE *); 704 /// int fputws(const wchar_t * restrict, FILE * restrict); 705 /// int fwide(FILE *, int); 706 /// int fwprintf(FILE * restrict, const wchar_t * restrict, ...); 707 /// int fwscanf(FILE * restrict, const wchar_t * restrict, ...); 708 /// wint_t getwc(FILE *); 709 /// wint_t getwchar(void); 710 /// size_t mbrlen(const char * restrict, size_t, mbstate_t * restrict); 711 /// size_t mbrtowc(wchar_t * restrict, const char * restrict, size_t, 712 /// mbstate_t * restrict); 713 /// int mbsinit(const mbstate_t *); 714 /// size_t mbsrtowcs(wchar_t * restrict, const char ** restrict, size_t, 715 /// mbstate_t * restrict); 716 /// wint_t putwc(wchar_t, FILE *); 717 /// wint_t putwchar(wchar_t); 718 /// int swprintf(wchar_t * restrict, size_t n, const wchar_t * restrict, 719 /// ...); 720 /// int swscanf(const wchar_t * restrict, const wchar_t * restrict, ...); 721 /// wint_t ungetwc(wint_t, FILE *); 722 /// int vfwprintf(FILE * restrict, const wchar_t * restrict, 723 /// __va_list); 724 /// int vswprintf(wchar_t * restrict, size_t n, const wchar_t * restrict, 725 /// __va_list); 726 /// int vwprintf(const wchar_t * restrict, __va_list); 727 /// size_t wcrtomb(char * restrict, wchar_t, mbstate_t * restrict); 728 /// wchar_t *wcscat(wchar_t * restrict, const wchar_t * restrict); 729 /// wchar_t *wcschr(const wchar_t *, wchar_t) __attribute__((__pure__)); 730 /// int wcscmp(const wchar_t *, const wchar_t *) __attribute__((__pure__)); 731 /// int wcscoll(const wchar_t *, const wchar_t *); 732 /// wchar_t *wcscpy(wchar_t * restrict, const wchar_t * restrict); 733 /// size_t wcscspn(const wchar_t *, const wchar_t *) __attribute__((__pure__)); 734 /// size_t wcsftime(wchar_t * restrict, size_t, const wchar_t * restrict, 735 /// const struct tm * restrict); 736 /// size_t wcslen(const wchar_t *) __attribute__((__pure__)); 737 /// wchar_t *wcsncat(wchar_t * restrict, const wchar_t * restrict, 738 /// size_t); 739 /// int wcsncmp(const wchar_t *, const wchar_t *, size_t) __attribute__((__pure__)); 740 /// wchar_t *wcsncpy(wchar_t * restrict , const wchar_t * restrict, size_t); 741 /// wchar_t *wcspbrk(const wchar_t *, const wchar_t *) __attribute__((__pure__)); 742 /// wchar_t *wcsrchr(const wchar_t *, wchar_t) __attribute__((__pure__)); 743 /// size_t wcsrtombs(char * restrict, const wchar_t ** restrict, size_t, 744 /// mbstate_t * restrict); 745 /// size_t wcsspn(const wchar_t *, const wchar_t *) __attribute__((__pure__)); 746 /// wchar_t *wcsstr(const wchar_t * restrict, const wchar_t * restrict) 747 /// __attribute__((__pure__)); 748 /// size_t wcsxfrm(wchar_t * restrict, const wchar_t * restrict, size_t); 749 /// int wctob(wint_t); 750 /// double wcstod(const wchar_t * restrict, wchar_t ** restrict); 751 /// wchar_t *wcstok(wchar_t * restrict, const wchar_t * restrict, 752 /// wchar_t ** restrict); 753 /// long wcstol(const wchar_t * restrict, wchar_t ** restrict, int); 754 /// unsigned long 755 /// wcstoul(const wchar_t * restrict, wchar_t ** restrict, int); 756 /// wchar_t *wmemchr(const wchar_t *, wchar_t, size_t) __attribute__((__pure__)); 757 /// int wmemcmp(const wchar_t *, const wchar_t *, size_t) __attribute__((__pure__)); 758 /// wchar_t *wmemcpy(wchar_t * restrict, const wchar_t * restrict, size_t); 759 /// wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t); 760 /// wchar_t *wmemset(wchar_t *, wchar_t, size_t); 761 /// int wprintf(const wchar_t * restrict, ...); 762 /// int wscanf(const wchar_t * restrict, ...); 763 /// 764 /// 765 /// extern FILE *__stdinp; 766 /// extern FILE *__stdoutp; 767 /// extern FILE *__stderrp; 768 /// 769 /// int vfwscanf(FILE * restrict, const wchar_t * restrict, 770 /// __va_list); 771 /// int vswscanf(const wchar_t * restrict, const wchar_t * restrict, 772 /// __va_list); 773 /// int vwscanf(const wchar_t * restrict, __va_list); 774 /// float wcstof(const wchar_t * restrict, wchar_t ** restrict); 775 /// long double 776 /// wcstold(const wchar_t * restrict, wchar_t ** restrict); 777 /// 778 /// 779 /// long long 780 /// wcstoll(const wchar_t * restrict, wchar_t ** restrict, int); 781 /// 782 /// unsigned long long 783 /// wcstoull(const wchar_t * restrict, wchar_t ** restrict, int); 784 /// 785 /// 786 /// 787 /// 788 /// int wcswidth(const wchar_t *, size_t); 789 /// int wcwidth(wchar_t); 790 /// 791 /// 792 /// 793 /// 794 /// size_t mbsnrtowcs(wchar_t * restrict, const char ** restrict, size_t, 795 /// size_t, mbstate_t * restrict); 796 /// FILE *open_wmemstream(wchar_t **, size_t *); 797 /// wchar_t *wcpcpy(wchar_t * restrict, const wchar_t * restrict); 798 /// wchar_t *wcpncpy(wchar_t * restrict, const wchar_t * restrict, size_t); 799 /// wchar_t *wcsdup(const wchar_t *) __attribute__((__malloc__)); 800 /// int wcscasecmp(const wchar_t *, const wchar_t *); 801 /// int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n); 802 /// size_t wcsnlen(const wchar_t *, size_t) __attribute__((__pure__)); 803 /// size_t wcsnrtombs(char * restrict, const wchar_t ** restrict, size_t, 804 /// size_t, mbstate_t * restrict); 805 /// 806 /// 807 /// 808 /// wchar_t *fgetwln(FILE * restrict, size_t * restrict); 809 /// size_t wcslcat(wchar_t *, const wchar_t *, size_t); 810 /// size_t wcslcpy(wchar_t *, const wchar_t *, size_t); 811 /// 812 /// 813 /// 814 /// 815 /// 816 /// int wcscasecmp_l(const wchar_t *, const wchar_t *, 817 /// locale_t); 818 /// int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, 819 /// locale_t); 820 /// int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); 821 /// size_t wcsxfrm_l(wchar_t * restrict, 822 /// const wchar_t * restrict, size_t, locale_t); 823 /// 824 /// 825 /// 826 /// 827 /// 828 /// 829 /// 830 /// 831 /// 832 /// 833 /// 834 /// 835 /// struct lconv { 836 /// char *decimal_point; 837 /// char *thousands_sep; 838 /// char *grouping; 839 /// char *int_curr_symbol; 840 /// char *currency_symbol; 841 /// char *mon_decimal_point; 842 /// char *mon_thousands_sep; 843 /// char *mon_grouping; 844 /// char *positive_sign; 845 /// char *negative_sign; 846 /// char int_frac_digits; 847 /// char frac_digits; 848 /// char p_cs_precedes; 849 /// char p_sep_by_space; 850 /// char n_cs_precedes; 851 /// char n_sep_by_space; 852 /// char p_sign_posn; 853 /// char n_sign_posn; 854 /// char int_p_cs_precedes; 855 /// char int_n_cs_precedes; 856 /// char int_p_sep_by_space; 857 /// char int_n_sep_by_space; 858 /// char int_p_sign_posn; 859 /// char int_n_sign_posn; 860 /// }; 861 /// 862 /// 863 /// struct lconv *localeconv(void); 864 /// char *setlocale(int, const char *); 865 /// 866 /// 867 /// 868 /// 869 /// locale_t duplocale(locale_t base); 870 /// void freelocale(locale_t loc); 871 /// locale_t newlocale(int mask, const char *locale, locale_t base); 872 /// const char *querylocale(int mask, locale_t loc); 873 /// locale_t uselocale(locale_t loc); 874 /// 875 /// 876 /// 877 /// 878 /// 879 /// 880 /// 881 /// 882 /// 883 /// 884 /// 885 /// wint_t btowc_l(int, locale_t); 886 /// wint_t fgetwc_l(FILE *, locale_t); 887 /// wchar_t *fgetws_l(wchar_t * restrict, int, FILE * restrict, 888 /// locale_t); 889 /// wint_t fputwc_l(wchar_t, FILE *, locale_t); 890 /// int fputws_l(const wchar_t * restrict, FILE * restrict, 891 /// locale_t); 892 /// int fwprintf_l(FILE * restrict, locale_t, 893 /// const wchar_t * restrict, ...); 894 /// int fwscanf_l(FILE * restrict, locale_t, 895 /// const wchar_t * restrict, ...); 896 /// wint_t getwc_l(FILE *, locale_t); 897 /// wint_t getwchar_l(locale_t); 898 /// size_t mbrlen_l(const char * restrict, size_t, 899 /// mbstate_t * restrict, locale_t); 900 /// size_t mbrtowc_l(wchar_t * restrict, 901 /// const char * restrict, size_t, 902 /// mbstate_t * restrict, locale_t); 903 /// int mbsinit_l(const mbstate_t *, locale_t); 904 /// size_t mbsrtowcs_l(wchar_t * restrict, 905 /// const char ** restrict, size_t, 906 /// mbstate_t * restrict, locale_t); 907 /// wint_t putwc_l(wchar_t, FILE *, locale_t); 908 /// wint_t putwchar_l(wchar_t, locale_t); 909 /// int swprintf_l(wchar_t * restrict, size_t n, locale_t, 910 /// const wchar_t * restrict, ...); 911 /// int swscanf_l(const wchar_t * restrict, locale_t, 912 /// const wchar_t * restrict, ...); 913 /// wint_t ungetwc_l(wint_t, FILE *, locale_t); 914 /// int vfwprintf_l(FILE * restrict, locale_t, 915 /// const wchar_t * restrict, __va_list); 916 /// int vswprintf_l(wchar_t * restrict, size_t n, locale_t, 917 /// const wchar_t * restrict, __va_list); 918 /// int vwprintf_l(locale_t, const wchar_t * restrict, 919 /// __va_list); 920 /// size_t wcrtomb_l(char * restrict, wchar_t, 921 /// mbstate_t * restrict, locale_t); 922 /// size_t wcsftime_l(wchar_t * restrict, size_t, 923 /// const wchar_t * restrict, 924 /// const struct tm * restrict, locale_t); 925 /// size_t wcsrtombs_l(char * restrict, 926 /// const wchar_t ** restrict, size_t, 927 /// mbstate_t * restrict, locale_t); 928 /// double wcstod_l(const wchar_t * restrict, 929 /// wchar_t ** restrict, locale_t); 930 /// long wcstol_l(const wchar_t * restrict, 931 /// wchar_t ** restrict, int, locale_t); 932 /// unsigned long wcstoul_l(const wchar_t * restrict, 933 /// wchar_t ** restrict, int, locale_t); 934 /// int wcswidth_l(const wchar_t *, size_t, locale_t); 935 /// int wctob_l(wint_t, locale_t); 936 /// int wcwidth_l(wchar_t, locale_t); 937 /// int wprintf_l(locale_t, const wchar_t * restrict, ...); 938 /// int wscanf_l(locale_t, const wchar_t * restrict, ...); 939 /// int vfwscanf_l(FILE * restrict, locale_t, 940 /// const wchar_t * restrict, __va_list); 941 /// int vswscanf_l(const wchar_t * restrict, locale_t, 942 /// const wchar_t *restrict, __va_list); 943 /// int vwscanf_l(locale_t, const wchar_t * restrict, 944 /// __va_list); 945 /// float wcstof_l(const wchar_t * restrict, 946 /// wchar_t ** restrict, locale_t); 947 /// long double wcstold_l(const wchar_t * restrict, 948 /// wchar_t ** restrict, locale_t); 949 /// long long wcstoll_l(const wchar_t * restrict, 950 /// wchar_t ** restrict, int, locale_t); 951 /// unsigned long long wcstoull_l(const wchar_t * restrict, 952 /// wchar_t ** restrict, int, locale_t); 953 /// size_t mbsnrtowcs_l(wchar_t * restrict, 954 /// const char ** restrict, size_t, size_t, 955 /// mbstate_t * restrict, locale_t); 956 /// size_t wcsnrtombs_l(char * restrict, 957 /// const wchar_t ** restrict, size_t, size_t, 958 /// mbstate_t * restrict, locale_t); 959 /// 960 /// 961 /// 962 /// 963 /// 964 /// struct lconv *localeconv_l(locale_t); 965 /// 966 /// 967 /// 968 /// 969 /// 970 /// 971 /// 972 /// 973 /// 974 /// typedef __rune_t rune_t; 975 /// 976 /// typedef struct { 977 /// int quot; 978 /// int rem; 979 /// } div_t; 980 /// 981 /// typedef struct { 982 /// long quot; 983 /// long rem; 984 /// } ldiv_t; 985 /// 986 /// 987 /// 988 /// 989 /// 990 /// double atof_l(const char *, locale_t); 991 /// int atoi_l(const char *, locale_t); 992 /// long atol_l(const char *, locale_t); 993 /// long long atoll_l(const char *, locale_t); 994 /// int mblen_l(const char *, size_t, locale_t); 995 /// size_t mbstowcs_l(wchar_t * restrict, 996 /// const char * restrict, size_t, locale_t); 997 /// int mbtowc_l(wchar_t * restrict, 998 /// const char * restrict, size_t, locale_t); 999 /// double strtod_l(const char *, char **, locale_t); 1000 /// float strtof_l(const char *, char **, locale_t); 1001 /// long strtol_l(const char *, char **, int, locale_t); 1002 /// long double strtold_l(const char *, char **, locale_t); 1003 /// long long strtoll_l(const char *, char **, int, locale_t); 1004 /// unsigned long strtoul_l(const char *, char **, int, locale_t); 1005 /// unsigned long long strtoull_l(const char *, char **, int, locale_t); 1006 /// size_t wcstombs_l(char * restrict, 1007 /// const wchar_t * restrict, size_t, locale_t); 1008 /// int wctomb_l(char *, wchar_t, locale_t); 1009 /// 1010 /// int ___mb_cur_max_l(locale_t); 1011 /// 1012 /// 1013 /// extern int __mb_cur_max; 1014 /// extern int ___mb_cur_max(void); 1015 /// 1016 /// 1017 /// _Noreturn void abort(void); 1018 /// int abs(int) __attribute__((__const__)); 1019 /// int atexit(void (* )(void)); 1020 /// double atof(const char *); 1021 /// int atoi(const char *); 1022 /// long atol(const char *); 1023 /// void *bsearch(const void *, const void *, size_t, 1024 /// size_t, int (*)(const void * , const void *)); 1025 /// void *calloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) 1026 /// __attribute__((__alloc_size__(1, 2))); 1027 /// div_t div(int, int) __attribute__((__const__)); 1028 /// _Noreturn void exit(int); 1029 /// void free(void *); 1030 /// char *getenv(const char *); 1031 /// long labs(long) __attribute__((__const__)); 1032 /// ldiv_t ldiv(long, long) __attribute__((__const__)); 1033 /// void *malloc(size_t) __attribute__((__malloc__)) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(1))); 1034 /// int mblen(const char *, size_t); 1035 /// size_t mbstowcs(wchar_t * restrict , const char * restrict, size_t); 1036 /// int mbtowc(wchar_t * restrict, const char * restrict, size_t); 1037 /// void qsort(void *, size_t, size_t, 1038 /// int (* )(const void *, const void *)); 1039 /// int rand(void); 1040 /// void *realloc(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2))); 1041 /// void srand(unsigned); 1042 /// double strtod(const char * restrict, char ** restrict); 1043 /// float strtof(const char * restrict, char ** restrict); 1044 /// long strtol(const char * restrict, char ** restrict, int); 1045 /// long double 1046 /// strtold(const char * restrict, char ** restrict); 1047 /// unsigned long 1048 /// strtoul(const char * restrict, char ** restrict, int); 1049 /// int system(const char *); 1050 /// int wctomb(char *, wchar_t); 1051 /// size_t wcstombs(char * restrict, const wchar_t * restrict, size_t); 1052 /// 1053 /// typedef struct { 1054 /// long long quot; 1055 /// long long rem; 1056 /// } lldiv_t; 1057 /// 1058 /// 1059 /// long long 1060 /// atoll(const char *); 1061 /// 1062 /// long long 1063 /// llabs(long long) __attribute__((__const__)); 1064 /// 1065 /// lldiv_t lldiv(long long, long long) __attribute__((__const__)); 1066 /// 1067 /// long long 1068 /// strtoll(const char * restrict, char ** restrict, int); 1069 /// 1070 /// unsigned long long 1071 /// strtoull(const char * restrict, char ** restrict, int); 1072 /// 1073 /// 1074 /// _Noreturn void _Exit(int); 1075 /// 1076 /// 1077 /// 1078 /// 1079 /// 1080 /// 1081 /// void * aligned_alloc(size_t, size_t) __attribute__((__malloc__)) __attribute__((__alloc_align__(1))) 1082 /// __attribute__((__alloc_size__(2))); 1083 /// int at_quick_exit(void (*)(void)); 1084 /// _Noreturn void 1085 /// quick_exit(int); 1086 /// 1087 /// 1088 /// 1089 /// 1090 /// 1091 /// char *realpath(const char * restrict, char * restrict); 1092 /// 1093 /// 1094 /// int rand_r(unsigned *); 1095 /// 1096 /// 1097 /// int posix_memalign(void **, size_t, size_t); 1098 /// int setenv(const char *, const char *, int); 1099 /// int unsetenv(const char *); 1100 /// 1101 /// 1102 /// 1103 /// int getsubopt(char **, char *const *, char **); 1104 /// 1105 /// char *mkdtemp(char *); 1106 /// 1107 /// 1108 /// 1109 /// int mkstemp(char *); 1110 /// 1111 /// long a64l(const char *); 1112 /// double drand48(void); 1113 /// 1114 /// double erand48(unsigned short[3]); 1115 /// 1116 /// 1117 /// char *initstate(unsigned int, char *, size_t); 1118 /// long jrand48(unsigned short[3]); 1119 /// char *l64a(long); 1120 /// void lcong48(unsigned short[7]); 1121 /// long lrand48(void); 1122 /// 1123 /// char *mktemp(char *); 1124 /// 1125 /// 1126 /// long mrand48(void); 1127 /// long nrand48(unsigned short[3]); 1128 /// int putenv(char *); 1129 /// long random(void); 1130 /// unsigned short 1131 /// *seed48(unsigned short[3]); 1132 /// char *setstate( char *); 1133 /// void srand48(long); 1134 /// void srandom(unsigned int); 1135 /// 1136 /// 1137 /// 1138 /// int grantpt(int); 1139 /// int posix_openpt(int); 1140 /// char *ptsname(int); 1141 /// int unlockpt(int); 1142 /// 1143 /// 1144 /// 1145 /// int ptsname_r(int, char *, size_t); 1146 /// 1147 /// 1148 /// 1149 /// extern const char *malloc_conf; 1150 /// extern void (*malloc_message)(void *, const char *); 1151 /// 1152 /// void abort2(const char *, int, void **) __attribute__((__noreturn__)); 1153 /// __uint32_t 1154 /// arc4random(void); 1155 /// void arc4random_buf(void *, size_t); 1156 /// __uint32_t 1157 /// arc4random_uniform(__uint32_t); 1158 /// 1159 /// 1160 /// 1161 /// 1162 /// 1163 /// 1164 /// char *getbsize(int *, long *); 1165 /// 1166 /// char *cgetcap(char *, const char *, int); 1167 /// int cgetclose(void); 1168 /// int cgetent(char **, char **, const char *); 1169 /// int cgetfirst(char **, char **); 1170 /// int cgetmatch(const char *, const char *); 1171 /// int cgetnext(char **, char **); 1172 /// int cgetnum(char *, const char *, long *); 1173 /// int cgetset(const char *); 1174 /// int cgetstr(char *, const char *, char **); 1175 /// int cgetustr(char *, const char *, char **); 1176 /// 1177 /// int daemon(int, int); 1178 /// int daemonfd(int, int); 1179 /// char *devname(__dev_t, __mode_t); 1180 /// char *devname_r(__dev_t, __mode_t, char *, int); 1181 /// char *fdevname(int); 1182 /// char *fdevname_r(int, char *, int); 1183 /// int getloadavg(double [], int); 1184 /// const char * 1185 /// getprogname(void); 1186 /// 1187 /// int heapsort(void *, size_t, size_t, 1188 /// int (* )(const void *, const void *)); 1189 /// 1190 /// 1191 /// 1192 /// 1193 /// 1194 /// 1195 /// int l64a_r(long, char *, int); 1196 /// int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); 1197 /// 1198 /// 1199 /// 1200 /// int mkostemp(char *, int); 1201 /// int mkostemps(char *, int, int); 1202 /// int mkostempsat(int, char *, int, int); 1203 /// void qsort_r(void *, size_t, size_t, void *, 1204 /// int (*)(void *, const void *, const void *)); 1205 /// int radixsort(const unsigned char **, int, const unsigned char *, 1206 /// unsigned); 1207 /// void *reallocarray(void *, size_t, size_t) __attribute__((__warn_unused_result__)) 1208 /// __attribute__((__alloc_size__(2, 3))); 1209 /// void *reallocf(void *, size_t) __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__(2))); 1210 /// int rpmatch(const char *); 1211 /// void setprogname(const char *); 1212 /// int sradixsort(const unsigned char **, int, const unsigned char *, 1213 /// unsigned); 1214 /// void srandomdev(void); 1215 /// long long 1216 /// strtonum(const char *, long long, long long, const char **); 1217 /// 1218 /// 1219 /// __int64_t 1220 /// strtoq(const char *, char **, int); 1221 /// __uint64_t 1222 /// strtouq(const char *, char **, int); 1223 /// 1224 /// extern char *suboptarg; 1225 /// 1226 /// 1227 /// 1228 /// 1229 /// 1230 /// 1231 /// typedef size_t rsize_t; 1232 /// 1233 /// 1234 /// 1235 /// 1236 /// typedef int errno_t; 1237 /// 1238 /// 1239 /// 1240 /// typedef void (*constraint_handler_t)(const char * restrict, 1241 /// void * restrict, errno_t); 1242 /// 1243 /// constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); 1244 /// 1245 /// _Noreturn void abort_handler_s(const char * restrict, void * restrict, 1246 /// errno_t); 1247 /// 1248 /// void ignore_handler_s(const char * restrict, void * restrict, errno_t); 1249 /// 1250 /// errno_t qsort_s(void *, rsize_t, rsize_t, 1251 /// int (*)(const void *, const void *, void *), void *); 1252 /// 1253 /// 1254 /// 1255 /// 1256 /// 1257 /// 1258 /// 1259 /// 1260 /// 1261 /// 1262 /// 1263 /// 1264 /// 1265 /// 1266 /// 1267 /// 1268 /// 1269 /// 1270 /// 1271 /// 1272 /// 1273 /// 1274 /// 1275 /// typedef __int8_t int8_t; 1276 /// 1277 /// 1278 /// 1279 /// 1280 /// typedef __int16_t int16_t; 1281 /// 1282 /// 1283 /// 1284 /// 1285 /// typedef __int32_t int32_t; 1286 /// 1287 /// 1288 /// 1289 /// 1290 /// typedef __int64_t int64_t; 1291 /// 1292 /// 1293 /// 1294 /// 1295 /// typedef __uint8_t uint8_t; 1296 /// 1297 /// 1298 /// 1299 /// 1300 /// typedef __uint16_t uint16_t; 1301 /// 1302 /// 1303 /// 1304 /// 1305 /// typedef __uint32_t uint32_t; 1306 /// 1307 /// 1308 /// 1309 /// 1310 /// typedef __uint64_t uint64_t; 1311 /// 1312 /// 1313 /// 1314 /// 1315 /// typedef __intptr_t intptr_t; 1316 /// 1317 /// 1318 /// 1319 /// typedef __uintptr_t uintptr_t; 1320 /// 1321 /// 1322 /// 1323 /// typedef __intmax_t intmax_t; 1324 /// 1325 /// 1326 /// 1327 /// typedef __uintmax_t uintmax_t; 1328 /// 1329 /// 1330 /// typedef __int_least8_t int_least8_t; 1331 /// typedef __int_least16_t int_least16_t; 1332 /// typedef __int_least32_t int_least32_t; 1333 /// typedef __int_least64_t int_least64_t; 1334 /// 1335 /// typedef __uint_least8_t uint_least8_t; 1336 /// typedef __uint_least16_t uint_least16_t; 1337 /// typedef __uint_least32_t uint_least32_t; 1338 /// typedef __uint_least64_t uint_least64_t; 1339 /// 1340 /// typedef __int_fast8_t int_fast8_t; 1341 /// typedef __int_fast16_t int_fast16_t; 1342 /// typedef __int_fast32_t int_fast32_t; 1343 /// typedef __int_fast64_t int_fast64_t; 1344 /// 1345 /// typedef __uint_fast8_t uint_fast8_t; 1346 /// typedef __uint_fast16_t uint_fast16_t; 1347 /// typedef __uint_fast32_t uint_fast32_t; 1348 /// typedef __uint_fast64_t uint_fast64_t; 1349 /// 1350 /// 1351 /// 1352 /// 1353 /// 1354 /// 1355 /// 1356 /// 1357 /// 1358 /// 1359 /// 1360 /// 1361 /// 1362 /// 1363 /// 1364 /// 1365 /// 1366 /// struct pthread; 1367 /// struct pthread_attr; 1368 /// struct pthread_cond; 1369 /// struct pthread_cond_attr; 1370 /// struct pthread_mutex; 1371 /// struct pthread_mutex_attr; 1372 /// struct pthread_once; 1373 /// struct pthread_rwlock; 1374 /// struct pthread_rwlockattr; 1375 /// struct pthread_barrier; 1376 /// struct pthread_barrier_attr; 1377 /// struct pthread_spinlock; 1378 /// 1379 /// typedef struct pthread *pthread_t; 1380 /// 1381 /// 1382 /// typedef struct pthread_attr *pthread_attr_t; 1383 /// typedef struct pthread_mutex *pthread_mutex_t; 1384 /// typedef struct pthread_mutex_attr *pthread_mutexattr_t; 1385 /// typedef struct pthread_cond *pthread_cond_t; 1386 /// typedef struct pthread_cond_attr *pthread_condattr_t; 1387 /// typedef int pthread_key_t; 1388 /// typedef struct pthread_once pthread_once_t; 1389 /// typedef struct pthread_rwlock *pthread_rwlock_t; 1390 /// typedef struct pthread_rwlockattr *pthread_rwlockattr_t; 1391 /// typedef struct pthread_barrier *pthread_barrier_t; 1392 /// typedef struct pthread_barrierattr *pthread_barrierattr_t; 1393 /// typedef struct pthread_spinlock *pthread_spinlock_t; 1394 /// 1395 /// 1396 /// 1397 /// 1398 /// 1399 /// 1400 /// 1401 /// typedef void *pthread_addr_t; 1402 /// typedef void *(*pthread_startroutine_t)(void *); 1403 /// 1404 /// 1405 /// 1406 /// 1407 /// struct pthread_once { 1408 /// int state; 1409 /// pthread_mutex_t mutex; 1410 /// }; 1411 /// 1412 /// 1413 /// 1414 /// typedef unsigned char u_char; 1415 /// typedef unsigned short u_short; 1416 /// typedef unsigned int u_int; 1417 /// typedef unsigned long u_long; 1418 /// 1419 /// typedef unsigned short ushort; 1420 /// typedef unsigned int uint; 1421 /// 1422 /// typedef __uint8_t u_int8_t; 1423 /// typedef __uint16_t u_int16_t; 1424 /// typedef __uint32_t u_int32_t; 1425 /// typedef __uint64_t u_int64_t; 1426 /// 1427 /// typedef __uint64_t u_quad_t; 1428 /// typedef __int64_t quad_t; 1429 /// typedef quad_t * qaddr_t; 1430 /// 1431 /// typedef char * caddr_t; 1432 /// typedef const char * c_caddr_t; 1433 /// 1434 /// 1435 /// typedef __blksize_t blksize_t; 1436 /// 1437 /// 1438 /// 1439 /// typedef __cpuwhich_t cpuwhich_t; 1440 /// typedef __cpulevel_t cpulevel_t; 1441 /// typedef __cpusetid_t cpusetid_t; 1442 /// 1443 /// 1444 /// typedef __blkcnt_t blkcnt_t; 1445 /// 1446 /// 1447 /// 1448 /// 1449 /// typedef __clock_t clock_t; 1450 /// 1451 /// 1452 /// 1453 /// 1454 /// typedef __clockid_t clockid_t; 1455 /// 1456 /// 1457 /// 1458 /// typedef __critical_t critical_t; 1459 /// typedef __daddr_t daddr_t; 1460 /// 1461 /// 1462 /// typedef __dev_t dev_t; 1463 /// 1464 /// 1465 /// 1466 /// 1467 /// typedef __fflags_t fflags_t; 1468 /// 1469 /// 1470 /// 1471 /// typedef __fixpt_t fixpt_t; 1472 /// 1473 /// 1474 /// typedef __fsblkcnt_t fsblkcnt_t; 1475 /// typedef __fsfilcnt_t fsfilcnt_t; 1476 /// 1477 /// 1478 /// 1479 /// 1480 /// typedef __gid_t gid_t; 1481 /// 1482 /// 1483 /// 1484 /// 1485 /// typedef __uint32_t in_addr_t; 1486 /// 1487 /// 1488 /// 1489 /// 1490 /// typedef __uint16_t in_port_t; 1491 /// 1492 /// 1493 /// 1494 /// 1495 /// typedef __id_t id_t; 1496 /// 1497 /// 1498 /// 1499 /// 1500 /// typedef __ino_t ino_t; 1501 /// 1502 /// 1503 /// 1504 /// 1505 /// typedef __key_t key_t; 1506 /// 1507 /// 1508 /// 1509 /// 1510 /// typedef __lwpid_t lwpid_t; 1511 /// 1512 /// 1513 /// 1514 /// 1515 /// typedef __mode_t mode_t; 1516 /// 1517 /// 1518 /// 1519 /// 1520 /// typedef __accmode_t accmode_t; 1521 /// 1522 /// 1523 /// 1524 /// 1525 /// typedef __nlink_t nlink_t; 1526 /// 1527 /// 1528 /// 1529 /// 1530 /// typedef __off_t off_t; 1531 /// 1532 /// 1533 /// 1534 /// 1535 /// typedef __off64_t off64_t; 1536 /// 1537 /// 1538 /// 1539 /// 1540 /// typedef __pid_t pid_t; 1541 /// 1542 /// 1543 /// 1544 /// typedef __register_t register_t; 1545 /// 1546 /// 1547 /// typedef __rlim_t rlim_t; 1548 /// 1549 /// 1550 /// 1551 /// typedef __int64_t sbintime_t; 1552 /// 1553 /// typedef __segsz_t segsz_t; 1554 /// 1555 /// 1556 /// 1557 /// 1558 /// 1559 /// 1560 /// 1561 /// typedef __ssize_t ssize_t; 1562 /// 1563 /// 1564 /// 1565 /// 1566 /// typedef __suseconds_t suseconds_t; 1567 /// 1568 /// 1569 /// 1570 /// 1571 /// typedef __time_t time_t; 1572 /// 1573 /// 1574 /// 1575 /// 1576 /// typedef __timer_t timer_t; 1577 /// 1578 /// 1579 /// 1580 /// 1581 /// typedef __mqd_t mqd_t; 1582 /// 1583 /// 1584 /// 1585 /// typedef __u_register_t u_register_t; 1586 /// 1587 /// 1588 /// typedef __uid_t uid_t; 1589 /// 1590 /// 1591 /// 1592 /// 1593 /// typedef __useconds_t useconds_t; 1594 /// 1595 /// 1596 /// 1597 /// 1598 /// 1599 /// typedef unsigned long cap_ioctl_t; 1600 /// 1601 /// 1602 /// 1603 /// 1604 /// struct cap_rights; 1605 /// 1606 /// typedef struct cap_rights cap_rights_t; 1607 /// 1608 /// typedef __uint64_t kpaddr_t; 1609 /// typedef __uint64_t kvaddr_t; 1610 /// typedef __uint64_t ksize_t; 1611 /// typedef __int64_t kssize_t; 1612 /// 1613 /// typedef __vm_offset_t vm_offset_t; 1614 /// typedef __uint64_t vm_ooffset_t; 1615 /// typedef __vm_paddr_t vm_paddr_t; 1616 /// typedef __uint64_t vm_pindex_t; 1617 /// typedef __vm_size_t vm_size_t; 1618 /// 1619 /// typedef __rman_res_t rman_res_t; 1620 /// 1621 /// static __inline __uint16_t 1622 /// __bitcount16(__uint16_t _x) 1623 /// { 1624 /// 1625 /// _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); 1626 /// _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); 1627 /// _x = (_x + (_x >> 4)) & 0x0f0f; 1628 /// _x = (_x + (_x >> 8)) & 0x00ff; 1629 /// return (_x); 1630 /// } 1631 /// 1632 /// static __inline __uint32_t 1633 /// __bitcount32(__uint32_t _x) 1634 /// { 1635 /// 1636 /// _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); 1637 /// _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); 1638 /// _x = (_x + (_x >> 4)) & 0x0f0f0f0f; 1639 /// _x = (_x + (_x >> 8)); 1640 /// _x = (_x + (_x >> 16)) & 0x000000ff; 1641 /// return (_x); 1642 /// } 1643 /// 1644 /// 1645 /// static __inline __uint64_t 1646 /// __bitcount64(__uint64_t _x) 1647 /// { 1648 /// 1649 /// _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); 1650 /// _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); 1651 /// _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; 1652 /// _x = (_x + (_x >> 8)); 1653 /// _x = (_x + (_x >> 16)); 1654 /// _x = (_x + (_x >> 32)) & 0x000000ff; 1655 /// return (_x); 1656 /// } 1657 /// 1658 /// 1659 /// 1660 /// 1661 /// 1662 /// typedef struct __sigset { 1663 /// __uint32_t __bits[4]; 1664 /// } __sigset_t; 1665 /// 1666 /// 1667 /// 1668 /// struct timeval { 1669 /// time_t tv_sec; 1670 /// suseconds_t tv_usec; 1671 /// }; 1672 /// 1673 /// 1674 /// 1675 /// 1676 /// 1677 /// struct timespec { 1678 /// time_t tv_sec; 1679 /// long tv_nsec; 1680 /// }; 1681 /// 1682 /// 1683 /// struct itimerspec { 1684 /// struct timespec it_interval; 1685 /// struct timespec it_value; 1686 /// }; 1687 /// 1688 /// 1689 /// typedef unsigned long __fd_mask; 1690 /// 1691 /// typedef __fd_mask fd_mask; 1692 /// 1693 /// 1694 /// 1695 /// 1696 /// typedef __sigset_t sigset_t; 1697 /// 1698 /// typedef struct fd_set { 1699 /// __fd_mask __fds_bits[(((1024) + (((sizeof(__fd_mask) * 8)) - 1)) / ((sizeof(__fd_mask) * 8)))]; 1700 /// } fd_set; 1701 /// 1702 /// 1703 /// int pselect(int, fd_set *restrict, fd_set *restrict, fd_set *restrict, 1704 /// const struct timespec *restrict, const sigset_t *restrict); 1705 /// 1706 /// 1707 /// 1708 /// int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 1709 /// 1710 /// 1711 /// 1712 /// 1713 /// static __inline int 1714 /// __major(dev_t _d) 1715 /// { 1716 /// return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff)); 1717 /// } 1718 /// 1719 /// static __inline int 1720 /// __minor(dev_t _d) 1721 /// { 1722 /// return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff)); 1723 /// } 1724 /// 1725 /// static __inline dev_t 1726 /// __makedev(int _Major, int _Minor) 1727 /// { 1728 /// return (((dev_t)(_Major & 0xffffff00) << 32) | ((_Major & 0xff) << 8) | 1729 /// ((dev_t)(_Minor & 0xff00) << 24) | (_Minor & 0xffff00ff)); 1730 /// } 1731 /// 1732 /// 1733 /// 1734 /// 1735 /// 1736 /// 1737 /// 1738 /// 1739 /// 1740 /// 1741 /// int ftruncate(int, off_t); 1742 /// 1743 /// 1744 /// 1745 /// off_t lseek(int, off_t, int); 1746 /// 1747 /// 1748 /// 1749 /// void * mmap(void *, size_t, int, int, int, off_t); 1750 /// 1751 /// 1752 /// 1753 /// int truncate(const char *, off_t); 1754 /// 1755 /// 1756 /// 1757 /// 1758 /// 1759 /// 1760 /// 1761 /// 1762 /// static __inline int atomic_cmpset_char(volatile u_char *dst, u_char expect, u_char src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "char" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_char(volatile u_char *dst, u_char *expect, u_char src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "char" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; 1763 /// static __inline int atomic_cmpset_short(volatile u_short *dst, u_short expect, u_short src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "short" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_short(volatile u_short *dst, u_short *expect, u_short src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "short" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; 1764 /// static __inline int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "int" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_int(volatile u_int *dst, u_int *expect, u_int src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "int" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; 1765 /// static __inline int atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_cmpset_" "long" " " : "=@cce" (res), "+m" (*dst), "+a" (expect) : "r" (src) : "memory", "cc"); return (res); } static __inline int atomic_fcmpset_long(volatile u_long *dst, u_long *expect, u_long src) { u_char res; __asm volatile( " " "lock ; " " " " cmpxchg %3,%1 ; " "# atomic_fcmpset_" "long" " " : "=@cce" (res), "+m" (*dst), "+a" (*expect) : "r" (src) : "memory", "cc"); return (res); }; 1766 /// 1767 /// 1768 /// 1769 /// 1770 /// 1771 /// static __inline u_int 1772 /// atomic_fetchadd_int(volatile u_int *p, u_int v) 1773 /// { 1774 /// 1775 /// __asm volatile( 1776 /// " " "lock ; " " " 1777 /// " xaddl %0,%1 ; " 1778 /// "# atomic_fetchadd_int" 1779 /// : "+r" (v), 1780 /// "+m" (*p) 1781 /// : : "cc"); 1782 /// return (v); 1783 /// } 1784 /// 1785 /// 1786 /// 1787 /// 1788 /// 1789 /// static __inline u_long 1790 /// atomic_fetchadd_long(volatile u_long *p, u_long v) 1791 /// { 1792 /// 1793 /// __asm volatile( 1794 /// " " "lock ; " " " 1795 /// " xaddq %0,%1 ; " 1796 /// "# atomic_fetchadd_long" 1797 /// : "+r" (v), 1798 /// "+m" (*p) 1799 /// : : "cc"); 1800 /// return (v); 1801 /// } 1802 /// 1803 /// static __inline int 1804 /// atomic_testandset_int(volatile u_int *p, u_int v) 1805 /// { 1806 /// u_char res; 1807 /// 1808 /// __asm volatile( 1809 /// " " "lock ; " " " 1810 /// " btsl %2,%1 ; " 1811 /// "# atomic_testandset_int" 1812 /// : "=@ccc" (res), 1813 /// "+m" (*p) 1814 /// : "Ir" (v & 0x1f) 1815 /// : "cc"); 1816 /// return (res); 1817 /// } 1818 /// 1819 /// static __inline int 1820 /// atomic_testandset_long(volatile u_long *p, u_int v) 1821 /// { 1822 /// u_char res; 1823 /// 1824 /// __asm volatile( 1825 /// " " "lock ; " " " 1826 /// " btsq %2,%1 ; " 1827 /// "# atomic_testandset_long" 1828 /// : "=@ccc" (res), 1829 /// "+m" (*p) 1830 /// : "Jr" ((u_long)(v & 0x3f)) 1831 /// : "cc"); 1832 /// return (res); 1833 /// } 1834 /// 1835 /// static __inline int 1836 /// atomic_testandclear_int(volatile u_int *p, u_int v) 1837 /// { 1838 /// u_char res; 1839 /// 1840 /// __asm volatile( 1841 /// " " "lock ; " " " 1842 /// " btrl %2,%1 ; " 1843 /// "# atomic_testandclear_int" 1844 /// : "=@ccc" (res), 1845 /// "+m" (*p) 1846 /// : "Ir" (v & 0x1f) 1847 /// : "cc"); 1848 /// return (res); 1849 /// } 1850 /// 1851 /// static __inline int 1852 /// atomic_testandclear_long(volatile u_long *p, u_int v) 1853 /// { 1854 /// u_char res; 1855 /// 1856 /// __asm volatile( 1857 /// " " "lock ; " " " 1858 /// " btrq %2,%1 ; " 1859 /// "# atomic_testandclear_long" 1860 /// : "=@ccc" (res), 1861 /// "+m" (*p) 1862 /// : "Jr" ((u_long)(v & 0x3f)) 1863 /// : "cc"); 1864 /// return (res); 1865 /// } 1866 /// 1867 /// static __inline void 1868 /// __storeload_barrier(void) 1869 /// { 1870 /// 1871 /// __asm volatile("lock; addl $0,-8(%%rsp)" : : : "memory", "cc"); 1872 /// } 1873 /// 1874 /// static __inline void 1875 /// atomic_thread_fence_acq(void) 1876 /// { 1877 /// 1878 /// __asm volatile(" " : : : "memory"); 1879 /// } 1880 /// 1881 /// static __inline void 1882 /// atomic_thread_fence_rel(void) 1883 /// { 1884 /// 1885 /// __asm volatile(" " : : : "memory"); 1886 /// } 1887 /// 1888 /// static __inline void 1889 /// atomic_thread_fence_acq_rel(void) 1890 /// { 1891 /// 1892 /// __asm volatile(" " : : : "memory"); 1893 /// } 1894 /// 1895 /// static __inline void 1896 /// atomic_thread_fence_seq_cst(void) 1897 /// { 1898 /// 1899 /// __storeload_barrier(); 1900 /// } 1901 /// 1902 /// 1903 /// 1904 /// static __inline void atomic_set_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "orb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_set_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "orb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack; 1905 /// static __inline void atomic_clear_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "andb %b1,%0" : "+m" (*p) : "iq" (~v) : "cc"); } static __inline void atomic_clear_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "andb %b1,%0" : "+m" (*p) : "iq" (~v) : "memory", "cc"); } struct __hack; 1906 /// static __inline void atomic_add_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "addb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_add_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "addb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack; 1907 /// static __inline void atomic_subtract_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "subb %b1,%0" : "+m" (*p) : "iq" (v) : "cc"); } static __inline void atomic_subtract_barr_char(volatile u_char *p, u_char v){ __asm volatile("lock ; " "subb %b1,%0" : "+m" (*p) : "iq" (v) : "memory", "cc"); } struct __hack; 1908 /// 1909 /// static __inline void atomic_set_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "orw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_set_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "orw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; 1910 /// static __inline void atomic_clear_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "andw %w1,%0" : "+m" (*p) : "ir" (~v) : "cc"); } static __inline void atomic_clear_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "andw %w1,%0" : "+m" (*p) : "ir" (~v) : "memory", "cc"); } struct __hack; 1911 /// static __inline void atomic_add_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "addw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_add_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "addw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; 1912 /// static __inline void atomic_subtract_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "subw %w1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_subtract_barr_short(volatile u_short *p, u_short v){ __asm volatile("lock ; " "subw %w1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; 1913 /// 1914 /// static __inline void atomic_set_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "orl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_set_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "orl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; 1915 /// static __inline void atomic_clear_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "andl %1,%0" : "+m" (*p) : "ir" (~v) : "cc"); } static __inline void atomic_clear_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "andl %1,%0" : "+m" (*p) : "ir" (~v) : "memory", "cc"); } struct __hack; 1916 /// static __inline void atomic_add_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "addl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_add_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "addl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; 1917 /// static __inline void atomic_subtract_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "subl %1,%0" : "+m" (*p) : "ir" (v) : "cc"); } static __inline void atomic_subtract_barr_int(volatile u_int *p, u_int v){ __asm volatile("lock ; " "subl %1,%0" : "+m" (*p) : "ir" (v) : "memory", "cc"); } struct __hack; 1918 /// 1919 /// static __inline void atomic_set_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "orq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_set_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "orq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack; 1920 /// static __inline void atomic_clear_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "andq %1,%0" : "+m" (*p) : "er" (~v) : "cc"); } static __inline void atomic_clear_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "andq %1,%0" : "+m" (*p) : "er" (~v) : "memory", "cc"); } struct __hack; 1921 /// static __inline void atomic_add_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "addq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_add_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "addq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack; 1922 /// static __inline void atomic_subtract_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "subq %1,%0" : "+m" (*p) : "er" (v) : "cc"); } static __inline void atomic_subtract_barr_long(volatile u_long *p, u_long v){ __asm volatile("lock ; " "subq %1,%0" : "+m" (*p) : "er" (v) : "memory", "cc"); } struct __hack; 1923 /// 1924 /// 1925 /// 1926 /// 1927 /// 1928 /// static __inline u_char atomic_load_acq_char(volatile u_char *p) { u_char res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_char(volatile u_char *p, u_char v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; 1929 /// static __inline u_short atomic_load_acq_short(volatile u_short *p) { u_short res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_short(volatile u_short *p, u_short v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; 1930 /// static __inline u_int atomic_load_acq_int(volatile u_int *p) { u_int res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_int(volatile u_int *p, u_int v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; 1931 /// static __inline u_long atomic_load_acq_long(volatile u_long *p) { u_long res; res = *p; __asm volatile(" " : : : "memory"); return (res); } struct __hack; static __inline void atomic_store_rel_long(volatile u_long *p, u_long v) { __asm volatile(" " : : : "memory"); *p = v; } struct __hack; 1932 /// 1933 /// static __inline u_int 1934 /// atomic_swap_int(volatile u_int *p, u_int v) 1935 /// { 1936 /// 1937 /// __asm volatile( 1938 /// " xchgl %1,%0 ; " 1939 /// "# atomic_swap_int" 1940 /// : "+r" (v), 1941 /// "+m" (*p)); 1942 /// return (v); 1943 /// } 1944 /// 1945 /// static __inline u_long 1946 /// atomic_swap_long(volatile u_long *p, u_long v) 1947 /// { 1948 /// 1949 /// __asm volatile( 1950 /// " xchgq %1,%0 ; " 1951 /// "# atomic_swap_long" 1952 /// : "+r" (v), 1953 /// "+m" (*p)); 1954 /// return (v); 1955 /// } 1956 /// 1957 /// 1958 /// 1959 /// 1960 /// 1961 /// extern char *_PathLocale; 1962 /// 1963 /// int __detect_path_locale(void); 1964 /// int __wrap_setrunelocale(const char *); 1965 /// 1966 /// 1967 /// enum { 1968 /// XLC_COLLATE = 0, 1969 /// XLC_CTYPE, 1970 /// XLC_MONETARY, 1971 /// XLC_NUMERIC, 1972 /// XLC_TIME, 1973 /// XLC_MESSAGES, 1974 /// XLC_LAST 1975 /// }; 1976 /// 1977 /// _Static_assert(XLC_LAST - XLC_COLLATE == 6, "XLC values should be contiguous"); 1978 /// _Static_assert(XLC_COLLATE == 1979 /// 1980 /// 1 1981 /// 1982 /// - 1, 1983 /// "XLC_COLLATE doesn't match the LC_COLLATE value."); 1984 /// _Static_assert(XLC_CTYPE == 1985 /// 1986 /// 2 1987 /// 1988 /// - 1, 1989 /// "XLC_CTYPE doesn't match the LC_CTYPE value."); 1990 /// _Static_assert(XLC_MONETARY == 1991 /// 1992 /// 3 1993 /// 1994 /// - 1, 1995 /// "XLC_MONETARY doesn't match the LC_MONETARY value."); 1996 /// _Static_assert(XLC_NUMERIC == 1997 /// 1998 /// 4 1999 /// 2000 /// - 1, 2001 /// "XLC_NUMERIC doesn't match the LC_NUMERIC value."); 2002 /// _Static_assert(XLC_TIME == 2003 /// 2004 /// 5 2005 /// 2006 /// - 1, 2007 /// "XLC_TIME doesn't match the LC_TIME value."); 2008 /// _Static_assert(XLC_MESSAGES == 2009 /// 2010 /// 6 2011 /// 2012 /// - 1, 2013 /// "XLC_MESSAGES doesn't match the LC_MESSAGES value."); 2014 /// 2015 /// struct xlocale_refcounted { 2016 /// 2017 /// long retain_count; 2018 /// 2019 /// void(*destructor)(void*); 2020 /// }; 2021 /// 2022 /// 2023 /// 2024 /// 2025 /// 2026 /// 2027 /// 2028 /// struct xlocale_component { 2029 /// struct xlocale_refcounted header; 2030 /// 2031 /// char locale[31 +1]; 2032 /// 2033 /// char version[12]; 2034 /// }; 2035 /// 2036 /// 2037 /// 2038 /// 2039 /// struct _xlocale { 2040 /// struct xlocale_refcounted header; 2041 /// 2042 /// struct xlocale_component *components[XLC_LAST]; 2043 /// 2044 /// 2045 /// int monetary_locale_changed; 2046 /// 2047 /// 2048 /// int using_monetary_locale; 2049 /// 2050 /// 2051 /// int numeric_locale_changed; 2052 /// 2053 /// 2054 /// int using_numeric_locale; 2055 /// 2056 /// 2057 /// int using_time_locale; 2058 /// 2059 /// 2060 /// int using_messages_locale; 2061 /// 2062 /// struct lconv lconv; 2063 /// 2064 /// char *csym; 2065 /// }; 2066 /// 2067 /// 2068 /// 2069 /// 2070 /// __attribute__((unused)) static void* 2071 /// xlocale_retain(void *val) 2072 /// { 2073 /// struct xlocale_refcounted *obj = val; 2074 /// atomic_add_long(&(obj->retain_count), 1); 2075 /// return (val); 2076 /// } 2077 /// 2078 /// 2079 /// 2080 /// 2081 /// __attribute__((unused)) static void 2082 /// xlocale_release(void *val) 2083 /// { 2084 /// struct xlocale_refcounted *obj = val; 2085 /// long count; 2086 /// 2087 /// count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1; 2088 /// if (count < 0 && obj->destructor != 2089 /// 2090 /// ((void *)0) 2091 /// 2092 /// ) 2093 /// obj->destructor(obj); 2094 /// } 2095 /// 2096 /// 2097 /// 2098 /// 2099 /// 2100 /// extern void* __collate_load(const char*, locale_t); 2101 /// extern void* __ctype_load(const char*, locale_t); 2102 /// extern void* __messages_load(const char*, locale_t); 2103 /// extern void* __monetary_load(const char*, locale_t); 2104 /// extern void* __numeric_load(const char*, locale_t); 2105 /// extern void* __time_load(const char*, locale_t); 2106 /// 2107 /// extern struct _xlocale __xlocale_global_locale; 2108 /// extern struct _xlocale __xlocale_C_locale; 2109 /// 2110 /// 2111 /// 2112 /// 2113 /// void __set_thread_rune_locale(locale_t loc); 2114 /// 2115 /// 2116 /// 2117 /// 2118 /// extern int __has_thread_locale; 2119 /// 2120 /// 2121 /// 2122 /// 2123 /// 2124 /// extern _Thread_local locale_t __thread_locale; 2125 /// 2126 /// 2127 /// 2128 /// 2129 /// 2130 /// 2131 /// 2132 /// static inline locale_t __get_locale(void) 2133 /// { 2134 /// 2135 /// if (!__has_thread_locale) { 2136 /// return (&__xlocale_global_locale); 2137 /// } 2138 /// return (__thread_locale ? __thread_locale : &__xlocale_global_locale); 2139 /// } 2140 /// 2141 /// 2142 /// 2143 /// 2144 /// 2145 /// static inline locale_t get_real_locale(locale_t locale) 2146 /// { 2147 /// switch ((intptr_t)locale) { 2148 /// case 0: return (&__xlocale_C_locale); 2149 /// case -1: return (&__xlocale_global_locale); 2150 /// default: return (locale); 2151 /// } 2152 /// } 2153 /// 2154 /// 2155 /// 2156 /// 2157 /// 2158 /// 2159 /// 2160 /// 2161 /// struct xlocale_ctype { 2162 /// struct xlocale_component header; 2163 /// _RuneLocale *runes; 2164 /// size_t (*__mbrtowc)(wchar_t * 2165 /// 2166 /// restrict 2167 /// 2168 /// , const char * 2169 /// 2170 /// restrict 2171 /// 2172 /// , 2173 /// size_t, mbstate_t * 2174 /// 2175 /// restrict 2176 /// 2177 /// ); 2178 /// int (*__mbsinit)(const mbstate_t *); 2179 /// size_t (*__mbsnrtowcs)(wchar_t * 2180 /// 2181 /// restrict 2182 /// 2183 /// , const char ** 2184 /// 2185 /// restrict 2186 /// 2187 /// , 2188 /// size_t, size_t, mbstate_t * 2189 /// 2190 /// restrict 2191 /// 2192 /// ); 2193 /// size_t (*__wcrtomb)(char * 2194 /// 2195 /// restrict 2196 /// 2197 /// , wchar_t, mbstate_t * 2198 /// 2199 /// restrict 2200 /// 2201 /// ); 2202 /// size_t (*__wcsnrtombs)(char * 2203 /// 2204 /// restrict 2205 /// 2206 /// , const wchar_t ** 2207 /// 2208 /// restrict 2209 /// 2210 /// , 2211 /// size_t, size_t, mbstate_t * 2212 /// 2213 /// restrict 2214 /// 2215 /// ); 2216 /// int __mb_cur_max; 2217 /// int __mb_sb_limit; 2218 /// 2219 /// __mbstate_t mblen; 2220 /// 2221 /// __mbstate_t mbrlen; 2222 /// 2223 /// __mbstate_t mbrtoc16; 2224 /// 2225 /// __mbstate_t mbrtoc32; 2226 /// 2227 /// __mbstate_t mbrtowc; 2228 /// 2229 /// __mbstate_t mbsnrtowcs; 2230 /// 2231 /// __mbstate_t mbsrtowcs; 2232 /// 2233 /// __mbstate_t mbtowc; 2234 /// 2235 /// __mbstate_t c16rtomb; 2236 /// 2237 /// __mbstate_t c32rtomb; 2238 /// 2239 /// __mbstate_t wcrtomb; 2240 /// 2241 /// __mbstate_t wcsnrtombs; 2242 /// 2243 /// __mbstate_t wcsrtombs; 2244 /// 2245 /// __mbstate_t wctomb; 2246 /// }; 2247 /// 2248 /// extern struct xlocale_ctype __xlocale_global_ctype; 2249 /// 2250 /// 2251 /// 2252 /// 2253 /// int _none_init(struct xlocale_ctype *, _RuneLocale *) 2254 /// 2255 /// __attribute__((__visibility__("hidden"))) 2256 /// 2257 /// ; 2258 /// int _UTF8_init(struct xlocale_ctype *, _RuneLocale *) 2259 /// 2260 /// __attribute__((__visibility__("hidden"))) 2261 /// 2262 /// ; 2263 /// int _EUC_CN_init(struct xlocale_ctype *, _RuneLocale *) 2264 /// 2265 /// __attribute__((__visibility__("hidden"))) 2266 /// 2267 /// ; 2268 /// int _EUC_JP_init(struct xlocale_ctype *, _RuneLocale *) 2269 /// 2270 /// __attribute__((__visibility__("hidden"))) 2271 /// 2272 /// ; 2273 /// int _EUC_KR_init(struct xlocale_ctype *, _RuneLocale *) 2274 /// 2275 /// __attribute__((__visibility__("hidden"))) 2276 /// 2277 /// ; 2278 /// int _EUC_TW_init(struct xlocale_ctype *, _RuneLocale *) 2279 /// 2280 /// __attribute__((__visibility__("hidden"))) 2281 /// 2282 /// ; 2283 /// int _GB18030_init(struct xlocale_ctype *, _RuneLocale *) 2284 /// 2285 /// __attribute__((__visibility__("hidden"))) 2286 /// 2287 /// ; 2288 /// int _GB2312_init(struct xlocale_ctype *, _RuneLocale *) 2289 /// 2290 /// __attribute__((__visibility__("hidden"))) 2291 /// 2292 /// ; 2293 /// int _GBK_init(struct xlocale_ctype *, _RuneLocale *) 2294 /// 2295 /// __attribute__((__visibility__("hidden"))) 2296 /// 2297 /// ; 2298 /// int _BIG5_init(struct xlocale_ctype *, _RuneLocale *) 2299 /// 2300 /// __attribute__((__visibility__("hidden"))) 2301 /// 2302 /// ; 2303 /// int _MSKanji_init(struct xlocale_ctype *, _RuneLocale *) 2304 /// 2305 /// __attribute__((__visibility__("hidden"))) 2306 /// 2307 /// ; 2308 /// int _ascii_init(struct xlocale_ctype *, _RuneLocale *) 2309 /// 2310 /// __attribute__((__visibility__("hidden"))) 2311 /// 2312 /// ; 2313 /// 2314 /// typedef size_t (*mbrtowc_pfn_t)(wchar_t * 2315 /// 2316 /// restrict 2317 /// 2318 /// , 2319 /// const char * 2320 /// 2321 /// restrict 2322 /// 2323 /// , size_t, mbstate_t * 2324 /// 2325 /// restrict 2326 /// 2327 /// ); 2328 /// typedef size_t (*wcrtomb_pfn_t)(char * 2329 /// 2330 /// restrict 2331 /// 2332 /// , wchar_t, 2333 /// mbstate_t * 2334 /// 2335 /// restrict 2336 /// 2337 /// ); 2338 /// size_t __mbsnrtowcs_std(wchar_t * 2339 /// 2340 /// restrict 2341 /// 2342 /// , const char ** 2343 /// 2344 /// restrict 2345 /// 2346 /// , 2347 /// size_t, size_t, mbstate_t * 2348 /// 2349 /// restrict 2350 /// 2351 /// , mbrtowc_pfn_t); 2352 /// size_t __wcsnrtombs_std(char * 2353 /// 2354 /// restrict 2355 /// 2356 /// , const wchar_t ** 2357 /// 2358 /// restrict 2359 /// 2360 /// , 2361 /// size_t, size_t, mbstate_t * 2362 /// 2363 /// restrict 2364 /// 2365 /// , wcrtomb_pfn_t); 2366 /// 2367 2368 var X_DefaultRuneLocale = _RuneLocale{ 2369 2370 F__magic: *(*[8]int8)(unsafe.Pointer(ts)), 2371 F__encoding: *(*[32]int8)(unsafe.Pointer(ts + 9)), 2372 F__invalid_rune: 0xFFFD, 2373 2374 F__runetype: [256]uint32{ 2375 2376 0: uint32(0x00000200), 2377 2378 1: uint32(0x00000200), 2379 2380 2: uint32(0x00000200), 2381 2382 3: uint32(0x00000200), 2383 2384 4: uint32(0x00000200), 2385 2386 5: uint32(0x00000200), 2387 2388 6: uint32(0x00000200), 2389 2390 7: uint32(0x00000200), 2391 2392 8: uint32(0x00000200), 2393 2394 9: uint32(0x00000200 | 2395 2396 0x00004000 | 2397 2398 0x00020000), 2399 2400 10: uint32(0x00000200 | 2401 2402 0x00004000), 2403 2404 11: uint32(0x00000200 | 2405 2406 0x00004000), 2407 2408 12: uint32(0x00000200 | 2409 2410 0x00004000), 2411 2412 13: uint32(0x00000200 | 2413 2414 0x00004000), 2415 2416 14: uint32(0x00000200), 2417 2418 15: uint32(0x00000200), 2419 2420 16: uint32(0x00000200), 2421 2422 17: uint32(0x00000200), 2423 2424 18: uint32(0x00000200), 2425 2426 19: uint32(0x00000200), 2427 2428 20: uint32(0x00000200), 2429 2430 21: uint32(0x00000200), 2431 2432 22: uint32(0x00000200), 2433 2434 23: uint32(0x00000200), 2435 2436 24: uint32(0x00000200), 2437 2438 25: uint32(0x00000200), 2439 2440 26: uint32(0x00000200), 2441 2442 27: uint32(0x00000200), 2443 2444 28: uint32(0x00000200), 2445 2446 29: uint32(0x00000200), 2447 2448 30: uint32(0x00000200), 2449 2450 31: uint32(0x00000200), 2451 2452 32: uint32(0x00004000 | 2453 2454 0x00020000 | 2455 2456 0x00040000), 2457 2458 33: uint32(0x00002000 | 2459 2460 0x00040000 | 2461 2462 0x00000800), 2463 2464 34: uint32(0x00002000 | 2465 2466 0x00040000 | 2467 2468 0x00000800), 2469 2470 35: uint32(0x00002000 | 2471 2472 0x00040000 | 2473 2474 0x00000800), 2475 2476 36: uint32(0x00002000 | 2477 2478 0x00040000 | 2479 2480 0x00000800), 2481 2482 37: uint32(0x00002000 | 2483 2484 0x00040000 | 2485 2486 0x00000800), 2487 2488 38: uint32(0x00002000 | 2489 2490 0x00040000 | 2491 2492 0x00000800), 2493 2494 39: uint32(0x00002000 | 2495 2496 0x00040000 | 2497 2498 0x00000800), 2499 2500 40: uint32(0x00002000 | 2501 2502 0x00040000 | 2503 2504 0x00000800), 2505 2506 41: uint32(0x00002000 | 2507 2508 0x00040000 | 2509 2510 0x00000800), 2511 2512 42: uint32(0x00002000 | 2513 2514 0x00040000 | 2515 2516 0x00000800), 2517 2518 43: uint32(0x00002000 | 2519 2520 0x00040000 | 2521 2522 0x00000800), 2523 2524 44: uint32(0x00002000 | 2525 2526 0x00040000 | 2527 2528 0x00000800), 2529 2530 45: uint32(0x00002000 | 2531 2532 0x00040000 | 2533 2534 0x00000800), 2535 2536 46: uint32(0x00002000 | 2537 2538 0x00040000 | 2539 2540 0x00000800), 2541 2542 47: uint32(0x00002000 | 2543 2544 0x00040000 | 2545 2546 0x00000800), 2547 2548 48: uint32(0x00000400 | 2549 2550 0x00040000 | 2551 2552 0x00000800 | 2553 2554 0x00010000 | 2555 2556 0x00400000 | 2557 2558 0), 2559 2560 49: uint32(0x00000400 | 2561 2562 0x00040000 | 2563 2564 0x00000800 | 2565 2566 0x00010000 | 2567 2568 0x00400000 | 2569 2570 1), 2571 2572 50: uint32(0x00000400 | 2573 2574 0x00040000 | 2575 2576 0x00000800 | 2577 2578 0x00010000 | 2579 2580 0x00400000 | 2581 2582 2), 2583 2584 51: uint32(0x00000400 | 2585 2586 0x00040000 | 2587 2588 0x00000800 | 2589 2590 0x00010000 | 2591 2592 0x00400000 | 2593 2594 3), 2595 2596 52: uint32(0x00000400 | 2597 2598 0x00040000 | 2599 2600 0x00000800 | 2601 2602 0x00010000 | 2603 2604 0x00400000 | 2605 2606 4), 2607 2608 53: uint32(0x00000400 | 2609 2610 0x00040000 | 2611 2612 0x00000800 | 2613 2614 0x00010000 | 2615 2616 0x00400000 | 2617 2618 5), 2619 2620 54: uint32(0x00000400 | 2621 2622 0x00040000 | 2623 2624 0x00000800 | 2625 2626 0x00010000 | 2627 2628 0x00400000 | 2629 2630 6), 2631 2632 55: uint32(0x00000400 | 2633 2634 0x00040000 | 2635 2636 0x00000800 | 2637 2638 0x00010000 | 2639 2640 0x00400000 | 2641 2642 7), 2643 2644 56: uint32(0x00000400 | 2645 2646 0x00040000 | 2647 2648 0x00000800 | 2649 2650 0x00010000 | 2651 2652 0x00400000 | 2653 2654 8), 2655 2656 57: uint32(0x00000400 | 2657 2658 0x00040000 | 2659 2660 0x00000800 | 2661 2662 0x00010000 | 2663 2664 0x00400000 | 2665 2666 9), 2667 2668 58: uint32(0x00002000 | 2669 2670 0x00040000 | 2671 2672 0x00000800), 2673 2674 59: uint32(0x00002000 | 2675 2676 0x00040000 | 2677 2678 0x00000800), 2679 2680 60: uint32(0x00002000 | 2681 2682 0x00040000 | 2683 2684 0x00000800), 2685 2686 61: uint32(0x00002000 | 2687 2688 0x00040000 | 2689 2690 0x00000800), 2691 2692 62: uint32(0x00002000 | 2693 2694 0x00040000 | 2695 2696 0x00000800), 2697 2698 63: uint32(0x00002000 | 2699 2700 0x00040000 | 2701 2702 0x00000800), 2703 2704 64: uint32(0x00002000 | 2705 2706 0x00040000 | 2707 2708 0x00000800), 2709 2710 65: uint32(0x00008000 | 2711 2712 0x00010000 | 2713 2714 0x00040000 | 2715 2716 0x00000800 | 2717 2718 0x00000100 | 2719 2720 10), 2721 2722 66: uint32(0x00008000 | 2723 2724 0x00010000 | 2725 2726 0x00040000 | 2727 2728 0x00000800 | 2729 2730 0x00000100 | 2731 2732 11), 2733 2734 67: uint32(0x00008000 | 2735 2736 0x00010000 | 2737 2738 0x00040000 | 2739 2740 0x00000800 | 2741 2742 0x00000100 | 2743 2744 12), 2745 2746 68: uint32(0x00008000 | 2747 2748 0x00010000 | 2749 2750 0x00040000 | 2751 2752 0x00000800 | 2753 2754 0x00000100 | 2755 2756 13), 2757 2758 69: uint32(0x00008000 | 2759 2760 0x00010000 | 2761 2762 0x00040000 | 2763 2764 0x00000800 | 2765 2766 0x00000100 | 2767 2768 14), 2769 2770 70: uint32(0x00008000 | 2771 2772 0x00010000 | 2773 2774 0x00040000 | 2775 2776 0x00000800 | 2777 2778 0x00000100 | 2779 2780 15), 2781 2782 71: uint32(0x00008000 | 2783 2784 0x00040000 | 2785 2786 0x00000800 | 2787 2788 0x00000100), 2789 2790 72: uint32(0x00008000 | 2791 2792 0x00040000 | 2793 2794 0x00000800 | 2795 2796 0x00000100), 2797 2798 73: uint32(0x00008000 | 2799 2800 0x00040000 | 2801 2802 0x00000800 | 2803 2804 0x00000100), 2805 2806 74: uint32(0x00008000 | 2807 2808 0x00040000 | 2809 2810 0x00000800 | 2811 2812 0x00000100), 2813 2814 75: uint32(0x00008000 | 2815 2816 0x00040000 | 2817 2818 0x00000800 | 2819 2820 0x00000100), 2821 2822 76: uint32(0x00008000 | 2823 2824 0x00040000 | 2825 2826 0x00000800 | 2827 2828 0x00000100), 2829 2830 77: uint32(0x00008000 | 2831 2832 0x00040000 | 2833 2834 0x00000800 | 2835 2836 0x00000100), 2837 2838 78: uint32(0x00008000 | 2839 2840 0x00040000 | 2841 2842 0x00000800 | 2843 2844 0x00000100), 2845 2846 79: uint32(0x00008000 | 2847 2848 0x00040000 | 2849 2850 0x00000800 | 2851 2852 0x00000100), 2853 2854 80: uint32(0x00008000 | 2855 2856 0x00040000 | 2857 2858 0x00000800 | 2859 2860 0x00000100), 2861 2862 81: uint32(0x00008000 | 2863 2864 0x00040000 | 2865 2866 0x00000800 | 2867 2868 0x00000100), 2869 2870 82: uint32(0x00008000 | 2871 2872 0x00040000 | 2873 2874 0x00000800 | 2875 2876 0x00000100), 2877 2878 83: uint32(0x00008000 | 2879 2880 0x00040000 | 2881 2882 0x00000800 | 2883 2884 0x00000100), 2885 2886 84: uint32(0x00008000 | 2887 2888 0x00040000 | 2889 2890 0x00000800 | 2891 2892 0x00000100), 2893 2894 85: uint32(0x00008000 | 2895 2896 0x00040000 | 2897 2898 0x00000800 | 2899 2900 0x00000100), 2901 2902 86: uint32(0x00008000 | 2903 2904 0x00040000 | 2905 2906 0x00000800 | 2907 2908 0x00000100), 2909 2910 87: uint32(0x00008000 | 2911 2912 0x00040000 | 2913 2914 0x00000800 | 2915 2916 0x00000100), 2917 2918 88: uint32(0x00008000 | 2919 2920 0x00040000 | 2921 2922 0x00000800 | 2923 2924 0x00000100), 2925 2926 89: uint32(0x00008000 | 2927 2928 0x00040000 | 2929 2930 0x00000800 | 2931 2932 0x00000100), 2933 2934 90: uint32(0x00008000 | 2935 2936 0x00040000 | 2937 2938 0x00000800 | 2939 2940 0x00000100), 2941 2942 91: uint32(0x00002000 | 2943 2944 0x00040000 | 2945 2946 0x00000800), 2947 2948 92: uint32(0x00002000 | 2949 2950 0x00040000 | 2951 2952 0x00000800), 2953 2954 93: uint32(0x00002000 | 2955 2956 0x00040000 | 2957 2958 0x00000800), 2959 2960 94: uint32(0x00002000 | 2961 2962 0x00040000 | 2963 2964 0x00000800), 2965 2966 95: uint32(0x00002000 | 2967 2968 0x00040000 | 2969 2970 0x00000800), 2971 2972 96: uint32(0x00002000 | 2973 2974 0x00040000 | 2975 2976 0x00000800), 2977 2978 97: uint32(0x00001000 | 2979 2980 0x00010000 | 2981 2982 0x00040000 | 2983 2984 0x00000800 | 2985 2986 0x00000100 | 2987 2988 10), 2989 2990 98: uint32(0x00001000 | 2991 2992 0x00010000 | 2993 2994 0x00040000 | 2995 2996 0x00000800 | 2997 2998 0x00000100 | 2999 3000 11), 3001 3002 99: uint32(0x00001000 | 3003 3004 0x00010000 | 3005 3006 0x00040000 | 3007 3008 0x00000800 | 3009 3010 0x00000100 | 3011 3012 12), 3013 3014 100: uint32(0x00001000 | 3015 3016 0x00010000 | 3017 3018 0x00040000 | 3019 3020 0x00000800 | 3021 3022 0x00000100 | 3023 3024 13), 3025 3026 101: uint32(0x00001000 | 3027 3028 0x00010000 | 3029 3030 0x00040000 | 3031 3032 0x00000800 | 3033 3034 0x00000100 | 3035 3036 14), 3037 3038 102: uint32(0x00001000 | 3039 3040 0x00010000 | 3041 3042 0x00040000 | 3043 3044 0x00000800 | 3045 3046 0x00000100 | 3047 3048 15), 3049 3050 103: uint32(0x00001000 | 3051 3052 0x00040000 | 3053 3054 0x00000800 | 3055 3056 0x00000100), 3057 3058 104: uint32(0x00001000 | 3059 3060 0x00040000 | 3061 3062 0x00000800 | 3063 3064 0x00000100), 3065 3066 105: uint32(0x00001000 | 3067 3068 0x00040000 | 3069 3070 0x00000800 | 3071 3072 0x00000100), 3073 3074 106: uint32(0x00001000 | 3075 3076 0x00040000 | 3077 3078 0x00000800 | 3079 3080 0x00000100), 3081 3082 107: uint32(0x00001000 | 3083 3084 0x00040000 | 3085 3086 0x00000800 | 3087 3088 0x00000100), 3089 3090 108: uint32(0x00001000 | 3091 3092 0x00040000 | 3093 3094 0x00000800 | 3095 3096 0x00000100), 3097 3098 109: uint32(0x00001000 | 3099 3100 0x00040000 | 3101 3102 0x00000800 | 3103 3104 0x00000100), 3105 3106 110: uint32(0x00001000 | 3107 3108 0x00040000 | 3109 3110 0x00000800 | 3111 3112 0x00000100), 3113 3114 111: uint32(0x00001000 | 3115 3116 0x00040000 | 3117 3118 0x00000800 | 3119 3120 0x00000100), 3121 3122 112: uint32(0x00001000 | 3123 3124 0x00040000 | 3125 3126 0x00000800 | 3127 3128 0x00000100), 3129 3130 113: uint32(0x00001000 | 3131 3132 0x00040000 | 3133 3134 0x00000800 | 3135 3136 0x00000100), 3137 3138 114: uint32(0x00001000 | 3139 3140 0x00040000 | 3141 3142 0x00000800 | 3143 3144 0x00000100), 3145 3146 115: uint32(0x00001000 | 3147 3148 0x00040000 | 3149 3150 0x00000800 | 3151 3152 0x00000100), 3153 3154 116: uint32(0x00001000 | 3155 3156 0x00040000 | 3157 3158 0x00000800 | 3159 3160 0x00000100), 3161 3162 117: uint32(0x00001000 | 3163 3164 0x00040000 | 3165 3166 0x00000800 | 3167 3168 0x00000100), 3169 3170 118: uint32(0x00001000 | 3171 3172 0x00040000 | 3173 3174 0x00000800 | 3175 3176 0x00000100), 3177 3178 119: uint32(0x00001000 | 3179 3180 0x00040000 | 3181 3182 0x00000800 | 3183 3184 0x00000100), 3185 3186 120: uint32(0x00001000 | 3187 3188 0x00040000 | 3189 3190 0x00000800 | 3191 3192 0x00000100), 3193 3194 121: uint32(0x00001000 | 3195 3196 0x00040000 | 3197 3198 0x00000800 | 3199 3200 0x00000100), 3201 3202 122: uint32(0x00001000 | 3203 3204 0x00040000 | 3205 3206 0x00000800 | 3207 3208 0x00000100), 3209 3210 123: uint32(0x00002000 | 3211 3212 0x00040000 | 3213 3214 0x00000800), 3215 3216 124: uint32(0x00002000 | 3217 3218 0x00040000 | 3219 3220 0x00000800), 3221 3222 125: uint32(0x00002000 | 3223 3224 0x00040000 | 3225 3226 0x00000800), 3227 3228 126: uint32(0x00002000 | 3229 3230 0x00040000 | 3231 3232 0x00000800), 3233 3234 127: uint32(0x00000200), 3235 }, 3236 F__maplower: [256]int32{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 3237 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 3238 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 3239 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 3240 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 3241 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 3242 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 3243 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 3244 0x40, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 3245 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 3246 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 3247 'x', 'y', 'z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 3248 0x60, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 3249 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 3250 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 3251 'x', 'y', 'z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 3252 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 3253 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 3254 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 3255 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 3256 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 3257 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 3258 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 3259 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 3260 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 3261 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 3262 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 3263 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 3264 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 3265 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 3266 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 3267 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 3268 }, 3269 F__mapupper: [256]int32{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 3270 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 3271 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 3272 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 3273 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 3274 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 3275 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 3276 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 3277 0x40, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 3278 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 3279 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 3280 'X', 'Y', 'Z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 3281 0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 3282 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 3283 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 3284 'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 3285 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 3286 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 3287 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 3288 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 3289 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 3290 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 3291 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 3292 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 3293 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 3294 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 3295 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 3296 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 3297 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 3298 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 3299 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 3300 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 3301 }, 3302 } /* table.cpp.c:2243:19 */ 3303 3304 var X_CurrentRuneLocale uintptr = 0 /* table.cpp.c:4092:19 */ 3305 3306 /// _RuneLocale * 3307 /// __runes_for_locale(locale_t locale, int *mb_sb_limit) 3308 /// { 3309 /// (locale = get_real_locale(locale)); 3310 /// struct xlocale_ctype *c = ((struct xlocale_ctype*)(locale)->components[XLC_CTYPE]); 3311 /// *mb_sb_limit = c->__mb_sb_limit; 3312 /// return c->runes; 3313 /// } 3314 3315 func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ 3316 return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5)) 3317 } 3318 3319 type locale_t = uintptr /* alltypes.h:366:32 */ 3320 3321 func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ 3322 return Bool32(func() int32 { 3323 if 0 != 0 { 3324 return Xisalpha(tls, c) 3325 } 3326 return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) 3327 }() != 0 || func() int32 { 3328 if 0 != 0 { 3329 return Xisdigit(tls, c) 3330 } 3331 return Bool32(uint32(c)-uint32('0') < uint32(10)) 3332 }() != 0) 3333 } 3334 3335 func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */ 3336 return Xisalnum(tls, c) 3337 } 3338 3339 func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */ 3340 return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) 3341 } 3342 3343 func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */ 3344 return Xisalpha(tls, c) 3345 } 3346 3347 func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */ 3348 return Bool32(uint32(c)-uint32('0') < uint32(10)) 3349 } 3350 3351 func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */ 3352 return Xisdigit(tls, c) 3353 } 3354 3355 func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */ 3356 return Bool32(uint32(c)-uint32('a') < uint32(26)) 3357 } 3358 3359 func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */ 3360 return Xislower(tls, c) 3361 } 3362 3363 func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ 3364 return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) 3365 } 3366 3367 func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */ 3368 return Xisprint(tls, c) 3369 } 3370 3371 func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */ 3372 return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5)) 3373 } 3374 3375 func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */ 3376 return Xisspace(tls, c) 3377 } 3378 3379 func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */ 3380 return Bool32(uint32(c)-uint32('A') < uint32(26)) 3381 } 3382 3383 func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */ 3384 return Xisupper(tls, c) 3385 } 3386 3387 func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */ 3388 return Bool32(func() int32 { 3389 if 0 != 0 { 3390 return Xisdigit(tls, c) 3391 } 3392 return Bool32(uint32(c)-uint32('0') < uint32(10)) 3393 }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6)) 3394 } 3395 3396 func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */ 3397 return Xisxdigit(tls, c) 3398 } 3399 3400 type uintptr_t = uint32 /* alltypes.h:78:24 */ 3401 3402 type intptr_t = int32 /* alltypes.h:93:15 */ 3403 3404 type int8_t = int8 /* alltypes.h:119:25 */ 3405 3406 type int16_t = int16 /* alltypes.h:124:25 */ 3407 3408 type int32_t = int32 /* alltypes.h:129:25 */ 3409 3410 type int64_t = int64 /* alltypes.h:134:25 */ 3411 3412 type intmax_t = int64 /* alltypes.h:139:25 */ 3413 3414 type uint8_t = uint8 /* alltypes.h:144:25 */ 3415 3416 type uint16_t = uint16 /* alltypes.h:149:25 */ 3417 3418 type uint32_t = uint32 /* alltypes.h:154:25 */ 3419 3420 type uint64_t = uint64 /* alltypes.h:159:25 */ 3421 3422 type uintmax_t = uint64 /* alltypes.h:169:25 */ 3423 3424 type int_fast8_t = int8_t /* stdint.h:22:16 */ 3425 type int_fast64_t = int64_t /* stdint.h:23:17 */ 3426 3427 type int_least8_t = int8_t /* stdint.h:25:17 */ 3428 type int_least16_t = int16_t /* stdint.h:26:17 */ 3429 type int_least32_t = int32_t /* stdint.h:27:17 */ 3430 type int_least64_t = int64_t /* stdint.h:28:17 */ 3431 3432 type uint_fast8_t = uint8_t /* stdint.h:30:17 */ 3433 type uint_fast64_t = uint64_t /* stdint.h:31:18 */ 3434 3435 type uint_least8_t = uint8_t /* stdint.h:33:18 */ 3436 type uint_least16_t = uint16_t /* stdint.h:34:18 */ 3437 type uint_least32_t = uint32_t /* stdint.h:35:18 */ 3438 type uint_least64_t = uint64_t /* stdint.h:36:18 */ 3439 3440 type int_fast16_t = int32_t /* stdint.h:1:17 */ 3441 type int_fast32_t = int32_t /* stdint.h:2:17 */ 3442 type uint_fast16_t = uint32_t /* stdint.h:3:18 */ 3443 type uint_fast32_t = uint32_t /* stdint.h:4:18 */ 3444 3445 type ssize_t = int32 /* alltypes.h:88:15 */ 3446 3447 type off_t = int64 /* alltypes.h:185:16 */ 3448 3449 type _IO_FILE = struct { 3450 Fflags uint32 3451 Frpos uintptr 3452 Frend uintptr 3453 Fclose uintptr 3454 Fwend uintptr 3455 Fwpos uintptr 3456 Fmustbezero_1 uintptr 3457 Fwbase uintptr 3458 Fread uintptr 3459 Fwrite uintptr 3460 Fseek uintptr 3461 Fbuf uintptr 3462 Fbuf_size size_t 3463 Fprev uintptr 3464 Fnext uintptr 3465 Ffd int32 3466 Fpipe_pid int32 3467 Flockcount int32 3468 Fmode int32 3469 Flock int32 3470 Flbf int32 3471 Fcookie uintptr 3472 Foff off_t 3473 Fgetln_buf uintptr 3474 Fmustbezero_2 uintptr 3475 Fshend uintptr 3476 Fshlim off_t 3477 Fshcnt off_t 3478 Fprev_locked uintptr 3479 Fnext_locked uintptr 3480 Flocale uintptr 3481 } /* alltypes.h:343:9 */ 3482 3483 type FILE = _IO_FILE /* alltypes.h:343:25 */ 3484 3485 type va_list = uintptr /* alltypes.h:349:27 */ 3486 3487 type _G_fpos64_t = struct { 3488 F__ccgo_pad1 [0]uint32 3489 F__opaque [16]int8 3490 } /* stdio.h:54:9 */ 3491 3492 type fpos_t = _G_fpos64_t /* stdio.h:58:3 */ 3493 3494 type float_t = float64 /* alltypes.h:38:21 */ 3495 3496 type double_t = float64 /* alltypes.h:43:21 */ 3497 3498 func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ 3499 bp := tls.Alloc(4) 3500 defer tls.Free(4) 3501 3502 // var __u struct {F__f float32;} at bp, 4 3503 3504 *(*float32)(unsafe.Pointer(bp)) = __f 3505 return *(*uint32)(unsafe.Pointer(bp)) 3506 } 3507 3508 func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ 3509 bp := tls.Alloc(8) 3510 defer tls.Free(8) 3511 3512 // var __u struct {F__f float64;} at bp, 8 3513 3514 *(*float64)(unsafe.Pointer(bp)) = __f 3515 return *(*uint64)(unsafe.Pointer(bp)) 3516 } 3517 3518 type syscall_arg_t = int32 /* syscall.h:22:14 */ 3519 3520 func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ 3521 var c int32 3522 var x int32 3523 var y int64 3524 var neg int32 = 0 3525 3526 c = func() int32 { 3527 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3528 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3529 } 3530 return X__shgetc(tls, f) 3531 }() 3532 if c == '+' || c == '-' { 3533 neg = Bool32(c == '-') 3534 c = func() int32 { 3535 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3536 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3537 } 3538 return X__shgetc(tls, f) 3539 }() 3540 if uint32(c-'0') >= 10 && pok != 0 { 3541 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 3542 (*FILE)(unsafe.Pointer(f)).Frpos-- 3543 } else { 3544 } 3545 } 3546 } 3547 if uint32(c-'0') >= 10 { 3548 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 3549 (*FILE)(unsafe.Pointer(f)).Frpos-- 3550 } else { 3551 } 3552 return -0x7fffffffffffffff - int64(1) 3553 } 3554 for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 { 3555 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3556 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3557 } 3558 return X__shgetc(tls, f) 3559 }() { 3560 x = 10*x + c - '0' 3561 } 3562 for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 { 3563 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3564 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3565 } 3566 return X__shgetc(tls, f) 3567 }() { 3568 y = int64(10)*y + int64(c) - int64('0') 3569 } 3570 for ; uint32(c-'0') < 10; c = func() int32 { 3571 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3572 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3573 } 3574 return X__shgetc(tls, f) 3575 }() { 3576 } 3577 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 3578 (*FILE)(unsafe.Pointer(f)).Frpos-- 3579 } else { 3580 } 3581 if neg != 0 { 3582 return -y 3583 } 3584 return y 3585 } 3586 3587 func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */ 3588 bp := tls.Alloc(512) 3589 defer tls.Free(512) 3590 3591 // var x [128]uint32_t at bp, 512 3592 3593 var i int32 3594 var j int32 3595 var k int32 3596 var a int32 3597 var z int32 3598 var lrp int64 = int64(0) 3599 var dc int64 = int64(0) 3600 var e10 int64 = int64(0) 3601 var lnz int32 = 0 3602 var gotdig int32 = 0 3603 var gotrad int32 = 0 3604 var rp int32 3605 var e2 int32 3606 var emax int32 = -emin - bits + 3 3607 var denormal int32 = 0 3608 var y float64 3609 var frac float64 = float64(0) 3610 var bias float64 = float64(0) 3611 3612 j = 0 3613 k = 0 3614 3615 // Don't let leading zeros consume buffer space 3616 for ; c == '0'; c = func() int32 { 3617 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3618 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3619 } 3620 return X__shgetc(tls, f) 3621 }() { 3622 gotdig = 1 3623 } 3624 if c == '.' { 3625 gotrad = 1 3626 for c = func() int32 { 3627 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3628 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3629 } 3630 return X__shgetc(tls, f) 3631 }(); c == '0'; c = func() int32 { 3632 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3633 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3634 } 3635 return X__shgetc(tls, f) 3636 }() { 3637 gotdig = 1 3638 lrp-- 3639 } 3640 } 3641 3642 *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0) 3643 for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 { 3644 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3645 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3646 } 3647 return X__shgetc(tls, f) 3648 }() { 3649 if c == '.' { 3650 if gotrad != 0 { 3651 break 3652 } 3653 gotrad = 1 3654 lrp = dc 3655 } else if k < 128-3 { 3656 dc++ 3657 if c != '0' { 3658 lnz = int32(dc) 3659 } 3660 if j != 0 { 3661 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))*uint32_t(10) + uint32_t(c) - uint32_t('0') 3662 } else { 3663 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0') 3664 } 3665 if PreIncInt32(&j, 1) == 9 { 3666 k++ 3667 j = 0 3668 } 3669 gotdig = 1 3670 } else { 3671 dc++ 3672 if c != '0' { 3673 lnz = (128 - 4) * 9 3674 *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1) 3675 } 3676 } 3677 } 3678 if !(gotrad != 0) { 3679 lrp = dc 3680 } 3681 3682 if gotdig != 0 && c|32 == 'e' { 3683 e10 = scanexp(tls, f, pok) 3684 if e10 == -0x7fffffffffffffff-int64(1) { 3685 if pok != 0 { 3686 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 3687 (*FILE)(unsafe.Pointer(f)).Frpos-- 3688 } else { 3689 } 3690 } else { 3691 X__shlim(tls, f, int64(0)) 3692 return float64(0) 3693 } 3694 e10 = int64(0) 3695 } 3696 lrp = lrp + e10 3697 } else if c >= 0 { 3698 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 3699 (*FILE)(unsafe.Pointer(f)).Frpos-- 3700 } else { 3701 } 3702 } 3703 if !(gotdig != 0) { 3704 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 3705 X__shlim(tls, f, int64(0)) 3706 return float64(0) 3707 } 3708 3709 // Handle zero specially to avoid nasty special cases later 3710 if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) { 3711 return float64(sign) * 0.0 3712 } 3713 3714 // Optimize small integers (w/no exponent) and over/under-flow 3715 if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) { 3716 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) 3717 } 3718 if lrp > int64(-emin/2) { 3719 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 3720 return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 3721 } 3722 if lrp < int64(emin-2*53) { 3723 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 3724 return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 3725 } 3726 3727 // Align incomplete final B1B digit 3728 if j != 0 { 3729 for ; j < 9; j++ { 3730 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10) 3731 } 3732 k++ 3733 j = 0 3734 } 3735 3736 a = 0 3737 z = k 3738 e2 = 0 3739 rp = int32(lrp) 3740 3741 // Optimize small to mid-size integers (even in exp. notation) 3742 if lnz < 9 && lnz <= rp && rp < 18 { 3743 if rp == 9 { 3744 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) 3745 } 3746 if rp < 9 { 3747 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp]) 3748 } 3749 var bitlim int32 = bits - 3*(rp-9) 3750 if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) { 3751 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10]) 3752 } 3753 } 3754 3755 // Drop trailing zeros 3756 for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- { 3757 } 3758 3759 // Align radix point to B1B digit boundary 3760 if rp%9 != 0 { 3761 var rpm9 int32 3762 if rp >= 0 { 3763 rpm9 = rp % 9 3764 } else { 3765 rpm9 = rp%9 + 9 3766 } 3767 var p10 int32 = _sp10s[8-rpm9] 3768 var carry uint32_t = uint32_t(0) 3769 for k = a; k != z; k++ { 3770 var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10) 3771 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry 3772 carry = uint32_t(1000000000/p10) * tmp 3773 if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 3774 a = (a + 1) & (128 - 1) 3775 rp = rp - 9 3776 } 3777 } 3778 if carry != 0 { 3779 *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry 3780 } 3781 rp = rp + (9 - rpm9) 3782 } 3783 3784 // Upscale until desired number of bits are left of radix point 3785 for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] { 3786 var carry uint32_t = uint32_t(0) 3787 e2 = e2 - 29 3788 for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) { 3789 var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry) 3790 if tmp > uint64(1000000000) { 3791 carry = uint32_t(tmp / uint64(1000000000)) 3792 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000)) 3793 } else { 3794 carry = uint32_t(0) 3795 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp) 3796 } 3797 if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 3798 z = k 3799 } 3800 if k == a { 3801 break 3802 } 3803 } 3804 if carry != 0 { 3805 rp = rp + 9 3806 a = (a - 1) & (128 - 1) 3807 if a == z { 3808 z = (z - 1) & (128 - 1) 3809 *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) 3810 } 3811 *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry 3812 } 3813 } 3814 3815 // Downscale until exactly number of bits are left of radix point 3816 for { 3817 var carry uint32_t = uint32_t(0) 3818 var sh int32 = 1 3819 for i = 0; i < 2; i++ { 3820 k = (a + i) & (128 - 1) 3821 if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] { 3822 i = 2 3823 break 3824 } 3825 if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] { 3826 break 3827 } 3828 } 3829 if i == 2 && rp == 9*2 { 3830 break 3831 } 3832 // FIXME: find a way to compute optimal sh 3833 if rp > 9+9*2 { 3834 sh = 9 3835 } 3836 e2 = e2 + sh 3837 for k = a; k != z; k = (k + 1) & (128 - 1) { 3838 var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1) 3839 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry 3840 carry = uint32_t(int32(1000000000)>>sh) * tmp 3841 if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 3842 a = (a + 1) & (128 - 1) 3843 i-- 3844 rp = rp - 9 3845 } 3846 } 3847 if carry != 0 { 3848 if (z+1)&(128-1) != a { 3849 *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry 3850 z = (z + 1) & (128 - 1) 3851 } else { 3852 *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1) 3853 } 3854 } 3855 } 3856 3857 // Assemble desired bits into floating point variable 3858 for y = float64(AssignInt32(&i, 0)); i < 2; i++ { 3859 if (a+i)&(128-1) == z { 3860 *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0) 3861 } 3862 y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))) 3863 } 3864 3865 y = y * float64(sign) 3866 3867 // Limit precision for denormal results 3868 if bits > 53+e2-emin { 3869 bits = 53 + e2 - emin 3870 if bits < 0 { 3871 bits = 0 3872 } 3873 denormal = 1 3874 } 3875 3876 // Calculate bias term to force rounding, move out lower bits 3877 if bits < 53 { 3878 bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y) 3879 frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits)) 3880 y = y - frac 3881 y = y + bias 3882 } 3883 3884 // Process tail of decimal input so it can affect rounding 3885 if (a+i)&(128-1) != z { 3886 var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) 3887 if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) { 3888 frac = frac + 0.25*float64(sign) 3889 } else if t > uint32_t(500000000) { 3890 frac = frac + 0.75*float64(sign) 3891 } else if t == uint32_t(500000000) { 3892 if (a+i+1)&(128-1) == z { 3893 frac = frac + 0.5*float64(sign) 3894 } else { 3895 frac = frac + 0.75*float64(sign) 3896 } 3897 } 3898 if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) { 3899 frac += 1 3900 } 3901 } 3902 3903 y = y + frac 3904 y = y - bias 3905 3906 if (e2+53)&0x7fffffff > emax-5 { 3907 if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 { 3908 if denormal != 0 && bits == 53+e2-emin { 3909 denormal = 0 3910 } 3911 y = y * 0.5 3912 e2++ 3913 } 3914 if e2+53 > emax || denormal != 0 && frac != 0 { 3915 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 3916 } 3917 } 3918 3919 return Xscalbnl(tls, y, e2) 3920 } 3921 3922 var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */ 3923 var _sp10s = [8]int32{10, 100, 1000, 10000, 3924 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */ 3925 3926 func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */ 3927 var x uint32_t = uint32_t(0) 3928 var y float64 = float64(0) 3929 var scale float64 = float64(1) 3930 var bias float64 = float64(0) 3931 var gottail int32 = 0 3932 var gotrad int32 = 0 3933 var gotdig int32 = 0 3934 var rp int64 = int64(0) 3935 var dc int64 = int64(0) 3936 var e2 int64 = int64(0) 3937 var d int32 3938 var c int32 3939 3940 c = func() int32 { 3941 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3942 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3943 } 3944 return X__shgetc(tls, f) 3945 }() 3946 3947 // Skip leading zeros 3948 for ; c == '0'; c = func() int32 { 3949 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3950 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3951 } 3952 return X__shgetc(tls, f) 3953 }() { 3954 gotdig = 1 3955 } 3956 3957 if c == '.' { 3958 gotrad = 1 3959 c = func() int32 { 3960 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3961 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3962 } 3963 return X__shgetc(tls, f) 3964 }() 3965 // Count zeros after the radix point before significand 3966 rp = int64(0) 3967 __1: 3968 if !(c == '0') { 3969 goto __3 3970 } 3971 gotdig = 1 3972 goto __2 3973 __2: 3974 c = func() int32 { 3975 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3976 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3977 } 3978 return X__shgetc(tls, f) 3979 }() 3980 rp-- 3981 goto __1 3982 goto __3 3983 __3: 3984 } 3985 3986 for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 { 3987 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 3988 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 3989 } 3990 return X__shgetc(tls, f) 3991 }() { 3992 if c == '.' { 3993 if gotrad != 0 { 3994 break 3995 } 3996 rp = dc 3997 gotrad = 1 3998 } else { 3999 gotdig = 1 4000 if c > '9' { 4001 d = c | 32 + 10 - 'a' 4002 } else { 4003 d = c - '0' 4004 } 4005 if dc < int64(8) { 4006 x = x*uint32_t(16) + uint32_t(d) 4007 } else if dc < int64(53/4+1) { 4008 y = y + float64(d)*AssignDivFloat64(&scale, float64(16)) 4009 } else if d != 0 && !(gottail != 0) { 4010 y = y + 0.5*scale 4011 gottail = 1 4012 } 4013 dc++ 4014 } 4015 } 4016 if !(gotdig != 0) { 4017 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4018 (*FILE)(unsafe.Pointer(f)).Frpos-- 4019 } else { 4020 } 4021 if pok != 0 { 4022 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4023 (*FILE)(unsafe.Pointer(f)).Frpos-- 4024 } else { 4025 } 4026 if gotrad != 0 { 4027 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4028 (*FILE)(unsafe.Pointer(f)).Frpos-- 4029 } else { 4030 } 4031 } 4032 } else { 4033 X__shlim(tls, f, int64(0)) 4034 } 4035 return float64(sign) * 0.0 4036 } 4037 if !(gotrad != 0) { 4038 rp = dc 4039 } 4040 for dc < int64(8) { 4041 x = x * uint32_t(16) 4042 dc++ 4043 } 4044 if c|32 == 'p' { 4045 e2 = scanexp(tls, f, pok) 4046 if e2 == -0x7fffffffffffffff-int64(1) { 4047 if pok != 0 { 4048 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4049 (*FILE)(unsafe.Pointer(f)).Frpos-- 4050 } else { 4051 } 4052 } else { 4053 X__shlim(tls, f, int64(0)) 4054 return float64(0) 4055 } 4056 e2 = int64(0) 4057 } 4058 } else { 4059 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4060 (*FILE)(unsafe.Pointer(f)).Frpos-- 4061 } else { 4062 } 4063 } 4064 e2 = e2 + (int64(4)*rp - int64(32)) 4065 4066 if !(x != 0) { 4067 return float64(sign) * 0.0 4068 } 4069 if e2 > int64(-emin) { 4070 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 4071 return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 4072 } 4073 if e2 < int64(emin-2*53) { 4074 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 4075 return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 4076 } 4077 4078 for x < 0x80000000 { 4079 if y >= 0.5 { 4080 x = x + (x + uint32_t(1)) 4081 y = y + (y - float64(1)) 4082 } else { 4083 x = x + x 4084 y = y + y 4085 } 4086 e2-- 4087 } 4088 4089 if int64(bits) > int64(32)+e2-int64(emin) { 4090 bits = int32(int64(32) + e2 - int64(emin)) 4091 if bits < 0 { 4092 bits = 0 4093 } 4094 } 4095 4096 if bits < 53 { 4097 bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign)) 4098 } 4099 4100 if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) { 4101 x++ 4102 y = float64(0) 4103 } 4104 4105 y = bias + float64(sign)*float64(x) + float64(sign)*y 4106 y = y - bias 4107 4108 if !(y != 0) { 4109 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 4110 } 4111 4112 return Xscalbnl(tls, y, int32(e2)) 4113 } 4114 4115 func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */ 4116 var sign int32 = 1 4117 var i size_t 4118 var bits int32 4119 var emin int32 4120 var c int32 4121 4122 switch prec { 4123 case 0: 4124 bits = 24 4125 emin = -125 - bits 4126 break 4127 case 1: 4128 bits = 53 4129 emin = -1021 - bits 4130 break 4131 case 2: 4132 bits = 53 4133 emin = -1021 - bits 4134 break 4135 default: 4136 return float64(0) 4137 } 4138 4139 for __isspace(tls, AssignInt32(&c, func() int32 { 4140 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4141 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4142 } 4143 return X__shgetc(tls, f) 4144 }())) != 0 { 4145 } 4146 4147 if c == '+' || c == '-' { 4148 sign = sign - 2*Bool32(c == '-') 4149 c = func() int32 { 4150 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4151 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4152 } 4153 return X__shgetc(tls, f) 4154 }() 4155 } 4156 4157 for i = size_t(0); i < size_t(8) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 41 /* "infinity" */ + uintptr(i)))); i++ { 4158 if i < size_t(7) { 4159 c = func() int32 { 4160 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4161 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4162 } 4163 return X__shgetc(tls, f) 4164 }() 4165 } 4166 } 4167 if i == size_t(3) || i == size_t(8) || i > size_t(3) && pok != 0 { 4168 if i != size_t(8) { 4169 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4170 (*FILE)(unsafe.Pointer(f)).Frpos-- 4171 } else { 4172 } 4173 if pok != 0 { 4174 for ; i > size_t(3); i-- { 4175 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4176 (*FILE)(unsafe.Pointer(f)).Frpos-- 4177 } else { 4178 } 4179 } 4180 } 4181 } 4182 return float64(float32(sign) * X__builtin_inff(tls)) 4183 } 4184 if !(i != 0) { 4185 for i = size_t(0); i < size_t(3) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 50 /* "nan" */ + uintptr(i)))); i++ { 4186 if i < size_t(2) { 4187 c = func() int32 { 4188 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4189 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4190 } 4191 return X__shgetc(tls, f) 4192 }() 4193 } 4194 } 4195 } 4196 if i == size_t(3) { 4197 if func() int32 { 4198 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4199 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4200 } 4201 return X__shgetc(tls, f) 4202 }() != '(' { 4203 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4204 (*FILE)(unsafe.Pointer(f)).Frpos-- 4205 } else { 4206 } 4207 return float64(X__builtin_nanf(tls, ts+54)) 4208 } 4209 for i = size_t(1); ; i++ { 4210 c = func() int32 { 4211 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4212 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4213 } 4214 return X__shgetc(tls, f) 4215 }() 4216 if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' { 4217 continue 4218 } 4219 if c == ')' { 4220 return float64(X__builtin_nanf(tls, ts+54)) 4221 } 4222 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4223 (*FILE)(unsafe.Pointer(f)).Frpos-- 4224 } else { 4225 } 4226 if !(pok != 0) { 4227 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 4228 X__shlim(tls, f, int64(0)) 4229 return float64(0) 4230 } 4231 for PostDecUint32(&i, 1) != 0 { 4232 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4233 (*FILE)(unsafe.Pointer(f)).Frpos-- 4234 } else { 4235 } 4236 } 4237 return float64(X__builtin_nanf(tls, ts+54)) 4238 } 4239 return float64(X__builtin_nanf(tls, ts+54)) 4240 } 4241 4242 if i != 0 { 4243 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4244 (*FILE)(unsafe.Pointer(f)).Frpos-- 4245 } else { 4246 } 4247 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 4248 X__shlim(tls, f, int64(0)) 4249 return float64(0) 4250 } 4251 4252 if c == '0' { 4253 c = func() int32 { 4254 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4255 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4256 } 4257 return X__shgetc(tls, f) 4258 }() 4259 if c|32 == 'x' { 4260 return hexfloat(tls, f, bits, emin, sign, pok) 4261 } 4262 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4263 (*FILE)(unsafe.Pointer(f)).Frpos-- 4264 } else { 4265 } 4266 c = '0' 4267 } 4268 4269 return decfloat(tls, f, c, bits, emin, sign, pok) 4270 } 4271 4272 // Lookup table for digit values. -1==255>=36 -> invalid 4273 var table = [257]uint8{Uint8FromInt32(-1), 4274 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4275 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4276 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4277 uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4278 Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), 4279 uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4280 Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), 4281 uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4282 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4283 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4284 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4285 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4286 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4287 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4288 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4289 Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), 4290 } /* intscan.c:7:28 */ 4291 4292 func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */ 4293 var val uintptr 4294 var c int32 4295 var neg int32 4296 var x uint32 4297 var y uint64 4298 var bs int32 4299 val = uintptr(unsafe.Pointer(&table)) + uintptr(1) 4300 neg = 0 4301 if !(base > uint32(36) || base == uint32(1)) { 4302 goto __1 4303 } 4304 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 4305 return uint64(0) 4306 __1: 4307 ; 4308 __2: 4309 if !(__isspace(tls, AssignInt32(&c, func() int32 { 4310 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4311 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4312 } 4313 return X__shgetc(tls, f) 4314 }())) != 0) { 4315 goto __3 4316 } 4317 goto __2 4318 __3: 4319 ; 4320 if !(c == '+' || c == '-') { 4321 goto __4 4322 } 4323 neg = -Bool32(c == '-') 4324 c = func() int32 { 4325 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4326 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4327 } 4328 return X__shgetc(tls, f) 4329 }() 4330 __4: 4331 ; 4332 if !((base == uint32(0) || base == uint32(16)) && c == '0') { 4333 goto __5 4334 } 4335 c = func() int32 { 4336 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4337 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4338 } 4339 return X__shgetc(tls, f) 4340 }() 4341 if !(c|32 == 'x') { 4342 goto __7 4343 } 4344 c = func() int32 { 4345 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4346 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4347 } 4348 return X__shgetc(tls, f) 4349 }() 4350 if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) { 4351 goto __9 4352 } 4353 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4354 (*FILE)(unsafe.Pointer(f)).Frpos-- 4355 } else { 4356 } 4357 if !(pok != 0) { 4358 goto __10 4359 } 4360 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4361 (*FILE)(unsafe.Pointer(f)).Frpos-- 4362 } else { 4363 } 4364 goto __11 4365 __10: 4366 X__shlim(tls, f, int64(0)) 4367 __11: 4368 ; 4369 return uint64(0) 4370 __9: 4371 ; 4372 base = uint32(16) 4373 goto __8 4374 __7: 4375 if !(base == uint32(0)) { 4376 goto __12 4377 } 4378 base = uint32(8) 4379 __12: 4380 ; 4381 __8: 4382 ; 4383 goto __6 4384 __5: 4385 if !(base == uint32(0)) { 4386 goto __13 4387 } 4388 base = uint32(10) 4389 __13: 4390 ; 4391 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) { 4392 goto __14 4393 } 4394 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4395 (*FILE)(unsafe.Pointer(f)).Frpos-- 4396 } else { 4397 } 4398 X__shlim(tls, f, int64(0)) 4399 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 4400 return uint64(0) 4401 __14: 4402 ; 4403 __6: 4404 ; 4405 if !(base == uint32(10)) { 4406 goto __15 4407 } 4408 x = uint32(0) 4409 __17: 4410 if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) { 4411 goto __19 4412 } 4413 x = x*uint32(10) + uint32(c-'0') 4414 goto __18 4415 __18: 4416 c = func() int32 { 4417 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4418 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4419 } 4420 return X__shgetc(tls, f) 4421 }() 4422 goto __17 4423 goto __19 4424 __19: 4425 ; 4426 y = uint64(x) 4427 __20: 4428 if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) { 4429 goto __22 4430 } 4431 y = y*uint64(10) + uint64(c-'0') 4432 goto __21 4433 __21: 4434 c = func() int32 { 4435 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4436 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4437 } 4438 return X__shgetc(tls, f) 4439 }() 4440 goto __20 4441 goto __22 4442 __22: 4443 ; 4444 if !(uint32(c-'0') >= 10) { 4445 goto __23 4446 } 4447 goto done 4448 __23: 4449 ; 4450 goto __16 4451 __15: 4452 if !!(base&(base-uint32(1)) != 0) { 4453 goto __24 4454 } 4455 bs = int32(*(*int8)(unsafe.Pointer(ts + 55 + uintptr(uint32(0x17)*base>>5&uint32(7))))) 4456 x = uint32(0) 4457 __26: 4458 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) { 4459 goto __28 4460 } 4461 x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 4462 goto __27 4463 __27: 4464 c = func() int32 { 4465 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4466 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4467 } 4468 return X__shgetc(tls, f) 4469 }() 4470 goto __26 4471 goto __28 4472 __28: 4473 ; 4474 y = uint64(x) 4475 __29: 4476 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) { 4477 goto __31 4478 } 4479 y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 4480 goto __30 4481 __30: 4482 c = func() int32 { 4483 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4484 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4485 } 4486 return X__shgetc(tls, f) 4487 }() 4488 goto __29 4489 goto __31 4490 __31: 4491 ; 4492 goto __25 4493 __24: 4494 x = uint32(0) 4495 __32: 4496 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) { 4497 goto __34 4498 } 4499 x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 4500 goto __33 4501 __33: 4502 c = func() int32 { 4503 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4504 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4505 } 4506 return X__shgetc(tls, f) 4507 }() 4508 goto __32 4509 goto __34 4510 __34: 4511 ; 4512 y = uint64(x) 4513 __35: 4514 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(base) && uint64(base)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) { 4515 goto __37 4516 } 4517 y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 4518 goto __36 4519 __36: 4520 c = func() int32 { 4521 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4522 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4523 } 4524 return X__shgetc(tls, f) 4525 }() 4526 goto __35 4527 goto __37 4528 __37: 4529 ; 4530 __25: 4531 ; 4532 __16: 4533 ; 4534 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { 4535 goto __38 4536 } 4537 __39: 4538 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { 4539 goto __41 4540 } 4541 goto __40 4542 __40: 4543 c = func() int32 { 4544 if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend { 4545 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1)))) 4546 } 4547 return X__shgetc(tls, f) 4548 }() 4549 goto __39 4550 goto __41 4551 __41: 4552 ; 4553 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 4554 y = lim 4555 if !(lim&uint64(1) != 0) { 4556 goto __42 4557 } 4558 neg = 0 4559 __42: 4560 ; 4561 __38: 4562 ; 4563 done: 4564 if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) { 4565 (*FILE)(unsafe.Pointer(f)).Frpos-- 4566 } else { 4567 } 4568 if !(y >= lim) { 4569 goto __43 4570 } 4571 if !(!(lim&uint64(1) != 0) && !(neg != 0)) { 4572 goto __44 4573 } 4574 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 4575 return lim - uint64(1) 4576 goto __45 4577 __44: 4578 if !(y > lim) { 4579 goto __46 4580 } 4581 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 4582 return lim 4583 __46: 4584 ; 4585 __45: 4586 ; 4587 __43: 4588 ; 4589 return y ^ uint64(neg) - uint64(neg) 4590 } 4591 4592 // The shcnt field stores the number of bytes read so far, offset by 4593 // the value of buf-rpos at the last function call (__shlim or __shgetc), 4594 // so that between calls the inline shcnt macro can add rpos-buf to get 4595 // the actual count. 4596 4597 func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */ 4598 (*FILE)(unsafe.Pointer(f)).Fshlim = lim 4599 (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf) - int32((*FILE)(unsafe.Pointer(f)).Frpos)) / 1) 4600 // If lim is nonzero, rend must be a valid pointer. 4601 if lim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).Frend)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) > lim { 4602 (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr(lim) 4603 } else { 4604 (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend 4605 } 4606 } 4607 4608 func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */ 4609 var c int32 4610 var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).Frpos)-int32((*FILE)(unsafe.Pointer(f)).Fbuf))/1) 4611 if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 { 4612 (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) + cnt 4613 (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos 4614 (*FILE)(unsafe.Pointer(f)).Fshlim = int64(-1) 4615 return -1 4616 } 4617 cnt++ 4618 if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && off_t((int32((*FILE)(unsafe.Pointer(f)).Frend)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) > (*FILE)(unsafe.Pointer(f)).Fshlim-cnt { 4619 (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr((*FILE)(unsafe.Pointer(f)).Fshlim-cnt) 4620 } else { 4621 (*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend 4622 } 4623 (*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf)-int32((*FILE)(unsafe.Pointer(f)).Frpos))/1) + cnt 4624 if (*FILE)(unsafe.Pointer(f)).Frpos <= (*FILE)(unsafe.Pointer(f)).Fbuf { 4625 *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).Frpos + UintptrFromInt32(-1))) = uint8(c) 4626 } 4627 return c 4628 } 4629 4630 func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ 4631 return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24 4632 } 4633 4634 func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */ 4635 return Xcopysign(tls, x, y) 4636 } 4637 4638 func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */ 4639 return Xfabs(tls, x) 4640 } 4641 4642 func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */ 4643 return Xfmod(tls, x, y) 4644 } 4645 4646 var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */ 4647 4648 func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ 4649 bp := tls.Alloc(8) 4650 defer tls.Free(8) 4651 4652 *(*struct{ Ff float64 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float64 }) { 4653 *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 4654 return r 4655 }() 4656 var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) 4657 var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63) 4658 var y double_t 4659 4660 if e >= 0x3ff+52 { 4661 return x 4662 } 4663 if s != 0 { 4664 y = x - toint + toint 4665 } else { 4666 y = x + toint - toint 4667 } 4668 if y == float64(0) { 4669 if s != 0 { 4670 return -Float64FromFloat64(0.0) 4671 } 4672 return float64(0) 4673 } 4674 return y 4675 } 4676 4677 func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ 4678 bp := tls.Alloc(8) 4679 defer tls.Free(8) 4680 4681 // var u struct {Ff float64;} at bp, 8 4682 4683 var y double_t = x 4684 4685 if n > 1023 { 4686 y = y * 0x1p1023 4687 n = n - 1023 4688 if n > 1023 { 4689 y = y * 0x1p1023 4690 n = n - 1023 4691 if n > 1023 { 4692 n = 1023 4693 } 4694 } 4695 } else if n < -1022 { 4696 // make sure final n < -53 to avoid double 4697 // rounding in the subnormal range 4698 y = y * (float64(0x1p-1022) * 0x1p53) 4699 n = n + (1022 - 53) 4700 if n < -1022 { 4701 y = y * (float64(0x1p-1022) * 0x1p53) 4702 n = n + (1022 - 53) 4703 if n < -1022 { 4704 n = -1022 4705 } 4706 } 4707 } 4708 *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52 4709 x = y * *(*float64)(unsafe.Pointer(bp)) 4710 return x 4711 } 4712 4713 func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ 4714 return Xscalbn(tls, x, n) 4715 } 4716 4717 type div_t = struct { 4718 Fquot int32 4719 Frem int32 4720 } /* stdlib.h:62:35 */ 4721 type ldiv_t = struct { 4722 Fquot int32 4723 Frem int32 4724 } /* stdlib.h:63:36 */ 4725 type lldiv_t = struct { 4726 Fquot int64 4727 Frem int64 4728 } /* stdlib.h:64:41 */ 4729 4730 type max_align_t = struct { 4731 F__ll int64 4732 F__ld float64 4733 } /* alltypes.h:51:66 */ 4734 4735 type imaxdiv_t = struct { 4736 Fquot intmax_t 4737 Frem intmax_t 4738 } /* inttypes.h:14:40 */ 4739 4740 type pid_t = int32 /* alltypes.h:258:13 */ 4741 4742 type uid_t = uint32 /* alltypes.h:268:18 */ 4743 4744 type gid_t = uint32 /* alltypes.h:273:18 */ 4745 4746 type iovec = struct { 4747 Fiov_base uintptr 4748 Fiov_len size_t 4749 } /* alltypes.h:378:1 */ 4750 4751 type socklen_t = uint32 /* alltypes.h:384:18 */ 4752 4753 type sa_family_t = uint16 /* alltypes.h:389:24 */ 4754 4755 type msghdr = struct { 4756 Fmsg_name uintptr 4757 Fmsg_namelen socklen_t 4758 Fmsg_iov uintptr 4759 Fmsg_iovlen int32 4760 Fmsg_control uintptr 4761 Fmsg_controllen socklen_t 4762 Fmsg_flags int32 4763 } /* socket.h:22:1 */ 4764 4765 type cmsghdr = struct { 4766 Fcmsg_len socklen_t 4767 Fcmsg_level int32 4768 Fcmsg_type int32 4769 } /* socket.h:44:1 */ 4770 4771 type linger = struct { 4772 Fl_onoff int32 4773 Fl_linger int32 4774 } /* socket.h:74:1 */ 4775 4776 type sockaddr = struct { 4777 Fsa_family sa_family_t 4778 Fsa_data [14]int8 4779 } /* socket.h:367:1 */ 4780 4781 type sockaddr_storage = struct { 4782 Fss_family sa_family_t 4783 F__ss_padding [122]int8 4784 F__ss_align uint32 4785 } /* socket.h:372:1 */ 4786 4787 type in_port_t = uint16_t /* in.h:12:18 */ 4788 type in_addr_t = uint32_t /* in.h:13:18 */ 4789 type in_addr = struct{ Fs_addr in_addr_t } /* in.h:14:1 */ 4790 4791 type sockaddr_in = struct { 4792 Fsin_family sa_family_t 4793 Fsin_port in_port_t 4794 Fsin_addr struct{ Fs_addr in_addr_t } 4795 Fsin_zero [8]uint8_t 4796 } /* in.h:16:1 */ 4797 4798 type in6_addr = struct { 4799 F__in6_union struct { 4800 F__ccgo_pad1 [0]uint32 4801 F__s6_addr [16]uint8_t 4802 } 4803 } /* in.h:23:1 */ 4804 4805 type sockaddr_in6 = struct { 4806 Fsin6_family sa_family_t 4807 Fsin6_port in_port_t 4808 Fsin6_flowinfo uint32_t 4809 Fsin6_addr struct { 4810 F__in6_union struct { 4811 F__ccgo_pad1 [0]uint32 4812 F__s6_addr [16]uint8_t 4813 } 4814 } 4815 Fsin6_scope_id uint32_t 4816 } /* in.h:34:1 */ 4817 4818 type ipv6_mreq = struct { 4819 Fipv6mr_multiaddr struct { 4820 F__in6_union struct { 4821 F__ccgo_pad1 [0]uint32 4822 F__s6_addr [16]uint8_t 4823 } 4824 } 4825 Fipv6mr_interface uint32 4826 } /* in.h:42:1 */ 4827 4828 type ip_opts = struct { 4829 Fip_dst struct{ Fs_addr in_addr_t } 4830 Fip_opts [40]int8 4831 } /* in.h:229:1 */ 4832 4833 type ip_mreq = struct { 4834 Fimr_multiaddr struct{ Fs_addr in_addr_t } 4835 Fimr_interface struct{ Fs_addr in_addr_t } 4836 } /* in.h:247:1 */ 4837 4838 type ip_mreqn = struct { 4839 Fimr_multiaddr struct{ Fs_addr in_addr_t } 4840 Fimr_address struct{ Fs_addr in_addr_t } 4841 Fimr_ifindex int32 4842 } /* in.h:252:1 */ 4843 4844 type ip_mreq_source = struct { 4845 Fimr_multiaddr struct{ Fs_addr in_addr_t } 4846 Fimr_interface struct{ Fs_addr in_addr_t } 4847 Fimr_sourceaddr struct{ Fs_addr in_addr_t } 4848 } /* in.h:258:1 */ 4849 4850 type ip_msfilter = struct { 4851 Fimsf_multiaddr struct{ Fs_addr in_addr_t } 4852 Fimsf_interface struct{ Fs_addr in_addr_t } 4853 Fimsf_fmode uint32_t 4854 Fimsf_numsrc uint32_t 4855 Fimsf_slist [1]struct{ Fs_addr in_addr_t } 4856 } /* in.h:264:1 */ 4857 4858 type group_req = struct { 4859 Fgr_interface uint32_t 4860 Fgr_group struct { 4861 Fss_family sa_family_t 4862 F__ss_padding [122]int8 4863 F__ss_align uint32 4864 } 4865 } /* in.h:275:1 */ 4866 4867 type group_source_req = struct { 4868 Fgsr_interface uint32_t 4869 Fgsr_group struct { 4870 Fss_family sa_family_t 4871 F__ss_padding [122]int8 4872 F__ss_align uint32 4873 } 4874 Fgsr_source struct { 4875 Fss_family sa_family_t 4876 F__ss_padding [122]int8 4877 F__ss_align uint32 4878 } 4879 } /* in.h:280:1 */ 4880 4881 type group_filter = struct { 4882 Fgf_interface uint32_t 4883 Fgf_group struct { 4884 Fss_family sa_family_t 4885 F__ss_padding [122]int8 4886 F__ss_align uint32 4887 } 4888 Fgf_fmode uint32_t 4889 Fgf_numsrc uint32_t 4890 Fgf_slist [1]struct { 4891 Fss_family sa_family_t 4892 F__ss_padding [122]int8 4893 F__ss_align uint32 4894 } 4895 } /* in.h:286:1 */ 4896 4897 type in_pktinfo = struct { 4898 Fipi_ifindex int32 4899 Fipi_spec_dst struct{ Fs_addr in_addr_t } 4900 Fipi_addr struct{ Fs_addr in_addr_t } 4901 } /* in.h:297:1 */ 4902 4903 type in6_pktinfo = struct { 4904 Fipi6_addr struct { 4905 F__in6_union struct { 4906 F__ccgo_pad1 [0]uint32 4907 F__s6_addr [16]uint8_t 4908 } 4909 } 4910 Fipi6_ifindex uint32 4911 } /* in.h:303:1 */ 4912 4913 type ip6_mtuinfo = struct { 4914 Fip6m_addr struct { 4915 Fsin6_family sa_family_t 4916 Fsin6_port in_port_t 4917 Fsin6_flowinfo uint32_t 4918 Fsin6_addr struct { 4919 F__in6_union struct { 4920 F__ccgo_pad1 [0]uint32 4921 F__s6_addr [16]uint8_t 4922 } 4923 } 4924 Fsin6_scope_id uint32_t 4925 } 4926 Fip6m_mtu uint32_t 4927 } /* in.h:308:1 */ 4928 4929 type addrinfo = struct { 4930 Fai_flags int32 4931 Fai_family int32 4932 Fai_socktype int32 4933 Fai_protocol int32 4934 Fai_addrlen socklen_t 4935 Fai_addr uintptr 4936 Fai_canonname uintptr 4937 Fai_next uintptr 4938 } /* netdb.h:16:1 */ 4939 4940 // Legacy functions follow (marked OBsolete in SUS) 4941 4942 type netent = struct { 4943 Fn_name uintptr 4944 Fn_aliases uintptr 4945 Fn_addrtype int32 4946 Fn_net uint32_t 4947 } /* netdb.h:62:1 */ 4948 4949 type hostent = struct { 4950 Fh_name uintptr 4951 Fh_aliases uintptr 4952 Fh_addrtype int32 4953 Fh_length int32 4954 Fh_addr_list uintptr 4955 } /* netdb.h:69:1 */ 4956 4957 type servent = struct { 4958 Fs_name uintptr 4959 Fs_aliases uintptr 4960 Fs_port int32 4961 Fs_proto uintptr 4962 } /* netdb.h:78:1 */ 4963 4964 type protoent = struct { 4965 Fp_name uintptr 4966 Fp_aliases uintptr 4967 Fp_proto int32 4968 } /* netdb.h:85:1 */ 4969 4970 type aibuf = struct { 4971 Fai struct { 4972 Fai_flags int32 4973 Fai_family int32 4974 Fai_socktype int32 4975 Fai_protocol int32 4976 Fai_addrlen socklen_t 4977 Fai_addr uintptr 4978 Fai_canonname uintptr 4979 Fai_next uintptr 4980 } 4981 Fsa struct { 4982 Fsin struct { 4983 Fsin_family sa_family_t 4984 Fsin_port in_port_t 4985 Fsin_addr struct{ Fs_addr in_addr_t } 4986 Fsin_zero [8]uint8_t 4987 } 4988 F__ccgo_pad1 [12]byte 4989 } 4990 Flock [1]int32 4991 Fslot int16 4992 Fref int16 4993 } /* lookup.h:10:1 */ 4994 4995 type sa = struct { 4996 Fsin struct { 4997 Fsin_family sa_family_t 4998 Fsin_port in_port_t 4999 Fsin_addr struct{ Fs_addr in_addr_t } 5000 Fsin_zero [8]uint8_t 5001 } 5002 F__ccgo_pad1 [12]byte 5003 } /* lookup.h:10:1 */ 5004 5005 type address = struct { 5006 Ffamily int32 5007 Fscopeid uint32 5008 Faddr [16]uint8_t 5009 Fsortkey int32 5010 } /* lookup.h:20:1 */ 5011 5012 type service = struct { 5013 Fport uint16_t 5014 Fproto uint8 5015 Fsocktype uint8 5016 } /* lookup.h:27:1 */ 5017 5018 type resolvconf = struct { 5019 Fns [3]struct { 5020 Ffamily int32 5021 Fscopeid uint32 5022 Faddr [16]uint8_t 5023 Fsortkey int32 5024 } 5025 Fnns uint32 5026 Fattempts uint32 5027 Fndots uint32 5028 Ftimeout uint32 5029 } /* lookup.h:34:1 */ 5030 5031 func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ 5032 var cnt size_t 5033 cnt = size_t(1) 5034 __1: 5035 if !((*addrinfo)(unsafe.Pointer(p)).Fai_next != 0) { 5036 goto __3 5037 } 5038 goto __2 5039 __2: 5040 cnt++ 5041 p = (*addrinfo)(unsafe.Pointer(p)).Fai_next 5042 goto __1 5043 goto __3 5044 __3: 5045 ; 5046 var b uintptr = p - uintptr(uint32(uintptr(0))) 5047 b -= 68 * uintptr((*aibuf)(unsafe.Pointer(b)).Fslot) 5048 //TODO LOCK(b->lock); 5049 if !(int32(AssignSubPtrInt16(b+66, int16(cnt))) != 0) { 5050 Xfree(tls, b) 5051 } 5052 //TODO else UNLOCK(b->lock); 5053 } 5054 5055 type time_t = int64 /* alltypes.h:108:16 */ 5056 5057 type clockid_t = int32 /* alltypes.h:237:13 */ 5058 5059 type timespec = struct { 5060 Ftv_sec time_t 5061 Ftv_nsec int32 5062 __12 uint32 /* int : 32 */ 5063 } /* alltypes.h:252:1 */ 5064 5065 type pthread_t = uintptr /* alltypes.h:296:26 */ 5066 5067 type pthread_once_t = int32 /* alltypes.h:302:13 */ 5068 5069 type pthread_key_t = uint32 /* alltypes.h:307:18 */ 5070 5071 type pthread_spinlock_t = int32 /* alltypes.h:312:13 */ 5072 5073 type pthread_mutexattr_t = struct{ F__attr uint32 } /* alltypes.h:317:37 */ 5074 5075 type pthread_condattr_t = struct{ F__attr uint32 } /* alltypes.h:322:37 */ 5076 5077 type pthread_barrierattr_t = struct{ F__attr uint32 } /* alltypes.h:327:37 */ 5078 5079 type pthread_rwlockattr_t = struct{ F__attr [2]uint32 } /* alltypes.h:332:40 */ 5080 5081 type __sigset_t = struct{ F__bits [32]uint32 } /* alltypes.h:372:9 */ 5082 5083 type sigset_t = __sigset_t /* alltypes.h:372:71 */ 5084 5085 type pthread_attr_t = struct{ F__u struct{ F__i [9]int32 } } /* alltypes.h:395:147 */ 5086 5087 type pthread_mutex_t = struct{ F__u struct{ F__i [6]int32 } } /* alltypes.h:400:157 */ 5088 5089 type pthread_cond_t = struct{ F__u struct{ F__i [12]int32 } } /* alltypes.h:410:112 */ 5090 5091 type pthread_rwlock_t = struct{ F__u struct{ F__i [8]int32 } } /* alltypes.h:420:139 */ 5092 5093 type pthread_barrier_t = struct{ F__u struct{ F__i [5]int32 } } /* alltypes.h:425:137 */ 5094 5095 type sched_param = struct { 5096 Fsched_priority int32 5097 F__reserved1 int32 5098 F__reserved2 [4]int32 5099 F__reserved3 int32 5100 } /* sched.h:19:1 */ 5101 5102 type timer_t = uintptr /* alltypes.h:232:14 */ 5103 5104 type clock_t = int32 /* alltypes.h:242:14 */ 5105 5106 type tm = struct { 5107 Ftm_sec int32 5108 Ftm_min int32 5109 Ftm_hour int32 5110 Ftm_mday int32 5111 Ftm_mon int32 5112 Ftm_year int32 5113 Ftm_wday int32 5114 Ftm_yday int32 5115 Ftm_isdst int32 5116 Ftm_gmtoff int32 5117 Ftm_zone uintptr 5118 } /* time.h:38:1 */ 5119 5120 type itimerspec = struct { 5121 Fit_interval struct { 5122 Ftv_sec time_t 5123 Ftv_nsec int32 5124 __12 uint32 /* int : 32 */ 5125 } 5126 Fit_value struct { 5127 Ftv_sec time_t 5128 Ftv_nsec int32 5129 __12 uint32 /* int : 32 */ 5130 } 5131 } /* time.h:80:1 */ 5132 5133 type __ptcb = struct { 5134 F__f uintptr 5135 F__x uintptr 5136 F__next uintptr 5137 } /* pthread.h:206:1 */ 5138 5139 type useconds_t = uint32 /* alltypes.h:283:18 */ 5140 5141 func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ 5142 bp := tls.Alloc(1608) 5143 defer tls.Free(1608) 5144 5145 // var ports [2]service at bp, 8 5146 5147 // var addrs [48]address at bp+8, 1344 5148 5149 // var canon [256]int8 at bp+1352, 256 5150 5151 var outcanon uintptr 5152 var nservs int32 5153 var naddrs int32 5154 var nais int32 5155 var canon_len int32 5156 var i int32 5157 var j int32 5158 var k int32 5159 var family int32 = 0 5160 var flags int32 = 0 5161 var proto int32 = 0 5162 var socktype int32 = 0 5163 var out uintptr 5164 5165 if !(host != 0) && !(serv != 0) { 5166 return -2 5167 } 5168 5169 if hint != 0 { 5170 family = (*addrinfo)(unsafe.Pointer(hint)).Fai_family 5171 flags = (*addrinfo)(unsafe.Pointer(hint)).Fai_flags 5172 proto = (*addrinfo)(unsafe.Pointer(hint)).Fai_protocol 5173 socktype = (*addrinfo)(unsafe.Pointer(hint)).Fai_socktype 5174 5175 var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400 5176 if flags&mask != flags { 5177 return -1 5178 } 5179 5180 switch family { 5181 case 2: 5182 fallthrough 5183 case 10: 5184 fallthrough 5185 case 0: 5186 break 5187 fallthrough 5188 default: 5189 return -6 5190 } 5191 } 5192 5193 if flags&0x20 != 0 { 5194 Xabort(tls) //TODO- 5195 // /* Define the "an address is configured" condition for address 5196 // * families via ability to create a socket for the family plus 5197 // * routability of the loopback address for the family. */ 5198 // static const struct sockaddr_in lo4 = { 5199 // .sin_family = AF_INET, .sin_port = 65535, 5200 // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN 5201 // ? 0x7f000001 : 0x0100007f 5202 // }; 5203 // static const struct sockaddr_in6 lo6 = { 5204 // .sin6_family = AF_INET6, .sin6_port = 65535, 5205 // .sin6_addr = IN6ADDR_LOOPBACK_INIT 5206 // }; 5207 // int tf[2] = { AF_INET, AF_INET6 }; 5208 // const void *ta[2] = { &lo4, &lo6 }; 5209 // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; 5210 // for (i=0; i<2; i++) { 5211 // if (family==tf[1-i]) continue; 5212 // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, 5213 // IPPROTO_UDP); 5214 // if (s>=0) { 5215 // int cs; 5216 // pthread_setcancelstate( 5217 // PTHREAD_CANCEL_DISABLE, &cs); 5218 // int r = connect(s, ta[i], tl[i]); 5219 // pthread_setcancelstate(cs, 0); 5220 // close(s); 5221 // if (!r) continue; 5222 // } 5223 // switch (errno) { 5224 // case EADDRNOTAVAIL: 5225 // case EAFNOSUPPORT: 5226 // case EHOSTUNREACH: 5227 // case ENETDOWN: 5228 // case ENETUNREACH: 5229 // break; 5230 // default: 5231 // return EAI_SYSTEM; 5232 // } 5233 // if (family == tf[i]) return EAI_NONAME; 5234 // family = tf[1-i]; 5235 // } 5236 } 5237 5238 nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags) 5239 if nservs < 0 { 5240 return nservs 5241 } 5242 5243 naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags) 5244 if naddrs < 0 { 5245 return naddrs 5246 } 5247 5248 nais = nservs * naddrs 5249 canon_len = int32(Xstrlen(tls, bp+1352)) 5250 out = Xcalloc(tls, uint32(1), uint32(nais)*uint32(unsafe.Sizeof(aibuf{}))+uint32(canon_len)+uint32(1)) 5251 if !(out != 0) { 5252 return -10 5253 } 5254 5255 if canon_len != 0 { 5256 outcanon = out + uintptr(nais)*68 5257 Xmemcpy(tls, outcanon, bp+1352, uint32(canon_len+1)) 5258 } else { 5259 outcanon = uintptr(0) 5260 } 5261 5262 for k = AssignInt32(&i, 0); i < naddrs; i++ { 5263 j = 0 5264 __1: 5265 if !(j < nservs) { 5266 goto __3 5267 } 5268 { 5269 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fslot = int16(k) 5270 //TODO out[k].ai = (struct addrinfo){ 5271 //TODO .ai_family = addrs[i].family, 5272 //TODO .ai_socktype = ports[j].socktype, 5273 //TODO .ai_protocol = ports[j].proto, 5274 //TODO .ai_addrlen = addrs[i].family == AF_INET 5275 //TODO ? sizeof(struct sockaddr_in) 5276 //TODO : sizeof(struct sockaddr_in6), 5277 //TODO .ai_addr = (void *)&out[k].sa, 5278 //TODO .ai_canonname = outcanon }; 5279 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily 5280 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fsocktype) 5281 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fproto) 5282 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_addrlen = func() uint32 { 5283 if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).Ffamily == 2 { 5284 return uint32(unsafe.Sizeof(sockaddr_in{})) 5285 } 5286 return uint32(unsafe.Sizeof(sockaddr_in6{})) 5287 }() 5288 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_addr = out + uintptr(k)*68 + 32 5289 (*aibuf)(unsafe.Pointer(out + uintptr(k)*68)).Fai.Fai_canonname = outcanon 5290 if k != 0 { 5291 (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*68)).Fai.Fai_next = out + uintptr(k)*68 5292 } 5293 switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily { 5294 case 2: 5295 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin_family = sa_family_t(2) 5296 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport) 5297 Xmemcpy(tls, out+uintptr(k)*68+32+4, bp+8+uintptr(i)*28+8, uint32(4)) 5298 break 5299 case 10: 5300 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_family = sa_family_t(10) 5301 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport) 5302 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*68 + 32)).Fsin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Fscopeid 5303 Xmemcpy(tls, out+uintptr(k)*68+32+8, bp+8+uintptr(i)*28+8, uint32(16)) 5304 break 5305 } 5306 5307 } 5308 goto __2 5309 __2: 5310 j++ 5311 k++ 5312 goto __1 5313 goto __3 5314 __3: 5315 } 5316 (*aibuf)(unsafe.Pointer(out)).Fref = int16(nais) 5317 *(*uintptr)(unsafe.Pointer(res)) = out 5318 return 0 5319 } 5320 5321 type ucred = struct { 5322 Fpid pid_t 5323 Fuid uid_t 5324 Fgid gid_t 5325 } /* socket.h:57:1 */ 5326 5327 type mmsghdr = struct { 5328 Fmsg_hdr struct { 5329 Fmsg_name uintptr 5330 Fmsg_namelen socklen_t 5331 Fmsg_iov uintptr 5332 Fmsg_iovlen int32 5333 Fmsg_control uintptr 5334 Fmsg_controllen socklen_t 5335 Fmsg_flags int32 5336 } 5337 Fmsg_len uint32 5338 } /* socket.h:63:1 */ 5339 5340 func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ 5341 bp := tls.Alloc(4) 5342 defer tls.Free(4) 5343 5344 var size size_t = size_t(63) 5345 // var res uintptr at bp, 4 5346 5347 var err int32 5348 for __ccgo := true; __ccgo; __ccgo = err == 34 { 5349 Xfree(tls, _sh) 5350 _sh = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1))) 5351 if !(_sh != 0) { 5352 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 5353 return uintptr(0) 5354 } 5355 err = Xgethostbyaddr_r(tls, a, l, af, _sh, 5356 _sh+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 5357 } 5358 if err != 0 { 5359 return uintptr(0) 5360 } 5361 return _sh 5362 } 5363 5364 var _sh uintptr /* gethostbyaddr.c:9:24: */ 5365 5366 func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ 5367 return Xgethostbyname2(tls, name, 2) 5368 } 5369 5370 func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ 5371 bp := tls.Alloc(4) 5372 defer tls.Free(4) 5373 5374 var size size_t = size_t(63) 5375 // var res uintptr at bp, 4 5376 5377 var err int32 5378 for __ccgo := true; __ccgo; __ccgo = err == 34 { 5379 Xfree(tls, _sh1) 5380 _sh1 = Xmalloc(tls, AssignAddUint32(&size, size+size_t(1))) 5381 if !(_sh1 != 0) { 5382 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 5383 return uintptr(0) 5384 } 5385 err = Xgethostbyname2_r(tls, name, af, _sh1, 5386 _sh1+uintptr(1)*20, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 5387 } 5388 if err != 0 { 5389 return uintptr(0) 5390 } 5391 return _sh1 5392 } 5393 5394 var _sh1 uintptr /* gethostbyname2.c:10:24: */ 5395 5396 func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */ 5397 bp := tls.Alloc(1600) 5398 defer tls.Free(1600) 5399 5400 // var addrs [48]address at bp, 1344 5401 5402 // var canon [256]int8 at bp+1344, 256 5403 5404 var i int32 5405 var cnt int32 5406 var align size_t 5407 var need size_t 5408 5409 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 5410 cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02) 5411 if cnt < 0 { 5412 switch cnt { 5413 case -2: 5414 *(*int32)(unsafe.Pointer(err)) = 1 5415 return 2 5416 fallthrough 5417 case -3: 5418 *(*int32)(unsafe.Pointer(err)) = 2 5419 return 11 5420 fallthrough 5421 default: 5422 fallthrough 5423 case -4: 5424 *(*int32)(unsafe.Pointer(err)) = 3 5425 return 74 5426 fallthrough 5427 case -10: 5428 fallthrough 5429 case -11: 5430 *(*int32)(unsafe.Pointer(err)) = 3 5431 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 5432 } 5433 } 5434 5435 (*hostent)(unsafe.Pointer(h)).Fh_addrtype = af 5436 (*hostent)(unsafe.Pointer(h)).Fh_length = func() int32 { 5437 if af == 10 { 5438 return 16 5439 } 5440 return 4 5441 }() 5442 5443 // Align buffer 5444 align = -uintptr_t(buf) & (uint32(unsafe.Sizeof(uintptr(0))) - uint32(1)) 5445 5446 need = uint32(4) * uint32(unsafe.Sizeof(uintptr(0))) 5447 need = need + uint32(cnt+1)*(uint32(unsafe.Sizeof(uintptr(0)))+uint32((*hostent)(unsafe.Pointer(h)).Fh_length)) 5448 need = need + (Xstrlen(tls, name) + size_t(1)) 5449 need = need + (Xstrlen(tls, bp+1344) + size_t(1)) 5450 need = need + align 5451 5452 if need > buflen { 5453 return 34 5454 } 5455 5456 buf += uintptr(align) 5457 (*hostent)(unsafe.Pointer(h)).Fh_aliases = buf 5458 buf += uintptr(uint32(3) * uint32(unsafe.Sizeof(uintptr(0)))) 5459 (*hostent)(unsafe.Pointer(h)).Fh_addr_list = buf 5460 buf += uintptr(uint32(cnt+1) * uint32(unsafe.Sizeof(uintptr(0)))) 5461 5462 for i = 0; i < cnt; i++ { 5463 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)) = buf 5464 buf += uintptr((*hostent)(unsafe.Pointer(h)).Fh_length) 5465 Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)), bp+uintptr(i)*28+8, uint32((*hostent)(unsafe.Pointer(h)).Fh_length)) 5466 } 5467 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*4)) = uintptr(0) 5468 5469 (*hostent)(unsafe.Pointer(h)).Fh_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).Fh_aliases, buf) 5470 Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, bp+1344) 5471 buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).Fh_name) + size_t(1)) 5472 5473 if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, name) != 0 { 5474 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)) = buf 5475 Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)), name) 5476 buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4))) + size_t(1)) 5477 } else { 5478 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*4)) = uintptr(0) 5479 } 5480 5481 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 2*4)) = uintptr(0) 5482 5483 *(*uintptr)(unsafe.Pointer(res)) = h 5484 return 0 5485 } 5486 5487 type if_nameindex = struct { 5488 Fif_index uint32 5489 Fif_name uintptr 5490 } /* if.h:12:1 */ 5491 5492 type ifaddr = struct { 5493 Fifa_addr struct { 5494 Fsa_family sa_family_t 5495 Fsa_data [14]int8 5496 } 5497 Fifa_ifu struct { 5498 Fifu_broadaddr struct { 5499 Fsa_family sa_family_t 5500 Fsa_data [14]int8 5501 } 5502 } 5503 Fifa_ifp uintptr 5504 Fifa_next uintptr 5505 } /* if.h:51:1 */ 5506 5507 type ifmap = struct { 5508 Fmem_start uint32 5509 Fmem_end uint32 5510 Fbase_addr uint16 5511 Firq uint8 5512 Fdma uint8 5513 Fport uint8 5514 F__ccgo_pad1 [3]byte 5515 } /* if.h:64:1 */ 5516 5517 type ifreq = struct { 5518 Fifr_ifrn struct{ Fifrn_name [16]int8 } 5519 Fifr_ifru struct { 5520 F__ccgo_pad1 [0]uint32 5521 Fifru_addr struct { 5522 Fsa_family sa_family_t 5523 Fsa_data [14]int8 5524 } 5525 } 5526 } /* if.h:76:1 */ 5527 5528 type ifconf = struct { 5529 Fifc_len int32 5530 Fifc_ifcu struct{ Fifcu_buf uintptr } 5531 } /* if.h:116:1 */ 5532 5533 type ns_sect = uint32 /* nameser.h:37:3 */ 5534 5535 type __ns_msg = struct { 5536 F_msg uintptr 5537 F_eom uintptr 5538 F_id uint16_t 5539 F_flags uint16_t 5540 F_counts [4]uint16_t 5541 F_sections [4]uintptr 5542 F_sect ns_sect 5543 F_rrnum int32 5544 F_msg_ptr uintptr 5545 } /* nameser.h:39:9 */ 5546 5547 type ns_msg = __ns_msg /* nameser.h:46:3 */ 5548 5549 type _ns_flagdata = struct { 5550 Fmask int32 5551 Fshift int32 5552 } /* nameser.h:48:1 */ 5553 5554 type __ns_rr = struct { 5555 Fname [1025]int8 5556 F__ccgo_pad1 [1]byte 5557 Ftype uint16_t 5558 Frr_class uint16_t 5559 F__ccgo_pad2 [2]byte 5560 Fttl uint32_t 5561 Frdlength uint16_t 5562 F__ccgo_pad3 [2]byte 5563 Frdata uintptr 5564 } /* nameser.h:59:9 */ 5565 5566 type ns_rr = __ns_rr /* nameser.h:66:3 */ 5567 5568 type ns_flag = uint32 /* nameser.h:87:3 */ 5569 5570 type ns_opcode = uint32 /* nameser.h:96:3 */ 5571 5572 type ns_rcode = uint32 /* nameser.h:115:3 */ 5573 5574 type ns_update_operation = uint32 /* nameser.h:121:3 */ 5575 5576 type ns_tsig_key1 = struct { 5577 Fname [1025]int8 5578 Falg [1025]int8 5579 F__ccgo_pad1 [2]byte 5580 Fdata uintptr 5581 Flen int32 5582 } /* nameser.h:123:1 */ 5583 5584 type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ 5585 5586 type ns_tcp_tsig_state1 = struct { 5587 Fcounter int32 5588 Fkey uintptr 5589 Fctx uintptr 5590 Fsig [512]uint8 5591 Fsiglen int32 5592 } /* nameser.h:130:1 */ 5593 5594 type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ 5595 5596 type ns_type = uint32 /* nameser.h:200:3 */ 5597 5598 type ns_class = uint32 /* nameser.h:219:3 */ 5599 5600 type ns_key_types = uint32 /* nameser.h:226:3 */ 5601 5602 type ns_cert_types = uint32 /* nameser.h:234:3 */ 5603 5604 type HEADER = struct { 5605 F__ccgo_pad1 [0]uint32 5606 Fid uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */ 5607 Fqdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ 5608 Fnscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ 5609 } /* nameser.h:353:3 */ 5610 5611 // unused; purely for broken apps 5612 type __res_state = struct { 5613 Fretrans int32 5614 Fretry int32 5615 Foptions uint32 5616 Fnscount int32 5617 Fnsaddr_list [3]struct { 5618 Fsin_family sa_family_t 5619 Fsin_port in_port_t 5620 Fsin_addr struct{ Fs_addr in_addr_t } 5621 Fsin_zero [8]uint8_t 5622 } 5623 Fid uint16 5624 F__ccgo_pad1 [2]byte 5625 Fdnsrch [7]uintptr 5626 Fdefdname [256]int8 5627 Fpfcode uint32 5628 Fndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ 5629 F__ccgo_pad2 [4]byte 5630 Fsort_list [10]struct { 5631 Faddr struct{ Fs_addr in_addr_t } 5632 Fmask uint32_t 5633 } 5634 Fqhook uintptr 5635 Frhook uintptr 5636 Fres_h_errno int32 5637 F_vcsock int32 5638 F_flags uint32 5639 F_u struct { 5640 F__ccgo_pad1 [0]uint32 5641 Fpad [52]int8 5642 } 5643 } /* resolv.h:26:9 */ 5644 5645 // unused; purely for broken apps 5646 type res_state = uintptr /* resolv.h:62:3 */ 5647 5648 type res_sym = struct { 5649 Fnumber int32 5650 Fname uintptr 5651 Fhumanname uintptr 5652 } /* resolv.h:70:1 */ 5653 5654 func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ 5655 p += uintptr(uint32(3) * uint32(unsafe.Sizeof(int32(0)))) 5656 *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0) 5657 for __ccgo := true; __ccgo; __ccgo = x != 0 { 5658 *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(uint32('0') + x%uint32(10)) 5659 x = x / uint32(10) 5660 } 5661 return p 5662 } 5663 5664 func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ 5665 bp := tls.Alloc(32) 5666 defer tls.Free(32) 5667 5668 Xsprintf(tls, s, ts+64, 5669 VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) 5670 } 5671 5672 func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ 5673 var i int32 5674 for i = 15; i >= 0; i-- { 5675 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15] 5676 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') 5677 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4] 5678 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') 5679 } 5680 Xstrcpy(tls, s, ts+89) 5681 } 5682 5683 var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 98)) /* getnameinfo.c:36:20 */ 5684 5685 func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ 5686 bp := tls.Alloc(556) 5687 defer tls.Free(556) 5688 5689 // var line [512]int8 at bp+16, 512 5690 5691 var p uintptr 5692 var z uintptr 5693 var _buf [1032]uint8 5694 _ = _buf 5695 // var atmp [16]uint8 at bp, 16 5696 5697 // var iplit address at bp+528, 28 5698 5699 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 5700 var f uintptr = Xfopen(tls, ts+115, ts+126) 5701 if !(f != 0) { 5702 return 5703 } 5704 if family == 2 { 5705 Xmemcpy(tls, bp+uintptr(12), a, uint32(4)) 5706 Xmemcpy(tls, bp, ts+129, uint32(12)) 5707 a = bp /* &atmp[0] */ 5708 } 5709 for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]int8{})), f) != 0 { 5710 if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 { 5711 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') 5712 *(*int8)(unsafe.Pointer(p)) = int8(0) 5713 } 5714 5715 for p = bp + 16; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { 5716 } 5717 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) 5718 if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 { 5719 continue 5720 } 5721 5722 if (*address)(unsafe.Pointer(bp+528)).Ffamily == 2 { 5723 Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint32(4)) 5724 Xmemcpy(tls, bp+528+8, ts+129, uint32(12)) 5725 (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).Fscopeid = uint32(0) 5726 } 5727 5728 if Xmemcmp(tls, a, bp+528+8, uint32(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).Fscopeid != scopeid { 5729 continue 5730 } 5731 5732 for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ { 5733 } 5734 for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { 5735 } 5736 *(*int8)(unsafe.Pointer(z)) = int8(0) 5737 if (int32(z)-int32(p))/1 < 256 { 5738 Xmemcpy(tls, buf, p, uint32((int32(z)-int32(p))/1+1)) 5739 break 5740 } 5741 } 5742 //TODO __fclose_ca(f); 5743 Xfclose(tls, f) 5744 } 5745 5746 func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ 5747 Xabort(tls) //TODO- 5748 // unsigned long svport; 5749 // char line[128], *p, *z; 5750 // unsigned char _buf[1032]; 5751 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 5752 // if (!f) return; 5753 // while (fgets(line, sizeof line, f)) { 5754 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 5755 5756 // for (p=line; *p && !isspace(*p); p++); 5757 // if (!*p) continue; 5758 // *p++ = 0; 5759 // svport = strtoul(p, &z, 10); 5760 5761 // if (svport != port || z==p) continue; 5762 // if (dgram && strncmp(z, "/udp", 4)) continue; 5763 // if (!dgram && strncmp(z, "/tcp", 4)) continue; 5764 // if (p-line > 32) continue; 5765 5766 // memcpy(buf, line, p-line); 5767 // break; 5768 // } 5769 // __fclose_ca(f); 5770 } 5771 5772 var Xh_errno int32 /* h_errno.c:4:5: */ 5773 5774 func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ 5775 return uintptr(unsafe.Pointer(&Xh_errno)) 5776 } 5777 5778 func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ 5779 bp := tls.Alloc(20) 5780 defer tls.Free(20) 5781 5782 var s uintptr = s0 5783 var d uintptr = dest 5784 *(*[4]uint32)(unsafe.Pointer(bp /* a */)) = [4]uint32{0: uint32(0)} 5785 // var z uintptr at bp+16, 4 5786 5787 var i int32 5788 5789 for i = 0; i < 4; i++ { 5790 *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) = Xstrtoul(tls, s, bp+16, 0) 5791 if *(*uintptr)(unsafe.Pointer(bp + 16)) == s || *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16)))) != 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != '.' || !(func() int32 { 5792 if 0 != 0 { 5793 return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s)))) 5794 } 5795 return Bool32(uint32(*(*int8)(unsafe.Pointer(s)))-uint32('0') < uint32(10)) 5796 }() != 0) { 5797 return 0 5798 } 5799 if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16))))) != 0) { 5800 break 5801 } 5802 s = *(*uintptr)(unsafe.Pointer(bp + 16)) + uintptr(1) 5803 } 5804 if i == 4 { 5805 return 0 5806 } 5807 switch i { 5808 case 0: 5809 *(*uint32)(unsafe.Pointer(bp + 1*4)) = *(*uint32)(unsafe.Pointer(bp)) & uint32(0xffffff) 5810 AssignShrPtrUint32(bp, int(24)) 5811 fallthrough 5812 case 1: 5813 *(*uint32)(unsafe.Pointer(bp + 2*4)) = *(*uint32)(unsafe.Pointer(bp + 1*4)) & uint32(0xffff) 5814 AssignShrPtrUint32(bp+1*4, int(16)) 5815 fallthrough 5816 case 2: 5817 *(*uint32)(unsafe.Pointer(bp + 3*4)) = *(*uint32)(unsafe.Pointer(bp + 2*4)) & uint32(0xff) 5818 AssignShrPtrUint32(bp+2*4, int(8)) 5819 } 5820 for i = 0; i < 4; i++ { 5821 if *(*uint32)(unsafe.Pointer(bp + uintptr(i)*4)) > uint32(255) { 5822 return 0 5823 } 5824 *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint32)(unsafe.Pointer(bp + uintptr(i)*4))) 5825 } 5826 return 1 5827 } 5828 5829 func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ 5830 bp := tls.Alloc(276) 5831 defer tls.Free(276) 5832 5833 var a uintptr = a0 5834 var i int32 5835 var j int32 5836 var max int32 5837 var best int32 5838 // var buf [100]int8 at bp+176, 100 5839 5840 switch af { 5841 case 2: 5842 if socklen_t(Xsnprintf(tls, s, l, ts+142, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { 5843 return s 5844 } 5845 break 5846 case 10: 5847 if Xmemcmp(tls, a, ts+129, uint32(12)) != 0 { 5848 Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]int8{})), 5849 ts+154, 5850 VaList(bp+32, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), 5851 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), 5852 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), 5853 256*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), 256*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15))))) 5854 } else { 5855 Xsnprintf(tls, bp+176, uint32(unsafe.Sizeof([100]int8{})), 5856 ts+178, 5857 VaList(bp+96, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), 5858 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), 5859 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), 5860 int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) 5861 } 5862 // Replace longest /(^0|:)[:0]{2,}/ with "::" 5863 i = AssignInt32(&best, 0) 5864 max = 2 5865 for ; *(*int8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ { 5866 if i != 0 && int32(*(*int8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' { 5867 continue 5868 } 5869 j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+208)) 5870 if j > max { 5871 best = i 5872 max = j 5873 } 5874 } 5875 if max > 3 { 5876 *(*int8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrInt8(bp+176+uintptr(best+1), int8(':')) 5877 Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint32(i-best-max+1)) 5878 } 5879 if Xstrlen(tls, bp+176) < l { 5880 Xstrcpy(tls, s, bp+176) 5881 return s 5882 } 5883 break 5884 default: 5885 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 5886 return uintptr(0) 5887 } 5888 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28 5889 return uintptr(0) 5890 } 5891 5892 func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ 5893 if c-uint32('0') < uint32(10) { 5894 return int32(c - uint32('0')) 5895 } 5896 c = c | uint32(32) 5897 if c-uint32('a') < uint32(6) { 5898 return int32(c - uint32('a') + uint32(10)) 5899 } 5900 return -1 5901 } 5902 5903 func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ 5904 bp := tls.Alloc(16) 5905 defer tls.Free(16) 5906 5907 // var ip [8]uint16_t at bp, 16 5908 5909 var a uintptr = a0 5910 var i int32 5911 var j int32 5912 var v int32 5913 var d int32 5914 var brk int32 = -1 5915 var need_v4 int32 = 0 5916 5917 if af == 2 { 5918 for i = 0; i < 4; i++ { 5919 for v = AssignInt32(&j, 0); j < 3 && func() int32 { 5920 if 0 != 0 { 5921 return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) 5922 } 5923 return Bool32(uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10)) 5924 }() != 0; j++ { 5925 v = 10*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - '0' 5926 } 5927 if j == 0 || j > 1 && int32(*(*int8)(unsafe.Pointer(s))) == '0' || v > 255 { 5928 return 0 5929 } 5930 *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) 5931 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 { 5932 return 1 5933 } 5934 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' { 5935 return 0 5936 } 5937 s += uintptr(j + 1) 5938 } 5939 return 0 5940 } else if af != 10 { 5941 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 5942 return -1 5943 } 5944 5945 if int32(*(*int8)(unsafe.Pointer(s))) == ':' && int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' { 5946 return 0 5947 } 5948 5949 for i = 0; ; i++ { 5950 if int32(*(*int8)(unsafe.Pointer(s))) == ':' && brk < 0 { 5951 brk = i 5952 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0) 5953 if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { 5954 break 5955 } 5956 if i == 7 { 5957 return 0 5958 } 5959 continue 5960 } 5961 for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ { 5962 v = 16*v + d 5963 } 5964 if j == 0 { 5965 return 0 5966 } 5967 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v) 5968 if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) { 5969 break 5970 } 5971 if i == 7 { 5972 return 0 5973 } 5974 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' { 5975 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 { 5976 return 0 5977 } 5978 need_v4 = 1 5979 i++ 5980 break 5981 } 5982 s += uintptr(j + 1) 5983 } 5984 if brk >= 0 { 5985 Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint32(2*(i+1-brk))) 5986 for j = 0; j < 7-i; j++ { 5987 *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0) 5988 } 5989 } 5990 for j = 0; j < 8; j++ { 5991 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8) 5992 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) 5993 } 5994 if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 { 5995 return 0 5996 } 5997 return 1 5998 } 5999 6000 func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ 6001 bp := tls.Alloc(88) 6002 defer tls.Free(88) 6003 6004 // var a4 in_addr at bp, 4 6005 6006 // var a6 in6_addr at bp+68, 16 6007 6008 if X__inet_aton(tls, name, bp) > 0 { 6009 if family == 10 { // wrong family 6010 return -2 6011 } 6012 Xmemcpy(tls, buf+8, bp, uint32(unsafe.Sizeof(in_addr{}))) 6013 (*address)(unsafe.Pointer(buf)).Ffamily = 2 6014 (*address)(unsafe.Pointer(buf)).Fscopeid = uint32(0) 6015 return 1 6016 } 6017 // var tmp [64]int8 at bp+4, 64 6018 6019 var p uintptr = Xstrchr(tls, name, '%') 6020 // var z uintptr at bp+84, 4 6021 6022 var scopeid uint64 = uint64(0) 6023 if p != 0 && (int32(p)-int32(name))/1 < 64 { 6024 Xmemcpy(tls, bp+4, name, uint32((int32(p)-int32(name))/1)) 6025 *(*int8)(unsafe.Pointer(bp + 4 + uintptr((int32(p)-int32(name))/1))) = int8(0) 6026 name = bp + 4 /* &tmp[0] */ 6027 } 6028 6029 if Xinet_pton(tls, 10, name, bp+68) <= 0 { 6030 return 0 6031 } 6032 if family == 2 { // wrong family 6033 return -2 6034 } 6035 6036 Xmemcpy(tls, buf+8, bp+68, uint32(unsafe.Sizeof(in6_addr{}))) 6037 (*address)(unsafe.Pointer(buf)).Ffamily = 10 6038 if p != 0 { 6039 if func() int32 { 6040 if 0 != 0 { 6041 return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) 6042 } 6043 return Bool32(uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10)) 6044 }() != 0 { 6045 scopeid = Xstrtoull(tls, p, bp+84, 10) 6046 } else { 6047 *(*uintptr)(unsafe.Pointer(bp + 84 /* z */)) = p - uintptr(1) 6048 } 6049 if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 84)))) != 0 { 6050 Xabort(tls) //TODO- 6051 // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && 6052 // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) 6053 // return EAI_NONAME; 6054 // scopeid = if_nametoindex(p); 6055 // if (!scopeid) return EAI_NONAME; 6056 } 6057 if scopeid > uint64(0xffffffff) { 6058 return -2 6059 } 6060 } 6061 (*address)(unsafe.Pointer(buf)).Fscopeid = uint32(scopeid) 6062 return 1 6063 } 6064 6065 type mode_t = uint32 /* alltypes.h:175:18 */ 6066 6067 type flock = struct { 6068 Fl_type int16 6069 Fl_whence int16 6070 Fl_start off_t 6071 Fl_len off_t 6072 Fl_pid pid_t 6073 } /* fcntl.h:24:1 */ 6074 6075 func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ 6076 var s uintptr 6077 //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; 6078 if Xstrnlen(tls, host, uint32(255))-size_t(1) >= size_t(254) { 6079 return 0 6080 } 6081 for s = host; int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80 || int32(*(*uint8)(unsafe.Pointer(s))) == '.' || int32(*(*uint8)(unsafe.Pointer(s))) == '-' || Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0; s++ { 6082 } 6083 return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) 6084 } 6085 6086 var Xzero_struct_address address /* lookup_name.c:27:16: */ 6087 6088 func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ 6089 var cnt int32 = 0 6090 if name != 0 { 6091 return 0 6092 } 6093 if flags&0x01 != 0 { 6094 //TODO if (family != AF_INET6) 6095 //TODO buf[cnt++] = (struct address){ .family = AF_INET }; 6096 if family != 10 { 6097 var x = Xzero_struct_address 6098 x.Ffamily = 2 6099 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 6100 } 6101 //TODO if (family != AF_INET) 6102 //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; 6103 if family != 2 { 6104 var x = Xzero_struct_address 6105 x.Ffamily = 10 6106 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 6107 } 6108 } else { 6109 Xabort(tls) //TODO- 6110 // if (family != AF_INET6) 6111 // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; 6112 // if (family != AF_INET) 6113 // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; 6114 } 6115 return cnt 6116 } 6117 6118 func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ 6119 return X__lookup_ipliteral(tls, buf, name, family) 6120 } 6121 6122 func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ 6123 bp := tls.Alloc(512) 6124 defer tls.Free(512) 6125 6126 // var line [512]int8 at bp, 512 6127 6128 var l size_t = Xstrlen(tls, name) 6129 var cnt int32 = 0 6130 var badfam int32 = 0 6131 var _buf [1032]uint8 6132 _ = _buf 6133 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 6134 var _f FILE 6135 _ = _f 6136 var f uintptr = Xfopen(tls, ts+115, ts+126) 6137 if !(f != 0) { 6138 switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { 6139 case 2: 6140 fallthrough 6141 case 20: 6142 fallthrough 6143 case 13: 6144 return 0 6145 fallthrough 6146 default: 6147 return -11 6148 } 6149 } 6150 for Xfgets(tls, bp, int32(unsafe.Sizeof([512]int8{})), f) != 0 && cnt < 48 { 6151 var p uintptr 6152 var z uintptr 6153 6154 if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 { 6155 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') 6156 *(*int8)(unsafe.Pointer(p)) = int8(0) 6157 } 6158 for p = bp + uintptr(1); AssignUintptr(&p, Xstrstr(tls, p, name)) != 0 && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { 6159 } 6160 if !(p != 0) { 6161 continue 6162 } 6163 6164 // Isolate IP address to parse 6165 for p = bp; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { 6166 } 6167 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) 6168 switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) { 6169 case 1: 6170 cnt++ 6171 break 6172 case 0: 6173 continue 6174 default: 6175 badfam = -2 6176 continue 6177 } 6178 6179 // Extract first name as canonical name 6180 for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ { 6181 } 6182 for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { 6183 } 6184 *(*int8)(unsafe.Pointer(z)) = int8(0) 6185 if is_valid_hostname(tls, p) != 0 { 6186 Xmemcpy(tls, canon, p, uint32((int32(z)-int32(p))/1+1)) 6187 } 6188 } 6189 //TODO __fclose_ca(f); 6190 Xfclose(tls, f) 6191 if cnt != 0 { 6192 return cnt 6193 } 6194 return badfam 6195 } 6196 6197 type dpc_ctx = struct { 6198 Faddrs uintptr 6199 Fcanon uintptr 6200 Fcnt int32 6201 } /* lookup_name.c:112:1 */ 6202 6203 func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ 6204 return -1 //TODO- 6205 Xabort(tls) 6206 return int32(0) //TODO- 6207 // char search[256]; 6208 // struct resolvconf conf; 6209 // size_t l, dots; 6210 // char *p, *z; 6211 6212 // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; 6213 6214 // /* Count dots, suppress search when >=ndots or name ends in 6215 // * a dot, which is an explicit request for global scope. */ 6216 // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; 6217 // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; 6218 6219 // /* Strip final dot for canon, fail if multiple trailing dots. */ 6220 // if (name[l-1]=='.') l--; 6221 // if (!l || name[l-1]=='.') return EAI_NONAME; 6222 6223 // /* This can never happen; the caller already checked length. */ 6224 // if (l >= 256) return EAI_NONAME; 6225 6226 // /* Name with search domain appended is setup in canon[]. This both 6227 // * provides the desired default canonical name (if the requested 6228 // * name is not a CNAME record) and serves as a buffer for passing 6229 // * the full requested name to name_from_dns. */ 6230 // memcpy(canon, name, l); 6231 // canon[l] = '.'; 6232 6233 // for (p=search; *p; p=z) { 6234 // for (; isspace(*p); p++); 6235 // for (z=p; *z && !isspace(*z); z++); 6236 // if (z==p) break; 6237 // if (z-p < 256 - l - 1) { 6238 // memcpy(canon+l+1, p, z-p); 6239 // canon[z-p+1+l] = 0; 6240 // int cnt = name_from_dns(buf, canon, canon, family, &conf); 6241 // if (cnt) return cnt; 6242 // } 6243 // } 6244 6245 // canon[l] = 0; 6246 // return name_from_dns(buf, canon, name, family, &conf); 6247 } 6248 6249 type policy = struct { 6250 Faddr [16]uint8 6251 Flen uint8 6252 Fmask uint8 6253 Fprec uint8 6254 Flabel uint8 6255 } /* lookup_name.c:237:14 */ 6256 6257 var defpolicy = [6]policy{ 6258 {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 211)), Flen: uint8(15), Fmask: uint8(0xff), Fprec: uint8(50)}, 6259 {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 228)), Flen: uint8(11), Fmask: uint8(0xff), Fprec: uint8(35), Flabel: uint8(4)}, 6260 {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 244)), Flen: uint8(1), Fmask: uint8(0xff), Fprec: uint8(30), Flabel: uint8(2)}, 6261 {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 260)), Flen: uint8(3), Fmask: uint8(0xff), Fprec: uint8(5), Flabel: uint8(5)}, 6262 {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 276)), Fmask: uint8(0xfe), Fprec: uint8(3), Flabel: uint8(13)}, 6263 // Last rule must match all addresses to stop loop. 6264 {Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 292)), Fprec: uint8(40), Flabel: uint8(1)}, 6265 } /* lookup_name.c:241:3 */ 6266 6267 func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ 6268 var i int32 6269 for i = 0; ; i++ { 6270 if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint32(defpolicy[i].Flen)) != 0 { 6271 continue 6272 } 6273 if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].Flen))))&int32(defpolicy[i].Fmask) != 6274 int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].Flen)))) { 6275 continue 6276 } 6277 return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 6278 } 6279 return uintptr(0) 6280 } 6281 6282 func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ 6283 return int32((*policy)(unsafe.Pointer(policyof(tls, a))).Flabel) 6284 } 6285 6286 func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ 6287 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff { 6288 return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15 6289 } 6290 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 { 6291 return 2 6292 } 6293 if *(*uint32_t)(unsafe.Pointer(a)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 1*4)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 2*4)) == uint32_t(0) && int32(*(*uint8_t)(unsafe.Pointer(a + 12))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 13))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 14))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 15))) == 1 { 6294 return 2 6295 } 6296 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 { 6297 return 5 6298 } 6299 return 14 6300 } 6301 6302 func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ 6303 // FIXME: The common prefix length should be limited to no greater 6304 // than the nominal length of the prefix portion of the source 6305 // address. However the definition of the source prefix length is 6306 // not clear and thus this limiting is not yet implemented. 6307 var i uint32 6308 for i = uint32(0); i < uint32(128) && !((int32(*(*uint8_t)(unsafe.Pointer(s /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8)))))^int32(*(*uint8_t)(unsafe.Pointer(d /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8))))))&(int32(128)>>(i%uint32(8))) != 0); i++ { 6309 } 6310 return int32(i) 6311 } 6312 6313 func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ 6314 var a uintptr = _a 6315 var b uintptr = _b 6316 return (*address)(unsafe.Pointer(b)).Fsortkey - (*address)(unsafe.Pointer(a)).Fsortkey 6317 } 6318 6319 func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ 6320 bp := tls.Alloc(92) 6321 defer tls.Free(92) 6322 6323 var cnt int32 = 0 6324 var i int32 6325 var j int32 6326 _ = j 6327 6328 *(*int8)(unsafe.Pointer(canon)) = int8(0) 6329 if name != 0 { 6330 // reject empty name and check len so it fits into temp bufs 6331 var l size_t = Xstrnlen(tls, name, uint32(255)) 6332 if l-size_t(1) >= size_t(254) { 6333 return -2 6334 } 6335 Xmemcpy(tls, canon, name, l+size_t(1)) 6336 } 6337 6338 // Procedurally, a request for v6 addresses with the v4-mapped 6339 // flag set is like a request for unspecified family, followed 6340 // by filtering of the results. 6341 if flags&0x08 != 0 { 6342 if family == 10 { 6343 family = 0 6344 } else { 6345 flags = flags - 0x08 6346 } 6347 } 6348 6349 // Try each backend until there's at least one result. 6350 cnt = name_from_null(tls, buf, name, family, flags) 6351 if !(cnt != 0) { 6352 cnt = name_from_numeric(tls, buf, name, family) 6353 } 6354 if !(cnt != 0) && !(flags&0x04 != 0) { 6355 cnt = name_from_hosts(tls, buf, canon, name, family) 6356 if !(cnt != 0) { 6357 cnt = name_from_dns_search(tls, buf, canon, name, family) 6358 } 6359 } 6360 if cnt <= 0 { 6361 if cnt != 0 { 6362 return cnt 6363 } 6364 return -2 6365 } 6366 6367 // Filter/transform results for v4-mapped lookup, if requested. 6368 if flags&0x08 != 0 { 6369 Xabort(tls) //TODO- 6370 // if (!(flags & AI_ALL)) { 6371 // /* If any v6 results exist, remove v4 results. */ 6372 // for (i=0; i<cnt && buf[i].family != AF_INET6; i++); 6373 // if (i<cnt) { 6374 // for (j=0; i<cnt; i++) { 6375 // if (buf[i].family == AF_INET6) 6376 // buf[j++] = buf[i]; 6377 // } 6378 // cnt = i = j; 6379 // } 6380 // } 6381 // /* Translate any remaining v4 results to v6 */ 6382 // for (i=0; i<cnt; i++) { 6383 // if (buf[i].family != AF_INET) continue; 6384 // memcpy(buf[i].addr+12, buf[i].addr, 4); 6385 // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12); 6386 // buf[i].family = AF_INET6; 6387 // } 6388 } 6389 6390 // No further processing is needed if there are fewer than 2 6391 // results or if there are only IPv4 results. 6392 if cnt < 2 || family == 2 { 6393 return cnt 6394 } 6395 for i = 0; i < cnt; i++ { 6396 if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).Ffamily != 2 { 6397 break 6398 } 6399 } 6400 if i == cnt { 6401 return cnt 6402 } 6403 var cs int32 6404 _ = cs 6405 //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); 6406 6407 // The following implements a subset of RFC 3484/6724 destination 6408 // address selection by generating a single 31-bit sort key for 6409 // each address. Rules 3, 4, and 7 are omitted for having 6410 // excessive runtime and code size cost and dubious benefit. 6411 // So far the label/precedence table cannot be customized. 6412 for i = 0; i < cnt; i++ { 6413 var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Ffamily 6414 var key int32 = 0 6415 *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{} 6416 *(*sockaddr_in6)(unsafe.Pointer(bp /* da6 */)) = sockaddr_in6{Fsin6_family: sa_family_t(10), Fsin6_port: in_port_t(65535), Fsin6_scope_id: (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fscopeid} 6417 *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{} 6418 *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{Fsin_family: sa_family_t(2), Fsin_port: in_port_t(65535)} 6419 var sa1 uintptr 6420 var da uintptr 6421 // var salen socklen_t at bp+88, 4 6422 6423 var dalen socklen_t 6424 if family == 10 { 6425 Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint32(16)) 6426 da = bp /* &da6 */ 6427 dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 6428 sa1 = bp + 28 /* &sa6 */ 6429 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 6430 } else { 6431 Xmemcpy(tls, bp+28+8, 6432 ts+129, uint32(12)) 6433 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4)) 6434 Xmemcpy(tls, bp+8, 6435 ts+129, uint32(12)) 6436 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint32(4)) 6437 Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint32(4)) 6438 da = bp + 56 /* &da4 */ 6439 dalen = socklen_t(unsafe.Sizeof(sockaddr_in{})) 6440 sa1 = bp + 72 /* &sa4 */ 6441 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{})) 6442 } 6443 var dpolicy uintptr = policyof(tls, bp+8) 6444 var dscope int32 = scopeof(tls, bp+8) 6445 var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Flabel) 6446 var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Fprec) 6447 var prefixlen int32 = 0 6448 var fd int32 = Xsocket(tls, family, 2|02000000, 17) 6449 if fd >= 0 { 6450 if !(Xconnect(tls, fd, da, dalen) != 0) { 6451 key = key | 0x40000000 6452 if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) { 6453 if family == 2 { 6454 Xmemcpy(tls, 6455 bp+28+8+uintptr(12), 6456 bp+72+4, uint32(4)) 6457 } 6458 if dscope == scopeof(tls, bp+28+8) { 6459 key = key | 0x20000000 6460 } 6461 if dlabel == labelof(tls, bp+28+8) { 6462 key = key | 0x10000000 6463 } 6464 prefixlen = prefixmatch(tls, bp+28+8, 6465 bp+8) 6466 } 6467 } 6468 Xclose(tls, fd) 6469 } 6470 key = key | dprec<<20 6471 key = key | (15-dscope)<<16 6472 key = key | prefixlen<<8 6473 key = key | (48-i)<<0 6474 (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fsortkey = key 6475 } 6476 Xqsort(tls, buf, uint32(cnt), uint32(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { 6477 f func(*TLS, uintptr, uintptr) int32 6478 }{addrcmp}))) 6479 6480 //TODO pthread_setcancelstate(cs, 0); 6481 6482 return cnt 6483 } 6484 6485 func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ 6486 bp := tls.Alloc(4) 6487 defer tls.Free(4) 6488 6489 var line [128]int8 6490 _ = line 6491 var cnt int32 = 0 6492 var p uintptr 6493 _ = p 6494 *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 54 /* "" */ 6495 var port uint32 = uint32(0) 6496 6497 switch socktype { 6498 case 1: 6499 switch proto { 6500 case 0: 6501 proto = 6 6502 fallthrough 6503 case 6: 6504 break 6505 default: 6506 return -8 6507 } 6508 break 6509 case 2: 6510 switch proto { 6511 case 0: 6512 proto = 17 6513 fallthrough 6514 case 17: 6515 break 6516 default: 6517 return -8 6518 } 6519 fallthrough 6520 case 0: 6521 break 6522 default: 6523 if name != 0 { 6524 return -8 6525 } 6526 (*service)(unsafe.Pointer(buf)).Fport = uint16_t(0) 6527 (*service)(unsafe.Pointer(buf)).Fproto = uint8(proto) 6528 (*service)(unsafe.Pointer(buf)).Fsocktype = uint8(socktype) 6529 return 1 6530 } 6531 6532 if name != 0 { 6533 if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) { 6534 return -8 6535 } 6536 port = Xstrtoul(tls, name, bp, 10) 6537 } 6538 if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) { 6539 if port > uint32(65535) { 6540 return -8 6541 } 6542 if proto != 17 { 6543 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port) 6544 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(1) 6545 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(6) 6546 } 6547 if proto != 6 { 6548 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port) 6549 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(2) 6550 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(17) 6551 } 6552 return cnt 6553 } 6554 6555 if flags&0x400 != 0 { 6556 return -2 6557 } 6558 6559 var l size_t = Xstrlen(tls, name) 6560 _ = l 6561 6562 Xabort(tls) //TODO- 6563 // unsigned char _buf[1032]; 6564 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 6565 // if (!f) switch (errno) { 6566 // case ENOENT: 6567 // case ENOTDIR: 6568 // case EACCES: 6569 // return EAI_SERVICE; 6570 // default: 6571 // return EAI_SYSTEM; 6572 // } 6573 6574 Xabort(tls) //TODO- 6575 // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { 6576 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 6577 6578 // /* Find service name */ 6579 // for(p=line; (p=strstr(p, name)); p++) { 6580 // if (p>line && !isspace(p[-1])) continue; 6581 // if (p[l] && !isspace(p[l])) continue; 6582 // break; 6583 // } 6584 // if (!p) continue; 6585 6586 // /* Skip past canonical name at beginning of line */ 6587 // for (p=line; *p && !isspace(*p); p++); 6588 6589 // port = strtoul(p, &z, 10); 6590 // if (port > 65535 || z==p) continue; 6591 // if (!strncmp(z, "/udp", 4)) { 6592 // if (proto == IPPROTO_TCP) continue; 6593 // buf[cnt].port = port; 6594 // buf[cnt].socktype = SOCK_DGRAM; 6595 // buf[cnt++].proto = IPPROTO_UDP; 6596 // } 6597 // if (!strncmp(z, "/tcp", 4)) { 6598 // if (proto == IPPROTO_UDP) continue; 6599 // buf[cnt].port = port; 6600 // buf[cnt].socktype = SOCK_STREAM; 6601 // buf[cnt++].proto = IPPROTO_TCP; 6602 // } 6603 // } 6604 // __fclose_ca(f); 6605 // return cnt > 0 ? cnt : EAI_SERVICE; 6606 Xabort(tls) 6607 return int32(0) //TODO- 6608 } 6609 6610 func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ 6611 *(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1 6612 if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase { 6613 (*struct { 6614 f func(*TLS, uintptr, uintptr, size_t) size_t 6615 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fwrite})).f(tls, f, uintptr(0), uint32(0)) 6616 } 6617 (*FILE)(unsafe.Pointer(f)).Fwpos = AssignPtrUintptr(f+28, AssignPtrUintptr(f+16, uintptr(0))) 6618 if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(4) != 0 { 6619 *(*uint32)(unsafe.Pointer(f)) |= uint32(32) 6620 return -1 6621 } 6622 (*FILE)(unsafe.Pointer(f)).Frpos = AssignPtrUintptr(f+8, (*FILE)(unsafe.Pointer(f)).Fbuf+uintptr((*FILE)(unsafe.Pointer(f)).Fbuf_size)) 6623 if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(16) != 0 { 6624 return -1 6625 } 6626 return 0 6627 } 6628 6629 func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ 6630 X__builtin_abort(tls) //TODO- 6631 // __stdio_exit_needed(); 6632 } 6633 6634 // This function assumes it will never be called if there is already 6635 // data buffered for reading. 6636 6637 func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ 6638 bp := tls.Alloc(1) 6639 defer tls.Free(1) 6640 6641 // var c uint8 at bp, 1 6642 6643 if !(X__toread(tls, f) != 0) && (*struct { 6644 f func(*TLS, uintptr, uintptr, size_t) size_t 6645 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fread})).f(tls, f, bp, uint32(1)) == size_t(1) { 6646 return int32(*(*uint8)(unsafe.Pointer(bp))) 6647 } 6648 return -1 6649 } 6650 6651 func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */ 6652 var try uintptr 6653 var sign int32 6654 for nel > size_t(0) { 6655 try = base + uintptr(width*(nel/size_t(2))) 6656 sign = (*struct { 6657 f func(*TLS, uintptr, uintptr) int32 6658 })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try) 6659 if sign < 0 { 6660 nel = nel / size_t(2) 6661 } else if sign > 0 { 6662 base = try + uintptr(width) 6663 nel = nel - (nel/size_t(2) + size_t(1)) 6664 } else { 6665 return try 6666 } 6667 } 6668 return uintptr(0) 6669 } 6670 6671 func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ 6672 bp := tls.Alloc(136) 6673 defer tls.Free(136) 6674 6675 // var f FILE at bp, 136 6676 6677 (*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+4, s) 6678 (*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1) 6679 X__shlim(tls, bp, int64(0)) 6680 var y float64 = X__floatscan(tls, bp, prec, 1) 6681 var cnt off_t = (*FILE)(unsafe.Pointer(bp)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).Frpos)-int32((*FILE)(unsafe.Pointer(bp)).Fbuf))/1) 6682 if p != 0 { 6683 *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { 6684 if cnt != 0 { 6685 return s + uintptr(cnt) 6686 } 6687 return s 6688 }() 6689 } 6690 return y 6691 } 6692 6693 func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ 6694 return float32(strtox(tls, s, p, 0)) 6695 } 6696 6697 func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ 6698 return strtox(tls, s, p, 1) 6699 } 6700 6701 func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ 6702 return strtox(tls, s, p, 2) 6703 } 6704 6705 func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ 6706 bp := tls.Alloc(136) 6707 defer tls.Free(136) 6708 6709 // var f FILE at bp, 136 6710 6711 (*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+4, s) 6712 (*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1) 6713 X__shlim(tls, bp, int64(0)) 6714 var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim) 6715 if p != 0 { 6716 var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(bp)).Frpos)-int32((*FILE)(unsafe.Pointer(bp)).Fbuf))/1)) 6717 *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt) 6718 } 6719 return y 6720 } 6721 6722 func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ 6723 return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6724 } 6725 6726 func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ 6727 return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1)))) 6728 } 6729 6730 func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */ 6731 return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1)))) 6732 } 6733 6734 func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */ 6735 return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1))))) 6736 } 6737 6738 func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ 6739 return Xstrtoll(tls, s, p, base) 6740 } 6741 6742 func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ 6743 return Xstrtoull(tls, s, p, base) 6744 } 6745 6746 func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ 6747 var l size_t = Xstrlen(tls, s) 6748 var d uintptr = Xmalloc(tls, l+size_t(1)) 6749 if !(d != 0) { 6750 return uintptr(0) 6751 } 6752 return Xmemcpy(tls, d, s, l+size_t(1)) 6753 } 6754 6755 func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ 6756 var p uintptr = Xmemchr(tls, s, 0, n) 6757 if p != 0 { 6758 return uint32((int32(p) - int32(s)) / 1) 6759 } 6760 return n 6761 } 6762 6763 func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ 6764 bp := tls.Alloc(32) 6765 defer tls.Free(32) 6766 6767 var a uintptr = s 6768 *(*[8]size_t)(unsafe.Pointer(bp /* byteset */)) = [8]size_t{0: size_t(0)} 6769 6770 if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { 6771 return size_t(0) 6772 } 6773 if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { 6774 for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { 6775 } 6776 return size_t((int32(s) - int32(a)) / 1) 6777 } 6778 6779 for ; *(*int8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint32(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4, size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; c++ { 6780 } 6781 for ; *(*int8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))*4))&(size_t(size_t(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint32(8)*uint32(unsafe.Sizeof(size_t(0)))))) != 0; s++ { 6782 } 6783 return size_t((int32(s) - int32(a)) / 1) 6784 } 6785 6786 func init() { 6787 *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_CurrentRuneLocale)) + 0)) = uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) // table.cpp.c:4092:41: 6788 } 6789 6790 var ts1 = "RuneMagi\x00NONE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" 6791 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data