musl_linux_s390x.go (192893B)
1 // Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_s390x.go -pkgname libc -static-locals-prefix _s -Iarch/s390x -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/__ctype_b_loc.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/locale/localeconv.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.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/gethostbyname_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/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.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 const ( /* pthread_impl.h:58:1: */ 355 DT_EXITING = 0 356 DT_JOINABLE = 1 357 DT_DETACHED = 2 358 ) 359 360 type ptrdiff_t = int64 /* <builtin>:3:26 */ 361 362 type size_t = uint64 /* <builtin>:9:23 */ 363 364 type wchar_t = int32 /* <builtin>:15:24 */ 365 366 type uint16_t = uint16 /* alltypes.h:113:25 */ 367 368 type uint32_t = uint32 /* alltypes.h:118:25 */ 369 370 type uint64_t = uint64 /* alltypes.h:123:25 */ 371 372 func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ 373 return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24 374 } 375 376 var table = [384]uint16{ 377 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 378 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 379 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 380 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 381 uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), 382 uint16(0x200), uint16(0x320), uint16(0x220), uint16(0x220), uint16(0x220), uint16(0x220), uint16(0x200), uint16(0x200), 383 uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), 384 uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), uint16(0x200), 385 uint16(0x160), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), 386 uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), 387 uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), uint16(0x8d8), 388 uint16(0x8d8), uint16(0x8d8), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), 389 uint16(0x4c0), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8d5), uint16(0x8c5), 390 uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), 391 uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), 392 uint16(0x8c5), uint16(0x8c5), uint16(0x8c5), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), 393 uint16(0x4c0), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8d6), uint16(0x8c6), 394 uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), 395 uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), 396 uint16(0x8c6), uint16(0x8c6), uint16(0x8c6), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x4c0), uint16(0x200), 397 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 398 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 399 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 400 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 401 } /* __ctype_b_loc.c:9:29 */ 402 403 var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */ 404 405 func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */ 406 return uintptr(unsafe.Pointer(&ptable)) 407 } 408 409 func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ 410 return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5)) 411 } 412 413 type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:330:9 */ 414 415 type locale_t = uintptr /* alltypes.h:330:32 */ 416 417 func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ 418 return Bool32(func() int32 { 419 if 0 != 0 { 420 return Xisalpha(tls, c) 421 } 422 return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) 423 }() != 0 || func() int32 { 424 if 0 != 0 { 425 return Xisdigit(tls, c) 426 } 427 return Bool32(uint32(c)-uint32('0') < uint32(10)) 428 }() != 0) 429 } 430 431 func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */ 432 return Xisalnum(tls, c) 433 } 434 435 func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */ 436 return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) 437 } 438 439 func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */ 440 return Xisalpha(tls, c) 441 } 442 443 func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */ 444 return Bool32(uint32(c)-uint32('0') < uint32(10)) 445 } 446 447 func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */ 448 return Xisdigit(tls, c) 449 } 450 451 func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */ 452 return Bool32(uint32(c)-uint32('a') < uint32(26)) 453 } 454 455 func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */ 456 return Xislower(tls, c) 457 } 458 459 func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ 460 return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) 461 } 462 463 func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */ 464 return Xisprint(tls, c) 465 } 466 467 func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */ 468 return Bool32(uint32(c)-uint32('A') < uint32(26)) 469 } 470 471 func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */ 472 return Xisupper(tls, c) 473 } 474 475 func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */ 476 return Bool32(func() int32 { 477 if 0 != 0 { 478 return Xisdigit(tls, c) 479 } 480 return Bool32(uint32(c)-uint32('0') < uint32(10)) 481 }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6)) 482 } 483 484 func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */ 485 return Xisxdigit(tls, c) 486 } 487 488 type off_t = int64 /* alltypes.h:149:16 */ 489 490 type ino_t = uint64 /* alltypes.h:154:25 */ 491 492 type dirent = struct { 493 d_ino ino_t 494 d_off off_t 495 d_reclen uint16 496 d_type uint8 497 d_name [256]uint8 498 _ [5]byte 499 } /* dirent.h:5:1 */ 500 501 type __dirstream = struct { 502 tell off_t 503 fd int32 504 buf_pos int32 505 buf_end int32 506 lock [1]int32 507 buf [2048]uint8 508 } /* dirent.h:20:9 */ 509 510 type DIR = __dirstream /* dirent.h:20:28 */ 511 512 type ssize_t = int64 /* alltypes.h:52:15 */ 513 514 type intptr_t = int64 /* alltypes.h:57:15 */ 515 516 type pid_t = int32 /* alltypes.h:222:13 */ 517 518 type uid_t = uint32 /* alltypes.h:232:18 */ 519 520 type gid_t = uint32 /* alltypes.h:237:18 */ 521 522 type useconds_t = uint32 /* alltypes.h:247:18 */ 523 524 type div_t = struct { 525 quot int32 526 rem int32 527 } /* stdlib.h:62:35 */ 528 type ldiv_t = struct { 529 quot int64 530 rem int64 531 } /* stdlib.h:63:36 */ 532 type lldiv_t = struct { 533 quot int64 534 rem int64 535 } /* stdlib.h:64:41 */ 536 537 func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */ 538 var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd) 539 Xfree(tls, dir) 540 return ret 541 } 542 543 type mode_t = uint32 /* alltypes.h:139:18 */ 544 545 type iovec = struct { 546 iov_base uintptr 547 iov_len size_t 548 } /* alltypes.h:342:1 */ 549 550 type flock = struct { 551 l_type int16 552 l_whence int16 553 _ [4]byte 554 l_start off_t 555 l_len off_t 556 l_pid pid_t 557 _ [4]byte 558 } /* fcntl.h:24:1 */ 559 560 type file_handle = struct { 561 _ [0]uint32 562 handle_bytes uint32 563 handle_type int32 564 } /* fcntl.h:167:1 */ 565 566 type f_owner_ex = struct { 567 __type int32 568 pid pid_t 569 } /* fcntl.h:172:1 */ 570 571 type syscall_arg_t = int64 /* syscall.h:22:14 */ 572 573 func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */ 574 var fd int32 575 var dir uintptr 576 577 if AssignInt32(&fd, Xopen(tls, name, 00|0200000|02000000, 0)) < 0 { 578 return uintptr(0) 579 } 580 if !(int32(AssignUintptr(&dir, Xcalloc(tls, uint64(1), uint64(unsafe.Sizeof(DIR{}))))) != 0) { 581 __syscall1(tls, int64(6), int64(fd)) 582 return uintptr(0) 583 } 584 (*DIR)(unsafe.Pointer(dir)).fd = fd 585 return dir 586 } 587 588 type max_align_t = struct { 589 __ll int64 590 __ld float64 591 } /* alltypes.h:28:54 */ 592 593 type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */ 594 595 func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */ 596 var de uintptr 597 598 if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end { 599 var len int32 = int32(__syscall3(tls, int64(220), int64((*DIR)(unsafe.Pointer(dir)).fd), int64(dir+24), int64(unsafe.Sizeof([2048]uint8{})))) 600 if len <= 0 { 601 if len < 0 && len != -2 { 602 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = -len 603 } 604 return uintptr(0) 605 } 606 (*DIR)(unsafe.Pointer(dir)).buf_end = len 607 (*DIR)(unsafe.Pointer(dir)).buf_pos = 0 608 } 609 de = dir + 24 + uintptr((*DIR)(unsafe.Pointer(dir)).buf_pos) 610 *(*int32)(unsafe.Pointer(dir + 12)) += int32((*dirent)(unsafe.Pointer(de)).d_reclen) 611 (*DIR)(unsafe.Pointer(dir)).tell = (*dirent)(unsafe.Pointer(de)).d_off 612 return de 613 } 614 615 type uintptr_t = uint64 /* alltypes.h:42:24 */ 616 617 type int8_t = int8 /* alltypes.h:83:25 */ 618 619 type int16_t = int16 /* alltypes.h:88:25 */ 620 621 type int32_t = int32 /* alltypes.h:93:25 */ 622 623 type int64_t = int64 /* alltypes.h:98:25 */ 624 625 type intmax_t = int64 /* alltypes.h:103:25 */ 626 627 type uint8_t = uint8 /* alltypes.h:108:25 */ 628 629 type uintmax_t = uint64 /* alltypes.h:133:25 */ 630 631 type int_fast8_t = int8_t /* stdint.h:22:16 */ 632 type int_fast64_t = int64_t /* stdint.h:23:17 */ 633 634 type int_least8_t = int8_t /* stdint.h:25:17 */ 635 type int_least16_t = int16_t /* stdint.h:26:17 */ 636 type int_least32_t = int32_t /* stdint.h:27:17 */ 637 type int_least64_t = int64_t /* stdint.h:28:17 */ 638 639 type uint_fast8_t = uint8_t /* stdint.h:30:17 */ 640 type uint_fast64_t = uint64_t /* stdint.h:31:18 */ 641 642 type uint_least8_t = uint8_t /* stdint.h:33:18 */ 643 type uint_least16_t = uint16_t /* stdint.h:34:18 */ 644 type uint_least32_t = uint32_t /* stdint.h:35:18 */ 645 type uint_least64_t = uint64_t /* stdint.h:36:18 */ 646 647 type int_fast16_t = int32_t /* stdint.h:1:17 */ 648 type int_fast32_t = int32_t /* stdint.h:2:17 */ 649 type uint_fast16_t = uint32_t /* stdint.h:3:18 */ 650 type uint_fast32_t = uint32_t /* stdint.h:4:18 */ 651 652 type _IO_FILE = struct { 653 flags uint32 654 _ [4]byte 655 rpos uintptr 656 rend uintptr 657 close uintptr 658 wend uintptr 659 wpos uintptr 660 mustbezero_1 uintptr 661 wbase uintptr 662 read uintptr 663 write uintptr 664 seek uintptr 665 buf uintptr 666 buf_size size_t 667 prev uintptr 668 next uintptr 669 fd int32 670 pipe_pid int32 671 lockcount int64 672 mode int32 673 lock int32 674 lbf int32 675 _ [4]byte 676 cookie uintptr 677 off off_t 678 getln_buf uintptr 679 mustbezero_2 uintptr 680 shend uintptr 681 shlim off_t 682 shcnt off_t 683 prev_locked uintptr 684 next_locked uintptr 685 locale uintptr 686 } /* alltypes.h:307:9 */ 687 688 type FILE = _IO_FILE /* alltypes.h:307:25 */ 689 690 type va_list = uintptr /* alltypes.h:313:27 */ 691 692 type _G_fpos64_t = struct { 693 _ [0]uint64 694 __opaque [16]uint8 695 } /* stdio.h:54:9 */ 696 697 type fpos_t = _G_fpos64_t /* stdio.h:58:3 */ 698 699 type float_t = float64 /* alltypes.h:17:16 */ 700 701 type double_t = float64 /* alltypes.h:22:16 */ 702 703 func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ 704 bp := tls.Alloc(4) 705 defer tls.Free(4) 706 707 // var __u struct {__f float32;} at bp, 4 708 709 *(*float32)(unsafe.Pointer(bp)) = __f 710 return *(*uint32)(unsafe.Pointer(bp)) 711 } 712 713 func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ 714 bp := tls.Alloc(8) 715 defer tls.Free(8) 716 717 // var __u struct {__f float64;} at bp, 8 718 719 *(*float64)(unsafe.Pointer(bp)) = __f 720 return *(*uint64)(unsafe.Pointer(bp)) 721 } 722 723 type __pthread = struct { 724 self uintptr 725 dtv uintptr 726 prev uintptr 727 next uintptr 728 sysinfo uintptr_t 729 canary uintptr_t 730 canary2 uintptr_t 731 tid int32 732 errno_val int32 733 detach_state int32 734 cancel int32 735 canceldisable uint8 736 cancelasync uint8 737 tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */ 738 _ [5]byte 739 map_base uintptr 740 map_size size_t 741 stack uintptr 742 stack_size size_t 743 guard_size size_t 744 result uintptr 745 cancelbuf uintptr 746 tsd uintptr 747 robust_list struct { 748 head uintptr 749 off int64 750 pending uintptr 751 } 752 timer_id int32 753 _ [4]byte 754 locale locale_t 755 killlock [1]int32 756 _ [4]byte 757 dlerror_buf uintptr 758 stdio_locks uintptr 759 canary_at_end uintptr_t 760 dtv_copy uintptr 761 } /* alltypes.h:260:9 */ 762 763 func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ 764 var c int32 765 var x int32 766 var y int64 767 var neg int32 = 0 768 769 c = func() int32 { 770 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 771 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 772 } 773 return X__shgetc(tls, f) 774 }() 775 if c == '+' || c == '-' { 776 neg = Bool32(c == '-') 777 c = func() int32 { 778 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 779 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 780 } 781 return X__shgetc(tls, f) 782 }() 783 if uint32(c-'0') >= 10 && pok != 0 { 784 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 785 (*FILE)(unsafe.Pointer(f)).rpos-- 786 } else { 787 } 788 } 789 } 790 if uint32(c-'0') >= 10 { 791 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 792 (*FILE)(unsafe.Pointer(f)).rpos-- 793 } else { 794 } 795 return -0x7fffffffffffffff - int64(1) 796 } 797 for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 { 798 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 799 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 800 } 801 return X__shgetc(tls, f) 802 }() { 803 x = 10*x + c - '0' 804 } 805 for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 { 806 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 807 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 808 } 809 return X__shgetc(tls, f) 810 }() { 811 y = int64(10)*y + int64(c) - int64('0') 812 } 813 for ; uint32(c-'0') < 10; c = func() int32 { 814 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 815 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 816 } 817 return X__shgetc(tls, f) 818 }() { 819 } 820 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 821 (*FILE)(unsafe.Pointer(f)).rpos-- 822 } else { 823 } 824 if neg != 0 { 825 return -y 826 } 827 return y 828 } 829 830 func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */ 831 bp := tls.Alloc(512) 832 defer tls.Free(512) 833 834 // var x [128]uint32_t at bp, 512 835 836 var i int32 837 var j int32 838 var k int32 839 var a int32 840 var z int32 841 var lrp int64 = int64(0) 842 var dc int64 = int64(0) 843 var e10 int64 = int64(0) 844 var lnz int32 = 0 845 var gotdig int32 = 0 846 var gotrad int32 = 0 847 var rp int32 848 var e2 int32 849 var emax int32 = -emin - bits + 3 850 var denormal int32 = 0 851 var y float64 852 var frac float64 = float64(0) 853 var bias float64 = float64(0) 854 855 j = 0 856 k = 0 857 858 // Don't let leading zeros consume buffer space 859 for ; c == '0'; c = func() int32 { 860 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 861 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 862 } 863 return X__shgetc(tls, f) 864 }() { 865 gotdig = 1 866 } 867 if c == '.' { 868 gotrad = 1 869 for c = func() int32 { 870 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 871 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 872 } 873 return X__shgetc(tls, f) 874 }(); c == '0'; c = func() int32 { 875 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 876 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 877 } 878 return X__shgetc(tls, f) 879 }() { 880 gotdig = 1 881 lrp-- 882 } 883 } 884 885 *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0) 886 for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 { 887 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 888 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 889 } 890 return X__shgetc(tls, f) 891 }() { 892 if c == '.' { 893 if gotrad != 0 { 894 break 895 } 896 gotrad = 1 897 lrp = dc 898 } else if k < 128-3 { 899 dc++ 900 if c != '0' { 901 lnz = int32(dc) 902 } 903 if j != 0 { 904 *(*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') 905 } else { 906 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0') 907 } 908 if PreIncInt32(&j, 1) == 9 { 909 k++ 910 j = 0 911 } 912 gotdig = 1 913 } else { 914 dc++ 915 if c != '0' { 916 lnz = (128 - 4) * 9 917 *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1) 918 } 919 } 920 } 921 if !(gotrad != 0) { 922 lrp = dc 923 } 924 925 if gotdig != 0 && c|32 == 'e' { 926 e10 = scanexp(tls, f, pok) 927 if e10 == -0x7fffffffffffffff-int64(1) { 928 if pok != 0 { 929 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 930 (*FILE)(unsafe.Pointer(f)).rpos-- 931 } else { 932 } 933 } else { 934 X__shlim(tls, f, int64(0)) 935 return float64(0) 936 } 937 e10 = int64(0) 938 } 939 lrp = lrp + e10 940 } else if c >= 0 { 941 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 942 (*FILE)(unsafe.Pointer(f)).rpos-- 943 } else { 944 } 945 } 946 if !(gotdig != 0) { 947 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 948 X__shlim(tls, f, int64(0)) 949 return float64(0) 950 } 951 952 // Handle zero specially to avoid nasty special cases later 953 if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) { 954 return float64(sign) * 0.0 955 } 956 957 // Optimize small integers (w/no exponent) and over/under-flow 958 if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) { 959 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) 960 } 961 if lrp > int64(-emin/2) { 962 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 963 return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 964 } 965 if lrp < int64(emin-2*53) { 966 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 967 return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 968 } 969 970 // Align incomplete final B1B digit 971 if j != 0 { 972 for ; j < 9; j++ { 973 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10) 974 } 975 k++ 976 j = 0 977 } 978 979 a = 0 980 z = k 981 e2 = 0 982 rp = int32(lrp) 983 984 // Optimize small to mid-size integers (even in exp. notation) 985 if lnz < 9 && lnz <= rp && rp < 18 { 986 if rp == 9 { 987 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) 988 } 989 if rp < 9 { 990 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp]) 991 } 992 var bitlim int32 = bits - 3*(rp-9) 993 if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) { 994 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10]) 995 } 996 } 997 998 // Drop trailing zeros 999 for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- { 1000 } 1001 1002 // Align radix point to B1B digit boundary 1003 if rp%9 != 0 { 1004 var rpm9 int32 1005 if rp >= 0 { 1006 rpm9 = rp % 9 1007 } else { 1008 rpm9 = rp%9 + 9 1009 } 1010 var p10 int32 = _sp10s[8-rpm9] 1011 var carry uint32_t = uint32_t(0) 1012 for k = a; k != z; k++ { 1013 var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10) 1014 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry 1015 carry = uint32_t(1000000000/p10) * tmp 1016 if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 1017 a = (a + 1) & (128 - 1) 1018 rp = rp - 9 1019 } 1020 } 1021 if carry != 0 { 1022 *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry 1023 } 1024 rp = rp + (9 - rpm9) 1025 } 1026 1027 // Upscale until desired number of bits are left of radix point 1028 for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] { 1029 var carry uint32_t = uint32_t(0) 1030 e2 = e2 - 29 1031 for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) { 1032 var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry) 1033 if tmp > uint64(1000000000) { 1034 carry = uint32_t(tmp / uint64(1000000000)) 1035 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000)) 1036 } else { 1037 carry = uint32_t(0) 1038 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp) 1039 } 1040 if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 1041 z = k 1042 } 1043 if k == a { 1044 break 1045 } 1046 } 1047 if carry != 0 { 1048 rp = rp + 9 1049 a = (a - 1) & (128 - 1) 1050 if a == z { 1051 z = (z - 1) & (128 - 1) 1052 *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) 1053 } 1054 *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry 1055 } 1056 } 1057 1058 // Downscale until exactly number of bits are left of radix point 1059 for { 1060 var carry uint32_t = uint32_t(0) 1061 var sh int32 = 1 1062 for i = 0; i < 2; i++ { 1063 k = (a + i) & (128 - 1) 1064 if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] { 1065 i = 2 1066 break 1067 } 1068 if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] { 1069 break 1070 } 1071 } 1072 if i == 2 && rp == 9*2 { 1073 break 1074 } 1075 // FIXME: find a way to compute optimal sh 1076 if rp > 9+9*2 { 1077 sh = 9 1078 } 1079 e2 = e2 + sh 1080 for k = a; k != z; k = (k + 1) & (128 - 1) { 1081 var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1) 1082 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry 1083 carry = uint32_t(int32(1000000000)>>sh) * tmp 1084 if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 1085 a = (a + 1) & (128 - 1) 1086 i-- 1087 rp = rp - 9 1088 } 1089 } 1090 if carry != 0 { 1091 if (z+1)&(128-1) != a { 1092 *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry 1093 z = (z + 1) & (128 - 1) 1094 } else { 1095 *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1) 1096 } 1097 } 1098 } 1099 1100 // Assemble desired bits into floating point variable 1101 for y = float64(AssignInt32(&i, 0)); i < 2; i++ { 1102 if (a+i)&(128-1) == z { 1103 *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0) 1104 } 1105 y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))) 1106 } 1107 1108 y = y * float64(sign) 1109 1110 // Limit precision for denormal results 1111 if bits > 53+e2-emin { 1112 bits = 53 + e2 - emin 1113 if bits < 0 { 1114 bits = 0 1115 } 1116 denormal = 1 1117 } 1118 1119 // Calculate bias term to force rounding, move out lower bits 1120 if bits < 53 { 1121 bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y) 1122 frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits)) 1123 y = y - frac 1124 y = y + bias 1125 } 1126 1127 // Process tail of decimal input so it can affect rounding 1128 if (a+i)&(128-1) != z { 1129 var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) 1130 if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) { 1131 frac = frac + 0.25*float64(sign) 1132 } else if t > uint32_t(500000000) { 1133 frac = frac + 0.75*float64(sign) 1134 } else if t == uint32_t(500000000) { 1135 if (a+i+1)&(128-1) == z { 1136 frac = frac + 0.5*float64(sign) 1137 } else { 1138 frac = frac + 0.75*float64(sign) 1139 } 1140 } 1141 if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) { 1142 frac += 1 1143 } 1144 } 1145 1146 y = y + frac 1147 y = y - bias 1148 1149 if (e2+53)&0x7fffffff > emax-5 { 1150 if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 { 1151 if denormal != 0 && bits == 53+e2-emin { 1152 denormal = 0 1153 } 1154 y = y * 0.5 1155 e2++ 1156 } 1157 if e2+53 > emax || denormal != 0 && frac != 0 { 1158 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1159 } 1160 } 1161 1162 return Xscalbnl(tls, y, e2) 1163 } 1164 1165 var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */ 1166 var _sp10s = [8]int32{10, 100, 1000, 10000, 1167 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */ 1168 1169 func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */ 1170 var x uint32_t = uint32_t(0) 1171 var y float64 = float64(0) 1172 var scale float64 = float64(1) 1173 var bias float64 = float64(0) 1174 var gottail int32 = 0 1175 var gotrad int32 = 0 1176 var gotdig int32 = 0 1177 var rp int64 = int64(0) 1178 var dc int64 = int64(0) 1179 var e2 int64 = int64(0) 1180 var d int32 1181 var c int32 1182 1183 c = func() int32 { 1184 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1185 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1186 } 1187 return X__shgetc(tls, f) 1188 }() 1189 1190 // Skip leading zeros 1191 for ; c == '0'; c = func() int32 { 1192 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1193 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1194 } 1195 return X__shgetc(tls, f) 1196 }() { 1197 gotdig = 1 1198 } 1199 1200 if c == '.' { 1201 gotrad = 1 1202 c = func() int32 { 1203 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1204 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1205 } 1206 return X__shgetc(tls, f) 1207 }() 1208 // Count zeros after the radix point before significand 1209 rp = int64(0) 1210 __1: 1211 if !(c == '0') { 1212 goto __3 1213 } 1214 gotdig = 1 1215 goto __2 1216 __2: 1217 c = func() int32 { 1218 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1219 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1220 } 1221 return X__shgetc(tls, f) 1222 }() 1223 rp-- 1224 goto __1 1225 goto __3 1226 __3: 1227 } 1228 1229 for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 { 1230 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1231 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1232 } 1233 return X__shgetc(tls, f) 1234 }() { 1235 if c == '.' { 1236 if gotrad != 0 { 1237 break 1238 } 1239 rp = dc 1240 gotrad = 1 1241 } else { 1242 gotdig = 1 1243 if c > '9' { 1244 d = c | 32 + 10 - 'a' 1245 } else { 1246 d = c - '0' 1247 } 1248 if dc < int64(8) { 1249 x = x*uint32_t(16) + uint32_t(d) 1250 } else if dc < int64(53/4+1) { 1251 y = y + float64(d)*AssignDivFloat64(&scale, float64(16)) 1252 } else if d != 0 && !(gottail != 0) { 1253 y = y + 0.5*scale 1254 gottail = 1 1255 } 1256 dc++ 1257 } 1258 } 1259 if !(gotdig != 0) { 1260 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1261 (*FILE)(unsafe.Pointer(f)).rpos-- 1262 } else { 1263 } 1264 if pok != 0 { 1265 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1266 (*FILE)(unsafe.Pointer(f)).rpos-- 1267 } else { 1268 } 1269 if gotrad != 0 { 1270 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1271 (*FILE)(unsafe.Pointer(f)).rpos-- 1272 } else { 1273 } 1274 } 1275 } else { 1276 X__shlim(tls, f, int64(0)) 1277 } 1278 return float64(sign) * 0.0 1279 } 1280 if !(gotrad != 0) { 1281 rp = dc 1282 } 1283 for dc < int64(8) { 1284 x = x * uint32_t(16) 1285 dc++ 1286 } 1287 if c|32 == 'p' { 1288 e2 = scanexp(tls, f, pok) 1289 if e2 == -0x7fffffffffffffff-int64(1) { 1290 if pok != 0 { 1291 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1292 (*FILE)(unsafe.Pointer(f)).rpos-- 1293 } else { 1294 } 1295 } else { 1296 X__shlim(tls, f, int64(0)) 1297 return float64(0) 1298 } 1299 e2 = int64(0) 1300 } 1301 } else { 1302 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1303 (*FILE)(unsafe.Pointer(f)).rpos-- 1304 } else { 1305 } 1306 } 1307 e2 = e2 + (int64(4)*rp - int64(32)) 1308 1309 if !(x != 0) { 1310 return float64(sign) * 0.0 1311 } 1312 if e2 > int64(-emin) { 1313 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1314 return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 1315 } 1316 if e2 < int64(emin-2*53) { 1317 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1318 return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 1319 } 1320 1321 for x < 0x80000000 { 1322 if y >= 0.5 { 1323 x = x + (x + uint32_t(1)) 1324 y = y + (y - float64(1)) 1325 } else { 1326 x = x + x 1327 y = y + y 1328 } 1329 e2-- 1330 } 1331 1332 if int64(bits) > int64(32)+e2-int64(emin) { 1333 bits = int32(int64(32) + e2 - int64(emin)) 1334 if bits < 0 { 1335 bits = 0 1336 } 1337 } 1338 1339 if bits < 53 { 1340 bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign)) 1341 } 1342 1343 if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) { 1344 x++ 1345 y = float64(0) 1346 } 1347 1348 y = bias + float64(sign)*float64(x) + float64(sign)*y 1349 y = y - bias 1350 1351 if !(y != 0) { 1352 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1353 } 1354 1355 return Xscalbnl(tls, y, int32(e2)) 1356 } 1357 1358 func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */ 1359 var sign int32 = 1 1360 var i size_t 1361 var bits int32 1362 var emin int32 1363 var c int32 1364 1365 switch prec { 1366 case 0: 1367 bits = 24 1368 emin = -125 - bits 1369 break 1370 case 1: 1371 bits = 53 1372 emin = -1021 - bits 1373 break 1374 case 2: 1375 bits = 53 1376 emin = -1021 - bits 1377 break 1378 default: 1379 return float64(0) 1380 } 1381 1382 for __isspace(tls, AssignInt32(&c, func() int32 { 1383 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1384 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1385 } 1386 return X__shgetc(tls, f) 1387 }())) != 0 { 1388 } 1389 1390 if c == '+' || c == '-' { 1391 sign = sign - 2*Bool32(c == '-') 1392 c = func() int32 { 1393 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1394 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1395 } 1396 return X__shgetc(tls, f) 1397 }() 1398 } 1399 1400 for i = uint64(0); i < uint64(8) && c|32 == int32(*(*uint8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i)))); i++ { 1401 if i < uint64(7) { 1402 c = func() int32 { 1403 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1404 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1405 } 1406 return X__shgetc(tls, f) 1407 }() 1408 } 1409 } 1410 if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 { 1411 if i != uint64(8) { 1412 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1413 (*FILE)(unsafe.Pointer(f)).rpos-- 1414 } else { 1415 } 1416 if pok != 0 { 1417 for ; i > uint64(3); i-- { 1418 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1419 (*FILE)(unsafe.Pointer(f)).rpos-- 1420 } else { 1421 } 1422 } 1423 } 1424 } 1425 return float64(float32(sign) * X__builtin_inff(tls)) 1426 } 1427 if !(i != 0) { 1428 for i = uint64(0); i < uint64(3) && c|32 == int32(*(*uint8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i)))); i++ { 1429 if i < uint64(2) { 1430 c = func() int32 { 1431 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1432 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1433 } 1434 return X__shgetc(tls, f) 1435 }() 1436 } 1437 } 1438 } 1439 if i == uint64(3) { 1440 if func() int32 { 1441 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1442 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1443 } 1444 return X__shgetc(tls, f) 1445 }() != '(' { 1446 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1447 (*FILE)(unsafe.Pointer(f)).rpos-- 1448 } else { 1449 } 1450 return float64(X__builtin_nanf(tls, ts+13)) 1451 } 1452 for i = uint64(1); ; i++ { 1453 c = func() int32 { 1454 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1455 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1456 } 1457 return X__shgetc(tls, f) 1458 }() 1459 if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' { 1460 continue 1461 } 1462 if c == ')' { 1463 return float64(X__builtin_nanf(tls, ts+13)) 1464 } 1465 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1466 (*FILE)(unsafe.Pointer(f)).rpos-- 1467 } else { 1468 } 1469 if !(pok != 0) { 1470 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1471 X__shlim(tls, f, int64(0)) 1472 return float64(0) 1473 } 1474 for PostDecUint64(&i, 1) != 0 { 1475 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1476 (*FILE)(unsafe.Pointer(f)).rpos-- 1477 } else { 1478 } 1479 } 1480 return float64(X__builtin_nanf(tls, ts+13)) 1481 } 1482 return float64(X__builtin_nanf(tls, ts+13)) 1483 } 1484 1485 if i != 0 { 1486 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1487 (*FILE)(unsafe.Pointer(f)).rpos-- 1488 } else { 1489 } 1490 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1491 X__shlim(tls, f, int64(0)) 1492 return float64(0) 1493 } 1494 1495 if c == '0' { 1496 c = func() int32 { 1497 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1498 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1499 } 1500 return X__shgetc(tls, f) 1501 }() 1502 if c|32 == 'x' { 1503 return hexfloat(tls, f, bits, emin, sign, pok) 1504 } 1505 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1506 (*FILE)(unsafe.Pointer(f)).rpos-- 1507 } else { 1508 } 1509 c = '0' 1510 } 1511 1512 return decfloat(tls, f, c, bits, emin, sign, pok) 1513 } 1514 1515 // Lookup table for digit values. -1==255>=36 -> invalid 1516 var table1 = [257]uint8{Uint8FromInt32(-1), 1517 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), 1518 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), 1519 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), 1520 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), 1521 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), 1522 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), 1523 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), 1524 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), 1525 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), 1526 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), 1527 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), 1528 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), 1529 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), 1530 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), 1531 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), 1532 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), 1533 } /* intscan.c:7:28 */ 1534 1535 func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */ 1536 var val uintptr 1537 var c int32 1538 var neg int32 1539 var x uint32 1540 var y uint64 1541 var bs int32 1542 val = uintptr(unsafe.Pointer(&table1)) + uintptr(1) 1543 neg = 0 1544 if !(base > uint32(36) || base == uint32(1)) { 1545 goto __1 1546 } 1547 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1548 return uint64(0) 1549 __1: 1550 ; 1551 __2: 1552 if !(__isspace(tls, AssignInt32(&c, func() int32 { 1553 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1554 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1555 } 1556 return X__shgetc(tls, f) 1557 }())) != 0) { 1558 goto __3 1559 } 1560 goto __2 1561 __3: 1562 ; 1563 if !(c == '+' || c == '-') { 1564 goto __4 1565 } 1566 neg = -Bool32(c == '-') 1567 c = func() int32 { 1568 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1569 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1570 } 1571 return X__shgetc(tls, f) 1572 }() 1573 __4: 1574 ; 1575 if !((base == uint32(0) || base == uint32(16)) && c == '0') { 1576 goto __5 1577 } 1578 c = func() int32 { 1579 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1580 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1581 } 1582 return X__shgetc(tls, f) 1583 }() 1584 if !(c|32 == 'x') { 1585 goto __7 1586 } 1587 c = func() int32 { 1588 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1589 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1590 } 1591 return X__shgetc(tls, f) 1592 }() 1593 if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) { 1594 goto __9 1595 } 1596 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1597 (*FILE)(unsafe.Pointer(f)).rpos-- 1598 } else { 1599 } 1600 if !(pok != 0) { 1601 goto __10 1602 } 1603 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1604 (*FILE)(unsafe.Pointer(f)).rpos-- 1605 } else { 1606 } 1607 goto __11 1608 __10: 1609 X__shlim(tls, f, int64(0)) 1610 __11: 1611 ; 1612 return uint64(0) 1613 __9: 1614 ; 1615 base = uint32(16) 1616 goto __8 1617 __7: 1618 if !(base == uint32(0)) { 1619 goto __12 1620 } 1621 base = uint32(8) 1622 __12: 1623 ; 1624 __8: 1625 ; 1626 goto __6 1627 __5: 1628 if !(base == uint32(0)) { 1629 goto __13 1630 } 1631 base = uint32(10) 1632 __13: 1633 ; 1634 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) { 1635 goto __14 1636 } 1637 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1638 (*FILE)(unsafe.Pointer(f)).rpos-- 1639 } else { 1640 } 1641 X__shlim(tls, f, int64(0)) 1642 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1643 return uint64(0) 1644 __14: 1645 ; 1646 __6: 1647 ; 1648 if !(base == uint32(10)) { 1649 goto __15 1650 } 1651 x = uint32(0) 1652 __17: 1653 if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) { 1654 goto __19 1655 } 1656 x = x*uint32(10) + uint32(c-'0') 1657 goto __18 1658 __18: 1659 c = func() int32 { 1660 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1661 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1662 } 1663 return X__shgetc(tls, f) 1664 }() 1665 goto __17 1666 goto __19 1667 __19: 1668 ; 1669 y = uint64(x) 1670 __20: 1671 if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) { 1672 goto __22 1673 } 1674 y = y*uint64(10) + uint64(c-'0') 1675 goto __21 1676 __21: 1677 c = func() int32 { 1678 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1679 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1680 } 1681 return X__shgetc(tls, f) 1682 }() 1683 goto __20 1684 goto __22 1685 __22: 1686 ; 1687 if !(uint32(c-'0') >= 10) { 1688 goto __23 1689 } 1690 goto done 1691 __23: 1692 ; 1693 goto __16 1694 __15: 1695 if !!(base&(base-uint32(1)) != 0) { 1696 goto __24 1697 } 1698 bs = int32(*(*uint8)(unsafe.Pointer(ts + 14 + uintptr(uint32(0x17)*base>>5&uint32(7))))) 1699 x = uint32(0) 1700 __26: 1701 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) { 1702 goto __28 1703 } 1704 x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1705 goto __27 1706 __27: 1707 c = func() int32 { 1708 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1709 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1710 } 1711 return X__shgetc(tls, f) 1712 }() 1713 goto __26 1714 goto __28 1715 __28: 1716 ; 1717 y = uint64(x) 1718 __29: 1719 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) { 1720 goto __31 1721 } 1722 y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1723 goto __30 1724 __30: 1725 c = func() int32 { 1726 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1727 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1728 } 1729 return X__shgetc(tls, f) 1730 }() 1731 goto __29 1732 goto __31 1733 __31: 1734 ; 1735 goto __25 1736 __24: 1737 x = uint32(0) 1738 __32: 1739 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) { 1740 goto __34 1741 } 1742 x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1743 goto __33 1744 __33: 1745 c = func() int32 { 1746 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1747 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1748 } 1749 return X__shgetc(tls, f) 1750 }() 1751 goto __32 1752 goto __34 1753 __34: 1754 ; 1755 y = uint64(x) 1756 __35: 1757 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))))) { 1758 goto __37 1759 } 1760 y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1761 goto __36 1762 __36: 1763 c = func() int32 { 1764 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1765 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1766 } 1767 return X__shgetc(tls, f) 1768 }() 1769 goto __35 1770 goto __37 1771 __37: 1772 ; 1773 __25: 1774 ; 1775 __16: 1776 ; 1777 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { 1778 goto __38 1779 } 1780 __39: 1781 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { 1782 goto __41 1783 } 1784 goto __40 1785 __40: 1786 c = func() int32 { 1787 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1788 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1789 } 1790 return X__shgetc(tls, f) 1791 }() 1792 goto __39 1793 goto __41 1794 __41: 1795 ; 1796 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1797 y = lim 1798 if !(lim&uint64(1) != 0) { 1799 goto __42 1800 } 1801 neg = 0 1802 __42: 1803 ; 1804 __38: 1805 ; 1806 done: 1807 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1808 (*FILE)(unsafe.Pointer(f)).rpos-- 1809 } else { 1810 } 1811 if !(y >= lim) { 1812 goto __43 1813 } 1814 if !(!(lim&uint64(1) != 0) && !(neg != 0)) { 1815 goto __44 1816 } 1817 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1818 return lim - uint64(1) 1819 goto __45 1820 __44: 1821 if !(y > lim) { 1822 goto __46 1823 } 1824 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1825 return lim 1826 __46: 1827 ; 1828 __45: 1829 ; 1830 __43: 1831 ; 1832 return y ^ uint64(neg) - uint64(neg) 1833 } 1834 1835 // The shcnt field stores the number of bytes read so far, offset by 1836 // the value of buf-rpos at the last function call (__shlim or __shgetc), 1837 // so that between calls the inline shcnt macro can add rpos-buf to get 1838 // the actual count. 1839 1840 func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */ 1841 (*FILE)(unsafe.Pointer(f)).shlim = lim 1842 (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1 1843 // If lim is nonzero, rend must be a valid pointer. 1844 if lim != 0 && (int64((*FILE)(unsafe.Pointer(f)).rend)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 > lim { 1845 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr(lim) 1846 } else { 1847 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend 1848 } 1849 } 1850 1851 func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */ 1852 var c int32 1853 var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 1854 if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 { 1855 (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 + cnt 1856 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos 1857 (*FILE)(unsafe.Pointer(f)).shlim = int64(-1) 1858 return -1 1859 } 1860 cnt++ 1861 if (*FILE)(unsafe.Pointer(f)).shlim != 0 && (int64((*FILE)(unsafe.Pointer(f)).rend)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 > (*FILE)(unsafe.Pointer(f)).shlim-cnt { 1862 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr((*FILE)(unsafe.Pointer(f)).shlim-cnt) 1863 } else { 1864 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend 1865 } 1866 (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 + cnt 1867 if (*FILE)(unsafe.Pointer(f)).rpos <= (*FILE)(unsafe.Pointer(f)).buf { 1868 *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).rpos + UintptrFromInt32(-1))) = uint8(c) 1869 } 1870 return c 1871 } 1872 1873 type lconv = struct { 1874 decimal_point uintptr 1875 thousands_sep uintptr 1876 grouping uintptr 1877 int_curr_symbol uintptr 1878 currency_symbol uintptr 1879 mon_decimal_point uintptr 1880 mon_thousands_sep uintptr 1881 mon_grouping uintptr 1882 positive_sign uintptr 1883 negative_sign uintptr 1884 int_frac_digits uint8 1885 frac_digits uint8 1886 p_cs_precedes uint8 1887 p_sep_by_space uint8 1888 n_cs_precedes uint8 1889 n_sep_by_space uint8 1890 p_sign_posn uint8 1891 n_sign_posn uint8 1892 int_p_cs_precedes uint8 1893 int_p_sep_by_space uint8 1894 int_n_cs_precedes uint8 1895 int_n_sep_by_space uint8 1896 int_p_sign_posn uint8 1897 int_n_sign_posn uint8 1898 _ [2]byte 1899 } /* locale.h:24:1 */ 1900 1901 // Support signed or unsigned plain-char 1902 1903 // Implementation choices... 1904 1905 // Arbitrary numbers... 1906 1907 // POSIX/SUS requirements follow. These numbers come directly 1908 // from SUS and have nothing to do with the host system. 1909 1910 var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */ 1911 1912 func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */ 1913 return uintptr(unsafe.Pointer(&posix_lconv)) 1914 } 1915 1916 func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */ 1917 bp := tls.Alloc(8) 1918 defer tls.Free(8) 1919 1920 *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) { 1921 *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 1922 return r 1923 }() 1924 var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) 1925 if !(e != 0) { 1926 if *(*uint64_t)(unsafe.Pointer(bp))<<1 != 0 { 1927 return 3 1928 } 1929 return 2 1930 } 1931 if e == 0x7ff { 1932 if *(*uint64_t)(unsafe.Pointer(bp))<<12 != 0 { 1933 return 0 1934 } 1935 return 1 1936 } 1937 return 4 1938 } 1939 1940 func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */ 1941 bp := tls.Alloc(4) 1942 defer tls.Free(4) 1943 1944 *(*struct{ f float32 })(unsafe.Pointer(bp)) = func() (r struct{ f float32 }) { 1945 *(*float32)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 1946 return r 1947 }() 1948 var e int32 = int32(*(*uint32_t)(unsafe.Pointer(bp)) >> 23 & uint32_t(0xff)) 1949 if !(e != 0) { 1950 if *(*uint32_t)(unsafe.Pointer(bp))<<1 != 0 { 1951 return 3 1952 } 1953 return 2 1954 } 1955 if e == 0xff { 1956 if *(*uint32_t)(unsafe.Pointer(bp))<<9 != 0 { 1957 return 0 1958 } 1959 return 1 1960 } 1961 return 4 1962 } 1963 1964 func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */ 1965 return X__fpclassify(tls, x) 1966 } 1967 1968 func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */ 1969 return Xcopysign(tls, x, y) 1970 } 1971 1972 func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */ 1973 return Xfabs(tls, x) 1974 } 1975 1976 func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */ 1977 return Xfmod(tls, x, y) 1978 } 1979 1980 func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ 1981 return X__builtin_nanf(tls, ts+13) 1982 } 1983 1984 var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */ 1985 1986 func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ 1987 bp := tls.Alloc(8) 1988 defer tls.Free(8) 1989 1990 *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) { 1991 *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 1992 return r 1993 }() 1994 var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) 1995 var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63) 1996 var y double_t 1997 1998 if e >= 0x3ff+52 { 1999 return x 2000 } 2001 if s != 0 { 2002 y = x - toint + toint 2003 } else { 2004 y = x + toint - toint 2005 } 2006 if y == float64(0) { 2007 if s != 0 { 2008 return -Float64FromFloat64(0.0) 2009 } 2010 return float64(0) 2011 } 2012 return y 2013 } 2014 2015 func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ 2016 bp := tls.Alloc(8) 2017 defer tls.Free(8) 2018 2019 // var u struct {f float64;} at bp, 8 2020 2021 var y double_t = x 2022 2023 if n > 1023 { 2024 y = y * 0x1p1023 2025 n = n - 1023 2026 if n > 1023 { 2027 y = y * 0x1p1023 2028 n = n - 1023 2029 if n > 1023 { 2030 n = 1023 2031 } 2032 } 2033 } else if n < -1022 { 2034 // make sure final n < -53 to avoid double 2035 // rounding in the subnormal range 2036 y = y * (float64(0x1p-1022) * 0x1p53) 2037 n = n + (1022 - 53) 2038 if n < -1022 { 2039 y = y * (float64(0x1p-1022) * 0x1p53) 2040 n = n + (1022 - 53) 2041 if n < -1022 { 2042 n = -1022 2043 } 2044 } 2045 } 2046 *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52 2047 x = y * *(*float64)(unsafe.Pointer(bp)) 2048 return x 2049 } 2050 2051 func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ 2052 return Xscalbn(tls, x, n) 2053 } 2054 2055 // Support signed or unsigned plain-char 2056 2057 // Implementation choices... 2058 2059 // Arbitrary numbers... 2060 2061 // POSIX/SUS requirements follow. These numbers come directly 2062 // from SUS and have nothing to do with the host system. 2063 2064 type __locale_map = struct { 2065 __map uintptr 2066 map_size size_t 2067 name [24]uint8 2068 next uintptr 2069 } /* alltypes.h:330:9 */ 2070 2071 type tls_module = struct { 2072 next uintptr 2073 image uintptr 2074 len size_t 2075 size size_t 2076 align size_t 2077 offset size_t 2078 } /* libc.h:14:1 */ 2079 2080 type __libc = struct { 2081 can_do_threads uint8 2082 threaded uint8 2083 secure uint8 2084 need_locks int8 2085 threads_minus_1 int32 2086 auxv uintptr 2087 tls_head uintptr 2088 tls_size size_t 2089 tls_align size_t 2090 tls_cnt size_t 2091 page_size size_t 2092 global_locale struct{ cat [6]uintptr } 2093 } /* libc.h:20:1 */ 2094 2095 type time_t = int64 /* alltypes.h:72:16 */ 2096 2097 type clockid_t = int32 /* alltypes.h:201:13 */ 2098 2099 type timespec = struct { 2100 tv_sec time_t 2101 tv_nsec int64 2102 } /* alltypes.h:216:1 */ 2103 2104 type pthread_t = uintptr /* alltypes.h:260:26 */ 2105 2106 type pthread_once_t = int32 /* alltypes.h:266:13 */ 2107 2108 type pthread_key_t = uint32 /* alltypes.h:271:18 */ 2109 2110 type pthread_spinlock_t = int32 /* alltypes.h:276:13 */ 2111 2112 type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:281:37 */ 2113 2114 type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:286:37 */ 2115 2116 type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:291:37 */ 2117 2118 type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:296:40 */ 2119 2120 type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:336:9 */ 2121 2122 type sigset_t = __sigset_t /* alltypes.h:336:71 */ 2123 2124 type pthread_attr_t = struct { 2125 __u struct { 2126 _ [0]uint64 2127 __i [14]int32 2128 } 2129 } /* alltypes.h:359:147 */ 2130 2131 type pthread_mutex_t = struct { 2132 __u struct { 2133 _ [0]uint64 2134 __i [10]int32 2135 } 2136 } /* alltypes.h:364:157 */ 2137 2138 type pthread_cond_t = struct { 2139 __u struct { 2140 _ [0]uint64 2141 __i [12]int32 2142 } 2143 } /* alltypes.h:374:112 */ 2144 2145 type pthread_rwlock_t = struct { 2146 __u struct { 2147 _ [0]uint64 2148 __i [14]int32 2149 } 2150 } /* alltypes.h:384:139 */ 2151 2152 type pthread_barrier_t = struct { 2153 __u struct { 2154 _ [0]uint64 2155 __i [8]int32 2156 } 2157 } /* alltypes.h:389:137 */ 2158 2159 type sched_param = struct { 2160 sched_priority int32 2161 __reserved1 int32 2162 __reserved2 [2]struct { 2163 __reserved1 time_t 2164 __reserved2 int64 2165 } 2166 __reserved3 int32 2167 _ [4]byte 2168 } /* sched.h:19:1 */ 2169 2170 type timer_t = uintptr /* alltypes.h:196:14 */ 2171 2172 type clock_t = int64 /* alltypes.h:206:14 */ 2173 2174 type tm = struct { 2175 tm_sec int32 2176 tm_min int32 2177 tm_hour int32 2178 tm_mday int32 2179 tm_mon int32 2180 tm_year int32 2181 tm_wday int32 2182 tm_yday int32 2183 tm_isdst int32 2184 _ [4]byte 2185 tm_gmtoff int64 2186 tm_zone uintptr 2187 } /* time.h:38:1 */ 2188 2189 type itimerspec = struct { 2190 it_interval struct { 2191 tv_sec time_t 2192 tv_nsec int64 2193 } 2194 it_value struct { 2195 tv_sec time_t 2196 tv_nsec int64 2197 } 2198 } /* time.h:80:1 */ 2199 2200 type sigevent = struct { 2201 sigev_value struct { 2202 _ [0]uint64 2203 sival_int int32 2204 _ [4]byte 2205 } 2206 sigev_signo int32 2207 sigev_notify int32 2208 sigev_notify_function uintptr 2209 sigev_notify_attributes uintptr 2210 __pad [32]uint8 2211 } /* time.h:107:1 */ 2212 2213 type __ptcb = struct { 2214 __f uintptr 2215 __x uintptr 2216 __next uintptr 2217 } /* alltypes.h:260:9 */ 2218 2219 type sigaltstack = struct { 2220 ss_sp uintptr 2221 ss_flags int32 2222 _ [4]byte 2223 ss_size size_t 2224 } /* signal.h:44:9 */ 2225 2226 type stack_t = sigaltstack /* signal.h:44:28 */ 2227 2228 type greg_t = uint64 /* signal.h:11:23 */ 2229 type gregset_t = [27]uint64 /* signal.h:11:31 */ 2230 2231 type fpreg_t = struct{ d float64 } /* signal.h:21:3 */ 2232 2233 type fpregset_t = struct { 2234 fpc uint32 2235 _ [4]byte 2236 fprs [16]fpreg_t 2237 } /* signal.h:26:3 */ 2238 2239 type mcontext_t = struct { 2240 psw struct { 2241 mask uint64 2242 addr uint64 2243 } 2244 gregs [16]uint64 2245 aregs [16]uint32 2246 fpregs fpregset_t 2247 } /* signal.h:34:3 */ 2248 2249 type sigcontext = struct { 2250 oldmask [1]uint64 2251 sregs uintptr 2252 } /* signal.h:36:1 */ 2253 2254 type __ucontext = struct { 2255 uc_flags uint64 2256 uc_link uintptr 2257 uc_stack stack_t 2258 uc_mcontext mcontext_t 2259 uc_sigmask sigset_t 2260 } /* signal.h:67:9 */ 2261 2262 type ucontext_t = __ucontext /* signal.h:73:3 */ 2263 2264 type sigval = struct { 2265 _ [0]uint64 2266 sival_int int32 2267 _ [4]byte 2268 } /* time.h:107:1 */ 2269 2270 type siginfo_t = struct { 2271 si_signo int32 2272 si_errno int32 2273 si_code int32 2274 _ [4]byte 2275 __si_fields struct { 2276 _ [0]uint64 2277 __pad [112]uint8 2278 } 2279 } /* signal.h:145:3 */ 2280 2281 type sigaction = struct { 2282 __sa_handler struct{ sa_handler uintptr } 2283 sa_mask sigset_t 2284 sa_flags int32 2285 _ [4]byte 2286 sa_restorer uintptr 2287 } /* signal.h:167:1 */ 2288 2289 type sig_t = uintptr /* signal.h:251:14 */ 2290 2291 type sig_atomic_t = int32 /* signal.h:269:13 */ 2292 2293 func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:2:19: */ 2294 panic(`arch/s390x/atomic_arch.h:4:2: assembler statements not supported`) 2295 return t 2296 } 2297 2298 func a_barrier(tls *TLS) { /* atomic_arch.h:21:20: */ 2299 panic(`arch/s390x/atomic_arch.h:23:2: assembler statements not supported`) 2300 } 2301 2302 func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:108:19: */ 2303 var old int32 2304 for ok := true; ok; ok = a_cas(tls, p, old, v) != old { 2305 old = *(*int32)(unsafe.Pointer(p)) 2306 } 2307 return old 2308 } 2309 2310 func a_fetch_add(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:119:19: */ 2311 var old int32 2312 for ok := true; ok; ok = a_cas(tls, p, old, int32(uint32(old)+uint32(v))) != old { 2313 old = *(*int32)(unsafe.Pointer(p)) 2314 } 2315 return old 2316 } 2317 2318 func a_fetch_and(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:130:19: */ 2319 var old int32 2320 for ok := true; ok; ok = a_cas(tls, p, old, old&v) != old { 2321 old = *(*int32)(unsafe.Pointer(p)) 2322 } 2323 return old 2324 } 2325 2326 func a_fetch_or(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:140:19: */ 2327 var old int32 2328 for ok := true; ok; ok = a_cas(tls, p, old, old|v) != old { 2329 old = *(*int32)(unsafe.Pointer(p)) 2330 } 2331 return old 2332 } 2333 2334 func a_and(tls *TLS, p uintptr, v int32) { /* atomic.h:151:20: */ 2335 a_fetch_and(tls, p, v) 2336 } 2337 2338 func a_or(tls *TLS, p uintptr, v int32) { /* atomic.h:159:20: */ 2339 a_fetch_or(tls, p, v) 2340 } 2341 2342 func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */ 2343 bp := tls.Alloc(8) 2344 defer tls.Free(8) 2345 2346 *(*struct{ v uint64_t })(unsafe.Pointer(bp)) = func() (r struct{ v uint64_t }) { 2347 *(*uint64_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = v 2348 return r 2349 }() 2350 if *(*uint32_t)(unsafe.Pointer(bp)) != 0 { 2351 a_or(tls, p, int32(*(*uint32_t)(unsafe.Pointer(bp)))) 2352 } 2353 if *(*uint32_t)(unsafe.Pointer(bp + 1*4)) != 0 { 2354 a_or(tls, p+uintptr(1)*4, int32(*(*uint32_t)(unsafe.Pointer(bp + 1*4)))) 2355 } 2356 } 2357 2358 func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ 2359 return int32(_sdebruijn328[x&-x*uint32_t(0x076be629)>>27]) 2360 } 2361 2362 var _sdebruijn328 = [32]uint8{ 2363 uint8(0), uint8(1), uint8(23), uint8(2), uint8(29), uint8(24), uint8(19), uint8(3), uint8(30), uint8(27), uint8(25), uint8(11), uint8(20), uint8(8), uint8(4), uint8(13), 2364 uint8(31), uint8(22), uint8(28), uint8(18), uint8(26), uint8(10), uint8(7), uint8(12), uint8(21), uint8(17), uint8(9), uint8(6), uint8(16), uint8(5), uint8(15), uint8(14), 2365 } /* atomic.h:261:20 */ 2366 2367 func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic.h:272:19: */ 2368 if uint64(unsafe.Sizeof(int64(0))) < uint64(8) { 2369 var y uint32_t = uint32_t(x) 2370 if !(y != 0) { 2371 y = uint32_t(x >> 32) 2372 return 32 + a_ctz_32(tls, y) 2373 } 2374 return a_ctz_32(tls, y) 2375 } 2376 return int32(_sdebruijn648[uint64(x&-x)*0x022fdd63cc95386d>>58]) 2377 } 2378 2379 var _sdebruijn648 = [64]uint8{ 2380 uint8(0), uint8(1), uint8(2), uint8(53), uint8(3), uint8(7), uint8(54), uint8(27), uint8(4), uint8(38), uint8(41), uint8(8), uint8(34), uint8(55), uint8(48), uint8(28), 2381 uint8(62), uint8(5), uint8(39), uint8(46), uint8(44), uint8(42), uint8(22), uint8(9), uint8(24), uint8(35), uint8(59), uint8(56), uint8(49), uint8(18), uint8(29), uint8(11), 2382 uint8(63), uint8(52), uint8(6), uint8(26), uint8(37), uint8(40), uint8(33), uint8(47), uint8(61), uint8(45), uint8(43), uint8(21), uint8(23), uint8(58), uint8(17), uint8(10), 2383 uint8(51), uint8(25), uint8(36), uint8(32), uint8(60), uint8(20), uint8(57), uint8(16), uint8(50), uint8(31), uint8(19), uint8(15), uint8(30), uint8(14), uint8(13), uint8(12), 2384 } /* atomic.h:274:20 */ 2385 2386 type __timer = struct { 2387 timerid int32 2388 _ [4]byte 2389 thread pthread_t 2390 } /* pthread_impl.h:64:1 */ 2391 2392 func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */ 2393 var self uintptr 2394 panic(`arch/s390x/pthread_arch.h:4:2: assembler statements not supported`) 2395 return self 2396 } 2397 2398 func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */ 2399 if priv != 0 { 2400 priv = 128 2401 } 2402 if cnt < 0 { 2403 cnt = 0x7fffffff 2404 } 2405 _ = Bool32(__syscall3(tls, int64(238), int64(addr), int64(1|priv), int64(cnt)) != int64(-38) || __syscall3(tls, int64(238), int64(addr), int64(1), int64(cnt)) != 0) 2406 } 2407 2408 func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ 2409 if priv != 0 { 2410 priv = 128 2411 } 2412 _ = Bool32(__syscall4(tls, int64(238), int64(addr), int64(0|priv), int64(val), int64(0)) != int64(-38) || __syscall4(tls, int64(238), int64(addr), int64(0), int64(val), int64(0)) != 0) 2413 } 2414 2415 var X__fsmu8 = [51]uint32_t{ 2416 func() uint32 { 2417 if 0x2 < 2 { 2418 return Uint32FromInt32(-1) 2419 } 2420 return func() uint32 { 2421 if Int32(0x80) == Int32(0x80) { 2422 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2423 } 2424 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2425 }()<<23 | uint32_t(0x2) 2426 }(), func() uint32 { 2427 if 0x3 < 2 { 2428 return Uint32FromInt32(-1) 2429 } 2430 return func() uint32 { 2431 if Int32(0x80) == Int32(0x80) { 2432 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2433 } 2434 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2435 }()<<23 | uint32_t(0x3) 2436 }(), func() uint32 { 2437 if 0x4 < 2 { 2438 return Uint32FromInt32(-1) 2439 } 2440 return func() uint32 { 2441 if Int32(0x80) == Int32(0x80) { 2442 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2443 } 2444 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2445 }()<<23 | uint32_t(0x4) 2446 }(), func() uint32 { 2447 if 0x5 < 2 { 2448 return Uint32FromInt32(-1) 2449 } 2450 return func() uint32 { 2451 if Int32(0x80) == Int32(0x80) { 2452 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2453 } 2454 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2455 }()<<23 | uint32_t(0x5) 2456 }(), func() uint32 { 2457 if 0x6 < 2 { 2458 return Uint32FromInt32(-1) 2459 } 2460 return func() uint32 { 2461 if Int32(0x80) == Int32(0x80) { 2462 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2463 } 2464 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2465 }()<<23 | uint32_t(0x6) 2466 }(), func() uint32 { 2467 if 0x7 < 2 { 2468 return Uint32FromInt32(-1) 2469 } 2470 return func() uint32 { 2471 if Int32(0x80) == Int32(0x80) { 2472 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2473 } 2474 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2475 }()<<23 | uint32_t(0x7) 2476 }(), 2477 func() uint32 { 2478 if 0x8 < 2 { 2479 return Uint32FromInt32(-1) 2480 } 2481 return func() uint32 { 2482 if Int32(0x80) == Int32(0x80) { 2483 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2484 } 2485 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2486 }()<<23 | uint32_t(0x8) 2487 }(), func() uint32 { 2488 if 0x9 < 2 { 2489 return Uint32FromInt32(-1) 2490 } 2491 return func() uint32 { 2492 if Int32(0x80) == Int32(0x80) { 2493 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2494 } 2495 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2496 }()<<23 | uint32_t(0x9) 2497 }(), func() uint32 { 2498 if 0xa < 2 { 2499 return Uint32FromInt32(-1) 2500 } 2501 return func() uint32 { 2502 if Int32(0x80) == Int32(0x80) { 2503 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2504 } 2505 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2506 }()<<23 | uint32_t(0xa) 2507 }(), func() uint32 { 2508 if 0xb < 2 { 2509 return Uint32FromInt32(-1) 2510 } 2511 return func() uint32 { 2512 if Int32(0x80) == Int32(0x80) { 2513 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2514 } 2515 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2516 }()<<23 | uint32_t(0xb) 2517 }(), func() uint32 { 2518 if 0xc < 2 { 2519 return Uint32FromInt32(-1) 2520 } 2521 return func() uint32 { 2522 if Int32(0x80) == Int32(0x80) { 2523 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2524 } 2525 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2526 }()<<23 | uint32_t(0xc) 2527 }(), func() uint32 { 2528 if 0xd < 2 { 2529 return Uint32FromInt32(-1) 2530 } 2531 return func() uint32 { 2532 if Int32(0x80) == Int32(0x80) { 2533 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2534 } 2535 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2536 }()<<23 | uint32_t(0xd) 2537 }(), func() uint32 { 2538 if 0xe < 2 { 2539 return Uint32FromInt32(-1) 2540 } 2541 return func() uint32 { 2542 if Int32(0x80) == Int32(0x80) { 2543 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2544 } 2545 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2546 }()<<23 | uint32_t(0xe) 2547 }(), func() uint32 { 2548 if 0xf < 2 { 2549 return Uint32FromInt32(-1) 2550 } 2551 return func() uint32 { 2552 if Int32(0x80) == Int32(0x80) { 2553 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2554 } 2555 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2556 }()<<23 | uint32_t(0xf) 2557 }(), 2558 func() uint32 { 2559 if 0x0+16 < 2 { 2560 return Uint32FromInt32(-1) 2561 } 2562 return func() uint32 { 2563 if Int32(0x80) == Int32(0x80) { 2564 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2565 } 2566 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2567 }()<<23 | uint32_t(0x0+16) 2568 }(), func() uint32 { 2569 if 0x1+16 < 2 { 2570 return Uint32FromInt32(-1) 2571 } 2572 return func() uint32 { 2573 if Int32(0x80) == Int32(0x80) { 2574 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2575 } 2576 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2577 }()<<23 | uint32_t(0x1+16) 2578 }(), func() uint32 { 2579 if 0x2+16 < 2 { 2580 return Uint32FromInt32(-1) 2581 } 2582 return func() uint32 { 2583 if Int32(0x80) == Int32(0x80) { 2584 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2585 } 2586 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2587 }()<<23 | uint32_t(0x2+16) 2588 }(), func() uint32 { 2589 if 0x3+16 < 2 { 2590 return Uint32FromInt32(-1) 2591 } 2592 return func() uint32 { 2593 if Int32(0x80) == Int32(0x80) { 2594 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2595 } 2596 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2597 }()<<23 | uint32_t(0x3+16) 2598 }(), func() uint32 { 2599 if 0x4+16 < 2 { 2600 return Uint32FromInt32(-1) 2601 } 2602 return func() uint32 { 2603 if Int32(0x80) == Int32(0x80) { 2604 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2605 } 2606 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2607 }()<<23 | uint32_t(0x4+16) 2608 }(), func() uint32 { 2609 if 0x5+16 < 2 { 2610 return Uint32FromInt32(-1) 2611 } 2612 return func() uint32 { 2613 if Int32(0x80) == Int32(0x80) { 2614 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2615 } 2616 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2617 }()<<23 | uint32_t(0x5+16) 2618 }(), func() uint32 { 2619 if 0x6+16 < 2 { 2620 return Uint32FromInt32(-1) 2621 } 2622 return func() uint32 { 2623 if Int32(0x80) == Int32(0x80) { 2624 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2625 } 2626 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2627 }()<<23 | uint32_t(0x6+16) 2628 }(), func() uint32 { 2629 if 0x7+16 < 2 { 2630 return Uint32FromInt32(-1) 2631 } 2632 return func() uint32 { 2633 if Int32(0x80) == Int32(0x80) { 2634 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2635 } 2636 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2637 }()<<23 | uint32_t(0x7+16) 2638 }(), 2639 func() uint32 { 2640 if 0x8+16 < 2 { 2641 return Uint32FromInt32(-1) 2642 } 2643 return func() uint32 { 2644 if Int32(0x80) == Int32(0x80) { 2645 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2646 } 2647 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2648 }()<<23 | uint32_t(0x8+16) 2649 }(), func() uint32 { 2650 if 0x9+16 < 2 { 2651 return Uint32FromInt32(-1) 2652 } 2653 return func() uint32 { 2654 if Int32(0x80) == Int32(0x80) { 2655 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2656 } 2657 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2658 }()<<23 | uint32_t(0x9+16) 2659 }(), func() uint32 { 2660 if 0xa+16 < 2 { 2661 return Uint32FromInt32(-1) 2662 } 2663 return func() uint32 { 2664 if Int32(0x80) == Int32(0x80) { 2665 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2666 } 2667 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2668 }()<<23 | uint32_t(0xa+16) 2669 }(), func() uint32 { 2670 if 0xb+16 < 2 { 2671 return Uint32FromInt32(-1) 2672 } 2673 return func() uint32 { 2674 if Int32(0x80) == Int32(0x80) { 2675 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2676 } 2677 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2678 }()<<23 | uint32_t(0xb+16) 2679 }(), func() uint32 { 2680 if 0xc+16 < 2 { 2681 return Uint32FromInt32(-1) 2682 } 2683 return func() uint32 { 2684 if Int32(0x80) == Int32(0x80) { 2685 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2686 } 2687 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2688 }()<<23 | uint32_t(0xc+16) 2689 }(), func() uint32 { 2690 if 0xd+16 < 2 { 2691 return Uint32FromInt32(-1) 2692 } 2693 return func() uint32 { 2694 if Int32(0x80) == Int32(0x80) { 2695 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2696 } 2697 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2698 }()<<23 | uint32_t(0xd+16) 2699 }(), func() uint32 { 2700 if 0xe+16 < 2 { 2701 return Uint32FromInt32(-1) 2702 } 2703 return func() uint32 { 2704 if Int32(0x80) == Int32(0x80) { 2705 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2706 } 2707 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2708 }()<<23 | uint32_t(0xe+16) 2709 }(), func() uint32 { 2710 if 0xf+16 < 2 { 2711 return Uint32FromInt32(-1) 2712 } 2713 return func() uint32 { 2714 if Int32(0x80) == Int32(0x80) { 2715 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2716 } 2717 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2718 }()<<23 | uint32_t(0xf+16) 2719 }(), 2720 func() uint32 { 2721 if 0x0 == 0 { 2722 return func() uint32 { 2723 if Int32(0xa0) == Int32(0x80) { 2724 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2725 } 2726 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2727 }() << 23 2728 } 2729 return func() uint32 { 2730 if 0x0 == 0xd { 2731 return func() uint32 { 2732 if Int32(0x80) == Int32(0x80) { 2733 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2734 } 2735 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2736 }() << 23 2737 } 2738 return func() uint32 { 2739 if Int32(0x80) == Int32(0x80) { 2740 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2741 } 2742 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2743 }() << 23 2744 }() 2745 }() | uint32_t(func() uint32 { 2746 if Int32(0x80) == Int32(0x80) { 2747 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2748 } 2749 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2750 }()<<23)>>6 | uint32_t(0x0), func() uint32 { 2751 if 0x1 == 0 { 2752 return func() uint32 { 2753 if Int32(0xa0) == Int32(0x80) { 2754 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2755 } 2756 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2757 }() << 23 2758 } 2759 return func() uint32 { 2760 if 0x1 == 0xd { 2761 return func() uint32 { 2762 if Int32(0x80) == Int32(0x80) { 2763 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2764 } 2765 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2766 }() << 23 2767 } 2768 return func() uint32 { 2769 if Int32(0x80) == Int32(0x80) { 2770 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2771 } 2772 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2773 }() << 23 2774 }() 2775 }() | uint32_t(func() uint32 { 2776 if Int32(0x80) == Int32(0x80) { 2777 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2778 } 2779 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2780 }()<<23)>>6 | uint32_t(0x1), func() uint32 { 2781 if 0x2 == 0 { 2782 return func() uint32 { 2783 if Int32(0xa0) == Int32(0x80) { 2784 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2785 } 2786 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2787 }() << 23 2788 } 2789 return func() uint32 { 2790 if 0x2 == 0xd { 2791 return func() uint32 { 2792 if Int32(0x80) == Int32(0x80) { 2793 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2794 } 2795 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2796 }() << 23 2797 } 2798 return func() uint32 { 2799 if Int32(0x80) == Int32(0x80) { 2800 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2801 } 2802 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2803 }() << 23 2804 }() 2805 }() | uint32_t(func() uint32 { 2806 if Int32(0x80) == Int32(0x80) { 2807 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2808 } 2809 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2810 }()<<23)>>6 | uint32_t(0x2), func() uint32 { 2811 if 0x3 == 0 { 2812 return func() uint32 { 2813 if Int32(0xa0) == Int32(0x80) { 2814 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2815 } 2816 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2817 }() << 23 2818 } 2819 return func() uint32 { 2820 if 0x3 == 0xd { 2821 return func() uint32 { 2822 if Int32(0x80) == Int32(0x80) { 2823 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2824 } 2825 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2826 }() << 23 2827 } 2828 return func() uint32 { 2829 if Int32(0x80) == Int32(0x80) { 2830 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2831 } 2832 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2833 }() << 23 2834 }() 2835 }() | uint32_t(func() uint32 { 2836 if Int32(0x80) == Int32(0x80) { 2837 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2838 } 2839 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2840 }()<<23)>>6 | uint32_t(0x3), func() uint32 { 2841 if 0x4 == 0 { 2842 return func() uint32 { 2843 if Int32(0xa0) == Int32(0x80) { 2844 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2845 } 2846 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2847 }() << 23 2848 } 2849 return func() uint32 { 2850 if 0x4 == 0xd { 2851 return func() uint32 { 2852 if Int32(0x80) == Int32(0x80) { 2853 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2854 } 2855 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2856 }() << 23 2857 } 2858 return func() uint32 { 2859 if Int32(0x80) == Int32(0x80) { 2860 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2861 } 2862 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2863 }() << 23 2864 }() 2865 }() | uint32_t(func() uint32 { 2866 if Int32(0x80) == Int32(0x80) { 2867 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2868 } 2869 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2870 }()<<23)>>6 | uint32_t(0x4), func() uint32 { 2871 if 0x5 == 0 { 2872 return func() uint32 { 2873 if Int32(0xa0) == Int32(0x80) { 2874 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2875 } 2876 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2877 }() << 23 2878 } 2879 return func() uint32 { 2880 if 0x5 == 0xd { 2881 return func() uint32 { 2882 if Int32(0x80) == Int32(0x80) { 2883 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2884 } 2885 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2886 }() << 23 2887 } 2888 return func() uint32 { 2889 if Int32(0x80) == Int32(0x80) { 2890 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2891 } 2892 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2893 }() << 23 2894 }() 2895 }() | uint32_t(func() uint32 { 2896 if Int32(0x80) == Int32(0x80) { 2897 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2898 } 2899 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2900 }()<<23)>>6 | uint32_t(0x5), func() uint32 { 2901 if 0x6 == 0 { 2902 return func() uint32 { 2903 if Int32(0xa0) == Int32(0x80) { 2904 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2905 } 2906 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2907 }() << 23 2908 } 2909 return func() uint32 { 2910 if 0x6 == 0xd { 2911 return func() uint32 { 2912 if Int32(0x80) == Int32(0x80) { 2913 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2914 } 2915 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2916 }() << 23 2917 } 2918 return func() uint32 { 2919 if Int32(0x80) == Int32(0x80) { 2920 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2921 } 2922 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2923 }() << 23 2924 }() 2925 }() | uint32_t(func() uint32 { 2926 if Int32(0x80) == Int32(0x80) { 2927 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2928 } 2929 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2930 }()<<23)>>6 | uint32_t(0x6), func() uint32 { 2931 if 0x7 == 0 { 2932 return func() uint32 { 2933 if Int32(0xa0) == Int32(0x80) { 2934 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2935 } 2936 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2937 }() << 23 2938 } 2939 return func() uint32 { 2940 if 0x7 == 0xd { 2941 return func() uint32 { 2942 if Int32(0x80) == Int32(0x80) { 2943 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2944 } 2945 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2946 }() << 23 2947 } 2948 return func() uint32 { 2949 if Int32(0x80) == Int32(0x80) { 2950 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2951 } 2952 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2953 }() << 23 2954 }() 2955 }() | uint32_t(func() uint32 { 2956 if Int32(0x80) == Int32(0x80) { 2957 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2958 } 2959 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2960 }()<<23)>>6 | uint32_t(0x7), 2961 func() uint32 { 2962 if 0x8 == 0 { 2963 return func() uint32 { 2964 if Int32(0xa0) == Int32(0x80) { 2965 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2966 } 2967 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2968 }() << 23 2969 } 2970 return func() uint32 { 2971 if 0x8 == 0xd { 2972 return func() uint32 { 2973 if Int32(0x80) == Int32(0x80) { 2974 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2975 } 2976 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2977 }() << 23 2978 } 2979 return func() uint32 { 2980 if Int32(0x80) == Int32(0x80) { 2981 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2982 } 2983 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2984 }() << 23 2985 }() 2986 }() | uint32_t(func() uint32 { 2987 if Int32(0x80) == Int32(0x80) { 2988 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2989 } 2990 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2991 }()<<23)>>6 | uint32_t(0x8), func() uint32 { 2992 if 0x9 == 0 { 2993 return func() uint32 { 2994 if Int32(0xa0) == Int32(0x80) { 2995 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2996 } 2997 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2998 }() << 23 2999 } 3000 return func() uint32 { 3001 if 0x9 == 0xd { 3002 return func() uint32 { 3003 if Int32(0x80) == Int32(0x80) { 3004 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3005 } 3006 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3007 }() << 23 3008 } 3009 return func() uint32 { 3010 if Int32(0x80) == Int32(0x80) { 3011 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3012 } 3013 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3014 }() << 23 3015 }() 3016 }() | uint32_t(func() uint32 { 3017 if Int32(0x80) == Int32(0x80) { 3018 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3019 } 3020 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3021 }()<<23)>>6 | uint32_t(0x9), func() uint32 { 3022 if 0xa == 0 { 3023 return func() uint32 { 3024 if Int32(0xa0) == Int32(0x80) { 3025 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3026 } 3027 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3028 }() << 23 3029 } 3030 return func() uint32 { 3031 if 0xa == 0xd { 3032 return func() uint32 { 3033 if Int32(0x80) == Int32(0x80) { 3034 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3035 } 3036 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3037 }() << 23 3038 } 3039 return func() uint32 { 3040 if Int32(0x80) == Int32(0x80) { 3041 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3042 } 3043 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3044 }() << 23 3045 }() 3046 }() | uint32_t(func() uint32 { 3047 if Int32(0x80) == Int32(0x80) { 3048 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3049 } 3050 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3051 }()<<23)>>6 | uint32_t(0xa), func() uint32 { 3052 if 0xb == 0 { 3053 return func() uint32 { 3054 if Int32(0xa0) == Int32(0x80) { 3055 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3056 } 3057 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3058 }() << 23 3059 } 3060 return func() uint32 { 3061 if 0xb == 0xd { 3062 return func() uint32 { 3063 if Int32(0x80) == Int32(0x80) { 3064 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3065 } 3066 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3067 }() << 23 3068 } 3069 return func() uint32 { 3070 if Int32(0x80) == Int32(0x80) { 3071 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3072 } 3073 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3074 }() << 23 3075 }() 3076 }() | uint32_t(func() uint32 { 3077 if Int32(0x80) == Int32(0x80) { 3078 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3079 } 3080 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3081 }()<<23)>>6 | uint32_t(0xb), func() uint32 { 3082 if 0xc == 0 { 3083 return func() uint32 { 3084 if Int32(0xa0) == Int32(0x80) { 3085 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3086 } 3087 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3088 }() << 23 3089 } 3090 return func() uint32 { 3091 if 0xc == 0xd { 3092 return func() uint32 { 3093 if Int32(0x80) == Int32(0x80) { 3094 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3095 } 3096 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3097 }() << 23 3098 } 3099 return func() uint32 { 3100 if Int32(0x80) == Int32(0x80) { 3101 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3102 } 3103 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3104 }() << 23 3105 }() 3106 }() | uint32_t(func() uint32 { 3107 if Int32(0x80) == Int32(0x80) { 3108 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3109 } 3110 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3111 }()<<23)>>6 | uint32_t(0xc), func() uint32 { 3112 if 0xd == 0 { 3113 return func() uint32 { 3114 if Int32(0xa0) == Int32(0x80) { 3115 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3116 } 3117 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3118 }() << 23 3119 } 3120 return func() uint32 { 3121 if 0xd == 0xd { 3122 return func() uint32 { 3123 if Int32(0x80) == Int32(0x80) { 3124 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3125 } 3126 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3127 }() << 23 3128 } 3129 return func() uint32 { 3130 if Int32(0x80) == Int32(0x80) { 3131 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3132 } 3133 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3134 }() << 23 3135 }() 3136 }() | uint32_t(func() uint32 { 3137 if Int32(0x80) == Int32(0x80) { 3138 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3139 } 3140 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3141 }()<<23)>>6 | uint32_t(0xd), func() uint32 { 3142 if 0xe == 0 { 3143 return func() uint32 { 3144 if Int32(0xa0) == Int32(0x80) { 3145 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3146 } 3147 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3148 }() << 23 3149 } 3150 return func() uint32 { 3151 if 0xe == 0xd { 3152 return func() uint32 { 3153 if Int32(0x80) == Int32(0x80) { 3154 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3155 } 3156 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3157 }() << 23 3158 } 3159 return func() uint32 { 3160 if Int32(0x80) == Int32(0x80) { 3161 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3162 } 3163 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3164 }() << 23 3165 }() 3166 }() | uint32_t(func() uint32 { 3167 if Int32(0x80) == Int32(0x80) { 3168 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3169 } 3170 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3171 }()<<23)>>6 | uint32_t(0xe), func() uint32 { 3172 if 0xf == 0 { 3173 return func() uint32 { 3174 if Int32(0xa0) == Int32(0x80) { 3175 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3176 } 3177 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3178 }() << 23 3179 } 3180 return func() uint32 { 3181 if 0xf == 0xd { 3182 return func() uint32 { 3183 if Int32(0x80) == Int32(0x80) { 3184 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3185 } 3186 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3187 }() << 23 3188 } 3189 return func() uint32 { 3190 if Int32(0x80) == Int32(0x80) { 3191 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3192 } 3193 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3194 }() << 23 3195 }() 3196 }() | uint32_t(func() uint32 { 3197 if Int32(0x80) == Int32(0x80) { 3198 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3199 } 3200 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3201 }()<<23)>>6 | uint32_t(0xf), 3202 func() uint32 { 3203 if 0x0 >= 5 { 3204 return uint32(0) 3205 } 3206 return func() uint32 { 3207 if 0x0 == 0 { 3208 return func() uint32 { 3209 if Int32(0x90) == Int32(0x80) { 3210 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3211 } 3212 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3213 }() << 23 3214 } 3215 return func() uint32 { 3216 if 0x0 == 4 { 3217 return func() uint32 { 3218 if Int32(0x80) == Int32(0x80) { 3219 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3220 } 3221 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3222 }() << 23 3223 } 3224 return func() uint32 { 3225 if Int32(0x80) == Int32(0x80) { 3226 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3227 } 3228 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3229 }() << 23 3230 }() 3231 }() 3232 }() | uint32_t(func() uint32 { 3233 if Int32(0x80) == Int32(0x80) { 3234 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3235 } 3236 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3237 }()<<23)>>6 | uint32_t(func() uint32 { 3238 if Int32(0x80) == Int32(0x80) { 3239 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3240 } 3241 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3242 }()<<23)>>12 | uint32_t(0x0), func() uint32 { 3243 if 0x1 >= 5 { 3244 return uint32(0) 3245 } 3246 return func() uint32 { 3247 if 0x1 == 0 { 3248 return func() uint32 { 3249 if Int32(0x90) == Int32(0x80) { 3250 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3251 } 3252 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3253 }() << 23 3254 } 3255 return func() uint32 { 3256 if 0x1 == 4 { 3257 return func() uint32 { 3258 if Int32(0x80) == Int32(0x80) { 3259 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3260 } 3261 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3262 }() << 23 3263 } 3264 return func() uint32 { 3265 if Int32(0x80) == Int32(0x80) { 3266 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3267 } 3268 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3269 }() << 23 3270 }() 3271 }() 3272 }() | uint32_t(func() uint32 { 3273 if Int32(0x80) == Int32(0x80) { 3274 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3275 } 3276 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3277 }()<<23)>>6 | uint32_t(func() uint32 { 3278 if Int32(0x80) == Int32(0x80) { 3279 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3280 } 3281 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3282 }()<<23)>>12 | uint32_t(0x1), func() uint32 { 3283 if 0x2 >= 5 { 3284 return uint32(0) 3285 } 3286 return func() uint32 { 3287 if 0x2 == 0 { 3288 return func() uint32 { 3289 if Int32(0x90) == Int32(0x80) { 3290 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3291 } 3292 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3293 }() << 23 3294 } 3295 return func() uint32 { 3296 if 0x2 == 4 { 3297 return func() uint32 { 3298 if Int32(0x80) == Int32(0x80) { 3299 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3300 } 3301 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3302 }() << 23 3303 } 3304 return func() uint32 { 3305 if Int32(0x80) == Int32(0x80) { 3306 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3307 } 3308 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3309 }() << 23 3310 }() 3311 }() 3312 }() | uint32_t(func() uint32 { 3313 if Int32(0x80) == Int32(0x80) { 3314 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3315 } 3316 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3317 }()<<23)>>6 | uint32_t(func() uint32 { 3318 if Int32(0x80) == Int32(0x80) { 3319 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3320 } 3321 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3322 }()<<23)>>12 | uint32_t(0x2), func() uint32 { 3323 if 0x3 >= 5 { 3324 return uint32(0) 3325 } 3326 return func() uint32 { 3327 if 0x3 == 0 { 3328 return func() uint32 { 3329 if Int32(0x90) == Int32(0x80) { 3330 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3331 } 3332 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3333 }() << 23 3334 } 3335 return func() uint32 { 3336 if 0x3 == 4 { 3337 return func() uint32 { 3338 if Int32(0x80) == Int32(0x80) { 3339 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3340 } 3341 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3342 }() << 23 3343 } 3344 return func() uint32 { 3345 if Int32(0x80) == Int32(0x80) { 3346 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3347 } 3348 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3349 }() << 23 3350 }() 3351 }() 3352 }() | uint32_t(func() uint32 { 3353 if Int32(0x80) == Int32(0x80) { 3354 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3355 } 3356 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3357 }()<<23)>>6 | uint32_t(func() uint32 { 3358 if Int32(0x80) == Int32(0x80) { 3359 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3360 } 3361 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3362 }()<<23)>>12 | uint32_t(0x3), func() uint32 { 3363 if 0x4 >= 5 { 3364 return uint32(0) 3365 } 3366 return func() uint32 { 3367 if 0x4 == 0 { 3368 return func() uint32 { 3369 if Int32(0x90) == Int32(0x80) { 3370 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3371 } 3372 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3373 }() << 23 3374 } 3375 return func() uint32 { 3376 if 0x4 == 4 { 3377 return func() uint32 { 3378 if Int32(0x80) == Int32(0x80) { 3379 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3380 } 3381 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3382 }() << 23 3383 } 3384 return func() uint32 { 3385 if Int32(0x80) == Int32(0x80) { 3386 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3387 } 3388 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3389 }() << 23 3390 }() 3391 }() 3392 }() | uint32_t(func() uint32 { 3393 if Int32(0x80) == Int32(0x80) { 3394 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3395 } 3396 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3397 }()<<23)>>6 | uint32_t(func() uint32 { 3398 if Int32(0x80) == Int32(0x80) { 3399 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3400 } 3401 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3402 }()<<23)>>12 | uint32_t(0x4), 3403 } /* internal.c:18:16 */ 3404 3405 type wint_t = uint32 /* alltypes.h:185:18 */ 3406 3407 type wctype_t = uint64 /* alltypes.h:190:23 */ 3408 3409 type __mbstate_t = struct { 3410 __opaque1 uint32 3411 __opaque2 uint32 3412 } /* alltypes.h:324:9 */ 3413 3414 type mbstate_t = __mbstate_t /* alltypes.h:324:63 */ 3415 3416 func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */ 3417 bp := tls.Alloc(4) 3418 defer tls.Free(4) 3419 3420 var c uint32 3421 var s uintptr 3422 var N uint32 3423 // var dummy wchar_t at bp, 4 3424 s = src 3425 N = uint32(n) 3426 3427 if !!(st != 0) { 3428 goto __1 3429 } 3430 st = uintptr(unsafe.Pointer(&_sinternal_state)) 3431 __1: 3432 ; 3433 c = *(*uint32)(unsafe.Pointer(st)) 3434 3435 if !!(s != 0) { 3436 goto __2 3437 } 3438 if !(c != 0) { 3439 goto __4 3440 } 3441 goto ilseq 3442 __4: 3443 ; 3444 return uint64(0) 3445 goto __3 3446 __2: 3447 if !!(wc != 0) { 3448 goto __5 3449 } 3450 wc = bp /* &dummy */ 3451 __5: 3452 ; 3453 __3: 3454 ; 3455 3456 if !!(n != 0) { 3457 goto __6 3458 } 3459 return Uint64FromInt32(-2) 3460 __6: 3461 ; 3462 if !!(c != 0) { 3463 goto __7 3464 } 3465 if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) { 3466 goto __8 3467 } 3468 return BoolUint64(!!(AssignPtrInt32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s)))) != 0)) 3469 __8: 3470 ; 3471 if !(func() int32 { 3472 if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) { 3473 return 4 3474 } 3475 return 1 3476 }() == 1) { 3477 goto __9 3478 } 3479 *(*wchar_t)(unsafe.Pointer(wc)) = 0xdfff & int32(int8(*(*uint8)(unsafe.Pointer(s)))) 3480 return 1 3481 __9: 3482 ; 3483 if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0xc2 > 0xf4-0xc2) { 3484 goto __10 3485 } 3486 goto ilseq 3487 __10: 3488 ; 3489 c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0xc2] 3490 n-- 3491 __7: 3492 ; 3493 3494 if !(n != 0) { 3495 goto __11 3496 } 3497 if !((int32(*(*uint8)(unsafe.Pointer(s)))>>3-0x10|(int32(*(*uint8)(unsafe.Pointer(s)))>>3+int32_t(c)>>26))&CplInt32(7) != 0) { 3498 goto __12 3499 } 3500 goto ilseq 3501 __12: 3502 ; 3503 loop: 3504 c = c<<6 | uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0x80) 3505 n-- 3506 if !!(c&(uint32(1)<<31) != 0) { 3507 goto __13 3508 } 3509 *(*uint32)(unsafe.Pointer(st)) = uint32(0) 3510 *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(c) 3511 return size_t(N) - n 3512 __13: 3513 ; 3514 if !(n != 0) { 3515 goto __14 3516 } 3517 if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0x80 >= uint32(0x40)) { 3518 goto __15 3519 } 3520 goto ilseq 3521 __15: 3522 ; 3523 goto loop 3524 __14: 3525 ; 3526 __11: 3527 ; 3528 3529 *(*uint32)(unsafe.Pointer(st)) = c 3530 return Uint64FromInt32(-2) 3531 ilseq: 3532 *(*uint32)(unsafe.Pointer(st)) = uint32(0) 3533 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84 3534 return Uint64FromInt32(-1) 3535 } 3536 3537 var _sinternal_state uint32 /* mbrtowc.c:8:18: */ 3538 3539 func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */ 3540 return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0)) 3541 } 3542 3543 type imaxdiv_t = struct { 3544 quot intmax_t 3545 rem intmax_t 3546 } /* inttypes.h:14:40 */ 3547 3548 type socklen_t = uint32 /* alltypes.h:348:18 */ 3549 3550 type sa_family_t = uint16 /* alltypes.h:353:24 */ 3551 3552 type msghdr = struct { 3553 msg_name uintptr 3554 msg_namelen socklen_t 3555 _ [4]byte 3556 msg_iov uintptr 3557 __pad1 int32 3558 msg_iovlen int32 3559 msg_control uintptr 3560 __pad2 int32 3561 msg_controllen socklen_t 3562 msg_flags int32 3563 _ [4]byte 3564 } /* socket.h:22:1 */ 3565 3566 type cmsghdr = struct { 3567 __pad1 int32 3568 cmsg_len socklen_t 3569 cmsg_level int32 3570 cmsg_type int32 3571 } /* socket.h:44:1 */ 3572 3573 type linger = struct { 3574 l_onoff int32 3575 l_linger int32 3576 } /* socket.h:74:1 */ 3577 3578 type sockaddr = struct { 3579 sa_family sa_family_t 3580 sa_data [14]uint8 3581 } /* socket.h:367:1 */ 3582 3583 type sockaddr_storage = struct { 3584 ss_family sa_family_t 3585 __ss_padding [118]uint8 3586 __ss_align uint64 3587 } /* socket.h:372:1 */ 3588 3589 type in_port_t = uint16_t /* in.h:12:18 */ 3590 type in_addr_t = uint32_t /* in.h:13:18 */ 3591 type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */ 3592 3593 type sockaddr_in = struct { 3594 sin_family sa_family_t 3595 sin_port in_port_t 3596 sin_addr struct{ s_addr in_addr_t } 3597 sin_zero [8]uint8_t 3598 } /* in.h:16:1 */ 3599 3600 type in6_addr = struct { 3601 __in6_union struct { 3602 _ [0]uint32 3603 __s6_addr [16]uint8_t 3604 } 3605 } /* in.h:23:1 */ 3606 3607 type sockaddr_in6 = struct { 3608 sin6_family sa_family_t 3609 sin6_port in_port_t 3610 sin6_flowinfo uint32_t 3611 sin6_addr struct { 3612 __in6_union struct { 3613 _ [0]uint32 3614 __s6_addr [16]uint8_t 3615 } 3616 } 3617 sin6_scope_id uint32_t 3618 } /* in.h:34:1 */ 3619 3620 type ipv6_mreq = struct { 3621 ipv6mr_multiaddr struct { 3622 __in6_union struct { 3623 _ [0]uint32 3624 __s6_addr [16]uint8_t 3625 } 3626 } 3627 ipv6mr_interface uint32 3628 } /* in.h:42:1 */ 3629 3630 type ip_opts = struct { 3631 ip_dst struct{ s_addr in_addr_t } 3632 ip_opts [40]uint8 3633 } /* in.h:229:1 */ 3634 3635 type ip_mreq = struct { 3636 imr_multiaddr struct{ s_addr in_addr_t } 3637 imr_interface struct{ s_addr in_addr_t } 3638 } /* in.h:247:1 */ 3639 3640 type ip_mreqn = struct { 3641 imr_multiaddr struct{ s_addr in_addr_t } 3642 imr_address struct{ s_addr in_addr_t } 3643 imr_ifindex int32 3644 } /* in.h:252:1 */ 3645 3646 type ip_mreq_source = struct { 3647 imr_multiaddr struct{ s_addr in_addr_t } 3648 imr_interface struct{ s_addr in_addr_t } 3649 imr_sourceaddr struct{ s_addr in_addr_t } 3650 } /* in.h:258:1 */ 3651 3652 type ip_msfilter = struct { 3653 imsf_multiaddr struct{ s_addr in_addr_t } 3654 imsf_interface struct{ s_addr in_addr_t } 3655 imsf_fmode uint32_t 3656 imsf_numsrc uint32_t 3657 imsf_slist [1]struct{ s_addr in_addr_t } 3658 } /* in.h:264:1 */ 3659 3660 type group_req = struct { 3661 gr_interface uint32_t 3662 _ [4]byte 3663 gr_group struct { 3664 ss_family sa_family_t 3665 __ss_padding [118]uint8 3666 __ss_align uint64 3667 } 3668 } /* in.h:275:1 */ 3669 3670 type group_source_req = struct { 3671 gsr_interface uint32_t 3672 _ [4]byte 3673 gsr_group struct { 3674 ss_family sa_family_t 3675 __ss_padding [118]uint8 3676 __ss_align uint64 3677 } 3678 gsr_source struct { 3679 ss_family sa_family_t 3680 __ss_padding [118]uint8 3681 __ss_align uint64 3682 } 3683 } /* in.h:280:1 */ 3684 3685 type group_filter = struct { 3686 gf_interface uint32_t 3687 _ [4]byte 3688 gf_group struct { 3689 ss_family sa_family_t 3690 __ss_padding [118]uint8 3691 __ss_align uint64 3692 } 3693 gf_fmode uint32_t 3694 gf_numsrc uint32_t 3695 gf_slist [1]struct { 3696 ss_family sa_family_t 3697 __ss_padding [118]uint8 3698 __ss_align uint64 3699 } 3700 } /* in.h:286:1 */ 3701 3702 type in_pktinfo = struct { 3703 ipi_ifindex int32 3704 ipi_spec_dst struct{ s_addr in_addr_t } 3705 ipi_addr struct{ s_addr in_addr_t } 3706 } /* in.h:297:1 */ 3707 3708 type in6_pktinfo = struct { 3709 ipi6_addr struct { 3710 __in6_union struct { 3711 _ [0]uint32 3712 __s6_addr [16]uint8_t 3713 } 3714 } 3715 ipi6_ifindex uint32 3716 } /* in.h:303:1 */ 3717 3718 type ip6_mtuinfo = struct { 3719 ip6m_addr struct { 3720 sin6_family sa_family_t 3721 sin6_port in_port_t 3722 sin6_flowinfo uint32_t 3723 sin6_addr struct { 3724 __in6_union struct { 3725 _ [0]uint32 3726 __s6_addr [16]uint8_t 3727 } 3728 } 3729 sin6_scope_id uint32_t 3730 } 3731 ip6m_mtu uint32_t 3732 } /* in.h:308:1 */ 3733 3734 type addrinfo = struct { 3735 ai_flags int32 3736 ai_family int32 3737 ai_socktype int32 3738 ai_protocol int32 3739 ai_addrlen socklen_t 3740 _ [4]byte 3741 ai_addr uintptr 3742 ai_canonname uintptr 3743 ai_next uintptr 3744 } /* netdb.h:16:1 */ 3745 3746 // Legacy functions follow (marked OBsolete in SUS) 3747 3748 type netent = struct { 3749 n_name uintptr 3750 n_aliases uintptr 3751 n_addrtype int32 3752 n_net uint32_t 3753 } /* netdb.h:62:1 */ 3754 3755 type hostent = struct { 3756 h_name uintptr 3757 h_aliases uintptr 3758 h_addrtype int32 3759 h_length int32 3760 h_addr_list uintptr 3761 } /* netdb.h:69:1 */ 3762 3763 type servent = struct { 3764 s_name uintptr 3765 s_aliases uintptr 3766 s_port int32 3767 _ [4]byte 3768 s_proto uintptr 3769 } /* netdb.h:78:1 */ 3770 3771 type protoent = struct { 3772 p_name uintptr 3773 p_aliases uintptr 3774 p_proto int32 3775 _ [4]byte 3776 } /* netdb.h:85:1 */ 3777 3778 type aibuf = struct { 3779 ai struct { 3780 ai_flags int32 3781 ai_family int32 3782 ai_socktype int32 3783 ai_protocol int32 3784 ai_addrlen socklen_t 3785 _ [4]byte 3786 ai_addr uintptr 3787 ai_canonname uintptr 3788 ai_next uintptr 3789 } 3790 sa struct { 3791 sin struct { 3792 sin_family sa_family_t 3793 sin_port in_port_t 3794 sin_addr struct{ s_addr in_addr_t } 3795 sin_zero [8]uint8_t 3796 } 3797 _ [12]byte 3798 } 3799 lock [1]int32 3800 slot int16 3801 ref int16 3802 _ [4]byte 3803 } /* lookup.h:10:1 */ 3804 3805 type sa = struct { 3806 sin struct { 3807 sin_family sa_family_t 3808 sin_port in_port_t 3809 sin_addr struct{ s_addr in_addr_t } 3810 sin_zero [8]uint8_t 3811 } 3812 _ [12]byte 3813 } /* lookup.h:10:1 */ 3814 3815 type address = struct { 3816 family int32 3817 scopeid uint32 3818 addr [16]uint8_t 3819 sortkey int32 3820 } /* lookup.h:20:1 */ 3821 3822 type service = struct { 3823 port uint16_t 3824 proto uint8 3825 socktype uint8 3826 } /* lookup.h:27:1 */ 3827 3828 type resolvconf = struct { 3829 ns [3]struct { 3830 family int32 3831 scopeid uint32 3832 addr [16]uint8_t 3833 sortkey int32 3834 } 3835 nns uint32 3836 attempts uint32 3837 ndots uint32 3838 timeout uint32 3839 } /* lookup.h:34:1 */ 3840 3841 func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ 3842 var cnt size_t 3843 cnt = uint64(1) 3844 __1: 3845 if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) { 3846 goto __3 3847 } 3848 goto __2 3849 __2: 3850 cnt++ 3851 p = (*addrinfo)(unsafe.Pointer(p)).ai_next 3852 goto __1 3853 goto __3 3854 __3: 3855 ; 3856 var b uintptr = p - uintptr(uint64(uintptr(0))) 3857 b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).slot) 3858 //TODO LOCK(b->lock); 3859 if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) { 3860 Xfree(tls, b) 3861 } 3862 //TODO else UNLOCK(b->lock); 3863 } 3864 3865 func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ 3866 bp := tls.Alloc(1608) 3867 defer tls.Free(1608) 3868 3869 // var ports [2]service at bp, 8 3870 3871 // var addrs [48]address at bp+8, 1344 3872 3873 // var canon [256]uint8 at bp+1352, 256 3874 3875 var outcanon uintptr 3876 var nservs int32 3877 var naddrs int32 3878 var nais int32 3879 var canon_len int32 3880 var i int32 3881 var j int32 3882 var k int32 3883 var family int32 = 0 3884 var flags int32 = 0 3885 var proto int32 = 0 3886 var socktype int32 = 0 3887 var out uintptr 3888 3889 if !(host != 0) && !(serv != 0) { 3890 return -2 3891 } 3892 3893 if hint != 0 { 3894 family = (*addrinfo)(unsafe.Pointer(hint)).ai_family 3895 flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags 3896 proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol 3897 socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype 3898 3899 var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400 3900 if flags&mask != flags { 3901 return -1 3902 } 3903 3904 switch family { 3905 case 2: 3906 fallthrough 3907 case 10: 3908 fallthrough 3909 case 0: 3910 break 3911 fallthrough 3912 default: 3913 return -6 3914 } 3915 } 3916 3917 if flags&0x20 != 0 { 3918 Xabort(tls) //TODO- 3919 // /* Define the "an address is configured" condition for address 3920 // * families via ability to create a socket for the family plus 3921 // * routability of the loopback address for the family. */ 3922 // static const struct sockaddr_in lo4 = { 3923 // .sin_family = AF_INET, .sin_port = 65535, 3924 // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN 3925 // ? 0x7f000001 : 0x0100007f 3926 // }; 3927 // static const struct sockaddr_in6 lo6 = { 3928 // .sin6_family = AF_INET6, .sin6_port = 65535, 3929 // .sin6_addr = IN6ADDR_LOOPBACK_INIT 3930 // }; 3931 // int tf[2] = { AF_INET, AF_INET6 }; 3932 // const void *ta[2] = { &lo4, &lo6 }; 3933 // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; 3934 // for (i=0; i<2; i++) { 3935 // if (family==tf[1-i]) continue; 3936 // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, 3937 // IPPROTO_UDP); 3938 // if (s>=0) { 3939 // int cs; 3940 // pthread_setcancelstate( 3941 // PTHREAD_CANCEL_DISABLE, &cs); 3942 // int r = connect(s, ta[i], tl[i]); 3943 // pthread_setcancelstate(cs, 0); 3944 // close(s); 3945 // if (!r) continue; 3946 // } 3947 // switch (errno) { 3948 // case EADDRNOTAVAIL: 3949 // case EAFNOSUPPORT: 3950 // case EHOSTUNREACH: 3951 // case ENETDOWN: 3952 // case ENETUNREACH: 3953 // break; 3954 // default: 3955 // return EAI_SYSTEM; 3956 // } 3957 // if (family == tf[i]) return EAI_NONAME; 3958 // family = tf[1-i]; 3959 // } 3960 } 3961 3962 nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags) 3963 if nservs < 0 { 3964 return nservs 3965 } 3966 3967 naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags) 3968 if naddrs < 0 { 3969 return naddrs 3970 } 3971 3972 nais = nservs * naddrs 3973 canon_len = int32(Xstrlen(tls, bp+1352)) 3974 out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1)) 3975 if !(out != 0) { 3976 return -10 3977 } 3978 3979 if canon_len != 0 { 3980 outcanon = out + uintptr(nais)*88 3981 Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1)) 3982 } else { 3983 outcanon = uintptr(0) 3984 } 3985 3986 for k = AssignInt32(&i, 0); i < naddrs; i++ { 3987 j = 0 3988 __1: 3989 if !(j < nservs) { 3990 goto __3 3991 } 3992 { 3993 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k) 3994 //TODO out[k].ai = (struct addrinfo){ 3995 //TODO .ai_family = addrs[i].family, 3996 //TODO .ai_socktype = ports[j].socktype, 3997 //TODO .ai_protocol = ports[j].proto, 3998 //TODO .ai_addrlen = addrs[i].family == AF_INET 3999 //TODO ? sizeof(struct sockaddr_in) 4000 //TODO : sizeof(struct sockaddr_in6), 4001 //TODO .ai_addr = (void *)&out[k].sa, 4002 //TODO .ai_canonname = outcanon }; 4003 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family 4004 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).socktype) 4005 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).proto) 4006 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 { 4007 if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).family == 2 { 4008 return uint32(unsafe.Sizeof(sockaddr_in{})) 4009 } 4010 return uint32(unsafe.Sizeof(sockaddr_in6{})) 4011 }() 4012 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = out + uintptr(k)*88 + 48 4013 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon 4014 if k != 0 { 4015 (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).ai.ai_next = out + uintptr(k)*88 4016 } 4017 switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family { 4018 case 2: 4019 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_family = sa_family_t(2) 4020 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) 4021 Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4)) 4022 break 4023 case 10: 4024 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_family = sa_family_t(10) 4025 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) 4026 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).scopeid 4027 Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16)) 4028 break 4029 } 4030 4031 } 4032 goto __2 4033 __2: 4034 j++ 4035 k++ 4036 goto __1 4037 goto __3 4038 __3: 4039 } 4040 (*aibuf)(unsafe.Pointer(out)).ref = int16(nais) 4041 *(*uintptr)(unsafe.Pointer(res)) = out 4042 return 0 4043 } 4044 4045 type ucred = struct { 4046 pid pid_t 4047 uid uid_t 4048 gid gid_t 4049 } /* socket.h:57:1 */ 4050 4051 type mmsghdr = struct { 4052 msg_hdr struct { 4053 msg_name uintptr 4054 msg_namelen socklen_t 4055 _ [4]byte 4056 msg_iov uintptr 4057 __pad1 int32 4058 msg_iovlen int32 4059 msg_control uintptr 4060 __pad2 int32 4061 msg_controllen socklen_t 4062 msg_flags int32 4063 _ [4]byte 4064 } 4065 msg_len uint32 4066 _ [4]byte 4067 } /* socket.h:63:1 */ 4068 4069 func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ 4070 bp := tls.Alloc(8) 4071 defer tls.Free(8) 4072 4073 var size size_t = uint64(63) 4074 // var res uintptr at bp, 8 4075 4076 var err int32 4077 for ok := true; ok; ok = err == 34 { 4078 Xfree(tls, _sh) 4079 _sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) 4080 if !(_sh != 0) { 4081 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 4082 return uintptr(0) 4083 } 4084 err = Xgethostbyaddr_r(tls, a, l, af, _sh, 4085 _sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 4086 } 4087 if err != 0 { 4088 return uintptr(0) 4089 } 4090 return _sh 4091 } 4092 4093 var _sh uintptr /* gethostbyaddr.c:9:24: */ 4094 4095 func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ 4096 bp := tls.Alloc(28) 4097 defer tls.Free(28) 4098 4099 //TODO union { 4100 //TODO struct sockaddr_in sin; 4101 //TODO struct sockaddr_in6 sin6; 4102 //TODO } sa = { .sin.sin_family = af }; 4103 *(*struct { 4104 sin sockaddr_in 4105 _ [12]byte 4106 })(unsafe.Pointer(bp)) = struct { 4107 sin sockaddr_in 4108 _ [12]byte 4109 }{} //TODO- 4110 (*sockaddr_in)(unsafe.Pointer(bp)).sin_family = sa_family_t(af) //TODO- 4111 var sl socklen_t 4112 if af == 10 { 4113 sl = uint32(unsafe.Sizeof(sockaddr_in6{})) 4114 } else { 4115 sl = uint32(unsafe.Sizeof(sockaddr_in{})) 4116 } 4117 var i int32 4118 4119 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 4120 4121 // Load address argument into sockaddr structure 4122 if af == 10 && l == socklen_t(16) { 4123 Xmemcpy(tls, bp+8, a, uint64(16)) 4124 } else if af == 2 && l == socklen_t(4) { 4125 Xmemcpy(tls, bp+4, a, uint64(4)) 4126 } else { 4127 *(*int32)(unsafe.Pointer(err)) = 3 4128 return 22 4129 } 4130 4131 // Align buffer and check for space for pointers and ip address 4132 i = int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))) 4133 if !(i != 0) { 4134 i = int32(unsafe.Sizeof(uintptr(0))) 4135 } 4136 if buflen <= uint64(5)*uint64(unsafe.Sizeof(uintptr(0)))-uint64(i)+uint64(l) { 4137 return 34 4138 } 4139 buf += uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i)) 4140 buflen = buflen - (uint64(5)*uint64(unsafe.Sizeof(uintptr(0))) - uint64(i) + uint64(l)) 4141 4142 (*hostent)(unsafe.Pointer(h)).h_addr_list = buf 4143 buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) 4144 (*hostent)(unsafe.Pointer(h)).h_aliases = buf 4145 buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) 4146 4147 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf 4148 Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) 4149 buf += uintptr(l) 4150 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) 4151 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf 4152 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) 4153 4154 switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { 4155 case -3: 4156 *(*int32)(unsafe.Pointer(err)) = 2 4157 return 11 4158 case -12: 4159 return 34 4160 default: 4161 fallthrough 4162 case -10: 4163 fallthrough 4164 case -11: 4165 fallthrough 4166 case -4: 4167 *(*int32)(unsafe.Pointer(err)) = 3 4168 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 4169 case 0: 4170 break 4171 } 4172 4173 (*hostent)(unsafe.Pointer(h)).h_addrtype = af 4174 (*hostent)(unsafe.Pointer(h)).h_length = int32(l) 4175 (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) 4176 *(*uintptr)(unsafe.Pointer(res)) = h 4177 return 0 4178 } 4179 4180 func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ 4181 return Xgethostbyname2(tls, name, 2) 4182 } 4183 4184 func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ 4185 bp := tls.Alloc(8) 4186 defer tls.Free(8) 4187 4188 var size size_t = uint64(63) 4189 // var res uintptr at bp, 8 4190 4191 var err int32 4192 for ok := true; ok; ok = err == 34 { 4193 Xfree(tls, _sh1) 4194 _sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) 4195 if !(_sh1 != 0) { 4196 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 4197 return uintptr(0) 4198 } 4199 err = Xgethostbyname2_r(tls, name, af, _sh1, 4200 _sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 4201 } 4202 if err != 0 { 4203 return uintptr(0) 4204 } 4205 return _sh1 4206 } 4207 4208 var _sh1 uintptr /* gethostbyname2.c:10:24: */ 4209 4210 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: */ 4211 bp := tls.Alloc(1600) 4212 defer tls.Free(1600) 4213 4214 // var addrs [48]address at bp, 1344 4215 4216 // var canon [256]uint8 at bp+1344, 256 4217 4218 var i int32 4219 var cnt int32 4220 var align size_t 4221 var need size_t 4222 4223 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 4224 cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02) 4225 if cnt < 0 { 4226 switch cnt { 4227 case -2: 4228 *(*int32)(unsafe.Pointer(err)) = 1 4229 return 2 4230 fallthrough 4231 case -3: 4232 *(*int32)(unsafe.Pointer(err)) = 2 4233 return 11 4234 fallthrough 4235 default: 4236 fallthrough 4237 case -4: 4238 *(*int32)(unsafe.Pointer(err)) = 3 4239 return 74 4240 fallthrough 4241 case -10: 4242 fallthrough 4243 case -11: 4244 *(*int32)(unsafe.Pointer(err)) = 3 4245 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 4246 } 4247 } 4248 4249 (*hostent)(unsafe.Pointer(h)).h_addrtype = af 4250 (*hostent)(unsafe.Pointer(h)).h_length = func() int32 { 4251 if af == 10 { 4252 return 16 4253 } 4254 return 4 4255 }() 4256 4257 // Align buffer 4258 align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)) 4259 4260 need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0))) 4261 need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).h_length)) 4262 need = need + (Xstrlen(tls, name) + uint64(1)) 4263 need = need + (Xstrlen(tls, bp+1344) + uint64(1)) 4264 need = need + align 4265 4266 if need > buflen { 4267 return 34 4268 } 4269 4270 buf += uintptr(align) 4271 (*hostent)(unsafe.Pointer(h)).h_aliases = buf 4272 buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0)))) 4273 (*hostent)(unsafe.Pointer(h)).h_addr_list = buf 4274 buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0)))) 4275 4276 for i = 0; i < cnt; i++ { 4277 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf 4278 buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length) 4279 Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)), bp+uintptr(i)*28+8, uint64((*hostent)(unsafe.Pointer(h)).h_length)) 4280 } 4281 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0) 4282 4283 (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf) 4284 Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344) 4285 buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1)) 4286 4287 if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 { 4288 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf 4289 Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name) 4290 buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1)) 4291 } else { 4292 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) 4293 } 4294 4295 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0) 4296 4297 *(*uintptr)(unsafe.Pointer(res)) = h 4298 return 0 4299 } 4300 4301 func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ 4302 return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) 4303 } 4304 4305 type if_nameindex = struct { 4306 if_index uint32 4307 _ [4]byte 4308 if_name uintptr 4309 } /* if.h:12:1 */ 4310 4311 type ifaddr = struct { 4312 ifa_addr struct { 4313 sa_family sa_family_t 4314 sa_data [14]uint8 4315 } 4316 ifa_ifu struct { 4317 ifu_broadaddr struct { 4318 sa_family sa_family_t 4319 sa_data [14]uint8 4320 } 4321 } 4322 ifa_ifp uintptr 4323 ifa_next uintptr 4324 } /* if.h:51:1 */ 4325 4326 type ifmap = struct { 4327 mem_start uint64 4328 mem_end uint64 4329 base_addr uint16 4330 irq uint8 4331 dma uint8 4332 port uint8 4333 _ [3]byte 4334 } /* if.h:64:1 */ 4335 4336 type ifreq = struct { 4337 ifr_ifrn struct{ ifrn_name [16]uint8 } 4338 ifr_ifru struct { 4339 _ [0]uint64 4340 ifru_addr struct { 4341 sa_family sa_family_t 4342 sa_data [14]uint8 4343 } 4344 _ [8]byte 4345 } 4346 } /* if.h:76:1 */ 4347 4348 type ifconf = struct { 4349 ifc_len int32 4350 _ [4]byte 4351 ifc_ifcu struct{ ifcu_buf uintptr } 4352 } /* if.h:116:1 */ 4353 4354 type ns_sect = uint32 /* nameser.h:37:3 */ 4355 4356 type __ns_msg = struct { 4357 _msg uintptr 4358 _eom uintptr 4359 _id uint16_t 4360 _flags uint16_t 4361 _counts [4]uint16_t 4362 _ [4]byte 4363 _sections [4]uintptr 4364 _sect ns_sect 4365 _rrnum int32 4366 _msg_ptr uintptr 4367 } /* nameser.h:39:9 */ 4368 4369 type ns_msg = __ns_msg /* nameser.h:46:3 */ 4370 4371 type _ns_flagdata = struct { 4372 mask int32 4373 shift int32 4374 } /* nameser.h:48:1 */ 4375 4376 type __ns_rr = struct { 4377 name [1025]uint8 4378 _ [1]byte 4379 __type uint16_t 4380 rr_class uint16_t 4381 _ [2]byte 4382 ttl uint32_t 4383 rdlength uint16_t 4384 _ [2]byte 4385 rdata uintptr 4386 } /* nameser.h:59:9 */ 4387 4388 type ns_rr = __ns_rr /* nameser.h:66:3 */ 4389 4390 type ns_flag = uint32 /* nameser.h:87:3 */ 4391 4392 type ns_opcode = uint32 /* nameser.h:96:3 */ 4393 4394 type ns_rcode = uint32 /* nameser.h:115:3 */ 4395 4396 type ns_update_operation = uint32 /* nameser.h:121:3 */ 4397 4398 type ns_tsig_key1 = struct { 4399 name [1025]uint8 4400 alg [1025]uint8 4401 _ [6]byte 4402 data uintptr 4403 len int32 4404 _ [4]byte 4405 } /* nameser.h:123:1 */ 4406 4407 type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ 4408 4409 type ns_tcp_tsig_state1 = struct { 4410 counter int32 4411 _ [4]byte 4412 key uintptr 4413 ctx uintptr 4414 sig [512]uint8 4415 siglen int32 4416 _ [4]byte 4417 } /* nameser.h:130:1 */ 4418 4419 type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ 4420 4421 type ns_type = uint32 /* nameser.h:200:3 */ 4422 4423 type ns_class = uint32 /* nameser.h:219:3 */ 4424 4425 type ns_key_types = uint32 /* nameser.h:226:3 */ 4426 4427 type ns_cert_types = uint32 /* nameser.h:234:3 */ 4428 4429 type HEADER = struct { 4430 _ [0]uint32 4431 id uint32 /* unsigned id: 16, unsigned qr: 1, unsigned opcode: 4, unsigned aa: 1, unsigned tc: 1, unsigned rd: 1, unsigned ra: 1, unsigned unused: 1, unsigned ad: 1, unsigned cd: 1, unsigned rcode: 4 */ 4432 qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ 4433 nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ 4434 } /* nameser.h:353:3 */ 4435 4436 // unused; purely for broken apps 4437 type __res_state = struct { 4438 retrans int32 4439 retry int32 4440 options uint64 4441 nscount int32 4442 nsaddr_list [3]struct { 4443 sin_family sa_family_t 4444 sin_port in_port_t 4445 sin_addr struct{ s_addr in_addr_t } 4446 sin_zero [8]uint8_t 4447 } 4448 id uint16 4449 _ [2]byte 4450 dnsrch [7]uintptr 4451 defdname [256]uint8 4452 pfcode uint64 4453 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ 4454 _ [4]byte 4455 sort_list [10]struct { 4456 addr struct{ s_addr in_addr_t } 4457 mask uint32_t 4458 } 4459 qhook uintptr 4460 rhook uintptr 4461 res_h_errno int32 4462 _vcsock int32 4463 _flags uint32 4464 _ [4]byte 4465 _u struct { 4466 _ [0]uint64 4467 pad [52]uint8 4468 _ [4]byte 4469 } 4470 } /* resolv.h:26:9 */ 4471 4472 // unused; purely for broken apps 4473 type res_state = uintptr /* resolv.h:62:3 */ 4474 4475 type res_sym = struct { 4476 number int32 4477 _ [4]byte 4478 name uintptr 4479 humanname uintptr 4480 } /* resolv.h:70:1 */ 4481 4482 func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ 4483 p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0)))) 4484 *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(0) 4485 for ok := true; ok; ok = x != 0 { 4486 *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(uint32('0') + x%uint32(10)) 4487 x = x / uint32(10) 4488 } 4489 return p 4490 } 4491 4492 func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ 4493 bp := tls.Alloc(32) 4494 defer tls.Free(32) 4495 4496 Xsprintf(tls, s, ts+25, 4497 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))))) 4498 } 4499 4500 func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ 4501 var i int32 4502 for i = 15; i >= 0; i-- { 4503 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15] 4504 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.') 4505 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4] 4506 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.') 4507 } 4508 Xstrcpy(tls, s, ts+50) 4509 } 4510 4511 var _sxdigits = *(*[17]uint8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */ 4512 4513 func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ 4514 bp := tls.Alloc(556) 4515 defer tls.Free(556) 4516 4517 // var line [512]uint8 at bp+16, 512 4518 4519 var p uintptr 4520 var z uintptr 4521 var _buf [1032]uint8 4522 _ = _buf 4523 // var atmp [16]uint8 at bp, 16 4524 4525 // var iplit address at bp+528, 28 4526 4527 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 4528 var f uintptr = Xfopen(tls, ts+76, ts+87) 4529 if !(f != 0) { 4530 return 4531 } 4532 if family == 2 { 4533 Xmemcpy(tls, bp+uintptr(12), a, uint64(4)) 4534 Xmemcpy(tls, bp, ts+90, uint64(12)) 4535 a = bp /* &atmp[0] */ 4536 } 4537 for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]uint8{})), f) != 0 { 4538 if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 { 4539 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n') 4540 *(*uint8)(unsafe.Pointer(p)) = uint8(0) 4541 } 4542 4543 for p = bp + 16; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { 4544 } 4545 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0) 4546 if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 { 4547 continue 4548 } 4549 4550 if (*address)(unsafe.Pointer(bp+528)).family == 2 { 4551 Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4)) 4552 Xmemcpy(tls, bp+528+8, ts+90, uint64(12)) 4553 (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0) 4554 } 4555 4556 if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).scopeid != scopeid { 4557 continue 4558 } 4559 4560 for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ { 4561 } 4562 for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ { 4563 } 4564 *(*uint8)(unsafe.Pointer(z)) = uint8(0) 4565 if (int64(z)-int64(p))/1 < int64(256) { 4566 Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1))) 4567 break 4568 } 4569 } 4570 //TODO __fclose_ca(f); 4571 Xfclose(tls, f) 4572 } 4573 4574 func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ 4575 Xabort(tls) //TODO- 4576 // unsigned long svport; 4577 // char line[128], *p, *z; 4578 // unsigned char _buf[1032]; 4579 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 4580 // if (!f) return; 4581 // while (fgets(line, sizeof line, f)) { 4582 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 4583 4584 // for (p=line; *p && !isspace(*p); p++); 4585 // if (!*p) continue; 4586 // *p++ = 0; 4587 // svport = strtoul(p, &z, 10); 4588 4589 // if (svport != port || z==p) continue; 4590 // if (dgram && strncmp(z, "/udp", 4)) continue; 4591 // if (!dgram && strncmp(z, "/tcp", 4)) continue; 4592 // if (p-line > 32) continue; 4593 4594 // memcpy(buf, line, p-line); 4595 // break; 4596 // } 4597 // __fclose_ca(f); 4598 } 4599 4600 func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */ 4601 bp := tls.Alloc(347) 4602 defer tls.Free(347) 4603 4604 // var ptr [78]uint8 at bp, 78 4605 4606 // var buf [256]uint8 at bp+78, 256 4607 4608 // var num [13]uint8 at bp+334, 13 4609 4610 var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) 4611 var a uintptr 4612 var scopeid uint32 4613 4614 switch af { 4615 case 2: 4616 a = sa1 + 4 4617 if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{})) { 4618 return -6 4619 } 4620 mkptr4(tls, bp, a) 4621 scopeid = uint32(0) 4622 break 4623 case 10: 4624 a = sa1 + 8 4625 if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{})) { 4626 return -6 4627 } 4628 if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { 4629 mkptr6(tls, bp, a) 4630 } else { 4631 mkptr4(tls, bp, a+uintptr(12)) 4632 } 4633 scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id 4634 break 4635 default: 4636 return -6 4637 } 4638 4639 if node != 0 && nodelen != 0 { 4640 *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0) 4641 if !(flags&0x01 != 0) { 4642 reverse_hosts(tls, bp+78, a, scopeid, af) 4643 } 4644 if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) { 4645 Xabort(tls) //TODO- 4646 // unsigned char query[18+PTR_MAX], reply[512]; 4647 // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, 4648 // 0, 0, 0, query, sizeof query); 4649 // query[3] = 0; /* don't need AD flag */ 4650 // int rlen = __res_send(query, qlen, reply, sizeof reply); 4651 // buf[0] = 0; 4652 // if (rlen > 0) 4653 // __dns_parse(reply, rlen, dns_parse_callback, buf); 4654 } 4655 if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) { 4656 if flags&0x08 != 0 { 4657 return -2 4658 } 4659 Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]uint8{}))) 4660 if scopeid != 0 { 4661 Xabort(tls) //TODO- 4662 // char *p = 0, tmp[IF_NAMESIZE+1]; 4663 // if (!(flags & NI_NUMERICSCOPE) && 4664 // (IN6_IS_ADDR_LINKLOCAL(a) || 4665 // IN6_IS_ADDR_MC_LINKLOCAL(a))) 4666 // p = if_indextoname(scopeid, tmp+1); 4667 // if (!p) 4668 // p = itoa(num, scopeid); 4669 // *--p = '%'; 4670 // strcat(buf, p); 4671 } 4672 } 4673 if Xstrlen(tls, bp+78) >= size_t(nodelen) { 4674 return -12 4675 } 4676 Xstrcpy(tls, node, bp+78) 4677 } 4678 4679 if serv != 0 && servlen != 0 { 4680 var p uintptr = bp + 78 /* buf */ 4681 var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) 4682 *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0) 4683 if !(flags&0x02 != 0) { 4684 reverse_services(tls, bp+78, port, flags&0x10) 4685 } 4686 if !(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { 4687 p = itoa(tls, bp+334, uint32(port)) 4688 } 4689 if Xstrlen(tls, p) >= size_t(servlen) { 4690 return -12 4691 } 4692 Xstrcpy(tls, serv, p) 4693 } 4694 4695 return 0 4696 } 4697 4698 var Xh_errno int32 /* h_errno.c:4:5: */ 4699 4700 func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ 4701 return uintptr(unsafe.Pointer(&Xh_errno)) 4702 } 4703 4704 func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ 4705 bp := tls.Alloc(40) 4706 defer tls.Free(40) 4707 4708 var s uintptr = s0 4709 var d uintptr = dest 4710 *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)} 4711 // var z uintptr at bp+32, 8 4712 4713 var i int32 4714 4715 for i = 0; i < 4; i++ { 4716 *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0) 4717 if *(*uintptr)(unsafe.Pointer(bp + 32)) == s || *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))) != 0 && int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != '.' || !(func() int32 { 4718 if 0 != 0 { 4719 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s)))) 4720 } 4721 return Bool32(uint32(*(*uint8)(unsafe.Pointer(s)))-uint32('0') < uint32(10)) 4722 }() != 0) { 4723 return 0 4724 } 4725 if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) { 4726 break 4727 } 4728 s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1) 4729 } 4730 if i == 4 { 4731 return 0 4732 } 4733 switch i { 4734 case 0: 4735 *(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff) 4736 AssignShrPtrUint64(bp, int(24)) 4737 fallthrough 4738 case 1: 4739 *(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff) 4740 AssignShrPtrUint64(bp+1*8, int(16)) 4741 fallthrough 4742 case 2: 4743 *(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff) 4744 AssignShrPtrUint64(bp+2*8, int(8)) 4745 } 4746 for i = 0; i < 4; i++ { 4747 if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) { 4748 return 0 4749 } 4750 *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8))) 4751 } 4752 return 1 4753 } 4754 4755 func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ 4756 bp := tls.Alloc(276) 4757 defer tls.Free(276) 4758 4759 var a uintptr = a0 4760 var i int32 4761 var j int32 4762 var max int32 4763 var best int32 4764 // var buf [100]uint8 at bp+176, 100 4765 4766 switch af { 4767 case 2: 4768 if socklen_t(Xsnprintf(tls, s, uint64(l), ts+103, 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 { 4769 return s 4770 } 4771 break 4772 case 10: 4773 if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { 4774 Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]uint8{})), 4775 ts+115, 4776 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))), 4777 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))), 4778 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))), 4779 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))))) 4780 } else { 4781 Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]uint8{})), 4782 ts+139, 4783 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))), 4784 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))), 4785 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))), 4786 int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) 4787 } 4788 // Replace longest /(^0|:)[:0]{2,}/ with "::" 4789 i = AssignInt32(&best, 0) 4790 max = 2 4791 for ; *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ { 4792 if i != 0 && int32(*(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' { 4793 continue 4794 } 4795 j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169)) 4796 if j > max { 4797 best = i 4798 max = j 4799 } 4800 } 4801 if max > 3 { 4802 *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrUint8(bp+176+uintptr(best+1), uint8(':')) 4803 Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1)) 4804 } 4805 if Xstrlen(tls, bp+176) < size_t(l) { 4806 Xstrcpy(tls, s, bp+176) 4807 return s 4808 } 4809 break 4810 default: 4811 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 4812 return uintptr(0) 4813 } 4814 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28 4815 return uintptr(0) 4816 } 4817 4818 func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ 4819 if c-uint32('0') < uint32(10) { 4820 return int32(c - uint32('0')) 4821 } 4822 c = c | uint32(32) 4823 if c-uint32('a') < uint32(6) { 4824 return int32(c - uint32('a') + uint32(10)) 4825 } 4826 return -1 4827 } 4828 4829 func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ 4830 bp := tls.Alloc(16) 4831 defer tls.Free(16) 4832 4833 // var ip [8]uint16_t at bp, 16 4834 4835 var a uintptr = a0 4836 var i int32 4837 var j int32 4838 var v int32 4839 var d int32 4840 var brk int32 = -1 4841 var need_v4 int32 = 0 4842 4843 if af == 2 { 4844 for i = 0; i < 4; i++ { 4845 for v = AssignInt32(&j, 0); j < 3 && func() int32 { 4846 if 0 != 0 { 4847 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))) 4848 } 4849 return Bool32(uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10)) 4850 }() != 0; j++ { 4851 v = 10*v + int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) - '0' 4852 } 4853 if j == 0 || j > 1 && int32(*(*uint8)(unsafe.Pointer(s))) == '0' || v > 255 { 4854 return 0 4855 } 4856 *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) 4857 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 { 4858 return 1 4859 } 4860 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' { 4861 return 0 4862 } 4863 s += uintptr(j + 1) 4864 } 4865 return 0 4866 } else if af != 10 { 4867 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 4868 return -1 4869 } 4870 4871 if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' { 4872 return 0 4873 } 4874 4875 for i = 0; ; i++ { 4876 if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && brk < 0 { 4877 brk = i 4878 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0) 4879 if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { 4880 break 4881 } 4882 if i == 7 { 4883 return 0 4884 } 4885 continue 4886 } 4887 for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ { 4888 v = 16*v + d 4889 } 4890 if j == 0 { 4891 return 0 4892 } 4893 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v) 4894 if !(int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) { 4895 break 4896 } 4897 if i == 7 { 4898 return 0 4899 } 4900 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != ':' { 4901 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 { 4902 return 0 4903 } 4904 need_v4 = 1 4905 i++ 4906 break 4907 } 4908 s += uintptr(j + 1) 4909 } 4910 if brk >= 0 { 4911 Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk))) 4912 for j = 0; j < 7-i; j++ { 4913 *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0) 4914 } 4915 } 4916 for j = 0; j < 8; j++ { 4917 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8) 4918 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) 4919 } 4920 if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 { 4921 return 0 4922 } 4923 return 1 4924 } 4925 4926 func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ 4927 bp := tls.Alloc(96) 4928 defer tls.Free(96) 4929 4930 // var a4 in_addr at bp, 4 4931 4932 // var a6 in6_addr at bp+68, 16 4933 4934 if X__inet_aton(tls, name, bp) > 0 { 4935 if family == 10 { // wrong family 4936 return -2 4937 } 4938 Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{}))) 4939 (*address)(unsafe.Pointer(buf)).family = 2 4940 (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) 4941 return 1 4942 } 4943 // var tmp [64]uint8 at bp+4, 64 4944 4945 var p uintptr = Xstrchr(tls, name, '%') 4946 // var z uintptr at bp+88, 8 4947 4948 var scopeid uint64 = uint64(0) 4949 if p != 0 && (int64(p)-int64(name))/1 < int64(64) { 4950 Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1)) 4951 *(*uint8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = uint8(0) 4952 name = bp + 4 /* &tmp[0] */ 4953 } 4954 4955 if Xinet_pton(tls, 10, name, bp+68) <= 0 { 4956 return 0 4957 } 4958 if family == 2 { // wrong family 4959 return -2 4960 } 4961 4962 Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{}))) 4963 (*address)(unsafe.Pointer(buf)).family = 10 4964 if p != 0 { 4965 if func() int32 { 4966 if 0 != 0 { 4967 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) 4968 } 4969 return Bool32(uint32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10)) 4970 }() != 0 { 4971 scopeid = Xstrtoull(tls, p, bp+88, 10) 4972 } else { 4973 *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1) 4974 } 4975 if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 { 4976 Xabort(tls) //TODO- 4977 // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && 4978 // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) 4979 // return EAI_NONAME; 4980 // scopeid = if_nametoindex(p); 4981 // if (!scopeid) return EAI_NONAME; 4982 } 4983 if scopeid > uint64(0xffffffff) { 4984 return -2 4985 } 4986 } 4987 (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid) 4988 return 1 4989 } 4990 4991 func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ 4992 var s uintptr 4993 //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; 4994 if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) { 4995 return 0 4996 } 4997 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++ { 4998 } 4999 return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) 5000 } 5001 5002 var Xzero_struct_address address /* lookup_name.c:27:16: */ 5003 5004 func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ 5005 var cnt int32 = 0 5006 if name != 0 { 5007 return 0 5008 } 5009 if flags&0x01 != 0 { 5010 //TODO if (family != AF_INET6) 5011 //TODO buf[cnt++] = (struct address){ .family = AF_INET }; 5012 if family != 10 { 5013 var x = Xzero_struct_address 5014 x.family = 2 5015 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 5016 } 5017 //TODO if (family != AF_INET) 5018 //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; 5019 if family != 2 { 5020 var x = Xzero_struct_address 5021 x.family = 10 5022 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 5023 } 5024 } else { 5025 Xabort(tls) //TODO- 5026 // if (family != AF_INET6) 5027 // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; 5028 // if (family != AF_INET) 5029 // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; 5030 } 5031 return cnt 5032 } 5033 5034 func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ 5035 return X__lookup_ipliteral(tls, buf, name, family) 5036 } 5037 5038 func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ 5039 bp := tls.Alloc(512) 5040 defer tls.Free(512) 5041 5042 // var line [512]uint8 at bp, 512 5043 5044 var l size_t = Xstrlen(tls, name) 5045 var cnt int32 = 0 5046 var badfam int32 = 0 5047 var _buf [1032]uint8 5048 _ = _buf 5049 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 5050 var _f FILE 5051 _ = _f 5052 var f uintptr = Xfopen(tls, ts+76, ts+87) 5053 if !(f != 0) { 5054 switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { 5055 case 2: 5056 fallthrough 5057 case 20: 5058 fallthrough 5059 case 13: 5060 return 0 5061 fallthrough 5062 default: 5063 return -11 5064 } 5065 } 5066 for Xfgets(tls, bp, int32(unsafe.Sizeof([512]uint8{})), f) != 0 && cnt < 48 { 5067 var p uintptr 5068 var z uintptr 5069 5070 if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 { 5071 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n') 5072 *(*uint8)(unsafe.Pointer(p)) = uint8(0) 5073 } 5074 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++ { 5075 } 5076 if !(p != 0) { 5077 continue 5078 } 5079 5080 // Isolate IP address to parse 5081 for p = bp; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { 5082 } 5083 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0) 5084 switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) { 5085 case 1: 5086 cnt++ 5087 break 5088 case 0: 5089 continue 5090 default: 5091 badfam = -2 5092 continue 5093 } 5094 5095 // Extract first name as canonical name 5096 for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ { 5097 } 5098 for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ { 5099 } 5100 *(*uint8)(unsafe.Pointer(z)) = uint8(0) 5101 if is_valid_hostname(tls, p) != 0 { 5102 Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1))) 5103 } 5104 } 5105 //TODO __fclose_ca(f); 5106 Xfclose(tls, f) 5107 if cnt != 0 { 5108 return cnt 5109 } 5110 return badfam 5111 } 5112 5113 type dpc_ctx = struct { 5114 addrs uintptr 5115 canon uintptr 5116 cnt int32 5117 _ [4]byte 5118 } /* lookup_name.c:112:1 */ 5119 5120 func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ 5121 return -1 //TODO- 5122 Xabort(tls) 5123 return int32(0) //TODO- 5124 // char search[256]; 5125 // struct resolvconf conf; 5126 // size_t l, dots; 5127 // char *p, *z; 5128 5129 // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; 5130 5131 // /* Count dots, suppress search when >=ndots or name ends in 5132 // * a dot, which is an explicit request for global scope. */ 5133 // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; 5134 // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; 5135 5136 // /* Strip final dot for canon, fail if multiple trailing dots. */ 5137 // if (name[l-1]=='.') l--; 5138 // if (!l || name[l-1]=='.') return EAI_NONAME; 5139 5140 // /* This can never happen; the caller already checked length. */ 5141 // if (l >= 256) return EAI_NONAME; 5142 5143 // /* Name with search domain appended is setup in canon[]. This both 5144 // * provides the desired default canonical name (if the requested 5145 // * name is not a CNAME record) and serves as a buffer for passing 5146 // * the full requested name to name_from_dns. */ 5147 // memcpy(canon, name, l); 5148 // canon[l] = '.'; 5149 5150 // for (p=search; *p; p=z) { 5151 // for (; isspace(*p); p++); 5152 // for (z=p; *z && !isspace(*z); z++); 5153 // if (z==p) break; 5154 // if (z-p < 256 - l - 1) { 5155 // memcpy(canon+l+1, p, z-p); 5156 // canon[z-p+1+l] = 0; 5157 // int cnt = name_from_dns(buf, canon, canon, family, &conf); 5158 // if (cnt) return cnt; 5159 // } 5160 // } 5161 5162 // canon[l] = 0; 5163 // return name_from_dns(buf, canon, name, family, &conf); 5164 } 5165 5166 type policy = struct { 5167 addr [16]uint8 5168 len uint8 5169 mask uint8 5170 prec uint8 5171 label uint8 5172 } /* lookup_name.c:237:14 */ 5173 5174 var defpolicy = [6]policy{ 5175 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)}, 5176 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)}, 5177 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)}, 5178 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)}, 5179 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)}, 5180 // Last rule must match all addresses to stop loop. 5181 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), prec: uint8(40), label: uint8(1)}, 5182 } /* lookup_name.c:241:3 */ 5183 5184 func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ 5185 var i int32 5186 for i = 0; ; i++ { 5187 if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].len)) != 0 { 5188 continue 5189 } 5190 if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].len))))&int32(defpolicy[i].mask) != 5191 int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].len)))) { 5192 continue 5193 } 5194 return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 5195 } 5196 return uintptr(0) 5197 } 5198 5199 func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ 5200 return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label) 5201 } 5202 5203 func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ 5204 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff { 5205 return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15 5206 } 5207 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 { 5208 return 2 5209 } 5210 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 { 5211 return 2 5212 } 5213 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 { 5214 return 5 5215 } 5216 return 14 5217 } 5218 5219 func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ 5220 // FIXME: The common prefix length should be limited to no greater 5221 // than the nominal length of the prefix portion of the source 5222 // address. However the definition of the source prefix length is 5223 // not clear and thus this limiting is not yet implemented. 5224 var i uint32 5225 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++ { 5226 } 5227 return int32(i) 5228 } 5229 5230 func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ 5231 var a uintptr = _a 5232 var b uintptr = _b 5233 return (*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey 5234 } 5235 5236 func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ 5237 bp := tls.Alloc(92) 5238 defer tls.Free(92) 5239 5240 var cnt int32 = 0 5241 var i int32 5242 var j int32 5243 _ = j 5244 5245 *(*uint8)(unsafe.Pointer(canon)) = uint8(0) 5246 if name != 0 { 5247 // reject empty name and check len so it fits into temp bufs 5248 var l size_t = Xstrnlen(tls, name, uint64(255)) 5249 if l-uint64(1) >= uint64(254) { 5250 return -2 5251 } 5252 Xmemcpy(tls, canon, name, l+uint64(1)) 5253 } 5254 5255 // Procedurally, a request for v6 addresses with the v4-mapped 5256 // flag set is like a request for unspecified family, followed 5257 // by filtering of the results. 5258 if flags&0x08 != 0 { 5259 if family == 10 { 5260 family = 0 5261 } else { 5262 flags = flags - 0x08 5263 } 5264 } 5265 5266 // Try each backend until there's at least one result. 5267 cnt = name_from_null(tls, buf, name, family, flags) 5268 if !(cnt != 0) { 5269 cnt = name_from_numeric(tls, buf, name, family) 5270 } 5271 if !(cnt != 0) && !(flags&0x04 != 0) { 5272 cnt = name_from_hosts(tls, buf, canon, name, family) 5273 if !(cnt != 0) { 5274 cnt = name_from_dns_search(tls, buf, canon, name, family) 5275 } 5276 } 5277 if cnt <= 0 { 5278 if cnt != 0 { 5279 return cnt 5280 } 5281 return -2 5282 } 5283 5284 // Filter/transform results for v4-mapped lookup, if requested. 5285 if flags&0x08 != 0 { 5286 Xabort(tls) //TODO- 5287 // if (!(flags & AI_ALL)) { 5288 // /* If any v6 results exist, remove v4 results. */ 5289 // for (i=0; i<cnt && buf[i].family != AF_INET6; i++); 5290 // if (i<cnt) { 5291 // for (j=0; i<cnt; i++) { 5292 // if (buf[i].family == AF_INET6) 5293 // buf[j++] = buf[i]; 5294 // } 5295 // cnt = i = j; 5296 // } 5297 // } 5298 // /* Translate any remaining v4 results to v6 */ 5299 // for (i=0; i<cnt; i++) { 5300 // if (buf[i].family != AF_INET) continue; 5301 // memcpy(buf[i].addr+12, buf[i].addr, 4); 5302 // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12); 5303 // buf[i].family = AF_INET6; 5304 // } 5305 } 5306 5307 // No further processing is needed if there are fewer than 2 5308 // results or if there are only IPv4 results. 5309 if cnt < 2 || family == 2 { 5310 return cnt 5311 } 5312 for i = 0; i < cnt; i++ { 5313 if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).family != 2 { 5314 break 5315 } 5316 } 5317 if i == cnt { 5318 return cnt 5319 } 5320 var cs int32 5321 _ = cs 5322 //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); 5323 5324 // The following implements a subset of RFC 3484/6724 destination 5325 // address selection by generating a single 31-bit sort key for 5326 // each address. Rules 3, 4, and 7 are omitted for having 5327 // excessive runtime and code size cost and dubious benefit. 5328 // So far the label/precedence table cannot be customized. 5329 for i = 0; i < cnt; i++ { 5330 var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).family 5331 var key int32 = 0 5332 *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{} 5333 *(*sockaddr_in6)(unsafe.Pointer(bp /* da6 */)) = sockaddr_in6{sin6_family: sa_family_t(10), sin6_port: in_port_t(65535), sin6_scope_id: (*address)(unsafe.Pointer(buf + uintptr(i)*28)).scopeid} 5334 *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{} 5335 *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{sin_family: sa_family_t(2), sin_port: in_port_t(65535)} 5336 var sa1 uintptr 5337 var da uintptr 5338 // var salen socklen_t at bp+88, 4 5339 5340 var dalen socklen_t 5341 if family == 10 { 5342 Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint64(16)) 5343 da = bp /* &da6 */ 5344 dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 5345 sa1 = bp + 28 /* &sa6 */ 5346 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 5347 } else { 5348 Xmemcpy(tls, bp+28+8, 5349 ts+90, uint64(12)) 5350 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) 5351 Xmemcpy(tls, bp+8, 5352 ts+90, uint64(12)) 5353 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) 5354 Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint64(4)) 5355 da = bp + 56 /* &da4 */ 5356 dalen = socklen_t(unsafe.Sizeof(sockaddr_in{})) 5357 sa1 = bp + 72 /* &sa4 */ 5358 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{})) 5359 } 5360 var dpolicy uintptr = policyof(tls, bp+8) 5361 var dscope int32 = scopeof(tls, bp+8) 5362 var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).label) 5363 var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).prec) 5364 var prefixlen int32 = 0 5365 var fd int32 = Xsocket(tls, family, 2|02000000, 17) 5366 if fd >= 0 { 5367 if !(Xconnect(tls, fd, da, dalen) != 0) { 5368 key = key | 0x40000000 5369 if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) { 5370 if family == 2 { 5371 Xmemcpy(tls, 5372 bp+28+8+uintptr(12), 5373 bp+72+4, uint64(4)) 5374 } 5375 if dscope == scopeof(tls, bp+28+8) { 5376 key = key | 0x20000000 5377 } 5378 if dlabel == labelof(tls, bp+28+8) { 5379 key = key | 0x10000000 5380 } 5381 prefixlen = prefixmatch(tls, bp+28+8, 5382 bp+8) 5383 } 5384 } 5385 Xclose(tls, fd) 5386 } 5387 key = key | dprec<<20 5388 key = key | (15-dscope)<<16 5389 key = key | prefixlen<<8 5390 key = key | (48-i)<<0 5391 (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key 5392 } 5393 Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { 5394 f func(*TLS, uintptr, uintptr) int32 5395 }{addrcmp}))) 5396 5397 //TODO pthread_setcancelstate(cs, 0); 5398 5399 return cnt 5400 } 5401 5402 func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ 5403 bp := tls.Alloc(8) 5404 defer tls.Free(8) 5405 5406 var line [128]uint8 5407 _ = line 5408 var cnt int32 = 0 5409 var p uintptr 5410 _ = p 5411 *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */ 5412 var port uint64 = uint64(0) 5413 5414 switch socktype { 5415 case 1: 5416 switch proto { 5417 case 0: 5418 proto = 6 5419 fallthrough 5420 case 6: 5421 break 5422 default: 5423 return -8 5424 } 5425 break 5426 case 2: 5427 switch proto { 5428 case 0: 5429 proto = 17 5430 fallthrough 5431 case 17: 5432 break 5433 default: 5434 return -8 5435 } 5436 fallthrough 5437 case 0: 5438 break 5439 default: 5440 if name != 0 { 5441 return -8 5442 } 5443 (*service)(unsafe.Pointer(buf)).port = uint16_t(0) 5444 (*service)(unsafe.Pointer(buf)).proto = uint8(proto) 5445 (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype) 5446 return 1 5447 } 5448 5449 if name != 0 { 5450 if !(int32(*(*uint8)(unsafe.Pointer(name))) != 0) { 5451 return -8 5452 } 5453 port = Xstrtoul(tls, name, bp, 10) 5454 } 5455 if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) { 5456 if port > uint64(65535) { 5457 return -8 5458 } 5459 if proto != 17 { 5460 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) 5461 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1) 5462 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6) 5463 } 5464 if proto != 6 { 5465 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) 5466 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2) 5467 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17) 5468 } 5469 return cnt 5470 } 5471 5472 if flags&0x400 != 0 { 5473 return -2 5474 } 5475 5476 var l size_t = Xstrlen(tls, name) 5477 _ = l 5478 5479 Xabort(tls) //TODO- 5480 // unsigned char _buf[1032]; 5481 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 5482 // if (!f) switch (errno) { 5483 // case ENOENT: 5484 // case ENOTDIR: 5485 // case EACCES: 5486 // return EAI_SERVICE; 5487 // default: 5488 // return EAI_SYSTEM; 5489 // } 5490 5491 Xabort(tls) //TODO- 5492 // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { 5493 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 5494 5495 // /* Find service name */ 5496 // for(p=line; (p=strstr(p, name)); p++) { 5497 // if (p>line && !isspace(p[-1])) continue; 5498 // if (p[l] && !isspace(p[l])) continue; 5499 // break; 5500 // } 5501 // if (!p) continue; 5502 5503 // /* Skip past canonical name at beginning of line */ 5504 // for (p=line; *p && !isspace(*p); p++); 5505 5506 // port = strtoul(p, &z, 10); 5507 // if (port > 65535 || z==p) continue; 5508 // if (!strncmp(z, "/udp", 4)) { 5509 // if (proto == IPPROTO_TCP) continue; 5510 // buf[cnt].port = port; 5511 // buf[cnt].socktype = SOCK_DGRAM; 5512 // buf[cnt++].proto = IPPROTO_UDP; 5513 // } 5514 // if (!strncmp(z, "/tcp", 4)) { 5515 // if (proto == IPPROTO_UDP) continue; 5516 // buf[cnt].port = port; 5517 // buf[cnt].socktype = SOCK_STREAM; 5518 // buf[cnt++].proto = IPPROTO_TCP; 5519 // } 5520 // } 5521 // __fclose_ca(f); 5522 // return cnt > 0 ? cnt : EAI_SERVICE; 5523 Xabort(tls) 5524 return int32(0) //TODO- 5525 } 5526 5527 func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */ 5528 x = x ^ x>>11 5529 x = x ^ x<<7&0x9D2C5680 5530 x = x ^ x<<15&0xEFC60000 5531 x = x ^ x>>18 5532 return x 5533 } 5534 5535 func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */ 5536 return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2)) 5537 } 5538 5539 func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */ 5540 var owner int32 = (*FILE)(unsafe.Pointer(f)).lock 5541 var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid 5542 if owner&CplInt32(0x40000000) == tid { 5543 return 0 5544 } 5545 owner = a_cas(tls, f+140, 0, tid) 5546 if !(owner != 0) { 5547 return 1 5548 } 5549 for AssignInt32(&owner, a_cas(tls, f+140, 0, tid|0x40000000)) != 0 { 5550 if owner&0x40000000 != 0 || a_cas(tls, f+140, owner, owner|0x40000000) == owner { 5551 __futexwait(tls, f+140, owner|0x40000000, 1) 5552 } 5553 } 5554 return 1 5555 } 5556 5557 func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */ 5558 if a_swap(tls, f+140, 0)&0x40000000 != 0 { 5559 __wake(tls, f+140, 1, 1) 5560 } 5561 } 5562 5563 func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ 5564 *(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1 5565 if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { 5566 (*struct { 5567 f func(*TLS, uintptr, uintptr, size_t) size_t 5568 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).write})).f(tls, f, uintptr(0), uint64(0)) 5569 } 5570 (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0))) 5571 if (*FILE)(unsafe.Pointer(f)).flags&uint32(4) != 0 { 5572 *(*uint32)(unsafe.Pointer(f)) |= uint32(32) 5573 return -1 5574 } 5575 (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).buf+uintptr((*FILE)(unsafe.Pointer(f)).buf_size)) 5576 if (*FILE)(unsafe.Pointer(f)).flags&uint32(16) != 0 { 5577 return -1 5578 } 5579 return 0 5580 } 5581 5582 func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ 5583 X__builtin_abort(tls) //TODO- 5584 // __stdio_exit_needed(); 5585 } 5586 5587 // This function assumes it will never be called if there is already 5588 // data buffered for reading. 5589 5590 func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ 5591 bp := tls.Alloc(1) 5592 defer tls.Free(1) 5593 5594 // var c uint8 at bp, 1 5595 5596 if !(X__toread(tls, f) != 0) && (*struct { 5597 f func(*TLS, uintptr, uintptr, size_t) size_t 5598 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).read})).f(tls, f, bp, uint64(1)) == uint64(1) { 5599 return int32(*(*uint8)(unsafe.Pointer(bp))) 5600 } 5601 return -1 5602 } 5603 5604 func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */ 5605 var ret int32 5606 var ap va_list 5607 _ = ap 5608 ap = va 5609 ret = Xvsscanf(tls, s, fmt, ap) 5610 _ = ap 5611 return ret 5612 } 5613 5614 type wctrans_t = uintptr /* wctype.h:20:19 */ 5615 5616 func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */ 5617 if !(dest != 0) { 5618 return 5619 } 5620 switch size { 5621 case -2: 5622 *(*uint8)(unsafe.Pointer(dest)) = uint8(i) 5623 break 5624 case -1: 5625 *(*int16)(unsafe.Pointer(dest)) = int16(i) 5626 break 5627 case 0: 5628 *(*int32)(unsafe.Pointer(dest)) = int32(i) 5629 break 5630 case 1: 5631 *(*int64)(unsafe.Pointer(dest)) = int64(i) 5632 break 5633 case 3: 5634 *(*int64)(unsafe.Pointer(dest)) = int64(i) 5635 break 5636 } 5637 } 5638 5639 func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */ 5640 var p uintptr 5641 var i uint32 5642 var ap2 va_list 5643 _ = ap2 5644 ap2 = ap 5645 for i = n; i > uint32(1); i-- { 5646 VaUintptr(&ap2) 5647 } 5648 p = VaUintptr(&ap2) 5649 _ = ap2 5650 return p 5651 } 5652 5653 func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */ 5654 bp := tls.Alloc(276) 5655 defer tls.Free(276) 5656 5657 var width int32 5658 var size int32 5659 var alloc int32 5660 var base int32 5661 var p uintptr 5662 var c int32 5663 var t int32 5664 var s uintptr 5665 var wcs uintptr 5666 // var st mbstate_t at bp+268, 8 5667 5668 var dest uintptr 5669 var invert int32 5670 var matches int32 5671 var x uint64 5672 var y float64 5673 var pos off_t 5674 // var scanset [257]uint8 at bp, 257 5675 5676 var i size_t 5677 var k size_t 5678 // var wc wchar_t at bp+260, 4 5679 5680 var __need_unlock int32 5681 var tmp uintptr 5682 var tmp1 uintptr 5683 alloc = 0 5684 dest = uintptr(0) 5685 matches = 0 5686 pos = int64(0) 5687 __need_unlock = func() int32 { 5688 if (*FILE)(unsafe.Pointer(f)).lock >= 0 { 5689 return X__lockfile(tls, f) 5690 } 5691 return 0 5692 }() 5693 5694 if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { 5695 goto __1 5696 } 5697 X__toread(tls, f) 5698 __1: 5699 ; 5700 if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { 5701 goto __2 5702 } 5703 goto input_fail 5704 __2: 5705 ; 5706 5707 p = fmt 5708 __3: 5709 if !(*(*uint8)(unsafe.Pointer(p)) != 0) { 5710 goto __5 5711 } 5712 5713 alloc = 0 5714 5715 if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) { 5716 goto __6 5717 } 5718 __7: 5719 if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) { 5720 goto __8 5721 } 5722 p++ 5723 goto __7 5724 __8: 5725 ; 5726 X__shlim(tls, f, int64(0)) 5727 __9: 5728 if !(__isspace(tls, func() int32 { 5729 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5730 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5731 } 5732 return X__shgetc(tls, f) 5733 }()) != 0) { 5734 goto __10 5735 } 5736 goto __9 5737 __10: 5738 ; 5739 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 5740 (*FILE)(unsafe.Pointer(f)).rpos-- 5741 } else { 5742 } 5743 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 5744 goto __4 5745 __6: 5746 ; 5747 if !(int32(*(*uint8)(unsafe.Pointer(p))) != '%' || int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%') { 5748 goto __11 5749 } 5750 X__shlim(tls, f, int64(0)) 5751 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') { 5752 goto __12 5753 } 5754 p++ 5755 __14: 5756 if !(__isspace(tls, AssignInt32(&c, func() int32 { 5757 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5758 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5759 } 5760 return X__shgetc(tls, f) 5761 }())) != 0) { 5762 goto __15 5763 } 5764 goto __14 5765 __15: 5766 ; 5767 goto __13 5768 __12: 5769 c = func() int32 { 5770 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5771 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5772 } 5773 return X__shgetc(tls, f) 5774 }() 5775 __13: 5776 ; 5777 if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) { 5778 goto __16 5779 } 5780 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 5781 (*FILE)(unsafe.Pointer(f)).rpos-- 5782 } else { 5783 } 5784 if !(c < 0) { 5785 goto __17 5786 } 5787 goto input_fail 5788 __17: 5789 ; 5790 goto match_fail 5791 __16: 5792 ; 5793 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 5794 goto __4 5795 __11: 5796 ; 5797 5798 p++ 5799 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') { 5800 goto __18 5801 } 5802 dest = uintptr(0) 5803 p++ 5804 goto __19 5805 __18: 5806 if !(func() int32 { 5807 if 0 != 0 { 5808 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) 5809 } 5810 return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) 5811 }() != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$') { 5812 goto __20 5813 } 5814 dest = arg_n(tls, ap, uint32(int32(*(*uint8)(unsafe.Pointer(p)))-'0')) 5815 p += uintptr(2) 5816 goto __21 5817 __20: 5818 dest = VaUintptr(&ap) 5819 __21: 5820 ; 5821 __19: 5822 ; 5823 5824 width = 0 5825 __22: 5826 if !(func() int32 { 5827 if 0 != 0 { 5828 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) 5829 } 5830 return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) 5831 }() != 0) { 5832 goto __24 5833 } 5834 width = 10*width + int32(*(*uint8)(unsafe.Pointer(p))) - '0' 5835 goto __23 5836 __23: 5837 p++ 5838 goto __22 5839 goto __24 5840 __24: 5841 ; 5842 5843 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') { 5844 goto __25 5845 } 5846 wcs = uintptr(0) 5847 s = uintptr(0) 5848 alloc = BoolInt32(!!(dest != 0)) 5849 p++ 5850 goto __26 5851 __25: 5852 alloc = 0 5853 __26: 5854 ; 5855 5856 size = 0 5857 switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) { 5858 case 'h': 5859 goto __28 5860 case 'l': 5861 goto __29 5862 case 'j': 5863 goto __30 5864 case 'z': 5865 goto __31 5866 case 't': 5867 goto __32 5868 case 'L': 5869 goto __33 5870 case 'd': 5871 goto __34 5872 case 'i': 5873 goto __35 5874 case 'o': 5875 goto __36 5876 case 'u': 5877 goto __37 5878 case 'x': 5879 goto __38 5880 case 'a': 5881 goto __39 5882 case 'e': 5883 goto __40 5884 case 'f': 5885 goto __41 5886 case 'g': 5887 goto __42 5888 case 'A': 5889 goto __43 5890 case 'E': 5891 goto __44 5892 case 'F': 5893 goto __45 5894 case 'G': 5895 goto __46 5896 case 'X': 5897 goto __47 5898 case 's': 5899 goto __48 5900 case 'c': 5901 goto __49 5902 case '[': 5903 goto __50 5904 case 'S': 5905 goto __51 5906 case 'C': 5907 goto __52 5908 case 'p': 5909 goto __53 5910 case 'n': 5911 goto __54 5912 default: 5913 goto __55 5914 } 5915 goto __27 5916 __28: 5917 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') { 5918 goto __56 5919 } 5920 p++ 5921 size = -2 5922 goto __57 5923 __56: 5924 size = -1 5925 __57: 5926 ; 5927 goto __27 5928 __29: 5929 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') { 5930 goto __58 5931 } 5932 p++ 5933 size = 3 5934 goto __59 5935 __58: 5936 size = 1 5937 __59: 5938 ; 5939 goto __27 5940 __30: 5941 size = 3 5942 goto __27 5943 __31: 5944 __32: 5945 size = 1 5946 goto __27 5947 __33: 5948 size = 2 5949 goto __27 5950 __34: 5951 __35: 5952 __36: 5953 __37: 5954 __38: 5955 __39: 5956 __40: 5957 __41: 5958 __42: 5959 __43: 5960 __44: 5961 __45: 5962 __46: 5963 __47: 5964 __48: 5965 __49: 5966 __50: 5967 __51: 5968 __52: 5969 __53: 5970 __54: 5971 p-- 5972 goto __27 5973 __55: 5974 goto fmt_fail 5975 __27: 5976 ; 5977 5978 t = int32(*(*uint8)(unsafe.Pointer(p))) 5979 5980 // C or S 5981 if !(t&0x2f == 3) { 5982 goto __60 5983 } 5984 t = t | 32 5985 size = 1 5986 __60: 5987 ; 5988 5989 switch t { 5990 case 'c': 5991 goto __62 5992 case '[': 5993 goto __63 5994 case 'n': 5995 goto __64 5996 default: 5997 goto __65 5998 } 5999 goto __61 6000 __62: 6001 if !(width < 1) { 6002 goto __66 6003 } 6004 width = 1 6005 __66: 6006 ; 6007 __63: 6008 goto __61 6009 __64: 6010 store_int(tls, dest, size, uint64(pos)) 6011 // do not increment match count, etc! 6012 goto __4 6013 __65: 6014 X__shlim(tls, f, int64(0)) 6015 __67: 6016 if !(__isspace(tls, func() int32 { 6017 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6018 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6019 } 6020 return X__shgetc(tls, f) 6021 }()) != 0) { 6022 goto __68 6023 } 6024 goto __67 6025 __68: 6026 ; 6027 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6028 (*FILE)(unsafe.Pointer(f)).rpos-- 6029 } else { 6030 } 6031 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 6032 __61: 6033 ; 6034 6035 X__shlim(tls, f, int64(width)) 6036 if !(func() int32 { 6037 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6038 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6039 } 6040 return X__shgetc(tls, f) 6041 }() < 0) { 6042 goto __69 6043 } 6044 goto input_fail 6045 __69: 6046 ; 6047 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6048 (*FILE)(unsafe.Pointer(f)).rpos-- 6049 } else { 6050 } 6051 6052 switch t { 6053 case 's': 6054 goto __71 6055 case 'c': 6056 goto __72 6057 case '[': 6058 goto __73 6059 case 'p': 6060 goto __74 6061 case 'X': 6062 goto __75 6063 case 'x': 6064 goto __76 6065 case 'o': 6066 goto __77 6067 case 'd': 6068 goto __78 6069 case 'u': 6070 goto __79 6071 case 'i': 6072 goto __80 6073 case 'a': 6074 goto __81 6075 case 'A': 6076 goto __82 6077 case 'e': 6078 goto __83 6079 case 'E': 6080 goto __84 6081 case 'f': 6082 goto __85 6083 case 'F': 6084 goto __86 6085 case 'g': 6086 goto __87 6087 case 'G': 6088 goto __88 6089 } 6090 goto __70 6091 __71: 6092 __72: 6093 __73: 6094 if !(t == 'c' || t == 's') { 6095 goto __89 6096 } 6097 Xmemset(tls, bp, -1, uint64(unsafe.Sizeof([257]uint8{}))) 6098 *(*uint8)(unsafe.Pointer(bp)) = uint8(0) 6099 if !(t == 's') { 6100 goto __91 6101 } 6102 *(*uint8)(unsafe.Pointer(bp + 10)) = uint8(0) 6103 *(*uint8)(unsafe.Pointer(bp + 11)) = uint8(0) 6104 *(*uint8)(unsafe.Pointer(bp + 12)) = uint8(0) 6105 *(*uint8)(unsafe.Pointer(bp + 13)) = uint8(0) 6106 *(*uint8)(unsafe.Pointer(bp + 14)) = uint8(0) 6107 *(*uint8)(unsafe.Pointer(bp + 33)) = uint8(0) 6108 __91: 6109 ; 6110 goto __90 6111 __89: 6112 if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') { 6113 goto __92 6114 } 6115 p++ 6116 invert = 1 6117 goto __93 6118 __92: 6119 invert = 0 6120 __93: 6121 ; 6122 Xmemset(tls, bp, invert, uint64(unsafe.Sizeof([257]uint8{}))) 6123 *(*uint8)(unsafe.Pointer(bp)) = uint8(0) 6124 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') { 6125 goto __94 6126 } 6127 p++ 6128 *(*uint8)(unsafe.Pointer(bp + 46)) = uint8(1 - invert) 6129 goto __95 6130 __94: 6131 if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') { 6132 goto __96 6133 } 6134 p++ 6135 *(*uint8)(unsafe.Pointer(bp + 94)) = uint8(1 - invert) 6136 __96: 6137 ; 6138 __95: 6139 ; 6140 __97: 6141 if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') { 6142 goto __99 6143 } 6144 if !!(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { 6145 goto __100 6146 } 6147 goto fmt_fail 6148 __100: 6149 ; 6150 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-' && *(*uint8)(unsafe.Pointer(p + 1)) != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']') { 6151 goto __101 6152 } 6153 c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1)))) 6154 __102: 6155 if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) { 6156 goto __104 6157 } 6158 *(*uint8)(unsafe.Pointer(bp + uintptr(1+c))) = uint8(1 - invert) 6159 goto __103 6160 __103: 6161 c++ 6162 goto __102 6163 goto __104 6164 __104: 6165 ; 6166 __101: 6167 ; 6168 *(*uint8)(unsafe.Pointer(bp + uintptr(1+int32(*(*uint8)(unsafe.Pointer(p)))))) = uint8(1 - invert) 6169 goto __98 6170 __98: 6171 p++ 6172 goto __97 6173 goto __99 6174 __99: 6175 ; 6176 __90: 6177 ; 6178 wcs = uintptr(0) 6179 s = uintptr(0) 6180 i = uint64(0) 6181 if t == 'c' { 6182 k = uint64(uint32(width) + 1) 6183 } else { 6184 k = uint64(31) 6185 } 6186 if !(size == 1) { 6187 goto __105 6188 } 6189 if !(alloc != 0) { 6190 goto __107 6191 } 6192 wcs = Xmalloc(tls, k*size_t(unsafe.Sizeof(wchar_t(0)))) 6193 if !!(wcs != 0) { 6194 goto __109 6195 } 6196 goto alloc_fail 6197 __109: 6198 ; 6199 goto __108 6200 __107: 6201 wcs = dest 6202 __108: 6203 ; 6204 *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{} 6205 __110: 6206 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6207 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6208 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6209 } 6210 return X__shgetc(tls, f) 6211 }())+1))) != 0) { 6212 goto __111 6213 } 6214 switch Xmbrtowc(tls, bp+260, func() uintptr { *(*uint8)(unsafe.Pointer(bp + 264)) = uint8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) { 6215 case Uint64FromInt32(-1): 6216 goto __113 6217 case Uint64FromInt32(-2): 6218 goto __114 6219 } 6220 goto __112 6221 __113: 6222 goto input_fail 6223 __114: 6224 goto __110 6225 __112: 6226 ; 6227 if !(wcs != 0) { 6228 goto __115 6229 } 6230 *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint64(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */)) 6231 __115: 6232 ; 6233 if !(alloc != 0 && i == k) { 6234 goto __116 6235 } 6236 k = k + (k + uint64(1)) 6237 tmp = Xrealloc(tls, wcs, k*size_t(unsafe.Sizeof(wchar_t(0)))) 6238 if !!(tmp != 0) { 6239 goto __117 6240 } 6241 goto alloc_fail 6242 __117: 6243 ; 6244 wcs = tmp 6245 __116: 6246 ; 6247 goto __110 6248 __111: 6249 ; 6250 if !!(Xmbsinit(tls, bp+268) != 0) { 6251 goto __118 6252 } 6253 goto input_fail 6254 __118: 6255 ; 6256 goto __106 6257 __105: 6258 if !(alloc != 0) { 6259 goto __119 6260 } 6261 s = Xmalloc(tls, k) 6262 if !!(s != 0) { 6263 goto __121 6264 } 6265 goto alloc_fail 6266 __121: 6267 ; 6268 __122: 6269 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6270 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6271 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6272 } 6273 return X__shgetc(tls, f) 6274 }())+1))) != 0) { 6275 goto __123 6276 } 6277 *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c) 6278 if !(i == k) { 6279 goto __124 6280 } 6281 k = k + (k + uint64(1)) 6282 tmp1 = Xrealloc(tls, s, k) 6283 if !!(tmp1 != 0) { 6284 goto __125 6285 } 6286 goto alloc_fail 6287 __125: 6288 ; 6289 s = tmp1 6290 __124: 6291 ; 6292 goto __122 6293 __123: 6294 ; 6295 goto __120 6296 __119: 6297 if !(AssignUintptr(&s, dest) != 0) { 6298 goto __126 6299 } 6300 __128: 6301 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6302 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6303 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6304 } 6305 return X__shgetc(tls, f) 6306 }())+1))) != 0) { 6307 goto __129 6308 } 6309 *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c) 6310 goto __128 6311 __129: 6312 ; 6313 goto __127 6314 __126: 6315 __130: 6316 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6317 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6318 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6319 } 6320 return X__shgetc(tls, f) 6321 }())+1))) != 0) { 6322 goto __131 6323 } 6324 goto __130 6325 __131: 6326 ; 6327 __127: 6328 ; 6329 __120: 6330 ; 6331 __106: 6332 ; 6333 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6334 (*FILE)(unsafe.Pointer(f)).rpos-- 6335 } else { 6336 } 6337 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6338 goto __132 6339 } 6340 goto match_fail 6341 __132: 6342 ; 6343 if !(t == 'c' && (*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != off_t(width)) { 6344 goto __133 6345 } 6346 goto match_fail 6347 __133: 6348 ; 6349 if !(alloc != 0) { 6350 goto __134 6351 } 6352 if !(size == 1) { 6353 goto __135 6354 } 6355 *(*uintptr)(unsafe.Pointer(dest)) = wcs 6356 goto __136 6357 __135: 6358 *(*uintptr)(unsafe.Pointer(dest)) = s 6359 __136: 6360 ; 6361 __134: 6362 ; 6363 if !(t != 'c') { 6364 goto __137 6365 } 6366 if !(wcs != 0) { 6367 goto __138 6368 } 6369 *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = 0 6370 __138: 6371 ; 6372 if !(s != 0) { 6373 goto __139 6374 } 6375 *(*uint8)(unsafe.Pointer(s + uintptr(i))) = uint8(0) 6376 __139: 6377 ; 6378 __137: 6379 ; 6380 goto __70 6381 __74: 6382 __75: 6383 __76: 6384 base = 16 6385 goto int_common 6386 __77: 6387 base = 8 6388 goto int_common 6389 __78: 6390 __79: 6391 base = 10 6392 goto int_common 6393 __80: 6394 base = 0 6395 int_common: 6396 x = X__intscan(tls, f, uint32(base), 0, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6397 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6398 goto __140 6399 } 6400 goto match_fail 6401 __140: 6402 ; 6403 if !(t == 'p' && dest != 0) { 6404 goto __141 6405 } 6406 *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x)) 6407 goto __142 6408 __141: 6409 store_int(tls, dest, size, x) 6410 __142: 6411 ; 6412 goto __70 6413 __81: 6414 __82: 6415 __83: 6416 __84: 6417 __85: 6418 __86: 6419 __87: 6420 __88: 6421 y = X__floatscan(tls, f, size, 0) 6422 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6423 goto __143 6424 } 6425 goto match_fail 6426 __143: 6427 ; 6428 if !(dest != 0) { 6429 goto __144 6430 } 6431 switch size { 6432 case 0: 6433 goto __146 6434 case 1: 6435 goto __147 6436 case 2: 6437 goto __148 6438 } 6439 goto __145 6440 __146: 6441 *(*float32)(unsafe.Pointer(dest)) = float32(y) 6442 goto __145 6443 __147: 6444 *(*float64)(unsafe.Pointer(dest)) = y 6445 goto __145 6446 __148: 6447 *(*float64)(unsafe.Pointer(dest)) = y 6448 goto __145 6449 __145: 6450 ; 6451 __144: 6452 ; 6453 goto __70 6454 __70: 6455 ; 6456 6457 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 6458 if !(dest != 0) { 6459 goto __149 6460 } 6461 matches++ 6462 __149: 6463 ; 6464 goto __4 6465 __4: 6466 p++ 6467 goto __3 6468 goto __5 6469 __5: 6470 ; 6471 if !(0 != 0) { 6472 goto __150 6473 } 6474 fmt_fail: 6475 alloc_fail: 6476 input_fail: 6477 if !!(matches != 0) { 6478 goto __151 6479 } 6480 matches-- 6481 __151: 6482 ; 6483 match_fail: 6484 if !(alloc != 0) { 6485 goto __152 6486 } 6487 Xfree(tls, s) 6488 Xfree(tls, wcs) 6489 __152: 6490 ; 6491 __150: 6492 ; 6493 __153: 6494 if !(__need_unlock != 0) { 6495 goto __156 6496 } 6497 X__unlockfile(tls, f) 6498 __156: 6499 ; 6500 goto __154 6501 __154: 6502 if 0 != 0 { 6503 goto __153 6504 } 6505 goto __155 6506 __155: 6507 ; 6508 return matches 6509 } 6510 6511 func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */ 6512 var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie 6513 var k size_t = len + uint64(256) 6514 var end uintptr = Xmemchr(tls, src, 0, k) 6515 if end != 0 { 6516 k = size_t((int64(end) - int64(src)) / 1) 6517 } 6518 if k < len { 6519 len = k 6520 } 6521 Xmemcpy(tls, buf, src, len) 6522 (*FILE)(unsafe.Pointer(f)).rpos = src + uintptr(len) 6523 (*FILE)(unsafe.Pointer(f)).rend = src + uintptr(k) 6524 (*FILE)(unsafe.Pointer(f)).cookie = src + uintptr(k) 6525 return len 6526 } 6527 6528 func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */ 6529 bp := tls.Alloc(232) 6530 defer tls.Free(232) 6531 6532 *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct { 6533 f func(*TLS, uintptr, uintptr, size_t) size_t 6534 }{string_read})), buf: s, lock: -1, cookie: s} 6535 return Xvfscanf(tls, bp, fmt, ap) 6536 } 6537 6538 func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */ 6539 var try uintptr 6540 var sign int32 6541 for nel > uint64(0) { 6542 try = base + uintptr(width*(nel/uint64(2))) 6543 sign = (*struct { 6544 f func(*TLS, uintptr, uintptr) int32 6545 })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try) 6546 if sign < 0 { 6547 nel = nel / uint64(2) 6548 } else if sign > 0 { 6549 base = try + uintptr(width) 6550 nel = nel - (nel/uint64(2) + uint64(1)) 6551 } else { 6552 return try 6553 } 6554 } 6555 return uintptr(0) 6556 } 6557 6558 func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ 6559 bp := tls.Alloc(232) 6560 defer tls.Free(232) 6561 6562 // var f FILE at bp, 232 6563 6564 (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) 6565 (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) 6566 X__shlim(tls, bp, int64(0)) 6567 var y float64 = X__floatscan(tls, bp, prec, 1) 6568 var cnt off_t = (*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1 6569 if p != 0 { 6570 *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { 6571 if cnt != 0 { 6572 return s + uintptr(cnt) 6573 } 6574 return s 6575 }() 6576 } 6577 return y 6578 } 6579 6580 func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ 6581 return float32(strtox(tls, s, p, 0)) 6582 } 6583 6584 func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ 6585 return strtox(tls, s, p, 1) 6586 } 6587 6588 func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ 6589 return strtox(tls, s, p, 2) 6590 } 6591 6592 func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ 6593 bp := tls.Alloc(232) 6594 defer tls.Free(232) 6595 6596 // var f FILE at bp, 232 6597 6598 (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) 6599 (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) 6600 X__shlim(tls, bp, int64(0)) 6601 var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim) 6602 if p != 0 { 6603 var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1) 6604 *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt) 6605 } 6606 return y 6607 } 6608 6609 func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ 6610 return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6611 } 6612 6613 func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ 6614 return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1)))) 6615 } 6616 6617 func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */ 6618 return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))) 6619 } 6620 6621 func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */ 6622 return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1)))) 6623 } 6624 6625 func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ 6626 return intmax_t(Xstrtoll(tls, s, p, base)) 6627 } 6628 6629 func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ 6630 return uintmax_t(Xstrtoull(tls, s, p, base)) 6631 } 6632 6633 func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ 6634 var l size_t = Xstrlen(tls, s) 6635 var d uintptr = Xmalloc(tls, l+uint64(1)) 6636 if !(d != 0) { 6637 return uintptr(0) 6638 } 6639 return Xmemcpy(tls, d, s, l+uint64(1)) 6640 } 6641 6642 func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */ 6643 var l size_t = Xstrnlen(tls, d, n) 6644 if l == n { 6645 return l + Xstrlen(tls, s) 6646 } 6647 return l + Xstrlcpy(tls, d+uintptr(l), s, n-l) 6648 } 6649 6650 // Support signed or unsigned plain-char 6651 6652 // Implementation choices... 6653 6654 // Arbitrary numbers... 6655 6656 // POSIX/SUS requirements follow. These numbers come directly 6657 // from SUS and have nothing to do with the host system. 6658 6659 func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */ 6660 var d0 uintptr 6661 var wd uintptr 6662 var ws uintptr 6663 d0 = d 6664 6665 if !!(int32(PostDecUint64(&n, 1)) != 0) { 6666 goto __1 6667 } 6668 goto finish 6669 __1: 6670 ; 6671 if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) == uintptr_t(d)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1))) { 6672 goto __2 6673 } 6674 __3: 6675 if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) != 0 && n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) { 6676 goto __5 6677 } 6678 goto __4 6679 __4: 6680 n-- 6681 s++ 6682 d++ 6683 goto __3 6684 goto __5 6685 __5: 6686 ; 6687 if !(n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0) { 6688 goto __6 6689 } 6690 wd = d 6691 ws = s 6692 __7: 6693 if !(n >= size_t(unsafe.Sizeof(size_t(0))) && !((*(*uint64)(unsafe.Pointer(ws))-Uint64(Uint64FromInt32(-1))/uint64(255)) & ^*(*uint64)(unsafe.Pointer(ws)) & (Uint64(Uint64FromInt32(-1))/uint64(255)*uint64(255/2+1)) != 0)) { 6694 goto __9 6695 } 6696 *(*size_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) 6697 goto __8 6698 __8: 6699 n = n - size_t(unsafe.Sizeof(size_t(0))) 6700 ws += 8 6701 wd += 8 6702 goto __7 6703 goto __9 6704 __9: 6705 ; 6706 d = wd 6707 s = ws 6708 __6: 6709 ; 6710 __2: 6711 ; 6712 __10: 6713 if !(n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) { 6714 goto __12 6715 } 6716 goto __11 6717 __11: 6718 n-- 6719 s++ 6720 d++ 6721 goto __10 6722 goto __12 6723 __12: 6724 ; 6725 *(*uint8)(unsafe.Pointer(d)) = uint8(0) 6726 finish: 6727 return size_t((int64(d)-int64(d0))/1) + Xstrlen(tls, s) 6728 } 6729 6730 func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */ 6731 var l uintptr = _l 6732 var r uintptr = _r 6733 if !(int32(PostDecUint64(&n, 1)) != 0) { 6734 return 0 6735 } 6736 __1: 6737 if !(*(*uint8)(unsafe.Pointer(l)) != 0 && *(*uint8)(unsafe.Pointer(r)) != 0 && n != 0 && (int32(*(*uint8)(unsafe.Pointer(l))) == int32(*(*uint8)(unsafe.Pointer(r))) || Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) == Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))))) { 6738 goto __3 6739 } 6740 goto __2 6741 __2: 6742 l++ 6743 r++ 6744 n-- 6745 goto __1 6746 goto __3 6747 __3: 6748 ; 6749 return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))) 6750 } 6751 6752 func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */ 6753 return Xstrncasecmp(tls, l, r, n) 6754 } 6755 6756 func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */ 6757 var a uintptr = d 6758 d += uintptr(Xstrlen(tls, d)) 6759 for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 { 6760 n-- 6761 *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) 6762 } 6763 *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = uint8(0) 6764 return a 6765 } 6766 6767 func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ 6768 var p uintptr = Xmemchr(tls, s, 0, n) 6769 if p != 0 { 6770 return uint64((int64(p) - int64(s)) / 1) 6771 } 6772 return n 6773 } 6774 6775 func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ 6776 bp := tls.Alloc(32) 6777 defer tls.Free(32) 6778 6779 var a uintptr = s 6780 *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} 6781 6782 if !(int32(*(*uint8)(unsafe.Pointer(c))) != 0) { 6783 return uint64(0) 6784 } 6785 if !(int32(*(*uint8)(unsafe.Pointer(c + 1))) != 0) { 6786 for ; int32(*(*uint8)(unsafe.Pointer(s))) == int32(*(*uint8)(unsafe.Pointer(c))); s++ { 6787 } 6788 return size_t((int64(s) - int64(a)) / 1) 6789 } 6790 6791 for ; *(*uint8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint64(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))*8, size_t(uint64(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))) != 0; c++ { 6792 } 6793 for ; *(*uint8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))*8))&(size_t(uint64(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))) != 0; s++ { 6794 } 6795 return size_t((int64(s) - int64(a)) / 1) 6796 } 6797 6798 func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ 6799 if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) { 6800 return uintptr(0) 6801 } 6802 s += uintptr(Xstrspn(tls, s, sep)) 6803 if !(int32(*(*uint8)(unsafe.Pointer(s))) != 0) { 6804 return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0)) 6805 } 6806 _sp = s + uintptr(Xstrcspn(tls, s, sep)) 6807 if *(*uint8)(unsafe.Pointer(_sp)) != 0 { 6808 *(*uint8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = uint8(0) 6809 } else { 6810 _sp = uintptr(0) 6811 } 6812 return s 6813 } 6814 6815 var _sp uintptr /* strtok.c:5:14: */ 6816 6817 func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ 6818 return *(*int32)(unsafe.Pointer(a + 6*4)) 6819 } 6820 6821 func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ 6822 *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4)) 6823 return 0 6824 } 6825 6826 // 6827 // int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) 6828 // { 6829 // *size = a->_a_guardsize; 6830 // return 0; 6831 // } 6832 // 6833 // int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) 6834 // { 6835 // *inherit = a->_a_sched; 6836 // return 0; 6837 // } 6838 // 6839 // int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) 6840 // { 6841 // param->sched_priority = a->_a_prio; 6842 // return 0; 6843 // } 6844 // 6845 // int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) 6846 // { 6847 // *policy = a->_a_policy; 6848 // return 0; 6849 // } 6850 // 6851 // int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) 6852 // { 6853 // *scope = PTHREAD_SCOPE_SYSTEM; 6854 // return 0; 6855 // } 6856 // 6857 // int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) 6858 // { 6859 // if (!a->_a_stackaddr) 6860 // return EINVAL; 6861 // *size = a->_a_stacksize; 6862 // *addr = (void *)(a->_a_stackaddr - *size); 6863 // return 0; 6864 // } 6865 // 6866 // int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) 6867 // { 6868 // *size = a->_a_stacksize; 6869 // return 0; 6870 // } 6871 // 6872 // int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) 6873 // { 6874 // *pshared = !!a->__attr; 6875 // return 0; 6876 // } 6877 // 6878 // int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) 6879 // { 6880 // *clk = a->__attr & 0x7fffffff; 6881 // return 0; 6882 // } 6883 // 6884 // int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) 6885 // { 6886 // *pshared = a->__attr>>31; 6887 // return 0; 6888 // } 6889 // 6890 // int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) 6891 // { 6892 // *protocol = PTHREAD_PRIO_NONE; 6893 // return 0; 6894 // } 6895 // int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) 6896 // { 6897 // *pshared = a->__attr / 128U % 2; 6898 // return 0; 6899 // } 6900 // 6901 // int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) 6902 // { 6903 // *robust = a->__attr / 4U % 2; 6904 // return 0; 6905 // } 6906 6907 func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ 6908 return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3)) 6909 } 6910 6911 // int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) 6912 // { 6913 // *type = a->__attr & 3; 6914 // return 0; 6915 // } 6916 // 6917 // int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) 6918 // { 6919 // *pshared = a->__attr[0]; 6920 // return 0; 6921 // } 6922 6923 func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ 6924 if uint32(state) > 1 { 6925 return 22 6926 } 6927 *(*int32)(unsafe.Pointer(a + 6*4)) = state 6928 return 0 6929 } 6930 6931 func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ 6932 return *(*int32)(unsafe.Pointer(m)) & 15 6933 } 6934 6935 // int __pthread_mutex_lock(pthread_mutex_t *m) 6936 // { 6937 // if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL 6938 // && !a_cas(&m->_m_lock, 0, EBUSY)) 6939 // return 0; 6940 // 6941 // return __pthread_mutex_timedlock(m, 0); 6942 // } 6943 // 6944 // weak_alias(__pthread_mutex_lock, pthread_mutex_lock); 6945 6946 func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ 6947 return 0 6948 } 6949 6950 func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ 6951 *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} 6952 return 0 6953 } 6954 6955 func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ 6956 if uint32(type1) > uint32(2) { 6957 return 22 6958 } 6959 (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr&Uint32FromInt32(CplInt32(3)) | uint32(type1) 6960 return 0 6961 } 6962 6963 func init() { 6964 *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = uintptr(unsafe.Pointer(&table)) + uintptr(128)*2 // __ctype_b_loc.c:36:45: 6965 } 6966 6967 var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00.\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" 6968 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data