| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078 |
- // Code generated by 'ccgo -D__environ=environ -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_windows_386.go -pkgname libc -static-locals-prefix _s -Iarch/i386 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isxdigit.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/multibyte/wcrtomb.c src/multibyte/wcsrtombs.c src/multibyte/wcstombs.c src/string/strchrnul.c src/string/strdup.c', DO NOT EDIT.
- package libc
- import (
- "math"
- "reflect"
- "sync/atomic"
- "unsafe"
- )
- var _ = math.Pi
- var _ reflect.Kind
- var _ atomic.Value
- var _ unsafe.Pointer
- // musl as a whole is licensed under the following standard MIT license:
- //
- // ----------------------------------------------------------------------
- // Copyright © 2005-2020 Rich Felker, et al.
- //
- // Permission is hereby granted, free of charge, to any person obtaining
- // a copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to
- // permit persons to whom the Software is furnished to do so, subject to
- // the following conditions:
- //
- // The above copyright notice and this permission notice shall be
- // included in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- // ----------------------------------------------------------------------
- //
- // Authors/contributors include:
- //
- // A. Wilcox
- // Ada Worcester
- // Alex Dowad
- // Alex Suykov
- // Alexander Monakov
- // Andre McCurdy
- // Andrew Kelley
- // Anthony G. Basile
- // Aric Belsito
- // Arvid Picciani
- // Bartosz Brachaczek
- // Benjamin Peterson
- // Bobby Bingham
- // Boris Brezillon
- // Brent Cook
- // Chris Spiegel
- // Clément Vasseur
- // Daniel Micay
- // Daniel Sabogal
- // Daurnimator
- // David Carlier
- // David Edelsohn
- // Denys Vlasenko
- // Dmitry Ivanov
- // Dmitry V. Levin
- // Drew DeVault
- // Emil Renner Berthing
- // Fangrui Song
- // Felix Fietkau
- // Felix Janda
- // Gianluca Anzolin
- // Hauke Mehrtens
- // He X
- // Hiltjo Posthuma
- // Isaac Dunham
- // Jaydeep Patil
- // Jens Gustedt
- // Jeremy Huntwork
- // Jo-Philipp Wich
- // Joakim Sindholt
- // John Spencer
- // Julien Ramseier
- // Justin Cormack
- // Kaarle Ritvanen
- // Khem Raj
- // Kylie McClain
- // Leah Neukirchen
- // Luca Barbato
- // Luka Perkov
- // M Farkas-Dyck (Strake)
- // Mahesh Bodapati
- // Markus Wichmann
- // Masanori Ogino
- // Michael Clark
- // Michael Forney
- // Mikhail Kremnyov
- // Natanael Copa
- // Nicholas J. Kain
- // orc
- // Pascal Cuoq
- // Patrick Oppenlander
- // Petr Hosek
- // Petr Skocik
- // Pierre Carrier
- // Reini Urban
- // Rich Felker
- // Richard Pennington
- // Ryan Fairfax
- // Samuel Holland
- // Segev Finer
- // Shiz
- // sin
- // Solar Designer
- // Stefan Kristiansson
- // Stefan O'Rear
- // Szabolcs Nagy
- // Timo Teräs
- // Trutz Behn
- // Valentin Ochs
- // Will Dietz
- // William Haddon
- // William Pitcock
- //
- // Portions of this software are derived from third-party works licensed
- // under terms compatible with the above MIT license:
- //
- // The TRE regular expression implementation (src/regex/reg* and
- // src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
- // under a 2-clause BSD license (license text in the source files). The
- // included version has been heavily modified by Rich Felker in 2012, in
- // the interests of size, simplicity, and namespace cleanliness.
- //
- // Much of the math library code (src/math/* and src/complex/*) is
- // Copyright © 1993,2004 Sun Microsystems or
- // Copyright © 2003-2011 David Schultz or
- // Copyright © 2003-2009 Steven G. Kargl or
- // Copyright © 2003-2009 Bruce D. Evans or
- // Copyright © 2008 Stephen L. Moshier or
- // Copyright © 2017-2018 Arm Limited
- // and labelled as such in comments in the individual source files. All
- // have been licensed under extremely permissive terms.
- //
- // The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
- // The Android Open Source Project and is licensed under a two-clause BSD
- // license. It was taken from Bionic libc, used on Android.
- //
- // The AArch64 memcpy and memset code (src/string/aarch64/*) are
- // Copyright © 1999-2019, Arm Limited.
- //
- // The implementation of DES for crypt (src/crypt/crypt_des.c) is
- // Copyright © 1994 David Burren. It is licensed under a BSD license.
- //
- // The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
- // originally written by Solar Designer and placed into the public
- // domain. The code also comes with a fallback permissive license for use
- // in jurisdictions that may not recognize the public domain.
- //
- // The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
- // Valentin Ochs and is licensed under an MIT-style license.
- //
- // The x86_64 port was written by Nicholas J. Kain and is licensed under
- // the standard MIT terms.
- //
- // The mips and microblaze ports were originally written by Richard
- // Pennington for use in the ellcc project. The original code was adapted
- // by Rich Felker for build system and code conventions during upstream
- // integration. It is licensed under the standard MIT terms.
- //
- // The mips64 port was contributed by Imagination Technologies and is
- // licensed under the standard MIT terms.
- //
- // The powerpc port was also originally written by Richard Pennington,
- // and later supplemented and integrated by John Spencer. It is licensed
- // under the standard MIT terms.
- //
- // All other files which have no copyright comments are original works
- // produced specifically for use as part of this library, written either
- // by Rich Felker, the main author of the library, or by one or more
- // contibutors listed above. Details on authorship of individual files
- // can be found in the git version control history of the project. The
- // omission of copyright and license comments in each file is in the
- // interest of source tree size.
- //
- // In addition, permission is hereby granted for all public header files
- // (include/* and arch/*/bits/*) and crt files intended to be linked into
- // applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
- // the copyright notice and permission notice otherwise required by the
- // license, and to use these files without any requirement of
- // attribution. These files include substantial contributions from:
- //
- // Bobby Bingham
- // John Spencer
- // Nicholas J. Kain
- // Rich Felker
- // Richard Pennington
- // Stefan Kristiansson
- // Szabolcs Nagy
- //
- // all of whom have explicitly granted such permission.
- //
- // This file previously contained text expressing a belief that most of
- // the files covered by the above exception were sufficiently trivial not
- // to be subject to copyright, resulting in confusion over whether it
- // negated the permissions granted in the license. In the spirit of
- // permissive licensing, and of not having licensing issues being an
- // obstacle to adoption, that text has been removed.
- const ( /* copyright.c:194:1: */
- __musl__copyright__ = 0
- )
- const ( /* pthread_impl.h:58:1: */
- DT_EXITING = 0
- DT_JOINABLE = 1
- DT_DETACHED = 2
- )
- type ptrdiff_t = int32 /* <builtin>:3:26 */
- type size_t = uint32 /* <builtin>:9:23 */
- type wchar_t = uint16 /* <builtin>:15:24 */
- type va_list = uintptr /* <builtin>:50:27 */
- type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:366:9 */
- type locale_t = uintptr /* alltypes.h:366:32 */
- func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
- return Bool32(func() int32 {
- if 0 != 0 {
- return Xisalpha(tls, c)
- }
- return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
- }() != 0 || func() int32 {
- if 0 != 0 {
- return Xisdigit(tls, c)
- }
- return Bool32(uint32(c)-uint32('0') < uint32(10))
- }() != 0)
- }
- func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
- return Xisalnum(tls, c)
- }
- func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
- return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
- }
- func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
- return Xisalpha(tls, c)
- }
- func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
- return Bool32(uint32(c)-uint32('0') < uint32(10))
- }
- func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
- return Xisdigit(tls, c)
- }
- func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
- return Bool32(uint32(c)-uint32('a') < uint32(26))
- }
- func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
- return Xislower(tls, c)
- }
- func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
- return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
- }
- func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
- return Xisprint(tls, c)
- }
- func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
- return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
- }
- func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
- return Xisspace(tls, c)
- }
- func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
- return Bool32(func() int32 {
- if 0 != 0 {
- return Xisdigit(tls, c)
- }
- return Bool32(uint32(c)-uint32('0') < uint32(10))
- }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6))
- }
- func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
- return Xisxdigit(tls, c)
- }
- type div_t = struct {
- quot int32
- rem int32
- } /* stdlib.h:62:35 */
- type ldiv_t = struct {
- quot int32
- rem int32
- } /* stdlib.h:63:36 */
- type lldiv_t = struct {
- quot int64
- rem int64
- } /* stdlib.h:64:41 */
- type ssize_t = int32 /* alltypes.h:88:15 */
- type intptr_t = int32 /* alltypes.h:93:15 */
- type off_t = int64 /* alltypes.h:185:16 */
- type pid_t = int32 /* alltypes.h:258:13 */
- type uid_t = uint32 /* alltypes.h:268:18 */
- type gid_t = uint32 /* alltypes.h:273:18 */
- type useconds_t = uint32 /* alltypes.h:283:18 */
- func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
- var i size_t
- var newenv uintptr
- var tmp uintptr
- //TODO for (char **e = __environ; *e; e++, i++)
- var e uintptr
- i = size_t(0)
- if !(Environ() != 0) {
- goto __1
- }
- //TODO for (char **e = __environ; *e; e++, i++)
- e = Environ()
- __2:
- if !(*(*uintptr)(unsafe.Pointer(e)) != 0) {
- goto __4
- }
- if !!(Xstrncmp(tls, s, *(*uintptr)(unsafe.Pointer(e)), l+size_t(1)) != 0) {
- goto __5
- }
- tmp = *(*uintptr)(unsafe.Pointer(e))
- *(*uintptr)(unsafe.Pointer(e)) = s
- X__env_rm_add(tls, tmp, r)
- return 0
- __5:
- ;
- goto __3
- __3:
- e += 4
- i++
- goto __2
- goto __4
- __4:
- ;
- __1:
- ;
- if !(Environ() == _soldenv) {
- goto __6
- }
- newenv = Xrealloc(tls, _soldenv, uint32(unsafe.Sizeof(uintptr(0)))*(i+size_t(2)))
- if !!(newenv != 0) {
- goto __8
- }
- goto oom
- __8:
- ;
- goto __7
- __6:
- newenv = Xmalloc(tls, uint32(unsafe.Sizeof(uintptr(0)))*(i+size_t(2)))
- if !!(newenv != 0) {
- goto __9
- }
- goto oom
- __9:
- ;
- if !(i != 0) {
- goto __10
- }
- Xmemcpy(tls, newenv, Environ(), uint32(unsafe.Sizeof(uintptr(0)))*i)
- __10:
- ;
- Xfree(tls, _soldenv)
- __7:
- ;
- *(*uintptr)(unsafe.Pointer(newenv + uintptr(i)*4)) = s
- *(*uintptr)(unsafe.Pointer(newenv + uintptr(i+size_t(1))*4)) = uintptr(0)
- *(*uintptr)(unsafe.Pointer(EnvironP())) = AssignPtrUintptr(uintptr(unsafe.Pointer(&_soldenv)), newenv)
- if !(r != 0) {
- goto __11
- }
- X__env_rm_add(tls, uintptr(0), r)
- __11:
- ;
- return 0
- oom:
- Xfree(tls, r)
- return -1
- }
- var _soldenv uintptr /* putenv.c:22:14: */
- func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
- var l size_t = size_t((int32(X__strchrnul(tls, s, '=')) - int32(s)) / 1)
- if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
- return Xunsetenv(tls, s)
- }
- return X__putenv(tls, s, l, uintptr(0))
- }
- func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
- //TODO for (size_t i=0; i < env_alloced_n; i++)
- var i size_t = size_t(0)
- for ; i < _senv_alloced_n; i++ {
- if *(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*4)) == old {
- *(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*4)) = new
- Xfree(tls, old)
- return
- } else if !(int32(*(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*4))) != 0) && new != 0 {
- *(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*4)) = new
- new = uintptr(0)
- }
- }
- if !(new != 0) {
- return
- }
- var t uintptr = Xrealloc(tls, _senv_alloced, uint32(unsafe.Sizeof(uintptr(0)))*(_senv_alloced_n+size_t(1)))
- if !(t != 0) {
- return
- }
- *(*uintptr)(unsafe.Pointer(AssignPtrUintptr(uintptr(unsafe.Pointer(&_senv_alloced)), t) + uintptr(PostIncUint32(&_senv_alloced_n, 1))*4)) = new
- }
- var _senv_alloced uintptr /* setenv.c:7:14: */
- var _senv_alloced_n size_t /* setenv.c:8:16: */
- func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
- var s uintptr
- var l1 size_t
- var l2 size_t
- if !(var1 != 0) || !(int32(AssignUint32(&l1, size_t((int32(X__strchrnul(tls, var1, '='))-int32(var1))/1))) != 0) || *(*int8)(unsafe.Pointer(var1 + uintptr(l1))) != 0 {
- *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
- return -1
- }
- if !(overwrite != 0) && Xgetenv(tls, var1) != 0 {
- return 0
- }
- l2 = Xstrlen(tls, value)
- s = Xmalloc(tls, l1+l2+size_t(2))
- if !(s != 0) {
- return -1
- }
- Xmemcpy(tls, s, var1, l1)
- *(*int8)(unsafe.Pointer(s + uintptr(l1))) = int8('=')
- Xmemcpy(tls, s+uintptr(l1)+uintptr(1), value, l2+size_t(1))
- return X__putenv(tls, s, l1, s)
- }
- func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
- var l size_t = size_t((int32(X__strchrnul(tls, name, '=')) - int32(name)) / 1)
- if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
- *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
- return -1
- }
- if Environ() != 0 {
- var e uintptr = Environ()
- var eo uintptr = e
- for ; *(*uintptr)(unsafe.Pointer(e)) != 0; e += 4 {
- //TODO if (!strncmp(name, *e, l) && l[*e] == '=')
- if !(Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(e)), l) != 0) && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(e)) + uintptr(l)))) == '=' {
- X__env_rm_add(tls, *(*uintptr)(unsafe.Pointer(e)), uintptr(0))
- } else if eo != e {
- *(*uintptr)(unsafe.Pointer(PostIncUintptr(&eo, 4))) = *(*uintptr)(unsafe.Pointer(e))
- } else {
- eo += 4
- }
- }
- if eo != e {
- *(*uintptr)(unsafe.Pointer(eo)) = uintptr(0)
- }
- }
- return 0
- }
- type wint_t = uint32 /* alltypes.h:221:18 */
- type wctype_t = uint32 /* alltypes.h:226:23 */
- type __mbstate_t = struct {
- __opaque1 uint32
- __opaque2 uint32
- } /* alltypes.h:360:9 */
- type mbstate_t = __mbstate_t /* alltypes.h:360:63 */
- type tm = struct {
- tm_sec int32
- tm_min int32
- tm_hour int32
- tm_mday int32
- tm_mon int32
- tm_year int32
- tm_wday int32
- tm_yday int32
- tm_isdst int32
- tm_gmtoff int32
- tm_zone uintptr
- } /* wchar.h:138:1 */
- type uintptr_t = uint32 /* alltypes.h:78:24 */
- type int8_t = int8 /* alltypes.h:119:25 */
- type int16_t = int16 /* alltypes.h:124:25 */
- type int32_t = int32 /* alltypes.h:129:25 */
- type int64_t = int64 /* alltypes.h:134:25 */
- type intmax_t = int64 /* alltypes.h:139:25 */
- type uint8_t = uint8 /* alltypes.h:144:25 */
- type uint16_t = uint16 /* alltypes.h:149:25 */
- type uint32_t = uint32 /* alltypes.h:154:25 */
- type uint64_t = uint64 /* alltypes.h:159:25 */
- type uintmax_t = uint64 /* alltypes.h:169:25 */
- type int_fast8_t = int8_t /* stdint.h:22:16 */
- type int_fast64_t = int64_t /* stdint.h:23:17 */
- type int_least8_t = int8_t /* stdint.h:25:17 */
- type int_least16_t = int16_t /* stdint.h:26:17 */
- type int_least32_t = int32_t /* stdint.h:27:17 */
- type int_least64_t = int64_t /* stdint.h:28:17 */
- type uint_fast8_t = uint8_t /* stdint.h:30:17 */
- type uint_fast64_t = uint64_t /* stdint.h:31:18 */
- type uint_least8_t = uint8_t /* stdint.h:33:18 */
- type uint_least16_t = uint16_t /* stdint.h:34:18 */
- type uint_least32_t = uint32_t /* stdint.h:35:18 */
- type uint_least64_t = uint64_t /* stdint.h:36:18 */
- type int_fast16_t = int32_t /* stdint.h:1:17 */
- type int_fast32_t = int32_t /* stdint.h:2:17 */
- type uint_fast16_t = uint32_t /* stdint.h:3:18 */
- type uint_fast32_t = uint32_t /* stdint.h:4:18 */
- // Upper 6 state bits are a negative integer offset to bound-check next byte
- // equivalent to: ( (b-0x80) | (b+offset) ) & ~0x3f
- // Interval [a,b). Either a must be 80 or b must be c0, lower 3 bits clear.
- // Arbitrary encoding for representing code units instead of characters.
- // Get inline definition of MB_CUR_MAX.
- type lconv = struct {
- decimal_point uintptr
- thousands_sep uintptr
- grouping uintptr
- int_curr_symbol uintptr
- currency_symbol uintptr
- mon_decimal_point uintptr
- mon_thousands_sep uintptr
- mon_grouping uintptr
- positive_sign uintptr
- negative_sign uintptr
- int_frac_digits int8
- frac_digits int8
- p_cs_precedes int8
- p_sep_by_space int8
- n_cs_precedes int8
- n_sep_by_space int8
- p_sign_posn int8
- n_sign_posn int8
- int_p_cs_precedes int8
- int_p_sep_by_space int8
- int_n_cs_precedes int8
- int_n_sep_by_space int8
- int_p_sign_posn int8
- int_n_sign_posn int8
- _ [2]byte
- } /* locale.h:24:1 */
- type _G_fpos64_t = struct {
- _ [0]uint64
- __opaque [16]int8
- } /* stdio.h:54:9 */
- type fpos_t = _G_fpos64_t /* stdio.h:58:3 */
- // Support signed or unsigned plain-char
- // Implementation choices...
- // Arbitrary numbers...
- // POSIX/SUS requirements follow. These numbers come directly
- // from SUS and have nothing to do with the host system.
- type __locale_map = struct {
- __map uintptr
- map_size size_t
- name [24]int8
- next uintptr
- } /* alltypes.h:366:9 */
- type tls_module = struct {
- next uintptr
- image uintptr
- len size_t
- size size_t
- align size_t
- offset size_t
- } /* libc.h:14:1 */
- type __libc = struct {
- can_do_threads int8
- threaded int8
- secure int8
- need_locks int8
- threads_minus_1 int32
- auxv uintptr
- tls_head uintptr
- tls_size size_t
- tls_align size_t
- tls_cnt size_t
- page_size size_t
- global_locale struct{ cat [6]uintptr }
- } /* libc.h:20:1 */
- type time_t = int64 /* alltypes.h:108:16 */
- type clockid_t = int32 /* alltypes.h:237:13 */
- type timespec = struct {
- tv_sec time_t
- tv_nsec int32
- __12 uint32 /* int : 32 */
- } /* alltypes.h:252:1 */
- type __pthread = struct {
- self uintptr
- dtv uintptr
- prev uintptr
- next uintptr
- sysinfo uintptr_t
- canary uintptr_t
- canary2 uintptr_t
- tid int32
- errno_val int32
- detach_state int32
- cancel int32
- canceldisable uint8
- cancelasync uint8
- tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */
- _ [1]byte
- map_base uintptr
- map_size size_t
- stack uintptr
- stack_size size_t
- guard_size size_t
- result uintptr
- cancelbuf uintptr
- tsd uintptr
- robust_list struct {
- head uintptr
- off int32
- pending uintptr
- }
- timer_id int32
- locale locale_t
- killlock [1]int32
- dlerror_buf uintptr
- stdio_locks uintptr
- canary_at_end uintptr_t
- dtv_copy uintptr
- } /* alltypes.h:296:9 */
- type pthread_t = uintptr /* alltypes.h:296:26 */
- type pthread_once_t = int32 /* alltypes.h:302:13 */
- type pthread_key_t = uint32 /* alltypes.h:307:18 */
- type pthread_spinlock_t = int32 /* alltypes.h:312:13 */
- type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:317:37 */
- type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:322:37 */
- type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:327:37 */
- type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:332:40 */
- type __sigset_t = struct{ __bits [32]uint32 } /* alltypes.h:372:9 */
- type sigset_t = __sigset_t /* alltypes.h:372:71 */
- type pthread_attr_t = struct{ __u struct{ __i [9]int32 } } /* alltypes.h:395:147 */
- type pthread_mutex_t = struct{ __u struct{ __i [6]int32 } } /* alltypes.h:400:157 */
- type pthread_cond_t = struct{ __u struct{ __i [12]int32 } } /* alltypes.h:410:112 */
- type pthread_rwlock_t = struct{ __u struct{ __i [8]int32 } } /* alltypes.h:420:139 */
- type pthread_barrier_t = struct{ __u struct{ __i [5]int32 } } /* alltypes.h:425:137 */
- type sched_param = struct {
- sched_priority int32
- __reserved1 int32
- __reserved2 [4]int32
- __reserved3 int32
- } /* sched.h:19:1 */
- type timer_t = uintptr /* alltypes.h:232:14 */
- type clock_t = int32 /* alltypes.h:242:14 */
- type itimerspec = struct {
- it_interval struct {
- tv_sec time_t
- tv_nsec int32
- __12 uint32 /* int : 32 */
- }
- it_value struct {
- tv_sec time_t
- tv_nsec int32
- __12 uint32 /* int : 32 */
- }
- } /* time.h:80:1 */
- type sigevent = struct {
- sigev_value struct{ sival_int int32 }
- sigev_signo int32
- sigev_notify int32
- sigev_notify_function uintptr
- sigev_notify_attributes uintptr
- __pad [44]int8
- } /* time.h:107:1 */
- type __ptcb = struct {
- __f uintptr
- __x uintptr
- __next uintptr
- } /* alltypes.h:296:9 */
- type sigaltstack = struct {
- ss_sp uintptr
- ss_flags int32
- ss_size size_t
- } /* signal.h:44:9 */
- type stack_t = sigaltstack /* signal.h:44:28 */
- type greg_t = int32 /* signal.h:51:13 */
- type gregset_t = [19]int32 /* signal.h:51:21 */
- type _fpstate = struct {
- cw uint32
- sw uint32
- tag uint32
- ipoff uint32
- cssel uint32
- dataoff uint32
- datasel uint32
- _st [8]struct {
- significand [4]uint16
- exponent uint16
- }
- status uint32
- } /* signal.h:52:9 */
- type fpregset_t = uintptr /* signal.h:58:3 */
- type sigcontext = struct {
- gs uint16
- __gsh uint16
- fs uint16
- __fsh uint16
- es uint16
- __esh uint16
- ds uint16
- __dsh uint16
- edi uint32
- esi uint32
- ebp uint32
- esp uint32
- ebx uint32
- edx uint32
- ecx uint32
- eax uint32
- trapno uint32
- err uint32
- eip uint32
- cs uint16
- __csh uint16
- eflags uint32
- esp_at_signal uint32
- ss uint16
- __ssh uint16
- fpstate uintptr
- oldmask uint32
- cr2 uint32
- } /* signal.h:59:1 */
- type mcontext_t = struct {
- gregs gregset_t
- fpregs fpregset_t
- oldmask uint32
- cr2 uint32
- } /* signal.h:73:3 */
- type __ucontext = struct {
- uc_flags uint32
- uc_link uintptr
- uc_stack stack_t
- uc_mcontext mcontext_t
- uc_sigmask sigset_t
- __fpregs_mem [28]uint32
- } /* signal.h:86:9 */
- type ucontext_t = __ucontext /* signal.h:93:3 */
- type sigval = struct{ sival_int int32 } /* time.h:107:1 */
- type siginfo_t = struct {
- si_signo int32
- si_errno int32
- si_code int32
- __si_fields struct {
- _ [0]uint32
- __pad [116]int8
- }
- } /* signal.h:145:3 */
- type sigaction = struct {
- __sa_handler struct{ sa_handler uintptr }
- sa_mask sigset_t
- sa_flags int32
- sa_restorer uintptr
- } /* signal.h:167:1 */
- type sig_t = uintptr /* signal.h:251:14 */
- type sig_atomic_t = int32 /* signal.h:269:13 */
- type mode_t = uint32 /* alltypes.h:175:18 */
- type syscall_arg_t = int32 /* syscall.h:22:14 */
- func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:2:19: */
- panic(`arch/i386/atomic_arch.h:4:2: assembler statements not supported`)
- return t
- }
- func a_and(tls *TLS, p uintptr, v int32) { /* atomic_arch.h:29:20: */
- panic(`arch/i386/atomic_arch.h:31:2: assembler statements not supported`)
- }
- func a_or(tls *TLS, p uintptr, v int32) { /* atomic_arch.h:37:20: */
- panic(`arch/i386/atomic_arch.h:39:2: assembler statements not supported`)
- }
- func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic_arch.h:87:19: */
- var r int32
- panic(`arch/i386/atomic_arch.h:90:2: assembler statements not supported`)
- return r
- }
- func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic_arch.h:96:19: */
- var r int32
- panic(`arch/i386/atomic_arch.h:99:2: assembler statements not supported`)
- return r
- }
- func a_clz_32(tls *TLS, x uint32_t) int32 { /* atomic_arch.h:104:19: */
- panic(`arch/i386/atomic_arch.h:106:2: assembler statements not supported`)
- return int32(x)
- }
- func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */
- bp := tls.Alloc(8)
- defer tls.Free(8)
- *(*struct{ v uint64_t })(unsafe.Pointer(bp)) = func() (r struct{ v uint64_t }) {
- *(*uint64_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = v
- return r
- }()
- if *(*uint32_t)(unsafe.Pointer(bp)) != 0 {
- a_or(tls, p, int32(*(*uint32_t)(unsafe.Pointer(bp))))
- }
- if *(*uint32_t)(unsafe.Pointer(bp + 1*4)) != 0 {
- a_or(tls, p+uintptr(1)*4, int32(*(*uint32_t)(unsafe.Pointer(bp + 1*4))))
- }
- }
- type a_cas_p_undefined_but_pointer_not_32bit = [1]int8 /* atomic.h:229:14 */
- type __timer = struct {
- timerid int32
- thread pthread_t
- } /* pthread_impl.h:64:1 */
- func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */
- var self uintptr
- panic(`arch/i386/pthread_arch.h:4:2: assembler statements not supported`)
- return self
- }
- func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c:6:8: */
- if !(s != 0) {
- return size_t(1)
- }
- if uint32(wc) < uint32(0x80) {
- *(*int8)(unsafe.Pointer(s)) = int8(wc)
- return size_t(1)
- } else if func() int32 {
- if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) {
- return 4
- }
- return 1
- }() == 1 {
- if !(uint32(wc)-uint32(0xdf80) < uint32(0x80)) {
- *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84
- return Uint32FromInt32(-1)
- }
- *(*int8)(unsafe.Pointer(s)) = int8(wc)
- return size_t(1)
- } else if uint32(wc) < uint32(0x800) {
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(0xc0 | int32(wc)>>6)
- *(*int8)(unsafe.Pointer(s)) = int8(0x80 | int32(wc)&0x3f)
- return size_t(2)
- } else if uint32(wc) < uint32(0xd800) || uint32(wc)-uint32(0xe000) < uint32(0x2000) {
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(0xe0 | int32(wc)>>12)
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(0x80 | int32(wc)>>6&0x3f)
- *(*int8)(unsafe.Pointer(s)) = int8(0x80 | int32(wc)&0x3f)
- return size_t(3)
- } else if uint32(wc)-uint32(0x10000) < uint32(0x100000) {
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(0xf0 | int32(wc)>>18)
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(0x80 | int32(wc)>>12&0x3f)
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(0x80 | int32(wc)>>6&0x3f)
- *(*int8)(unsafe.Pointer(s)) = int8(0x80 | int32(wc)&0x3f)
- return size_t(4)
- }
- *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84
- return Uint32FromInt32(-1)
- }
- func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t { /* wcsrtombs.c:3:8: */
- bp := tls.Alloc(4)
- defer tls.Free(4)
- var ws2 uintptr
- // var buf [4]int8 at bp, 4
- var N size_t = n
- var l size_t
- if !(s != 0) {
- n = size_t(0)
- ws2 = *(*uintptr)(unsafe.Pointer(ws))
- for ; *(*wchar_t)(unsafe.Pointer(ws2)) != 0; ws2 += 2 {
- if uint32(*(*wchar_t)(unsafe.Pointer(ws2))) >= 0x80 {
- l = Xwcrtomb(tls, bp, *(*wchar_t)(unsafe.Pointer(ws2)), uintptr(0))
- if !(l+size_t(1) != 0) {
- return Uint32FromInt32(-1)
- }
- n = n + l
- } else {
- n++
- }
- }
- return n
- }
- for n >= size_t(4) {
- if uint32(*(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))))-1 >= 0x7f {
- if !(int32(*(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws))))) != 0) {
- *(*int8)(unsafe.Pointer(s)) = int8(0)
- *(*uintptr)(unsafe.Pointer(ws)) = uintptr(0)
- return N - n
- }
- l = Xwcrtomb(tls, s, *(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))), uintptr(0))
- if !(l+size_t(1) != 0) {
- return Uint32FromInt32(-1)
- }
- s += uintptr(l)
- n = n - l
- } else {
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(*(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))))
- n--
- }
- *(*uintptr)(unsafe.Pointer(ws)) += 2
- }
- for n != 0 {
- if uint32(*(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))))-1 >= 0x7f {
- if !(int32(*(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws))))) != 0) {
- *(*int8)(unsafe.Pointer(s)) = int8(0)
- *(*uintptr)(unsafe.Pointer(ws)) = uintptr(0)
- return N - n
- }
- l = Xwcrtomb(tls, bp, *(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))), uintptr(0))
- if !(l+size_t(1) != 0) {
- return Uint32FromInt32(-1)
- }
- if l > n {
- return N - n
- }
- Xwcrtomb(tls, s, *(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))), uintptr(0))
- s += uintptr(l)
- n = n - l
- } else {
- *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8(*(*wchar_t)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ws)))))
- n--
- }
- *(*uintptr)(unsafe.Pointer(ws)) += 2
- }
- return N
- }
- func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c:4:8: */
- bp := tls.Alloc(4)
- defer tls.Free(4)
- *(*uintptr)(unsafe.Pointer(bp)) = ws
- //TODO return wcsrtombs(s, &(const wchar_t *){ws}, n, 0);
- return Xwcsrtombs(tls, s, bp, n, uintptr(0))
- }
- // Support signed or unsigned plain-char
- // Implementation choices...
- // Arbitrary numbers...
- // POSIX/SUS requirements follow. These numbers come directly
- // from SUS and have nothing to do with the host system.
- func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
- c = int32(uint8(c))
- if !(c != 0) {
- return s + uintptr(Xstrlen(tls, s))
- }
- var w uintptr
- for ; uintptr_t(s)%uintptr_t(unsafe.Sizeof(size_t(0))) != 0; s++ {
- if !(int32(*(*int8)(unsafe.Pointer(s))) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c {
- return s
- }
- }
- var k size_t = Uint32(Uint32FromInt32(-1)) / size_t(255) * size_t(c)
- for w = s; !((*(*uint32)(unsafe.Pointer(w))-Uint32(Uint32FromInt32(-1))/size_t(255)) & ^*(*uint32)(unsafe.Pointer(w)) & (Uint32(Uint32FromInt32(-1))/size_t(255)*size_t(255/2+1)) != 0) && !((*(*uint32)(unsafe.Pointer(w))^k-Uint32(Uint32FromInt32(-1))/size_t(255)) & ^(*(*uint32)(unsafe.Pointer(w))^k) & (Uint32(Uint32FromInt32(-1))/size_t(255)*size_t(255/2+1)) != 0); w += 4 {
- }
- s = w
- for ; *(*int8)(unsafe.Pointer(s)) != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c; s++ {
- }
- return s
- }
- func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
- var l size_t = Xstrlen(tls, s)
- var d uintptr = Xmalloc(tls, l+size_t(1))
- if !(d != 0) {
- return uintptr(0)
- }
- return Xmemcpy(tls, d, s, l+size_t(1))
- }
|