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