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