diff --git a/c/c_test.go b/c/c_test.go index 98408058..52517020 100644 --- a/c/c_test.go +++ b/c/c_test.go @@ -1,3 +1,5 @@ +//go:build !(linux && arm64 && !android) + /* * Copyright (c) 2026 The XGo Authors (xgo.dev). All rights reserved. * diff --git a/c/generated_native_llgo_test.go b/c/generated_native_llgo_test.go new file mode 100644 index 00000000..2b5c4bd5 --- /dev/null +++ b/c/generated_native_llgo_test.go @@ -0,0 +1,53 @@ +//go:build llgo && ((darwin && arm64 && !ios) || (linux && (amd64 || arm64) && !android)) + +package c_test + +import ( + "github.com/goplus/lib/c" + "testing" + "unsafe" +) + +func TestGeneratedMemoryCalls(t *testing.T) { + input := [6]byte{0, 1, 127, 128, 254, 255} + var output [6]byte + if p := c.Memcpy(unsafe.Pointer(&output[0]), unsafe.Pointer(&input[0]), 6); p != unsafe.Pointer(&output[0]) { + t.Fatal("memcpy returned another buffer") + } + if output != input || c.Memcmp(unsafe.Pointer(&output[0]), unsafe.Pointer(&input[0]), 6) != 0 { + t.Fatal("native memory copy differs") + } + c.Memset(unsafe.Pointer(&output[0]), 0, 6) + if output != [6]byte{} { + t.Fatalf("memset result %v", output) + } + value := c.Str("native libc") + if got := c.Strlen(value); got != 11 { + t.Fatalf("strlen = %d, want 11", got) + } +} +func TestGeneratedStdioCalls(t *testing.T) { + stream := c.Tmpfile() + if stream == nil { + t.Fatal("tmpfile returned nil") + } + defer func() { + if result := c.Fclose(stream); result != 0 { + t.Errorf("fclose = %d", result) + } + }() + input := [6]byte{0, 1, 127, 128, 254, 255} + var output [6]byte + if got := c.Fwrite(unsafe.Pointer(&input[0]), 1, 6, stream); got != 6 { + t.Fatalf("fwrite = %d", got) + } + if got := c.Fseek(stream, 0, 0); got != 0 { + t.Fatalf("fseek = %d", got) + } + if got := c.Fread(unsafe.Pointer(&output[0]), 1, 6, stream); got != 6 { + t.Fatalf("fread = %d", got) + } + if output != input { + t.Fatalf("stdio result %v, want %v", output, input) + } +} diff --git a/c/libc_darwin_arm64.go b/c/libc_darwin_arm64.go new file mode 100644 index 00000000..cde5edfb --- /dev/null +++ b/c/libc_darwin_arm64.go @@ -0,0 +1,1034 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package c + +import ( + "unsafe" +) + +// Match failed. +const FNM_NOMATCH = 1 + +const ( + // Disable backslash escaping. + FNM_NOESCAPE = 1 + // Slash must be matched by slash. + FNM_PATHNAME = 2 + // Period must be matched by period. + FNM_PERIOD = 4 +) + +// Reserved. +const FNM_NOSYS = -1 + +const ( + // Ignore / after Imatch. + FNM_LEADING_DIR = 8 + // Case insensitive search. + FNM_CASEFOLD = 16 + FNM_IGNORECASE = 16 + FNM_FILE_NAME = 2 +) + +//go:linkname Fnmatch C.fnmatch +func Fnmatch(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 Int) Int + +const ( + PRId16 = "hd" + PRIi16 = "hi" + PRIo16 = "ho" + PRIu16 = "hu" + PRIx16 = "hx" + PRIX16 = "hX" +) + +const ( + PRId32 = "d" + PRIi32 = "i" + PRIo32 = "o" + PRIu32 = "u" + PRIx32 = "x" + PRIX32 = "X" +) + +const ( + PRIdLEAST16 = "hd" + PRIiLEAST16 = "hi" + PRIoLEAST16 = "ho" + PRIuLEAST16 = "hu" + PRIxLEAST16 = "hx" + PRIXLEAST16 = "hX" +) + +const ( + PRIdLEAST32 = "d" + PRIiLEAST32 = "i" + PRIoLEAST32 = "o" + PRIuLEAST32 = "u" + PRIxLEAST32 = "x" + PRIXLEAST32 = "X" +) + +const ( + PRIdFAST16 = "hd" + PRIiFAST16 = "hi" + PRIoFAST16 = "ho" + PRIuFAST16 = "hu" + PRIxFAST16 = "hx" + PRIXFAST16 = "hX" +) + +const ( + PRIdFAST32 = "d" + PRIiFAST32 = "i" + PRIoFAST32 = "o" + PRIuFAST32 = "u" + PRIxFAST32 = "x" + PRIXFAST32 = "X" +) + +// int32_t is 'int', but intptr_t is 'long'. +const ( + PRIdPTR = "ld" + PRIiPTR = "li" + PRIoPTR = "lo" + PRIuPTR = "lu" + PRIxPTR = "lx" + PRIXPTR = "lX" +) + +const ( + SCNd16 = "hd" + SCNi16 = "hi" + SCNo16 = "ho" + SCNu16 = "hu" + SCNx16 = "hx" +) + +const ( + SCNd32 = "d" + SCNi32 = "i" + SCNo32 = "o" + SCNu32 = "u" + SCNx32 = "x" +) + +const ( + SCNdLEAST16 = "hd" + SCNiLEAST16 = "hi" + SCNoLEAST16 = "ho" + SCNuLEAST16 = "hu" + SCNxLEAST16 = "hx" +) + +const ( + SCNdLEAST32 = "d" + SCNiLEAST32 = "i" + SCNoLEAST32 = "o" + SCNuLEAST32 = "u" + SCNxLEAST32 = "x" +) + +const ( + SCNdFAST16 = "hd" + SCNiFAST16 = "hi" + SCNoFAST16 = "ho" + SCNuFAST16 = "hu" + SCNxFAST16 = "hx" +) + +const ( + SCNdFAST32 = "d" + SCNiFAST32 = "i" + SCNoFAST32 = "o" + SCNuFAST32 = "u" + SCNxFAST32 = "x" +) + +const ( + SCNdPTR = "ld" + SCNiPTR = "li" + SCNoPTR = "lo" + SCNuPTR = "lu" + SCNxPTR = "lx" +) + +// 7.8.2.2 +type ImaxdivT struct { + Quot Long + Rem Long +} + +// 7.8.2.1 +// +//go:linkname Imaxabs C.imaxabs +func Imaxabs(j Long) Long + +//go:linkname Imaxdiv C.imaxdiv +func Imaxdiv(__numer Long, __denom Long) ImaxdivT + +// 7.8.2.3 +// +//go:linkname Strtoimax C.strtoimax +func Strtoimax(__nptr *Char, __endptr **Char, __base Int) Long + +//go:linkname Strtoumax C.strtoumax +func Strtoumax(__nptr *Char, __endptr **Char, __base Int) Ulong + +// 7.8.2.4 +// +//go:linkname Wcstoimax C.wcstoimax +func Wcstoimax(__nptr *Int, __endptr **Int, __base Int) Long + +//go:linkname Wcstoumax C.wcstoumax +func Wcstoumax(__nptr *Int, __endptr **Int, __base Int) Ulong + +//go:linkname Basename C.basename +func Basename(_llcppg_param1 *Char) *Char + +//go:linkname Dirname C.dirname +func Dirname(_llcppg_param1 *Char) *Char + +//go:linkname BasenameR C.basename_r +func BasenameR(_llcppg_param1 *Char, _llcppg_param2 *Char) *Char + +//go:linkname DirnameR C.dirname_r +func DirnameR(_llcppg_param1 *Char, _llcppg_param2 *Char) *Char + +const ( + PTHREAD_DESTRUCTOR_ITERATIONS = 4 + PTHREAD_KEYS_MAX = 512 +) + +const PTHREAD_STACK_MIN = 16384 + +const PASS_MAX = 128 + +const ( + NL_ARGMAX = 9 + NL_LANGMAX = 14 + NL_MSGMAX = 32767 + NL_NMAX = 1 + NL_SETMAX = 255 + NL_TEXTMAX = 2048 +) + +const ( + IOV_MAX = 1024 +) + +const ( + LC_ALL = 0 + LC_COLLATE = 1 + LC_CTYPE = 2 + LC_MONETARY = 3 + LC_NUMERIC = 4 + LC_TIME = 5 + LC_MESSAGES = 6 +) + +//go:linkname Setlocale C.setlocale +func Setlocale(_llcppg_param1 Int, _llcppg_param2 *Char) *Char + +//go:linkname Valloc C.valloc +func Valloc(_llcppg_param1 SizeT) unsafe.Pointer + +//go:linkname AlignedAlloc C.aligned_alloc +func AlignedAlloc(__alignment SizeT, __size SizeT) unsafe.Pointer + +//go:linkname PosixMemalign C.posix_memalign +func PosixMemalign(__memptr *unsafe.Pointer, __alignment SizeT, __size SizeT) Int + +type X_mallocZoneT struct { +} + +type MallocZoneT X_mallocZoneT + +// 7.18.2.1 Limits of exact-width integer types +const ( + INT8_MAX = 127 + INT16_MAX = 32767 + INT32_MAX = 2147483647 +) + +// Note: the literal "most negative int" cannot be written in C -- +// the rules in the standard (section 6.4.4.1 in C99) will give it +// an unsigned type, so INT32_MIN (and the most negative member of +// any larger signed type) must be written via a constant expression. +const ( + INT8_MIN = -128 + INT16_MIN = -32768 +) + +// Note: the literal "most negative int" cannot be written in C -- +// the rules in the standard (section 6.4.4.1 in C99) will give it +// an unsigned type, so INT32_MIN (and the most negative member of +// any larger signed type) must be written via a constant expression. +const INT32_MIN = -2147483648 + +const ( + UINT8_MAX = 255 + UINT16_MAX = 65535 +) + +// 7.18.2.2 Limits of minimum-width integer types +const ( + INT_LEAST8_MIN = -128 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MIN = -2147483648 +) + +const ( + INT_LEAST8_MAX = 127 + INT_LEAST16_MAX = 32767 + INT_LEAST32_MAX = 2147483647 +) + +const ( + UINT_LEAST8_MAX = 255 + UINT_LEAST16_MAX = 65535 +) + +// 7.18.2.3 Limits of fastest minimum-width integer types +const ( + INT_FAST8_MIN = -128 + INT_FAST16_MIN = -32768 + INT_FAST32_MIN = -2147483648 +) + +const ( + INT_FAST8_MAX = 127 + INT_FAST16_MAX = 32767 + INT_FAST32_MAX = 2147483647 +) + +const ( + UINT_FAST8_MAX = 255 + UINT_FAST16_MAX = 65535 +) + +const ( + WINT_MIN = -2147483648 + WINT_MAX = 2147483647 +) + +const ( + SIG_ATOMIC_MIN = -2147483648 + SIG_ATOMIC_MAX = 2147483647 +) + +const ( + // size of buffer used by setbuf + BUFSIZ = 1024 + EOF = -1 +) + +// must be == _POSIX_STREAM_MAX +const ( + FOPEN_MAX = 20 + // must be <= PATH_MAX + FILENAME_MAX = 1024 +) + +const PTmpdir = "/var/tmp/" + +const ( + // XXX must be == PATH_MAX + LTmpnam = 1024 + TMP_MAX = 308915776 +) + +// size for ctermid(); PATH_MAX +const LCtermid = 1024 + +// Stdio function-access interface. +// +// llgo:type C +type llcppgCallback8 = func(_llcppg_param1 unsafe.Pointer) Int + +// llgo:type C +type llcppgCallback9 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 LongLong, _llcppg_param3 Int) LongLong + +// llgo:type C +type llcppgCallback10 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *Char, _llcppg_param3 Int) Int + +// llgo:type C +type llcppgCallback11 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *Char, _llcppg_param3 Int) Int + +//go:linkname Clearerr C.clearerr +func Clearerr(_llcppg_param1 *FILE) + +//go:linkname Feof C.feof +func Feof(_llcppg_param1 *FILE) Int + +//go:linkname Ferror C.ferror +func Ferror(_llcppg_param1 *FILE) Int + +//go:linkname Fgetc C.fgetc +func Fgetc(_llcppg_param1 *FILE) Int + +//go:linkname Fgetpos C.fgetpos +func Fgetpos(_llcppg_param1 *FILE, _llcppg_param2 *LongLong) Int + +//go:linkname Fgets C.fgets +func Fgets(_llcppg_param1 *Char, _llcppg_param2 Int, _llcppg_param3 *FILE) *Char + +//go:linkname Freopen C.freopen +func Freopen(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 *FILE) *FILE + +//go:linkname Fscanf C.fscanf +func Fscanf(_llcppg_param1 *FILE, _llcppg_param2 *Char, __llgo_va_list ...any) Int + +//go:linkname Fseek C.fseek +func Fseek(_llcppg_param1 *FILE, _llcppg_param2 Long, _llcppg_param3 Int) Int + +//go:linkname Fsetpos C.fsetpos +func Fsetpos(_llcppg_param1 *FILE, _llcppg_param2 *LongLong) Int + +//go:linkname Ftell C.ftell +func Ftell(_llcppg_param1 *FILE) Long + +//go:linkname Getc C.getc +func Getc(_llcppg_param1 *FILE) Int + +//go:linkname Getchar C.getchar +func Getchar() Int + +//go:linkname Gets C.gets +func Gets(_llcppg_param1 *Char) *Char + +//go:linkname Putc C.putc +func Putc(_llcppg_param1 Int, _llcppg_param2 *FILE) Int + +//go:linkname Putchar C.putchar +func Putchar(_llcppg_param1 Int) Int + +//go:linkname Puts C.puts +func Puts(_llcppg_param1 *Char) Int + +//go:linkname Rewind C.rewind +func Rewind(_llcppg_param1 *FILE) + +//go:linkname Scanf C.scanf +func Scanf(_llcppg_param1 *Char, __llgo_va_list ...any) Int + +//go:linkname Setbuf C.setbuf +func Setbuf(_llcppg_param1 *FILE, _llcppg_param2 *Char) + +//go:linkname Setvbuf C.setvbuf +func Setvbuf(_llcppg_param1 *FILE, _llcppg_param2 *Char, _llcppg_param3 Int, _llcppg_param4 SizeT) Int + +//go:linkname Sscanf C.sscanf +func Sscanf(_llcppg_param1 *Char, _llcppg_param2 *Char, __llgo_va_list ...any) Int + +//go:linkname Tmpfile C.tmpfile +func Tmpfile() *FILE + +//go:linkname Tmpnam C.tmpnam +func Tmpnam(_llcppg_param1 *Char) *Char + +//go:linkname Ungetc C.ungetc +func Ungetc(_llcppg_param1 Int, _llcppg_param2 *FILE) Int + +//go:linkname Fdopen C.fdopen +func Fdopen(_llcppg_param1 Int, _llcppg_param2 *Char) *FILE + +//go:linkname Fileno C.fileno +func Fileno(_llcppg_param1 *FILE) Int + +//go:linkname Pclose C.pclose +func Pclose(_llcppg_param1 *FILE) Int + +//go:linkname Popen C.popen +func Popen(_llcppg_param1 *Char, _llcppg_param2 *Char) *FILE + +//go:linkname Flockfile C.flockfile +func Flockfile(_llcppg_param1 *FILE) + +//go:linkname Ftrylockfile C.ftrylockfile +func Ftrylockfile(_llcppg_param1 *FILE) Int + +//go:linkname Funlockfile C.funlockfile +func Funlockfile(_llcppg_param1 *FILE) + +//go:linkname GetcUnlocked C.getc_unlocked +func GetcUnlocked(_llcppg_param1 *FILE) Int + +//go:linkname GetcharUnlocked C.getchar_unlocked +func GetcharUnlocked() Int + +//go:linkname PutcUnlocked C.putc_unlocked +func PutcUnlocked(_llcppg_param1 Int, _llcppg_param2 *FILE) Int + +//go:linkname PutcharUnlocked C.putchar_unlocked +func PutcharUnlocked(_llcppg_param1 Int) Int + +//go:linkname Getw C.getw +func Getw(_llcppg_param1 *FILE) Int + +//go:linkname Putw C.putw +func Putw(_llcppg_param1 Int, _llcppg_param2 *FILE) Int + +//go:linkname Tempnam C.tempnam +func Tempnam(__dir *Char, __prefix *Char) *Char + +//go:linkname Fseeko C.fseeko +func Fseeko(__stream *FILE, __offset LongLong, __whence Int) Int + +//go:linkname Ftello C.ftello +func Ftello(__stream *FILE) LongLong + +//go:linkname Dprintf C.dprintf +func Dprintf(_llcppg_param1 Int, _llcppg_param2 *Char, __llgo_va_list ...any) Int + +//go:linkname Getdelim C.getdelim +func Getdelim(__linep **Char, __linecapp *SizeT, __delimiter Int, __stream *FILE) SsizeT + +//go:linkname Getline C.getline +func Getline(__linep **Char, __linecapp *SizeT, __stream *FILE) SsizeT + +//go:linkname Fmemopen C.fmemopen +func Fmemopen(__buf unsafe.Pointer, __size SizeT, __mode *Char) *FILE + +//go:linkname OpenMemstream C.open_memstream +func OpenMemstream(__bufp **Char, __sizep *SizeT) *FILE + +// perror(3) external variables +// +//go:linkname SysNerr C.sys_nerr +var SysNerr Int + +//go:linkname SysErrlist C.sys_errlist +var SysErrlist [0]*Char + +//go:linkname Asprintf C.asprintf +func Asprintf(_llcppg_param1 **Char, _llcppg_param2 *Char, __llgo_va_list ...any) Int + +//go:linkname CtermidR C.ctermid_r +func CtermidR(_llcppg_param1 *Char) *Char + +//go:linkname Fgetln C.fgetln +func Fgetln(_llcppg_param1 *FILE, _llcppg_param2 *SizeT) *Char + +//go:linkname Fmtcheck C.fmtcheck +func Fmtcheck(_llcppg_param1 *Char, _llcppg_param2 *Char) *Char + +//go:linkname Fpurge C.fpurge +func Fpurge(_llcppg_param1 *FILE) Int + +//go:linkname Setbuffer C.setbuffer +func Setbuffer(_llcppg_param1 *FILE, _llcppg_param2 *Char, _llcppg_param3 Int) + +//go:linkname Setlinebuf C.setlinebuf +func Setlinebuf(_llcppg_param1 *FILE) Int + +//go:linkname Funopen C.funopen +func Funopen(_llcppg_param1 unsafe.Pointer, _llcppg_param2 llcppgCallback11, _llcppg_param3 llcppgCallback10, _llcppg_param4 llcppgCallback9, _llcppg_param5 llcppgCallback8) *FILE + +const ( + EXIT_FAILURE = 1 + EXIT_SUCCESS = 0 +) + +const RAND_MAX = 2147483647 + +// llgo:type C +type llcppgCallback7 = func() + +// llgo:type C +type llcppgCallback6 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// posix_memalign is now declared in _malloc.h +// +// llgo:type C +type llcppgCallback5 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// llgo:type C +type llcppgCallback4 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// llgo:type C +type llcppgCallback3 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// llgo:type C +type llcppgCallback2 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// llgo:type C +type llcppgCallback1 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer) Int + +// llgo:type C +type llcppgCallback0 = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer) Int + +//go:linkname Abort C.abort +func Abort() + +//go:linkname Abs C.abs +func Abs(_llcppg_param1 Int) Int + +//go:linkname Atexit C.atexit +func Atexit(_llcppg_param1 llcppgCallback7) Int + +//go:linkname Atof C.atof +func Atof(_llcppg_param1 *Char) Double + +//go:linkname Atol C.atol +func Atol(_llcppg_param1 *Char) Long + +//go:linkname Atoll C.atoll +func Atoll(_llcppg_param1 *Char) LongLong + +// calloc is now declared in _malloc.h +// +//go:linkname Bsearch C.bsearch +func Bsearch(__key unsafe.Pointer, __base unsafe.Pointer, __nel SizeT, __width SizeT, __compar llcppgCallback6) unsafe.Pointer + +// calloc is now declared in _malloc.h +// +//go:linkname Div C.div +func Div(_llcppg_param1 Int, _llcppg_param2 Int) DivT + +//go:linkname Labs C.labs +func Labs(_llcppg_param1 Long) Long + +//go:linkname Ldiv C.ldiv +func Ldiv(_llcppg_param1 Long, _llcppg_param2 Long) LdivT + +//go:linkname Llabs C.llabs +func Llabs(_llcppg_param1 LongLong) LongLong + +//go:linkname Lldiv C.lldiv +func Lldiv(_llcppg_param1 LongLong, _llcppg_param2 LongLong) LldivT + +// malloc is now declared in _malloc.h +// +//go:linkname Mblen C.mblen +func Mblen(__s *Char, __n SizeT) Int + +//go:linkname Mbstowcs C.mbstowcs +func Mbstowcs(_llcppg_param1 *Int, _llcppg_param2 *Char, _llcppg_param3 SizeT) SizeT + +// posix_memalign is now declared in _malloc.h +// +//go:linkname Mbtowc C.mbtowc +func Mbtowc(_llcppg_param1 *Int, _llcppg_param2 *Char, _llcppg_param3 SizeT) Int + +// realloc is now declared in _malloc.h +// +//go:linkname Srand C.srand +func Srand(_llcppg_param1 Uint) + +//go:linkname Strtod C.strtod +func Strtod(_llcppg_param1 *Char, _llcppg_param2 **Char) Double + +//go:linkname Strtof C.strtof +func Strtof(_llcppg_param1 *Char, _llcppg_param2 **Char) Float + +//go:linkname Strtol C.strtol +func Strtol(__str *Char, __endptr **Char, __base Int) Long + +//go:linkname Strtold C.strtold +func Strtold(_llcppg_param1 *Char, _llcppg_param2 **Char) LongDouble + +//go:linkname Strtoll C.strtoll +func Strtoll(__str *Char, __endptr **Char, __base Int) LongLong + +//go:linkname Strtoul C.strtoul +func Strtoul(__str *Char, __endptr **Char, __base Int) Ulong + +//go:linkname Strtoull C.strtoull +func Strtoull(__str *Char, __endptr **Char, __base Int) UlongLong + +//go:linkname System C.system +func System(_llcppg_param1 *Char) Int + +//go:linkname Wcstombs C.wcstombs +func Wcstombs(_llcppg_param1 *Char, _llcppg_param2 *Int, _llcppg_param3 SizeT) SizeT + +//go:linkname Wctomb C.wctomb +func Wctomb(_llcppg_param1 *Char, _llcppg_param2 Int) Int + +//go:linkname X_Exit C._Exit +func X_Exit(_llcppg_param1 Int) + +//go:linkname A64l C.a64l +func A64l(_llcppg_param1 *Char) Long + +//go:linkname Drand48 C.drand48 +func Drand48() Double + +// LEGACY +// +//go:linkname Ecvt C.ecvt +func Ecvt(_llcppg_param1 Double, _llcppg_param2 Int, _llcppg_param3 *Int, _llcppg_param4 *Int) *Char + +//go:linkname Erand48 C.erand48 +func Erand48(_llcppg_param1 *uint16) Double + +// LEGACY +// +//go:linkname Fcvt C.fcvt +func Fcvt(_llcppg_param1 Double, _llcppg_param2 Int, _llcppg_param3 *Int, _llcppg_param4 *Int) *Char + +// LEGACY +// +//go:linkname Gcvt C.gcvt +func Gcvt(_llcppg_param1 Double, _llcppg_param2 Int, _llcppg_param3 *Char) *Char + +//go:linkname Getsubopt C.getsubopt +func Getsubopt(_llcppg_param1 **Char, _llcppg_param2 **Char, _llcppg_param3 **Char) Int + +//go:linkname Grantpt C.grantpt +func Grantpt(_llcppg_param1 Int) Int + +// no __DARWIN_ALIAS needed +// +//go:linkname Initstate C.initstate +func Initstate(_llcppg_param1 Uint, _llcppg_param2 *Char, _llcppg_param3 SizeT) *Char + +//go:linkname Jrand48 C.jrand48 +func Jrand48(_llcppg_param1 *uint16) Long + +//go:linkname L64a C.l64a +func L64a(_llcppg_param1 Long) *Char + +//go:linkname Lcong48 C.lcong48 +func Lcong48(_llcppg_param1 *uint16) + +//go:linkname Lrand48 C.lrand48 +func Lrand48() Long + +//go:linkname Mktemp C.mktemp +func Mktemp(_llcppg_param1 *Char) *Char + +//go:linkname Mkstemp C.mkstemp +func Mkstemp(_llcppg_param1 *Char) Int + +//go:linkname Mrand48 C.mrand48 +func Mrand48() Long + +//go:linkname Nrand48 C.nrand48 +func Nrand48(_llcppg_param1 *uint16) Long + +//go:linkname PosixOpenpt C.posix_openpt +func PosixOpenpt(_llcppg_param1 Int) Int + +//go:linkname Ptsname C.ptsname +func Ptsname(_llcppg_param1 Int) *Char + +//go:linkname PtsnameR C.ptsname_r +func PtsnameR(fildes Int, buffer *Char, buflen SizeT) Int + +//go:linkname Random C.random +func Random() Long + +//go:linkname RandR C.rand_r +func RandR(_llcppg_param1 *Uint) Int + +//go:linkname Realpath C.realpath$DARWIN_EXTSN +func Realpath(_llcppg_param1 *Char, _llcppg_param2 *Char) *Char + +//go:linkname Seed48 C.seed48 +func Seed48(_llcppg_param1 *uint16) *uint16 + +//go:linkname Setkey C.setkey +func Setkey(_llcppg_param1 *Char) + +//go:linkname Setstate C.setstate +func Setstate(_llcppg_param1 *Char) *Char + +//go:linkname Srand48 C.srand48 +func Srand48(_llcppg_param1 Long) + +//go:linkname Srandom C.srandom +func Srandom(_llcppg_param1 Uint) + +//go:linkname Unlockpt C.unlockpt +func Unlockpt(_llcppg_param1 Int) Int + +//go:linkname Arc4random C.arc4random +func Arc4random() Uint + +//go:linkname Arc4randomAddrandom C.arc4random_addrandom +func Arc4randomAddrandom(_llcppg_param1 *uint8, _llcppg_param2 Int) + +//go:linkname Arc4randomBuf C.arc4random_buf +func Arc4randomBuf(__buf unsafe.Pointer, __nbytes SizeT) + +//go:linkname Arc4randomStir C.arc4random_stir +func Arc4randomStir() + +//go:linkname Arc4randomUniform C.arc4random_uniform +func Arc4randomUniform(__upper_bound Uint) Uint + +// getcap(3) functions +// +//go:linkname Cgetcap C.cgetcap +func Cgetcap(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 Int) *Char + +//go:linkname Cgetclose C.cgetclose +func Cgetclose() Int + +//go:linkname Cgetent C.cgetent +func Cgetent(_llcppg_param1 **Char, _llcppg_param2 **Char, _llcppg_param3 *Char) Int + +//go:linkname Cgetfirst C.cgetfirst +func Cgetfirst(_llcppg_param1 **Char, _llcppg_param2 **Char) Int + +//go:linkname Cgetmatch C.cgetmatch +func Cgetmatch(_llcppg_param1 *Char, _llcppg_param2 *Char) Int + +//go:linkname Cgetnext C.cgetnext +func Cgetnext(_llcppg_param1 **Char, _llcppg_param2 **Char) Int + +//go:linkname Cgetnum C.cgetnum +func Cgetnum(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 *Long) Int + +//go:linkname Cgetset C.cgetset +func Cgetset(_llcppg_param1 *Char) Int + +//go:linkname Cgetstr C.cgetstr +func Cgetstr(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 **Char) Int + +//go:linkname Cgetustr C.cgetustr +func Cgetustr(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 **Char) Int + +//go:linkname Daemon C.daemon +func Daemon(_llcppg_param1 Int, _llcppg_param2 Int) Int + +//go:linkname Devname C.devname +func Devname(_llcppg_param1 Int, _llcppg_param2 Uint16T) *Char + +//go:linkname DevnameR C.devname_r +func DevnameR(_llcppg_param1 Int, _llcppg_param2 Uint16T, buf *Char, len Int) *Char + +//go:linkname Getbsize C.getbsize +func Getbsize(_llcppg_param1 *Int, _llcppg_param2 *Long) *Char + +//go:linkname Getloadavg C.getloadavg +func Getloadavg(_llcppg_param1 *Double, _llcppg_param2 Int) Int + +//go:linkname Getprogname C.getprogname +func Getprogname() *Char + +//go:linkname Setprogname C.setprogname +func Setprogname(_llcppg_param1 *Char) + +//go:linkname Heapsort C.heapsort +func Heapsort(__base unsafe.Pointer, __nel SizeT, __width SizeT, __compar llcppgCallback4) Int + +//go:linkname Mergesort C.mergesort +func Mergesort(__base unsafe.Pointer, __nel SizeT, __width SizeT, __compar llcppgCallback3) Int + +//go:linkname Psort C.psort +func Psort(__base unsafe.Pointer, __nel SizeT, __width SizeT, __compar llcppgCallback2) + +//go:linkname PsortR C.psort_r +func PsortR(__base unsafe.Pointer, __nel SizeT, __width SizeT, _llcppg_param4 unsafe.Pointer, __compar llcppgCallback1) + +//go:linkname QsortR C.qsort_r +func QsortR(__base unsafe.Pointer, __nel SizeT, __width SizeT, _llcppg_param4 unsafe.Pointer, __compar llcppgCallback0) + +//go:linkname Radixsort C.radixsort +func Radixsort(__base **uint8, __nel Int, __table *uint8, __endbyte Uint) Int + +//go:linkname Rpmatch C.rpmatch +func Rpmatch(_llcppg_param1 *Char) Int + +//go:linkname Sradixsort C.sradixsort +func Sradixsort(__base **uint8, __nel Int, __table *uint8, __endbyte Uint) Int + +//go:linkname Sranddev C.sranddev +func Sranddev() + +//go:linkname Srandomdev C.srandomdev +func Srandomdev() + +//go:linkname Reallocf C.reallocf +func Reallocf(__ptr unsafe.Pointer, __size SizeT) unsafe.Pointer + +//go:linkname Strtonum C.strtonum +func Strtonum(__numstr *Char, __minval LongLong, __maxval LongLong, __errstrp **Char) LongLong + +//go:linkname Strtoq C.strtoq +func Strtoq(__str *Char, __endptr **Char, __base Int) LongLong + +//go:linkname Strtouq C.strtouq +func Strtouq(__str *Char, __endptr **Char, __base Int) UlongLong + +// getsubopt(3) external variable +// +//go:linkname Suboptarg C.suboptarg +var Suboptarg *Char + +//go:linkname Strcoll C.strcoll +func Strcoll(__s1 *Char, __s2 *Char) Int + +//go:linkname Strcspn C.strcspn +func Strcspn(__s *Char, __charset *Char) SizeT + +//go:linkname Strpbrk C.strpbrk +func Strpbrk(__s *Char, __charset *Char) *Char + +//go:linkname Strspn C.strspn +func Strspn(__s *Char, __charset *Char) SizeT + +//go:linkname Strxfrm C.strxfrm +func Strxfrm(__s1 *Char, __s2 *Char, __n SizeT) SizeT + +//go:linkname StrtokR C.strtok_r +func StrtokR(__str *Char, __sep *Char, __lasts **Char) *Char + +//go:linkname StrerrorR C.strerror_r +func StrerrorR(__errnum Int, __strerrbuf *Char, __buflen SizeT) Int + +//go:linkname Memccpy C.memccpy +func Memccpy(__dst unsafe.Pointer, __src unsafe.Pointer, __c Int, __n SizeT) unsafe.Pointer + +//go:linkname Stpcpy C.stpcpy +func Stpcpy(__dst *Char, __src *Char) *Char + +//go:linkname Stpncpy C.stpncpy +func Stpncpy(__dst *Char, __src *Char, __n SizeT) *Char + +//go:linkname Strnlen C.strnlen +func Strnlen(__s1 *Char, __n SizeT) SizeT + +//go:linkname Strsignal C.strsignal +func Strsignal(__sig Int) *Char + +//go:linkname MemsetS C.memset_s +func MemsetS(__s unsafe.Pointer, __smax Ulong, __c Int, __n Ulong) Int + +//go:linkname Memmem C.memmem +func Memmem(__big unsafe.Pointer, __big_len SizeT, __little unsafe.Pointer, __little_len SizeT) unsafe.Pointer + +//go:linkname MemsetPattern4 C.memset_pattern4 +func MemsetPattern4(__b unsafe.Pointer, __pattern4 unsafe.Pointer, __len SizeT) + +//go:linkname MemsetPattern8 C.memset_pattern8 +func MemsetPattern8(__b unsafe.Pointer, __pattern8 unsafe.Pointer, __len SizeT) + +//go:linkname MemsetPattern16 C.memset_pattern16 +func MemsetPattern16(__b unsafe.Pointer, __pattern16 unsafe.Pointer, __len SizeT) + +//go:linkname Strcasestr C.strcasestr +func Strcasestr(__big *Char, __little *Char) *Char + +//go:linkname Strnstr C.strnstr +func Strnstr(__big *Char, __little *Char, __len SizeT) *Char + +//go:linkname Strlcat C.strlcat +func Strlcat(__dst *Char, __source *Char, __size SizeT) SizeT + +//go:linkname Strlcpy C.strlcpy +func Strlcpy(__dst *Char, __source *Char, __size SizeT) SizeT + +//go:linkname Strmode C.strmode +func Strmode(__mode Int, __bp *Char) + +//go:linkname Strsep C.strsep +func Strsep(__stringp **Char, __delim *Char) *Char + +// SUS places swab() in unistd.h. It is listed here for source compatibility +// +//go:linkname Swab C.swab +func Swab(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SsizeT) + +//go:linkname TimingsafeBcmp C.timingsafe_bcmp +func TimingsafeBcmp(__b1 unsafe.Pointer, __b2 unsafe.Pointer, __len SizeT) Int + +//go:linkname StrsignalR C.strsignal_r +func StrsignalR(__sig Int, __strsignalbuf *Char, __buflen SizeT) Int + +//go:linkname Bcmp C.bcmp +func Bcmp(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT) Int + +//go:linkname Bcopy C.bcopy +func Bcopy(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SizeT) + +//go:linkname Bzero C.bzero +func Bzero(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) + +//go:linkname Rindex C.rindex +func Rindex(_llcppg_param1 *Char, _llcppg_param2 Int) *Char + +//go:linkname Ffs C.ffs +func Ffs(_llcppg_param1 Int) Int + +//go:linkname Strcasecmp C.strcasecmp +func Strcasecmp(_llcppg_param1 *Char, _llcppg_param2 *Char) Int + +//go:linkname Strncasecmp C.strncasecmp +func Strncasecmp(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 SizeT) Int + +//go:linkname Ffsl C.ffsl +func Ffsl(_llcppg_param1 Long) Int + +//go:linkname Ffsll C.ffsll +func Ffsll(_llcppg_param1 LongLong) Int + +//go:linkname Fls C.fls +func Fls(_llcppg_param1 Int) Int + +//go:linkname Flsl C.flsl +func Flsl(_llcppg_param1 Long) Int + +//go:linkname Flsll C.flsll +func Flsll(_llcppg_param1 LongLong) Int + +const ( + RENAME_SECLUDE = 1 + RENAME_SWAP = 2 + RENAME_EXCL = 4 + RENAME_RESERVED1 = 8 + RENAME_NOFOLLOW_ANY = 16 +) + +//go:linkname Renameat C.renameat +func Renameat(_llcppg_param1 Int, _llcppg_param2 *Char, _llcppg_param3 Int, _llcppg_param4 *Char) Int + +//go:linkname RenamexNp C.renamex_np +func RenamexNp(_llcppg_param1 *Char, _llcppg_param2 *Char, _llcppg_param3 Uint) Int + +//go:linkname RenameatxNp C.renameatx_np +func RenameatxNp(_llcppg_param1 Int, _llcppg_param2 *Char, _llcppg_param3 Int, _llcppg_param4 *Char, _llcppg_param5 Uint) Int + +//go:linkname Ctermid C.ctermid +func Ctermid(_llcppg_param1 *Char) *Char + +type Lconv struct { + DecimalPoint *Char + ThousandsSep *Char + Grouping *Char + IntCurrSymbol *Char + CurrencySymbol *Char + MonDecimalPoint *Char + MonThousandsSep *Char + MonGrouping *Char + PositiveSign *Char + NegativeSign *Char + IntFracDigits Char + FracDigits Char + PCsPrecedes Char + PSepBySpace Char + NCsPrecedes Char + NSepBySpace Char + PSignPosn Char + NSignPosn Char + IntPCsPrecedes Char + IntNCsPrecedes Char + IntPSepBySpace Char + IntNSepBySpace Char + IntPSignPosn Char + IntNSignPosn Char +} + +//go:linkname Localeconv C.localeconv +func Localeconv() *Lconv + +type Iovec struct { + IovBase unsafe.Pointer + IovLen uint64 +} diff --git a/c/libc_linux_amd64.go b/c/libc_linux_amd64.go new file mode 100644 index 00000000..8df68082 --- /dev/null +++ b/c/libc_linux_amd64.go @@ -0,0 +1,1619 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package c + +import ( + "unsafe" +) + +// Data structure to describe CPU mask. +type CpuSetT struct { + X__Bits [16]Ulong +} + +// Structure describing messages sent by +// `sendmsg' and received by `recvmsg'. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen Uint + MsgIov *Iovec + MsgIovlen SizeT + MsgControl unsafe.Pointer + MsgControllen SizeT + MsgFlags Int +} + +// Structure used for storage of ancillary data object information. +type Cmsghdr struct { + CmsgLen SizeT + CmsgLevel Int + CmsgType Int +} + +// The following names are all functions: +// int isCHARACTERISTIC(int c); +// which return nonzero iff C has CHARACTERISTIC. +// For the meaning of the characteristic names, see the `enum' above. +// +//go:linkname Isalnum C.isalnum +func Isalnum(_llcppg_param1 Int) Int + +//go:linkname Isalpha C.isalpha +func Isalpha(_llcppg_param1 Int) Int + +//go:linkname Iscntrl C.iscntrl +func Iscntrl(_llcppg_param1 Int) Int + +//go:linkname Isdigit C.isdigit +func Isdigit(_llcppg_param1 Int) Int + +//go:linkname Islower C.islower +func Islower(_llcppg_param1 Int) Int + +//go:linkname Isgraph C.isgraph +func Isgraph(_llcppg_param1 Int) Int + +//go:linkname Isprint C.isprint +func Isprint(_llcppg_param1 Int) Int + +//go:linkname Ispunct C.ispunct +func Ispunct(_llcppg_param1 Int) Int + +//go:linkname Isspace C.isspace +func Isspace(_llcppg_param1 Int) Int + +//go:linkname Isupper C.isupper +func Isupper(_llcppg_param1 Int) Int + +//go:linkname Isxdigit C.isxdigit +func Isxdigit(_llcppg_param1 Int) Int + +// Return the lowercase version of C. +// +//go:linkname Tolower C.tolower +func Tolower(__c Int) Int + +// Return the uppercase version of C. +// +//go:linkname Toupper C.toupper +func Toupper(__c Int) Int + +//go:linkname Isblank C.isblank +func Isblank(_llcppg_param1 Int) Int + +// Return nonzero iff C is in the ASCII set +// (i.e., is no more than 7 bits wide). +// +//go:linkname Isascii C.isascii +func Isascii(__c Int) Int + +// Return the part of C that is in the ASCII set +// (i.e., the low-order 7 bits of C). +// +//go:linkname Toascii C.toascii +func Toascii(__c Int) Int + +// These are the same as `toupper' and `tolower' except that they do not +// check the argument for being in the range of a `char'. +// +//go:linkname X_toupper C._toupper +func X_toupper(_llcppg_param1 Int) Int + +//go:linkname X_tolower C._tolower +func X_tolower(_llcppg_param1 Int) Int + +// The following names are all functions: +// int isCHARACTERISTIC(int c, locale_t *locale); +// which return nonzero iff C has CHARACTERISTIC. +// For the meaning of the characteristic names, see the `enum' above. +// +//go:linkname IsalnumL C.isalnum_l +func IsalnumL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsalphaL C.isalpha_l +func IsalphaL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IscntrlL C.iscntrl_l +func IscntrlL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsdigitL C.isdigit_l +func IsdigitL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IslowerL C.islower_l +func IslowerL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsgraphL C.isgraph_l +func IsgraphL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsprintL C.isprint_l +func IsprintL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IspunctL C.ispunct_l +func IspunctL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsspaceL C.isspace_l +func IsspaceL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsupperL C.isupper_l +func IsupperL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsxdigitL C.isxdigit_l +func IsxdigitL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsblankL C.isblank_l +func IsblankL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname TolowerL C.tolower_l +func TolowerL(__c Int, __l X__LocaleT) Int + +//go:linkname ToupperL C.toupper_l +func ToupperL(__c Int, __l X__LocaleT) Int + +// Bits set in the FLAGS argument to `fnmatch'. +const ( + FNM_PATHNAME = 1 + // Backslashes don't quote special chars. + FNM_NOESCAPE = 2 + // Leading `.' is matched only explicitly. + FNM_PERIOD = 4 +) + +// Value returned by `fnmatch' if STRING does not match PATTERN. +const FNM_NOMATCH = 1 + +// Match NAME against the filename pattern PATTERN, +// returning zero if it matches, FNM_NOMATCH if not. +// +//go:linkname Fnmatch C.fnmatch +func Fnmatch(__pattern *Char, __name *Char, __flags Int) Int + +// Decimal notation. +const ( + PRId8 = "d" + PRId16 = "d" + PRId32 = "d" +) + +const ( + PRIdLEAST8 = "d" + PRIdLEAST16 = "d" + PRIdLEAST32 = "d" +) + +const PRIdFAST8 = "d" + +const ( + PRIi8 = "i" + PRIi16 = "i" + PRIi32 = "i" +) + +const ( + PRIiLEAST8 = "i" + PRIiLEAST16 = "i" + PRIiLEAST32 = "i" +) + +const PRIiFAST8 = "i" + +// Octal notation. +const ( + PRIo8 = "o" + PRIo16 = "o" + PRIo32 = "o" +) + +const ( + PRIoLEAST8 = "o" + PRIoLEAST16 = "o" + PRIoLEAST32 = "o" +) + +const PRIoFAST8 = "o" + +// Unsigned integers. +const ( + PRIu8 = "u" + PRIu16 = "u" + PRIu32 = "u" +) + +const ( + PRIuLEAST8 = "u" + PRIuLEAST16 = "u" + PRIuLEAST32 = "u" +) + +const PRIuFAST8 = "u" + +// lowercase hexadecimal notation. +const ( + PRIx8 = "x" + PRIx16 = "x" + PRIx32 = "x" +) + +const ( + PRIxLEAST8 = "x" + PRIxLEAST16 = "x" + PRIxLEAST32 = "x" +) + +const PRIxFAST8 = "x" + +// UPPERCASE hexadecimal notation. +const ( + PRIX8 = "X" + PRIX16 = "X" + PRIX32 = "X" +) + +const ( + PRIXLEAST8 = "X" + PRIXLEAST16 = "X" + PRIXLEAST32 = "X" +) + +const PRIXFAST8 = "X" + +// Signed decimal notation. +const ( + SCNd8 = "hhd" + SCNd16 = "hd" + SCNd32 = "d" +) + +const ( + SCNdLEAST8 = "hhd" + SCNdLEAST16 = "hd" + SCNdLEAST32 = "d" +) + +const SCNdFAST8 = "hhd" + +// Signed decimal notation. +const ( + SCNi8 = "hhi" + SCNi16 = "hi" + SCNi32 = "i" +) + +const ( + SCNiLEAST8 = "hhi" + SCNiLEAST16 = "hi" + SCNiLEAST32 = "i" +) + +const SCNiFAST8 = "hhi" + +// Unsigned decimal notation. +const ( + SCNu8 = "hhu" + SCNu16 = "hu" + SCNu32 = "u" +) + +const ( + SCNuLEAST8 = "hhu" + SCNuLEAST16 = "hu" + SCNuLEAST32 = "u" +) + +const SCNuFAST8 = "hhu" + +// Octal notation. +const ( + SCNo8 = "hho" + SCNo16 = "ho" + SCNo32 = "o" +) + +const ( + SCNoLEAST8 = "hho" + SCNoLEAST16 = "ho" + SCNoLEAST32 = "o" +) + +const SCNoFAST8 = "hho" + +// Hexadecimal notation. +const ( + SCNx8 = "hhx" + SCNx16 = "hx" + SCNx32 = "x" +) + +const ( + SCNxLEAST8 = "hhx" + SCNxLEAST16 = "hx" + SCNxLEAST32 = "x" +) + +const SCNxFAST8 = "hhx" + +// We have to define the `uintmax_t' type using `ldiv_t'. +type ImaxdivT struct { + Quot Long + Rem Long +} + +// Compute absolute value of N. +// +//go:linkname Imaxabs C.imaxabs +func Imaxabs(__n Long) Long + +// Return the `imaxdiv_t' representation of the value of NUMER over DENOM. +// +//go:linkname Imaxdiv C.imaxdiv +func Imaxdiv(__numer Long, __denom Long) ImaxdivT + +// Like `strtol' but convert to `intmax_t'. +// +//go:linkname Strtoimax C.strtoimax +func Strtoimax(__nptr *Char, __endptr **Char, __base Int) Long + +// Like `strtoul' but convert to `uintmax_t'. +// +//go:linkname Strtoumax C.strtoumax +func Strtoumax(__nptr *Char, __endptr **Char, __base Int) Ulong + +// Like `wcstol' but convert to `intmax_t'. +// +//go:linkname Wcstoimax C.wcstoimax +func Wcstoimax(__nptr *Int, __endptr **Int, __base Int) Long + +// Like `wcstoul' but convert to `uintmax_t'. +// +//go:linkname Wcstoumax C.wcstoumax +func Wcstoumax(__nptr *Int, __endptr **Int, __base Int) Ulong + +// Return directory part of PATH or "." if none is available. +// +//go:linkname Dirname C.dirname +func Dirname(__path *Char) *Char + +// Return final component of PATH. +// +// This is the weird XPG version of this function. It sometimes will +// modify its argument. Therefore we normally use the GNU version (in +// ) and only if this header is included make the XPG +// version available under the real name. +// +//go:linkname X__XpgBasename C.__xpg_basename +func X__XpgBasename(__path *Char) *Char + +type X_IO_marker struct { + X_next *X_IO_marker + X_sbuf *X_IO_FILE + X_pos Int +} + +type X_IO_FILE struct { + X_flags Int + X_IO_read_ptr *Char + X_IO_read_end *Char + X_IO_read_base *Char + X_IO_write_base *Char + X_IO_write_ptr *Char + X_IO_write_end *Char + X_IO_buf_base *Char + X_IO_buf_end *Char + X_IO_save_base *Char + X_IO_backup_base *Char + X_IO_save_end *Char + X_markers *X_IO_marker + X_chain *X_IO_FILE + X_fileno Int + X_flags2 Int + X_oldOffset Long + X_curColumn uint16 + X_vtableOffset int8 + X_shortbuf [1]Char + X_lock *Void + X_offset Long + X__Pad1 unsafe.Pointer + X__Pad2 unsafe.Pointer + X__Pad3 unsafe.Pointer + X__Pad4 unsafe.Pointer + X__Pad5 SizeT + X_mode Int + X_unused2 [20]Char +} + +// Maximum length of any multibyte character in any locale. +// We define this value here since the gcc header does not define +// the correct value. +const MB_LEN_MAX = 16 + +// These are the possibilities for the first argument to setlocale. +// The code assumes that the lowest LC_* symbol has the value zero. +const ( + LC_CTYPE = 0 + LC_NUMERIC = 1 + LC_TIME = 2 + LC_COLLATE = 3 + LC_MONETARY = 4 + LC_MESSAGES = 5 + LC_ALL = 6 + LC_PAPER = 7 + LC_NAME = 8 + LC_ADDRESS = 9 + LC_TELEPHONE = 10 + LC_MEASUREMENT = 11 + LC_IDENTIFICATION = 12 +) + +// These are the bits that can be set in the CATEGORY_MASK argument to +// `newlocale'. In the GNU implementation, LC_FOO_MASK has the value +// of (1 << LC_FOO), but this is not a part of the interface that +// callers can assume will be true. +const ( + LC_CTYPE_MASK = 1 + LC_NUMERIC_MASK = 2 + LC_TIME_MASK = 4 + LC_COLLATE_MASK = 8 + LC_MONETARY_MASK = 16 + LC_MESSAGES_MASK = 32 + LC_PAPER_MASK = 128 + LC_NAME_MASK = 256 + LC_ADDRESS_MASK = 512 + LC_TELEPHONE_MASK = 1024 + LC_MEASUREMENT_MASK = 2048 + LC_IDENTIFICATION_MASK = 4096 + LC_ALL_MASK = 8127 +) + +// Structure giving information about numeric and monetary notation. +type Lconv struct { + DecimalPoint *Char + ThousandsSep *Char + Grouping *Char + IntCurrSymbol *Char + CurrencySymbol *Char + MonDecimalPoint *Char + MonThousandsSep *Char + MonGrouping *Char + PositiveSign *Char + NegativeSign *Char + IntFracDigits Char + FracDigits Char + PCsPrecedes Char + PSepBySpace Char + NCsPrecedes Char + NSepBySpace Char + PSignPosn Char + NSignPosn Char + IntPCsPrecedes Char + IntPSepBySpace Char + IntNCsPrecedes Char + IntNSepBySpace Char + IntPSignPosn Char + IntNSignPosn Char +} + +// Set and/or return the current locale. +// +//go:linkname Setlocale C.setlocale +func Setlocale(__category Int, __locale *Char) *Char + +// Return the numeric/monetary information for the current locale. +// +//go:linkname Localeconv C.localeconv +func Localeconv() *Lconv + +// Return a reference to a data structure representing a set of locale +// datasets. Unlike for the CATEGORY parameter for `setlocale' the +// CATEGORY_MASK parameter here uses a single bit for each category, +// made by OR'ing together LC_*_MASK bits above. +// +//go:linkname Newlocale C.newlocale +func Newlocale(__category_mask Int, __locale *Char, __base X__LocaleT) X__LocaleT + +// Return a duplicate of the set of locale in DATASET. All usage +// counters are increased if necessary. +// +// llgo:link X__LocaleT.Duplocale C.duplocale +func (self X__LocaleT) Duplocale() X__LocaleT { + return self +} + +// Free the data associated with a locale dataset previously returned +// by a call to `setlocale_r'. +// +// llgo:link X__LocaleT.Freelocale C.freelocale +func (self X__LocaleT) Freelocale() { +} + +// Switch the current thread's locale to DATASET. +// If DATASET is null, instead just return the current setting. +// The special value LC_GLOBAL_LOCALE is the initial setting +// for all threads and can also be installed any time, meaning +// the thread uses the global settings controlled by `setlocale'. +// +// llgo:link X__LocaleT.Uselocale C.uselocale +func (self X__LocaleT) Uselocale() X__LocaleT { + return self +} + +type Rpcent struct { + RName *Char + RAliases **Char + RNumber Int +} + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(__stayopen Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(__name *Char) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(__number Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname GetrpcbynameR C.getrpcbyname_r +func GetrpcbynameR(__name *Char, __result_buf *Rpcent, __buffer *Char, __buflen SizeT, __result **Rpcent) Int + +//go:linkname GetrpcbynumberR C.getrpcbynumber_r +func GetrpcbynumberR(__number Int, __result_buf *Rpcent, __buffer *Char, __buflen SizeT, __result **Rpcent) Int + +// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r +func (self *Rpcent) GetrpcentR(__buffer *Char, __buflen SizeT, __result **Rpcent) Int { + return 0 +} + +// Minimum of signed integral types. +const ( + INT8_MIN = -128 + INT16_MIN = -32768 + INT32_MIN = -2147483648 +) + +// Maximum of signed integral types. +const ( + INT8_MAX = 127 + INT16_MAX = 32767 + INT32_MAX = 2147483647 +) + +// Maximum of unsigned integral types. +const ( + UINT8_MAX = 255 + UINT16_MAX = 65535 +) + +// Minimum of signed integral types having a minimum size. +const ( + INT_LEAST8_MIN = -128 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MIN = -2147483648 +) + +// Maximum of signed integral types having a minimum size. +const ( + INT_LEAST8_MAX = 127 + INT_LEAST16_MAX = 32767 + INT_LEAST32_MAX = 2147483647 +) + +// Maximum of unsigned integral types having a minimum size. +const ( + UINT_LEAST8_MAX = 255 + UINT_LEAST16_MAX = 65535 +) + +// Minimum of fast signed integral types having a minimum size. +const INT_FAST8_MIN = -128 + +// Maximum of fast signed integral types having a minimum size. +const INT_FAST8_MAX = 127 + +// Maximum of fast unsigned integral types having a minimum size. +const UINT_FAST8_MAX = 255 + +// Limits of `sig_atomic_t'. +const ( + SIG_ATOMIC_MIN = -2147483648 + SIG_ATOMIC_MAX = 2147483647 +) + +const BUFSIZ = 8192 + +// Default path prefix for `tempnam' and `tmpnam'. +const PTmpdir = "/tmp" + +type FposT = X_GFposT + +// Rename file OLD relative to OLDFD to NEW relative to NEWFD. +// +//go:linkname Renameat C.renameat +func Renameat(__oldfd Int, __old *Char, __newfd Int, __new *Char) Int + +// Ignore +// +//go:linkname Tmpfile C.tmpfile +func Tmpfile() *FILE + +// Generate a temporary filename. +// +//go:linkname Tmpnam C.tmpnam +func Tmpnam(__s *Char) *Char + +// This is the reentrant variant of `tmpnam'. The only difference is +// that it does not allow S to be NULL. +// +//go:linkname TmpnamR C.tmpnam_r +func TmpnamR(__s *Char) *Char + +// Generate a unique temporary filename using up to five characters of PFX +// if it is not NULL. The directory to put this file in is searched for +// as follows: First the environment variable "TMPDIR" is checked. +// If it contains the name of a writable directory, that directory is used. +// If not and if DIR is not NULL, that value is checked. If that fails, +// P_tmpdir is tried and finally "/tmp". The storage for the filename +// is allocated by `malloc'. +// +//go:linkname Tempnam C.tempnam +func Tempnam(__dir *Char, __pfx *Char) *Char + +// Faster versions when locking is not required. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FflushUnlocked C.fflush_unlocked +func FflushUnlocked(__stream *FILE) Int + +// Open a file, replacing an existing stream with it. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Freopen C.freopen +func Freopen(__filename *Char, __modes *Char, __stream *FILE) *FILE + +// Create a new stream that refers to an existing system file descriptor. +// +//go:linkname Fdopen C.fdopen +func Fdopen(__fd Int, __modes *Char) *FILE + +// Create a new stream that refers to a memory buffer. +// +//go:linkname Fmemopen C.fmemopen +func Fmemopen(__s unsafe.Pointer, __len SizeT, __modes *Char) *FILE + +// Open a stream that writes into a malloc'd buffer that is expanded as +// necessary. *BUFLOC and *SIZELOC are updated with the buffer's location +// and the number of characters written on fflush or fclose. +// +//go:linkname OpenMemstream C.open_memstream +func OpenMemstream(__bufloc **Char, __sizeloc *SizeT) *FILE + +// If BUF is NULL, make STREAM unbuffered. +// Else make it use buffer BUF, of size BUFSIZ. +// +//go:linkname Setbuf C.setbuf +func Setbuf(__stream *FILE, __buf *Char) + +// Make STREAM use buffering mode MODE. +// If BUF is not NULL, use N bytes of it for buffering; +// else allocate an internal buffer N bytes long. +// +//go:linkname Setvbuf C.setvbuf +func Setvbuf(__stream *FILE, __buf *Char, __modes Int, __n SizeT) Int + +// If BUF is NULL, make STREAM unbuffered. +// Else make it use SIZE bytes of BUF for buffering. +// +//go:linkname Setbuffer C.setbuffer +func Setbuffer(__stream *FILE, __buf *Char, __size SizeT) + +// Make STREAM line-buffered. +// +//go:linkname Setlinebuf C.setlinebuf +func Setlinebuf(__stream *FILE) + +//go:linkname Dprintf C.dprintf +func Dprintf(__fd Int, __fmt *Char, __llgo_va_list ...any) Int + +// Read formatted input from STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fscanf C.fscanf +func Fscanf(__stream *FILE, __format *Char, __llgo_va_list ...any) Int + +// Read formatted input from stdin. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Scanf C.scanf +func Scanf(__format *Char, __llgo_va_list ...any) Int + +// Read formatted input from S. +// +//go:linkname Sscanf C.sscanf +func Sscanf(__s *Char, __format *Char, __llgo_va_list ...any) Int + +// Read a character from STREAM. +// +// These functions are possible cancellation points and therefore not +// marked with __THROW. +// +//go:linkname Fgetc C.fgetc +func Fgetc(__stream *FILE) Int + +//go:linkname Getc C.getc +func Getc(__stream *FILE) Int + +// Read a character from stdin. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getchar C.getchar +func Getchar() Int + +// These are defined in POSIX.1:1996. +// +// These functions are possible cancellation points and therefore not +// marked with __THROW. +// +//go:linkname GetcUnlocked C.getc_unlocked +func GetcUnlocked(__stream *FILE) Int + +//go:linkname GetcharUnlocked C.getchar_unlocked +func GetcharUnlocked() Int + +// Faster version when locking is not necessary. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetcUnlocked C.fgetc_unlocked +func FgetcUnlocked(__stream *FILE) Int + +//go:linkname Putc C.putc +func Putc(__c Int, __stream *FILE) Int + +// Write a character to stdout. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Putchar C.putchar +func Putchar(__c Int) Int + +// Faster version when locking is not necessary. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FputcUnlocked C.fputc_unlocked +func FputcUnlocked(__c Int, __stream *FILE) Int + +// These are defined in POSIX.1:1996. +// +// These functions are possible cancellation points and therefore not +// marked with __THROW. +// +//go:linkname PutcUnlocked C.putc_unlocked +func PutcUnlocked(__c Int, __stream *FILE) Int + +//go:linkname PutcharUnlocked C.putchar_unlocked +func PutcharUnlocked(__c Int) Int + +// Get a word (int) from STREAM. +// +//go:linkname Getw C.getw +func Getw(__stream *FILE) Int + +// Write a word (int) to STREAM. +// +//go:linkname Putw C.putw +func Putw(__w Int, __stream *FILE) Int + +// Get a newline-terminated string of finite length from STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fgets C.fgets +func Fgets(__s *Char, __n Int, __stream *FILE) *Char + +// Ignore +// +//go:linkname Getdelim C.getdelim +func Getdelim(__lineptr **Char, __n *SizeT, __delimiter Int, __stream *FILE) Long + +// Like `getdelim', but reads up to a newline. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getline C.getline +func Getline(__lineptr **Char, __n *SizeT, __stream *FILE) Long + +// Write a string, followed by a newline, to stdout. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Puts C.puts +func Puts(__s *Char) Int + +// Push a character back onto the input buffer of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Ungetc C.ungetc +func Ungetc(__c Int, __stream *FILE) Int + +// Faster versions when locking is not necessary. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +//go:linkname FreadUnlocked C.fread_unlocked +func FreadUnlocked(__ptr unsafe.Pointer, __size SizeT, __n SizeT, __stream *FILE) SizeT + +//go:linkname FwriteUnlocked C.fwrite_unlocked +func FwriteUnlocked(__ptr unsafe.Pointer, __size SizeT, __n SizeT, __stream *FILE) SizeT + +// Seek to a certain position on STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fseek C.fseek +func Fseek(__stream *FILE, __off Long, __whence Int) Int + +// Return the current position of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Ftell C.ftell +func Ftell(__stream *FILE) Long + +// Rewind to the beginning of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Rewind C.rewind +func Rewind(__stream *FILE) + +// Seek to a certain position on STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fseeko C.fseeko +func Fseeko(__stream *FILE, __off Long, __whence Int) Int + +// Return the current position of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Ftello C.ftello +func Ftello(__stream *FILE) Long + +// Get STREAM's position. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fgetpos C.fgetpos +func Fgetpos(__stream *FILE, __pos *FposT) Int + +// Set STREAM's position. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fsetpos C.fsetpos +func Fsetpos(__stream *FILE, __pos *FposT) Int + +// Clear the error and EOF indicators for STREAM. +// +//go:linkname Clearerr C.clearerr +func Clearerr(__stream *FILE) + +// Return the EOF indicator for STREAM. +// +//go:linkname Feof C.feof +func Feof(__stream *FILE) Int + +// Return the error indicator for STREAM. +// +//go:linkname Ferror C.ferror +func Ferror(__stream *FILE) Int + +// Faster versions when locking is not required. +// +//go:linkname ClearerrUnlocked C.clearerr_unlocked +func ClearerrUnlocked(__stream *FILE) + +// Ignore +// +//go:linkname FeofUnlocked C.feof_unlocked +func FeofUnlocked(__stream *FILE) Int + +// Ignore +// +//go:linkname FerrorUnlocked C.ferror_unlocked +func FerrorUnlocked(__stream *FILE) Int + +// Return the system file descriptor for STREAM. +// +//go:linkname Fileno C.fileno +func Fileno(__stream *FILE) Int + +// Faster version when locking is not required. +// +//go:linkname FilenoUnlocked C.fileno_unlocked +func FilenoUnlocked(__stream *FILE) Int + +// Create a new stream connected to a pipe running the given command. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Popen C.popen +func Popen(__command *Char, __modes *Char) *FILE + +// Close a stream opened by popen and return the status of its child. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Pclose C.pclose +func Pclose(__stream *FILE) Int + +// Return the name of the controlling terminal. +// +//go:linkname Ctermid C.ctermid +func Ctermid(__s *Char) *Char + +// Acquire ownership of STREAM. +// +//go:linkname Flockfile C.flockfile +func Flockfile(__stream *FILE) + +// Try to acquire ownership of STREAM but do not block if it is not +// possible. +// +//go:linkname Ftrylockfile C.ftrylockfile +func Ftrylockfile(__stream *FILE) Int + +// Relinquish the ownership granted for STREAM. +// +//go:linkname Funlockfile C.funlockfile +func Funlockfile(__stream *FILE) + +// The largest number rand will return (same as INT_MAX). +const RAND_MAX = 2147483647 + +// We define these the same for all machines. +// Changes from this to the outside world should be done in `_exit'. +const ( + EXIT_FAILURE = 1 + // Successful exit status. + EXIT_SUCCESS = 0 +) + +type RandomData struct { + Fptr *Int + Rptr *Int + State *Int + RandType Int + RandDeg Int + RandSep Int + EndPtr *Int +} + +// Data structure for communication with thread safe versions. This +// type is to be regarded as opaque. It's only exported because users +// have to allocate objects of this type. +type Drand48Data struct { + X__X [3]uint16 + X__OldX [3]uint16 + X__C uint16 + X__Init uint16 + X__A UlongLong +} + +// Register a function to be called when `exit' is called. +// +// llgo:type C +type llcppgCallback2 = func() + +// llgo:type C +type llcppgCallback1 = func() + +// Register a function to be called with the status +// given to `exit' and the given argument. +// +// llgo:type C +type llcppgCallback0 = func(_llcppg_param1 Int, _llcppg_param2 unsafe.Pointer) + +// llgo:type C +type X__ComparFnT = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// Convert a string to a floating-point number. +// +//go:linkname Atof C.atof +func Atof(__nptr *Char) Double + +// Convert a string to a long integer. +// +//go:linkname Atol C.atol +func Atol(__nptr *Char) Long + +// Convert a string to a long long integer. +// +//go:linkname Atoll C.atoll +func Atoll(__nptr *Char) LongLong + +// Convert a string to a floating-point number. +// +//go:linkname Strtod C.strtod +func Strtod(__nptr *Char, __endptr **Char) Double + +// Likewise for `float' and `long double' sizes of floating-point numbers. +// +//go:linkname Strtof C.strtof +func Strtof(__nptr *Char, __endptr **Char) Float + +// Convert a string to a long integer. +// +//go:linkname Strtol C.strtol +func Strtol(__nptr *Char, __endptr **Char, __base Int) Long + +// Convert a string to an unsigned long integer. +// +//go:linkname Strtoul C.strtoul +func Strtoul(__nptr *Char, __endptr **Char, __base Int) Ulong + +// Convert a string to an unsigned quadword integer. +// +//go:linkname Strtoq C.strtoq +func Strtoq(__nptr *Char, __endptr **Char, __base Int) LongLong + +//go:linkname Strtouq C.strtouq +func Strtouq(__nptr *Char, __endptr **Char, __base Int) UlongLong + +// Convert a string to an unsigned quadword integer. +// +//go:linkname Strtoll C.strtoll +func Strtoll(__nptr *Char, __endptr **Char, __base Int) LongLong + +//go:linkname Strtoull C.strtoull +func Strtoull(__nptr *Char, __endptr **Char, __base Int) UlongLong + +// Convert N to base 64 using the digits "./0-9A-Za-z", least-significant +// digit first. Returns a pointer to static storage overwritten by the +// next call. +// +//go:linkname L64a C.l64a +func L64a(__n Long) *Char + +// Read a number from a string S in base 64 as above. +// +//go:linkname A64l C.a64l +func A64l(__s *Char) Long + +// Return a random long integer between 0 and RAND_MAX inclusive. +// +//go:linkname Random C.random +func Random() Long + +// Seed the random number generator with the given number. +// +//go:linkname Srandom C.srandom +func Srandom(__seed Uint) + +// Initialize the random number generator to use state buffer STATEBUF, +// of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16, +// 32, 64, 128 and 256, the bigger the better; values less than 8 will +// cause an error and values greater than 256 will be rounded down. +// +//go:linkname Initstate C.initstate +func Initstate(__seed Uint, __statebuf *Char, __statelen SizeT) *Char + +// Switch the random number generator to state buffer STATEBUF, +// which should have been previously initialized by `initstate'. +// +//go:linkname Setstate C.setstate +func Setstate(__statebuf *Char) *Char + +// llgo:link (*RandomData).RandomR C.random_r +func (self *RandomData) RandomR(__result *Int) Int { + return 0 +} + +//go:linkname SrandomR C.srandom_r +func SrandomR(__seed Uint, __buf *RandomData) Int + +//go:linkname InitstateR C.initstate_r +func InitstateR(__seed Uint, __statebuf *Char, __statelen SizeT, __buf *RandomData) Int + +//go:linkname SetstateR C.setstate_r +func SetstateR(__statebuf *Char, __buf *RandomData) Int + +// Seed the random number generator with the given number. +// +//go:linkname Srand C.srand +func Srand(__seed Uint) + +// Reentrant interface according to POSIX.1. +// +//go:linkname RandR C.rand_r +func RandR(__seed *Uint) Int + +// Return non-negative, double-precision floating-point value in [0.0,1.0). +// +//go:linkname Drand48 C.drand48 +func Drand48() Double + +//go:linkname Erand48 C.erand48 +func Erand48(__xsubi *uint16) Double + +// Return non-negative, long integer in [0,2^31). +// +//go:linkname Lrand48 C.lrand48 +func Lrand48() Long + +//go:linkname Nrand48 C.nrand48 +func Nrand48(__xsubi *uint16) Long + +// Return signed, long integers in [-2^31,2^31). +// +//go:linkname Mrand48 C.mrand48 +func Mrand48() Long + +//go:linkname Jrand48 C.jrand48 +func Jrand48(__xsubi *uint16) Long + +// Seed random number generator. +// +//go:linkname Srand48 C.srand48 +func Srand48(__seedval Long) + +//go:linkname Seed48 C.seed48 +func Seed48(__seed16v *uint16) *uint16 + +//go:linkname Lcong48 C.lcong48 +func Lcong48(__param *uint16) + +// Return non-negative, double-precision floating-point value in [0.0,1.0). +// +// llgo:link (*Drand48Data).Drand48R C.drand48_r +func (self *Drand48Data) Drand48R(__result *Double) Int { + return 0 +} + +//go:linkname Erand48R C.erand48_r +func Erand48R(__xsubi *uint16, __buffer *Drand48Data, __result *Double) Int + +// Return non-negative, long integer in [0,2^31). +// +// llgo:link (*Drand48Data).Lrand48R C.lrand48_r +func (self *Drand48Data) Lrand48R(__result *Long) Int { + return 0 +} + +//go:linkname Nrand48R C.nrand48_r +func Nrand48R(__xsubi *uint16, __buffer *Drand48Data, __result *Long) Int + +// Return signed, long integers in [-2^31,2^31). +// +// llgo:link (*Drand48Data).Mrand48R C.mrand48_r +func (self *Drand48Data) Mrand48R(__result *Long) Int { + return 0 +} + +//go:linkname Jrand48R C.jrand48_r +func Jrand48R(__xsubi *uint16, __buffer *Drand48Data, __result *Long) Int + +// Seed random number generator. +// +//go:linkname Srand48R C.srand48_r +func Srand48R(__seedval Long, __buffer *Drand48Data) Int + +//go:linkname Seed48R C.seed48_r +func Seed48R(__seed16v *uint16, __buffer *Drand48Data) Int + +//go:linkname Lcong48R C.lcong48_r +func Lcong48R(__param *uint16, __buffer *Drand48Data) Int + +// Free a block. An alias for `free'. (Sun Unices). +// +//go:linkname Cfree C.free +func Cfree(__ptr unsafe.Pointer) + +// Allocate SIZE bytes on a page boundary. The storage cannot be freed. +// +//go:linkname Valloc C.valloc +func Valloc(__size SizeT) unsafe.Pointer + +// Allocate memory of SIZE bytes with an alignment of ALIGNMENT. +// +//go:linkname PosixMemalign C.posix_memalign +func PosixMemalign(__memptr *unsafe.Pointer, __alignment SizeT, __size SizeT) Int + +// ISO C variant of aligned allocation. +// +//go:linkname AlignedAlloc C.aligned_alloc +func AlignedAlloc(__alignment SizeT, __size SizeT) unsafe.Pointer + +// Abort execution and generate a core-dump. +// +//go:linkname Abort C.abort +func Abort() + +//go:linkname Atexit C.atexit +func Atexit(__func llcppgCallback2) Int + +//go:linkname AtQuickExit C.at_quick_exit +func AtQuickExit(__func llcppgCallback1) Int + +//go:linkname OnExit C.on_exit +func OnExit(__func llcppgCallback0, __arg unsafe.Pointer) Int + +// Call all functions registered with `at_quick_exit' in the reverse +// of the order in which they were registered and terminate program +// execution with STATUS. +// +//go:linkname QuickExit C.quick_exit +func QuickExit(__status Int) + +// Terminate the program with STATUS without calling any of the +// functions registered with `atexit' or `on_exit'. +// +//go:linkname X_Exit C._Exit +func X_Exit(__status Int) + +// Generate a unique temporary file name from TEMPLATE. +// The last six characters of TEMPLATE must be "XXXXXX"; +// they are replaced with a string that makes the file name unique. +// Always returns TEMPLATE, it's either a temporary file name or a null +// string if it cannot get a unique file name. +// +//go:linkname Mktemp C.mktemp +func Mktemp(__template *Char) *Char + +// Ignore +// +//go:linkname Mkstemp C.mkstemp +func Mkstemp(__template *Char) Int + +// Ignore +// +//go:linkname Mkstemps C.mkstemps +func Mkstemps(__template *Char, __suffixlen Int) Int + +// Create a unique temporary directory from TEMPLATE. +// The last six characters of TEMPLATE must be "XXXXXX"; +// they are replaced with a string that makes the directory name unique. +// Returns TEMPLATE, or a null pointer if it cannot get a unique name. +// The directory is created mode 700. +// +//go:linkname Mkdtemp C.mkdtemp +func Mkdtemp(__template *Char) *Char + +// Execute the given line as a shell command. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname System C.system +func System(__command *Char) Int + +// Return the canonical absolute name of file NAME. If RESOLVED is +// null, the result is malloc'd; otherwise, if the canonical name is +// PATH_MAX chars or more, returns null with `errno' set to +// ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, +// returns the name in RESOLVED. +// +//go:linkname Realpath C.realpath +func Realpath(__name *Char, __resolved *Char) *Char + +// Do a binary search for KEY in BASE, which consists of NMEMB elements +// of SIZE bytes each, using COMPAR to perform the comparisons. +// +//go:linkname Bsearch C.bsearch +func Bsearch(__key unsafe.Pointer, __base unsafe.Pointer, __nmemb SizeT, __size SizeT, __compar X__ComparFnT) unsafe.Pointer + +// Return the absolute value of X. +// +//go:linkname Abs C.abs +func Abs(__x Int) Int + +// Ignore +// +//go:linkname Labs C.labs +func Labs(__x Long) Long + +// Ignore +// +//go:linkname Llabs C.llabs +func Llabs(__x LongLong) LongLong + +// GCC may have built-ins for these someday. +// +//go:linkname Div C.div +func Div(__numer Int, __denom Int) DivT + +// Ignore +// +//go:linkname Ldiv C.ldiv +func Ldiv(__numer Long, __denom Long) LdivT + +// Ignore +// +//go:linkname Lldiv C.lldiv +func Lldiv(__numer LongLong, __denom LongLong) LldivT + +// Convert VALUE to a string with NDIGIT digits and return a pointer to +// this. Set *DECPT with the position of the decimal character and *SIGN +// with the sign of the number. +// +//go:linkname Ecvt C.ecvt +func Ecvt(__value Double, __ndigit Int, __decpt *Int, __sign *Int) *Char + +// Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT +// with the position of the decimal character and *SIGN with the sign of +// the number. +// +//go:linkname Fcvt C.fcvt +func Fcvt(__value Double, __ndigit Int, __decpt *Int, __sign *Int) *Char + +// If possible convert VALUE to a string with NDIGIT significant digits. +// Otherwise use exponential representation. The resulting string will +// be written to BUF. +// +//go:linkname Gcvt C.gcvt +func Gcvt(__value Double, __ndigit Int, __buf *Char) *Char + +// Reentrant version of the functions above which provide their own +// buffers. +// +//go:linkname EcvtR C.ecvt_r +func EcvtR(__value Double, __ndigit Int, __decpt *Int, __sign *Int, __buf *Char, __len SizeT) Int + +//go:linkname FcvtR C.fcvt_r +func FcvtR(__value Double, __ndigit Int, __decpt *Int, __sign *Int, __buf *Char, __len SizeT) Int + +// Return the length of the multibyte character +// in S, which is no longer than N. +// +//go:linkname Mblen C.mblen +func Mblen(__s *Char, __n SizeT) Int + +// Return the length of the given multibyte character, +// putting its `wchar_t' representation in *PWC. +// +//go:linkname Mbtowc C.mbtowc +func Mbtowc(__pwc *WcharT, __s *Char, __n SizeT) Int + +// Put the multibyte character represented +// by WCHAR in S, returning its length. +// +//go:linkname Wctomb C.wctomb +func Wctomb(__s *Char, __wchar WcharT) Int + +// Convert a multibyte string to a wide char string. +// +//go:linkname Mbstowcs C.mbstowcs +func Mbstowcs(__pwcs *WcharT, __s *Char, __n SizeT) SizeT + +// Convert a wide char string to multibyte string. +// +//go:linkname Wcstombs C.wcstombs +func Wcstombs(__s *Char, __pwcs *WcharT, __n SizeT) SizeT + +// Determine whether the string value of RESPONSE matches the affirmation +// or negative response expression as specified by the LC_MESSAGES category +// in the program's current locale. Returns 1 if affirmative, 0 if +// negative, and -1 if not matching. +// +//go:linkname Rpmatch C.rpmatch +func Rpmatch(__response *Char) Int + +// Parse comma separated suboption from *OPTIONP and match against +// strings in TOKENS. If found return index and set *VALUEP to +// optional value introduced by an equal sign. If the suboption is +// not part of TOKENS return in *VALUEP beginning of unknown +// suboption. On exit *OPTIONP is set to the beginning of the next +// token or at the terminating NUL character. +// +//go:linkname Getsubopt C.getsubopt +func Getsubopt(__optionp **Char, __tokens **Char, __valuep **Char) Int + +// Put the 1 minute, 5 minute and 15 minute load averages into the first +// NELEM elements of LOADAVG. Return the number written (never more than +// three, but may be less than NELEM), or -1 if an error occurred. +// +//go:linkname Getloadavg C.getloadavg +func Getloadavg(__loadavg *Double, __nelem Int) Int + +//go:linkname Memccpy C.memccpy +func Memccpy(__dest unsafe.Pointer, __src unsafe.Pointer, __c Int, __n SizeT) unsafe.Pointer + +// Compare the collated forms of S1 and S2. +// +//go:linkname Strcoll C.strcoll +func Strcoll(__s1 *Char, __s2 *Char) Int + +// Put a transformation of SRC into no more than N bytes of DEST. +// +//go:linkname Strxfrm C.strxfrm +func Strxfrm(__dest *Char, __src *Char, __n SizeT) SizeT + +// Compare the collated forms of S1 and S2 using rules from L. +// +//go:linkname StrcollL C.strcoll_l +func StrcollL(__s1 *Char, __s2 *Char, __l X__LocaleT) Int + +// Put a transformation of SRC into no more than N bytes of DEST. +// +//go:linkname StrxfrmL C.strxfrm_l +func StrxfrmL(__dest *Char, __src *Char, __n SizeT, __l X__LocaleT) SizeT + +// Return the length of the initial segment of S which +// consists entirely of characters not in REJECT. +// +//go:linkname Strcspn C.strcspn +func Strcspn(__s *Char, __reject *Char) SizeT + +// Return the length of the initial segment of S which +// consists entirely of characters in ACCEPT. +// +//go:linkname Strspn C.strspn +func Strspn(__s *Char, __accept *Char) SizeT + +//go:linkname Strpbrk C.strpbrk +func Strpbrk(__s *Char, __accept *Char) *Char + +//go:linkname StrtokR C.strtok_r +func StrtokR(__s *Char, __delim *Char, __save_ptr **Char) *Char + +// Find the length of STRING, but scan at most MAXLEN characters. +// If no '\0' terminator is found in that many characters, return MAXLEN. +// +//go:linkname Strnlen C.strnlen +func Strnlen(__string *Char, __maxlen SizeT) SizeT + +//go:linkname StrerrorR C.__xpg_strerror_r +func StrerrorR(__errnum Int, __buf *Char, __buflen SizeT) Int + +// Translate error number to string according to the locale L. +// +//go:linkname StrerrorL C.strerror_l +func StrerrorL(__errnum Int, __l X__LocaleT) *Char + +// Copy N bytes of SRC to DEST (like memmove, but args reversed). +// +//go:linkname Bcopy C.bcopy +func Bcopy(__src unsafe.Pointer, __dest unsafe.Pointer, __n SizeT) + +// Set N bytes of S to 0. +// +//go:linkname Bzero C.bzero +func Bzero(__s unsafe.Pointer, __n SizeT) + +// Compare N bytes of S1 and S2 (same as memcmp). +// +//go:linkname Bcmp C.bcmp +func Bcmp(__s1 unsafe.Pointer, __s2 unsafe.Pointer, __n SizeT) Int + +//go:linkname Rindex C.rindex +func Rindex(__s *Char, __c Int) *Char + +// Return the position of the first bit set in I, or 0 if none are set. +// The least-significant bit is position 1, the most-significant 32. +// +//go:linkname Ffs C.ffs +func Ffs(__i Int) Int + +// Compare S1 and S2, ignoring case. +// +//go:linkname Strcasecmp C.strcasecmp +func Strcasecmp(__s1 *Char, __s2 *Char) Int + +// Compare no more than N chars of S1 and S2, ignoring case. +// +//go:linkname Strncasecmp C.strncasecmp +func Strncasecmp(__s1 *Char, __s2 *Char, __n SizeT) Int + +// Return the next DELIM-delimited token from *STRINGP, +// terminating it with a '\0', and update *STRINGP to point past it. +// +//go:linkname Strsep C.strsep +func Strsep(__stringp **Char, __delim *Char) *Char + +// Return a string describing the meaning of the signal number in SIG. +// +//go:linkname Strsignal C.strsignal +func Strsignal(__sig Int) *Char + +//go:linkname Stpcpy C.stpcpy +func Stpcpy(__dest *Char, __src *Char) *Char + +//go:linkname Stpncpy C.stpncpy +func Stpncpy(__dest *Char, __src *Char, __n SizeT) *Char + +// Conversion state information. +type X__MbstateT struct { + X__Count Int + X__Value _llcppg_anon_9 +} + +type _llcppg_anon_9 struct { + _xgo_union [1]uint32 +} + +func (p *_llcppg_anon_9) XGof_ref___wch() *Uint { + return (*Uint)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_9) XGof_ref___wchb() *[4]Char { + return (*[4]Char)(unsafe.Pointer(p)) +} + +// Structure for reentrant locale using functions. This is an +// (almost) opaque type for the user level programs. The file and +// this data structure is not standardized. Don't rely on it. It can +// go away without warning. +type X__LocaleStruct struct { + X__Locales [13]*X__LocaleData + X__CtypeB *uint16 + X__CtypeTolower *Int + X__CtypeToupper *Int + X__Names [13]*Char +} + +type X__LocaleData struct { +} + +// Structure for reentrant locale using functions. This is an +// (almost) opaque type for the user level programs. The file and +// this data structure is not standardized. Don't rely on it. It can +// go away without warning. +type X__LocaleT = *X__LocaleStruct + +type X_GFposT struct { + X__Pos Long + X__State X__MbstateT +} + +type Iovec struct { + IovBase unsafe.Pointer + IovLen uintptr +} + +const LLGoPackage = "link" diff --git a/c/libc_linux_arm64.go b/c/libc_linux_arm64.go new file mode 100644 index 00000000..9e9a2bf4 --- /dev/null +++ b/c/libc_linux_arm64.go @@ -0,0 +1,1619 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package c + +import ( + "unsafe" +) + +// Data structure to describe CPU mask. +type CpuSetT struct { + X__Bits [16]Ulong +} + +// Structure describing messages sent by +// `sendmsg' and received by `recvmsg'. +type Msghdr struct { + MsgName unsafe.Pointer + MsgNamelen Uint + MsgIov *Iovec + MsgIovlen SizeT + MsgControl unsafe.Pointer + MsgControllen SizeT + MsgFlags Int +} + +// Structure used for storage of ancillary data object information. +type Cmsghdr struct { + CmsgLen SizeT + CmsgLevel Int + CmsgType Int +} + +// The following names are all functions: +// int isCHARACTERISTIC(int c); +// which return nonzero iff C has CHARACTERISTIC. +// For the meaning of the characteristic names, see the `enum' above. +// +//go:linkname Isalnum C.isalnum +func Isalnum(_llcppg_param1 Int) Int + +//go:linkname Isalpha C.isalpha +func Isalpha(_llcppg_param1 Int) Int + +//go:linkname Iscntrl C.iscntrl +func Iscntrl(_llcppg_param1 Int) Int + +//go:linkname Isdigit C.isdigit +func Isdigit(_llcppg_param1 Int) Int + +//go:linkname Islower C.islower +func Islower(_llcppg_param1 Int) Int + +//go:linkname Isgraph C.isgraph +func Isgraph(_llcppg_param1 Int) Int + +//go:linkname Isprint C.isprint +func Isprint(_llcppg_param1 Int) Int + +//go:linkname Ispunct C.ispunct +func Ispunct(_llcppg_param1 Int) Int + +//go:linkname Isspace C.isspace +func Isspace(_llcppg_param1 Int) Int + +//go:linkname Isupper C.isupper +func Isupper(_llcppg_param1 Int) Int + +//go:linkname Isxdigit C.isxdigit +func Isxdigit(_llcppg_param1 Int) Int + +// Return the lowercase version of C. +// +//go:linkname Tolower C.tolower +func Tolower(__c Int) Int + +// Return the uppercase version of C. +// +//go:linkname Toupper C.toupper +func Toupper(__c Int) Int + +//go:linkname Isblank C.isblank +func Isblank(_llcppg_param1 Int) Int + +// Return nonzero iff C is in the ASCII set +// (i.e., is no more than 7 bits wide). +// +//go:linkname Isascii C.isascii +func Isascii(__c Int) Int + +// Return the part of C that is in the ASCII set +// (i.e., the low-order 7 bits of C). +// +//go:linkname Toascii C.toascii +func Toascii(__c Int) Int + +// These are the same as `toupper' and `tolower' except that they do not +// check the argument for being in the range of a `char'. +// +//go:linkname X_toupper C._toupper +func X_toupper(_llcppg_param1 Int) Int + +//go:linkname X_tolower C._tolower +func X_tolower(_llcppg_param1 Int) Int + +// The following names are all functions: +// int isCHARACTERISTIC(int c, locale_t *locale); +// which return nonzero iff C has CHARACTERISTIC. +// For the meaning of the characteristic names, see the `enum' above. +// +//go:linkname IsalnumL C.isalnum_l +func IsalnumL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsalphaL C.isalpha_l +func IsalphaL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IscntrlL C.iscntrl_l +func IscntrlL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsdigitL C.isdigit_l +func IsdigitL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IslowerL C.islower_l +func IslowerL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsgraphL C.isgraph_l +func IsgraphL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsprintL C.isprint_l +func IsprintL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IspunctL C.ispunct_l +func IspunctL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsspaceL C.isspace_l +func IsspaceL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsupperL C.isupper_l +func IsupperL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsxdigitL C.isxdigit_l +func IsxdigitL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname IsblankL C.isblank_l +func IsblankL(_llcppg_param1 Int, _llcppg_param2 X__LocaleT) Int + +//go:linkname TolowerL C.tolower_l +func TolowerL(__c Int, __l X__LocaleT) Int + +//go:linkname ToupperL C.toupper_l +func ToupperL(__c Int, __l X__LocaleT) Int + +// Bits set in the FLAGS argument to `fnmatch'. +const ( + FNM_PATHNAME = 1 + // Backslashes don't quote special chars. + FNM_NOESCAPE = 2 + // Leading `.' is matched only explicitly. + FNM_PERIOD = 4 +) + +// Value returned by `fnmatch' if STRING does not match PATTERN. +const FNM_NOMATCH = 1 + +// Match NAME against the filename pattern PATTERN, +// returning zero if it matches, FNM_NOMATCH if not. +// +//go:linkname Fnmatch C.fnmatch +func Fnmatch(__pattern *uint8, __name *uint8, __flags Int) Int + +// Decimal notation. +const ( + PRId8 = "d" + PRId16 = "d" + PRId32 = "d" +) + +const ( + PRIdLEAST8 = "d" + PRIdLEAST16 = "d" + PRIdLEAST32 = "d" +) + +const PRIdFAST8 = "d" + +const ( + PRIi8 = "i" + PRIi16 = "i" + PRIi32 = "i" +) + +const ( + PRIiLEAST8 = "i" + PRIiLEAST16 = "i" + PRIiLEAST32 = "i" +) + +const PRIiFAST8 = "i" + +// Octal notation. +const ( + PRIo8 = "o" + PRIo16 = "o" + PRIo32 = "o" +) + +const ( + PRIoLEAST8 = "o" + PRIoLEAST16 = "o" + PRIoLEAST32 = "o" +) + +const PRIoFAST8 = "o" + +// Unsigned integers. +const ( + PRIu8 = "u" + PRIu16 = "u" + PRIu32 = "u" +) + +const ( + PRIuLEAST8 = "u" + PRIuLEAST16 = "u" + PRIuLEAST32 = "u" +) + +const PRIuFAST8 = "u" + +// lowercase hexadecimal notation. +const ( + PRIx8 = "x" + PRIx16 = "x" + PRIx32 = "x" +) + +const ( + PRIxLEAST8 = "x" + PRIxLEAST16 = "x" + PRIxLEAST32 = "x" +) + +const PRIxFAST8 = "x" + +// UPPERCASE hexadecimal notation. +const ( + PRIX8 = "X" + PRIX16 = "X" + PRIX32 = "X" +) + +const ( + PRIXLEAST8 = "X" + PRIXLEAST16 = "X" + PRIXLEAST32 = "X" +) + +const PRIXFAST8 = "X" + +// Signed decimal notation. +const ( + SCNd8 = "hhd" + SCNd16 = "hd" + SCNd32 = "d" +) + +const ( + SCNdLEAST8 = "hhd" + SCNdLEAST16 = "hd" + SCNdLEAST32 = "d" +) + +const SCNdFAST8 = "hhd" + +// Signed decimal notation. +const ( + SCNi8 = "hhi" + SCNi16 = "hi" + SCNi32 = "i" +) + +const ( + SCNiLEAST8 = "hhi" + SCNiLEAST16 = "hi" + SCNiLEAST32 = "i" +) + +const SCNiFAST8 = "hhi" + +// Unsigned decimal notation. +const ( + SCNu8 = "hhu" + SCNu16 = "hu" + SCNu32 = "u" +) + +const ( + SCNuLEAST8 = "hhu" + SCNuLEAST16 = "hu" + SCNuLEAST32 = "u" +) + +const SCNuFAST8 = "hhu" + +// Octal notation. +const ( + SCNo8 = "hho" + SCNo16 = "ho" + SCNo32 = "o" +) + +const ( + SCNoLEAST8 = "hho" + SCNoLEAST16 = "ho" + SCNoLEAST32 = "o" +) + +const SCNoFAST8 = "hho" + +// Hexadecimal notation. +const ( + SCNx8 = "hhx" + SCNx16 = "hx" + SCNx32 = "x" +) + +const ( + SCNxLEAST8 = "hhx" + SCNxLEAST16 = "hx" + SCNxLEAST32 = "x" +) + +const SCNxFAST8 = "hhx" + +// We have to define the `uintmax_t' type using `ldiv_t'. +type ImaxdivT struct { + Quot Long + Rem Long +} + +// Compute absolute value of N. +// +//go:linkname Imaxabs C.imaxabs +func Imaxabs(__n Long) Long + +// Return the `imaxdiv_t' representation of the value of NUMER over DENOM. +// +//go:linkname Imaxdiv C.imaxdiv +func Imaxdiv(__numer Long, __denom Long) ImaxdivT + +// Like `strtol' but convert to `intmax_t'. +// +//go:linkname Strtoimax C.strtoimax +func Strtoimax(__nptr *uint8, __endptr **uint8, __base Int) Long + +// Like `strtoul' but convert to `uintmax_t'. +// +//go:linkname Strtoumax C.strtoumax +func Strtoumax(__nptr *uint8, __endptr **uint8, __base Int) Ulong + +// Like `wcstol' but convert to `intmax_t'. +// +//go:linkname Wcstoimax C.wcstoimax +func Wcstoimax(__nptr *Uint, __endptr **Uint, __base Int) Long + +// Like `wcstoul' but convert to `uintmax_t'. +// +//go:linkname Wcstoumax C.wcstoumax +func Wcstoumax(__nptr *Uint, __endptr **Uint, __base Int) Ulong + +// Return directory part of PATH or "." if none is available. +// +//go:linkname Dirname C.dirname +func Dirname(__path *uint8) *uint8 + +// Return final component of PATH. +// +// This is the weird XPG version of this function. It sometimes will +// modify its argument. Therefore we normally use the GNU version (in +// ) and only if this header is included make the XPG +// version available under the real name. +// +//go:linkname X__XpgBasename C.__xpg_basename +func X__XpgBasename(__path *uint8) *uint8 + +type X_IO_marker struct { + X_next *X_IO_marker + X_sbuf *X_IO_FILE + X_pos Int +} + +type X_IO_FILE struct { + X_flags Int + X_IO_read_ptr *uint8 + X_IO_read_end *uint8 + X_IO_read_base *uint8 + X_IO_write_base *uint8 + X_IO_write_ptr *uint8 + X_IO_write_end *uint8 + X_IO_buf_base *uint8 + X_IO_buf_end *uint8 + X_IO_save_base *uint8 + X_IO_backup_base *uint8 + X_IO_save_end *uint8 + X_markers *X_IO_marker + X_chain *X_IO_FILE + X_fileno Int + X_flags2 Int + X_oldOffset Long + X_curColumn uint16 + X_vtableOffset int8 + X_shortbuf [1]uint8 + X_lock *Void + X_offset Long + X__Pad1 unsafe.Pointer + X__Pad2 unsafe.Pointer + X__Pad3 unsafe.Pointer + X__Pad4 unsafe.Pointer + X__Pad5 SizeT + X_mode Int + X_unused2 [20]uint8 +} + +// Maximum length of any multibyte character in any locale. +// We define this value here since the gcc header does not define +// the correct value. +const MB_LEN_MAX = 16 + +// These are the possibilities for the first argument to setlocale. +// The code assumes that the lowest LC_* symbol has the value zero. +const ( + LC_CTYPE = 0 + LC_NUMERIC = 1 + LC_TIME = 2 + LC_COLLATE = 3 + LC_MONETARY = 4 + LC_MESSAGES = 5 + LC_ALL = 6 + LC_PAPER = 7 + LC_NAME = 8 + LC_ADDRESS = 9 + LC_TELEPHONE = 10 + LC_MEASUREMENT = 11 + LC_IDENTIFICATION = 12 +) + +// These are the bits that can be set in the CATEGORY_MASK argument to +// `newlocale'. In the GNU implementation, LC_FOO_MASK has the value +// of (1 << LC_FOO), but this is not a part of the interface that +// callers can assume will be true. +const ( + LC_CTYPE_MASK = 1 + LC_NUMERIC_MASK = 2 + LC_TIME_MASK = 4 + LC_COLLATE_MASK = 8 + LC_MONETARY_MASK = 16 + LC_MESSAGES_MASK = 32 + LC_PAPER_MASK = 128 + LC_NAME_MASK = 256 + LC_ADDRESS_MASK = 512 + LC_TELEPHONE_MASK = 1024 + LC_MEASUREMENT_MASK = 2048 + LC_IDENTIFICATION_MASK = 4096 + LC_ALL_MASK = 8127 +) + +// Structure giving information about numeric and monetary notation. +type Lconv struct { + DecimalPoint *uint8 + ThousandsSep *uint8 + Grouping *uint8 + IntCurrSymbol *uint8 + CurrencySymbol *uint8 + MonDecimalPoint *uint8 + MonThousandsSep *uint8 + MonGrouping *uint8 + PositiveSign *uint8 + NegativeSign *uint8 + IntFracDigits uint8 + FracDigits uint8 + PCsPrecedes uint8 + PSepBySpace uint8 + NCsPrecedes uint8 + NSepBySpace uint8 + PSignPosn uint8 + NSignPosn uint8 + IntPCsPrecedes uint8 + IntPSepBySpace uint8 + IntNCsPrecedes uint8 + IntNSepBySpace uint8 + IntPSignPosn uint8 + IntNSignPosn uint8 +} + +// Set and/or return the current locale. +// +//go:linkname Setlocale C.setlocale +func Setlocale(__category Int, __locale *uint8) *uint8 + +// Return the numeric/monetary information for the current locale. +// +//go:linkname Localeconv C.localeconv +func Localeconv() *Lconv + +// Return a reference to a data structure representing a set of locale +// datasets. Unlike for the CATEGORY parameter for `setlocale' the +// CATEGORY_MASK parameter here uses a single bit for each category, +// made by OR'ing together LC_*_MASK bits above. +// +//go:linkname Newlocale C.newlocale +func Newlocale(__category_mask Int, __locale *uint8, __base X__LocaleT) X__LocaleT + +// Return a duplicate of the set of locale in DATASET. All usage +// counters are increased if necessary. +// +// llgo:link X__LocaleT.Duplocale C.duplocale +func (self X__LocaleT) Duplocale() X__LocaleT { + return self +} + +// Free the data associated with a locale dataset previously returned +// by a call to `setlocale_r'. +// +// llgo:link X__LocaleT.Freelocale C.freelocale +func (self X__LocaleT) Freelocale() { +} + +// Switch the current thread's locale to DATASET. +// If DATASET is null, instead just return the current setting. +// The special value LC_GLOBAL_LOCALE is the initial setting +// for all threads and can also be installed any time, meaning +// the thread uses the global settings controlled by `setlocale'. +// +// llgo:link X__LocaleT.Uselocale C.uselocale +func (self X__LocaleT) Uselocale() X__LocaleT { + return self +} + +type Rpcent struct { + RName *uint8 + RAliases **uint8 + RNumber Int +} + +//go:linkname Setrpcent C.setrpcent +func Setrpcent(__stayopen Int) + +//go:linkname Endrpcent C.endrpcent +func Endrpcent() + +//go:linkname Getrpcbyname C.getrpcbyname +func Getrpcbyname(__name *uint8) *Rpcent + +//go:linkname Getrpcbynumber C.getrpcbynumber +func Getrpcbynumber(__number Int) *Rpcent + +//go:linkname Getrpcent C.getrpcent +func Getrpcent() *Rpcent + +//go:linkname GetrpcbynameR C.getrpcbyname_r +func GetrpcbynameR(__name *uint8, __result_buf *Rpcent, __buffer *uint8, __buflen SizeT, __result **Rpcent) Int + +//go:linkname GetrpcbynumberR C.getrpcbynumber_r +func GetrpcbynumberR(__number Int, __result_buf *Rpcent, __buffer *uint8, __buflen SizeT, __result **Rpcent) Int + +// llgo:link (*Rpcent).GetrpcentR C.getrpcent_r +func (self *Rpcent) GetrpcentR(__buffer *uint8, __buflen SizeT, __result **Rpcent) Int { + return 0 +} + +// Minimum of signed integral types. +const ( + INT8_MIN = -128 + INT16_MIN = -32768 + INT32_MIN = -2147483648 +) + +// Maximum of signed integral types. +const ( + INT8_MAX = 127 + INT16_MAX = 32767 + INT32_MAX = 2147483647 +) + +// Maximum of unsigned integral types. +const ( + UINT8_MAX = 255 + UINT16_MAX = 65535 +) + +// Minimum of signed integral types having a minimum size. +const ( + INT_LEAST8_MIN = -128 + INT_LEAST16_MIN = -32768 + INT_LEAST32_MIN = -2147483648 +) + +// Maximum of signed integral types having a minimum size. +const ( + INT_LEAST8_MAX = 127 + INT_LEAST16_MAX = 32767 + INT_LEAST32_MAX = 2147483647 +) + +// Maximum of unsigned integral types having a minimum size. +const ( + UINT_LEAST8_MAX = 255 + UINT_LEAST16_MAX = 65535 +) + +// Minimum of fast signed integral types having a minimum size. +const INT_FAST8_MIN = -128 + +// Maximum of fast signed integral types having a minimum size. +const INT_FAST8_MAX = 127 + +// Maximum of fast unsigned integral types having a minimum size. +const UINT_FAST8_MAX = 255 + +// Limits of `sig_atomic_t'. +const ( + SIG_ATOMIC_MIN = -2147483648 + SIG_ATOMIC_MAX = 2147483647 +) + +const BUFSIZ = 8192 + +// Default path prefix for `tempnam' and `tmpnam'. +const PTmpdir = "/tmp" + +type FposT = X_GFposT + +// Rename file OLD relative to OLDFD to NEW relative to NEWFD. +// +//go:linkname Renameat C.renameat +func Renameat(__oldfd Int, __old *uint8, __newfd Int, __new *uint8) Int + +// Ignore +// +//go:linkname Tmpfile C.tmpfile +func Tmpfile() *FILE + +// Generate a temporary filename. +// +//go:linkname Tmpnam C.tmpnam +func Tmpnam(__s *uint8) *uint8 + +// This is the reentrant variant of `tmpnam'. The only difference is +// that it does not allow S to be NULL. +// +//go:linkname TmpnamR C.tmpnam_r +func TmpnamR(__s *uint8) *uint8 + +// Generate a unique temporary filename using up to five characters of PFX +// if it is not NULL. The directory to put this file in is searched for +// as follows: First the environment variable "TMPDIR" is checked. +// If it contains the name of a writable directory, that directory is used. +// If not and if DIR is not NULL, that value is checked. If that fails, +// P_tmpdir is tried and finally "/tmp". The storage for the filename +// is allocated by `malloc'. +// +//go:linkname Tempnam C.tempnam +func Tempnam(__dir *uint8, __pfx *uint8) *uint8 + +// Faster versions when locking is not required. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FflushUnlocked C.fflush_unlocked +func FflushUnlocked(__stream *FILE) Int + +// Open a file, replacing an existing stream with it. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Freopen C.freopen +func Freopen(__filename *uint8, __modes *uint8, __stream *FILE) *FILE + +// Create a new stream that refers to an existing system file descriptor. +// +//go:linkname Fdopen C.fdopen +func Fdopen(__fd Int, __modes *uint8) *FILE + +// Create a new stream that refers to a memory buffer. +// +//go:linkname Fmemopen C.fmemopen +func Fmemopen(__s unsafe.Pointer, __len SizeT, __modes *uint8) *FILE + +// Open a stream that writes into a malloc'd buffer that is expanded as +// necessary. *BUFLOC and *SIZELOC are updated with the buffer's location +// and the number of characters written on fflush or fclose. +// +//go:linkname OpenMemstream C.open_memstream +func OpenMemstream(__bufloc **uint8, __sizeloc *SizeT) *FILE + +// If BUF is NULL, make STREAM unbuffered. +// Else make it use buffer BUF, of size BUFSIZ. +// +//go:linkname Setbuf C.setbuf +func Setbuf(__stream *FILE, __buf *uint8) + +// Make STREAM use buffering mode MODE. +// If BUF is not NULL, use N bytes of it for buffering; +// else allocate an internal buffer N bytes long. +// +//go:linkname Setvbuf C.setvbuf +func Setvbuf(__stream *FILE, __buf *uint8, __modes Int, __n SizeT) Int + +// If BUF is NULL, make STREAM unbuffered. +// Else make it use SIZE bytes of BUF for buffering. +// +//go:linkname Setbuffer C.setbuffer +func Setbuffer(__stream *FILE, __buf *uint8, __size SizeT) + +// Make STREAM line-buffered. +// +//go:linkname Setlinebuf C.setlinebuf +func Setlinebuf(__stream *FILE) + +//go:linkname Dprintf C.dprintf +func Dprintf(__fd Int, __fmt *uint8, __llgo_va_list ...any) Int + +// Read formatted input from STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fscanf C.fscanf +func Fscanf(__stream *FILE, __format *uint8, __llgo_va_list ...any) Int + +// Read formatted input from stdin. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Scanf C.scanf +func Scanf(__format *uint8, __llgo_va_list ...any) Int + +// Read formatted input from S. +// +//go:linkname Sscanf C.sscanf +func Sscanf(__s *uint8, __format *uint8, __llgo_va_list ...any) Int + +// Read a character from STREAM. +// +// These functions are possible cancellation points and therefore not +// marked with __THROW. +// +//go:linkname Fgetc C.fgetc +func Fgetc(__stream *FILE) Int + +//go:linkname Getc C.getc +func Getc(__stream *FILE) Int + +// Read a character from stdin. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getchar C.getchar +func Getchar() Int + +// These are defined in POSIX.1:1996. +// +// These functions are possible cancellation points and therefore not +// marked with __THROW. +// +//go:linkname GetcUnlocked C.getc_unlocked +func GetcUnlocked(__stream *FILE) Int + +//go:linkname GetcharUnlocked C.getchar_unlocked +func GetcharUnlocked() Int + +// Faster version when locking is not necessary. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetcUnlocked C.fgetc_unlocked +func FgetcUnlocked(__stream *FILE) Int + +//go:linkname Putc C.putc +func Putc(__c Int, __stream *FILE) Int + +// Write a character to stdout. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Putchar C.putchar +func Putchar(__c Int) Int + +// Faster version when locking is not necessary. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FputcUnlocked C.fputc_unlocked +func FputcUnlocked(__c Int, __stream *FILE) Int + +// These are defined in POSIX.1:1996. +// +// These functions are possible cancellation points and therefore not +// marked with __THROW. +// +//go:linkname PutcUnlocked C.putc_unlocked +func PutcUnlocked(__c Int, __stream *FILE) Int + +//go:linkname PutcharUnlocked C.putchar_unlocked +func PutcharUnlocked(__c Int) Int + +// Get a word (int) from STREAM. +// +//go:linkname Getw C.getw +func Getw(__stream *FILE) Int + +// Write a word (int) to STREAM. +// +//go:linkname Putw C.putw +func Putw(__w Int, __stream *FILE) Int + +// Get a newline-terminated string of finite length from STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fgets C.fgets +func Fgets(__s *uint8, __n Int, __stream *FILE) *uint8 + +// Ignore +// +//go:linkname Getdelim C.getdelim +func Getdelim(__lineptr **uint8, __n *SizeT, __delimiter Int, __stream *FILE) Long + +// Like `getdelim', but reads up to a newline. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getline C.getline +func Getline(__lineptr **uint8, __n *SizeT, __stream *FILE) Long + +// Write a string, followed by a newline, to stdout. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Puts C.puts +func Puts(__s *uint8) Int + +// Push a character back onto the input buffer of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Ungetc C.ungetc +func Ungetc(__c Int, __stream *FILE) Int + +// Faster versions when locking is not necessary. +// +// These functions are not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation they are cancellation points and +// therefore not marked with __THROW. +// +//go:linkname FreadUnlocked C.fread_unlocked +func FreadUnlocked(__ptr unsafe.Pointer, __size SizeT, __n SizeT, __stream *FILE) SizeT + +//go:linkname FwriteUnlocked C.fwrite_unlocked +func FwriteUnlocked(__ptr unsafe.Pointer, __size SizeT, __n SizeT, __stream *FILE) SizeT + +// Seek to a certain position on STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fseek C.fseek +func Fseek(__stream *FILE, __off Long, __whence Int) Int + +// Return the current position of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Ftell C.ftell +func Ftell(__stream *FILE) Long + +// Rewind to the beginning of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Rewind C.rewind +func Rewind(__stream *FILE) + +// Seek to a certain position on STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fseeko C.fseeko +func Fseeko(__stream *FILE, __off Long, __whence Int) Int + +// Return the current position of STREAM. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Ftello C.ftello +func Ftello(__stream *FILE) Long + +// Get STREAM's position. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fgetpos C.fgetpos +func Fgetpos(__stream *FILE, __pos *FposT) Int + +// Set STREAM's position. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Fsetpos C.fsetpos +func Fsetpos(__stream *FILE, __pos *FposT) Int + +// Clear the error and EOF indicators for STREAM. +// +//go:linkname Clearerr C.clearerr +func Clearerr(__stream *FILE) + +// Return the EOF indicator for STREAM. +// +//go:linkname Feof C.feof +func Feof(__stream *FILE) Int + +// Return the error indicator for STREAM. +// +//go:linkname Ferror C.ferror +func Ferror(__stream *FILE) Int + +// Faster versions when locking is not required. +// +//go:linkname ClearerrUnlocked C.clearerr_unlocked +func ClearerrUnlocked(__stream *FILE) + +// Ignore +// +//go:linkname FeofUnlocked C.feof_unlocked +func FeofUnlocked(__stream *FILE) Int + +// Ignore +// +//go:linkname FerrorUnlocked C.ferror_unlocked +func FerrorUnlocked(__stream *FILE) Int + +// Return the system file descriptor for STREAM. +// +//go:linkname Fileno C.fileno +func Fileno(__stream *FILE) Int + +// Faster version when locking is not required. +// +//go:linkname FilenoUnlocked C.fileno_unlocked +func FilenoUnlocked(__stream *FILE) Int + +// Create a new stream connected to a pipe running the given command. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Popen C.popen +func Popen(__command *uint8, __modes *uint8) *FILE + +// Close a stream opened by popen and return the status of its child. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Pclose C.pclose +func Pclose(__stream *FILE) Int + +// Return the name of the controlling terminal. +// +//go:linkname Ctermid C.ctermid +func Ctermid(__s *uint8) *uint8 + +// Acquire ownership of STREAM. +// +//go:linkname Flockfile C.flockfile +func Flockfile(__stream *FILE) + +// Try to acquire ownership of STREAM but do not block if it is not +// possible. +// +//go:linkname Ftrylockfile C.ftrylockfile +func Ftrylockfile(__stream *FILE) Int + +// Relinquish the ownership granted for STREAM. +// +//go:linkname Funlockfile C.funlockfile +func Funlockfile(__stream *FILE) + +// The largest number rand will return (same as INT_MAX). +const RAND_MAX = 2147483647 + +// We define these the same for all machines. +// Changes from this to the outside world should be done in `_exit'. +const ( + EXIT_FAILURE = 1 + // Successful exit status. + EXIT_SUCCESS = 0 +) + +type RandomData struct { + Fptr *Int + Rptr *Int + State *Int + RandType Int + RandDeg Int + RandSep Int + EndPtr *Int +} + +// Data structure for communication with thread safe versions. This +// type is to be regarded as opaque. It's only exported because users +// have to allocate objects of this type. +type Drand48Data struct { + X__X [3]uint16 + X__OldX [3]uint16 + X__C uint16 + X__Init uint16 + X__A UlongLong +} + +// Register a function to be called when `exit' is called. +// +// llgo:type C +type llcppgCallback2 = func() + +// llgo:type C +type llcppgCallback1 = func() + +// Register a function to be called with the status +// given to `exit' and the given argument. +// +// llgo:type C +type llcppgCallback0 = func(_llcppg_param1 Int, _llcppg_param2 unsafe.Pointer) + +// llgo:type C +type X__ComparFnT = func(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer) Int + +// Convert a string to a floating-point number. +// +//go:linkname Atof C.atof +func Atof(__nptr *uint8) Double + +// Convert a string to a long integer. +// +//go:linkname Atol C.atol +func Atol(__nptr *uint8) Long + +// Convert a string to a long long integer. +// +//go:linkname Atoll C.atoll +func Atoll(__nptr *uint8) LongLong + +// Convert a string to a floating-point number. +// +//go:linkname Strtod C.strtod +func Strtod(__nptr *uint8, __endptr **uint8) Double + +// Likewise for `float' and `long double' sizes of floating-point numbers. +// +//go:linkname Strtof C.strtof +func Strtof(__nptr *uint8, __endptr **uint8) Float + +// Convert a string to a long integer. +// +//go:linkname Strtol C.strtol +func Strtol(__nptr *uint8, __endptr **uint8, __base Int) Long + +// Convert a string to an unsigned long integer. +// +//go:linkname Strtoul C.strtoul +func Strtoul(__nptr *uint8, __endptr **uint8, __base Int) Ulong + +// Convert a string to an unsigned quadword integer. +// +//go:linkname Strtoq C.strtoq +func Strtoq(__nptr *uint8, __endptr **uint8, __base Int) LongLong + +//go:linkname Strtouq C.strtouq +func Strtouq(__nptr *uint8, __endptr **uint8, __base Int) UlongLong + +// Convert a string to an unsigned quadword integer. +// +//go:linkname Strtoll C.strtoll +func Strtoll(__nptr *uint8, __endptr **uint8, __base Int) LongLong + +//go:linkname Strtoull C.strtoull +func Strtoull(__nptr *uint8, __endptr **uint8, __base Int) UlongLong + +// Convert N to base 64 using the digits "./0-9A-Za-z", least-significant +// digit first. Returns a pointer to static storage overwritten by the +// next call. +// +//go:linkname L64a C.l64a +func L64a(__n Long) *uint8 + +// Read a number from a string S in base 64 as above. +// +//go:linkname A64l C.a64l +func A64l(__s *uint8) Long + +// Return a random long integer between 0 and RAND_MAX inclusive. +// +//go:linkname Random C.random +func Random() Long + +// Seed the random number generator with the given number. +// +//go:linkname Srandom C.srandom +func Srandom(__seed Uint) + +// Initialize the random number generator to use state buffer STATEBUF, +// of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16, +// 32, 64, 128 and 256, the bigger the better; values less than 8 will +// cause an error and values greater than 256 will be rounded down. +// +//go:linkname Initstate C.initstate +func Initstate(__seed Uint, __statebuf *uint8, __statelen SizeT) *uint8 + +// Switch the random number generator to state buffer STATEBUF, +// which should have been previously initialized by `initstate'. +// +//go:linkname Setstate C.setstate +func Setstate(__statebuf *uint8) *uint8 + +// llgo:link (*RandomData).RandomR C.random_r +func (self *RandomData) RandomR(__result *Int) Int { + return 0 +} + +//go:linkname SrandomR C.srandom_r +func SrandomR(__seed Uint, __buf *RandomData) Int + +//go:linkname InitstateR C.initstate_r +func InitstateR(__seed Uint, __statebuf *uint8, __statelen SizeT, __buf *RandomData) Int + +//go:linkname SetstateR C.setstate_r +func SetstateR(__statebuf *uint8, __buf *RandomData) Int + +// Seed the random number generator with the given number. +// +//go:linkname Srand C.srand +func Srand(__seed Uint) + +// Reentrant interface according to POSIX.1. +// +//go:linkname RandR C.rand_r +func RandR(__seed *Uint) Int + +// Return non-negative, double-precision floating-point value in [0.0,1.0). +// +//go:linkname Drand48 C.drand48 +func Drand48() Double + +//go:linkname Erand48 C.erand48 +func Erand48(__xsubi *uint16) Double + +// Return non-negative, long integer in [0,2^31). +// +//go:linkname Lrand48 C.lrand48 +func Lrand48() Long + +//go:linkname Nrand48 C.nrand48 +func Nrand48(__xsubi *uint16) Long + +// Return signed, long integers in [-2^31,2^31). +// +//go:linkname Mrand48 C.mrand48 +func Mrand48() Long + +//go:linkname Jrand48 C.jrand48 +func Jrand48(__xsubi *uint16) Long + +// Seed random number generator. +// +//go:linkname Srand48 C.srand48 +func Srand48(__seedval Long) + +//go:linkname Seed48 C.seed48 +func Seed48(__seed16v *uint16) *uint16 + +//go:linkname Lcong48 C.lcong48 +func Lcong48(__param *uint16) + +// Return non-negative, double-precision floating-point value in [0.0,1.0). +// +// llgo:link (*Drand48Data).Drand48R C.drand48_r +func (self *Drand48Data) Drand48R(__result *Double) Int { + return 0 +} + +//go:linkname Erand48R C.erand48_r +func Erand48R(__xsubi *uint16, __buffer *Drand48Data, __result *Double) Int + +// Return non-negative, long integer in [0,2^31). +// +// llgo:link (*Drand48Data).Lrand48R C.lrand48_r +func (self *Drand48Data) Lrand48R(__result *Long) Int { + return 0 +} + +//go:linkname Nrand48R C.nrand48_r +func Nrand48R(__xsubi *uint16, __buffer *Drand48Data, __result *Long) Int + +// Return signed, long integers in [-2^31,2^31). +// +// llgo:link (*Drand48Data).Mrand48R C.mrand48_r +func (self *Drand48Data) Mrand48R(__result *Long) Int { + return 0 +} + +//go:linkname Jrand48R C.jrand48_r +func Jrand48R(__xsubi *uint16, __buffer *Drand48Data, __result *Long) Int + +// Seed random number generator. +// +//go:linkname Srand48R C.srand48_r +func Srand48R(__seedval Long, __buffer *Drand48Data) Int + +//go:linkname Seed48R C.seed48_r +func Seed48R(__seed16v *uint16, __buffer *Drand48Data) Int + +//go:linkname Lcong48R C.lcong48_r +func Lcong48R(__param *uint16, __buffer *Drand48Data) Int + +// Free a block. An alias for `free'. (Sun Unices). +// +//go:linkname Cfree C.free +func Cfree(__ptr unsafe.Pointer) + +// Allocate SIZE bytes on a page boundary. The storage cannot be freed. +// +//go:linkname Valloc C.valloc +func Valloc(__size SizeT) unsafe.Pointer + +// Allocate memory of SIZE bytes with an alignment of ALIGNMENT. +// +//go:linkname PosixMemalign C.posix_memalign +func PosixMemalign(__memptr *unsafe.Pointer, __alignment SizeT, __size SizeT) Int + +// ISO C variant of aligned allocation. +// +//go:linkname AlignedAlloc C.aligned_alloc +func AlignedAlloc(__alignment SizeT, __size SizeT) unsafe.Pointer + +// Abort execution and generate a core-dump. +// +//go:linkname Abort C.abort +func Abort() + +//go:linkname Atexit C.atexit +func Atexit(__func llcppgCallback2) Int + +//go:linkname AtQuickExit C.at_quick_exit +func AtQuickExit(__func llcppgCallback1) Int + +//go:linkname OnExit C.on_exit +func OnExit(__func llcppgCallback0, __arg unsafe.Pointer) Int + +// Call all functions registered with `at_quick_exit' in the reverse +// of the order in which they were registered and terminate program +// execution with STATUS. +// +//go:linkname QuickExit C.quick_exit +func QuickExit(__status Int) + +// Terminate the program with STATUS without calling any of the +// functions registered with `atexit' or `on_exit'. +// +//go:linkname X_Exit C._Exit +func X_Exit(__status Int) + +// Generate a unique temporary file name from TEMPLATE. +// The last six characters of TEMPLATE must be "XXXXXX"; +// they are replaced with a string that makes the file name unique. +// Always returns TEMPLATE, it's either a temporary file name or a null +// string if it cannot get a unique file name. +// +//go:linkname Mktemp C.mktemp +func Mktemp(__template *uint8) *uint8 + +// Ignore +// +//go:linkname Mkstemp C.mkstemp +func Mkstemp(__template *uint8) Int + +// Ignore +// +//go:linkname Mkstemps C.mkstemps +func Mkstemps(__template *uint8, __suffixlen Int) Int + +// Create a unique temporary directory from TEMPLATE. +// The last six characters of TEMPLATE must be "XXXXXX"; +// they are replaced with a string that makes the directory name unique. +// Returns TEMPLATE, or a null pointer if it cannot get a unique name. +// The directory is created mode 700. +// +//go:linkname Mkdtemp C.mkdtemp +func Mkdtemp(__template *uint8) *uint8 + +// Execute the given line as a shell command. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname System C.system +func System(__command *uint8) Int + +// Return the canonical absolute name of file NAME. If RESOLVED is +// null, the result is malloc'd; otherwise, if the canonical name is +// PATH_MAX chars or more, returns null with `errno' set to +// ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, +// returns the name in RESOLVED. +// +//go:linkname Realpath C.realpath +func Realpath(__name *uint8, __resolved *uint8) *uint8 + +// Do a binary search for KEY in BASE, which consists of NMEMB elements +// of SIZE bytes each, using COMPAR to perform the comparisons. +// +//go:linkname Bsearch C.bsearch +func Bsearch(__key unsafe.Pointer, __base unsafe.Pointer, __nmemb SizeT, __size SizeT, __compar X__ComparFnT) unsafe.Pointer + +// Return the absolute value of X. +// +//go:linkname Abs C.abs +func Abs(__x Int) Int + +// Ignore +// +//go:linkname Labs C.labs +func Labs(__x Long) Long + +// Ignore +// +//go:linkname Llabs C.llabs +func Llabs(__x LongLong) LongLong + +// GCC may have built-ins for these someday. +// +//go:linkname Div C.div +func Div(__numer Int, __denom Int) DivT + +// Ignore +// +//go:linkname Ldiv C.ldiv +func Ldiv(__numer Long, __denom Long) LdivT + +// Ignore +// +//go:linkname Lldiv C.lldiv +func Lldiv(__numer LongLong, __denom LongLong) LldivT + +// Convert VALUE to a string with NDIGIT digits and return a pointer to +// this. Set *DECPT with the position of the decimal character and *SIGN +// with the sign of the number. +// +//go:linkname Ecvt C.ecvt +func Ecvt(__value Double, __ndigit Int, __decpt *Int, __sign *Int) *uint8 + +// Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT +// with the position of the decimal character and *SIGN with the sign of +// the number. +// +//go:linkname Fcvt C.fcvt +func Fcvt(__value Double, __ndigit Int, __decpt *Int, __sign *Int) *uint8 + +// If possible convert VALUE to a string with NDIGIT significant digits. +// Otherwise use exponential representation. The resulting string will +// be written to BUF. +// +//go:linkname Gcvt C.gcvt +func Gcvt(__value Double, __ndigit Int, __buf *uint8) *uint8 + +// Reentrant version of the functions above which provide their own +// buffers. +// +//go:linkname EcvtR C.ecvt_r +func EcvtR(__value Double, __ndigit Int, __decpt *Int, __sign *Int, __buf *uint8, __len SizeT) Int + +//go:linkname FcvtR C.fcvt_r +func FcvtR(__value Double, __ndigit Int, __decpt *Int, __sign *Int, __buf *uint8, __len SizeT) Int + +// Return the length of the multibyte character +// in S, which is no longer than N. +// +//go:linkname Mblen C.mblen +func Mblen(__s *uint8, __n SizeT) Int + +// Return the length of the given multibyte character, +// putting its `wchar_t' representation in *PWC. +// +//go:linkname Mbtowc C.mbtowc +func Mbtowc(__pwc *WcharT, __s *uint8, __n SizeT) Int + +// Put the multibyte character represented +// by WCHAR in S, returning its length. +// +//go:linkname Wctomb C.wctomb +func Wctomb(__s *uint8, __wchar WcharT) Int + +// Convert a multibyte string to a wide char string. +// +//go:linkname Mbstowcs C.mbstowcs +func Mbstowcs(__pwcs *WcharT, __s *uint8, __n SizeT) SizeT + +// Convert a wide char string to multibyte string. +// +//go:linkname Wcstombs C.wcstombs +func Wcstombs(__s *uint8, __pwcs *WcharT, __n SizeT) SizeT + +// Determine whether the string value of RESPONSE matches the affirmation +// or negative response expression as specified by the LC_MESSAGES category +// in the program's current locale. Returns 1 if affirmative, 0 if +// negative, and -1 if not matching. +// +//go:linkname Rpmatch C.rpmatch +func Rpmatch(__response *uint8) Int + +// Parse comma separated suboption from *OPTIONP and match against +// strings in TOKENS. If found return index and set *VALUEP to +// optional value introduced by an equal sign. If the suboption is +// not part of TOKENS return in *VALUEP beginning of unknown +// suboption. On exit *OPTIONP is set to the beginning of the next +// token or at the terminating NUL character. +// +//go:linkname Getsubopt C.getsubopt +func Getsubopt(__optionp **uint8, __tokens **uint8, __valuep **uint8) Int + +// Put the 1 minute, 5 minute and 15 minute load averages into the first +// NELEM elements of LOADAVG. Return the number written (never more than +// three, but may be less than NELEM), or -1 if an error occurred. +// +//go:linkname Getloadavg C.getloadavg +func Getloadavg(__loadavg *Double, __nelem Int) Int + +//go:linkname Memccpy C.memccpy +func Memccpy(__dest unsafe.Pointer, __src unsafe.Pointer, __c Int, __n SizeT) unsafe.Pointer + +// Compare the collated forms of S1 and S2. +// +//go:linkname Strcoll C.strcoll +func Strcoll(__s1 *uint8, __s2 *uint8) Int + +// Put a transformation of SRC into no more than N bytes of DEST. +// +//go:linkname Strxfrm C.strxfrm +func Strxfrm(__dest *uint8, __src *uint8, __n SizeT) SizeT + +// Compare the collated forms of S1 and S2 using rules from L. +// +//go:linkname StrcollL C.strcoll_l +func StrcollL(__s1 *uint8, __s2 *uint8, __l X__LocaleT) Int + +// Put a transformation of SRC into no more than N bytes of DEST. +// +//go:linkname StrxfrmL C.strxfrm_l +func StrxfrmL(__dest *uint8, __src *uint8, __n SizeT, __l X__LocaleT) SizeT + +// Return the length of the initial segment of S which +// consists entirely of characters not in REJECT. +// +//go:linkname Strcspn C.strcspn +func Strcspn(__s *uint8, __reject *uint8) SizeT + +// Return the length of the initial segment of S which +// consists entirely of characters in ACCEPT. +// +//go:linkname Strspn C.strspn +func Strspn(__s *uint8, __accept *uint8) SizeT + +//go:linkname Strpbrk C.strpbrk +func Strpbrk(__s *uint8, __accept *uint8) *uint8 + +//go:linkname StrtokR C.strtok_r +func StrtokR(__s *uint8, __delim *uint8, __save_ptr **uint8) *uint8 + +// Find the length of STRING, but scan at most MAXLEN characters. +// If no '\0' terminator is found in that many characters, return MAXLEN. +// +//go:linkname Strnlen C.strnlen +func Strnlen(__string *uint8, __maxlen SizeT) SizeT + +//go:linkname StrerrorR C.__xpg_strerror_r +func StrerrorR(__errnum Int, __buf *uint8, __buflen SizeT) Int + +// Translate error number to string according to the locale L. +// +//go:linkname StrerrorL C.strerror_l +func StrerrorL(__errnum Int, __l X__LocaleT) *uint8 + +// Copy N bytes of SRC to DEST (like memmove, but args reversed). +// +//go:linkname Bcopy C.bcopy +func Bcopy(__src unsafe.Pointer, __dest unsafe.Pointer, __n SizeT) + +// Set N bytes of S to 0. +// +//go:linkname Bzero C.bzero +func Bzero(__s unsafe.Pointer, __n SizeT) + +// Compare N bytes of S1 and S2 (same as memcmp). +// +//go:linkname Bcmp C.bcmp +func Bcmp(__s1 unsafe.Pointer, __s2 unsafe.Pointer, __n SizeT) Int + +//go:linkname Rindex C.rindex +func Rindex(__s *uint8, __c Int) *uint8 + +// Return the position of the first bit set in I, or 0 if none are set. +// The least-significant bit is position 1, the most-significant 32. +// +//go:linkname Ffs C.ffs +func Ffs(__i Int) Int + +// Compare S1 and S2, ignoring case. +// +//go:linkname Strcasecmp C.strcasecmp +func Strcasecmp(__s1 *uint8, __s2 *uint8) Int + +// Compare no more than N chars of S1 and S2, ignoring case. +// +//go:linkname Strncasecmp C.strncasecmp +func Strncasecmp(__s1 *uint8, __s2 *uint8, __n SizeT) Int + +// Return the next DELIM-delimited token from *STRINGP, +// terminating it with a '\0', and update *STRINGP to point past it. +// +//go:linkname Strsep C.strsep +func Strsep(__stringp **uint8, __delim *uint8) *uint8 + +// Return a string describing the meaning of the signal number in SIG. +// +//go:linkname Strsignal C.strsignal +func Strsignal(__sig Int) *uint8 + +//go:linkname Stpcpy C.stpcpy +func Stpcpy(__dest *uint8, __src *uint8) *uint8 + +//go:linkname Stpncpy C.stpncpy +func Stpncpy(__dest *uint8, __src *uint8, __n SizeT) *uint8 + +// Conversion state information. +type X__MbstateT struct { + X__Count Int + X__Value _llcppg_anon_8 +} + +type _llcppg_anon_8 struct { + _xgo_union [1]uint32 +} + +func (p *_llcppg_anon_8) XGof_ref___wch() *Uint { + return (*Uint)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_8) XGof_ref___wchb() *[4]uint8 { + return (*[4]uint8)(unsafe.Pointer(p)) +} + +// Structure for reentrant locale using functions. This is an +// (almost) opaque type for the user level programs. The file and +// this data structure is not standardized. Don't rely on it. It can +// go away without warning. +type X__LocaleStruct struct { + X__Locales [13]*X__LocaleData + X__CtypeB *uint16 + X__CtypeTolower *Int + X__CtypeToupper *Int + X__Names [13]*uint8 +} + +type X__LocaleData struct { +} + +// Structure for reentrant locale using functions. This is an +// (almost) opaque type for the user level programs. The file and +// this data structure is not standardized. Don't rely on it. It can +// go away without warning. +type X__LocaleT = *X__LocaleStruct + +type X_GFposT struct { + X__Pos Long + X__State X__MbstateT +} + +type Iovec struct { + IovBase unsafe.Pointer + IovLen uintptr +} + +const LLGoPackage = "link" diff --git a/c/libc_native_darwin_arm64_llgo_test.go b/c/libc_native_darwin_arm64_llgo_test.go new file mode 100644 index 00000000..ae7063e1 --- /dev/null +++ b/c/libc_native_darwin_arm64_llgo_test.go @@ -0,0 +1,724 @@ +//go:build llgo && darwin && arm64 && !ios + +package c_test + +import ( + "github.com/goplus/lib/c" + "reflect" + "testing" + "unsafe" +) + +type nativeChar = c.Char +type nativeWide = c.Int +type nativeFilePosition = c.LongLong + +const nativeFilePositionSize = 8 + +func TestGeneratedDarwinLongDoubleResult(t *testing.T) { + t.Run("Memmem", func(t *testing.T) { + input := [8]nativeChar{'a', 'b', 'c', ':', 'd', 0} + needle := [2]nativeChar{'b', 'c'} + if c.Memmem(unsafe.Pointer(&input[0]), 5, unsafe.Pointer(&needle[0]), 2) != unsafe.Pointer(&input[1]) { + t.Fatal("memmem match position differs") + } + }) + t.Run("SysNerr and SysErrlist", func(t *testing.T) { + if c.SysNerr <= 0 { + t.Fatalf("sys_nerr = %d", c.SysNerr) + } + errors := (**c.Char)(unsafe.Pointer(&c.SysErrlist)) + for i := c.Int(0); i < c.SysNerr; i++ { + entry := c.Index(errors, i) + if entry == nil { + t.Fatalf("sys_errlist[%d] is nil", i) + } + if got, want := c.GoString(entry), c.GoString(c.Strerror(i)); got != want { + t.Fatalf("sys_errlist[%d] = %q, strerror = %q", i, got, want) + } + } + }) + t.Run("Suboptarg", func(t *testing.T) { + previous := c.Suboptarg + defer func() { c.Suboptarg = previous }() + value := c.Str("llcppg suboption") + c.Suboptarg = value + if c.Suboptarg != value || c.GoString(c.Suboptarg) != "llcppg suboption" { + t.Fatal("suboptarg storage differs") + } + }) + var end *c.Char + value := c.Strtold(c.Str("1.5"), &end) + if value != 1.5 || end == nil || *end != 0 { + t.Fatalf("strtold value/end = %v/%p", value, end) + } +} + +// This table deliberately takes every new C symbol address so the linker must resolve it. +var generatedFunctionSymbols = []struct { + name string + address unsafe.Pointer +}{ + {"Fnmatch", c.Func(c.Fnmatch)}, + {"Imaxabs", c.Func(c.Imaxabs)}, + {"Imaxdiv", c.Func(c.Imaxdiv)}, + {"Strtoimax", c.Func(c.Strtoimax)}, + {"Strtoumax", c.Func(c.Strtoumax)}, + {"Wcstoimax", c.Func(c.Wcstoimax)}, + {"Wcstoumax", c.Func(c.Wcstoumax)}, + {"Basename", c.Func(c.Basename)}, + {"Dirname", c.Func(c.Dirname)}, + {"BasenameR", c.Func(c.BasenameR)}, + {"DirnameR", c.Func(c.DirnameR)}, + {"Setlocale", c.Func(c.Setlocale)}, + {"Valloc", c.Func(c.Valloc)}, + {"AlignedAlloc", c.Func(c.AlignedAlloc)}, + {"PosixMemalign", c.Func(c.PosixMemalign)}, + {"Clearerr", c.Func(c.Clearerr)}, + {"Feof", c.Func(c.Feof)}, + {"Ferror", c.Func(c.Ferror)}, + {"Fgetc", c.Func(c.Fgetc)}, + {"Fgetpos", c.Func(c.Fgetpos)}, + {"Fgets", c.Func(c.Fgets)}, + {"Freopen", c.Func(c.Freopen)}, + {"Fscanf", c.Func(c.Fscanf)}, + {"Fseek", c.Func(c.Fseek)}, + {"Fsetpos", c.Func(c.Fsetpos)}, + {"Ftell", c.Func(c.Ftell)}, + {"Getc", c.Func(c.Getc)}, + {"Getchar", c.Func(c.Getchar)}, + {"Gets", c.Func(c.Gets)}, + {"Putc", c.Func(c.Putc)}, + {"Putchar", c.Func(c.Putchar)}, + {"Puts", c.Func(c.Puts)}, + {"Rewind", c.Func(c.Rewind)}, + {"Scanf", c.Func(c.Scanf)}, + {"Setbuf", c.Func(c.Setbuf)}, + {"Setvbuf", c.Func(c.Setvbuf)}, + {"Sscanf", c.Func(c.Sscanf)}, + {"Tmpfile", c.Func(c.Tmpfile)}, + {"Tmpnam", c.Func(c.Tmpnam)}, + {"Ungetc", c.Func(c.Ungetc)}, + {"Fdopen", c.Func(c.Fdopen)}, + {"Fileno", c.Func(c.Fileno)}, + {"Pclose", c.Func(c.Pclose)}, + {"Popen", c.Func(c.Popen)}, + {"Flockfile", c.Func(c.Flockfile)}, + {"Ftrylockfile", c.Func(c.Ftrylockfile)}, + {"Funlockfile", c.Func(c.Funlockfile)}, + {"GetcUnlocked", c.Func(c.GetcUnlocked)}, + {"GetcharUnlocked", c.Func(c.GetcharUnlocked)}, + {"PutcUnlocked", c.Func(c.PutcUnlocked)}, + {"PutcharUnlocked", c.Func(c.PutcharUnlocked)}, + {"Getw", c.Func(c.Getw)}, + {"Putw", c.Func(c.Putw)}, + {"Tempnam", c.Func(c.Tempnam)}, + {"Fseeko", c.Func(c.Fseeko)}, + {"Ftello", c.Func(c.Ftello)}, + {"Dprintf", c.Func(c.Dprintf)}, + {"Getdelim", c.Func(c.Getdelim)}, + {"Getline", c.Func(c.Getline)}, + {"Fmemopen", c.Func(c.Fmemopen)}, + {"OpenMemstream", c.Func(c.OpenMemstream)}, + {"Asprintf", c.Func(c.Asprintf)}, + {"CtermidR", c.Func(c.CtermidR)}, + {"Fgetln", c.Func(c.Fgetln)}, + {"Fmtcheck", c.Func(c.Fmtcheck)}, + {"Fpurge", c.Func(c.Fpurge)}, + {"Setbuffer", c.Func(c.Setbuffer)}, + {"Setlinebuf", c.Func(c.Setlinebuf)}, + {"Funopen", c.Func(c.Funopen)}, + {"Abort", c.Func(c.Abort)}, + {"Abs", c.Func(c.Abs)}, + {"Atexit", c.Func(c.Atexit)}, + {"Atof", c.Func(c.Atof)}, + {"Atol", c.Func(c.Atol)}, + {"Atoll", c.Func(c.Atoll)}, + {"Bsearch", c.Func(c.Bsearch)}, + {"Div", c.Func(c.Div)}, + {"Labs", c.Func(c.Labs)}, + {"Ldiv", c.Func(c.Ldiv)}, + {"Llabs", c.Func(c.Llabs)}, + {"Lldiv", c.Func(c.Lldiv)}, + {"Mblen", c.Func(c.Mblen)}, + {"Mbstowcs", c.Func(c.Mbstowcs)}, + {"Mbtowc", c.Func(c.Mbtowc)}, + {"Srand", c.Func(c.Srand)}, + {"Strtod", c.Func(c.Strtod)}, + {"Strtof", c.Func(c.Strtof)}, + {"Strtol", c.Func(c.Strtol)}, + {"Strtold", c.Func(c.Strtold)}, + {"Strtoll", c.Func(c.Strtoll)}, + {"Strtoul", c.Func(c.Strtoul)}, + {"Strtoull", c.Func(c.Strtoull)}, + {"System", c.Func(c.System)}, + {"Wcstombs", c.Func(c.Wcstombs)}, + {"Wctomb", c.Func(c.Wctomb)}, + {"X_Exit", c.Func(c.X_Exit)}, + {"A64l", c.Func(c.A64l)}, + {"Drand48", c.Func(c.Drand48)}, + {"Ecvt", c.Func(c.Ecvt)}, + {"Erand48", c.Func(c.Erand48)}, + {"Fcvt", c.Func(c.Fcvt)}, + {"Gcvt", c.Func(c.Gcvt)}, + {"Getsubopt", c.Func(c.Getsubopt)}, + {"Grantpt", c.Func(c.Grantpt)}, + {"Initstate", c.Func(c.Initstate)}, + {"Jrand48", c.Func(c.Jrand48)}, + {"L64a", c.Func(c.L64a)}, + {"Lcong48", c.Func(c.Lcong48)}, + {"Lrand48", c.Func(c.Lrand48)}, + {"Mktemp", c.Func(c.Mktemp)}, + {"Mkstemp", c.Func(c.Mkstemp)}, + {"Mrand48", c.Func(c.Mrand48)}, + {"Nrand48", c.Func(c.Nrand48)}, + {"PosixOpenpt", c.Func(c.PosixOpenpt)}, + {"Ptsname", c.Func(c.Ptsname)}, + {"PtsnameR", c.Func(c.PtsnameR)}, + {"Random", c.Func(c.Random)}, + {"RandR", c.Func(c.RandR)}, + {"Realpath", c.Func(c.Realpath)}, + {"Seed48", c.Func(c.Seed48)}, + {"Setkey", c.Func(c.Setkey)}, + {"Setstate", c.Func(c.Setstate)}, + {"Srand48", c.Func(c.Srand48)}, + {"Srandom", c.Func(c.Srandom)}, + {"Unlockpt", c.Func(c.Unlockpt)}, + {"Arc4random", c.Func(c.Arc4random)}, + {"Arc4randomAddrandom", c.Func(c.Arc4randomAddrandom)}, + {"Arc4randomBuf", c.Func(c.Arc4randomBuf)}, + {"Arc4randomStir", c.Func(c.Arc4randomStir)}, + {"Arc4randomUniform", c.Func(c.Arc4randomUniform)}, + {"Cgetcap", c.Func(c.Cgetcap)}, + {"Cgetclose", c.Func(c.Cgetclose)}, + {"Cgetent", c.Func(c.Cgetent)}, + {"Cgetfirst", c.Func(c.Cgetfirst)}, + {"Cgetmatch", c.Func(c.Cgetmatch)}, + {"Cgetnext", c.Func(c.Cgetnext)}, + {"Cgetnum", c.Func(c.Cgetnum)}, + {"Cgetset", c.Func(c.Cgetset)}, + {"Cgetstr", c.Func(c.Cgetstr)}, + {"Cgetustr", c.Func(c.Cgetustr)}, + {"Daemon", c.Func(c.Daemon)}, + {"Devname", c.Func(c.Devname)}, + {"DevnameR", c.Func(c.DevnameR)}, + {"Getbsize", c.Func(c.Getbsize)}, + {"Getloadavg", c.Func(c.Getloadavg)}, + {"Getprogname", c.Func(c.Getprogname)}, + {"Setprogname", c.Func(c.Setprogname)}, + {"Heapsort", c.Func(c.Heapsort)}, + {"Mergesort", c.Func(c.Mergesort)}, + {"Psort", c.Func(c.Psort)}, + {"PsortR", c.Func(c.PsortR)}, + {"QsortR", c.Func(c.QsortR)}, + {"Radixsort", c.Func(c.Radixsort)}, + {"Rpmatch", c.Func(c.Rpmatch)}, + {"Sradixsort", c.Func(c.Sradixsort)}, + {"Sranddev", c.Func(c.Sranddev)}, + {"Srandomdev", c.Func(c.Srandomdev)}, + {"Reallocf", c.Func(c.Reallocf)}, + {"Strtonum", c.Func(c.Strtonum)}, + {"Strtoq", c.Func(c.Strtoq)}, + {"Strtouq", c.Func(c.Strtouq)}, + {"Strcoll", c.Func(c.Strcoll)}, + {"Strcspn", c.Func(c.Strcspn)}, + {"Strpbrk", c.Func(c.Strpbrk)}, + {"Strspn", c.Func(c.Strspn)}, + {"Strxfrm", c.Func(c.Strxfrm)}, + {"StrtokR", c.Func(c.StrtokR)}, + {"StrerrorR", c.Func(c.StrerrorR)}, + {"Memccpy", c.Func(c.Memccpy)}, + {"Stpcpy", c.Func(c.Stpcpy)}, + {"Stpncpy", c.Func(c.Stpncpy)}, + {"Strnlen", c.Func(c.Strnlen)}, + {"Strsignal", c.Func(c.Strsignal)}, + {"MemsetS", c.Func(c.MemsetS)}, + {"Memmem", c.Func(c.Memmem)}, + {"MemsetPattern4", c.Func(c.MemsetPattern4)}, + {"MemsetPattern8", c.Func(c.MemsetPattern8)}, + {"MemsetPattern16", c.Func(c.MemsetPattern16)}, + {"Strcasestr", c.Func(c.Strcasestr)}, + {"Strnstr", c.Func(c.Strnstr)}, + {"Strlcat", c.Func(c.Strlcat)}, + {"Strlcpy", c.Func(c.Strlcpy)}, + {"Strmode", c.Func(c.Strmode)}, + {"Strsep", c.Func(c.Strsep)}, + {"Swab", c.Func(c.Swab)}, + {"TimingsafeBcmp", c.Func(c.TimingsafeBcmp)}, + {"StrsignalR", c.Func(c.StrsignalR)}, + {"Bcmp", c.Func(c.Bcmp)}, + {"Bcopy", c.Func(c.Bcopy)}, + {"Bzero", c.Func(c.Bzero)}, + {"Rindex", c.Func(c.Rindex)}, + {"Ffs", c.Func(c.Ffs)}, + {"Strcasecmp", c.Func(c.Strcasecmp)}, + {"Strncasecmp", c.Func(c.Strncasecmp)}, + {"Ffsl", c.Func(c.Ffsl)}, + {"Ffsll", c.Func(c.Ffsll)}, + {"Fls", c.Func(c.Fls)}, + {"Flsl", c.Func(c.Flsl)}, + {"Flsll", c.Func(c.Flsll)}, + {"Renameat", c.Func(c.Renameat)}, + {"RenamexNp", c.Func(c.RenamexNp)}, + {"RenameatxNp", c.Func(c.RenameatxNp)}, + {"Ctermid", c.Func(c.Ctermid)}, + {"Localeconv", c.Func(c.Localeconv)}, +} + +var generatedVariableSymbols = []struct { + name string + address unsafe.Pointer +}{ + {"SysNerr", unsafe.Pointer(&c.SysNerr)}, + {"SysErrlist", unsafe.Pointer(&c.SysErrlist)}, + {"Suboptarg", unsafe.Pointer(&c.Suboptarg)}, +} + +var generatedLifecycleCalls = []struct { + name string + check func(*testing.T) +}{} + +// Expected values were compiled from the original macOS 14.0 / glibc 2.24 C headers. +var generatedIntegerConstants = []struct { + name string + got, want int64 +}{ + {"FNM_NOMATCH", int64(c.FNM_NOMATCH), 1}, + {"FNM_NOESCAPE", int64(c.FNM_NOESCAPE), 1}, + {"FNM_PATHNAME", int64(c.FNM_PATHNAME), 2}, + {"FNM_PERIOD", int64(c.FNM_PERIOD), 4}, + {"FNM_NOSYS", int64(c.FNM_NOSYS), -1}, + {"FNM_LEADING_DIR", int64(c.FNM_LEADING_DIR), 8}, + {"FNM_CASEFOLD", int64(c.FNM_CASEFOLD), 16}, + {"FNM_IGNORECASE", int64(c.FNM_IGNORECASE), 16}, + {"FNM_FILE_NAME", int64(c.FNM_FILE_NAME), 2}, + {"PTHREAD_DESTRUCTOR_ITERATIONS", int64(c.PTHREAD_DESTRUCTOR_ITERATIONS), 4}, + {"PTHREAD_KEYS_MAX", int64(c.PTHREAD_KEYS_MAX), 512}, + {"PTHREAD_STACK_MIN", int64(c.PTHREAD_STACK_MIN), 16384}, + {"PASS_MAX", int64(c.PASS_MAX), 128}, + {"NL_ARGMAX", int64(c.NL_ARGMAX), 9}, + {"NL_LANGMAX", int64(c.NL_LANGMAX), 14}, + {"NL_MSGMAX", int64(c.NL_MSGMAX), 32767}, + {"NL_NMAX", int64(c.NL_NMAX), 1}, + {"NL_SETMAX", int64(c.NL_SETMAX), 255}, + {"NL_TEXTMAX", int64(c.NL_TEXTMAX), 2048}, + {"IOV_MAX", int64(c.IOV_MAX), 1024}, + {"LC_ALL", int64(c.LC_ALL), 0}, + {"LC_COLLATE", int64(c.LC_COLLATE), 1}, + {"LC_CTYPE", int64(c.LC_CTYPE), 2}, + {"LC_MONETARY", int64(c.LC_MONETARY), 3}, + {"LC_NUMERIC", int64(c.LC_NUMERIC), 4}, + {"LC_TIME", int64(c.LC_TIME), 5}, + {"LC_MESSAGES", int64(c.LC_MESSAGES), 6}, + {"INT8_MAX", int64(c.INT8_MAX), 127}, + {"INT16_MAX", int64(c.INT16_MAX), 32767}, + {"INT32_MAX", int64(c.INT32_MAX), 2147483647}, + {"INT8_MIN", int64(c.INT8_MIN), -128}, + {"INT16_MIN", int64(c.INT16_MIN), -32768}, + {"INT32_MIN", int64(c.INT32_MIN), -2147483648}, + {"UINT8_MAX", int64(c.UINT8_MAX), 255}, + {"UINT16_MAX", int64(c.UINT16_MAX), 65535}, + {"INT_LEAST8_MIN", int64(c.INT_LEAST8_MIN), -128}, + {"INT_LEAST16_MIN", int64(c.INT_LEAST16_MIN), -32768}, + {"INT_LEAST32_MIN", int64(c.INT_LEAST32_MIN), -2147483648}, + {"INT_LEAST8_MAX", int64(c.INT_LEAST8_MAX), 127}, + {"INT_LEAST16_MAX", int64(c.INT_LEAST16_MAX), 32767}, + {"INT_LEAST32_MAX", int64(c.INT_LEAST32_MAX), 2147483647}, + {"UINT_LEAST8_MAX", int64(c.UINT_LEAST8_MAX), 255}, + {"UINT_LEAST16_MAX", int64(c.UINT_LEAST16_MAX), 65535}, + {"INT_FAST8_MIN", int64(c.INT_FAST8_MIN), -128}, + {"INT_FAST16_MIN", int64(c.INT_FAST16_MIN), -32768}, + {"INT_FAST32_MIN", int64(c.INT_FAST32_MIN), -2147483648}, + {"INT_FAST8_MAX", int64(c.INT_FAST8_MAX), 127}, + {"INT_FAST16_MAX", int64(c.INT_FAST16_MAX), 32767}, + {"INT_FAST32_MAX", int64(c.INT_FAST32_MAX), 2147483647}, + {"UINT_FAST8_MAX", int64(c.UINT_FAST8_MAX), 255}, + {"UINT_FAST16_MAX", int64(c.UINT_FAST16_MAX), 65535}, + {"WINT_MIN", int64(c.WINT_MIN), -2147483648}, + {"WINT_MAX", int64(c.WINT_MAX), 2147483647}, + {"SIG_ATOMIC_MIN", int64(c.SIG_ATOMIC_MIN), -2147483648}, + {"SIG_ATOMIC_MAX", int64(c.SIG_ATOMIC_MAX), 2147483647}, + {"BUFSIZ", int64(c.BUFSIZ), 1024}, + {"EOF", int64(c.EOF), -1}, + {"FOPEN_MAX", int64(c.FOPEN_MAX), 20}, + {"FILENAME_MAX", int64(c.FILENAME_MAX), 1024}, + {"LTmpnam", int64(c.LTmpnam), 1024}, + {"TMP_MAX", int64(c.TMP_MAX), 308915776}, + {"LCtermid", int64(c.LCtermid), 1024}, + {"EXIT_FAILURE", int64(c.EXIT_FAILURE), 1}, + {"EXIT_SUCCESS", int64(c.EXIT_SUCCESS), 0}, + {"RAND_MAX", int64(c.RAND_MAX), 2147483647}, + {"RENAME_SECLUDE", int64(c.RENAME_SECLUDE), 1}, + {"RENAME_SWAP", int64(c.RENAME_SWAP), 2}, + {"RENAME_EXCL", int64(c.RENAME_EXCL), 4}, + {"RENAME_RESERVED1", int64(c.RENAME_RESERVED1), 8}, + {"RENAME_NOFOLLOW_ANY", int64(c.RENAME_NOFOLLOW_ANY), 16}, +} +var generatedStringConstants = []struct{ name, got, want string }{ + {"PRId16", c.PRId16, "hd"}, + {"PRIi16", c.PRIi16, "hi"}, + {"PRIo16", c.PRIo16, "ho"}, + {"PRIu16", c.PRIu16, "hu"}, + {"PRIx16", c.PRIx16, "hx"}, + {"PRIX16", c.PRIX16, "hX"}, + {"PRId32", c.PRId32, "d"}, + {"PRIi32", c.PRIi32, "i"}, + {"PRIo32", c.PRIo32, "o"}, + {"PRIu32", c.PRIu32, "u"}, + {"PRIx32", c.PRIx32, "x"}, + {"PRIX32", c.PRIX32, "X"}, + {"PRIdLEAST16", c.PRIdLEAST16, "hd"}, + {"PRIiLEAST16", c.PRIiLEAST16, "hi"}, + {"PRIoLEAST16", c.PRIoLEAST16, "ho"}, + {"PRIuLEAST16", c.PRIuLEAST16, "hu"}, + {"PRIxLEAST16", c.PRIxLEAST16, "hx"}, + {"PRIXLEAST16", c.PRIXLEAST16, "hX"}, + {"PRIdLEAST32", c.PRIdLEAST32, "d"}, + {"PRIiLEAST32", c.PRIiLEAST32, "i"}, + {"PRIoLEAST32", c.PRIoLEAST32, "o"}, + {"PRIuLEAST32", c.PRIuLEAST32, "u"}, + {"PRIxLEAST32", c.PRIxLEAST32, "x"}, + {"PRIXLEAST32", c.PRIXLEAST32, "X"}, + {"PRIdFAST16", c.PRIdFAST16, "hd"}, + {"PRIiFAST16", c.PRIiFAST16, "hi"}, + {"PRIoFAST16", c.PRIoFAST16, "ho"}, + {"PRIuFAST16", c.PRIuFAST16, "hu"}, + {"PRIxFAST16", c.PRIxFAST16, "hx"}, + {"PRIXFAST16", c.PRIXFAST16, "hX"}, + {"PRIdFAST32", c.PRIdFAST32, "d"}, + {"PRIiFAST32", c.PRIiFAST32, "i"}, + {"PRIoFAST32", c.PRIoFAST32, "o"}, + {"PRIuFAST32", c.PRIuFAST32, "u"}, + {"PRIxFAST32", c.PRIxFAST32, "x"}, + {"PRIXFAST32", c.PRIXFAST32, "X"}, + {"PRIdPTR", c.PRIdPTR, "ld"}, + {"PRIiPTR", c.PRIiPTR, "li"}, + {"PRIoPTR", c.PRIoPTR, "lo"}, + {"PRIuPTR", c.PRIuPTR, "lu"}, + {"PRIxPTR", c.PRIxPTR, "lx"}, + {"PRIXPTR", c.PRIXPTR, "lX"}, + {"SCNd16", c.SCNd16, "hd"}, + {"SCNi16", c.SCNi16, "hi"}, + {"SCNo16", c.SCNo16, "ho"}, + {"SCNu16", c.SCNu16, "hu"}, + {"SCNx16", c.SCNx16, "hx"}, + {"SCNd32", c.SCNd32, "d"}, + {"SCNi32", c.SCNi32, "i"}, + {"SCNo32", c.SCNo32, "o"}, + {"SCNu32", c.SCNu32, "u"}, + {"SCNx32", c.SCNx32, "x"}, + {"SCNdLEAST16", c.SCNdLEAST16, "hd"}, + {"SCNiLEAST16", c.SCNiLEAST16, "hi"}, + {"SCNoLEAST16", c.SCNoLEAST16, "ho"}, + {"SCNuLEAST16", c.SCNuLEAST16, "hu"}, + {"SCNxLEAST16", c.SCNxLEAST16, "hx"}, + {"SCNdLEAST32", c.SCNdLEAST32, "d"}, + {"SCNiLEAST32", c.SCNiLEAST32, "i"}, + {"SCNoLEAST32", c.SCNoLEAST32, "o"}, + {"SCNuLEAST32", c.SCNuLEAST32, "u"}, + {"SCNxLEAST32", c.SCNxLEAST32, "x"}, + {"SCNdFAST16", c.SCNdFAST16, "hd"}, + {"SCNiFAST16", c.SCNiFAST16, "hi"}, + {"SCNoFAST16", c.SCNoFAST16, "ho"}, + {"SCNuFAST16", c.SCNuFAST16, "hu"}, + {"SCNxFAST16", c.SCNxFAST16, "hx"}, + {"SCNdFAST32", c.SCNdFAST32, "d"}, + {"SCNiFAST32", c.SCNiFAST32, "i"}, + {"SCNoFAST32", c.SCNoFAST32, "o"}, + {"SCNuFAST32", c.SCNuFAST32, "u"}, + {"SCNxFAST32", c.SCNxFAST32, "x"}, + {"SCNdPTR", c.SCNdPTR, "ld"}, + {"SCNiPTR", c.SCNiPTR, "li"}, + {"SCNoPTR", c.SCNoPTR, "lo"}, + {"SCNuPTR", c.SCNuPTR, "lu"}, + {"SCNxPTR", c.SCNxPTR, "lx"}, + {"PTmpdir", c.PTmpdir, "/var/tmp/"}, +} +var generatedTypeLayouts = []struct { + symbol, property string + got, want uintptr +}{ + {"ImaxdivT", "size", unsafe.Sizeof(*new(c.ImaxdivT)), 16}, + {"ImaxdivT", "align", unsafe.Alignof(*new(c.ImaxdivT)), 8}, + {"ImaxdivT", "Quot.offset", unsafe.Offsetof((*new(c.ImaxdivT)).Quot), 0}, + {"ImaxdivT", "Quot.width", unsafe.Sizeof((*new(c.ImaxdivT)).Quot), 8}, + {"ImaxdivT", "Rem.offset", unsafe.Offsetof((*new(c.ImaxdivT)).Rem), 8}, + {"ImaxdivT", "Rem.width", unsafe.Sizeof((*new(c.ImaxdivT)).Rem), 8}, + {"X_mallocZoneT", "pointer_size", unsafe.Sizeof(*new(*c.X_mallocZoneT)), 8}, + {"X_mallocZoneT", "pointer_align", unsafe.Alignof(*new(*c.X_mallocZoneT)), 8}, + {"MallocZoneT", "pointer_size", unsafe.Sizeof(*new(*c.MallocZoneT)), 8}, + {"MallocZoneT", "pointer_align", unsafe.Alignof(*new(*c.MallocZoneT)), 8}, + {"Lconv", "size", unsafe.Sizeof(*new(c.Lconv)), 96}, + {"Lconv", "align", unsafe.Alignof(*new(c.Lconv)), 8}, + {"Lconv", "DecimalPoint.offset", unsafe.Offsetof((*new(c.Lconv)).DecimalPoint), 0}, + {"Lconv", "DecimalPoint.width", unsafe.Sizeof((*new(c.Lconv)).DecimalPoint), 8}, + {"Lconv", "ThousandsSep.offset", unsafe.Offsetof((*new(c.Lconv)).ThousandsSep), 8}, + {"Lconv", "ThousandsSep.width", unsafe.Sizeof((*new(c.Lconv)).ThousandsSep), 8}, + {"Lconv", "Grouping.offset", unsafe.Offsetof((*new(c.Lconv)).Grouping), 16}, + {"Lconv", "Grouping.width", unsafe.Sizeof((*new(c.Lconv)).Grouping), 8}, + {"Lconv", "IntCurrSymbol.offset", unsafe.Offsetof((*new(c.Lconv)).IntCurrSymbol), 24}, + {"Lconv", "IntCurrSymbol.width", unsafe.Sizeof((*new(c.Lconv)).IntCurrSymbol), 8}, + {"Lconv", "CurrencySymbol.offset", unsafe.Offsetof((*new(c.Lconv)).CurrencySymbol), 32}, + {"Lconv", "CurrencySymbol.width", unsafe.Sizeof((*new(c.Lconv)).CurrencySymbol), 8}, + {"Lconv", "MonDecimalPoint.offset", unsafe.Offsetof((*new(c.Lconv)).MonDecimalPoint), 40}, + {"Lconv", "MonDecimalPoint.width", unsafe.Sizeof((*new(c.Lconv)).MonDecimalPoint), 8}, + {"Lconv", "MonThousandsSep.offset", unsafe.Offsetof((*new(c.Lconv)).MonThousandsSep), 48}, + {"Lconv", "MonThousandsSep.width", unsafe.Sizeof((*new(c.Lconv)).MonThousandsSep), 8}, + {"Lconv", "MonGrouping.offset", unsafe.Offsetof((*new(c.Lconv)).MonGrouping), 56}, + {"Lconv", "MonGrouping.width", unsafe.Sizeof((*new(c.Lconv)).MonGrouping), 8}, + {"Lconv", "PositiveSign.offset", unsafe.Offsetof((*new(c.Lconv)).PositiveSign), 64}, + {"Lconv", "PositiveSign.width", unsafe.Sizeof((*new(c.Lconv)).PositiveSign), 8}, + {"Lconv", "NegativeSign.offset", unsafe.Offsetof((*new(c.Lconv)).NegativeSign), 72}, + {"Lconv", "NegativeSign.width", unsafe.Sizeof((*new(c.Lconv)).NegativeSign), 8}, + {"Lconv", "IntFracDigits.offset", unsafe.Offsetof((*new(c.Lconv)).IntFracDigits), 80}, + {"Lconv", "IntFracDigits.width", unsafe.Sizeof((*new(c.Lconv)).IntFracDigits), 1}, + {"Lconv", "FracDigits.offset", unsafe.Offsetof((*new(c.Lconv)).FracDigits), 81}, + {"Lconv", "FracDigits.width", unsafe.Sizeof((*new(c.Lconv)).FracDigits), 1}, + {"Lconv", "PCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).PCsPrecedes), 82}, + {"Lconv", "PCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).PCsPrecedes), 1}, + {"Lconv", "PSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).PSepBySpace), 83}, + {"Lconv", "PSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).PSepBySpace), 1}, + {"Lconv", "NCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).NCsPrecedes), 84}, + {"Lconv", "NCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).NCsPrecedes), 1}, + {"Lconv", "NSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).NSepBySpace), 85}, + {"Lconv", "NSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).NSepBySpace), 1}, + {"Lconv", "PSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).PSignPosn), 86}, + {"Lconv", "PSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).PSignPosn), 1}, + {"Lconv", "NSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).NSignPosn), 87}, + {"Lconv", "NSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).NSignPosn), 1}, + {"Lconv", "IntPCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).IntPCsPrecedes), 88}, + {"Lconv", "IntPCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).IntPCsPrecedes), 1}, + {"Lconv", "IntNCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).IntNCsPrecedes), 89}, + {"Lconv", "IntNCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).IntNCsPrecedes), 1}, + {"Lconv", "IntPSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).IntPSepBySpace), 90}, + {"Lconv", "IntPSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).IntPSepBySpace), 1}, + {"Lconv", "IntNSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).IntNSepBySpace), 91}, + {"Lconv", "IntNSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).IntNSepBySpace), 1}, + {"Lconv", "IntPSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).IntPSignPosn), 92}, + {"Lconv", "IntPSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).IntPSignPosn), 1}, + {"Lconv", "IntNSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).IntNSignPosn), 93}, + {"Lconv", "IntNSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).IntNSignPosn), 1}, + {"Iovec", "size", unsafe.Sizeof(*new(c.Iovec)), 16}, + {"Iovec", "align", unsafe.Alignof(*new(c.Iovec)), 8}, + {"Iovec", "IovBase.offset", unsafe.Offsetof((*new(c.Iovec)).IovBase), 0}, + {"Iovec", "IovBase.width", unsafe.Sizeof((*new(c.Iovec)).IovBase), 8}, + {"Iovec", "IovLen.offset", unsafe.Offsetof((*new(c.Iovec)).IovLen), 8}, + {"Iovec", "IovLen.width", unsafe.Sizeof((*new(c.Iovec)).IovLen), 8}, +} + +var generatedAccessorSymbols = []string{} + +// Each slot is classified by Clang from the original native C prototype. +var generatedFunctionPrototypes = []struct { + name string + signature reflect.Type + variadic bool + inputs []nativeABISlot + output *nativeABISlot +}{ + {"Fnmatch", reflect.TypeOf(c.Fnmatch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Imaxabs", reflect.TypeOf(c.Imaxabs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Imaxdiv", reflect.TypeOf(c.Imaxdiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Strtoimax", reflect.TypeOf(c.Strtoimax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoumax", reflect.TypeOf(c.Strtoumax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstoimax", reflect.TypeOf(c.Wcstoimax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstoumax", reflect.TypeOf(c.Wcstoumax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Basename", reflect.TypeOf(c.Basename), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Dirname", reflect.TypeOf(c.Dirname), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"BasenameR", reflect.TypeOf(c.BasenameR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"DirnameR", reflect.TypeOf(c.DirnameR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setlocale", reflect.TypeOf(c.Setlocale), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Valloc", reflect.TypeOf(c.Valloc), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"AlignedAlloc", reflect.TypeOf(c.AlignedAlloc), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"PosixMemalign", reflect.TypeOf(c.PosixMemalign), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Clearerr", reflect.TypeOf(c.Clearerr), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Feof", reflect.TypeOf(c.Feof), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ferror", reflect.TypeOf(c.Ferror), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgetc", reflect.TypeOf(c.Fgetc), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgetpos", reflect.TypeOf(c.Fgetpos), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgets", reflect.TypeOf(c.Fgets), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Freopen", reflect.TypeOf(c.Freopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fscanf", reflect.TypeOf(c.Fscanf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fseek", reflect.TypeOf(c.Fseek), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Fsetpos", reflect.TypeOf(c.Fsetpos), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ftell", reflect.TypeOf(c.Ftell), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Getc", reflect.TypeOf(c.Getc), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getchar", reflect.TypeOf(c.Getchar), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"Gets", reflect.TypeOf(c.Gets), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Putc", reflect.TypeOf(c.Putc), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putchar", reflect.TypeOf(c.Putchar), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Puts", reflect.TypeOf(c.Puts), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Rewind", reflect.TypeOf(c.Rewind), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Scanf", reflect.TypeOf(c.Scanf), true, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Setbuf", reflect.TypeOf(c.Setbuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, nil}, + {"Setvbuf", reflect.TypeOf(c.Setvbuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Sscanf", reflect.TypeOf(c.Sscanf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Tmpfile", reflect.TypeOf(c.Tmpfile), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"Tmpnam", reflect.TypeOf(c.Tmpnam), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Ungetc", reflect.TypeOf(c.Ungetc), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fdopen", reflect.TypeOf(c.Fdopen), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fileno", reflect.TypeOf(c.Fileno), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Pclose", reflect.TypeOf(c.Pclose), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Popen", reflect.TypeOf(c.Popen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Flockfile", reflect.TypeOf(c.Flockfile), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Ftrylockfile", reflect.TypeOf(c.Ftrylockfile), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Funlockfile", reflect.TypeOf(c.Funlockfile), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"GetcUnlocked", reflect.TypeOf(c.GetcUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"GetcharUnlocked", reflect.TypeOf(c.GetcharUnlocked), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"PutcUnlocked", reflect.TypeOf(c.PutcUnlocked), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"PutcharUnlocked", reflect.TypeOf(c.PutcharUnlocked), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Getw", reflect.TypeOf(c.Getw), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putw", reflect.TypeOf(c.Putw), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Tempnam", reflect.TypeOf(c.Tempnam), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fseeko", reflect.TypeOf(c.Fseeko), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ftello", reflect.TypeOf(c.Ftello), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Dprintf", reflect.TypeOf(c.Dprintf), true, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getdelim", reflect.TypeOf(c.Getdelim), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Getline", reflect.TypeOf(c.Getline), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Fmemopen", reflect.TypeOf(c.Fmemopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"OpenMemstream", reflect.TypeOf(c.OpenMemstream), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Asprintf", reflect.TypeOf(c.Asprintf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"CtermidR", reflect.TypeOf(c.CtermidR), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fgetln", reflect.TypeOf(c.Fgetln), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fmtcheck", reflect.TypeOf(c.Fmtcheck), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fpurge", reflect.TypeOf(c.Fpurge), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Setbuffer", reflect.TypeOf(c.Setbuffer), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, nil}, + {"Setlinebuf", reflect.TypeOf(c.Setlinebuf), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Funopen", reflect.TypeOf(c.Funopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Abort", reflect.TypeOf(c.Abort), false, []nativeABISlot{}, nil}, + {"Abs", reflect.TypeOf(c.Abs), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Atexit", reflect.TypeOf(c.Atexit), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Atof", reflect.TypeOf(c.Atof), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Atol", reflect.TypeOf(c.Atol), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Atoll", reflect.TypeOf(c.Atoll), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Bsearch", reflect.TypeOf(c.Bsearch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Div", reflect.TypeOf(c.Div), false, []nativeABISlot{{4, 4, 1}, {4, 4, 1}}, &nativeABISlot{8, 4, 12}}, + {"Labs", reflect.TypeOf(c.Labs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Ldiv", reflect.TypeOf(c.Ldiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Llabs", reflect.TypeOf(c.Llabs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Lldiv", reflect.TypeOf(c.Lldiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Mblen", reflect.TypeOf(c.Mblen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mbstowcs", reflect.TypeOf(c.Mbstowcs), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Mbtowc", reflect.TypeOf(c.Mbtowc), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Srand", reflect.TypeOf(c.Srand), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Strtod", reflect.TypeOf(c.Strtod), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Strtof", reflect.TypeOf(c.Strtof), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 8}}, + {"Strtol", reflect.TypeOf(c.Strtol), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtold", reflect.TypeOf(c.Strtold), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Strtoll", reflect.TypeOf(c.Strtoll), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoul", reflect.TypeOf(c.Strtoul), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoull", reflect.TypeOf(c.Strtoull), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"System", reflect.TypeOf(c.System), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Wcstombs", reflect.TypeOf(c.Wcstombs), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wctomb", reflect.TypeOf(c.Wctomb), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"X_Exit", reflect.TypeOf(c.X_Exit), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"A64l", reflect.TypeOf(c.A64l), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Drand48", reflect.TypeOf(c.Drand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 8}}, + {"Ecvt", reflect.TypeOf(c.Ecvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Erand48", reflect.TypeOf(c.Erand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Fcvt", reflect.TypeOf(c.Fcvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Gcvt", reflect.TypeOf(c.Gcvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Getsubopt", reflect.TypeOf(c.Getsubopt), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Grantpt", reflect.TypeOf(c.Grantpt), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Initstate", reflect.TypeOf(c.Initstate), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Jrand48", reflect.TypeOf(c.Jrand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"L64a", reflect.TypeOf(c.L64a), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Lcong48", reflect.TypeOf(c.Lcong48), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Lrand48", reflect.TypeOf(c.Lrand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Mktemp", reflect.TypeOf(c.Mktemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Mkstemp", reflect.TypeOf(c.Mkstemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Mrand48", reflect.TypeOf(c.Mrand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Nrand48", reflect.TypeOf(c.Nrand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"PosixOpenpt", reflect.TypeOf(c.PosixOpenpt), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ptsname", reflect.TypeOf(c.Ptsname), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"PtsnameR", reflect.TypeOf(c.PtsnameR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Random", reflect.TypeOf(c.Random), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"RandR", reflect.TypeOf(c.RandR), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Realpath", reflect.TypeOf(c.Realpath), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Seed48", reflect.TypeOf(c.Seed48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setkey", reflect.TypeOf(c.Setkey), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Setstate", reflect.TypeOf(c.Setstate), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Srand48", reflect.TypeOf(c.Srand48), false, []nativeABISlot{{8, 8, 1}}, nil}, + {"Srandom", reflect.TypeOf(c.Srandom), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Unlockpt", reflect.TypeOf(c.Unlockpt), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Arc4random", reflect.TypeOf(c.Arc4random), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"Arc4randomAddrandom", reflect.TypeOf(c.Arc4randomAddrandom), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, nil}, + {"Arc4randomBuf", reflect.TypeOf(c.Arc4randomBuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, nil}, + {"Arc4randomStir", reflect.TypeOf(c.Arc4randomStir), false, []nativeABISlot{}, nil}, + {"Arc4randomUniform", reflect.TypeOf(c.Arc4randomUniform), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Cgetcap", reflect.TypeOf(c.Cgetcap), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Cgetclose", reflect.TypeOf(c.Cgetclose), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"Cgetent", reflect.TypeOf(c.Cgetent), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetfirst", reflect.TypeOf(c.Cgetfirst), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetmatch", reflect.TypeOf(c.Cgetmatch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetnext", reflect.TypeOf(c.Cgetnext), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetnum", reflect.TypeOf(c.Cgetnum), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetset", reflect.TypeOf(c.Cgetset), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetstr", reflect.TypeOf(c.Cgetstr), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cgetustr", reflect.TypeOf(c.Cgetustr), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Daemon", reflect.TypeOf(c.Daemon), false, []nativeABISlot{{4, 4, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Devname", reflect.TypeOf(c.Devname), false, []nativeABISlot{{4, 4, 1}, {2, 2, 1}}, &nativeABISlot{8, 8, 5}}, + {"DevnameR", reflect.TypeOf(c.DevnameR), false, []nativeABISlot{{4, 4, 1}, {2, 2, 1}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Getbsize", reflect.TypeOf(c.Getbsize), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Getloadavg", reflect.TypeOf(c.Getloadavg), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Getprogname", reflect.TypeOf(c.Getprogname), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"Setprogname", reflect.TypeOf(c.Setprogname), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Heapsort", reflect.TypeOf(c.Heapsort), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Mergesort", reflect.TypeOf(c.Mergesort), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Psort", reflect.TypeOf(c.Psort), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, nil}, + {"PsortR", reflect.TypeOf(c.PsortR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, nil}, + {"QsortR", reflect.TypeOf(c.QsortR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}, {8, 8, 5}}, nil}, + {"Radixsort", reflect.TypeOf(c.Radixsort), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Rpmatch", reflect.TypeOf(c.Rpmatch), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Sradixsort", reflect.TypeOf(c.Sradixsort), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Sranddev", reflect.TypeOf(c.Sranddev), false, []nativeABISlot{}, nil}, + {"Srandomdev", reflect.TypeOf(c.Srandomdev), false, []nativeABISlot{}, nil}, + {"Reallocf", reflect.TypeOf(c.Reallocf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Strtonum", reflect.TypeOf(c.Strtonum), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strtoq", reflect.TypeOf(c.Strtoq), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtouq", reflect.TypeOf(c.Strtouq), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strcoll", reflect.TypeOf(c.Strcoll), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Strcspn", reflect.TypeOf(c.Strcspn), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strpbrk", reflect.TypeOf(c.Strpbrk), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Strspn", reflect.TypeOf(c.Strspn), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strxfrm", reflect.TypeOf(c.Strxfrm), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"StrtokR", reflect.TypeOf(c.StrtokR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"StrerrorR", reflect.TypeOf(c.StrerrorR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Memccpy", reflect.TypeOf(c.Memccpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Stpcpy", reflect.TypeOf(c.Stpcpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Stpncpy", reflect.TypeOf(c.Stpncpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Strnlen", reflect.TypeOf(c.Strnlen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strsignal", reflect.TypeOf(c.Strsignal), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"MemsetS", reflect.TypeOf(c.MemsetS), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Memmem", reflect.TypeOf(c.Memmem), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"MemsetPattern4", reflect.TypeOf(c.MemsetPattern4), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"MemsetPattern8", reflect.TypeOf(c.MemsetPattern8), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"MemsetPattern16", reflect.TypeOf(c.MemsetPattern16), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"Strcasestr", reflect.TypeOf(c.Strcasestr), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Strnstr", reflect.TypeOf(c.Strnstr), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Strlcat", reflect.TypeOf(c.Strlcat), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strlcpy", reflect.TypeOf(c.Strlcpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strmode", reflect.TypeOf(c.Strmode), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, nil}, + {"Strsep", reflect.TypeOf(c.Strsep), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Swab", reflect.TypeOf(c.Swab), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"TimingsafeBcmp", reflect.TypeOf(c.TimingsafeBcmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"StrsignalR", reflect.TypeOf(c.StrsignalR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Bcmp", reflect.TypeOf(c.Bcmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Bcopy", reflect.TypeOf(c.Bcopy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"Bzero", reflect.TypeOf(c.Bzero), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, nil}, + {"Rindex", reflect.TypeOf(c.Rindex), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Ffs", reflect.TypeOf(c.Ffs), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Strcasecmp", reflect.TypeOf(c.Strcasecmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Strncasecmp", reflect.TypeOf(c.Strncasecmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ffsl", reflect.TypeOf(c.Ffsl), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ffsll", reflect.TypeOf(c.Ffsll), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Fls", reflect.TypeOf(c.Fls), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Flsl", reflect.TypeOf(c.Flsl), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Flsll", reflect.TypeOf(c.Flsll), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Renameat", reflect.TypeOf(c.Renameat), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"RenamexNp", reflect.TypeOf(c.RenamexNp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"RenameatxNp", reflect.TypeOf(c.RenameatxNp), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ctermid", reflect.TypeOf(c.Ctermid), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Localeconv", reflect.TypeOf(c.Localeconv), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, +} diff --git a/c/libc_native_linux_amd64_llgo_test.go b/c/libc_native_linux_amd64_llgo_test.go new file mode 100644 index 00000000..85f1f7cf --- /dev/null +++ b/c/libc_native_linux_amd64_llgo_test.go @@ -0,0 +1,881 @@ +//go:build llgo && linux && amd64 && !android + +package c_test + +import ( + "github.com/goplus/lib/c" + "reflect" + "testing" + "unsafe" +) + +type nativeChar = c.Char +type nativeWide = c.Int +type nativeFilePosition = c.FposT + +const nativeFilePositionSize = 16 + +// This table deliberately takes every new C symbol address so the linker must resolve it. +var generatedFunctionSymbols = []struct { + name string + address unsafe.Pointer +}{ + {"Isalnum", c.Func(c.Isalnum)}, + {"Isalpha", c.Func(c.Isalpha)}, + {"Iscntrl", c.Func(c.Iscntrl)}, + {"Isdigit", c.Func(c.Isdigit)}, + {"Islower", c.Func(c.Islower)}, + {"Isgraph", c.Func(c.Isgraph)}, + {"Isprint", c.Func(c.Isprint)}, + {"Ispunct", c.Func(c.Ispunct)}, + {"Isspace", c.Func(c.Isspace)}, + {"Isupper", c.Func(c.Isupper)}, + {"Isxdigit", c.Func(c.Isxdigit)}, + {"Tolower", c.Func(c.Tolower)}, + {"Toupper", c.Func(c.Toupper)}, + {"Isblank", c.Func(c.Isblank)}, + {"Isascii", c.Func(c.Isascii)}, + {"Toascii", c.Func(c.Toascii)}, + {"X_toupper", c.Func(c.X_toupper)}, + {"X_tolower", c.Func(c.X_tolower)}, + {"IsalnumL", c.Func(c.IsalnumL)}, + {"IsalphaL", c.Func(c.IsalphaL)}, + {"IscntrlL", c.Func(c.IscntrlL)}, + {"IsdigitL", c.Func(c.IsdigitL)}, + {"IslowerL", c.Func(c.IslowerL)}, + {"IsgraphL", c.Func(c.IsgraphL)}, + {"IsprintL", c.Func(c.IsprintL)}, + {"IspunctL", c.Func(c.IspunctL)}, + {"IsspaceL", c.Func(c.IsspaceL)}, + {"IsupperL", c.Func(c.IsupperL)}, + {"IsxdigitL", c.Func(c.IsxdigitL)}, + {"IsblankL", c.Func(c.IsblankL)}, + {"TolowerL", c.Func(c.TolowerL)}, + {"ToupperL", c.Func(c.ToupperL)}, + {"Fnmatch", c.Func(c.Fnmatch)}, + {"Imaxabs", c.Func(c.Imaxabs)}, + {"Imaxdiv", c.Func(c.Imaxdiv)}, + {"Strtoimax", c.Func(c.Strtoimax)}, + {"Strtoumax", c.Func(c.Strtoumax)}, + {"Wcstoimax", c.Func(c.Wcstoimax)}, + {"Wcstoumax", c.Func(c.Wcstoumax)}, + {"Dirname", c.Func(c.Dirname)}, + {"X__XpgBasename", c.Func(c.X__XpgBasename)}, + {"Setlocale", c.Func(c.Setlocale)}, + {"Localeconv", c.Func(c.Localeconv)}, + {"Newlocale", c.Func(c.Newlocale)}, + {"X__LocaleT.Duplocale", c.Func((c.X__LocaleT).Duplocale)}, + {"X__LocaleT.Freelocale", c.Func((c.X__LocaleT).Freelocale)}, + {"X__LocaleT.Uselocale", c.Func((c.X__LocaleT).Uselocale)}, + {"Setrpcent", c.Func(c.Setrpcent)}, + {"Endrpcent", c.Func(c.Endrpcent)}, + {"Getrpcbyname", c.Func(c.Getrpcbyname)}, + {"Getrpcbynumber", c.Func(c.Getrpcbynumber)}, + {"Getrpcent", c.Func(c.Getrpcent)}, + {"GetrpcbynameR", c.Func(c.GetrpcbynameR)}, + {"GetrpcbynumberR", c.Func(c.GetrpcbynumberR)}, + {"*Rpcent.GetrpcentR", c.Func((*c.Rpcent).GetrpcentR)}, + {"Renameat", c.Func(c.Renameat)}, + {"Tmpfile", c.Func(c.Tmpfile)}, + {"Tmpnam", c.Func(c.Tmpnam)}, + {"TmpnamR", c.Func(c.TmpnamR)}, + {"Tempnam", c.Func(c.Tempnam)}, + {"FflushUnlocked", c.Func(c.FflushUnlocked)}, + {"Freopen", c.Func(c.Freopen)}, + {"Fdopen", c.Func(c.Fdopen)}, + {"Fmemopen", c.Func(c.Fmemopen)}, + {"OpenMemstream", c.Func(c.OpenMemstream)}, + {"Setbuf", c.Func(c.Setbuf)}, + {"Setvbuf", c.Func(c.Setvbuf)}, + {"Setbuffer", c.Func(c.Setbuffer)}, + {"Setlinebuf", c.Func(c.Setlinebuf)}, + {"Dprintf", c.Func(c.Dprintf)}, + {"Fscanf", c.Func(c.Fscanf)}, + {"Scanf", c.Func(c.Scanf)}, + {"Sscanf", c.Func(c.Sscanf)}, + {"Fgetc", c.Func(c.Fgetc)}, + {"Getc", c.Func(c.Getc)}, + {"Getchar", c.Func(c.Getchar)}, + {"GetcUnlocked", c.Func(c.GetcUnlocked)}, + {"GetcharUnlocked", c.Func(c.GetcharUnlocked)}, + {"FgetcUnlocked", c.Func(c.FgetcUnlocked)}, + {"Putc", c.Func(c.Putc)}, + {"Putchar", c.Func(c.Putchar)}, + {"FputcUnlocked", c.Func(c.FputcUnlocked)}, + {"PutcUnlocked", c.Func(c.PutcUnlocked)}, + {"PutcharUnlocked", c.Func(c.PutcharUnlocked)}, + {"Getw", c.Func(c.Getw)}, + {"Putw", c.Func(c.Putw)}, + {"Fgets", c.Func(c.Fgets)}, + {"Getdelim", c.Func(c.Getdelim)}, + {"Getline", c.Func(c.Getline)}, + {"Puts", c.Func(c.Puts)}, + {"Ungetc", c.Func(c.Ungetc)}, + {"FreadUnlocked", c.Func(c.FreadUnlocked)}, + {"FwriteUnlocked", c.Func(c.FwriteUnlocked)}, + {"Fseek", c.Func(c.Fseek)}, + {"Ftell", c.Func(c.Ftell)}, + {"Rewind", c.Func(c.Rewind)}, + {"Fseeko", c.Func(c.Fseeko)}, + {"Ftello", c.Func(c.Ftello)}, + {"Fgetpos", c.Func(c.Fgetpos)}, + {"Fsetpos", c.Func(c.Fsetpos)}, + {"Clearerr", c.Func(c.Clearerr)}, + {"Feof", c.Func(c.Feof)}, + {"Ferror", c.Func(c.Ferror)}, + {"ClearerrUnlocked", c.Func(c.ClearerrUnlocked)}, + {"FeofUnlocked", c.Func(c.FeofUnlocked)}, + {"FerrorUnlocked", c.Func(c.FerrorUnlocked)}, + {"Fileno", c.Func(c.Fileno)}, + {"FilenoUnlocked", c.Func(c.FilenoUnlocked)}, + {"Popen", c.Func(c.Popen)}, + {"Pclose", c.Func(c.Pclose)}, + {"Ctermid", c.Func(c.Ctermid)}, + {"Flockfile", c.Func(c.Flockfile)}, + {"Ftrylockfile", c.Func(c.Ftrylockfile)}, + {"Funlockfile", c.Func(c.Funlockfile)}, + {"Atof", c.Func(c.Atof)}, + {"Atol", c.Func(c.Atol)}, + {"Atoll", c.Func(c.Atoll)}, + {"Strtod", c.Func(c.Strtod)}, + {"Strtof", c.Func(c.Strtof)}, + {"Strtol", c.Func(c.Strtol)}, + {"Strtoul", c.Func(c.Strtoul)}, + {"Strtoq", c.Func(c.Strtoq)}, + {"Strtouq", c.Func(c.Strtouq)}, + {"Strtoll", c.Func(c.Strtoll)}, + {"Strtoull", c.Func(c.Strtoull)}, + {"L64a", c.Func(c.L64a)}, + {"A64l", c.Func(c.A64l)}, + {"Random", c.Func(c.Random)}, + {"Srandom", c.Func(c.Srandom)}, + {"Initstate", c.Func(c.Initstate)}, + {"Setstate", c.Func(c.Setstate)}, + {"*RandomData.RandomR", c.Func((*c.RandomData).RandomR)}, + {"SrandomR", c.Func(c.SrandomR)}, + {"InitstateR", c.Func(c.InitstateR)}, + {"SetstateR", c.Func(c.SetstateR)}, + {"Srand", c.Func(c.Srand)}, + {"RandR", c.Func(c.RandR)}, + {"Drand48", c.Func(c.Drand48)}, + {"Erand48", c.Func(c.Erand48)}, + {"Lrand48", c.Func(c.Lrand48)}, + {"Nrand48", c.Func(c.Nrand48)}, + {"Mrand48", c.Func(c.Mrand48)}, + {"Jrand48", c.Func(c.Jrand48)}, + {"Srand48", c.Func(c.Srand48)}, + {"Seed48", c.Func(c.Seed48)}, + {"Lcong48", c.Func(c.Lcong48)}, + {"*Drand48Data.Drand48R", c.Func((*c.Drand48Data).Drand48R)}, + {"Erand48R", c.Func(c.Erand48R)}, + {"*Drand48Data.Lrand48R", c.Func((*c.Drand48Data).Lrand48R)}, + {"Nrand48R", c.Func(c.Nrand48R)}, + {"*Drand48Data.Mrand48R", c.Func((*c.Drand48Data).Mrand48R)}, + {"Jrand48R", c.Func(c.Jrand48R)}, + {"Srand48R", c.Func(c.Srand48R)}, + {"Seed48R", c.Func(c.Seed48R)}, + {"Lcong48R", c.Func(c.Lcong48R)}, + {"Cfree", c.Func(c.Cfree)}, + {"Valloc", c.Func(c.Valloc)}, + {"PosixMemalign", c.Func(c.PosixMemalign)}, + {"AlignedAlloc", c.Func(c.AlignedAlloc)}, + {"Abort", c.Func(c.Abort)}, + {"Atexit", c.Func(c.Atexit)}, + {"AtQuickExit", c.Func(c.AtQuickExit)}, + {"OnExit", c.Func(c.OnExit)}, + {"QuickExit", c.Func(c.QuickExit)}, + {"X_Exit", c.Func(c.X_Exit)}, + {"Mktemp", c.Func(c.Mktemp)}, + {"Mkstemp", c.Func(c.Mkstemp)}, + {"Mkstemps", c.Func(c.Mkstemps)}, + {"Mkdtemp", c.Func(c.Mkdtemp)}, + {"System", c.Func(c.System)}, + {"Realpath", c.Func(c.Realpath)}, + {"Bsearch", c.Func(c.Bsearch)}, + {"Abs", c.Func(c.Abs)}, + {"Labs", c.Func(c.Labs)}, + {"Llabs", c.Func(c.Llabs)}, + {"Div", c.Func(c.Div)}, + {"Ldiv", c.Func(c.Ldiv)}, + {"Lldiv", c.Func(c.Lldiv)}, + {"Ecvt", c.Func(c.Ecvt)}, + {"Fcvt", c.Func(c.Fcvt)}, + {"Gcvt", c.Func(c.Gcvt)}, + {"EcvtR", c.Func(c.EcvtR)}, + {"FcvtR", c.Func(c.FcvtR)}, + {"Mblen", c.Func(c.Mblen)}, + {"Mbtowc", c.Func(c.Mbtowc)}, + {"Wctomb", c.Func(c.Wctomb)}, + {"Mbstowcs", c.Func(c.Mbstowcs)}, + {"Wcstombs", c.Func(c.Wcstombs)}, + {"Rpmatch", c.Func(c.Rpmatch)}, + {"Getsubopt", c.Func(c.Getsubopt)}, + {"Getloadavg", c.Func(c.Getloadavg)}, + {"Memccpy", c.Func(c.Memccpy)}, + {"Strcoll", c.Func(c.Strcoll)}, + {"Strxfrm", c.Func(c.Strxfrm)}, + {"StrcollL", c.Func(c.StrcollL)}, + {"StrxfrmL", c.Func(c.StrxfrmL)}, + {"Strcspn", c.Func(c.Strcspn)}, + {"Strspn", c.Func(c.Strspn)}, + {"Strpbrk", c.Func(c.Strpbrk)}, + {"StrtokR", c.Func(c.StrtokR)}, + {"Strnlen", c.Func(c.Strnlen)}, + {"StrerrorR", c.Func(c.StrerrorR)}, + {"StrerrorL", c.Func(c.StrerrorL)}, + {"Bcopy", c.Func(c.Bcopy)}, + {"Bzero", c.Func(c.Bzero)}, + {"Bcmp", c.Func(c.Bcmp)}, + {"Rindex", c.Func(c.Rindex)}, + {"Ffs", c.Func(c.Ffs)}, + {"Strcasecmp", c.Func(c.Strcasecmp)}, + {"Strncasecmp", c.Func(c.Strncasecmp)}, + {"Strsep", c.Func(c.Strsep)}, + {"Strsignal", c.Func(c.Strsignal)}, + {"Stpcpy", c.Func(c.Stpcpy)}, + {"Stpncpy", c.Func(c.Stpncpy)}, +} + +var generatedVariableSymbols = []struct { + name string + address unsafe.Pointer +}{} + +var generatedLifecycleCalls = []struct { + name string + check func(*testing.T) +}{ + {"mbstate union accessors", func(t *testing.T) { + var state c.X__MbstateT + word := state.X__Value.XGof_ref___wch() + bytes := state.X__Value.XGof_ref___wchb() + if unsafe.Pointer(word) != unsafe.Pointer(&state.X__Value) || unsafe.Pointer(bytes) != unsafe.Pointer(word) { + t.Fatal("union accessor offsets differ") + } + *word = 0x12345678 + if bytes[0] != 0x78 || bytes[1] != 0x56 || bytes[2] != 0x34 || bytes[3] != 0x12 { + t.Fatalf("union byte view = %v", *bytes) + } + bytes[0], bytes[1], bytes[2], bytes[3] = 1, 2, 3, 4 + if *word != 0x04030201 { + t.Fatalf("union integer view = %#x", *word) + } + }}, + + {"Cfree", func(t *testing.T) { + if c.Func(c.Cfree) != c.Func(c.Free) { + t.Fatal("cfree must resolve to the native free alias") + } + c.Cfree(nil) + ptr := c.Malloc(64) + if ptr == nil { + t.Fatal("malloc returned nil") + } + c.Memset(ptr, 0x5a, 64) + c.Cfree(ptr) + }}, +} + +// Expected values were compiled from the original macOS 14.0 / glibc 2.24 C headers. +var generatedIntegerConstants = []struct { + name string + got, want int64 +}{ + {"FNM_PATHNAME", int64(c.FNM_PATHNAME), 1}, + {"FNM_NOESCAPE", int64(c.FNM_NOESCAPE), 2}, + {"FNM_PERIOD", int64(c.FNM_PERIOD), 4}, + {"FNM_NOMATCH", int64(c.FNM_NOMATCH), 1}, + {"MB_LEN_MAX", int64(c.MB_LEN_MAX), 16}, + {"LC_CTYPE", int64(c.LC_CTYPE), 0}, + {"LC_NUMERIC", int64(c.LC_NUMERIC), 1}, + {"LC_TIME", int64(c.LC_TIME), 2}, + {"LC_COLLATE", int64(c.LC_COLLATE), 3}, + {"LC_MONETARY", int64(c.LC_MONETARY), 4}, + {"LC_MESSAGES", int64(c.LC_MESSAGES), 5}, + {"LC_ALL", int64(c.LC_ALL), 6}, + {"LC_PAPER", int64(c.LC_PAPER), 7}, + {"LC_NAME", int64(c.LC_NAME), 8}, + {"LC_ADDRESS", int64(c.LC_ADDRESS), 9}, + {"LC_TELEPHONE", int64(c.LC_TELEPHONE), 10}, + {"LC_MEASUREMENT", int64(c.LC_MEASUREMENT), 11}, + {"LC_IDENTIFICATION", int64(c.LC_IDENTIFICATION), 12}, + {"LC_CTYPE_MASK", int64(c.LC_CTYPE_MASK), 1}, + {"LC_NUMERIC_MASK", int64(c.LC_NUMERIC_MASK), 2}, + {"LC_TIME_MASK", int64(c.LC_TIME_MASK), 4}, + {"LC_COLLATE_MASK", int64(c.LC_COLLATE_MASK), 8}, + {"LC_MONETARY_MASK", int64(c.LC_MONETARY_MASK), 16}, + {"LC_MESSAGES_MASK", int64(c.LC_MESSAGES_MASK), 32}, + {"LC_PAPER_MASK", int64(c.LC_PAPER_MASK), 128}, + {"LC_NAME_MASK", int64(c.LC_NAME_MASK), 256}, + {"LC_ADDRESS_MASK", int64(c.LC_ADDRESS_MASK), 512}, + {"LC_TELEPHONE_MASK", int64(c.LC_TELEPHONE_MASK), 1024}, + {"LC_MEASUREMENT_MASK", int64(c.LC_MEASUREMENT_MASK), 2048}, + {"LC_IDENTIFICATION_MASK", int64(c.LC_IDENTIFICATION_MASK), 4096}, + {"LC_ALL_MASK", int64(c.LC_ALL_MASK), 8127}, + {"INT8_MIN", int64(c.INT8_MIN), -128}, + {"INT16_MIN", int64(c.INT16_MIN), -32768}, + {"INT32_MIN", int64(c.INT32_MIN), -2147483648}, + {"INT8_MAX", int64(c.INT8_MAX), 127}, + {"INT16_MAX", int64(c.INT16_MAX), 32767}, + {"INT32_MAX", int64(c.INT32_MAX), 2147483647}, + {"UINT8_MAX", int64(c.UINT8_MAX), 255}, + {"UINT16_MAX", int64(c.UINT16_MAX), 65535}, + {"INT_LEAST8_MIN", int64(c.INT_LEAST8_MIN), -128}, + {"INT_LEAST16_MIN", int64(c.INT_LEAST16_MIN), -32768}, + {"INT_LEAST32_MIN", int64(c.INT_LEAST32_MIN), -2147483648}, + {"INT_LEAST8_MAX", int64(c.INT_LEAST8_MAX), 127}, + {"INT_LEAST16_MAX", int64(c.INT_LEAST16_MAX), 32767}, + {"INT_LEAST32_MAX", int64(c.INT_LEAST32_MAX), 2147483647}, + {"UINT_LEAST8_MAX", int64(c.UINT_LEAST8_MAX), 255}, + {"UINT_LEAST16_MAX", int64(c.UINT_LEAST16_MAX), 65535}, + {"INT_FAST8_MIN", int64(c.INT_FAST8_MIN), -128}, + {"INT_FAST8_MAX", int64(c.INT_FAST8_MAX), 127}, + {"UINT_FAST8_MAX", int64(c.UINT_FAST8_MAX), 255}, + {"SIG_ATOMIC_MIN", int64(c.SIG_ATOMIC_MIN), -2147483648}, + {"SIG_ATOMIC_MAX", int64(c.SIG_ATOMIC_MAX), 2147483647}, + {"BUFSIZ", int64(c.BUFSIZ), 8192}, + {"RAND_MAX", int64(c.RAND_MAX), 2147483647}, + {"EXIT_FAILURE", int64(c.EXIT_FAILURE), 1}, + {"EXIT_SUCCESS", int64(c.EXIT_SUCCESS), 0}, +} +var generatedStringConstants = []struct{ name, got, want string }{ + {"PRId8", c.PRId8, "d"}, + {"PRId16", c.PRId16, "d"}, + {"PRId32", c.PRId32, "d"}, + {"PRIdLEAST8", c.PRIdLEAST8, "d"}, + {"PRIdLEAST16", c.PRIdLEAST16, "d"}, + {"PRIdLEAST32", c.PRIdLEAST32, "d"}, + {"PRIdFAST8", c.PRIdFAST8, "d"}, + {"PRIi8", c.PRIi8, "i"}, + {"PRIi16", c.PRIi16, "i"}, + {"PRIi32", c.PRIi32, "i"}, + {"PRIiLEAST8", c.PRIiLEAST8, "i"}, + {"PRIiLEAST16", c.PRIiLEAST16, "i"}, + {"PRIiLEAST32", c.PRIiLEAST32, "i"}, + {"PRIiFAST8", c.PRIiFAST8, "i"}, + {"PRIo8", c.PRIo8, "o"}, + {"PRIo16", c.PRIo16, "o"}, + {"PRIo32", c.PRIo32, "o"}, + {"PRIoLEAST8", c.PRIoLEAST8, "o"}, + {"PRIoLEAST16", c.PRIoLEAST16, "o"}, + {"PRIoLEAST32", c.PRIoLEAST32, "o"}, + {"PRIoFAST8", c.PRIoFAST8, "o"}, + {"PRIu8", c.PRIu8, "u"}, + {"PRIu16", c.PRIu16, "u"}, + {"PRIu32", c.PRIu32, "u"}, + {"PRIuLEAST8", c.PRIuLEAST8, "u"}, + {"PRIuLEAST16", c.PRIuLEAST16, "u"}, + {"PRIuLEAST32", c.PRIuLEAST32, "u"}, + {"PRIuFAST8", c.PRIuFAST8, "u"}, + {"PRIx8", c.PRIx8, "x"}, + {"PRIx16", c.PRIx16, "x"}, + {"PRIx32", c.PRIx32, "x"}, + {"PRIxLEAST8", c.PRIxLEAST8, "x"}, + {"PRIxLEAST16", c.PRIxLEAST16, "x"}, + {"PRIxLEAST32", c.PRIxLEAST32, "x"}, + {"PRIxFAST8", c.PRIxFAST8, "x"}, + {"PRIX8", c.PRIX8, "X"}, + {"PRIX16", c.PRIX16, "X"}, + {"PRIX32", c.PRIX32, "X"}, + {"PRIXLEAST8", c.PRIXLEAST8, "X"}, + {"PRIXLEAST16", c.PRIXLEAST16, "X"}, + {"PRIXLEAST32", c.PRIXLEAST32, "X"}, + {"PRIXFAST8", c.PRIXFAST8, "X"}, + {"SCNd8", c.SCNd8, "hhd"}, + {"SCNd16", c.SCNd16, "hd"}, + {"SCNd32", c.SCNd32, "d"}, + {"SCNdLEAST8", c.SCNdLEAST8, "hhd"}, + {"SCNdLEAST16", c.SCNdLEAST16, "hd"}, + {"SCNdLEAST32", c.SCNdLEAST32, "d"}, + {"SCNdFAST8", c.SCNdFAST8, "hhd"}, + {"SCNi8", c.SCNi8, "hhi"}, + {"SCNi16", c.SCNi16, "hi"}, + {"SCNi32", c.SCNi32, "i"}, + {"SCNiLEAST8", c.SCNiLEAST8, "hhi"}, + {"SCNiLEAST16", c.SCNiLEAST16, "hi"}, + {"SCNiLEAST32", c.SCNiLEAST32, "i"}, + {"SCNiFAST8", c.SCNiFAST8, "hhi"}, + {"SCNu8", c.SCNu8, "hhu"}, + {"SCNu16", c.SCNu16, "hu"}, + {"SCNu32", c.SCNu32, "u"}, + {"SCNuLEAST8", c.SCNuLEAST8, "hhu"}, + {"SCNuLEAST16", c.SCNuLEAST16, "hu"}, + {"SCNuLEAST32", c.SCNuLEAST32, "u"}, + {"SCNuFAST8", c.SCNuFAST8, "hhu"}, + {"SCNo8", c.SCNo8, "hho"}, + {"SCNo16", c.SCNo16, "ho"}, + {"SCNo32", c.SCNo32, "o"}, + {"SCNoLEAST8", c.SCNoLEAST8, "hho"}, + {"SCNoLEAST16", c.SCNoLEAST16, "ho"}, + {"SCNoLEAST32", c.SCNoLEAST32, "o"}, + {"SCNoFAST8", c.SCNoFAST8, "hho"}, + {"SCNx8", c.SCNx8, "hhx"}, + {"SCNx16", c.SCNx16, "hx"}, + {"SCNx32", c.SCNx32, "x"}, + {"SCNxLEAST8", c.SCNxLEAST8, "hhx"}, + {"SCNxLEAST16", c.SCNxLEAST16, "hx"}, + {"SCNxLEAST32", c.SCNxLEAST32, "x"}, + {"SCNxFAST8", c.SCNxFAST8, "hhx"}, + {"PTmpdir", c.PTmpdir, "/tmp"}, +} +var generatedTypeLayouts = []struct { + symbol, property string + got, want uintptr +}{ + {"CpuSetT", "size", unsafe.Sizeof(*new(c.CpuSetT)), 128}, + {"CpuSetT", "align", unsafe.Alignof(*new(c.CpuSetT)), 8}, + {"CpuSetT", "X__Bits.offset", unsafe.Offsetof((*new(c.CpuSetT)).X__Bits), 0}, + {"CpuSetT", "X__Bits.width", unsafe.Sizeof((*new(c.CpuSetT)).X__Bits), 128}, + {"Msghdr", "size", unsafe.Sizeof(*new(c.Msghdr)), 56}, + {"Msghdr", "align", unsafe.Alignof(*new(c.Msghdr)), 8}, + {"Msghdr", "MsgName.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgName), 0}, + {"Msghdr", "MsgName.width", unsafe.Sizeof((*new(c.Msghdr)).MsgName), 8}, + {"Msghdr", "MsgNamelen.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgNamelen), 8}, + {"Msghdr", "MsgNamelen.width", unsafe.Sizeof((*new(c.Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgIov.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgIov), 16}, + {"Msghdr", "MsgIov.width", unsafe.Sizeof((*new(c.Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIovlen.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgIovlen), 24}, + {"Msghdr", "MsgIovlen.width", unsafe.Sizeof((*new(c.Msghdr)).MsgIovlen), 8}, + {"Msghdr", "MsgControl.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgControl), 32}, + {"Msghdr", "MsgControl.width", unsafe.Sizeof((*new(c.Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControllen.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgControllen), 40}, + {"Msghdr", "MsgControllen.width", unsafe.Sizeof((*new(c.Msghdr)).MsgControllen), 8}, + {"Msghdr", "MsgFlags.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgFlags), 48}, + {"Msghdr", "MsgFlags.width", unsafe.Sizeof((*new(c.Msghdr)).MsgFlags), 4}, + {"Cmsghdr", "size", unsafe.Sizeof(*new(c.Cmsghdr)), 16}, + {"Cmsghdr", "align", unsafe.Alignof(*new(c.Cmsghdr)), 8}, + {"Cmsghdr", "CmsgLen.offset", unsafe.Offsetof((*new(c.Cmsghdr)).CmsgLen), 0}, + {"Cmsghdr", "CmsgLen.width", unsafe.Sizeof((*new(c.Cmsghdr)).CmsgLen), 8}, + {"Cmsghdr", "CmsgLevel.offset", unsafe.Offsetof((*new(c.Cmsghdr)).CmsgLevel), 8}, + {"Cmsghdr", "CmsgLevel.width", unsafe.Sizeof((*new(c.Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgType.offset", unsafe.Offsetof((*new(c.Cmsghdr)).CmsgType), 12}, + {"Cmsghdr", "CmsgType.width", unsafe.Sizeof((*new(c.Cmsghdr)).CmsgType), 4}, + {"ImaxdivT", "size", unsafe.Sizeof(*new(c.ImaxdivT)), 16}, + {"ImaxdivT", "align", unsafe.Alignof(*new(c.ImaxdivT)), 8}, + {"ImaxdivT", "Quot.offset", unsafe.Offsetof((*new(c.ImaxdivT)).Quot), 0}, + {"ImaxdivT", "Quot.width", unsafe.Sizeof((*new(c.ImaxdivT)).Quot), 8}, + {"ImaxdivT", "Rem.offset", unsafe.Offsetof((*new(c.ImaxdivT)).Rem), 8}, + {"ImaxdivT", "Rem.width", unsafe.Sizeof((*new(c.ImaxdivT)).Rem), 8}, + {"X_IO_marker", "size", unsafe.Sizeof(*new(c.X_IO_marker)), 24}, + {"X_IO_marker", "align", unsafe.Alignof(*new(c.X_IO_marker)), 8}, + {"X_IO_marker", "X_next.offset", unsafe.Offsetof((*new(c.X_IO_marker)).X_next), 0}, + {"X_IO_marker", "X_next.width", unsafe.Sizeof((*new(c.X_IO_marker)).X_next), 8}, + {"X_IO_marker", "X_sbuf.offset", unsafe.Offsetof((*new(c.X_IO_marker)).X_sbuf), 8}, + {"X_IO_marker", "X_sbuf.width", unsafe.Sizeof((*new(c.X_IO_marker)).X_sbuf), 8}, + {"X_IO_marker", "X_pos.offset", unsafe.Offsetof((*new(c.X_IO_marker)).X_pos), 16}, + {"X_IO_marker", "X_pos.width", unsafe.Sizeof((*new(c.X_IO_marker)).X_pos), 4}, + {"X_IO_FILE", "size", unsafe.Sizeof(*new(c.X_IO_FILE)), 216}, + {"X_IO_FILE", "align", unsafe.Alignof(*new(c.X_IO_FILE)), 8}, + {"X_IO_FILE", "X_flags.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_flags), 0}, + {"X_IO_FILE", "X_flags.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_flags), 4}, + {"X_IO_FILE", "X_IO_read_ptr.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_read_ptr), 8}, + {"X_IO_FILE", "X_IO_read_ptr.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_read_ptr), 8}, + {"X_IO_FILE", "X_IO_read_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_read_end), 16}, + {"X_IO_FILE", "X_IO_read_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_read_end), 8}, + {"X_IO_FILE", "X_IO_read_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_read_base), 24}, + {"X_IO_FILE", "X_IO_read_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_read_base), 8}, + {"X_IO_FILE", "X_IO_write_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_write_base), 32}, + {"X_IO_FILE", "X_IO_write_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_write_base), 8}, + {"X_IO_FILE", "X_IO_write_ptr.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_write_ptr), 40}, + {"X_IO_FILE", "X_IO_write_ptr.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_write_ptr), 8}, + {"X_IO_FILE", "X_IO_write_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_write_end), 48}, + {"X_IO_FILE", "X_IO_write_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_write_end), 8}, + {"X_IO_FILE", "X_IO_buf_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_buf_base), 56}, + {"X_IO_FILE", "X_IO_buf_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_buf_base), 8}, + {"X_IO_FILE", "X_IO_buf_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_buf_end), 64}, + {"X_IO_FILE", "X_IO_buf_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_buf_end), 8}, + {"X_IO_FILE", "X_IO_save_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_save_base), 72}, + {"X_IO_FILE", "X_IO_save_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_save_base), 8}, + {"X_IO_FILE", "X_IO_backup_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_backup_base), 80}, + {"X_IO_FILE", "X_IO_backup_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_backup_base), 8}, + {"X_IO_FILE", "X_IO_save_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_save_end), 88}, + {"X_IO_FILE", "X_IO_save_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_save_end), 8}, + {"X_IO_FILE", "X_markers.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_markers), 96}, + {"X_IO_FILE", "X_markers.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_markers), 8}, + {"X_IO_FILE", "X_chain.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_chain), 104}, + {"X_IO_FILE", "X_chain.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_chain), 8}, + {"X_IO_FILE", "X_fileno.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_fileno), 112}, + {"X_IO_FILE", "X_fileno.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_fileno), 4}, + {"X_IO_FILE", "X_flags2.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_flags2), 116}, + {"X_IO_FILE", "X_flags2.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_flags2), 4}, + {"X_IO_FILE", "X_oldOffset.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_oldOffset), 120}, + {"X_IO_FILE", "X_oldOffset.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_oldOffset), 8}, + {"X_IO_FILE", "X_curColumn.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_curColumn), 128}, + {"X_IO_FILE", "X_curColumn.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_curColumn), 2}, + {"X_IO_FILE", "X_vtableOffset.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_vtableOffset), 130}, + {"X_IO_FILE", "X_vtableOffset.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_vtableOffset), 1}, + {"X_IO_FILE", "X_shortbuf.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_shortbuf), 131}, + {"X_IO_FILE", "X_shortbuf.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_shortbuf), 1}, + {"X_IO_FILE", "X_lock.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_lock), 136}, + {"X_IO_FILE", "X_lock.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_lock), 8}, + {"X_IO_FILE", "X_offset.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_offset), 144}, + {"X_IO_FILE", "X_offset.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_offset), 8}, + {"X_IO_FILE", "X__Pad1.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad1), 152}, + {"X_IO_FILE", "X__Pad1.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad1), 8}, + {"X_IO_FILE", "X__Pad2.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad2), 160}, + {"X_IO_FILE", "X__Pad2.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad2), 8}, + {"X_IO_FILE", "X__Pad3.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad3), 168}, + {"X_IO_FILE", "X__Pad3.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad3), 8}, + {"X_IO_FILE", "X__Pad4.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad4), 176}, + {"X_IO_FILE", "X__Pad4.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad4), 8}, + {"X_IO_FILE", "X__Pad5.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad5), 184}, + {"X_IO_FILE", "X__Pad5.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad5), 8}, + {"X_IO_FILE", "X_mode.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_mode), 192}, + {"X_IO_FILE", "X_mode.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_mode), 4}, + {"X_IO_FILE", "X_unused2.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_unused2), 196}, + {"X_IO_FILE", "X_unused2.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_unused2), 20}, + {"Lconv", "size", unsafe.Sizeof(*new(c.Lconv)), 96}, + {"Lconv", "align", unsafe.Alignof(*new(c.Lconv)), 8}, + {"Lconv", "DecimalPoint.offset", unsafe.Offsetof((*new(c.Lconv)).DecimalPoint), 0}, + {"Lconv", "DecimalPoint.width", unsafe.Sizeof((*new(c.Lconv)).DecimalPoint), 8}, + {"Lconv", "ThousandsSep.offset", unsafe.Offsetof((*new(c.Lconv)).ThousandsSep), 8}, + {"Lconv", "ThousandsSep.width", unsafe.Sizeof((*new(c.Lconv)).ThousandsSep), 8}, + {"Lconv", "Grouping.offset", unsafe.Offsetof((*new(c.Lconv)).Grouping), 16}, + {"Lconv", "Grouping.width", unsafe.Sizeof((*new(c.Lconv)).Grouping), 8}, + {"Lconv", "IntCurrSymbol.offset", unsafe.Offsetof((*new(c.Lconv)).IntCurrSymbol), 24}, + {"Lconv", "IntCurrSymbol.width", unsafe.Sizeof((*new(c.Lconv)).IntCurrSymbol), 8}, + {"Lconv", "CurrencySymbol.offset", unsafe.Offsetof((*new(c.Lconv)).CurrencySymbol), 32}, + {"Lconv", "CurrencySymbol.width", unsafe.Sizeof((*new(c.Lconv)).CurrencySymbol), 8}, + {"Lconv", "MonDecimalPoint.offset", unsafe.Offsetof((*new(c.Lconv)).MonDecimalPoint), 40}, + {"Lconv", "MonDecimalPoint.width", unsafe.Sizeof((*new(c.Lconv)).MonDecimalPoint), 8}, + {"Lconv", "MonThousandsSep.offset", unsafe.Offsetof((*new(c.Lconv)).MonThousandsSep), 48}, + {"Lconv", "MonThousandsSep.width", unsafe.Sizeof((*new(c.Lconv)).MonThousandsSep), 8}, + {"Lconv", "MonGrouping.offset", unsafe.Offsetof((*new(c.Lconv)).MonGrouping), 56}, + {"Lconv", "MonGrouping.width", unsafe.Sizeof((*new(c.Lconv)).MonGrouping), 8}, + {"Lconv", "PositiveSign.offset", unsafe.Offsetof((*new(c.Lconv)).PositiveSign), 64}, + {"Lconv", "PositiveSign.width", unsafe.Sizeof((*new(c.Lconv)).PositiveSign), 8}, + {"Lconv", "NegativeSign.offset", unsafe.Offsetof((*new(c.Lconv)).NegativeSign), 72}, + {"Lconv", "NegativeSign.width", unsafe.Sizeof((*new(c.Lconv)).NegativeSign), 8}, + {"Lconv", "IntFracDigits.offset", unsafe.Offsetof((*new(c.Lconv)).IntFracDigits), 80}, + {"Lconv", "IntFracDigits.width", unsafe.Sizeof((*new(c.Lconv)).IntFracDigits), 1}, + {"Lconv", "FracDigits.offset", unsafe.Offsetof((*new(c.Lconv)).FracDigits), 81}, + {"Lconv", "FracDigits.width", unsafe.Sizeof((*new(c.Lconv)).FracDigits), 1}, + {"Lconv", "PCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).PCsPrecedes), 82}, + {"Lconv", "PCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).PCsPrecedes), 1}, + {"Lconv", "PSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).PSepBySpace), 83}, + {"Lconv", "PSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).PSepBySpace), 1}, + {"Lconv", "NCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).NCsPrecedes), 84}, + {"Lconv", "NCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).NCsPrecedes), 1}, + {"Lconv", "NSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).NSepBySpace), 85}, + {"Lconv", "NSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).NSepBySpace), 1}, + {"Lconv", "PSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).PSignPosn), 86}, + {"Lconv", "PSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).PSignPosn), 1}, + {"Lconv", "NSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).NSignPosn), 87}, + {"Lconv", "NSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).NSignPosn), 1}, + {"Lconv", "IntPCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).IntPCsPrecedes), 88}, + {"Lconv", "IntPCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).IntPCsPrecedes), 1}, + {"Lconv", "IntPSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).IntPSepBySpace), 89}, + {"Lconv", "IntPSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).IntPSepBySpace), 1}, + {"Lconv", "IntNCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).IntNCsPrecedes), 90}, + {"Lconv", "IntNCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).IntNCsPrecedes), 1}, + {"Lconv", "IntNSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).IntNSepBySpace), 91}, + {"Lconv", "IntNSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).IntNSepBySpace), 1}, + {"Lconv", "IntPSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).IntPSignPosn), 92}, + {"Lconv", "IntPSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).IntPSignPosn), 1}, + {"Lconv", "IntNSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).IntNSignPosn), 93}, + {"Lconv", "IntNSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).IntNSignPosn), 1}, + {"Rpcent", "size", unsafe.Sizeof(*new(c.Rpcent)), 24}, + {"Rpcent", "align", unsafe.Alignof(*new(c.Rpcent)), 8}, + {"Rpcent", "RName.offset", unsafe.Offsetof((*new(c.Rpcent)).RName), 0}, + {"Rpcent", "RName.width", unsafe.Sizeof((*new(c.Rpcent)).RName), 8}, + {"Rpcent", "RAliases.offset", unsafe.Offsetof((*new(c.Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases.width", unsafe.Sizeof((*new(c.Rpcent)).RAliases), 8}, + {"Rpcent", "RNumber.offset", unsafe.Offsetof((*new(c.Rpcent)).RNumber), 16}, + {"Rpcent", "RNumber.width", unsafe.Sizeof((*new(c.Rpcent)).RNumber), 4}, + {"FposT", "size", unsafe.Sizeof(*new(c.FposT)), 16}, + {"FposT", "align", unsafe.Alignof(*new(c.FposT)), 8}, + {"FposT", "X__Pos.offset", unsafe.Offsetof((*new(c.FposT)).X__Pos), 0}, + {"FposT", "X__Pos.width", unsafe.Sizeof((*new(c.FposT)).X__Pos), 8}, + {"FposT", "X__State.offset", unsafe.Offsetof((*new(c.FposT)).X__State), 8}, + {"FposT", "X__State.width", unsafe.Sizeof((*new(c.FposT)).X__State), 8}, + {"RandomData", "size", unsafe.Sizeof(*new(c.RandomData)), 48}, + {"RandomData", "align", unsafe.Alignof(*new(c.RandomData)), 8}, + {"RandomData", "Fptr.offset", unsafe.Offsetof((*new(c.RandomData)).Fptr), 0}, + {"RandomData", "Fptr.width", unsafe.Sizeof((*new(c.RandomData)).Fptr), 8}, + {"RandomData", "Rptr.offset", unsafe.Offsetof((*new(c.RandomData)).Rptr), 8}, + {"RandomData", "Rptr.width", unsafe.Sizeof((*new(c.RandomData)).Rptr), 8}, + {"RandomData", "State.offset", unsafe.Offsetof((*new(c.RandomData)).State), 16}, + {"RandomData", "State.width", unsafe.Sizeof((*new(c.RandomData)).State), 8}, + {"RandomData", "RandType.offset", unsafe.Offsetof((*new(c.RandomData)).RandType), 24}, + {"RandomData", "RandType.width", unsafe.Sizeof((*new(c.RandomData)).RandType), 4}, + {"RandomData", "RandDeg.offset", unsafe.Offsetof((*new(c.RandomData)).RandDeg), 28}, + {"RandomData", "RandDeg.width", unsafe.Sizeof((*new(c.RandomData)).RandDeg), 4}, + {"RandomData", "RandSep.offset", unsafe.Offsetof((*new(c.RandomData)).RandSep), 32}, + {"RandomData", "RandSep.width", unsafe.Sizeof((*new(c.RandomData)).RandSep), 4}, + {"RandomData", "EndPtr.offset", unsafe.Offsetof((*new(c.RandomData)).EndPtr), 40}, + {"RandomData", "EndPtr.width", unsafe.Sizeof((*new(c.RandomData)).EndPtr), 8}, + {"Drand48Data", "size", unsafe.Sizeof(*new(c.Drand48Data)), 24}, + {"Drand48Data", "align", unsafe.Alignof(*new(c.Drand48Data)), 8}, + {"Drand48Data", "X__X.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__X), 0}, + {"Drand48Data", "X__X.width", unsafe.Sizeof((*new(c.Drand48Data)).X__X), 6}, + {"Drand48Data", "X__OldX.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__OldX), 6}, + {"Drand48Data", "X__OldX.width", unsafe.Sizeof((*new(c.Drand48Data)).X__OldX), 6}, + {"Drand48Data", "X__C.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__C), 12}, + {"Drand48Data", "X__C.width", unsafe.Sizeof((*new(c.Drand48Data)).X__C), 2}, + {"Drand48Data", "X__Init.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__Init), 14}, + {"Drand48Data", "X__Init.width", unsafe.Sizeof((*new(c.Drand48Data)).X__Init), 2}, + {"Drand48Data", "X__A.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__A), 16}, + {"Drand48Data", "X__A.width", unsafe.Sizeof((*new(c.Drand48Data)).X__A), 8}, + {"X__ComparFnT", "size", unsafe.Sizeof(*new(c.X__ComparFnT)), 8}, + {"X__ComparFnT", "align", unsafe.Alignof(*new(c.X__ComparFnT)), 8}, + {"X__MbstateT", "size", unsafe.Sizeof(*new(c.X__MbstateT)), 8}, + {"X__MbstateT", "align", unsafe.Alignof(*new(c.X__MbstateT)), 4}, + {"X__MbstateT", "X__Count.offset", unsafe.Offsetof((*new(c.X__MbstateT)).X__Count), 0}, + {"X__MbstateT", "X__Count.width", unsafe.Sizeof((*new(c.X__MbstateT)).X__Count), 4}, + {"X__MbstateT", "X__Value.offset", unsafe.Offsetof((*new(c.X__MbstateT)).X__Value), 4}, + {"X__MbstateT", "X__Value.width", unsafe.Sizeof((*new(c.X__MbstateT)).X__Value), 4}, + {"X__LocaleStruct", "size", unsafe.Sizeof(*new(c.X__LocaleStruct)), 232}, + {"X__LocaleStruct", "align", unsafe.Alignof(*new(c.X__LocaleStruct)), 8}, + {"X__LocaleStruct", "X__Locales.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__Locales), 0}, + {"X__LocaleStruct", "X__Locales.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__Locales), 104}, + {"X__LocaleStruct", "X__CtypeB.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__CtypeB), 104}, + {"X__LocaleStruct", "X__CtypeB.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__CtypeB), 8}, + {"X__LocaleStruct", "X__CtypeTolower.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__CtypeTolower), 112}, + {"X__LocaleStruct", "X__CtypeTolower.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__CtypeTolower), 8}, + {"X__LocaleStruct", "X__CtypeToupper.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__CtypeToupper), 120}, + {"X__LocaleStruct", "X__CtypeToupper.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__CtypeToupper), 8}, + {"X__LocaleStruct", "X__Names.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__Names), 128}, + {"X__LocaleStruct", "X__Names.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__Names), 104}, + {"X__LocaleData", "pointer_size", unsafe.Sizeof(*new(*c.X__LocaleData)), 8}, + {"X__LocaleData", "pointer_align", unsafe.Alignof(*new(*c.X__LocaleData)), 8}, + {"X__LocaleT", "size", unsafe.Sizeof(*new(c.X__LocaleT)), 8}, + {"X__LocaleT", "align", unsafe.Alignof(*new(c.X__LocaleT)), 8}, + {"X_GFposT", "size", unsafe.Sizeof(*new(c.X_GFposT)), 16}, + {"X_GFposT", "align", unsafe.Alignof(*new(c.X_GFposT)), 8}, + {"X_GFposT", "X__Pos.offset", unsafe.Offsetof((*new(c.X_GFposT)).X__Pos), 0}, + {"X_GFposT", "X__Pos.width", unsafe.Sizeof((*new(c.X_GFposT)).X__Pos), 8}, + {"X_GFposT", "X__State.offset", unsafe.Offsetof((*new(c.X_GFposT)).X__State), 8}, + {"X_GFposT", "X__State.width", unsafe.Sizeof((*new(c.X_GFposT)).X__State), 8}, + {"Iovec", "size", unsafe.Sizeof(*new(c.Iovec)), 16}, + {"Iovec", "align", unsafe.Alignof(*new(c.Iovec)), 8}, + {"Iovec", "IovBase.offset", unsafe.Offsetof((*new(c.Iovec)).IovBase), 0}, + {"Iovec", "IovBase.width", unsafe.Sizeof((*new(c.Iovec)).IovBase), 8}, + {"Iovec", "IovLen.offset", unsafe.Offsetof((*new(c.Iovec)).IovLen), 8}, + {"Iovec", "IovLen.width", unsafe.Sizeof((*new(c.Iovec)).IovLen), 8}, +} + +var generatedAccessorSymbols = []string{"XGof_ref___wch", "XGof_ref___wchb"} + +// Each slot is classified by Clang from the original native C prototype. +var generatedFunctionPrototypes = []struct { + name string + signature reflect.Type + variadic bool + inputs []nativeABISlot + output *nativeABISlot +}{ + {"Isalnum", reflect.TypeOf(c.Isalnum), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isalpha", reflect.TypeOf(c.Isalpha), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Iscntrl", reflect.TypeOf(c.Iscntrl), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isdigit", reflect.TypeOf(c.Isdigit), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Islower", reflect.TypeOf(c.Islower), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isgraph", reflect.TypeOf(c.Isgraph), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isprint", reflect.TypeOf(c.Isprint), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ispunct", reflect.TypeOf(c.Ispunct), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isspace", reflect.TypeOf(c.Isspace), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isupper", reflect.TypeOf(c.Isupper), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isxdigit", reflect.TypeOf(c.Isxdigit), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Tolower", reflect.TypeOf(c.Tolower), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Toupper", reflect.TypeOf(c.Toupper), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isblank", reflect.TypeOf(c.Isblank), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isascii", reflect.TypeOf(c.Isascii), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Toascii", reflect.TypeOf(c.Toascii), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"X_toupper", reflect.TypeOf(c.X_toupper), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"X_tolower", reflect.TypeOf(c.X_tolower), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"IsalnumL", reflect.TypeOf(c.IsalnumL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsalphaL", reflect.TypeOf(c.IsalphaL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IscntrlL", reflect.TypeOf(c.IscntrlL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsdigitL", reflect.TypeOf(c.IsdigitL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IslowerL", reflect.TypeOf(c.IslowerL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsgraphL", reflect.TypeOf(c.IsgraphL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsprintL", reflect.TypeOf(c.IsprintL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IspunctL", reflect.TypeOf(c.IspunctL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsspaceL", reflect.TypeOf(c.IsspaceL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsupperL", reflect.TypeOf(c.IsupperL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsxdigitL", reflect.TypeOf(c.IsxdigitL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsblankL", reflect.TypeOf(c.IsblankL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"TolowerL", reflect.TypeOf(c.TolowerL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"ToupperL", reflect.TypeOf(c.ToupperL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fnmatch", reflect.TypeOf(c.Fnmatch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Imaxabs", reflect.TypeOf(c.Imaxabs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Imaxdiv", reflect.TypeOf(c.Imaxdiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Strtoimax", reflect.TypeOf(c.Strtoimax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoumax", reflect.TypeOf(c.Strtoumax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstoimax", reflect.TypeOf(c.Wcstoimax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstoumax", reflect.TypeOf(c.Wcstoumax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Dirname", reflect.TypeOf(c.Dirname), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"X__XpgBasename", reflect.TypeOf(c.X__XpgBasename), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setlocale", reflect.TypeOf(c.Setlocale), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Localeconv", reflect.TypeOf(c.Localeconv), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"Newlocale", reflect.TypeOf(c.Newlocale), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"X__LocaleT.Duplocale", reflect.TypeOf((c.X__LocaleT).Duplocale), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"X__LocaleT.Freelocale", reflect.TypeOf((c.X__LocaleT).Freelocale), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"X__LocaleT.Uselocale", reflect.TypeOf((c.X__LocaleT).Uselocale), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setrpcent", reflect.TypeOf(c.Setrpcent), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Endrpcent", reflect.TypeOf(c.Endrpcent), false, []nativeABISlot{}, nil}, + {"Getrpcbyname", reflect.TypeOf(c.Getrpcbyname), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Getrpcbynumber", reflect.TypeOf(c.Getrpcbynumber), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Getrpcent", reflect.TypeOf(c.Getrpcent), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"GetrpcbynameR", reflect.TypeOf(c.GetrpcbynameR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"GetrpcbynumberR", reflect.TypeOf(c.GetrpcbynumberR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"*Rpcent.GetrpcentR", reflect.TypeOf((*c.Rpcent).GetrpcentR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Renameat", reflect.TypeOf(c.Renameat), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Tmpfile", reflect.TypeOf(c.Tmpfile), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"Tmpnam", reflect.TypeOf(c.Tmpnam), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"TmpnamR", reflect.TypeOf(c.TmpnamR), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Tempnam", reflect.TypeOf(c.Tempnam), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"FflushUnlocked", reflect.TypeOf(c.FflushUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Freopen", reflect.TypeOf(c.Freopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fdopen", reflect.TypeOf(c.Fdopen), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fmemopen", reflect.TypeOf(c.Fmemopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"OpenMemstream", reflect.TypeOf(c.OpenMemstream), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setbuf", reflect.TypeOf(c.Setbuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, nil}, + {"Setvbuf", reflect.TypeOf(c.Setvbuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Setbuffer", reflect.TypeOf(c.Setbuffer), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"Setlinebuf", reflect.TypeOf(c.Setlinebuf), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Dprintf", reflect.TypeOf(c.Dprintf), true, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fscanf", reflect.TypeOf(c.Fscanf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Scanf", reflect.TypeOf(c.Scanf), true, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Sscanf", reflect.TypeOf(c.Sscanf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgetc", reflect.TypeOf(c.Fgetc), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getc", reflect.TypeOf(c.Getc), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getchar", reflect.TypeOf(c.Getchar), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"GetcUnlocked", reflect.TypeOf(c.GetcUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"GetcharUnlocked", reflect.TypeOf(c.GetcharUnlocked), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"FgetcUnlocked", reflect.TypeOf(c.FgetcUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putc", reflect.TypeOf(c.Putc), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putchar", reflect.TypeOf(c.Putchar), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"FputcUnlocked", reflect.TypeOf(c.FputcUnlocked), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"PutcUnlocked", reflect.TypeOf(c.PutcUnlocked), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"PutcharUnlocked", reflect.TypeOf(c.PutcharUnlocked), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Getw", reflect.TypeOf(c.Getw), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putw", reflect.TypeOf(c.Putw), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgets", reflect.TypeOf(c.Fgets), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Getdelim", reflect.TypeOf(c.Getdelim), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Getline", reflect.TypeOf(c.Getline), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Puts", reflect.TypeOf(c.Puts), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ungetc", reflect.TypeOf(c.Ungetc), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"FreadUnlocked", reflect.TypeOf(c.FreadUnlocked), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"FwriteUnlocked", reflect.TypeOf(c.FwriteUnlocked), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Fseek", reflect.TypeOf(c.Fseek), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ftell", reflect.TypeOf(c.Ftell), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Rewind", reflect.TypeOf(c.Rewind), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Fseeko", reflect.TypeOf(c.Fseeko), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ftello", reflect.TypeOf(c.Ftello), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Fgetpos", reflect.TypeOf(c.Fgetpos), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fsetpos", reflect.TypeOf(c.Fsetpos), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Clearerr", reflect.TypeOf(c.Clearerr), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Feof", reflect.TypeOf(c.Feof), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ferror", reflect.TypeOf(c.Ferror), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"ClearerrUnlocked", reflect.TypeOf(c.ClearerrUnlocked), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"FeofUnlocked", reflect.TypeOf(c.FeofUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"FerrorUnlocked", reflect.TypeOf(c.FerrorUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fileno", reflect.TypeOf(c.Fileno), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"FilenoUnlocked", reflect.TypeOf(c.FilenoUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Popen", reflect.TypeOf(c.Popen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Pclose", reflect.TypeOf(c.Pclose), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ctermid", reflect.TypeOf(c.Ctermid), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Flockfile", reflect.TypeOf(c.Flockfile), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Ftrylockfile", reflect.TypeOf(c.Ftrylockfile), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Funlockfile", reflect.TypeOf(c.Funlockfile), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Atof", reflect.TypeOf(c.Atof), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Atol", reflect.TypeOf(c.Atol), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Atoll", reflect.TypeOf(c.Atoll), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strtod", reflect.TypeOf(c.Strtod), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Strtof", reflect.TypeOf(c.Strtof), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 8}}, + {"Strtol", reflect.TypeOf(c.Strtol), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoul", reflect.TypeOf(c.Strtoul), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoq", reflect.TypeOf(c.Strtoq), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtouq", reflect.TypeOf(c.Strtouq), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoll", reflect.TypeOf(c.Strtoll), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoull", reflect.TypeOf(c.Strtoull), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"L64a", reflect.TypeOf(c.L64a), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"A64l", reflect.TypeOf(c.A64l), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Random", reflect.TypeOf(c.Random), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Srandom", reflect.TypeOf(c.Srandom), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Initstate", reflect.TypeOf(c.Initstate), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Setstate", reflect.TypeOf(c.Setstate), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"*RandomData.RandomR", reflect.TypeOf((*c.RandomData).RandomR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"SrandomR", reflect.TypeOf(c.SrandomR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"InitstateR", reflect.TypeOf(c.InitstateR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"SetstateR", reflect.TypeOf(c.SetstateR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Srand", reflect.TypeOf(c.Srand), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"RandR", reflect.TypeOf(c.RandR), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Drand48", reflect.TypeOf(c.Drand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 8}}, + {"Erand48", reflect.TypeOf(c.Erand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Lrand48", reflect.TypeOf(c.Lrand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Nrand48", reflect.TypeOf(c.Nrand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Mrand48", reflect.TypeOf(c.Mrand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Jrand48", reflect.TypeOf(c.Jrand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Srand48", reflect.TypeOf(c.Srand48), false, []nativeABISlot{{8, 8, 1}}, nil}, + {"Seed48", reflect.TypeOf(c.Seed48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Lcong48", reflect.TypeOf(c.Lcong48), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"*Drand48Data.Drand48R", reflect.TypeOf((*c.Drand48Data).Drand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Erand48R", reflect.TypeOf(c.Erand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"*Drand48Data.Lrand48R", reflect.TypeOf((*c.Drand48Data).Lrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Nrand48R", reflect.TypeOf(c.Nrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"*Drand48Data.Mrand48R", reflect.TypeOf((*c.Drand48Data).Mrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Jrand48R", reflect.TypeOf(c.Jrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Srand48R", reflect.TypeOf(c.Srand48R), false, []nativeABISlot{{8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Seed48R", reflect.TypeOf(c.Seed48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Lcong48R", reflect.TypeOf(c.Lcong48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cfree", reflect.TypeOf(c.Cfree), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Valloc", reflect.TypeOf(c.Valloc), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"PosixMemalign", reflect.TypeOf(c.PosixMemalign), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"AlignedAlloc", reflect.TypeOf(c.AlignedAlloc), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Abort", reflect.TypeOf(c.Abort), false, []nativeABISlot{}, nil}, + {"Atexit", reflect.TypeOf(c.Atexit), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"AtQuickExit", reflect.TypeOf(c.AtQuickExit), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"OnExit", reflect.TypeOf(c.OnExit), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"QuickExit", reflect.TypeOf(c.QuickExit), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"X_Exit", reflect.TypeOf(c.X_Exit), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Mktemp", reflect.TypeOf(c.Mktemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Mkstemp", reflect.TypeOf(c.Mkstemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Mkstemps", reflect.TypeOf(c.Mkstemps), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mkdtemp", reflect.TypeOf(c.Mkdtemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"System", reflect.TypeOf(c.System), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Realpath", reflect.TypeOf(c.Realpath), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Bsearch", reflect.TypeOf(c.Bsearch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Abs", reflect.TypeOf(c.Abs), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Labs", reflect.TypeOf(c.Labs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Llabs", reflect.TypeOf(c.Llabs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Div", reflect.TypeOf(c.Div), false, []nativeABISlot{{4, 4, 1}, {4, 4, 1}}, &nativeABISlot{8, 4, 12}}, + {"Ldiv", reflect.TypeOf(c.Ldiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Lldiv", reflect.TypeOf(c.Lldiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Ecvt", reflect.TypeOf(c.Ecvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fcvt", reflect.TypeOf(c.Fcvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Gcvt", reflect.TypeOf(c.Gcvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"EcvtR", reflect.TypeOf(c.EcvtR), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"FcvtR", reflect.TypeOf(c.FcvtR), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mblen", reflect.TypeOf(c.Mblen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mbtowc", reflect.TypeOf(c.Mbtowc), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Wctomb", reflect.TypeOf(c.Wctomb), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mbstowcs", reflect.TypeOf(c.Mbstowcs), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstombs", reflect.TypeOf(c.Wcstombs), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Rpmatch", reflect.TypeOf(c.Rpmatch), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getsubopt", reflect.TypeOf(c.Getsubopt), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getloadavg", reflect.TypeOf(c.Getloadavg), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Memccpy", reflect.TypeOf(c.Memccpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Strcoll", reflect.TypeOf(c.Strcoll), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Strxfrm", reflect.TypeOf(c.Strxfrm), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"StrcollL", reflect.TypeOf(c.StrcollL), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"StrxfrmL", reflect.TypeOf(c.StrxfrmL), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strcspn", reflect.TypeOf(c.Strcspn), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strspn", reflect.TypeOf(c.Strspn), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strpbrk", reflect.TypeOf(c.Strpbrk), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"StrtokR", reflect.TypeOf(c.StrtokR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Strnlen", reflect.TypeOf(c.Strnlen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"StrerrorR", reflect.TypeOf(c.StrerrorR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"StrerrorL", reflect.TypeOf(c.StrerrorL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Bcopy", reflect.TypeOf(c.Bcopy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"Bzero", reflect.TypeOf(c.Bzero), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, nil}, + {"Bcmp", reflect.TypeOf(c.Bcmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Rindex", reflect.TypeOf(c.Rindex), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Ffs", reflect.TypeOf(c.Ffs), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Strcasecmp", reflect.TypeOf(c.Strcasecmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Strncasecmp", reflect.TypeOf(c.Strncasecmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Strsep", reflect.TypeOf(c.Strsep), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Strsignal", reflect.TypeOf(c.Strsignal), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Stpcpy", reflect.TypeOf(c.Stpcpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Stpncpy", reflect.TypeOf(c.Stpncpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, +} diff --git a/c/libc_native_linux_arm64_llgo_test.go b/c/libc_native_linux_arm64_llgo_test.go new file mode 100644 index 00000000..aed16cf4 --- /dev/null +++ b/c/libc_native_linux_arm64_llgo_test.go @@ -0,0 +1,881 @@ +//go:build llgo && linux && arm64 && !android + +package c_test + +import ( + "github.com/goplus/lib/c" + "reflect" + "testing" + "unsafe" +) + +type nativeChar = uint8 +type nativeWide = c.Uint +type nativeFilePosition = c.FposT + +const nativeFilePositionSize = 16 + +// This table deliberately takes every new C symbol address so the linker must resolve it. +var generatedFunctionSymbols = []struct { + name string + address unsafe.Pointer +}{ + {"Isalnum", c.Func(c.Isalnum)}, + {"Isalpha", c.Func(c.Isalpha)}, + {"Iscntrl", c.Func(c.Iscntrl)}, + {"Isdigit", c.Func(c.Isdigit)}, + {"Islower", c.Func(c.Islower)}, + {"Isgraph", c.Func(c.Isgraph)}, + {"Isprint", c.Func(c.Isprint)}, + {"Ispunct", c.Func(c.Ispunct)}, + {"Isspace", c.Func(c.Isspace)}, + {"Isupper", c.Func(c.Isupper)}, + {"Isxdigit", c.Func(c.Isxdigit)}, + {"Tolower", c.Func(c.Tolower)}, + {"Toupper", c.Func(c.Toupper)}, + {"Isblank", c.Func(c.Isblank)}, + {"Isascii", c.Func(c.Isascii)}, + {"Toascii", c.Func(c.Toascii)}, + {"X_toupper", c.Func(c.X_toupper)}, + {"X_tolower", c.Func(c.X_tolower)}, + {"IsalnumL", c.Func(c.IsalnumL)}, + {"IsalphaL", c.Func(c.IsalphaL)}, + {"IscntrlL", c.Func(c.IscntrlL)}, + {"IsdigitL", c.Func(c.IsdigitL)}, + {"IslowerL", c.Func(c.IslowerL)}, + {"IsgraphL", c.Func(c.IsgraphL)}, + {"IsprintL", c.Func(c.IsprintL)}, + {"IspunctL", c.Func(c.IspunctL)}, + {"IsspaceL", c.Func(c.IsspaceL)}, + {"IsupperL", c.Func(c.IsupperL)}, + {"IsxdigitL", c.Func(c.IsxdigitL)}, + {"IsblankL", c.Func(c.IsblankL)}, + {"TolowerL", c.Func(c.TolowerL)}, + {"ToupperL", c.Func(c.ToupperL)}, + {"Fnmatch", c.Func(c.Fnmatch)}, + {"Imaxabs", c.Func(c.Imaxabs)}, + {"Imaxdiv", c.Func(c.Imaxdiv)}, + {"Strtoimax", c.Func(c.Strtoimax)}, + {"Strtoumax", c.Func(c.Strtoumax)}, + {"Wcstoimax", c.Func(c.Wcstoimax)}, + {"Wcstoumax", c.Func(c.Wcstoumax)}, + {"Dirname", c.Func(c.Dirname)}, + {"X__XpgBasename", c.Func(c.X__XpgBasename)}, + {"Setlocale", c.Func(c.Setlocale)}, + {"Localeconv", c.Func(c.Localeconv)}, + {"Newlocale", c.Func(c.Newlocale)}, + {"X__LocaleT.Duplocale", c.Func((c.X__LocaleT).Duplocale)}, + {"X__LocaleT.Freelocale", c.Func((c.X__LocaleT).Freelocale)}, + {"X__LocaleT.Uselocale", c.Func((c.X__LocaleT).Uselocale)}, + {"Setrpcent", c.Func(c.Setrpcent)}, + {"Endrpcent", c.Func(c.Endrpcent)}, + {"Getrpcbyname", c.Func(c.Getrpcbyname)}, + {"Getrpcbynumber", c.Func(c.Getrpcbynumber)}, + {"Getrpcent", c.Func(c.Getrpcent)}, + {"GetrpcbynameR", c.Func(c.GetrpcbynameR)}, + {"GetrpcbynumberR", c.Func(c.GetrpcbynumberR)}, + {"*Rpcent.GetrpcentR", c.Func((*c.Rpcent).GetrpcentR)}, + {"Renameat", c.Func(c.Renameat)}, + {"Tmpfile", c.Func(c.Tmpfile)}, + {"Tmpnam", c.Func(c.Tmpnam)}, + {"TmpnamR", c.Func(c.TmpnamR)}, + {"Tempnam", c.Func(c.Tempnam)}, + {"FflushUnlocked", c.Func(c.FflushUnlocked)}, + {"Freopen", c.Func(c.Freopen)}, + {"Fdopen", c.Func(c.Fdopen)}, + {"Fmemopen", c.Func(c.Fmemopen)}, + {"OpenMemstream", c.Func(c.OpenMemstream)}, + {"Setbuf", c.Func(c.Setbuf)}, + {"Setvbuf", c.Func(c.Setvbuf)}, + {"Setbuffer", c.Func(c.Setbuffer)}, + {"Setlinebuf", c.Func(c.Setlinebuf)}, + {"Dprintf", c.Func(c.Dprintf)}, + {"Fscanf", c.Func(c.Fscanf)}, + {"Scanf", c.Func(c.Scanf)}, + {"Sscanf", c.Func(c.Sscanf)}, + {"Fgetc", c.Func(c.Fgetc)}, + {"Getc", c.Func(c.Getc)}, + {"Getchar", c.Func(c.Getchar)}, + {"GetcUnlocked", c.Func(c.GetcUnlocked)}, + {"GetcharUnlocked", c.Func(c.GetcharUnlocked)}, + {"FgetcUnlocked", c.Func(c.FgetcUnlocked)}, + {"Putc", c.Func(c.Putc)}, + {"Putchar", c.Func(c.Putchar)}, + {"FputcUnlocked", c.Func(c.FputcUnlocked)}, + {"PutcUnlocked", c.Func(c.PutcUnlocked)}, + {"PutcharUnlocked", c.Func(c.PutcharUnlocked)}, + {"Getw", c.Func(c.Getw)}, + {"Putw", c.Func(c.Putw)}, + {"Fgets", c.Func(c.Fgets)}, + {"Getdelim", c.Func(c.Getdelim)}, + {"Getline", c.Func(c.Getline)}, + {"Puts", c.Func(c.Puts)}, + {"Ungetc", c.Func(c.Ungetc)}, + {"FreadUnlocked", c.Func(c.FreadUnlocked)}, + {"FwriteUnlocked", c.Func(c.FwriteUnlocked)}, + {"Fseek", c.Func(c.Fseek)}, + {"Ftell", c.Func(c.Ftell)}, + {"Rewind", c.Func(c.Rewind)}, + {"Fseeko", c.Func(c.Fseeko)}, + {"Ftello", c.Func(c.Ftello)}, + {"Fgetpos", c.Func(c.Fgetpos)}, + {"Fsetpos", c.Func(c.Fsetpos)}, + {"Clearerr", c.Func(c.Clearerr)}, + {"Feof", c.Func(c.Feof)}, + {"Ferror", c.Func(c.Ferror)}, + {"ClearerrUnlocked", c.Func(c.ClearerrUnlocked)}, + {"FeofUnlocked", c.Func(c.FeofUnlocked)}, + {"FerrorUnlocked", c.Func(c.FerrorUnlocked)}, + {"Fileno", c.Func(c.Fileno)}, + {"FilenoUnlocked", c.Func(c.FilenoUnlocked)}, + {"Popen", c.Func(c.Popen)}, + {"Pclose", c.Func(c.Pclose)}, + {"Ctermid", c.Func(c.Ctermid)}, + {"Flockfile", c.Func(c.Flockfile)}, + {"Ftrylockfile", c.Func(c.Ftrylockfile)}, + {"Funlockfile", c.Func(c.Funlockfile)}, + {"Atof", c.Func(c.Atof)}, + {"Atol", c.Func(c.Atol)}, + {"Atoll", c.Func(c.Atoll)}, + {"Strtod", c.Func(c.Strtod)}, + {"Strtof", c.Func(c.Strtof)}, + {"Strtol", c.Func(c.Strtol)}, + {"Strtoul", c.Func(c.Strtoul)}, + {"Strtoq", c.Func(c.Strtoq)}, + {"Strtouq", c.Func(c.Strtouq)}, + {"Strtoll", c.Func(c.Strtoll)}, + {"Strtoull", c.Func(c.Strtoull)}, + {"L64a", c.Func(c.L64a)}, + {"A64l", c.Func(c.A64l)}, + {"Random", c.Func(c.Random)}, + {"Srandom", c.Func(c.Srandom)}, + {"Initstate", c.Func(c.Initstate)}, + {"Setstate", c.Func(c.Setstate)}, + {"*RandomData.RandomR", c.Func((*c.RandomData).RandomR)}, + {"SrandomR", c.Func(c.SrandomR)}, + {"InitstateR", c.Func(c.InitstateR)}, + {"SetstateR", c.Func(c.SetstateR)}, + {"Srand", c.Func(c.Srand)}, + {"RandR", c.Func(c.RandR)}, + {"Drand48", c.Func(c.Drand48)}, + {"Erand48", c.Func(c.Erand48)}, + {"Lrand48", c.Func(c.Lrand48)}, + {"Nrand48", c.Func(c.Nrand48)}, + {"Mrand48", c.Func(c.Mrand48)}, + {"Jrand48", c.Func(c.Jrand48)}, + {"Srand48", c.Func(c.Srand48)}, + {"Seed48", c.Func(c.Seed48)}, + {"Lcong48", c.Func(c.Lcong48)}, + {"*Drand48Data.Drand48R", c.Func((*c.Drand48Data).Drand48R)}, + {"Erand48R", c.Func(c.Erand48R)}, + {"*Drand48Data.Lrand48R", c.Func((*c.Drand48Data).Lrand48R)}, + {"Nrand48R", c.Func(c.Nrand48R)}, + {"*Drand48Data.Mrand48R", c.Func((*c.Drand48Data).Mrand48R)}, + {"Jrand48R", c.Func(c.Jrand48R)}, + {"Srand48R", c.Func(c.Srand48R)}, + {"Seed48R", c.Func(c.Seed48R)}, + {"Lcong48R", c.Func(c.Lcong48R)}, + {"Cfree", c.Func(c.Cfree)}, + {"Valloc", c.Func(c.Valloc)}, + {"PosixMemalign", c.Func(c.PosixMemalign)}, + {"AlignedAlloc", c.Func(c.AlignedAlloc)}, + {"Abort", c.Func(c.Abort)}, + {"Atexit", c.Func(c.Atexit)}, + {"AtQuickExit", c.Func(c.AtQuickExit)}, + {"OnExit", c.Func(c.OnExit)}, + {"QuickExit", c.Func(c.QuickExit)}, + {"X_Exit", c.Func(c.X_Exit)}, + {"Mktemp", c.Func(c.Mktemp)}, + {"Mkstemp", c.Func(c.Mkstemp)}, + {"Mkstemps", c.Func(c.Mkstemps)}, + {"Mkdtemp", c.Func(c.Mkdtemp)}, + {"System", c.Func(c.System)}, + {"Realpath", c.Func(c.Realpath)}, + {"Bsearch", c.Func(c.Bsearch)}, + {"Abs", c.Func(c.Abs)}, + {"Labs", c.Func(c.Labs)}, + {"Llabs", c.Func(c.Llabs)}, + {"Div", c.Func(c.Div)}, + {"Ldiv", c.Func(c.Ldiv)}, + {"Lldiv", c.Func(c.Lldiv)}, + {"Ecvt", c.Func(c.Ecvt)}, + {"Fcvt", c.Func(c.Fcvt)}, + {"Gcvt", c.Func(c.Gcvt)}, + {"EcvtR", c.Func(c.EcvtR)}, + {"FcvtR", c.Func(c.FcvtR)}, + {"Mblen", c.Func(c.Mblen)}, + {"Mbtowc", c.Func(c.Mbtowc)}, + {"Wctomb", c.Func(c.Wctomb)}, + {"Mbstowcs", c.Func(c.Mbstowcs)}, + {"Wcstombs", c.Func(c.Wcstombs)}, + {"Rpmatch", c.Func(c.Rpmatch)}, + {"Getsubopt", c.Func(c.Getsubopt)}, + {"Getloadavg", c.Func(c.Getloadavg)}, + {"Memccpy", c.Func(c.Memccpy)}, + {"Strcoll", c.Func(c.Strcoll)}, + {"Strxfrm", c.Func(c.Strxfrm)}, + {"StrcollL", c.Func(c.StrcollL)}, + {"StrxfrmL", c.Func(c.StrxfrmL)}, + {"Strcspn", c.Func(c.Strcspn)}, + {"Strspn", c.Func(c.Strspn)}, + {"Strpbrk", c.Func(c.Strpbrk)}, + {"StrtokR", c.Func(c.StrtokR)}, + {"Strnlen", c.Func(c.Strnlen)}, + {"StrerrorR", c.Func(c.StrerrorR)}, + {"StrerrorL", c.Func(c.StrerrorL)}, + {"Bcopy", c.Func(c.Bcopy)}, + {"Bzero", c.Func(c.Bzero)}, + {"Bcmp", c.Func(c.Bcmp)}, + {"Rindex", c.Func(c.Rindex)}, + {"Ffs", c.Func(c.Ffs)}, + {"Strcasecmp", c.Func(c.Strcasecmp)}, + {"Strncasecmp", c.Func(c.Strncasecmp)}, + {"Strsep", c.Func(c.Strsep)}, + {"Strsignal", c.Func(c.Strsignal)}, + {"Stpcpy", c.Func(c.Stpcpy)}, + {"Stpncpy", c.Func(c.Stpncpy)}, +} + +var generatedVariableSymbols = []struct { + name string + address unsafe.Pointer +}{} + +var generatedLifecycleCalls = []struct { + name string + check func(*testing.T) +}{ + {"mbstate union accessors", func(t *testing.T) { + var state c.X__MbstateT + word := state.X__Value.XGof_ref___wch() + bytes := state.X__Value.XGof_ref___wchb() + if unsafe.Pointer(word) != unsafe.Pointer(&state.X__Value) || unsafe.Pointer(bytes) != unsafe.Pointer(word) { + t.Fatal("union accessor offsets differ") + } + *word = 0x12345678 + if bytes[0] != 0x78 || bytes[1] != 0x56 || bytes[2] != 0x34 || bytes[3] != 0x12 { + t.Fatalf("union byte view = %v", *bytes) + } + bytes[0], bytes[1], bytes[2], bytes[3] = 1, 2, 3, 4 + if *word != 0x04030201 { + t.Fatalf("union integer view = %#x", *word) + } + }}, + + {"Cfree", func(t *testing.T) { + if c.Func(c.Cfree) != c.Func(c.Free) { + t.Fatal("cfree must resolve to the native free alias") + } + c.Cfree(nil) + ptr := c.Malloc(64) + if ptr == nil { + t.Fatal("malloc returned nil") + } + c.Memset(ptr, 0x5a, 64) + c.Cfree(ptr) + }}, +} + +// Expected values were compiled from the original macOS 14.0 / glibc 2.24 C headers. +var generatedIntegerConstants = []struct { + name string + got, want int64 +}{ + {"FNM_PATHNAME", int64(c.FNM_PATHNAME), 1}, + {"FNM_NOESCAPE", int64(c.FNM_NOESCAPE), 2}, + {"FNM_PERIOD", int64(c.FNM_PERIOD), 4}, + {"FNM_NOMATCH", int64(c.FNM_NOMATCH), 1}, + {"MB_LEN_MAX", int64(c.MB_LEN_MAX), 16}, + {"LC_CTYPE", int64(c.LC_CTYPE), 0}, + {"LC_NUMERIC", int64(c.LC_NUMERIC), 1}, + {"LC_TIME", int64(c.LC_TIME), 2}, + {"LC_COLLATE", int64(c.LC_COLLATE), 3}, + {"LC_MONETARY", int64(c.LC_MONETARY), 4}, + {"LC_MESSAGES", int64(c.LC_MESSAGES), 5}, + {"LC_ALL", int64(c.LC_ALL), 6}, + {"LC_PAPER", int64(c.LC_PAPER), 7}, + {"LC_NAME", int64(c.LC_NAME), 8}, + {"LC_ADDRESS", int64(c.LC_ADDRESS), 9}, + {"LC_TELEPHONE", int64(c.LC_TELEPHONE), 10}, + {"LC_MEASUREMENT", int64(c.LC_MEASUREMENT), 11}, + {"LC_IDENTIFICATION", int64(c.LC_IDENTIFICATION), 12}, + {"LC_CTYPE_MASK", int64(c.LC_CTYPE_MASK), 1}, + {"LC_NUMERIC_MASK", int64(c.LC_NUMERIC_MASK), 2}, + {"LC_TIME_MASK", int64(c.LC_TIME_MASK), 4}, + {"LC_COLLATE_MASK", int64(c.LC_COLLATE_MASK), 8}, + {"LC_MONETARY_MASK", int64(c.LC_MONETARY_MASK), 16}, + {"LC_MESSAGES_MASK", int64(c.LC_MESSAGES_MASK), 32}, + {"LC_PAPER_MASK", int64(c.LC_PAPER_MASK), 128}, + {"LC_NAME_MASK", int64(c.LC_NAME_MASK), 256}, + {"LC_ADDRESS_MASK", int64(c.LC_ADDRESS_MASK), 512}, + {"LC_TELEPHONE_MASK", int64(c.LC_TELEPHONE_MASK), 1024}, + {"LC_MEASUREMENT_MASK", int64(c.LC_MEASUREMENT_MASK), 2048}, + {"LC_IDENTIFICATION_MASK", int64(c.LC_IDENTIFICATION_MASK), 4096}, + {"LC_ALL_MASK", int64(c.LC_ALL_MASK), 8127}, + {"INT8_MIN", int64(c.INT8_MIN), -128}, + {"INT16_MIN", int64(c.INT16_MIN), -32768}, + {"INT32_MIN", int64(c.INT32_MIN), -2147483648}, + {"INT8_MAX", int64(c.INT8_MAX), 127}, + {"INT16_MAX", int64(c.INT16_MAX), 32767}, + {"INT32_MAX", int64(c.INT32_MAX), 2147483647}, + {"UINT8_MAX", int64(c.UINT8_MAX), 255}, + {"UINT16_MAX", int64(c.UINT16_MAX), 65535}, + {"INT_LEAST8_MIN", int64(c.INT_LEAST8_MIN), -128}, + {"INT_LEAST16_MIN", int64(c.INT_LEAST16_MIN), -32768}, + {"INT_LEAST32_MIN", int64(c.INT_LEAST32_MIN), -2147483648}, + {"INT_LEAST8_MAX", int64(c.INT_LEAST8_MAX), 127}, + {"INT_LEAST16_MAX", int64(c.INT_LEAST16_MAX), 32767}, + {"INT_LEAST32_MAX", int64(c.INT_LEAST32_MAX), 2147483647}, + {"UINT_LEAST8_MAX", int64(c.UINT_LEAST8_MAX), 255}, + {"UINT_LEAST16_MAX", int64(c.UINT_LEAST16_MAX), 65535}, + {"INT_FAST8_MIN", int64(c.INT_FAST8_MIN), -128}, + {"INT_FAST8_MAX", int64(c.INT_FAST8_MAX), 127}, + {"UINT_FAST8_MAX", int64(c.UINT_FAST8_MAX), 255}, + {"SIG_ATOMIC_MIN", int64(c.SIG_ATOMIC_MIN), -2147483648}, + {"SIG_ATOMIC_MAX", int64(c.SIG_ATOMIC_MAX), 2147483647}, + {"BUFSIZ", int64(c.BUFSIZ), 8192}, + {"RAND_MAX", int64(c.RAND_MAX), 2147483647}, + {"EXIT_FAILURE", int64(c.EXIT_FAILURE), 1}, + {"EXIT_SUCCESS", int64(c.EXIT_SUCCESS), 0}, +} +var generatedStringConstants = []struct{ name, got, want string }{ + {"PRId8", c.PRId8, "d"}, + {"PRId16", c.PRId16, "d"}, + {"PRId32", c.PRId32, "d"}, + {"PRIdLEAST8", c.PRIdLEAST8, "d"}, + {"PRIdLEAST16", c.PRIdLEAST16, "d"}, + {"PRIdLEAST32", c.PRIdLEAST32, "d"}, + {"PRIdFAST8", c.PRIdFAST8, "d"}, + {"PRIi8", c.PRIi8, "i"}, + {"PRIi16", c.PRIi16, "i"}, + {"PRIi32", c.PRIi32, "i"}, + {"PRIiLEAST8", c.PRIiLEAST8, "i"}, + {"PRIiLEAST16", c.PRIiLEAST16, "i"}, + {"PRIiLEAST32", c.PRIiLEAST32, "i"}, + {"PRIiFAST8", c.PRIiFAST8, "i"}, + {"PRIo8", c.PRIo8, "o"}, + {"PRIo16", c.PRIo16, "o"}, + {"PRIo32", c.PRIo32, "o"}, + {"PRIoLEAST8", c.PRIoLEAST8, "o"}, + {"PRIoLEAST16", c.PRIoLEAST16, "o"}, + {"PRIoLEAST32", c.PRIoLEAST32, "o"}, + {"PRIoFAST8", c.PRIoFAST8, "o"}, + {"PRIu8", c.PRIu8, "u"}, + {"PRIu16", c.PRIu16, "u"}, + {"PRIu32", c.PRIu32, "u"}, + {"PRIuLEAST8", c.PRIuLEAST8, "u"}, + {"PRIuLEAST16", c.PRIuLEAST16, "u"}, + {"PRIuLEAST32", c.PRIuLEAST32, "u"}, + {"PRIuFAST8", c.PRIuFAST8, "u"}, + {"PRIx8", c.PRIx8, "x"}, + {"PRIx16", c.PRIx16, "x"}, + {"PRIx32", c.PRIx32, "x"}, + {"PRIxLEAST8", c.PRIxLEAST8, "x"}, + {"PRIxLEAST16", c.PRIxLEAST16, "x"}, + {"PRIxLEAST32", c.PRIxLEAST32, "x"}, + {"PRIxFAST8", c.PRIxFAST8, "x"}, + {"PRIX8", c.PRIX8, "X"}, + {"PRIX16", c.PRIX16, "X"}, + {"PRIX32", c.PRIX32, "X"}, + {"PRIXLEAST8", c.PRIXLEAST8, "X"}, + {"PRIXLEAST16", c.PRIXLEAST16, "X"}, + {"PRIXLEAST32", c.PRIXLEAST32, "X"}, + {"PRIXFAST8", c.PRIXFAST8, "X"}, + {"SCNd8", c.SCNd8, "hhd"}, + {"SCNd16", c.SCNd16, "hd"}, + {"SCNd32", c.SCNd32, "d"}, + {"SCNdLEAST8", c.SCNdLEAST8, "hhd"}, + {"SCNdLEAST16", c.SCNdLEAST16, "hd"}, + {"SCNdLEAST32", c.SCNdLEAST32, "d"}, + {"SCNdFAST8", c.SCNdFAST8, "hhd"}, + {"SCNi8", c.SCNi8, "hhi"}, + {"SCNi16", c.SCNi16, "hi"}, + {"SCNi32", c.SCNi32, "i"}, + {"SCNiLEAST8", c.SCNiLEAST8, "hhi"}, + {"SCNiLEAST16", c.SCNiLEAST16, "hi"}, + {"SCNiLEAST32", c.SCNiLEAST32, "i"}, + {"SCNiFAST8", c.SCNiFAST8, "hhi"}, + {"SCNu8", c.SCNu8, "hhu"}, + {"SCNu16", c.SCNu16, "hu"}, + {"SCNu32", c.SCNu32, "u"}, + {"SCNuLEAST8", c.SCNuLEAST8, "hhu"}, + {"SCNuLEAST16", c.SCNuLEAST16, "hu"}, + {"SCNuLEAST32", c.SCNuLEAST32, "u"}, + {"SCNuFAST8", c.SCNuFAST8, "hhu"}, + {"SCNo8", c.SCNo8, "hho"}, + {"SCNo16", c.SCNo16, "ho"}, + {"SCNo32", c.SCNo32, "o"}, + {"SCNoLEAST8", c.SCNoLEAST8, "hho"}, + {"SCNoLEAST16", c.SCNoLEAST16, "ho"}, + {"SCNoLEAST32", c.SCNoLEAST32, "o"}, + {"SCNoFAST8", c.SCNoFAST8, "hho"}, + {"SCNx8", c.SCNx8, "hhx"}, + {"SCNx16", c.SCNx16, "hx"}, + {"SCNx32", c.SCNx32, "x"}, + {"SCNxLEAST8", c.SCNxLEAST8, "hhx"}, + {"SCNxLEAST16", c.SCNxLEAST16, "hx"}, + {"SCNxLEAST32", c.SCNxLEAST32, "x"}, + {"SCNxFAST8", c.SCNxFAST8, "hhx"}, + {"PTmpdir", c.PTmpdir, "/tmp"}, +} +var generatedTypeLayouts = []struct { + symbol, property string + got, want uintptr +}{ + {"CpuSetT", "size", unsafe.Sizeof(*new(c.CpuSetT)), 128}, + {"CpuSetT", "align", unsafe.Alignof(*new(c.CpuSetT)), 8}, + {"CpuSetT", "X__Bits.offset", unsafe.Offsetof((*new(c.CpuSetT)).X__Bits), 0}, + {"CpuSetT", "X__Bits.width", unsafe.Sizeof((*new(c.CpuSetT)).X__Bits), 128}, + {"Msghdr", "size", unsafe.Sizeof(*new(c.Msghdr)), 56}, + {"Msghdr", "align", unsafe.Alignof(*new(c.Msghdr)), 8}, + {"Msghdr", "MsgName.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgName), 0}, + {"Msghdr", "MsgName.width", unsafe.Sizeof((*new(c.Msghdr)).MsgName), 8}, + {"Msghdr", "MsgNamelen.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgNamelen), 8}, + {"Msghdr", "MsgNamelen.width", unsafe.Sizeof((*new(c.Msghdr)).MsgNamelen), 4}, + {"Msghdr", "MsgIov.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgIov), 16}, + {"Msghdr", "MsgIov.width", unsafe.Sizeof((*new(c.Msghdr)).MsgIov), 8}, + {"Msghdr", "MsgIovlen.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgIovlen), 24}, + {"Msghdr", "MsgIovlen.width", unsafe.Sizeof((*new(c.Msghdr)).MsgIovlen), 8}, + {"Msghdr", "MsgControl.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgControl), 32}, + {"Msghdr", "MsgControl.width", unsafe.Sizeof((*new(c.Msghdr)).MsgControl), 8}, + {"Msghdr", "MsgControllen.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgControllen), 40}, + {"Msghdr", "MsgControllen.width", unsafe.Sizeof((*new(c.Msghdr)).MsgControllen), 8}, + {"Msghdr", "MsgFlags.offset", unsafe.Offsetof((*new(c.Msghdr)).MsgFlags), 48}, + {"Msghdr", "MsgFlags.width", unsafe.Sizeof((*new(c.Msghdr)).MsgFlags), 4}, + {"Cmsghdr", "size", unsafe.Sizeof(*new(c.Cmsghdr)), 16}, + {"Cmsghdr", "align", unsafe.Alignof(*new(c.Cmsghdr)), 8}, + {"Cmsghdr", "CmsgLen.offset", unsafe.Offsetof((*new(c.Cmsghdr)).CmsgLen), 0}, + {"Cmsghdr", "CmsgLen.width", unsafe.Sizeof((*new(c.Cmsghdr)).CmsgLen), 8}, + {"Cmsghdr", "CmsgLevel.offset", unsafe.Offsetof((*new(c.Cmsghdr)).CmsgLevel), 8}, + {"Cmsghdr", "CmsgLevel.width", unsafe.Sizeof((*new(c.Cmsghdr)).CmsgLevel), 4}, + {"Cmsghdr", "CmsgType.offset", unsafe.Offsetof((*new(c.Cmsghdr)).CmsgType), 12}, + {"Cmsghdr", "CmsgType.width", unsafe.Sizeof((*new(c.Cmsghdr)).CmsgType), 4}, + {"ImaxdivT", "size", unsafe.Sizeof(*new(c.ImaxdivT)), 16}, + {"ImaxdivT", "align", unsafe.Alignof(*new(c.ImaxdivT)), 8}, + {"ImaxdivT", "Quot.offset", unsafe.Offsetof((*new(c.ImaxdivT)).Quot), 0}, + {"ImaxdivT", "Quot.width", unsafe.Sizeof((*new(c.ImaxdivT)).Quot), 8}, + {"ImaxdivT", "Rem.offset", unsafe.Offsetof((*new(c.ImaxdivT)).Rem), 8}, + {"ImaxdivT", "Rem.width", unsafe.Sizeof((*new(c.ImaxdivT)).Rem), 8}, + {"X_IO_marker", "size", unsafe.Sizeof(*new(c.X_IO_marker)), 24}, + {"X_IO_marker", "align", unsafe.Alignof(*new(c.X_IO_marker)), 8}, + {"X_IO_marker", "X_next.offset", unsafe.Offsetof((*new(c.X_IO_marker)).X_next), 0}, + {"X_IO_marker", "X_next.width", unsafe.Sizeof((*new(c.X_IO_marker)).X_next), 8}, + {"X_IO_marker", "X_sbuf.offset", unsafe.Offsetof((*new(c.X_IO_marker)).X_sbuf), 8}, + {"X_IO_marker", "X_sbuf.width", unsafe.Sizeof((*new(c.X_IO_marker)).X_sbuf), 8}, + {"X_IO_marker", "X_pos.offset", unsafe.Offsetof((*new(c.X_IO_marker)).X_pos), 16}, + {"X_IO_marker", "X_pos.width", unsafe.Sizeof((*new(c.X_IO_marker)).X_pos), 4}, + {"X_IO_FILE", "size", unsafe.Sizeof(*new(c.X_IO_FILE)), 216}, + {"X_IO_FILE", "align", unsafe.Alignof(*new(c.X_IO_FILE)), 8}, + {"X_IO_FILE", "X_flags.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_flags), 0}, + {"X_IO_FILE", "X_flags.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_flags), 4}, + {"X_IO_FILE", "X_IO_read_ptr.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_read_ptr), 8}, + {"X_IO_FILE", "X_IO_read_ptr.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_read_ptr), 8}, + {"X_IO_FILE", "X_IO_read_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_read_end), 16}, + {"X_IO_FILE", "X_IO_read_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_read_end), 8}, + {"X_IO_FILE", "X_IO_read_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_read_base), 24}, + {"X_IO_FILE", "X_IO_read_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_read_base), 8}, + {"X_IO_FILE", "X_IO_write_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_write_base), 32}, + {"X_IO_FILE", "X_IO_write_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_write_base), 8}, + {"X_IO_FILE", "X_IO_write_ptr.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_write_ptr), 40}, + {"X_IO_FILE", "X_IO_write_ptr.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_write_ptr), 8}, + {"X_IO_FILE", "X_IO_write_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_write_end), 48}, + {"X_IO_FILE", "X_IO_write_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_write_end), 8}, + {"X_IO_FILE", "X_IO_buf_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_buf_base), 56}, + {"X_IO_FILE", "X_IO_buf_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_buf_base), 8}, + {"X_IO_FILE", "X_IO_buf_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_buf_end), 64}, + {"X_IO_FILE", "X_IO_buf_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_buf_end), 8}, + {"X_IO_FILE", "X_IO_save_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_save_base), 72}, + {"X_IO_FILE", "X_IO_save_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_save_base), 8}, + {"X_IO_FILE", "X_IO_backup_base.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_backup_base), 80}, + {"X_IO_FILE", "X_IO_backup_base.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_backup_base), 8}, + {"X_IO_FILE", "X_IO_save_end.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_IO_save_end), 88}, + {"X_IO_FILE", "X_IO_save_end.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_IO_save_end), 8}, + {"X_IO_FILE", "X_markers.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_markers), 96}, + {"X_IO_FILE", "X_markers.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_markers), 8}, + {"X_IO_FILE", "X_chain.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_chain), 104}, + {"X_IO_FILE", "X_chain.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_chain), 8}, + {"X_IO_FILE", "X_fileno.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_fileno), 112}, + {"X_IO_FILE", "X_fileno.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_fileno), 4}, + {"X_IO_FILE", "X_flags2.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_flags2), 116}, + {"X_IO_FILE", "X_flags2.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_flags2), 4}, + {"X_IO_FILE", "X_oldOffset.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_oldOffset), 120}, + {"X_IO_FILE", "X_oldOffset.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_oldOffset), 8}, + {"X_IO_FILE", "X_curColumn.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_curColumn), 128}, + {"X_IO_FILE", "X_curColumn.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_curColumn), 2}, + {"X_IO_FILE", "X_vtableOffset.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_vtableOffset), 130}, + {"X_IO_FILE", "X_vtableOffset.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_vtableOffset), 1}, + {"X_IO_FILE", "X_shortbuf.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_shortbuf), 131}, + {"X_IO_FILE", "X_shortbuf.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_shortbuf), 1}, + {"X_IO_FILE", "X_lock.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_lock), 136}, + {"X_IO_FILE", "X_lock.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_lock), 8}, + {"X_IO_FILE", "X_offset.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_offset), 144}, + {"X_IO_FILE", "X_offset.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_offset), 8}, + {"X_IO_FILE", "X__Pad1.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad1), 152}, + {"X_IO_FILE", "X__Pad1.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad1), 8}, + {"X_IO_FILE", "X__Pad2.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad2), 160}, + {"X_IO_FILE", "X__Pad2.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad2), 8}, + {"X_IO_FILE", "X__Pad3.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad3), 168}, + {"X_IO_FILE", "X__Pad3.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad3), 8}, + {"X_IO_FILE", "X__Pad4.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad4), 176}, + {"X_IO_FILE", "X__Pad4.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad4), 8}, + {"X_IO_FILE", "X__Pad5.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X__Pad5), 184}, + {"X_IO_FILE", "X__Pad5.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X__Pad5), 8}, + {"X_IO_FILE", "X_mode.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_mode), 192}, + {"X_IO_FILE", "X_mode.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_mode), 4}, + {"X_IO_FILE", "X_unused2.offset", unsafe.Offsetof((*new(c.X_IO_FILE)).X_unused2), 196}, + {"X_IO_FILE", "X_unused2.width", unsafe.Sizeof((*new(c.X_IO_FILE)).X_unused2), 20}, + {"Lconv", "size", unsafe.Sizeof(*new(c.Lconv)), 96}, + {"Lconv", "align", unsafe.Alignof(*new(c.Lconv)), 8}, + {"Lconv", "DecimalPoint.offset", unsafe.Offsetof((*new(c.Lconv)).DecimalPoint), 0}, + {"Lconv", "DecimalPoint.width", unsafe.Sizeof((*new(c.Lconv)).DecimalPoint), 8}, + {"Lconv", "ThousandsSep.offset", unsafe.Offsetof((*new(c.Lconv)).ThousandsSep), 8}, + {"Lconv", "ThousandsSep.width", unsafe.Sizeof((*new(c.Lconv)).ThousandsSep), 8}, + {"Lconv", "Grouping.offset", unsafe.Offsetof((*new(c.Lconv)).Grouping), 16}, + {"Lconv", "Grouping.width", unsafe.Sizeof((*new(c.Lconv)).Grouping), 8}, + {"Lconv", "IntCurrSymbol.offset", unsafe.Offsetof((*new(c.Lconv)).IntCurrSymbol), 24}, + {"Lconv", "IntCurrSymbol.width", unsafe.Sizeof((*new(c.Lconv)).IntCurrSymbol), 8}, + {"Lconv", "CurrencySymbol.offset", unsafe.Offsetof((*new(c.Lconv)).CurrencySymbol), 32}, + {"Lconv", "CurrencySymbol.width", unsafe.Sizeof((*new(c.Lconv)).CurrencySymbol), 8}, + {"Lconv", "MonDecimalPoint.offset", unsafe.Offsetof((*new(c.Lconv)).MonDecimalPoint), 40}, + {"Lconv", "MonDecimalPoint.width", unsafe.Sizeof((*new(c.Lconv)).MonDecimalPoint), 8}, + {"Lconv", "MonThousandsSep.offset", unsafe.Offsetof((*new(c.Lconv)).MonThousandsSep), 48}, + {"Lconv", "MonThousandsSep.width", unsafe.Sizeof((*new(c.Lconv)).MonThousandsSep), 8}, + {"Lconv", "MonGrouping.offset", unsafe.Offsetof((*new(c.Lconv)).MonGrouping), 56}, + {"Lconv", "MonGrouping.width", unsafe.Sizeof((*new(c.Lconv)).MonGrouping), 8}, + {"Lconv", "PositiveSign.offset", unsafe.Offsetof((*new(c.Lconv)).PositiveSign), 64}, + {"Lconv", "PositiveSign.width", unsafe.Sizeof((*new(c.Lconv)).PositiveSign), 8}, + {"Lconv", "NegativeSign.offset", unsafe.Offsetof((*new(c.Lconv)).NegativeSign), 72}, + {"Lconv", "NegativeSign.width", unsafe.Sizeof((*new(c.Lconv)).NegativeSign), 8}, + {"Lconv", "IntFracDigits.offset", unsafe.Offsetof((*new(c.Lconv)).IntFracDigits), 80}, + {"Lconv", "IntFracDigits.width", unsafe.Sizeof((*new(c.Lconv)).IntFracDigits), 1}, + {"Lconv", "FracDigits.offset", unsafe.Offsetof((*new(c.Lconv)).FracDigits), 81}, + {"Lconv", "FracDigits.width", unsafe.Sizeof((*new(c.Lconv)).FracDigits), 1}, + {"Lconv", "PCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).PCsPrecedes), 82}, + {"Lconv", "PCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).PCsPrecedes), 1}, + {"Lconv", "PSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).PSepBySpace), 83}, + {"Lconv", "PSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).PSepBySpace), 1}, + {"Lconv", "NCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).NCsPrecedes), 84}, + {"Lconv", "NCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).NCsPrecedes), 1}, + {"Lconv", "NSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).NSepBySpace), 85}, + {"Lconv", "NSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).NSepBySpace), 1}, + {"Lconv", "PSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).PSignPosn), 86}, + {"Lconv", "PSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).PSignPosn), 1}, + {"Lconv", "NSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).NSignPosn), 87}, + {"Lconv", "NSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).NSignPosn), 1}, + {"Lconv", "IntPCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).IntPCsPrecedes), 88}, + {"Lconv", "IntPCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).IntPCsPrecedes), 1}, + {"Lconv", "IntPSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).IntPSepBySpace), 89}, + {"Lconv", "IntPSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).IntPSepBySpace), 1}, + {"Lconv", "IntNCsPrecedes.offset", unsafe.Offsetof((*new(c.Lconv)).IntNCsPrecedes), 90}, + {"Lconv", "IntNCsPrecedes.width", unsafe.Sizeof((*new(c.Lconv)).IntNCsPrecedes), 1}, + {"Lconv", "IntNSepBySpace.offset", unsafe.Offsetof((*new(c.Lconv)).IntNSepBySpace), 91}, + {"Lconv", "IntNSepBySpace.width", unsafe.Sizeof((*new(c.Lconv)).IntNSepBySpace), 1}, + {"Lconv", "IntPSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).IntPSignPosn), 92}, + {"Lconv", "IntPSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).IntPSignPosn), 1}, + {"Lconv", "IntNSignPosn.offset", unsafe.Offsetof((*new(c.Lconv)).IntNSignPosn), 93}, + {"Lconv", "IntNSignPosn.width", unsafe.Sizeof((*new(c.Lconv)).IntNSignPosn), 1}, + {"Rpcent", "size", unsafe.Sizeof(*new(c.Rpcent)), 24}, + {"Rpcent", "align", unsafe.Alignof(*new(c.Rpcent)), 8}, + {"Rpcent", "RName.offset", unsafe.Offsetof((*new(c.Rpcent)).RName), 0}, + {"Rpcent", "RName.width", unsafe.Sizeof((*new(c.Rpcent)).RName), 8}, + {"Rpcent", "RAliases.offset", unsafe.Offsetof((*new(c.Rpcent)).RAliases), 8}, + {"Rpcent", "RAliases.width", unsafe.Sizeof((*new(c.Rpcent)).RAliases), 8}, + {"Rpcent", "RNumber.offset", unsafe.Offsetof((*new(c.Rpcent)).RNumber), 16}, + {"Rpcent", "RNumber.width", unsafe.Sizeof((*new(c.Rpcent)).RNumber), 4}, + {"FposT", "size", unsafe.Sizeof(*new(c.FposT)), 16}, + {"FposT", "align", unsafe.Alignof(*new(c.FposT)), 8}, + {"FposT", "X__Pos.offset", unsafe.Offsetof((*new(c.FposT)).X__Pos), 0}, + {"FposT", "X__Pos.width", unsafe.Sizeof((*new(c.FposT)).X__Pos), 8}, + {"FposT", "X__State.offset", unsafe.Offsetof((*new(c.FposT)).X__State), 8}, + {"FposT", "X__State.width", unsafe.Sizeof((*new(c.FposT)).X__State), 8}, + {"RandomData", "size", unsafe.Sizeof(*new(c.RandomData)), 48}, + {"RandomData", "align", unsafe.Alignof(*new(c.RandomData)), 8}, + {"RandomData", "Fptr.offset", unsafe.Offsetof((*new(c.RandomData)).Fptr), 0}, + {"RandomData", "Fptr.width", unsafe.Sizeof((*new(c.RandomData)).Fptr), 8}, + {"RandomData", "Rptr.offset", unsafe.Offsetof((*new(c.RandomData)).Rptr), 8}, + {"RandomData", "Rptr.width", unsafe.Sizeof((*new(c.RandomData)).Rptr), 8}, + {"RandomData", "State.offset", unsafe.Offsetof((*new(c.RandomData)).State), 16}, + {"RandomData", "State.width", unsafe.Sizeof((*new(c.RandomData)).State), 8}, + {"RandomData", "RandType.offset", unsafe.Offsetof((*new(c.RandomData)).RandType), 24}, + {"RandomData", "RandType.width", unsafe.Sizeof((*new(c.RandomData)).RandType), 4}, + {"RandomData", "RandDeg.offset", unsafe.Offsetof((*new(c.RandomData)).RandDeg), 28}, + {"RandomData", "RandDeg.width", unsafe.Sizeof((*new(c.RandomData)).RandDeg), 4}, + {"RandomData", "RandSep.offset", unsafe.Offsetof((*new(c.RandomData)).RandSep), 32}, + {"RandomData", "RandSep.width", unsafe.Sizeof((*new(c.RandomData)).RandSep), 4}, + {"RandomData", "EndPtr.offset", unsafe.Offsetof((*new(c.RandomData)).EndPtr), 40}, + {"RandomData", "EndPtr.width", unsafe.Sizeof((*new(c.RandomData)).EndPtr), 8}, + {"Drand48Data", "size", unsafe.Sizeof(*new(c.Drand48Data)), 24}, + {"Drand48Data", "align", unsafe.Alignof(*new(c.Drand48Data)), 8}, + {"Drand48Data", "X__X.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__X), 0}, + {"Drand48Data", "X__X.width", unsafe.Sizeof((*new(c.Drand48Data)).X__X), 6}, + {"Drand48Data", "X__OldX.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__OldX), 6}, + {"Drand48Data", "X__OldX.width", unsafe.Sizeof((*new(c.Drand48Data)).X__OldX), 6}, + {"Drand48Data", "X__C.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__C), 12}, + {"Drand48Data", "X__C.width", unsafe.Sizeof((*new(c.Drand48Data)).X__C), 2}, + {"Drand48Data", "X__Init.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__Init), 14}, + {"Drand48Data", "X__Init.width", unsafe.Sizeof((*new(c.Drand48Data)).X__Init), 2}, + {"Drand48Data", "X__A.offset", unsafe.Offsetof((*new(c.Drand48Data)).X__A), 16}, + {"Drand48Data", "X__A.width", unsafe.Sizeof((*new(c.Drand48Data)).X__A), 8}, + {"X__ComparFnT", "size", unsafe.Sizeof(*new(c.X__ComparFnT)), 8}, + {"X__ComparFnT", "align", unsafe.Alignof(*new(c.X__ComparFnT)), 8}, + {"X__MbstateT", "size", unsafe.Sizeof(*new(c.X__MbstateT)), 8}, + {"X__MbstateT", "align", unsafe.Alignof(*new(c.X__MbstateT)), 4}, + {"X__MbstateT", "X__Count.offset", unsafe.Offsetof((*new(c.X__MbstateT)).X__Count), 0}, + {"X__MbstateT", "X__Count.width", unsafe.Sizeof((*new(c.X__MbstateT)).X__Count), 4}, + {"X__MbstateT", "X__Value.offset", unsafe.Offsetof((*new(c.X__MbstateT)).X__Value), 4}, + {"X__MbstateT", "X__Value.width", unsafe.Sizeof((*new(c.X__MbstateT)).X__Value), 4}, + {"X__LocaleStruct", "size", unsafe.Sizeof(*new(c.X__LocaleStruct)), 232}, + {"X__LocaleStruct", "align", unsafe.Alignof(*new(c.X__LocaleStruct)), 8}, + {"X__LocaleStruct", "X__Locales.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__Locales), 0}, + {"X__LocaleStruct", "X__Locales.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__Locales), 104}, + {"X__LocaleStruct", "X__CtypeB.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__CtypeB), 104}, + {"X__LocaleStruct", "X__CtypeB.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__CtypeB), 8}, + {"X__LocaleStruct", "X__CtypeTolower.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__CtypeTolower), 112}, + {"X__LocaleStruct", "X__CtypeTolower.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__CtypeTolower), 8}, + {"X__LocaleStruct", "X__CtypeToupper.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__CtypeToupper), 120}, + {"X__LocaleStruct", "X__CtypeToupper.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__CtypeToupper), 8}, + {"X__LocaleStruct", "X__Names.offset", unsafe.Offsetof((*new(c.X__LocaleStruct)).X__Names), 128}, + {"X__LocaleStruct", "X__Names.width", unsafe.Sizeof((*new(c.X__LocaleStruct)).X__Names), 104}, + {"X__LocaleData", "pointer_size", unsafe.Sizeof(*new(*c.X__LocaleData)), 8}, + {"X__LocaleData", "pointer_align", unsafe.Alignof(*new(*c.X__LocaleData)), 8}, + {"X__LocaleT", "size", unsafe.Sizeof(*new(c.X__LocaleT)), 8}, + {"X__LocaleT", "align", unsafe.Alignof(*new(c.X__LocaleT)), 8}, + {"X_GFposT", "size", unsafe.Sizeof(*new(c.X_GFposT)), 16}, + {"X_GFposT", "align", unsafe.Alignof(*new(c.X_GFposT)), 8}, + {"X_GFposT", "X__Pos.offset", unsafe.Offsetof((*new(c.X_GFposT)).X__Pos), 0}, + {"X_GFposT", "X__Pos.width", unsafe.Sizeof((*new(c.X_GFposT)).X__Pos), 8}, + {"X_GFposT", "X__State.offset", unsafe.Offsetof((*new(c.X_GFposT)).X__State), 8}, + {"X_GFposT", "X__State.width", unsafe.Sizeof((*new(c.X_GFposT)).X__State), 8}, + {"Iovec", "size", unsafe.Sizeof(*new(c.Iovec)), 16}, + {"Iovec", "align", unsafe.Alignof(*new(c.Iovec)), 8}, + {"Iovec", "IovBase.offset", unsafe.Offsetof((*new(c.Iovec)).IovBase), 0}, + {"Iovec", "IovBase.width", unsafe.Sizeof((*new(c.Iovec)).IovBase), 8}, + {"Iovec", "IovLen.offset", unsafe.Offsetof((*new(c.Iovec)).IovLen), 8}, + {"Iovec", "IovLen.width", unsafe.Sizeof((*new(c.Iovec)).IovLen), 8}, +} + +var generatedAccessorSymbols = []string{"XGof_ref___wch", "XGof_ref___wchb"} + +// Each slot is classified by Clang from the original native C prototype. +var generatedFunctionPrototypes = []struct { + name string + signature reflect.Type + variadic bool + inputs []nativeABISlot + output *nativeABISlot +}{ + {"Isalnum", reflect.TypeOf(c.Isalnum), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isalpha", reflect.TypeOf(c.Isalpha), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Iscntrl", reflect.TypeOf(c.Iscntrl), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isdigit", reflect.TypeOf(c.Isdigit), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Islower", reflect.TypeOf(c.Islower), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isgraph", reflect.TypeOf(c.Isgraph), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isprint", reflect.TypeOf(c.Isprint), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ispunct", reflect.TypeOf(c.Ispunct), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isspace", reflect.TypeOf(c.Isspace), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isupper", reflect.TypeOf(c.Isupper), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isxdigit", reflect.TypeOf(c.Isxdigit), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Tolower", reflect.TypeOf(c.Tolower), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Toupper", reflect.TypeOf(c.Toupper), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isblank", reflect.TypeOf(c.Isblank), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Isascii", reflect.TypeOf(c.Isascii), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Toascii", reflect.TypeOf(c.Toascii), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"X_toupper", reflect.TypeOf(c.X_toupper), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"X_tolower", reflect.TypeOf(c.X_tolower), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"IsalnumL", reflect.TypeOf(c.IsalnumL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsalphaL", reflect.TypeOf(c.IsalphaL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IscntrlL", reflect.TypeOf(c.IscntrlL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsdigitL", reflect.TypeOf(c.IsdigitL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IslowerL", reflect.TypeOf(c.IslowerL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsgraphL", reflect.TypeOf(c.IsgraphL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsprintL", reflect.TypeOf(c.IsprintL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IspunctL", reflect.TypeOf(c.IspunctL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsspaceL", reflect.TypeOf(c.IsspaceL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsupperL", reflect.TypeOf(c.IsupperL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsxdigitL", reflect.TypeOf(c.IsxdigitL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"IsblankL", reflect.TypeOf(c.IsblankL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"TolowerL", reflect.TypeOf(c.TolowerL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"ToupperL", reflect.TypeOf(c.ToupperL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fnmatch", reflect.TypeOf(c.Fnmatch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Imaxabs", reflect.TypeOf(c.Imaxabs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Imaxdiv", reflect.TypeOf(c.Imaxdiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Strtoimax", reflect.TypeOf(c.Strtoimax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoumax", reflect.TypeOf(c.Strtoumax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstoimax", reflect.TypeOf(c.Wcstoimax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstoumax", reflect.TypeOf(c.Wcstoumax), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Dirname", reflect.TypeOf(c.Dirname), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"X__XpgBasename", reflect.TypeOf(c.X__XpgBasename), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setlocale", reflect.TypeOf(c.Setlocale), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Localeconv", reflect.TypeOf(c.Localeconv), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"Newlocale", reflect.TypeOf(c.Newlocale), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"X__LocaleT.Duplocale", reflect.TypeOf((c.X__LocaleT).Duplocale), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"X__LocaleT.Freelocale", reflect.TypeOf((c.X__LocaleT).Freelocale), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"X__LocaleT.Uselocale", reflect.TypeOf((c.X__LocaleT).Uselocale), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setrpcent", reflect.TypeOf(c.Setrpcent), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Endrpcent", reflect.TypeOf(c.Endrpcent), false, []nativeABISlot{}, nil}, + {"Getrpcbyname", reflect.TypeOf(c.Getrpcbyname), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Getrpcbynumber", reflect.TypeOf(c.Getrpcbynumber), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Getrpcent", reflect.TypeOf(c.Getrpcent), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"GetrpcbynameR", reflect.TypeOf(c.GetrpcbynameR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"GetrpcbynumberR", reflect.TypeOf(c.GetrpcbynumberR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"*Rpcent.GetrpcentR", reflect.TypeOf((*c.Rpcent).GetrpcentR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Renameat", reflect.TypeOf(c.Renameat), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Tmpfile", reflect.TypeOf(c.Tmpfile), false, []nativeABISlot{}, &nativeABISlot{8, 8, 5}}, + {"Tmpnam", reflect.TypeOf(c.Tmpnam), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"TmpnamR", reflect.TypeOf(c.TmpnamR), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Tempnam", reflect.TypeOf(c.Tempnam), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"FflushUnlocked", reflect.TypeOf(c.FflushUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Freopen", reflect.TypeOf(c.Freopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fdopen", reflect.TypeOf(c.Fdopen), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fmemopen", reflect.TypeOf(c.Fmemopen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"OpenMemstream", reflect.TypeOf(c.OpenMemstream), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Setbuf", reflect.TypeOf(c.Setbuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, nil}, + {"Setvbuf", reflect.TypeOf(c.Setvbuf), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Setbuffer", reflect.TypeOf(c.Setbuffer), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"Setlinebuf", reflect.TypeOf(c.Setlinebuf), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Dprintf", reflect.TypeOf(c.Dprintf), true, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fscanf", reflect.TypeOf(c.Fscanf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Scanf", reflect.TypeOf(c.Scanf), true, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Sscanf", reflect.TypeOf(c.Sscanf), true, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgetc", reflect.TypeOf(c.Fgetc), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getc", reflect.TypeOf(c.Getc), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getchar", reflect.TypeOf(c.Getchar), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"GetcUnlocked", reflect.TypeOf(c.GetcUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"GetcharUnlocked", reflect.TypeOf(c.GetcharUnlocked), false, []nativeABISlot{}, &nativeABISlot{4, 4, 1}}, + {"FgetcUnlocked", reflect.TypeOf(c.FgetcUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putc", reflect.TypeOf(c.Putc), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putchar", reflect.TypeOf(c.Putchar), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"FputcUnlocked", reflect.TypeOf(c.FputcUnlocked), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"PutcUnlocked", reflect.TypeOf(c.PutcUnlocked), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"PutcharUnlocked", reflect.TypeOf(c.PutcharUnlocked), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Getw", reflect.TypeOf(c.Getw), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Putw", reflect.TypeOf(c.Putw), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fgets", reflect.TypeOf(c.Fgets), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Getdelim", reflect.TypeOf(c.Getdelim), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Getline", reflect.TypeOf(c.Getline), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Puts", reflect.TypeOf(c.Puts), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ungetc", reflect.TypeOf(c.Ungetc), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"FreadUnlocked", reflect.TypeOf(c.FreadUnlocked), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"FwriteUnlocked", reflect.TypeOf(c.FwriteUnlocked), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Fseek", reflect.TypeOf(c.Fseek), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ftell", reflect.TypeOf(c.Ftell), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Rewind", reflect.TypeOf(c.Rewind), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Fseeko", reflect.TypeOf(c.Fseeko), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Ftello", reflect.TypeOf(c.Ftello), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Fgetpos", reflect.TypeOf(c.Fgetpos), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fsetpos", reflect.TypeOf(c.Fsetpos), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Clearerr", reflect.TypeOf(c.Clearerr), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Feof", reflect.TypeOf(c.Feof), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ferror", reflect.TypeOf(c.Ferror), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"ClearerrUnlocked", reflect.TypeOf(c.ClearerrUnlocked), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"FeofUnlocked", reflect.TypeOf(c.FeofUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"FerrorUnlocked", reflect.TypeOf(c.FerrorUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Fileno", reflect.TypeOf(c.Fileno), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"FilenoUnlocked", reflect.TypeOf(c.FilenoUnlocked), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Popen", reflect.TypeOf(c.Popen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Pclose", reflect.TypeOf(c.Pclose), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Ctermid", reflect.TypeOf(c.Ctermid), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Flockfile", reflect.TypeOf(c.Flockfile), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Ftrylockfile", reflect.TypeOf(c.Ftrylockfile), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Funlockfile", reflect.TypeOf(c.Funlockfile), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Atof", reflect.TypeOf(c.Atof), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Atol", reflect.TypeOf(c.Atol), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Atoll", reflect.TypeOf(c.Atoll), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strtod", reflect.TypeOf(c.Strtod), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Strtof", reflect.TypeOf(c.Strtof), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 8}}, + {"Strtol", reflect.TypeOf(c.Strtol), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoul", reflect.TypeOf(c.Strtoul), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoq", reflect.TypeOf(c.Strtoq), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtouq", reflect.TypeOf(c.Strtouq), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoll", reflect.TypeOf(c.Strtoll), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"Strtoull", reflect.TypeOf(c.Strtoull), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 1}}, + {"L64a", reflect.TypeOf(c.L64a), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"A64l", reflect.TypeOf(c.A64l), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Random", reflect.TypeOf(c.Random), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Srandom", reflect.TypeOf(c.Srandom), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Initstate", reflect.TypeOf(c.Initstate), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Setstate", reflect.TypeOf(c.Setstate), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"*RandomData.RandomR", reflect.TypeOf((*c.RandomData).RandomR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"SrandomR", reflect.TypeOf(c.SrandomR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"InitstateR", reflect.TypeOf(c.InitstateR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"SetstateR", reflect.TypeOf(c.SetstateR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Srand", reflect.TypeOf(c.Srand), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"RandR", reflect.TypeOf(c.RandR), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Drand48", reflect.TypeOf(c.Drand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 8}}, + {"Erand48", reflect.TypeOf(c.Erand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 8}}, + {"Lrand48", reflect.TypeOf(c.Lrand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Nrand48", reflect.TypeOf(c.Nrand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Mrand48", reflect.TypeOf(c.Mrand48), false, []nativeABISlot{}, &nativeABISlot{8, 8, 1}}, + {"Jrand48", reflect.TypeOf(c.Jrand48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Srand48", reflect.TypeOf(c.Srand48), false, []nativeABISlot{{8, 8, 1}}, nil}, + {"Seed48", reflect.TypeOf(c.Seed48), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Lcong48", reflect.TypeOf(c.Lcong48), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"*Drand48Data.Drand48R", reflect.TypeOf((*c.Drand48Data).Drand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Erand48R", reflect.TypeOf(c.Erand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"*Drand48Data.Lrand48R", reflect.TypeOf((*c.Drand48Data).Lrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Nrand48R", reflect.TypeOf(c.Nrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"*Drand48Data.Mrand48R", reflect.TypeOf((*c.Drand48Data).Mrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Jrand48R", reflect.TypeOf(c.Jrand48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Srand48R", reflect.TypeOf(c.Srand48R), false, []nativeABISlot{{8, 8, 1}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Seed48R", reflect.TypeOf(c.Seed48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Lcong48R", reflect.TypeOf(c.Lcong48R), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Cfree", reflect.TypeOf(c.Cfree), false, []nativeABISlot{{8, 8, 5}}, nil}, + {"Valloc", reflect.TypeOf(c.Valloc), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"PosixMemalign", reflect.TypeOf(c.PosixMemalign), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"AlignedAlloc", reflect.TypeOf(c.AlignedAlloc), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Abort", reflect.TypeOf(c.Abort), false, []nativeABISlot{}, nil}, + {"Atexit", reflect.TypeOf(c.Atexit), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"AtQuickExit", reflect.TypeOf(c.AtQuickExit), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"OnExit", reflect.TypeOf(c.OnExit), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"QuickExit", reflect.TypeOf(c.QuickExit), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"X_Exit", reflect.TypeOf(c.X_Exit), false, []nativeABISlot{{4, 4, 1}}, nil}, + {"Mktemp", reflect.TypeOf(c.Mktemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Mkstemp", reflect.TypeOf(c.Mkstemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Mkstemps", reflect.TypeOf(c.Mkstemps), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mkdtemp", reflect.TypeOf(c.Mkdtemp), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"System", reflect.TypeOf(c.System), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Realpath", reflect.TypeOf(c.Realpath), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Bsearch", reflect.TypeOf(c.Bsearch), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Abs", reflect.TypeOf(c.Abs), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Labs", reflect.TypeOf(c.Labs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Llabs", reflect.TypeOf(c.Llabs), false, []nativeABISlot{{8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Div", reflect.TypeOf(c.Div), false, []nativeABISlot{{4, 4, 1}, {4, 4, 1}}, &nativeABISlot{8, 4, 12}}, + {"Ldiv", reflect.TypeOf(c.Ldiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Lldiv", reflect.TypeOf(c.Lldiv), false, []nativeABISlot{{8, 8, 1}, {8, 8, 1}}, &nativeABISlot{16, 8, 12}}, + {"Ecvt", reflect.TypeOf(c.Ecvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Fcvt", reflect.TypeOf(c.Fcvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Gcvt", reflect.TypeOf(c.Gcvt), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"EcvtR", reflect.TypeOf(c.EcvtR), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"FcvtR", reflect.TypeOf(c.FcvtR), false, []nativeABISlot{{8, 8, 8}, {4, 4, 1}, {8, 8, 5}, {8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mblen", reflect.TypeOf(c.Mblen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mbtowc", reflect.TypeOf(c.Mbtowc), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Wctomb", reflect.TypeOf(c.Wctomb), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Mbstowcs", reflect.TypeOf(c.Mbstowcs), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Wcstombs", reflect.TypeOf(c.Wcstombs), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"Rpmatch", reflect.TypeOf(c.Rpmatch), false, []nativeABISlot{{8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getsubopt", reflect.TypeOf(c.Getsubopt), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Getloadavg", reflect.TypeOf(c.Getloadavg), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Memccpy", reflect.TypeOf(c.Memccpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {4, 4, 1}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, + {"Strcoll", reflect.TypeOf(c.Strcoll), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Strxfrm", reflect.TypeOf(c.Strxfrm), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"StrcollL", reflect.TypeOf(c.StrcollL), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"StrxfrmL", reflect.TypeOf(c.StrxfrmL), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strcspn", reflect.TypeOf(c.Strcspn), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strspn", reflect.TypeOf(c.Strspn), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 1}}, + {"Strpbrk", reflect.TypeOf(c.Strpbrk), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"StrtokR", reflect.TypeOf(c.StrtokR), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Strnlen", reflect.TypeOf(c.Strnlen), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 1}}, + {"StrerrorR", reflect.TypeOf(c.StrerrorR), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"StrerrorL", reflect.TypeOf(c.StrerrorL), false, []nativeABISlot{{4, 4, 1}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Bcopy", reflect.TypeOf(c.Bcopy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, nil}, + {"Bzero", reflect.TypeOf(c.Bzero), false, []nativeABISlot{{8, 8, 5}, {8, 8, 1}}, nil}, + {"Bcmp", reflect.TypeOf(c.Bcmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Rindex", reflect.TypeOf(c.Rindex), false, []nativeABISlot{{8, 8, 5}, {4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Ffs", reflect.TypeOf(c.Ffs), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{4, 4, 1}}, + {"Strcasecmp", reflect.TypeOf(c.Strcasecmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{4, 4, 1}}, + {"Strncasecmp", reflect.TypeOf(c.Strncasecmp), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{4, 4, 1}}, + {"Strsep", reflect.TypeOf(c.Strsep), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Strsignal", reflect.TypeOf(c.Strsignal), false, []nativeABISlot{{4, 4, 1}}, &nativeABISlot{8, 8, 5}}, + {"Stpcpy", reflect.TypeOf(c.Stpcpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}}, &nativeABISlot{8, 8, 5}}, + {"Stpncpy", reflect.TypeOf(c.Stpncpy), false, []nativeABISlot{{8, 8, 5}, {8, 8, 5}, {8, 8, 1}}, &nativeABISlot{8, 8, 5}}, +} diff --git a/c/libc_native_llgo_test.go b/c/libc_native_llgo_test.go new file mode 100644 index 00000000..5a397503 --- /dev/null +++ b/c/libc_native_llgo_test.go @@ -0,0 +1,540 @@ +//go:build llgo && ((darwin && arm64 && !ios) || (linux && (amd64 || arm64) && !android)) + +// Copyright (c) 2026 The XGo Authors. Licensed under the Apache License 2.0. + +package c_test + +import ( + "go/ast" + "go/parser" + "go/token" + "os" + "reflect" + "runtime" + "strings" + "testing" + "unsafe" + + "github.com/goplus/lib/c" +) + +type nativeABISlot struct { + size, align uintptr + class int +} + +func TestNativeLibcLayouts(t *testing.T) { + t.Run("native function prototypes", func(t *testing.T) { + checkSlot := func(t *testing.T, name string, got reflect.Type, want nativeABISlot) { + if got.Size() != want.size || uintptr(got.Align()) != want.align { + t.Errorf("%s size/alignment = %d/%d, C = %d/%d", name, got.Size(), got.Align(), want.size, want.align) + } + class := 0 + switch got.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + class = 1 + case reflect.Ptr, reflect.UnsafePointer, reflect.Func: + class = 5 + case reflect.Float32, reflect.Float64: + class = 8 + case reflect.Struct: + class = 12 + } + if class != want.class { + t.Errorf("%s ABI class = %d (%v), C = %d", name, class, got.Kind(), want.class) + } + } + for _, tc := range generatedFunctionPrototypes { + t.Run(tc.name, func(t *testing.T) { + wantInputs := len(tc.inputs) + if tc.variadic { + wantInputs++ + } + if tc.signature.Kind() != reflect.Func || tc.signature.NumIn() != wantInputs || tc.signature.IsVariadic() != tc.variadic { + t.Fatalf("Go parameters/variadic = %v, C fixed parameters = %d, variadic = %v", tc.signature, len(tc.inputs), tc.variadic) + } + for i, slot := range tc.inputs { + checkSlot(t, "parameter", tc.signature.In(i), slot) + } + wantOutputs := 0 + if tc.output != nil { + wantOutputs = 1 + } + if tc.signature.NumOut() != wantOutputs { + t.Fatalf("Go result count = %d, C = %d", tc.signature.NumOut(), wantOutputs) + } + if tc.output != nil { + checkSlot(t, "result", tc.signature.Out(0), *tc.output) + } + }) + } + }) + t.Run("symbol inventory", func(t *testing.T) { + filename := "libc_" + runtime.GOOS + "_" + runtime.GOARCH + ".go" + source, err := parser.ParseFile(token.NewFileSet(), filename, nil, 0) + if err != nil { + t.Fatal(err) + } + functions, types, constants, variables := map[string]bool{}, map[string]bool{}, map[string]bool{}, map[string]bool{} + prototypes := map[string]bool{} + for _, prototype := range generatedFunctionPrototypes { + prototypes[prototype.name] = true + } + for _, symbol := range generatedFunctionSymbols { + functions[symbol.name] = true + if !prototypes[symbol.name] { + t.Errorf("generated C function %s has no native prototype test", symbol.name) + } + } + for _, name := range generatedAccessorSymbols { + functions[name] = true + } + for _, tc := range generatedTypeLayouts { + types[tc.symbol] = true + } + for _, tc := range generatedIntegerConstants { + constants[tc.name] = true + } + for _, tc := range generatedStringConstants { + constants[tc.name] = true + } + for _, symbol := range generatedVariableSymbols { + variables[symbol.name] = true + } + for _, declaration := range source.Decls { + switch decl := declaration.(type) { + case *ast.FuncDecl: + name := decl.Name.Name + if !ast.IsExported(name) { + continue + } + if decl.Recv != nil { + receiver, prefix := decl.Recv.List[0].Type, "" + if pointer, ok := receiver.(*ast.StarExpr); ok { + receiver, prefix = pointer.X, "*" + } + id := receiver.(*ast.Ident).Name + if !strings.HasPrefix(id, "_llcppg_anon_") { + name = prefix + id + "." + name + } + } + if !functions[name] { + t.Errorf("generated function %s has no symbol test", name) + } + case *ast.GenDecl: + for _, specification := range decl.Specs { + switch spec := specification.(type) { + case *ast.TypeSpec: + if ast.IsExported(spec.Name.Name) && !types[spec.Name.Name] { + t.Errorf("generated type %s has no native ABI test", spec.Name.Name) + } + case *ast.ValueSpec: + for _, name := range spec.Names { + if !ast.IsExported(name.Name) { + continue + } + if decl.Tok == token.CONST && name.Name == "LLGoPackage" { + if c.LLGoPackage != "link" { + t.Errorf("generated Go accessors require LLGoPackage=link, got %q", c.LLGoPackage) + } + continue + } + if decl.Tok == token.CONST && !constants[name.Name] { + t.Errorf("generated constant %s has no native value test", name.Name) + } + if decl.Tok == token.VAR && !variables[name.Name] { + t.Errorf("generated variable %s has no symbol test", name.Name) + } + } + } + } + } + } + }) + t.Run("native constants", func(t *testing.T) { + for _, tc := range generatedIntegerConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %d, C headers = %d", tc.got, tc.want) + } + }) + } + for _, tc := range generatedStringConstants { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go constant = %q, C headers = %q", tc.got, tc.want) + } + }) + } + }) + t.Run("native types", func(t *testing.T) { + for _, tc := range generatedTypeLayouts { + t.Run(tc.symbol+"/"+tc.property, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("Go layout = %d, C headers = %d", tc.got, tc.want) + } + }) + } + }) + t.Run("function symbols", func(t *testing.T) { + for _, symbol := range generatedFunctionSymbols { + t.Run(symbol.name, func(t *testing.T) { + if symbol.address == nil { + t.Fatal("C function address is nil") + } + t.Logf("C function address: %p", symbol.address) + }) + } + }) + t.Run("variable symbols", func(t *testing.T) { + for _, symbol := range generatedVariableSymbols { + t.Run(symbol.name, func(t *testing.T) { + if symbol.address == nil { + t.Fatal("C variable address is nil") + } + t.Logf("C variable address: %p", symbol.address) + }) + } + }) + var iovec c.Iovec + var div c.DivT + var ldiv c.LdivT + var lldiv c.LldivT + var imaxdiv c.ImaxdivT + var filePosition nativeFilePosition + // These values come from the original macOS 14 SDK and glibc 2.24 headers. + cases := []struct { + name string + size, align, wantSize, wantAlign uintptr + }{ + {"iovec", unsafe.Sizeof(iovec), unsafe.Alignof(iovec), 16, 8}, + {"div_t", unsafe.Sizeof(div), unsafe.Alignof(div), 8, 4}, + {"ldiv_t", unsafe.Sizeof(ldiv), unsafe.Alignof(ldiv), 16, 8}, + {"lldiv_t", unsafe.Sizeof(lldiv), unsafe.Alignof(lldiv), 16, 8}, + {"imaxdiv_t", unsafe.Sizeof(imaxdiv), unsafe.Alignof(imaxdiv), 16, 8}, + {"fpos_t", unsafe.Sizeof(filePosition), unsafe.Alignof(filePosition), nativeFilePositionSize, 8}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + if tc.size != tc.wantSize || tc.align != tc.wantAlign { + t.Fatalf("size/alignment = %d/%d, want %d/%d", tc.size, tc.align, tc.wantSize, tc.wantAlign) + } + }) + } + if unsafe.Offsetof(iovec.IovBase) != 0 || unsafe.Offsetof(iovec.IovLen) != 8 || unsafe.Sizeof(iovec.IovLen) != 8 { + t.Fatalf("iovec fields: base=%d len=%d width=%d", unsafe.Offsetof(iovec.IovBase), unsafe.Offsetof(iovec.IovLen), unsafe.Sizeof(iovec.IovLen)) + } + if unsafe.Offsetof(imaxdiv.Quot) != 0 || unsafe.Offsetof(imaxdiv.Rem) != 8 { + t.Fatalf("imaxdiv_t field offsets = %d/%d, want 0/8", unsafe.Offsetof(imaxdiv.Quot), unsafe.Offsetof(imaxdiv.Rem)) + } +} + +func TestNativeLibcIntegers(t *testing.T) { + for _, tc := range generatedLifecycleCalls { + t.Run(tc.name, tc.check) + } + t.Run("integer and floating conversions", func(t *testing.T) { + signed := (*nativeChar)(unsafe.Pointer(c.Str("-4294967297tail"))) + unsigned := (*nativeChar)(unsafe.Pointer(c.Str("100000001tail"))) + var end *nativeChar + for _, tc := range []struct { + name string + got, want int64 + }{ + {"Abs", int64(c.Abs(-91)), 91}, + {"Labs", int64(c.Labs(-4294967297)), 4294967297}, + {"Llabs", int64(c.Llabs(-4294967297)), 4294967297}, + {"Imaxabs", int64(c.Imaxabs(-4294967297)), 4294967297}, + {"Atol", int64(c.Atol(signed)), -4294967297}, + {"Atoll", int64(c.Atoll(signed)), -4294967297}, + {"Strtol", int64(c.Strtol(signed, &end, 10)), -4294967297}, + {"Strtoll", int64(c.Strtoll(signed, &end, 10)), -4294967297}, + {"Strtoq", int64(c.Strtoq(signed, &end, 10)), -4294967297}, + {"Strtoul", int64(c.Strtoul(unsigned, &end, 16)), 4294967297}, + {"Strtoull", int64(c.Strtoull(unsigned, &end, 16)), 4294967297}, + {"Strtouq", int64(c.Strtouq(unsigned, &end, 16)), 4294967297}, + } { + t.Run(tc.name, func(t *testing.T) { + if tc.got != tc.want { + t.Fatalf("result = %d, want %d", tc.got, tc.want) + } + }) + } + if end == nil || *end != 't' { + t.Fatal("integer conversion end pointer differs") + } + floating := (*nativeChar)(unsafe.Pointer(c.Str("1.25tail"))) + if c.Atof(floating) != 1.25 || c.Strtod(floating, &end) != 1.25 || end == nil || *end != 't' { + t.Fatal("double conversion differs") + } + if c.Strtof(floating, &end) != 1.25 || end == nil || *end != 't' { + t.Fatal("float conversion differs") + } + wideSigned := [6]nativeWide{'-', '1', '2', '3', 'x', 0} + wideUnsigned := [5]nativeWide{'1', '2', '3', 'x', 0} + var wideEnd *nativeWide + if c.Wcstoimax(&wideSigned[0], &wideEnd, 10) != -123 || wideEnd != &wideSigned[4] { + t.Fatal("wcstoimax value/end differ") + } + if c.Wcstoumax(&wideUnsigned[0], &wideEnd, 10) != 123 || wideEnd != &wideUnsigned[3] { + t.Fatal("wcstoumax value/end differ") + } + }) + t.Run("locale and multibyte calls", func(t *testing.T) { + previous := c.Setlocale(c.LC_ALL, nil) + if previous == nil { + t.Fatal("setlocale query returned nil") + } + saved := c.GoString((*c.Char)(unsafe.Pointer(previous))) + defer func() { c.Setlocale(c.LC_ALL, (*nativeChar)(unsafe.Pointer(c.AllocaCStr(saved)))) }() + if c.Setlocale(c.LC_ALL, (*nativeChar)(unsafe.Pointer(c.Str("C")))) == nil { + t.Fatal("C locale is unavailable") + } + locale := c.Localeconv() + if locale == nil || c.GoString((*c.Char)(unsafe.Pointer(locale.DecimalPoint))) != "." { + t.Fatal("localeconv decimal point differs") + } + input := [3]nativeChar{'a', 'b', 0} + if c.Mblen(&input[0], 1) != 1 || c.Mblen(nil, 0) != 0 { + t.Fatal("mblen result differs") + } + var character c.WcharT + if c.Mbtowc(&character, &input[0], 1) != 1 || character != 'a' { + t.Fatal("mbtowc result differs") + } + var bytes [8]nativeChar + if c.Wctomb(&bytes[0], 'b') != 1 || bytes[0] != 'b' { + t.Fatal("wctomb result differs") + } + var wide [4]c.WcharT + if c.Mbstowcs(&wide[0], &input[0], 4) != 2 || wide != [4]c.WcharT{'a', 'b', 0, 0} { + t.Fatalf("mbstowcs = %v", wide) + } + if c.Wcstombs(&bytes[0], &wide[0], 8) != 2 || bytes[0] != 'a' || bytes[1] != 'b' || bytes[2] != 0 { + t.Fatal("wcstombs result differs") + } + if c.Strcoll(&input[0], (*nativeChar)(unsafe.Pointer(c.Str("ac")))) >= 0 { + t.Fatal("strcoll ordering differs") + } + if c.Strxfrm(&bytes[0], &input[0], 8) != 2 || bytes[0] != 'a' || bytes[1] != 'b' || bytes[2] != 0 { + t.Fatal("C locale strxfrm differs") + } + }) + t.Run("new memory and string calls", func(t *testing.T) { + input := [8]nativeChar{'a', 'b', 'c', ':', 'd', 0} + colon := (*nativeChar)(unsafe.Pointer(c.Str(":"))) + if c.Strcspn(&input[0], colon) != 3 || c.Strspn(&input[0], (*nativeChar)(unsafe.Pointer(c.Str("abc")))) != 3 || c.Strpbrk(&input[0], colon) != &input[3] { + t.Fatal("string span results differ") + } + var output [16]nativeChar + if c.Memccpy(unsafe.Pointer(&output[0]), unsafe.Pointer(&input[0]), ':', 6) != unsafe.Pointer(&output[4]) || output[3] != ':' || output[4] != 0 { + t.Fatal("memccpy stop position differs") + } + c.Bzero(unsafe.Pointer(&output[0]), 16) + c.Bcopy(unsafe.Pointer(&input[0]), unsafe.Pointer(&output[0]), 6) + if c.Bcmp(unsafe.Pointer(&output[0]), unsafe.Pointer(&input[0]), 6) != 0 { + t.Fatal("bcopy/bcmp differ") + } + word := (*nativeChar)(unsafe.Pointer(c.Str("abc"))) + if c.Stpcpy(&output[0], word) != &output[3] || output[0] != 'a' || output[3] != 0 { + t.Fatal("stpcpy end pointer differs") + } + if c.Stpncpy(&output[0], word, 5) != &output[3] || output[3] != 0 || output[4] != 0 { + t.Fatal("stpncpy padding differs") + } + if c.Strnlen(word, 2) != 2 || c.Strnlen(word, 8) != 3 { + t.Fatal("strnlen bounds differ") + } + if c.Rindex(&input[0], ':') != &input[3] || c.Strcasecmp((*nativeChar)(unsafe.Pointer(c.Str("AbC"))), word) != 0 || c.Strncasecmp((*nativeChar)(unsafe.Pointer(c.Str("ABCx"))), word, 3) != 0 { + t.Fatal("string search/case results differ") + } + if c.Ffs(0) != 0 || c.Ffs(8) != 4 { + t.Fatal("ffs bit positions differ") + } + var errorText [128]nativeChar + if c.StrerrorR(2, &errorText[0], 128) != 0 || errorText[0] == 0 { + t.Fatal("strerror_r result differs") + } + if signalText := c.Strsignal(15); signalText == nil || *signalText == 0 { + t.Fatal("strsignal returned no description") + } + path := (*nativeChar)(unsafe.Pointer(c.AllocaCStr("/tmp/leaf"))) + if c.GoString((*c.Char)(unsafe.Pointer(c.Dirname(path)))) != "/tmp" { + t.Fatal("dirname result differs") + } + tokenInput := [5]nativeChar{'a', ':', 'b', 0} + var save *nativeChar + if c.StrtokR(&tokenInput[0], colon, &save) != &tokenInput[0] || tokenInput[1] != 0 || c.StrtokR(nil, colon, &save) != &tokenInput[2] || c.StrtokR(nil, colon, &save) != nil { + t.Fatal("strtok_r state differs") + } + separated := [5]nativeChar{'a', ':', 'b', 0} + cursor := &separated[0] + if c.Strsep(&cursor, colon) != &separated[0] || cursor != &separated[2] || c.Strsep(&cursor, colon) != &separated[2] || cursor != nil { + t.Fatal("strsep cursor differs") + } + }) + t.Run("allocation and callback calls", func(t *testing.T) { + page := c.Valloc(64) + if page == nil { + t.Fatal("valloc returned nil") + } + defer c.Free(page) + if uintptr(page)%uintptr(os.Getpagesize()) != 0 { + t.Fatal("valloc is not page aligned") + } + aligned := c.AlignedAlloc(64, 128) + if aligned == nil { + t.Fatal("aligned_alloc returned nil") + } + defer c.Free(aligned) + if uintptr(aligned)%64 != 0 { + t.Fatal("aligned_alloc alignment differs") + } + var pointer unsafe.Pointer + if result := c.PosixMemalign(&pointer, 64, 128); result != 0 || pointer == nil { + t.Fatalf("posix_memalign = %d/%p", result, pointer) + } + defer c.Free(pointer) + if uintptr(pointer)%64 != 0 { + t.Fatal("posix_memalign alignment differs") + } + items := [4]c.Int{2, 5, 7, 11} + key := c.Int(7) + found := c.Bsearch(unsafe.Pointer(&key), unsafe.Pointer(&items[0]), 4, unsafe.Sizeof(key), func(a, b unsafe.Pointer) c.Int { return *(*c.Int)(a) - *(*c.Int)(b) }) + if found != unsafe.Pointer(&items[2]) { + t.Fatalf("bsearch returned %p, want %p", found, &items[2]) + } + }) + t.Run("structure returns", func(t *testing.T) { + cases := []struct{ numerator, denominator, quotient, remainder c.Long }{ + {29, 6, 4, 5}, + {-29, 6, -4, -5}, + {29, -6, -4, 5}, + {-29, -6, 4, -5}, + {(1 << 40) + 7, 16, 1 << 36, 7}, + } + for _, tc := range cases { + got := c.Imaxdiv(tc.numerator, tc.denominator) + if got.Quot != tc.quotient || got.Rem != tc.remainder { + t.Fatalf("imaxdiv(%d,%d) = %d,%d, want %d,%d", tc.numerator, tc.denominator, got.Quot, got.Rem, tc.quotient, tc.remainder) + } + } + div := c.Div(29, 6) + ldiv := c.Ldiv(-29, 6) + lldiv := c.Lldiv((1<<40)+7, 16) + if div.Quot != 4 || div.Rem != 5 || ldiv.Quot != -4 || ldiv.Rem != -5 || lldiv.Quot != 1<<36 || lldiv.Rem != 7 { + t.Fatalf("division structure returns: div=%v ldiv=%v lldiv=%v", div, ldiv, lldiv) + } + }) + t.Run("signed parsing", func(t *testing.T) { + input := (*nativeChar)(unsafe.Pointer(c.AllocaCStr("-1099511627776tail"))) + var end *nativeChar + if got := c.Strtoimax(input, &end, 10); got != -(1 << 40) { + t.Fatalf("strtoimax = %d, want %d", got, -(1 << 40)) + } + if got := c.GoString((*c.Char)(unsafe.Pointer(end))); got != "tail" { + t.Fatalf("strtoimax end pointer = %q, want tail", got) + } + }) + t.Run("unsigned parsing", func(t *testing.T) { + input := (*nativeChar)(unsafe.Pointer(c.AllocaCStr("0x10000000000rest"))) + var end *nativeChar + if got := c.Strtoumax(input, &end, 0); got != 1<<40 { + t.Fatalf("strtoumax = %d, want %d", got, 1<<40) + } + if got := c.GoString((*c.Char)(unsafe.Pointer(end))); got != "rest" { + t.Fatalf("strtoumax end pointer = %q, want rest", got) + } + }) + t.Run("variadic pointer arguments", func(t *testing.T) { + var first, second c.Int + input := (*nativeChar)(unsafe.Pointer(c.AllocaCStr("17 -23"))) + format := (*nativeChar)(unsafe.Pointer(c.AllocaCStr("%d %d"))) + if count := c.Sscanf(input, format, &first, &second); count != 2 || first != 17 || second != -23 { + t.Fatalf("sscanf = %d (%d,%d), want 2 (17,-23)", count, first, second) + } + }) +} + +func TestNativeLibcFnmatch(t *testing.T) { + cases := []struct { + name, pattern, value string + flags, want c.Int + }{ + {"match", "*.go", "binding.go", 0, 0}, + {"mismatch", "*.go", "binding.c", 0, c.FNM_NOMATCH}, + {"pathname", "*", "dir/file", c.FNM_PATHNAME, c.FNM_NOMATCH}, + {"pathname disabled", "*", "dir/file", 0, 0}, + {"leading period", "*", ".private", c.FNM_PERIOD, c.FNM_NOMATCH}, + {"escaped wildcard", "\\*", "*", 0, 0}, + {"escaping disabled", "\\*", "*", c.FNM_NOESCAPE, c.FNM_NOMATCH}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + pattern := (*nativeChar)(unsafe.Pointer(c.AllocaCStr(tc.pattern))) + value := (*nativeChar)(unsafe.Pointer(c.AllocaCStr(tc.value))) + if got := c.Fnmatch(pattern, value, tc.flags); got != tc.want { + t.Fatalf("fnmatch(%q,%q,%d) = %d, want %d", tc.pattern, tc.value, tc.flags, got, tc.want) + } + }) + } +} + +func TestNativeLibcStdio(t *testing.T) { + stream := c.Tmpfile() + if stream == nil { + t.Fatal("tmpfile returned nil") + } + defer func() { + if got := c.Fclose(stream); got != 0 { + t.Errorf("fclose = %d, want 0", got) + } + }() + payload := []byte{'a', 0, 'b', '\n'} + if count := c.Fwrite(unsafe.Pointer(&payload[0]), 1, uintptr(len(payload)), stream); count != uintptr(len(payload)) { + t.Fatalf("fwrite = %d, want %d", count, len(payload)) + } + if got := c.Ftell(stream); got != c.Long(len(payload)) { + t.Fatalf("ftell = %d, want %d", got, len(payload)) + } + // SEEK_SET is zero in each of the supported target headers. + if got := c.Fseek(stream, 0, 0); got != 0 { + t.Fatalf("fseek = %d, want 0", got) + } + var position nativeFilePosition + if got := c.Fgetpos(stream, &position); got != 0 { + t.Fatalf("fgetpos = %d, want 0", got) + } + if got := c.Fgetc(stream); got != 'a' { + t.Fatalf("first fgetc = %d, want a", got) + } + if got := c.Fsetpos(stream, &position); got != 0 { + t.Fatalf("fsetpos = %d, want 0", got) + } + if got := c.Fgetc(stream); got != 'a' { + t.Fatalf("restored fgetc = %d, want a", got) + } + c.Rewind(stream) + got := make([]byte, len(payload)) + if count := c.Fread(unsafe.Pointer(&got[0]), 1, uintptr(len(got)), stream); count != uintptr(len(got)) { + t.Fatalf("fread = %d, want %d", count, len(got)) + } + if string(got) != string(payload) { + t.Fatalf("read payload = %v, want %v", got, payload) + } + // EOF is -1 in each of the supported target headers. + if value := c.Fgetc(stream); value != -1 { + t.Fatalf("fgetc at EOF = %d, want -1", value) + } + if c.Feof(stream) == 0 || c.Ferror(stream) != 0 { + t.Fatalf("EOF/error indicators = %d/%d", c.Feof(stream), c.Ferror(stream)) + } + c.Clearerr(stream) + if c.Feof(stream) != 0 || c.Ferror(stream) != 0 { + t.Fatalf("clearerr indicators = %d/%d", c.Feof(stream), c.Ferror(stream)) + } + c.Rewind(stream) + if value := c.Fgetc(stream); value != 'a' { + t.Fatalf("rewound fgetc = %d, want a", value) + } +} diff --git a/c/llcppg.cfg b/c/llcppg.cfg new file mode 100644 index 00000000..75e27be3 --- /dev/null +++ b/c/llcppg.cfg @@ -0,0 +1,3 @@ +{ + "Dir": ".sysroot/include" +} diff --git a/c/llcppg.pub b/c/llcppg.pub index bf242f82..209b4824 100644 --- a/c/llcppg.pub +++ b/c/llcppg.pub @@ -1,32 +1,52 @@ D github.com/goplus/lib/c/os -D github.com/goplus/lib/c/time -D github.com/goplus/lib/c/types D github.com/goplus/lib/c/pthread D github.com/goplus/lib/c/pthread/sync +D github.com/goplus/lib/c/time +D github.com/goplus/lib/c/types T FILE FILE -T wchar_t WcharT -T char8_t Char8T +T _G_fpos_t X_GFposT +T _IO_FILE X_IO_FILE +T _IO_marker X_IO_marker +T __compar_fn_t X__ComparFnT +T __locale_data X__LocaleData +T __locale_struct X__LocaleStruct +T __locale_t X__LocaleT +T __mbstate_t X__MbstateT +T _malloc_zone_t X_mallocZoneT T char16_t Char16T T char32_t Char32T -T size_t SizeT -T ssize_t SsizeT -T ptrdiff_t PtrdiffT -T intptr_t IntptrT -T uintptr_t UintptrT -T int8_t Int8T +T char8_t Char8T +T cmsghdr Cmsghdr +T cpu_set_t CpuSetT +T div_t DivT +T drand48_data Drand48Data +T fpos_t FposT +T iconv_t IconvT +T imaxdiv_t ImaxdivT T int16_t Int16T T int32_t Int32T T int64_t Int64T -T uint8_t Uint8T -T uint16_t Uint16T -T uint32_t Uint32T -T uint64_t Uint64T +T int8_t Int8T T intmax_t IntmaxT -T uintmax_t UintmaxT -T div_t DivT +T intptr_t IntptrT +T iovec Iovec +T lconv Lconv T ldiv_t LdivT T lldiv_t LldivT -T iconv_t IconvT T locale_t LocaleT +T malloc_zone_t MallocZoneT +T msghdr Msghdr T option Option +T ptrdiff_t PtrdiffT +T random_data RandomData +T rpcent Rpcent +T size_t SizeT +T ssize_t SsizeT +T uint16_t Uint16T +T uint32_t Uint32T +T uint64_t Uint64T +T uint8_t Uint8T +T uintmax_t UintmaxT +T uintptr_t UintptrT T va_list VaList +T wchar_t WcharT diff --git a/c/package_default_other.go b/c/package_default_other.go new file mode 100644 index 00000000..0bea6ba9 --- /dev/null +++ b/c/package_default_other.go @@ -0,0 +1,5 @@ +//go:build !darwin && !windows && !(linux && (amd64 || arm64) && !android) + +package c + +const LLGoPackage = "decl" diff --git a/c/stdio_default.go b/c/stdio_default.go index 844995ef..b34d3a3a 100644 --- a/c/stdio_default.go +++ b/c/stdio_default.go @@ -21,8 +21,6 @@ package c import _ "unsafe" -const LLGoPackage = "decl" - //go:linkname Stdin C.stdin var Stdin FilePtr