modernc.org/z@v1.7.4/internal/example_openbsd_amd64.go (about)

     1  // Code generated by 'ccgo -lmodernc.org/z/lib -o internal/example_openbsd_amd64.go -trace-translation-units /tmp/go-generate-4169310015/cdb.json example64', DO NOT EDIT.
     2  
     3  package main
     4  
     5  import (
     6  	"math"
     7  	"reflect"
     8  	"sync/atomic"
     9  	"unsafe"
    10  
    11  	"modernc.org/libc"
    12  	"modernc.org/libc/sys/types"
    13  	"modernc.org/z/lib"
    14  )
    15  
    16  var _ = math.Pi
    17  var _ reflect.Kind
    18  var _ atomic.Value
    19  var _ unsafe.Pointer
    20  var _ *libc.TLS
    21  var _ types.Size_t
    22  
    23  func main() { libc.Start(main1) }
    24  
    25  type ptrdiff_t = int64 /* <builtin>:3:26 */
    26  
    27  type size_t = uint64 /* <builtin>:9:23 */
    28  
    29  type wchar_t = int32 /* <builtin>:15:24 */
    30  
    31  type wint_t = int32 /* stddef.h:60:18 */
    32  
    33  type mbstate_t = struct {
    34  	_          [0]uint64
    35  	__mbstate8 [128]int8
    36  } /* stddef.h:65:21 */
    37  
    38  type max_align_t = struct {
    39  	__max_align_ll int64
    40  	__max_align_ld float64
    41  } /* stddef.h:80:3 */
    42  
    43  type z_size_t = size_t /* zconf.h:248:21 */
    44  
    45  // Maximum value for memLevel in deflateInit2
    46  
    47  // Maximum value for windowBits in deflateInit2 and inflateInit2.
    48  // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
    49  // created by gzip. (Files created by minigzip can still be extracted by
    50  // gzip.)
    51  
    52  // The memory requirements for deflate are (in bytes):
    53  //             (1 << (windowBits+2)) +  (1 << (memLevel+9))
    54  //  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
    55  //  plus a few kilobytes for small objects. For example, if you want to reduce
    56  //  the default memory requirements from 256K to 128K, compile with
    57  //      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
    58  //  Of course this will generally degrade compression (there's no free lunch).
    59  //
    60  //    The memory requirements for inflate are (in bytes) 1 << windowBits
    61  //  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
    62  //  for small objects.
    63  
    64  // Type declarations
    65  
    66  // The following definitions for FAR are needed only for MSDOS mixed
    67  // model programming (small or medium model with some far allocations).
    68  // This was tested only with MSC; for other MSDOS compilers you may have
    69  // to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
    70  // just define FAR to be empty.
    71  
    72  type Byte = uint8   /* zconf.h:391:24 */ // 8 bits
    73  type uInt = uint32  /* zconf.h:393:24 */ // 16 bits or more
    74  type uLong = uint64 /* zconf.h:394:24 */ // 32 bits or more
    75  
    76  type Bytef = Byte   /* zconf.h:400:22 */
    77  type charf = int8   /* zconf.h:402:19 */
    78  type intf = int32   /* zconf.h:403:19 */
    79  type uIntf = uInt   /* zconf.h:404:19 */
    80  type uLongf = uLong /* zconf.h:405:19 */
    81  
    82  type voidpc = uintptr /* zconf.h:408:23 */
    83  type voidpf = uintptr /* zconf.h:409:23 */
    84  type voidp = uintptr  /* zconf.h:410:23 */
    85  
    86  //	$OpenBSD: limits.h,v 1.19 2015/01/20 22:09:50 tedu Exp $
    87  //	$NetBSD: limits.h,v 1.7 1994/10/26 00:56:00 cgd Exp $
    88  
    89  // Copyright (c) 1988 The Regents of the University of California.
    90  // All rights reserved.
    91  //
    92  // Redistribution and use in source and binary forms, with or without
    93  // modification, are permitted provided that the following conditions
    94  // are met:
    95  // 1. Redistributions of source code must retain the above copyright
    96  //    notice, this list of conditions and the following disclaimer.
    97  // 2. Redistributions in binary form must reproduce the above copyright
    98  //    notice, this list of conditions and the following disclaimer in the
    99  //    documentation and/or other materials provided with the distribution.
   100  // 3. Neither the name of the University nor the names of its contributors
   101  //    may be used to endorse or promote products derived from this software
   102  //    without specific prior written permission.
   103  //
   104  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   105  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   106  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   107  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   108  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   109  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   110  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   111  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   112  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   113  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   114  // SUCH DAMAGE.
   115  //
   116  //	@(#)limits.h	5.9 (Berkeley) 4/3/91
   117  
   118  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
   119  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
   120  
   121  // Copyright (c) 1991, 1993
   122  //	The Regents of the University of California.  All rights reserved.
   123  //
   124  // This code is derived from software contributed to Berkeley by
   125  // Berkeley Software Design, Inc.
   126  //
   127  // Redistribution and use in source and binary forms, with or without
   128  // modification, are permitted provided that the following conditions
   129  // are met:
   130  // 1. Redistributions of source code must retain the above copyright
   131  //    notice, this list of conditions and the following disclaimer.
   132  // 2. Redistributions in binary form must reproduce the above copyright
   133  //    notice, this list of conditions and the following disclaimer in the
   134  //    documentation and/or other materials provided with the distribution.
   135  // 3. Neither the name of the University nor the names of its contributors
   136  //    may be used to endorse or promote products derived from this software
   137  //    without specific prior written permission.
   138  //
   139  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   140  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   141  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   142  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   143  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   144  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   145  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   146  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   147  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   148  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   149  // SUCH DAMAGE.
   150  //
   151  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
   152  
   153  // $OpenBSD: limits.h,v 1.10 2012/06/30 20:21:10 guenther Exp $
   154  // Copyright (c) 2002 Marc Espie.
   155  //
   156  // Redistribution and use in source and binary forms, with or without
   157  // modification, are permitted provided that the following conditions
   158  // are met:
   159  // 1. Redistributions of source code must retain the above copyright
   160  //    notice, this list of conditions and the following disclaimer.
   161  // 2. Redistributions in binary form must reproduce the above copyright
   162  //    notice, this list of conditions and the following disclaimer in the
   163  //    documentation and/or other materials provided with the distribution.
   164  //
   165  // THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
   166  // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   167  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   168  // A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
   169  // PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   170  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   171  // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   172  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   173  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   174  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   175  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   176  
   177  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
   178  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
   179  
   180  // Copyright (c) 1991, 1993
   181  //	The Regents of the University of California.  All rights reserved.
   182  //
   183  // This code is derived from software contributed to Berkeley by
   184  // Berkeley Software Design, Inc.
   185  //
   186  // Redistribution and use in source and binary forms, with or without
   187  // modification, are permitted provided that the following conditions
   188  // are met:
   189  // 1. Redistributions of source code must retain the above copyright
   190  //    notice, this list of conditions and the following disclaimer.
   191  // 2. Redistributions in binary form must reproduce the above copyright
   192  //    notice, this list of conditions and the following disclaimer in the
   193  //    documentation and/or other materials provided with the distribution.
   194  // 3. Neither the name of the University nor the names of its contributors
   195  //    may be used to endorse or promote products derived from this software
   196  //    without specific prior written permission.
   197  //
   198  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   199  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   200  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   201  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   202  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   203  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   204  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   205  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   206  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   207  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   208  // SUCH DAMAGE.
   209  //
   210  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
   211  
   212  // Common definitions for limits.h.
   213  
   214  // Legacy
   215  //	$OpenBSD: limits.h,v 1.6 2015/04/30 13:42:08 millert Exp $
   216  
   217  // Copyright (c) 1988 The Regents of the University of California.
   218  // All rights reserved.
   219  //
   220  // Redistribution and use in source and binary forms, with or without
   221  // modification, are permitted provided that the following conditions
   222  // are met:
   223  // 1. Redistributions of source code must retain the above copyright
   224  //    notice, this list of conditions and the following disclaimer.
   225  // 2. Redistributions in binary form must reproduce the above copyright
   226  //    notice, this list of conditions and the following disclaimer in the
   227  //    documentation and/or other materials provided with the distribution.
   228  // 3. Neither the name of the University nor the names of its contributors
   229  //    may be used to endorse or promote products derived from this software
   230  //    without specific prior written permission.
   231  //
   232  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   233  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   234  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   235  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   236  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   237  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   238  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   239  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   240  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   241  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   242  // SUCH DAMAGE.
   243  //
   244  //	@(#)limits.h	7.2 (Berkeley) 6/28/90
   245  
   246  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
   247  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
   248  
   249  // Copyright (c) 1991, 1993
   250  //	The Regents of the University of California.  All rights reserved.
   251  //
   252  // This code is derived from software contributed to Berkeley by
   253  // Berkeley Software Design, Inc.
   254  //
   255  // Redistribution and use in source and binary forms, with or without
   256  // modification, are permitted provided that the following conditions
   257  // are met:
   258  // 1. Redistributions of source code must retain the above copyright
   259  //    notice, this list of conditions and the following disclaimer.
   260  // 2. Redistributions in binary form must reproduce the above copyright
   261  //    notice, this list of conditions and the following disclaimer in the
   262  //    documentation and/or other materials provided with the distribution.
   263  // 3. Neither the name of the University nor the names of its contributors
   264  //    may be used to endorse or promote products derived from this software
   265  //    without specific prior written permission.
   266  //
   267  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   268  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   269  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   270  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   271  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   272  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   273  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   274  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   275  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   276  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   277  // SUCH DAMAGE.
   278  //
   279  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
   280  
   281  // max value for unsigned long
   282  // max value for a signed long
   283  // min value for a signed long
   284  
   285  // max value for unsigned long long
   286  // max value for a signed long long
   287  // min value for a signed long long
   288  
   289  //	$OpenBSD: syslimits.h,v 1.14 2020/04/02 18:00:00 deraadt Exp $
   290  //	$NetBSD: syslimits.h,v 1.12 1995/10/05 05:26:19 thorpej Exp $
   291  
   292  // Copyright (c) 1988, 1993
   293  //	The Regents of the University of California.  All rights reserved.
   294  //
   295  // Redistribution and use in source and binary forms, with or without
   296  // modification, are permitted provided that the following conditions
   297  // are met:
   298  // 1. Redistributions of source code must retain the above copyright
   299  //    notice, this list of conditions and the following disclaimer.
   300  // 2. Redistributions in binary form must reproduce the above copyright
   301  //    notice, this list of conditions and the following disclaimer in the
   302  //    documentation and/or other materials provided with the distribution.
   303  // 3. Neither the name of the University nor the names of its contributors
   304  //    may be used to endorse or promote products derived from this software
   305  //    without specific prior written permission.
   306  //
   307  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   308  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   309  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   310  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   311  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   312  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   313  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   314  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   315  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   316  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   317  // SUCH DAMAGE.
   318  //
   319  //	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
   320  
   321  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
   322  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
   323  
   324  // Copyright (c) 1991, 1993
   325  //	The Regents of the University of California.  All rights reserved.
   326  //
   327  // This code is derived from software contributed to Berkeley by
   328  // Berkeley Software Design, Inc.
   329  //
   330  // Redistribution and use in source and binary forms, with or without
   331  // modification, are permitted provided that the following conditions
   332  // are met:
   333  // 1. Redistributions of source code must retain the above copyright
   334  //    notice, this list of conditions and the following disclaimer.
   335  // 2. Redistributions in binary form must reproduce the above copyright
   336  //    notice, this list of conditions and the following disclaimer in the
   337  //    documentation and/or other materials provided with the distribution.
   338  // 3. Neither the name of the University nor the names of its contributors
   339  //    may be used to endorse or promote products derived from this software
   340  //    without specific prior written permission.
   341  //
   342  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   343  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   344  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   345  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   346  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   347  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   348  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   349  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   350  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   351  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   352  // SUCH DAMAGE.
   353  //
   354  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
   355  
   356  type z_crc_t = uint32 /* zconf.h:429:17 */
   357  
   358  // Tell sys/endian.h we have MD variants of the swap macros.
   359  
   360  // Note that these macros evaluate their arguments several times.
   361  
   362  // Public names
   363  
   364  // These are specified to be function-like macros to match the spec
   365  
   366  // POSIX names
   367  
   368  // original BSD names
   369  
   370  // these were exposed here before
   371  
   372  // ancient stuff
   373  
   374  type u_char = uint8   /* types.h:51:23 */
   375  type u_short = uint16 /* types.h:52:24 */
   376  type u_int = uint32   /* types.h:53:22 */
   377  type u_long = uint64  /* types.h:54:23 */
   378  
   379  type unchar = uint8  /* types.h:56:23 */ // Sys V compatibility
   380  type ushort = uint16 /* types.h:57:24 */ // Sys V compatibility
   381  type uint = uint32   /* types.h:58:22 */ // Sys V compatibility
   382  type ulong = uint64  /* types.h:59:23 */ // Sys V compatibility
   383  
   384  type cpuid_t = uint64   /* types.h:61:19 */ // CPU id
   385  type register_t = int64 /* types.h:62:22 */ // register-sized type
   386  
   387  // XXX The exact-width bit types should only be exposed if __BSD_VISIBLE
   388  //     but the rest of the includes are not ready for that yet.
   389  
   390  type int8_t = int8 /* types.h:75:19 */
   391  
   392  type uint8_t = uint8 /* types.h:80:20 */
   393  
   394  type int16_t = int16 /* types.h:85:20 */
   395  
   396  type uint16_t = uint16 /* types.h:90:21 */
   397  
   398  type int32_t = int32 /* types.h:95:20 */
   399  
   400  type uint32_t = uint32 /* types.h:100:21 */
   401  
   402  type int64_t = int64 /* types.h:105:20 */
   403  
   404  type uint64_t = uint64 /* types.h:110:21 */
   405  
   406  // BSD-style unsigned bits types
   407  type u_int8_t = uint8   /* types.h:114:19 */
   408  type u_int16_t = uint16 /* types.h:115:20 */
   409  type u_int32_t = uint32 /* types.h:116:20 */
   410  type u_int64_t = uint64 /* types.h:117:20 */
   411  
   412  // quads, deprecated in favor of 64 bit int types
   413  type quad_t = int64    /* types.h:120:19 */
   414  type u_quad_t = uint64 /* types.h:121:20 */
   415  
   416  // VM system types
   417  type vaddr_t = uint64 /* types.h:125:19 */
   418  type paddr_t = uint64 /* types.h:126:19 */
   419  type vsize_t = uint64 /* types.h:127:19 */
   420  type psize_t = uint64 /* types.h:128:19 */
   421  
   422  // Standard system types
   423  type blkcnt_t = int64    /* types.h:132:20 */ // blocks allocated for file
   424  type blksize_t = int32   /* types.h:133:21 */ // optimal blocksize for I/O
   425  type caddr_t = uintptr   /* types.h:134:14 */ // core address
   426  type daddr32_t = int32   /* types.h:135:19 */ // 32-bit disk address
   427  type daddr_t = int64     /* types.h:136:19 */ // 64-bit disk address
   428  type dev_t = int32       /* types.h:137:18 */ // device number
   429  type fixpt_t = uint32    /* types.h:138:19 */ // fixed point number
   430  type gid_t = uint32      /* types.h:139:18 */ // group id
   431  type id_t = uint32       /* types.h:140:17 */ // may contain pid, uid or gid
   432  type ino_t = uint64      /* types.h:141:18 */ // inode number
   433  type key_t = int64       /* types.h:142:18 */ // IPC key (for Sys V IPC)
   434  type mode_t = uint32     /* types.h:143:18 */ // permissions
   435  type nlink_t = uint32    /* types.h:144:19 */ // link count
   436  type rlim_t = uint64     /* types.h:145:18 */ // resource limit
   437  type segsz_t = int32     /* types.h:146:19 */ // segment size
   438  type swblk_t = int32     /* types.h:147:19 */ // swap offset
   439  type uid_t = uint32      /* types.h:148:18 */ // user id
   440  type useconds_t = uint32 /* types.h:149:22 */ // microseconds
   441  type suseconds_t = int64 /* types.h:150:23 */ // microseconds (signed)
   442  type fsblkcnt_t = uint64 /* types.h:151:22 */ // file system block count
   443  type fsfilcnt_t = uint64 /* types.h:152:22 */ // file system file count
   444  
   445  // The following types may be defined in multiple header files.
   446  type clock_t = int64 /* types.h:159:19 */
   447  
   448  type clockid_t = int32 /* types.h:164:21 */
   449  
   450  type pid_t = int32 /* types.h:169:18 */
   451  
   452  type ssize_t = int64 /* types.h:179:19 */
   453  
   454  type time_t = int64 /* types.h:184:18 */
   455  
   456  type timer_t = int32 /* types.h:189:19 */
   457  
   458  type off_t = int64 /* types.h:194:18 */
   459  
   460  // Note that the type used in va_arg is supposed to match the
   461  //    actual type **after default promotions**.
   462  //    Thus, va_arg (..., short) is not valid.
   463  
   464  type va_list = uintptr /* stdarg.h:39:24 */
   465  
   466  // a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
   467  // "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
   468  // though the former does not conform to the LFS document), but considering
   469  // both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
   470  // equivalently requesting no 64-bit operations
   471  
   472  //	$OpenBSD: unistd.h,v 1.106 2018/07/13 09:25:22 beck Exp $
   473  //	$NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $
   474  
   475  // -
   476  // Copyright (c) 1991 The Regents of the University of California.
   477  // All rights reserved.
   478  //
   479  // Redistribution and use in source and binary forms, with or without
   480  // modification, are permitted provided that the following conditions
   481  // are met:
   482  // 1. Redistributions of source code must retain the above copyright
   483  //    notice, this list of conditions and the following disclaimer.
   484  // 2. Redistributions in binary form must reproduce the above copyright
   485  //    notice, this list of conditions and the following disclaimer in the
   486  //    documentation and/or other materials provided with the distribution.
   487  // 3. Neither the name of the University nor the names of its contributors
   488  //    may be used to endorse or promote products derived from this software
   489  //    without specific prior written permission.
   490  //
   491  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   492  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   493  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   494  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   495  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   496  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   497  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   498  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   499  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   500  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   501  // SUCH DAMAGE.
   502  //
   503  //	@(#)unistd.h	5.13 (Berkeley) 6/17/91
   504  
   505  //	$OpenBSD: _null.h,v 1.2 2016/09/09 22:07:58 millert Exp $
   506  
   507  // Written by Todd C. Miller, September 9, 2016
   508  // Public domain.
   509  
   510  //	$OpenBSD: types.h,v 1.48 2019/02/09 04:54:11 guenther Exp $
   511  //	$NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $
   512  
   513  // -
   514  // Copyright (c) 1982, 1986, 1991, 1993
   515  //	The Regents of the University of California.  All rights reserved.
   516  // (c) UNIX System Laboratories, Inc.
   517  // All or some portions of this file are derived from material licensed
   518  // to the University of California by American Telephone and Telegraph
   519  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
   520  // the permission of UNIX System Laboratories, Inc.
   521  //
   522  // Redistribution and use in source and binary forms, with or without
   523  // modification, are permitted provided that the following conditions
   524  // are met:
   525  // 1. Redistributions of source code must retain the above copyright
   526  //    notice, this list of conditions and the following disclaimer.
   527  // 2. Redistributions in binary form must reproduce the above copyright
   528  //    notice, this list of conditions and the following disclaimer in the
   529  //    documentation and/or other materials provided with the distribution.
   530  // 3. Neither the name of the University nor the names of its contributors
   531  //    may be used to endorse or promote products derived from this software
   532  //    without specific prior written permission.
   533  //
   534  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   535  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   536  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   537  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   538  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   539  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   540  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   541  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   542  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   543  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   544  // SUCH DAMAGE.
   545  //
   546  //	@(#)types.h	8.4 (Berkeley) 1/21/94
   547  
   548  //	$OpenBSD: unistd.h,v 1.31 2015/07/20 00:56:10 guenther Exp $
   549  //	$NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $
   550  
   551  // Copyright (c) 1989, 1993
   552  //	The Regents of the University of California.  All rights reserved.
   553  //
   554  // Redistribution and use in source and binary forms, with or without
   555  // modification, are permitted provided that the following conditions
   556  // are met:
   557  // 1. Redistributions of source code must retain the above copyright
   558  //    notice, this list of conditions and the following disclaimer.
   559  // 2. Redistributions in binary form must reproduce the above copyright
   560  //    notice, this list of conditions and the following disclaimer in the
   561  //    documentation and/or other materials provided with the distribution.
   562  // 3. Neither the name of the University nor the names of its contributors
   563  //    may be used to endorse or promote products derived from this software
   564  //    without specific prior written permission.
   565  //
   566  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   567  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   568  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   569  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   570  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   571  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   572  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   573  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   574  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   575  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   576  // SUCH DAMAGE.
   577  //
   578  //	@(#)unistd.h	8.2 (Berkeley) 1/7/94
   579  
   580  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
   581  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
   582  
   583  // Copyright (c) 1991, 1993
   584  //	The Regents of the University of California.  All rights reserved.
   585  //
   586  // This code is derived from software contributed to Berkeley by
   587  // Berkeley Software Design, Inc.
   588  //
   589  // Redistribution and use in source and binary forms, with or without
   590  // modification, are permitted provided that the following conditions
   591  // are met:
   592  // 1. Redistributions of source code must retain the above copyright
   593  //    notice, this list of conditions and the following disclaimer.
   594  // 2. Redistributions in binary form must reproduce the above copyright
   595  //    notice, this list of conditions and the following disclaimer in the
   596  //    documentation and/or other materials provided with the distribution.
   597  // 3. Neither the name of the University nor the names of its contributors
   598  //    may be used to endorse or promote products derived from this software
   599  //    without specific prior written permission.
   600  //
   601  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   602  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   603  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   604  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   605  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   606  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   607  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   608  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   609  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   610  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   611  // SUCH DAMAGE.
   612  //
   613  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
   614  
   615  // Define the POSIX.1 version we target for compliance.
   616  
   617  // access function
   618  
   619  // whence values for lseek(2)
   620  
   621  // old BSD whence values for lseek(2); renamed by POSIX 1003.1
   622  
   623  // the parameters argument passed to the __tfork() syscall
   624  type __tfork = struct {
   625  	tf_tcb   uintptr
   626  	tf_tid   uintptr
   627  	tf_stack uintptr
   628  } /* unistd.h:66:1 */
   629  
   630  // the parameters argument for the kbind() syscall
   631  type __kbind = struct {
   632  	kb_addr uintptr
   633  	kb_size size_t
   634  } /* unistd.h:73:1 */
   635  
   636  // the pathconf(2) variable values are part of the ABI
   637  
   638  // configurable pathname variables
   639  
   640  // POSIX options and option groups we unconditionally do or don't
   641  // implement.  Please keep this list in alphabetical order.
   642  //
   643  // Anything which is defined as zero below **must** have an
   644  // implementation for the corresponding sysconf() which is able to
   645  // determine conclusively whether or not the feature is supported.
   646  // Anything which is defined as other than -1 below **must** have
   647  // complete headers, types, and function declarations as specified by
   648  // the POSIX standard; however, if the relevant sysconf() function
   649  // returns -1, the functions may be stubbed out.
   650  
   651  // Define the POSIX.2 version we target for compliance.
   652  
   653  // the sysconf(3) variable values are part of the ABI
   654  
   655  // configurable system variables
   656  
   657  // configurable system strings
   658  
   659  type intptr_t = int64 /* unistd.h:320:21 */
   660  
   661  // MVS linker does not support external names larger than 8 bytes
   662  
   663  //
   664  //     The 'zlib' compression library provides in-memory compression and
   665  //   decompression functions, including integrity checks of the uncompressed data.
   666  //   This version of the library supports only one compression method (deflation)
   667  //   but other algorithms will be added later and will have the same stream
   668  //   interface.
   669  //
   670  //     Compression can be done in a single step if the buffers are large enough,
   671  //   or can be done by repeated calls of the compression function.  In the latter
   672  //   case, the application must provide more input and/or consume the output
   673  //   (providing more output space) before each call.
   674  //
   675  //     The compressed data format used by default by the in-memory functions is
   676  //   the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
   677  //   around a deflate stream, which is itself documented in RFC 1951.
   678  //
   679  //     The library also supports reading and writing files in gzip (.gz) format
   680  //   with an interface similar to that of stdio using the functions that start
   681  //   with "gz".  The gzip format is different from the zlib format.  gzip is a
   682  //   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
   683  //
   684  //     This library can optionally read and write gzip and raw deflate streams in
   685  //   memory as well.
   686  //
   687  //     The zlib format was designed to be compact and fast for use in memory
   688  //   and on communications channels.  The gzip format was designed for single-
   689  //   file compression on file systems, has a larger header than zlib to maintain
   690  //   directory information, and uses a different, slower check method than zlib.
   691  //
   692  //     The library does not install any signal handler.  The decoder checks
   693  //   the consistency of the compressed data, so the library should never crash
   694  //   even in the case of corrupted input.
   695  
   696  type alloc_func = uintptr /* zlib.h:81:16 */
   697  type free_func = uintptr  /* zlib.h:82:16 */
   698  
   699  type z_stream_s = struct {
   700  	next_in   uintptr
   701  	avail_in  uInt
   702  	_         [4]byte
   703  	total_in  uLong
   704  	next_out  uintptr
   705  	avail_out uInt
   706  	_         [4]byte
   707  	total_out uLong
   708  	msg       uintptr
   709  	state     uintptr
   710  	zalloc    alloc_func
   711  	zfree     free_func
   712  	opaque    voidpf
   713  	data_type int32
   714  	_         [4]byte
   715  	adler     uLong
   716  	reserved  uLong
   717  } /* zlib.h:86:9 */
   718  
   719  type z_stream = z_stream_s /* zlib.h:106:3 */
   720  
   721  type z_streamp = uintptr /* zlib.h:108:22 */
   722  
   723  //
   724  //      gzip header information passed to and from zlib routines.  See RFC 1952
   725  //   for more details on the meanings of these fields.
   726  type gz_header_s = struct {
   727  	text      int32
   728  	_         [4]byte
   729  	time      uLong
   730  	xflags    int32
   731  	os        int32
   732  	extra     uintptr
   733  	extra_len uInt
   734  	extra_max uInt
   735  	name      uintptr
   736  	name_max  uInt
   737  	_         [4]byte
   738  	comment   uintptr
   739  	comm_max  uInt
   740  	hcrc      int32
   741  	done      int32
   742  	_         [4]byte
   743  } /* zlib.h:114:9 */
   744  
   745  //
   746  //      gzip header information passed to and from zlib routines.  See RFC 1952
   747  //   for more details on the meanings of these fields.
   748  type gz_header = gz_header_s /* zlib.h:129:3 */
   749  
   750  type gz_headerp = uintptr /* zlib.h:131:23 */
   751  //
   752  //      inflateGetHeader() requests that gzip header information be stored in the
   753  //    provided gz_header structure.  inflateGetHeader() may be called after
   754  //    inflateInit2() or inflateReset(), and before the first call of inflate().
   755  //    As inflate() processes the gzip stream, head->done is zero until the header
   756  //    is completed, at which time head->done is set to one.  If a zlib stream is
   757  //    being decoded, then head->done is set to -1 to indicate that there will be
   758  //    no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
   759  //    used to force inflate() to return immediately after header processing is
   760  //    complete and before any actual data is decompressed.
   761  //
   762  //      The text, time, xflags, and os fields are filled in with the gzip header
   763  //    contents.  hcrc is set to true if there is a header CRC.  (The header CRC
   764  //    was valid if done is set to one.) If extra is not Z_NULL, then extra_max
   765  //    contains the maximum number of bytes to write to extra.  Once done is true,
   766  //    extra_len contains the actual extra field length, and extra contains the
   767  //    extra field, or that field truncated if extra_max is less than extra_len.
   768  //    If name is not Z_NULL, then up to name_max characters are written there,
   769  //    terminated with a zero unless the length is greater than name_max.  If
   770  //    comment is not Z_NULL, then up to comm_max characters are written there,
   771  //    terminated with a zero unless the length is greater than comm_max.  When any
   772  //    of extra, name, or comment are not Z_NULL and the respective field is not
   773  //    present in the header, then that field is set to Z_NULL to signal its
   774  //    absence.  This allows the use of deflateSetHeader() with the returned
   775  //    structure to duplicate the header.  However if those fields are set to
   776  //    allocated memory, then the application will need to save those pointers
   777  //    elsewhere so that they can be eventually freed.
   778  //
   779  //      If inflateGetHeader is not used, then the header information is simply
   780  //    discarded.  The header is always checked for validity, including the header
   781  //    CRC if present.  inflateReset() will reset the process to discard the header
   782  //    information.  The application would need to call inflateGetHeader() again to
   783  //    retrieve the header from the next gzip stream.
   784  //
   785  //      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
   786  //    stream state was inconsistent.
   787  
   788  //
   789  // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
   790  //                                         unsigned char FAR *window));
   791  //
   792  //      Initialize the internal stream state for decompression using inflateBack()
   793  //    calls.  The fields zalloc, zfree and opaque in strm must be initialized
   794  //    before the call.  If zalloc and zfree are Z_NULL, then the default library-
   795  //    derived memory allocation routines are used.  windowBits is the base two
   796  //    logarithm of the window size, in the range 8..15.  window is a caller
   797  //    supplied buffer of that size.  Except for special applications where it is
   798  //    assured that deflate was used with small window sizes, windowBits must be 15
   799  //    and a 32K byte window must be supplied to be able to decompress general
   800  //    deflate streams.
   801  //
   802  //      See inflateBack() for the usage of these routines.
   803  //
   804  //      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
   805  //    the parameters are invalid, Z_MEM_ERROR if the internal state could not be
   806  //    allocated, or Z_VERSION_ERROR if the version of the library does not match
   807  //    the version of the header file.
   808  
   809  type in_func = uintptr  /* zlib.h:1092:18 */
   810  type out_func = uintptr /* zlib.h:1094:13 */
   811  //
   812  //      Same as uncompress, except that sourceLen is a pointer, where the
   813  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
   814  //    source bytes consumed.
   815  
   816  // gzip file access functions
   817  
   818  //
   819  //      This library supports reading and writing files in gzip (.gz) format with
   820  //    an interface similar to that of stdio, using the functions that start with
   821  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
   822  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
   823  
   824  type gzFile_s = struct {
   825  	have uint32
   826  	_    [4]byte
   827  	next uintptr
   828  	pos  off_t
   829  } /* zlib.h:1300:9 */
   830  
   831  //
   832  //      Same as uncompress, except that sourceLen is a pointer, where the
   833  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
   834  //    source bytes consumed.
   835  
   836  // gzip file access functions
   837  
   838  //
   839  //      This library supports reading and writing files in gzip (.gz) format with
   840  //    an interface similar to that of stdio, using the functions that start with
   841  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
   842  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
   843  
   844  type gzFile = uintptr /* zlib.h:1300:25 */
   845  
   846  //	$OpenBSD: stdio.h,v 1.54 2020/09/11 17:56:41 naddy Exp $
   847  //	$NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $
   848  
   849  // -
   850  // Copyright (c) 1990 The Regents of the University of California.
   851  // All rights reserved.
   852  //
   853  // This code is derived from software contributed to Berkeley by
   854  // Chris Torek.
   855  //
   856  // Redistribution and use in source and binary forms, with or without
   857  // modification, are permitted provided that the following conditions
   858  // are met:
   859  // 1. Redistributions of source code must retain the above copyright
   860  //    notice, this list of conditions and the following disclaimer.
   861  // 2. Redistributions in binary form must reproduce the above copyright
   862  //    notice, this list of conditions and the following disclaimer in the
   863  //    documentation and/or other materials provided with the distribution.
   864  // 3. Neither the name of the University nor the names of its contributors
   865  //    may be used to endorse or promote products derived from this software
   866  //    without specific prior written permission.
   867  //
   868  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   869  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   870  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   871  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   872  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   873  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   874  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   875  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   876  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   877  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   878  // SUCH DAMAGE.
   879  //
   880  //	@(#)stdio.h	5.17 (Berkeley) 6/3/91
   881  
   882  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
   883  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
   884  
   885  // Copyright (c) 1991, 1993
   886  //	The Regents of the University of California.  All rights reserved.
   887  //
   888  // This code is derived from software contributed to Berkeley by
   889  // Berkeley Software Design, Inc.
   890  //
   891  // Redistribution and use in source and binary forms, with or without
   892  // modification, are permitted provided that the following conditions
   893  // are met:
   894  // 1. Redistributions of source code must retain the above copyright
   895  //    notice, this list of conditions and the following disclaimer.
   896  // 2. Redistributions in binary form must reproduce the above copyright
   897  //    notice, this list of conditions and the following disclaimer in the
   898  //    documentation and/or other materials provided with the distribution.
   899  // 3. Neither the name of the University nor the names of its contributors
   900  //    may be used to endorse or promote products derived from this software
   901  //    without specific prior written permission.
   902  //
   903  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   904  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   905  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   906  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   907  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   908  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   909  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   910  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   911  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   912  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   913  // SUCH DAMAGE.
   914  //
   915  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
   916  
   917  //	$OpenBSD: _null.h,v 1.2 2016/09/09 22:07:58 millert Exp $
   918  
   919  // Written by Todd C. Miller, September 9, 2016
   920  // Public domain.
   921  
   922  //	$OpenBSD: _types.h,v 1.9 2014/08/22 23:05:15 krw Exp $
   923  
   924  // -
   925  // Copyright (c) 1990, 1993
   926  //	The Regents of the University of California.  All rights reserved.
   927  //
   928  // Redistribution and use in source and binary forms, with or without
   929  // modification, are permitted provided that the following conditions
   930  // are met:
   931  // 1. Redistributions of source code must retain the above copyright
   932  //    notice, this list of conditions and the following disclaimer.
   933  // 2. Redistributions in binary form must reproduce the above copyright
   934  //    notice, this list of conditions and the following disclaimer in the
   935  //    documentation and/or other materials provided with the distribution.
   936  // 3. Neither the name of the University nor the names of its contributors
   937  //    may be used to endorse or promote products derived from this software
   938  //    without specific prior written permission.
   939  //
   940  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   941  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   942  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   943  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   944  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   945  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   946  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   947  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   948  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   949  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   950  // SUCH DAMAGE.
   951  //
   952  //	@(#)types.h	8.3 (Berkeley) 1/5/94
   953  
   954  //	$OpenBSD: types.h,v 1.48 2019/02/09 04:54:11 guenther Exp $
   955  //	$NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $
   956  
   957  // -
   958  // Copyright (c) 1982, 1986, 1991, 1993
   959  //	The Regents of the University of California.  All rights reserved.
   960  // (c) UNIX System Laboratories, Inc.
   961  // All or some portions of this file are derived from material licensed
   962  // to the University of California by American Telephone and Telegraph
   963  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
   964  // the permission of UNIX System Laboratories, Inc.
   965  //
   966  // Redistribution and use in source and binary forms, with or without
   967  // modification, are permitted provided that the following conditions
   968  // are met:
   969  // 1. Redistributions of source code must retain the above copyright
   970  //    notice, this list of conditions and the following disclaimer.
   971  // 2. Redistributions in binary form must reproduce the above copyright
   972  //    notice, this list of conditions and the following disclaimer in the
   973  //    documentation and/or other materials provided with the distribution.
   974  // 3. Neither the name of the University nor the names of its contributors
   975  //    may be used to endorse or promote products derived from this software
   976  //    without specific prior written permission.
   977  //
   978  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   979  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   980  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   981  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   982  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   983  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   984  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   985  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   986  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   987  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   988  // SUCH DAMAGE.
   989  //
   990  //	@(#)types.h	8.4 (Berkeley) 1/21/94
   991  
   992  type fpos_t = off_t /* stdio.h:61:15 */ // stdio file position type
   993  
   994  // NB: to fit things in six character monocase externals, the stdio
   995  // code uses the prefix `__s' for stdio objects, typically followed
   996  // by a three-character attempt at a mnemonic.
   997  
   998  // stdio buffers
   999  type __sbuf = struct {
  1000  	_base uintptr
  1001  	_size int32
  1002  	_     [4]byte
  1003  } /* stdio.h:70:1 */
  1004  
  1005  // stdio state variables.
  1006  //
  1007  // The following always hold:
  1008  //
  1009  //	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  1010  //		_lbfsize is -_bf._size, else _lbfsize is 0
  1011  //	if _flags&__SRD, _w is 0
  1012  //	if _flags&__SWR, _r is 0
  1013  //
  1014  // This ensures that the getc and putc macros (or inline functions) never
  1015  // try to write or read from a file that is in `read' or `write' mode.
  1016  // (Moreover, they can, and do, automatically switch from read mode to
  1017  // write mode, and back, on "r+" and "w+" files.)
  1018  //
  1019  // _lbfsize is used only to make the inline line-buffered output stream
  1020  // code as compact as possible.
  1021  //
  1022  // _ub, _up, and _ur are used when ungetc() pushes back more characters
  1023  // than fit in the current _bf, or when ungetc() pushes back a character
  1024  // that does not match the previous one in _bf.  When this happens,
  1025  // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  1026  // _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  1027  type __sFILE = struct {
  1028  	_p     uintptr
  1029  	_r     int32
  1030  	_w     int32
  1031  	_flags int16
  1032  	_file  int16
  1033  	_      [4]byte
  1034  	_bf    struct {
  1035  		_base uintptr
  1036  		_size int32
  1037  		_     [4]byte
  1038  	}
  1039  	_lbfsize int32
  1040  	_        [4]byte
  1041  	_cookie  uintptr
  1042  	_close   uintptr
  1043  	_read    uintptr
  1044  	_seek    uintptr
  1045  	_write   uintptr
  1046  	_ext     struct {
  1047  		_base uintptr
  1048  		_size int32
  1049  		_     [4]byte
  1050  	}
  1051  	_up   uintptr
  1052  	_ur   int32
  1053  	_ubuf [3]uint8
  1054  	_nbuf [1]uint8
  1055  	_lb   struct {
  1056  		_base uintptr
  1057  		_size int32
  1058  		_     [4]byte
  1059  	}
  1060  	_blksize int32
  1061  	_        [4]byte
  1062  	_offset  fpos_t
  1063  } /* stdio.h:99:9 */
  1064  
  1065  // stdio state variables.
  1066  //
  1067  // The following always hold:
  1068  //
  1069  //	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  1070  //		_lbfsize is -_bf._size, else _lbfsize is 0
  1071  //	if _flags&__SRD, _w is 0
  1072  //	if _flags&__SWR, _r is 0
  1073  //
  1074  // This ensures that the getc and putc macros (or inline functions) never
  1075  // try to write or read from a file that is in `read' or `write' mode.
  1076  // (Moreover, they can, and do, automatically switch from read mode to
  1077  // write mode, and back, on "r+" and "w+" files.)
  1078  //
  1079  // _lbfsize is used only to make the inline line-buffered output stream
  1080  // code as compact as possible.
  1081  //
  1082  // _ub, _up, and _ur are used when ungetc() pushes back more characters
  1083  // than fit in the current _bf, or when ungetc() pushes back a character
  1084  // that does not match the previous one in _bf.  When this happens,
  1085  // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  1086  // _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  1087  type FILE = __sFILE /* stdio.h:131:3 */
  1088  
  1089  // The macro implementations of putc and putc_unlocked are not
  1090  // fully POSIX compliant; they do not set errno on failure
  1091  
  1092  // The macro implementations of putc and putc_unlocked are not
  1093  // fully POSIX compliant; they do not set errno on failure
  1094  
  1095  //	$OpenBSD: string.h,v 1.32 2017/09/05 03:16:13 schwarze Exp $
  1096  //	$NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $
  1097  
  1098  // -
  1099  // Copyright (c) 1990 The Regents of the University of California.
  1100  // All rights reserved.
  1101  //
  1102  // Redistribution and use in source and binary forms, with or without
  1103  // modification, are permitted provided that the following conditions
  1104  // are met:
  1105  // 1. Redistributions of source code must retain the above copyright
  1106  //    notice, this list of conditions and the following disclaimer.
  1107  // 2. Redistributions in binary form must reproduce the above copyright
  1108  //    notice, this list of conditions and the following disclaimer in the
  1109  //    documentation and/or other materials provided with the distribution.
  1110  // 3. Neither the name of the University nor the names of its contributors
  1111  //    may be used to endorse or promote products derived from this software
  1112  //    without specific prior written permission.
  1113  //
  1114  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1115  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1116  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1117  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1118  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1119  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1120  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1121  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1122  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1123  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1124  // SUCH DAMAGE.
  1125  //
  1126  //	@(#)string.h	5.10 (Berkeley) 3/9/91
  1127  
  1128  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
  1129  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
  1130  
  1131  // Copyright (c) 1991, 1993
  1132  //	The Regents of the University of California.  All rights reserved.
  1133  //
  1134  // This code is derived from software contributed to Berkeley by
  1135  // Berkeley Software Design, Inc.
  1136  //
  1137  // Redistribution and use in source and binary forms, with or without
  1138  // modification, are permitted provided that the following conditions
  1139  // are met:
  1140  // 1. Redistributions of source code must retain the above copyright
  1141  //    notice, this list of conditions and the following disclaimer.
  1142  // 2. Redistributions in binary form must reproduce the above copyright
  1143  //    notice, this list of conditions and the following disclaimer in the
  1144  //    documentation and/or other materials provided with the distribution.
  1145  // 3. Neither the name of the University nor the names of its contributors
  1146  //    may be used to endorse or promote products derived from this software
  1147  //    without specific prior written permission.
  1148  //
  1149  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1150  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1151  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1152  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1153  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1154  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1155  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1156  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1157  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1158  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1159  // SUCH DAMAGE.
  1160  //
  1161  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
  1162  
  1163  //	$OpenBSD: _null.h,v 1.2 2016/09/09 22:07:58 millert Exp $
  1164  
  1165  // Written by Todd C. Miller, September 9, 2016
  1166  // Public domain.
  1167  
  1168  //	$OpenBSD: _types.h,v 1.17 2018/03/05 01:15:25 deraadt Exp $
  1169  
  1170  // -
  1171  // Copyright (c) 1990, 1993
  1172  //	The Regents of the University of California.  All rights reserved.
  1173  //
  1174  // Redistribution and use in source and binary forms, with or without
  1175  // modification, are permitted provided that the following conditions
  1176  // are met:
  1177  // 1. Redistributions of source code must retain the above copyright
  1178  //    notice, this list of conditions and the following disclaimer.
  1179  // 2. Redistributions in binary form must reproduce the above copyright
  1180  //    notice, this list of conditions and the following disclaimer in the
  1181  //    documentation and/or other materials provided with the distribution.
  1182  // 3. Neither the name of the University nor the names of its contributors
  1183  //    may be used to endorse or promote products derived from this software
  1184  //    without specific prior written permission.
  1185  //
  1186  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1187  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1188  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1189  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1190  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1191  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1192  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1193  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1194  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1195  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1196  // SUCH DAMAGE.
  1197  //
  1198  //	@(#)types.h	8.3 (Berkeley) 1/5/94
  1199  //	@(#)ansi.h	8.2 (Berkeley) 1/4/94
  1200  
  1201  // POSIX mandates that certain string functions not present in ISO C
  1202  // be prototyped in strings.h.  Historically, we've included them here.
  1203  //	$OpenBSD: strings.h,v 1.6 2017/09/10 21:50:36 schwarze Exp $
  1204  
  1205  // -
  1206  // Copyright (c) 1990 The Regents of the University of California.
  1207  // All rights reserved.
  1208  //
  1209  // Redistribution and use in source and binary forms, with or without
  1210  // modification, are permitted provided that the following conditions
  1211  // are met:
  1212  // 1. Redistributions of source code must retain the above copyright
  1213  //    notice, this list of conditions and the following disclaimer.
  1214  // 2. Redistributions in binary form must reproduce the above copyright
  1215  //    notice, this list of conditions and the following disclaimer in the
  1216  //    documentation and/or other materials provided with the distribution.
  1217  // 3. Neither the name of the University nor the names of its contributors
  1218  //    may be used to endorse or promote products derived from this software
  1219  //    without specific prior written permission.
  1220  //
  1221  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1222  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1223  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1224  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1225  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1226  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1227  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1228  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1229  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1230  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1231  // SUCH DAMAGE.
  1232  //
  1233  //	@(#)strings.h	5.8 (Berkeley) 5/15/90
  1234  
  1235  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
  1236  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
  1237  
  1238  // Copyright (c) 1991, 1993
  1239  //	The Regents of the University of California.  All rights reserved.
  1240  //
  1241  // This code is derived from software contributed to Berkeley by
  1242  // Berkeley Software Design, Inc.
  1243  //
  1244  // Redistribution and use in source and binary forms, with or without
  1245  // modification, are permitted provided that the following conditions
  1246  // are met:
  1247  // 1. Redistributions of source code must retain the above copyright
  1248  //    notice, this list of conditions and the following disclaimer.
  1249  // 2. Redistributions in binary form must reproduce the above copyright
  1250  //    notice, this list of conditions and the following disclaimer in the
  1251  //    documentation and/or other materials provided with the distribution.
  1252  // 3. Neither the name of the University nor the names of its contributors
  1253  //    may be used to endorse or promote products derived from this software
  1254  //    without specific prior written permission.
  1255  //
  1256  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1257  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1258  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1259  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1260  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1261  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1262  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1263  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1264  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1265  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1266  // SUCH DAMAGE.
  1267  //
  1268  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
  1269  
  1270  //	$OpenBSD: _types.h,v 1.17 2018/03/05 01:15:25 deraadt Exp $
  1271  
  1272  // -
  1273  // Copyright (c) 1990, 1993
  1274  //	The Regents of the University of California.  All rights reserved.
  1275  //
  1276  // Redistribution and use in source and binary forms, with or without
  1277  // modification, are permitted provided that the following conditions
  1278  // are met:
  1279  // 1. Redistributions of source code must retain the above copyright
  1280  //    notice, this list of conditions and the following disclaimer.
  1281  // 2. Redistributions in binary form must reproduce the above copyright
  1282  //    notice, this list of conditions and the following disclaimer in the
  1283  //    documentation and/or other materials provided with the distribution.
  1284  // 3. Neither the name of the University nor the names of its contributors
  1285  //    may be used to endorse or promote products derived from this software
  1286  //    without specific prior written permission.
  1287  //
  1288  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1289  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1290  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1291  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1292  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1293  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1294  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1295  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1296  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1297  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1298  // SUCH DAMAGE.
  1299  //
  1300  //	@(#)types.h	8.3 (Berkeley) 1/5/94
  1301  //	@(#)ansi.h	8.2 (Berkeley) 1/4/94
  1302  
  1303  // POSIX mandates that certain string functions not present in ISO C
  1304  // be prototyped in strings.h.
  1305  
  1306  type locale_t = uintptr /* strings.h:53:14 */
  1307  
  1308  //	$OpenBSD: stdlib.h,v 1.76 2019/05/10 15:03:24 otto Exp $
  1309  //	$NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $
  1310  
  1311  // -
  1312  // Copyright (c) 1990 The Regents of the University of California.
  1313  // All rights reserved.
  1314  //
  1315  // Redistribution and use in source and binary forms, with or without
  1316  // modification, are permitted provided that the following conditions
  1317  // are met:
  1318  // 1. Redistributions of source code must retain the above copyright
  1319  //    notice, this list of conditions and the following disclaimer.
  1320  // 2. Redistributions in binary form must reproduce the above copyright
  1321  //    notice, this list of conditions and the following disclaimer in the
  1322  //    documentation and/or other materials provided with the distribution.
  1323  // 3. Neither the name of the University nor the names of its contributors
  1324  //    may be used to endorse or promote products derived from this software
  1325  //    without specific prior written permission.
  1326  //
  1327  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1328  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1329  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1330  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1331  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1332  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1333  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1334  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1335  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1336  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1337  // SUCH DAMAGE.
  1338  //
  1339  //	@(#)stdlib.h	5.13 (Berkeley) 6/4/91
  1340  
  1341  //	$OpenBSD: cdefs.h,v 1.43 2018/10/29 17:10:40 guenther Exp $
  1342  //	$NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $
  1343  
  1344  // Copyright (c) 1991, 1993
  1345  //	The Regents of the University of California.  All rights reserved.
  1346  //
  1347  // This code is derived from software contributed to Berkeley by
  1348  // Berkeley Software Design, Inc.
  1349  //
  1350  // Redistribution and use in source and binary forms, with or without
  1351  // modification, are permitted provided that the following conditions
  1352  // are met:
  1353  // 1. Redistributions of source code must retain the above copyright
  1354  //    notice, this list of conditions and the following disclaimer.
  1355  // 2. Redistributions in binary form must reproduce the above copyright
  1356  //    notice, this list of conditions and the following disclaimer in the
  1357  //    documentation and/or other materials provided with the distribution.
  1358  // 3. Neither the name of the University nor the names of its contributors
  1359  //    may be used to endorse or promote products derived from this software
  1360  //    without specific prior written permission.
  1361  //
  1362  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1363  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1364  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1365  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1366  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1367  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1368  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1369  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1370  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1371  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1372  // SUCH DAMAGE.
  1373  //
  1374  //	@(#)cdefs.h	8.7 (Berkeley) 1/21/94
  1375  
  1376  //	$OpenBSD: _null.h,v 1.2 2016/09/09 22:07:58 millert Exp $
  1377  
  1378  // Written by Todd C. Miller, September 9, 2016
  1379  // Public domain.
  1380  
  1381  //	$OpenBSD: _types.h,v 1.17 2018/03/05 01:15:25 deraadt Exp $
  1382  
  1383  // -
  1384  // Copyright (c) 1990, 1993
  1385  //	The Regents of the University of California.  All rights reserved.
  1386  //
  1387  // Redistribution and use in source and binary forms, with or without
  1388  // modification, are permitted provided that the following conditions
  1389  // are met:
  1390  // 1. Redistributions of source code must retain the above copyright
  1391  //    notice, this list of conditions and the following disclaimer.
  1392  // 2. Redistributions in binary form must reproduce the above copyright
  1393  //    notice, this list of conditions and the following disclaimer in the
  1394  //    documentation and/or other materials provided with the distribution.
  1395  // 3. Neither the name of the University nor the names of its contributors
  1396  //    may be used to endorse or promote products derived from this software
  1397  //    without specific prior written permission.
  1398  //
  1399  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1400  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1401  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1402  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1403  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1404  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1405  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1406  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1407  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1408  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1409  // SUCH DAMAGE.
  1410  //
  1411  //	@(#)types.h	8.3 (Berkeley) 1/5/94
  1412  //	@(#)ansi.h	8.2 (Berkeley) 1/4/94
  1413  
  1414  //	$OpenBSD: types.h,v 1.48 2019/02/09 04:54:11 guenther Exp $
  1415  //	$NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $
  1416  
  1417  // -
  1418  // Copyright (c) 1982, 1986, 1991, 1993
  1419  //	The Regents of the University of California.  All rights reserved.
  1420  // (c) UNIX System Laboratories, Inc.
  1421  // All or some portions of this file are derived from material licensed
  1422  // to the University of California by American Telephone and Telegraph
  1423  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
  1424  // the permission of UNIX System Laboratories, Inc.
  1425  //
  1426  // Redistribution and use in source and binary forms, with or without
  1427  // modification, are permitted provided that the following conditions
  1428  // are met:
  1429  // 1. Redistributions of source code must retain the above copyright
  1430  //    notice, this list of conditions and the following disclaimer.
  1431  // 2. Redistributions in binary form must reproduce the above copyright
  1432  //    notice, this list of conditions and the following disclaimer in the
  1433  //    documentation and/or other materials provided with the distribution.
  1434  // 3. Neither the name of the University nor the names of its contributors
  1435  //    may be used to endorse or promote products derived from this software
  1436  //    without specific prior written permission.
  1437  //
  1438  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1439  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1440  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1441  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1442  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1443  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1444  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1445  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1446  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1447  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1448  // SUCH DAMAGE.
  1449  //
  1450  //	@(#)types.h	8.4 (Berkeley) 1/21/94
  1451  
  1452  // in C++, wchar_t is a built-in type
  1453  
  1454  type div_t = struct {
  1455  	quot int32
  1456  	rem  int32
  1457  } /* stdlib.h:59:3 */
  1458  
  1459  type ldiv_t = struct {
  1460  	quot int64
  1461  	rem  int64
  1462  } /* stdlib.h:64:3 */
  1463  
  1464  type lldiv_t = struct {
  1465  	quot int64
  1466  	rem  int64
  1467  } /* stdlib.h:70:3 */
  1468  
  1469  type qdiv_t = struct {
  1470  	quot quad_t
  1471  	rem  quad_t
  1472  } /* stdlib.h:77:3 */
  1473  
  1474  var hello = *(*[14]int8)(unsafe.Pointer(ts)) /* example.c:29:21 */
  1475  // "hello world" would be more standard, but the repeated "hello"
  1476  // stresses the compression code better, sorry...
  1477  
  1478  var dictionary = *(*[6]int8)(unsafe.Pointer(ts + 14)) /* example.c:34:19 */
  1479  var dictId uLong                                      /* example.c:35:14: */
  1480  
  1481  var zalloc alloc_func = uintptr(0) /* example.c:77:19 */
  1482  var zfree free_func = uintptr(0)   /* example.c:78:18 */
  1483  
  1484  // ===========================================================================
  1485  // Test compress() and uncompress()
  1486  func test_compress(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:88:6: */
  1487  	bp := tls.Alloc(56)
  1488  	defer tls.Free(56)
  1489  	*(*uLong)(unsafe.Pointer(bp + 40)) = comprLen
  1490  	*(*uLong)(unsafe.Pointer(bp + 48)) = uncomprLen
  1491  
  1492  	var err int32
  1493  	var len uLong = libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello))) + uint64(1)
  1494  
  1495  	err = z.Xcompress(tls, compr, bp+40, uintptr(uintptr(unsafe.Pointer(&hello))), len)
  1496  	{
  1497  		if err != 0 {
  1498  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+34, err))
  1499  			libc.Xexit(tls, 1)
  1500  		}
  1501  	}
  1502  
  1503  	libc.Xstrcpy(tls, uncompr, ts+43)
  1504  
  1505  	err = z.Xuncompress(tls, uncompr, bp+48, compr, *(*uLong)(unsafe.Pointer(bp + 40 /* comprLen */)))
  1506  	{
  1507  		if err != 0 {
  1508  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+51, err))
  1509  			libc.Xexit(tls, 1)
  1510  		}
  1511  	}
  1512  
  1513  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  1514  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+62, 0)
  1515  		libc.Xexit(tls, 1)
  1516  	} else {
  1517  		libc.Xprintf(tls, ts+78, libc.VaList(bp+32, uncompr))
  1518  	}
  1519  }
  1520  
  1521  // ===========================================================================
  1522  // Test read/write of .gz files
  1523  func test_gzio(tls *libc.TLS, fname uintptr, uncompr uintptr, uncomprLen uLong) { /* example.c:114:6: */
  1524  	bp := tls.Alloc(84)
  1525  	defer tls.Free(84)
  1526  
  1527  	// var err int32 at bp+80, 4
  1528  
  1529  	var len int32 = int32(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + 1
  1530  	var file gzFile
  1531  	var pos off_t
  1532  
  1533  	file = z.Xgzopen(tls, fname, ts+96)
  1534  	if file == uintptr(0) {
  1535  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+99, 0)
  1536  		libc.Xexit(tls, 1)
  1537  	}
  1538  	z.Xgzputc(tls, file, 'h')
  1539  	if z.Xgzputs(tls, file, ts+113) != 4 {
  1540  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+118, libc.VaList(bp, z.Xgzerror(tls, file, bp+80)))
  1541  		libc.Xexit(tls, 1)
  1542  	}
  1543  	if z.Xgzprintf(tls, file, ts+134, libc.VaList(bp+8, ts+14)) != 8 {
  1544  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+140, libc.VaList(bp+16, z.Xgzerror(tls, file, bp+80)))
  1545  		libc.Xexit(tls, 1)
  1546  	}
  1547  	z.Xgzseek(tls, file, 1, 1) // add one zero byte
  1548  	z.Xgzclose(tls, file)
  1549  
  1550  	file = z.Xgzopen(tls, fname, ts+158)
  1551  	if file == uintptr(0) {
  1552  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+99, 0)
  1553  		libc.Xexit(tls, 1)
  1554  	}
  1555  	libc.Xstrcpy(tls, uncompr, ts+43)
  1556  
  1557  	if z.Xgzread(tls, file, uncompr, uint32(uncomprLen)) != len {
  1558  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+161, libc.VaList(bp+24, z.Xgzerror(tls, file, bp+80)))
  1559  		libc.Xexit(tls, 1)
  1560  	}
  1561  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  1562  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+177, libc.VaList(bp+32, uncompr))
  1563  		libc.Xexit(tls, 1)
  1564  	} else {
  1565  		libc.Xprintf(tls, ts+193, libc.VaList(bp+40, uncompr))
  1566  	}
  1567  
  1568  	pos = z.Xgzseek(tls, file, -8, 1)
  1569  	if pos != int64(6) || z.Xgztell(tls, file) != pos {
  1570  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+207,
  1571  			libc.VaList(bp+48, int64(pos), int64(z.Xgztell(tls, file))))
  1572  		libc.Xexit(tls, 1)
  1573  	}
  1574  
  1575  	if func() int32 {
  1576  		if (*gzFile_s)(unsafe.Pointer(file)).have != 0 {
  1577  			return int32(func() uint8 {
  1578  				(*gzFile_s)(unsafe.Pointer(file)).have--
  1579  				(*gzFile_s)(unsafe.Pointer(file)).pos++
  1580  				return *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&(*gzFile_s)(unsafe.Pointer(file)).next, 1)))
  1581  			}())
  1582  		}
  1583  		return z.Xgzgetc(tls, file)
  1584  	}() != ' ' {
  1585  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+242, 0)
  1586  		libc.Xexit(tls, 1)
  1587  	}
  1588  
  1589  	if z.Xgzungetc(tls, ' ', file) != ' ' {
  1590  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+256, 0)
  1591  		libc.Xexit(tls, 1)
  1592  	}
  1593  
  1594  	z.Xgzgets(tls, file, uncompr, int32(uncomprLen))
  1595  	if libc.Xstrlen(tls, uncompr) != uint64(7) { // " hello!"
  1596  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+272, libc.VaList(bp+64, z.Xgzerror(tls, file, bp+80)))
  1597  		libc.Xexit(tls, 1)
  1598  	}
  1599  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))+uintptr(6)) != 0 {
  1600  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+301, 0)
  1601  		libc.Xexit(tls, 1)
  1602  	} else {
  1603  		libc.Xprintf(tls, ts+326, libc.VaList(bp+72, uncompr))
  1604  	}
  1605  
  1606  	z.Xgzclose(tls, file)
  1607  }
  1608  
  1609  // ===========================================================================
  1610  // Test deflate() with small buffers
  1611  func test_deflate(tls *libc.TLS, compr uintptr, comprLen uLong) { /* example.c:200:6: */
  1612  	bp := tls.Alloc(176)
  1613  	defer tls.Free(176)
  1614  
  1615  	// var c_stream z_stream at bp+64, 112
  1616  	// compression stream
  1617  	var err int32
  1618  	var len uLong = libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello))) + uint64(1)
  1619  
  1620  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zalloc = zalloc
  1621  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zfree = zfree
  1622  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).opaque = uintptr(0)
  1623  
  1624  	err = z.XdeflateInit_(tls, bp+64, -1, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1625  	{
  1626  		if err != 0 {
  1627  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+360, err))
  1628  			libc.Xexit(tls, 1)
  1629  		}
  1630  	}
  1631  
  1632  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello)))
  1633  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_out = compr
  1634  
  1635  	for (*z_stream)(unsafe.Pointer(bp+64)).total_in != len && (*z_stream)(unsafe.Pointer(bp+64)).total_out < comprLen {
  1636  		(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = libc.AssignPtrUint32(bp+64+32, uInt(1)) // force small buffers
  1637  		err = z.Xdeflate(tls, bp+64, 0)
  1638  		{
  1639  			if err != 0 {
  1640  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+372, err))
  1641  				libc.Xexit(tls, 1)
  1642  			}
  1643  		}
  1644  
  1645  	}
  1646  	// Finish the stream, still forcing small buffers:
  1647  	for {
  1648  		(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_out = uInt(1)
  1649  		err = z.Xdeflate(tls, bp+64, 4)
  1650  		if err == 1 {
  1651  			break
  1652  		}
  1653  		{
  1654  			if err != 0 {
  1655  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+372, err))
  1656  				libc.Xexit(tls, 1)
  1657  			}
  1658  		}
  1659  
  1660  	}
  1661  
  1662  	err = z.XdeflateEnd(tls, bp+64)
  1663  	{
  1664  		if err != 0 {
  1665  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+48, ts+380, err))
  1666  			libc.Xexit(tls, 1)
  1667  		}
  1668  	}
  1669  
  1670  }
  1671  
  1672  // ===========================================================================
  1673  // Test inflate() with small buffers
  1674  func test_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:238:6: */
  1675  	bp := tls.Alloc(168)
  1676  	defer tls.Free(168)
  1677  
  1678  	var err int32
  1679  	// var d_stream z_stream at bp+56, 112
  1680  	// decompression stream
  1681  
  1682  	libc.Xstrcpy(tls, uncompr, ts+43)
  1683  
  1684  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc
  1685  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree
  1686  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0)
  1687  
  1688  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr
  1689  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(0)
  1690  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr
  1691  
  1692  	err = z.XinflateInit_(tls, bp+56, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1693  	{
  1694  		if err != 0 {
  1695  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+391, err))
  1696  			libc.Xexit(tls, 1)
  1697  		}
  1698  	}
  1699  
  1700  	for (*z_stream)(unsafe.Pointer(bp+56)).total_out < uncomprLen && (*z_stream)(unsafe.Pointer(bp+56)).total_in < comprLen {
  1701  		(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = libc.AssignPtrUint32(bp+56+32, uInt(1)) // force small buffers
  1702  		err = z.Xinflate(tls, bp+56, 0)
  1703  		if err == 1 {
  1704  			break
  1705  		}
  1706  		{
  1707  			if err != 0 {
  1708  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+403, err))
  1709  				libc.Xexit(tls, 1)
  1710  			}
  1711  		}
  1712  
  1713  	}
  1714  
  1715  	err = z.XinflateEnd(tls, bp+56)
  1716  	{
  1717  		if err != 0 {
  1718  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+411, err))
  1719  			libc.Xexit(tls, 1)
  1720  		}
  1721  	}
  1722  
  1723  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  1724  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+422, 0)
  1725  		libc.Xexit(tls, 1)
  1726  	} else {
  1727  		libc.Xprintf(tls, ts+435, libc.VaList(bp+48, uncompr))
  1728  	}
  1729  }
  1730  
  1731  // ===========================================================================
  1732  // Test deflate() with large buffers and dynamic change of compression level
  1733  func test_large_deflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:279:6: */
  1734  	bp := tls.Alloc(192)
  1735  	defer tls.Free(192)
  1736  
  1737  	// var c_stream z_stream at bp+80, 112
  1738  	// compression stream
  1739  	var err int32
  1740  
  1741  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).zalloc = zalloc
  1742  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).zfree = zfree
  1743  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).opaque = uintptr(0)
  1744  
  1745  	err = z.XdeflateInit_(tls, bp+80, 1, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1746  	{
  1747  		if err != 0 {
  1748  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+360, err))
  1749  			libc.Xexit(tls, 1)
  1750  		}
  1751  	}
  1752  
  1753  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_out = compr
  1754  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_out = uInt(comprLen)
  1755  
  1756  	// At this point, uncompr is still mostly zeroes, so it should compress
  1757  	// very well:
  1758  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = uncompr
  1759  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(uncomprLen)
  1760  	err = z.Xdeflate(tls, bp+80, 0)
  1761  	{
  1762  		if err != 0 {
  1763  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+372, err))
  1764  			libc.Xexit(tls, 1)
  1765  		}
  1766  	}
  1767  
  1768  	if (*z_stream)(unsafe.Pointer(bp+80)).avail_in != uInt(0) {
  1769  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+450, 0)
  1770  		libc.Xexit(tls, 1)
  1771  	}
  1772  
  1773  	// Feed in already compressed data and switch to no compression:
  1774  	z.XdeflateParams(tls, bp+80, 0, 0)
  1775  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = compr
  1776  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(comprLen) / uInt(2)
  1777  	err = z.Xdeflate(tls, bp+80, 0)
  1778  	{
  1779  		if err != 0 {
  1780  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+372, err))
  1781  			libc.Xexit(tls, 1)
  1782  		}
  1783  	}
  1784  
  1785  	// Switch back to compressing mode:
  1786  	z.XdeflateParams(tls, bp+80, 9, 1)
  1787  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = uncompr
  1788  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(uncomprLen)
  1789  	err = z.Xdeflate(tls, bp+80, 0)
  1790  	{
  1791  		if err != 0 {
  1792  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+48, ts+372, err))
  1793  			libc.Xexit(tls, 1)
  1794  		}
  1795  	}
  1796  
  1797  	err = z.Xdeflate(tls, bp+80, 4)
  1798  	if err != 1 {
  1799  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+470, 0)
  1800  		libc.Xexit(tls, 1)
  1801  	}
  1802  	err = z.XdeflateEnd(tls, bp+80)
  1803  	{
  1804  		if err != 0 {
  1805  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+64, ts+380, err))
  1806  			libc.Xexit(tls, 1)
  1807  		}
  1808  	}
  1809  
  1810  }
  1811  
  1812  // ===========================================================================
  1813  // Test inflate() with large buffers
  1814  func test_large_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:334:6: */
  1815  	bp := tls.Alloc(168)
  1816  	defer tls.Free(168)
  1817  
  1818  	var err int32
  1819  	// var d_stream z_stream at bp+56, 112
  1820  	// decompression stream
  1821  
  1822  	libc.Xstrcpy(tls, uncompr, ts+43)
  1823  
  1824  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc
  1825  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree
  1826  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0)
  1827  
  1828  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr
  1829  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(comprLen)
  1830  
  1831  	err = z.XinflateInit_(tls, bp+56, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1832  	{
  1833  		if err != 0 {
  1834  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+391, err))
  1835  			libc.Xexit(tls, 1)
  1836  		}
  1837  	}
  1838  
  1839  	for {
  1840  		(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr // discard the output
  1841  		(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_out = uInt(uncomprLen)
  1842  		err = z.Xinflate(tls, bp+56, 0)
  1843  		if err == 1 {
  1844  			break
  1845  		}
  1846  		{
  1847  			if err != 0 {
  1848  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+506, err))
  1849  				libc.Xexit(tls, 1)
  1850  			}
  1851  		}
  1852  
  1853  	}
  1854  
  1855  	err = z.XinflateEnd(tls, bp+56)
  1856  	{
  1857  		if err != 0 {
  1858  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+411, err))
  1859  			libc.Xexit(tls, 1)
  1860  		}
  1861  	}
  1862  
  1863  	if (*z_stream)(unsafe.Pointer(bp+56)).total_out != uint64(2)*uncomprLen+comprLen/uint64(2) {
  1864  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+520, libc.VaList(bp+48, (*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).total_out))
  1865  		libc.Xexit(tls, 1)
  1866  	} else {
  1867  		libc.Xprintf(tls, ts+544, 0)
  1868  	}
  1869  }
  1870  
  1871  // ===========================================================================
  1872  // Test deflate() with full flush
  1873  func test_flush(tls *libc.TLS, compr uintptr, comprLen uintptr) { /* example.c:375:6: */
  1874  	bp := tls.Alloc(176)
  1875  	defer tls.Free(176)
  1876  
  1877  	// var c_stream z_stream at bp+64, 112
  1878  	// compression stream
  1879  	var err int32
  1880  	var len uInt = uInt(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + uInt(1)
  1881  
  1882  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zalloc = zalloc
  1883  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zfree = zfree
  1884  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).opaque = uintptr(0)
  1885  
  1886  	err = z.XdeflateInit_(tls, bp+64, -1, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1887  	{
  1888  		if err != 0 {
  1889  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+360, err))
  1890  			libc.Xexit(tls, 1)
  1891  		}
  1892  	}
  1893  
  1894  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello)))
  1895  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_out = compr
  1896  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = uInt(3)
  1897  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_out = uInt(*(*uLong)(unsafe.Pointer(comprLen)))
  1898  	err = z.Xdeflate(tls, bp+64, 3)
  1899  	{
  1900  		if err != 0 {
  1901  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+372, err))
  1902  			libc.Xexit(tls, 1)
  1903  		}
  1904  	}
  1905  
  1906  	*(*Byte)(unsafe.Pointer(compr + 3))++ // force an error in first compressed block
  1907  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = len - uInt(3)
  1908  
  1909  	err = z.Xdeflate(tls, bp+64, 4)
  1910  	if err != 1 {
  1911  		{
  1912  			if err != 0 {
  1913  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+372, err))
  1914  				libc.Xexit(tls, 1)
  1915  			}
  1916  		}
  1917  
  1918  	}
  1919  	err = z.XdeflateEnd(tls, bp+64)
  1920  	{
  1921  		if err != 0 {
  1922  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+48, ts+380, err))
  1923  			libc.Xexit(tls, 1)
  1924  		}
  1925  	}
  1926  
  1927  	*(*uLong)(unsafe.Pointer(comprLen)) = (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).total_out
  1928  }
  1929  
  1930  // ===========================================================================
  1931  // Test inflateSync()
  1932  func test_sync(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:413:6: */
  1933  	bp := tls.Alloc(184)
  1934  	defer tls.Free(184)
  1935  
  1936  	var err int32
  1937  	// var d_stream z_stream at bp+72, 112
  1938  	// decompression stream
  1939  
  1940  	libc.Xstrcpy(tls, uncompr, ts+43)
  1941  
  1942  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).zalloc = zalloc
  1943  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).zfree = zfree
  1944  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).opaque = uintptr(0)
  1945  
  1946  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).next_in = compr
  1947  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_in = uInt(2) // just read the zlib header
  1948  
  1949  	err = z.XinflateInit_(tls, bp+72, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1950  	{
  1951  		if err != 0 {
  1952  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+391, err))
  1953  			libc.Xexit(tls, 1)
  1954  		}
  1955  	}
  1956  
  1957  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).next_out = uncompr
  1958  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_out = uInt(uncomprLen)
  1959  
  1960  	err = z.Xinflate(tls, bp+72, 0)
  1961  	{
  1962  		if err != 0 {
  1963  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+403, err))
  1964  			libc.Xexit(tls, 1)
  1965  		}
  1966  	}
  1967  
  1968  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_in = uInt(comprLen) - uInt(2) // read all compressed data
  1969  	err = z.XinflateSync(tls, bp+72)                                                         /* but skip the damaged part */
  1970  	{
  1971  		if err != 0 {
  1972  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+565, err))
  1973  			libc.Xexit(tls, 1)
  1974  		}
  1975  	}
  1976  
  1977  	err = z.Xinflate(tls, bp+72, 4)
  1978  	if err != -3 {
  1979  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+577, 0)
  1980  		// Because of incorrect adler32
  1981  		libc.Xexit(tls, 1)
  1982  	}
  1983  	err = z.XinflateEnd(tls, bp+72)
  1984  	{
  1985  		if err != 0 {
  1986  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+48, ts+411, err))
  1987  			libc.Xexit(tls, 1)
  1988  		}
  1989  	}
  1990  
  1991  	libc.Xprintf(tls, ts+611, libc.VaList(bp+64, uncompr))
  1992  }
  1993  
  1994  // ===========================================================================
  1995  // Test deflate() with preset dictionary
  1996  func test_dict_deflate(tls *libc.TLS, compr uintptr, comprLen uLong) { /* example.c:457:6: */
  1997  	bp := tls.Alloc(160)
  1998  	defer tls.Free(160)
  1999  
  2000  	// var c_stream z_stream at bp+48, 112
  2001  	// compression stream
  2002  	var err int32
  2003  
  2004  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).zalloc = zalloc
  2005  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).zfree = zfree
  2006  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).opaque = uintptr(0)
  2007  
  2008  	err = z.XdeflateInit_(tls, bp+48, 9, ts+353, int32(unsafe.Sizeof(z_stream{})))
  2009  	{
  2010  		if err != 0 {
  2011  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+360, err))
  2012  			libc.Xexit(tls, 1)
  2013  		}
  2014  	}
  2015  
  2016  	err = z.XdeflateSetDictionary(tls, bp+48,
  2017  		uintptr(uintptr(unsafe.Pointer(&dictionary))), uint32(int32(unsafe.Sizeof(dictionary))))
  2018  	{
  2019  		if err != 0 {
  2020  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+639, err))
  2021  			libc.Xexit(tls, 1)
  2022  		}
  2023  	}
  2024  
  2025  	dictId = (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).adler
  2026  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).next_out = compr
  2027  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).avail_out = uInt(comprLen)
  2028  
  2029  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello)))
  2030  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).avail_in = uInt(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + uInt(1)
  2031  
  2032  	err = z.Xdeflate(tls, bp+48, 4)
  2033  	if err != 1 {
  2034  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+470, 0)
  2035  		libc.Xexit(tls, 1)
  2036  	}
  2037  	err = z.XdeflateEnd(tls, bp+48)
  2038  	{
  2039  		if err != 0 {
  2040  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+380, err))
  2041  			libc.Xexit(tls, 1)
  2042  		}
  2043  	}
  2044  
  2045  }
  2046  
  2047  // ===========================================================================
  2048  // Test inflate() with a preset dictionary
  2049  func test_dict_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:494:6: */
  2050  	bp := tls.Alloc(168)
  2051  	defer tls.Free(168)
  2052  
  2053  	var err int32
  2054  	// var d_stream z_stream at bp+56, 112
  2055  	// decompression stream
  2056  
  2057  	libc.Xstrcpy(tls, uncompr, ts+43)
  2058  
  2059  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc
  2060  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree
  2061  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0)
  2062  
  2063  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr
  2064  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(comprLen)
  2065  
  2066  	err = z.XinflateInit_(tls, bp+56, ts+353, int32(unsafe.Sizeof(z_stream{})))
  2067  	{
  2068  		if err != 0 {
  2069  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp, ts+391, err))
  2070  			libc.Xexit(tls, 1)
  2071  		}
  2072  	}
  2073  
  2074  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr
  2075  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_out = uInt(uncomprLen)
  2076  
  2077  	for {
  2078  		err = z.Xinflate(tls, bp+56, 0)
  2079  		if err == 1 {
  2080  			break
  2081  		}
  2082  		if err == 2 {
  2083  			if (*z_stream)(unsafe.Pointer(bp+56)).adler != dictId {
  2084  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+660, 0)
  2085  				libc.Xexit(tls, 1)
  2086  			}
  2087  			err = z.XinflateSetDictionary(tls, bp+56, uintptr(uintptr(unsafe.Pointer(&dictionary))),
  2088  				uint32(int32(unsafe.Sizeof(dictionary))))
  2089  		}
  2090  		{
  2091  			if err != 0 {
  2092  				libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+16, ts+682, err))
  2093  				libc.Xexit(tls, 1)
  2094  			}
  2095  		}
  2096  
  2097  	}
  2098  
  2099  	err = z.XinflateEnd(tls, bp+56)
  2100  	{
  2101  		if err != 0 {
  2102  			libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+20, libc.VaList(bp+32, ts+411, err))
  2103  			libc.Xexit(tls, 1)
  2104  		}
  2105  	}
  2106  
  2107  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  2108  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+700, 0)
  2109  		libc.Xexit(tls, 1)
  2110  	} else {
  2111  		libc.Xprintf(tls, ts+723, libc.VaList(bp+48, uncompr))
  2112  	}
  2113  }
  2114  
  2115  // ===========================================================================
  2116  // Usage:  example [output.gz  [input.gz]]
  2117  
  2118  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* example.c:545:5: */
  2119  	bp := tls.Alloc(32)
  2120  	defer tls.Free(32)
  2121  
  2122  	var compr uintptr
  2123  	var uncompr uintptr
  2124  	*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) = uint64(10000) * uint64(unsafe.Sizeof(int32(0))) // don't overflow on MSDOS
  2125  	var uncomprLen uLong = *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */))
  2126  
  2127  	if int32(*(*int8)(unsafe.Pointer(z.XzlibVersion(tls)))) != int32(*(*int8)(unsafe.Pointer(myVersion))) {
  2128  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+752, 0)
  2129  		libc.Xexit(tls, 1)
  2130  
  2131  	} else if libc.Xstrcmp(tls, z.XzlibVersion(tls), ts+353) != 0 {
  2132  		libc.Xfprintf(tls, uintptr(unsafe.Pointer(&libc.X__sF))+2*152, ts+779, 0)
  2133  	}
  2134  
  2135  	libc.Xprintf(tls, ts+812,
  2136  		libc.VaList(bp, ts+353, 0x12b0, z.XzlibCompileFlags(tls)))
  2137  
  2138  	compr = libc.Xcalloc(tls, uint64(uInt(*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)))), uint64(1))
  2139  	uncompr = libc.Xcalloc(tls, uint64(uInt(uncomprLen)), uint64(1))
  2140  	// compr and uncompr are cleared to avoid reading uninitialized
  2141  	// data and to ensure that uncompr compresses well.
  2142  	if compr == uintptr(0) || uncompr == uintptr(0) {
  2143  		libc.Xprintf(tls, ts+861, 0)
  2144  		libc.Xexit(tls, 1)
  2145  	}
  2146  
  2147  	test_compress(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2148  
  2149  	test_gzio(tls, func() uintptr {
  2150  		if argc > 1 {
  2151  			return *(*uintptr)(unsafe.Pointer(argv + 1*8))
  2152  		}
  2153  		return ts + 876
  2154  	}(),
  2155  		uncompr, uncomprLen)
  2156  
  2157  	test_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)))
  2158  	test_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2159  
  2160  	test_large_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2161  	test_large_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2162  
  2163  	test_flush(tls, compr, bp+24)
  2164  	test_sync(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2165  	*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) = uncomprLen
  2166  
  2167  	test_dict_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)))
  2168  	test_dict_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2169  
  2170  	libc.Xfree(tls, compr)
  2171  	libc.Xfree(tls, uncompr)
  2172  
  2173  	return 0
  2174  }
  2175  
  2176  var myVersion uintptr = ts + 353 /* "1.2.11" */ /* example.c:552:22 */
  2177  
  2178  var ts1 = "hello, hello!\x00hello\x00%s error: %d\n\x00compress\x00garbage\x00uncompress\x00bad uncompress\n\x00uncompress(): %s\n\x00wb\x00gzopen error\n\x00ello\x00gzputs err: %s\n\x00, %s!\x00gzprintf err: %s\n\x00rb\x00gzread err: %s\n\x00bad gzread: %s\n\x00gzread(): %s\n\x00gzseek error, pos=%ld, gztell=%ld\n\x00gzgetc error\n\x00gzungetc error\n\x00gzgets err after gzseek: %s\n\x00bad gzgets after gzseek\n\x00gzgets() after gzseek: %s\n\x001.2.11\x00deflateInit\x00deflate\x00deflateEnd\x00inflateInit\x00inflate\x00inflateEnd\x00bad inflate\n\x00inflate(): %s\n\x00deflate not greedy\n\x00deflate should report Z_STREAM_END\n\x00large inflate\x00bad large inflate: %ld\n\x00large_inflate(): OK\n\x00inflateSync\x00inflate should report DATA_ERROR\n\x00after inflateSync(): hel%s\n\x00deflateSetDictionary\x00unexpected dictionary\x00inflate with dict\x00bad inflate with dict\n\x00inflate with dictionary: %s\n\x00incompatible zlib version\n\x00warning: different zlib version\n\x00zlib version %s = 0x%04x, compile flags = 0x%lx\n\x00out of memory\n\x00foo.gz\x00"
  2179  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data