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

     1  // Code generated by 'ccgo -lmodernc.org/z/lib -o internal\minigzip_windows_amd64.go -trace-translation-units C:\Users\0xjnml\go\src\modernc.org\z\tmp\cdb.json minigzip.exe', 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 _ types.Size_t
    21  
    22  func main() { libc.Start(main1) }
    23  
    24  type ptrdiff_t = int64 /* <builtin>:3:26 */
    25  
    26  type size_t = uint64 /* <builtin>:9:23 */
    27  
    28  type wchar_t = uint16 /* <builtin>:15:24 */
    29  
    30  type va_list = uintptr /* <builtin>:50:27 */
    31  
    32  type ssize_t = int64 /* crtdefs.h:45:35 */
    33  
    34  type rsize_t = size_t /* crtdefs.h:52:16 */
    35  
    36  type intptr_t = int64 /* crtdefs.h:62:35 */
    37  
    38  type uintptr_t = uint64 /* crtdefs.h:75:44 */
    39  
    40  type wint_t = uint16   /* crtdefs.h:106:24 */
    41  type wctype_t = uint16 /* crtdefs.h:107:24 */
    42  
    43  type errno_t = int32 /* crtdefs.h:113:13 */
    44  
    45  type time_t = int64 /* crtdefs.h:138:20 */
    46  
    47  type threadlocaleinfostruct = struct {
    48  	refcount      int32
    49  	lc_codepage   uint32
    50  	lc_collate_cp uint32
    51  	lc_handle     [6]uint32
    52  	lc_id         [6]LC_ID
    53  	lc_category   [6]struct {
    54  		locale    uintptr
    55  		wlocale   uintptr
    56  		refcount  uintptr
    57  		wrefcount uintptr
    58  	}
    59  	lc_clike            int32
    60  	mb_cur_max          int32
    61  	lconv_intl_refcount uintptr
    62  	lconv_num_refcount  uintptr
    63  	lconv_mon_refcount  uintptr
    64  	lconv               uintptr
    65  	ctype1_refcount     uintptr
    66  	ctype1              uintptr
    67  	pctype              uintptr
    68  	pclmap              uintptr
    69  	pcumap              uintptr
    70  	lc_time_curr        uintptr
    71  } /* crtdefs.h:422:1 */
    72  
    73  type pthreadlocinfo = uintptr /* crtdefs.h:424:39 */
    74  type pthreadmbcinfo = uintptr /* crtdefs.h:425:36 */
    75  
    76  type localeinfo_struct = struct {
    77  	locinfo pthreadlocinfo
    78  	mbcinfo pthreadmbcinfo
    79  } /* crtdefs.h:428:9 */
    80  
    81  type _locale_tstruct = localeinfo_struct /* crtdefs.h:431:3 */
    82  type _locale_t = uintptr                 /* crtdefs.h:431:19 */
    83  
    84  type tagLC_ID = struct {
    85  	wLanguage uint16
    86  	wCountry  uint16
    87  	wCodePage uint16
    88  } /* crtdefs.h:422:1 */
    89  
    90  type LC_ID = tagLC_ID  /* crtdefs.h:439:3 */
    91  type LPLC_ID = uintptr /* crtdefs.h:439:9 */
    92  
    93  type threadlocinfo = threadlocaleinfostruct /* crtdefs.h:468:3 */
    94  
    95  // ISO C Standard:  7.17  Common definitions  <stddef.h>
    96  
    97  // Any one of these symbols __need_* means that GNU libc
    98  //    wants us just to define one data type.  So don't define
    99  //    the symbols that indicate this file's entire job has been done.
   100  // snaroff@next.com says the NeXT needs this.
   101  // Irix 5.1 needs this.
   102  
   103  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
   104  //    defined if the corresponding type is *not* defined.
   105  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_
   106  
   107  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
   108  //    Just ignore it.
   109  
   110  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
   111  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
   112  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
   113  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
   114  //    If we find that the macros are still defined at this point, we must
   115  //    invoke them so that the type is defined as expected.
   116  
   117  // In case nobody has defined these types, but we aren't running under
   118  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
   119  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
   120  //    parts of GCC is compiled by an older compiler, that actually
   121  //    include gstddef.h, such as collect2.
   122  
   123  // Signed type of difference of two pointers.
   124  
   125  // Define this type if we are doing the whole job,
   126  //    or if we want this type in particular.
   127  
   128  // If this symbol has done its job, get rid of it.
   129  
   130  // Unsigned type of `sizeof' something.
   131  
   132  // Define this type if we are doing the whole job,
   133  //    or if we want this type in particular.
   134  
   135  // Wide character type.
   136  //    Locale-writers should change this as necessary to
   137  //    be big enough to hold unique values not between 0 and 127,
   138  //    and not (wchar_t) -1, for each defined multibyte character.
   139  
   140  // Define this type if we are doing the whole job,
   141  //    or if we want this type in particular.
   142  
   143  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
   144  //     are already defined.
   145  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
   146  
   147  // A null pointer constant.
   148  
   149  // Offset of member MEMBER in a struct of type TYPE.
   150  
   151  // Type whose alignment is supported in every context and is at least
   152  //    as great as that of any standard type not using alignment
   153  //    specifiers.
   154  type max_align_t = struct {
   155  	__max_align_ll int64
   156  	__max_align_ld float64
   157  } /* stddef.h:426:3 */
   158  
   159  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
   160  //
   161  // This file is part of GCC.
   162  //
   163  // GCC is free software; you can redistribute it and/or modify
   164  // it under the terms of the GNU General Public License as published by
   165  // the Free Software Foundation; either version 3, or (at your option)
   166  // any later version.
   167  //
   168  // GCC is distributed in the hope that it will be useful,
   169  // but WITHOUT ANY WARRANTY; without even the implied warranty of
   170  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   171  // GNU General Public License for more details.
   172  //
   173  // Under Section 7 of GPL version 3, you are granted additional
   174  // permissions described in the GCC Runtime Library Exception, version
   175  // 3.1, as published by the Free Software Foundation.
   176  //
   177  // You should have received a copy of the GNU General Public License and
   178  // a copy of the GCC Runtime Library Exception along with this program;
   179  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   180  // <http://www.gnu.org/licenses/>.
   181  
   182  // ISO C Standard:  7.17  Common definitions  <stddef.h>
   183  type z_size_t = size_t /* zconf.h:248:21 */
   184  
   185  // Maximum value for memLevel in deflateInit2
   186  
   187  // Maximum value for windowBits in deflateInit2 and inflateInit2.
   188  // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
   189  // created by gzip. (Files created by minigzip can still be extracted by
   190  // gzip.)
   191  
   192  // The memory requirements for deflate are (in bytes):
   193  //             (1 << (windowBits+2)) +  (1 << (memLevel+9))
   194  //  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
   195  //  plus a few kilobytes for small objects. For example, if you want to reduce
   196  //  the default memory requirements from 256K to 128K, compile with
   197  //      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
   198  //  Of course this will generally degrade compression (there's no free lunch).
   199  //
   200  //    The memory requirements for inflate are (in bytes) 1 << windowBits
   201  //  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
   202  //  for small objects.
   203  
   204  // Type declarations
   205  
   206  // The following definitions for FAR are needed only for MSDOS mixed
   207  // model programming (small or medium model with some far allocations).
   208  // This was tested only with MSC; for other MSDOS compilers you may have
   209  // to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
   210  // just define FAR to be empty.
   211  
   212  // If building or using zlib as a DLL, define ZLIB_DLL.
   213  // This is not mandatory, but it offers a little performance increase.
   214  // If building or using zlib with the WINAPI/WINAPIV calling convention,
   215  // define ZLIB_WINAPI.
   216  // Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
   217  
   218  type Byte = uint8   /* zconf.h:391:24 */ // 8 bits
   219  type uInt = uint32  /* zconf.h:393:24 */ // 16 bits or more
   220  type uLong = uint32 /* zconf.h:394:24 */ // 32 bits or more
   221  
   222  type Bytef = Byte   /* zconf.h:400:22 */
   223  type charf = int8   /* zconf.h:402:19 */
   224  type intf = int32   /* zconf.h:403:19 */
   225  type uIntf = uInt   /* zconf.h:404:19 */
   226  type uLongf = uLong /* zconf.h:405:19 */
   227  
   228  type voidpc = uintptr /* zconf.h:408:23 */
   229  type voidpf = uintptr /* zconf.h:409:23 */
   230  type voidp = uintptr  /* zconf.h:410:23 */
   231  
   232  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
   233  //
   234  // This file is part of GCC.
   235  //
   236  // GCC is free software; you can redistribute it and/or modify it under
   237  // the terms of the GNU General Public License as published by the Free
   238  // Software Foundation; either version 3, or (at your option) any later
   239  // version.
   240  //
   241  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
   242  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
   243  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   244  // for more details.
   245  //
   246  // Under Section 7 of GPL version 3, you are granted additional
   247  // permissions described in the GCC Runtime Library Exception, version
   248  // 3.1, as published by the Free Software Foundation.
   249  //
   250  // You should have received a copy of the GNU General Public License and
   251  // a copy of the GCC Runtime Library Exception along with this program;
   252  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   253  // <http://www.gnu.org/licenses/>.
   254  
   255  // This administrivia gets added to the beginning of limits.h
   256  //    if the system has its own version of limits.h.
   257  
   258  // We use _GCC_LIMITS_H_ because we want this not to match
   259  //    any macros that the system's limits.h uses for its own purposes.
   260  
   261  // Use "..." so that we find syslimits.h only in this same directory.
   262  // syslimits.h stands for the system's own limits.h file.
   263  //    If we can use it ok unmodified, then we install this text.
   264  //    If fixincludes fixes it, then the fixed version is installed
   265  //    instead of this text.
   266  
   267  // *
   268  // This file has no copyright assigned and is placed in the Public Domain.
   269  // This file is part of the mingw-w64 runtime package.
   270  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   271  // *
   272  // This file has no copyright assigned and is placed in the Public Domain.
   273  // This file is part of the mingw-w64 runtime package.
   274  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   275  
   276  // File system limits
   277  //
   278  // NOTE: Apparently the actual size of PATH_MAX is 260, but a space is
   279  //       required for the NUL. TODO: Test?
   280  // NOTE: PATH_MAX is the POSIX equivalent for Microsoft's MAX_PATH; the two
   281  //       are semantically identical, with a limit of 259 characters for the
   282  //       path name, plus one for a terminating NUL, for a total of 260.
   283  
   284  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
   285  //
   286  // This file is part of GCC.
   287  //
   288  // GCC is free software; you can redistribute it and/or modify it under
   289  // the terms of the GNU General Public License as published by the Free
   290  // Software Foundation; either version 3, or (at your option) any later
   291  // version.
   292  //
   293  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
   294  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
   295  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   296  // for more details.
   297  //
   298  // Under Section 7 of GPL version 3, you are granted additional
   299  // permissions described in the GCC Runtime Library Exception, version
   300  // 3.1, as published by the Free Software Foundation.
   301  //
   302  // You should have received a copy of the GNU General Public License and
   303  // a copy of the GCC Runtime Library Exception along with this program;
   304  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   305  // <http://www.gnu.org/licenses/>.
   306  
   307  // Number of bits in a `char'.
   308  
   309  // Maximum length of a multibyte character.
   310  
   311  // Minimum and maximum values a `signed char' can hold.
   312  
   313  // Maximum value an `unsigned char' can hold.  (Minimum is 0).
   314  
   315  // Minimum and maximum values a `char' can hold.
   316  
   317  // Minimum and maximum values a `signed short int' can hold.
   318  
   319  // Maximum value an `unsigned short int' can hold.  (Minimum is 0).
   320  
   321  // Minimum and maximum values a `signed int' can hold.
   322  
   323  // Maximum value an `unsigned int' can hold.  (Minimum is 0).
   324  
   325  // Minimum and maximum values a `signed long int' can hold.
   326  //    (Same as `int').
   327  
   328  // Maximum value an `unsigned long int' can hold.  (Minimum is 0).
   329  
   330  // Minimum and maximum values a `signed long long int' can hold.
   331  
   332  // Maximum value an `unsigned long long int' can hold.  (Minimum is 0).
   333  
   334  // Minimum and maximum values a `signed long long int' can hold.
   335  
   336  // Maximum value an `unsigned long long int' can hold.  (Minimum is 0).
   337  
   338  // This administrivia gets added to the end of limits.h
   339  //    if the system has its own version of limits.h.
   340  
   341  type z_crc_t = uint32 /* zconf.h:429:17 */
   342  
   343  // *
   344  // This file has no copyright assigned and is placed in the Public Domain.
   345  // This file is part of the mingw-w64 runtime package.
   346  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   347  
   348  // *
   349  // This file has no copyright assigned and is placed in the Public Domain.
   350  // This file is part of the mingw-w64 runtime package.
   351  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   352  
   353  type _ino_t = uint16 /* types.h:43:24 */
   354  type ino_t = uint16  /* types.h:45:24 */
   355  
   356  type _dev_t = uint32 /* types.h:51:22 */
   357  type dev_t = uint32  /* types.h:53:22 */
   358  
   359  type _pid_t = int64 /* types.h:63:17 */
   360  
   361  type pid_t = _pid_t /* types.h:68:16 */
   362  
   363  type _mode_t = uint16 /* types.h:74:24 */
   364  
   365  type mode_t = _mode_t /* types.h:77:17 */
   366  
   367  type _off_t = int32  /* _mingw_off_t.h:5:16 */
   368  type off32_t = int32 /* _mingw_off_t.h:7:16 */
   369  
   370  type _off64_t = int64 /* _mingw_off_t.h:13:39 */
   371  type off64_t = int64  /* _mingw_off_t.h:15:39 */
   372  
   373  type off_t = off64_t /* _mingw_off_t.h:24:17 */
   374  
   375  type useconds_t = uint32 /* types.h:84:22 */
   376  
   377  type timespec = struct {
   378  	tv_sec  time_t
   379  	tv_nsec int32
   380  	_       [4]byte
   381  } /* types.h:89:1 */
   382  
   383  type itimerspec = struct {
   384  	it_interval struct {
   385  		tv_sec  time_t
   386  		tv_nsec int32
   387  		_       [4]byte
   388  	}
   389  	it_value struct {
   390  		tv_sec  time_t
   391  		tv_nsec int32
   392  		_       [4]byte
   393  	}
   394  } /* types.h:94:1 */
   395  
   396  type _sigset_t = uint64 /* types.h:104:28 */
   397  
   398  // Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
   399  //
   400  // This file is part of GCC.
   401  //
   402  // GCC is free software; you can redistribute it and/or modify
   403  // it under the terms of the GNU General Public License as published by
   404  // the Free Software Foundation; either version 2, or (at your option)
   405  // any later version.
   406  //
   407  // GCC is distributed in the hope that it will be useful,
   408  // but WITHOUT ANY WARRANTY; without even the implied warranty of
   409  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   410  // GNU General Public License for more details.
   411  //
   412  // You should have received a copy of the GNU General Public License
   413  // along with GCC; see the file COPYING.  If not, write to
   414  // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
   415  // Boston, MA 02110-1301, USA.
   416  
   417  // As a special exception, if you include this header file into source
   418  //    files compiled by GCC, this header file does not by itself cause
   419  //    the resulting executable to be covered by the GNU General Public
   420  //    License.  This exception does not however invalidate any other
   421  //    reasons why the executable file might be covered by the GNU General
   422  //    Public License.
   423  
   424  // ISO C Standard:  7.15  Variable arguments  <stdarg.h>
   425  
   426  // Define __gnuc_va_list.
   427  
   428  // Define the standard macros for the user,
   429  //    if this invocation was from the user program.
   430  
   431  // Define va_list, if desired, from __gnuc_va_list.
   432  // We deliberately do not define va_list when called from
   433  //    stdio.h, because ANSI C says that stdio.h is not supposed to define
   434  //    va_list.  stdio.h needs to have access to that data type,
   435  //    but must not use that name.  It should use the name __gnuc_va_list,
   436  //    which is safe because it is reserved for the implementation.
   437  
   438  // The macro _VA_LIST_ is the same thing used by this file in Ultrix.
   439  //    But on BSD NET2 we must not test or define or undef it.
   440  //    (Note that the comments in NET 2's ansi.h
   441  //    are incorrect for _VA_LIST_--see stdio.h!)
   442  // The macro _VA_LIST_DEFINED is used in Windows NT 3.5
   443  
   444  // include mingw stuff
   445  // *
   446  // This file has no copyright assigned and is placed in the Public Domain.
   447  // This file is part of the mingw-w64 runtime package.
   448  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   449  
   450  // *
   451  // This file has no copyright assigned and is placed in the Public Domain.
   452  // This file is part of the mingw-w64 runtime package.
   453  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   454  
   455  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
   456  //
   457  // This file is part of GCC.
   458  //
   459  // GCC is free software; you can redistribute it and/or modify
   460  // it under the terms of the GNU General Public License as published by
   461  // the Free Software Foundation; either version 3, or (at your option)
   462  // any later version.
   463  //
   464  // GCC is distributed in the hope that it will be useful,
   465  // but WITHOUT ANY WARRANTY; without even the implied warranty of
   466  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   467  // GNU General Public License for more details.
   468  //
   469  // Under Section 7 of GPL version 3, you are granted additional
   470  // permissions described in the GCC Runtime Library Exception, version
   471  // 3.1, as published by the Free Software Foundation.
   472  //
   473  // You should have received a copy of the GNU General Public License and
   474  // a copy of the GCC Runtime Library Exception along with this program;
   475  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   476  // <http://www.gnu.org/licenses/>.
   477  
   478  // ISO C Standard:  7.15  Variable arguments  <stdarg.h>
   479  
   480  // *
   481  // This file has no copyright assigned and is placed in the Public Domain.
   482  // This file is part of the mingw-w64 runtime package.
   483  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   484  
   485  // *
   486  // This file has no copyright assigned and is placed in the Public Domain.
   487  // This file is part of the mingw-w64 runtime package.
   488  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   489  
   490  // ISO C Standard:  7.17  Common definitions  <stddef.h>
   491  
   492  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
   493  //
   494  // This file is part of GCC.
   495  //
   496  // GCC is free software; you can redistribute it and/or modify
   497  // it under the terms of the GNU General Public License as published by
   498  // the Free Software Foundation; either version 3, or (at your option)
   499  // any later version.
   500  //
   501  // GCC is distributed in the hope that it will be useful,
   502  // but WITHOUT ANY WARRANTY; without even the implied warranty of
   503  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   504  // GNU General Public License for more details.
   505  //
   506  // Under Section 7 of GPL version 3, you are granted additional
   507  // permissions described in the GCC Runtime Library Exception, version
   508  // 3.1, as published by the Free Software Foundation.
   509  //
   510  // You should have received a copy of the GNU General Public License and
   511  // a copy of the GCC Runtime Library Exception along with this program;
   512  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   513  // <http://www.gnu.org/licenses/>.
   514  
   515  // ISO C Standard:  7.17  Common definitions  <stddef.h>
   516  
   517  // a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
   518  // "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
   519  // though the former does not conform to the LFS document), but considering
   520  // both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
   521  // equivalently requesting no 64-bit operations
   522  
   523  // MVS linker does not support external names larger than 8 bytes
   524  
   525  //
   526  //     The 'zlib' compression library provides in-memory compression and
   527  //   decompression functions, including integrity checks of the uncompressed data.
   528  //   This version of the library supports only one compression method (deflation)
   529  //   but other algorithms will be added later and will have the same stream
   530  //   interface.
   531  //
   532  //     Compression can be done in a single step if the buffers are large enough,
   533  //   or can be done by repeated calls of the compression function.  In the latter
   534  //   case, the application must provide more input and/or consume the output
   535  //   (providing more output space) before each call.
   536  //
   537  //     The compressed data format used by default by the in-memory functions is
   538  //   the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
   539  //   around a deflate stream, which is itself documented in RFC 1951.
   540  //
   541  //     The library also supports reading and writing files in gzip (.gz) format
   542  //   with an interface similar to that of stdio using the functions that start
   543  //   with "gz".  The gzip format is different from the zlib format.  gzip is a
   544  //   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
   545  //
   546  //     This library can optionally read and write gzip and raw deflate streams in
   547  //   memory as well.
   548  //
   549  //     The zlib format was designed to be compact and fast for use in memory
   550  //   and on communications channels.  The gzip format was designed for single-
   551  //   file compression on file systems, has a larger header than zlib to maintain
   552  //   directory information, and uses a different, slower check method than zlib.
   553  //
   554  //     The library does not install any signal handler.  The decoder checks
   555  //   the consistency of the compressed data, so the library should never crash
   556  //   even in the case of corrupted input.
   557  
   558  type alloc_func = uintptr /* zlib.h:81:16 */
   559  type free_func = uintptr  /* zlib.h:82:16 */
   560  
   561  type z_stream_s = struct {
   562  	next_in   uintptr
   563  	avail_in  uInt
   564  	total_in  uLong
   565  	next_out  uintptr
   566  	avail_out uInt
   567  	total_out uLong
   568  	msg       uintptr
   569  	state     uintptr
   570  	zalloc    alloc_func
   571  	zfree     free_func
   572  	opaque    voidpf
   573  	data_type int32
   574  	adler     uLong
   575  	reserved  uLong
   576  	_         [4]byte
   577  } /* zlib.h:86:9 */
   578  
   579  type z_stream = z_stream_s /* zlib.h:106:3 */
   580  
   581  type z_streamp = uintptr /* zlib.h:108:22 */
   582  
   583  //
   584  //      gzip header information passed to and from zlib routines.  See RFC 1952
   585  //   for more details on the meanings of these fields.
   586  type gz_header_s = struct {
   587  	text      int32
   588  	time      uLong
   589  	xflags    int32
   590  	os        int32
   591  	extra     uintptr
   592  	extra_len uInt
   593  	extra_max uInt
   594  	name      uintptr
   595  	name_max  uInt
   596  	_         [4]byte
   597  	comment   uintptr
   598  	comm_max  uInt
   599  	hcrc      int32
   600  	done      int32
   601  	_         [4]byte
   602  } /* zlib.h:114:9 */
   603  
   604  //
   605  //      gzip header information passed to and from zlib routines.  See RFC 1952
   606  //   for more details on the meanings of these fields.
   607  type gz_header = gz_header_s /* zlib.h:129:3 */
   608  
   609  type gz_headerp = uintptr /* zlib.h:131:23 */
   610  //
   611  //      inflateGetHeader() requests that gzip header information be stored in the
   612  //    provided gz_header structure.  inflateGetHeader() may be called after
   613  //    inflateInit2() or inflateReset(), and before the first call of inflate().
   614  //    As inflate() processes the gzip stream, head->done is zero until the header
   615  //    is completed, at which time head->done is set to one.  If a zlib stream is
   616  //    being decoded, then head->done is set to -1 to indicate that there will be
   617  //    no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
   618  //    used to force inflate() to return immediately after header processing is
   619  //    complete and before any actual data is decompressed.
   620  //
   621  //      The text, time, xflags, and os fields are filled in with the gzip header
   622  //    contents.  hcrc is set to true if there is a header CRC.  (The header CRC
   623  //    was valid if done is set to one.) If extra is not Z_NULL, then extra_max
   624  //    contains the maximum number of bytes to write to extra.  Once done is true,
   625  //    extra_len contains the actual extra field length, and extra contains the
   626  //    extra field, or that field truncated if extra_max is less than extra_len.
   627  //    If name is not Z_NULL, then up to name_max characters are written there,
   628  //    terminated with a zero unless the length is greater than name_max.  If
   629  //    comment is not Z_NULL, then up to comm_max characters are written there,
   630  //    terminated with a zero unless the length is greater than comm_max.  When any
   631  //    of extra, name, or comment are not Z_NULL and the respective field is not
   632  //    present in the header, then that field is set to Z_NULL to signal its
   633  //    absence.  This allows the use of deflateSetHeader() with the returned
   634  //    structure to duplicate the header.  However if those fields are set to
   635  //    allocated memory, then the application will need to save those pointers
   636  //    elsewhere so that they can be eventually freed.
   637  //
   638  //      If inflateGetHeader is not used, then the header information is simply
   639  //    discarded.  The header is always checked for validity, including the header
   640  //    CRC if present.  inflateReset() will reset the process to discard the header
   641  //    information.  The application would need to call inflateGetHeader() again to
   642  //    retrieve the header from the next gzip stream.
   643  //
   644  //      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
   645  //    stream state was inconsistent.
   646  
   647  //
   648  // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
   649  //                                         unsigned char FAR *window));
   650  //
   651  //      Initialize the internal stream state for decompression using inflateBack()
   652  //    calls.  The fields zalloc, zfree and opaque in strm must be initialized
   653  //    before the call.  If zalloc and zfree are Z_NULL, then the default library-
   654  //    derived memory allocation routines are used.  windowBits is the base two
   655  //    logarithm of the window size, in the range 8..15.  window is a caller
   656  //    supplied buffer of that size.  Except for special applications where it is
   657  //    assured that deflate was used with small window sizes, windowBits must be 15
   658  //    and a 32K byte window must be supplied to be able to decompress general
   659  //    deflate streams.
   660  //
   661  //      See inflateBack() for the usage of these routines.
   662  //
   663  //      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
   664  //    the parameters are invalid, Z_MEM_ERROR if the internal state could not be
   665  //    allocated, or Z_VERSION_ERROR if the version of the library does not match
   666  //    the version of the header file.
   667  
   668  type in_func = uintptr  /* zlib.h:1092:18 */
   669  type out_func = uintptr /* zlib.h:1094:13 */
   670  //
   671  //      Same as uncompress, except that sourceLen is a pointer, where the
   672  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
   673  //    source bytes consumed.
   674  
   675  // gzip file access functions
   676  
   677  //
   678  //      This library supports reading and writing files in gzip (.gz) format with
   679  //    an interface similar to that of stdio, using the functions that start with
   680  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
   681  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
   682  
   683  type gzFile_s = struct {
   684  	have uint32
   685  	_    [4]byte
   686  	next uintptr
   687  	pos  int32
   688  	_    [4]byte
   689  } /* zlib.h:1300:9 */
   690  
   691  //
   692  //      Same as uncompress, except that sourceLen is a pointer, where the
   693  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
   694  //    source bytes consumed.
   695  
   696  // gzip file access functions
   697  
   698  //
   699  //      This library supports reading and writing files in gzip (.gz) format with
   700  //    an interface similar to that of stdio, using the functions that start with
   701  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
   702  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
   703  
   704  type gzFile = uintptr /* zlib.h:1300:25 */
   705  
   706  // *
   707  // This file has no copyright assigned and is placed in the Public Domain.
   708  // This file is part of the mingw-w64 runtime package.
   709  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   710  
   711  // *
   712  // This file has no copyright assigned and is placed in the Public Domain.
   713  // This file is part of the mingw-w64 runtime package.
   714  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   715  
   716  // *
   717  // This file has no copyright assigned and is placed in the Public Domain.
   718  // This file is part of the mingw-w64 runtime package.
   719  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   720  
   721  // Undefine __mingw_<printf> macros.
   722  
   723  type _iobuf = struct {
   724  	_ptr      uintptr
   725  	_cnt      int32
   726  	_         [4]byte
   727  	_base     uintptr
   728  	_flag     int32
   729  	_file     int32
   730  	_charbuf  int32
   731  	_bufsiz   int32
   732  	_tmpfname uintptr
   733  } /* stdio.h:26:3 */
   734  
   735  type FILE = _iobuf /* stdio.h:36:25 */
   736  
   737  type fpos_t = int64 /* stdio.h:104:37 */
   738  
   739  func snprintf(tls *libc.TLS, __stream uintptr, __n size_t, __format uintptr, va uintptr) int32 { /* stdio.h:786:5: */
   740  	var __retval int32
   741  	var __local_argv uintptr
   742  	__local_argv = va
   743  	__retval = libc.X__ms_vsnprintf(tls, __stream, __n, __format, __local_argv)
   744  	_ = __local_argv
   745  	return __retval
   746  }
   747  
   748  func vsnwprintf(tls *libc.TLS, s uintptr, n size_t, format uintptr, arg va_list) int32 { /* stdio.h:1209:15: */
   749  	return libc.X_vsnwprintf(tls, s, n, format, arg)
   750  
   751  }
   752  
   753  // *
   754  // This file has no copyright assigned and is placed in the Public Domain.
   755  // This file is part of the mingw-w64 runtime package.
   756  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   757  
   758  // *
   759  // This file has no copyright assigned and is placed in the Public Domain.
   760  // This file is part of the mingw-w64 runtime package.
   761  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   762  
   763  func vswprintf(tls *libc.TLS, __stream uintptr, __count size_t, __format uintptr, __local_argv uintptr) int32 { /* swprintf.inl:27:5: */
   764  	return vsnwprintf(tls, __stream, __count, __format, __local_argv)
   765  }
   766  
   767  // *
   768  // This file has no copyright assigned and is placed in the Public Domain.
   769  // This file is part of the mingw-w64 runtime package.
   770  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   771  
   772  // *
   773  // This file has no copyright assigned and is placed in the Public Domain.
   774  // This file is part of the mingw-w64 runtime package.
   775  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   776  
   777  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
   778  //
   779  // This file is part of GCC.
   780  //
   781  // GCC is free software; you can redistribute it and/or modify it under
   782  // the terms of the GNU General Public License as published by the Free
   783  // Software Foundation; either version 3, or (at your option) any later
   784  // version.
   785  //
   786  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
   787  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
   788  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   789  // for more details.
   790  //
   791  // Under Section 7 of GPL version 3, you are granted additional
   792  // permissions described in the GCC Runtime Library Exception, version
   793  // 3.1, as published by the Free Software Foundation.
   794  //
   795  // You should have received a copy of the GNU General Public License and
   796  // a copy of the GCC Runtime Library Exception along with this program;
   797  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   798  // <http://www.gnu.org/licenses/>.
   799  
   800  // This administrivia gets added to the beginning of limits.h
   801  //    if the system has its own version of limits.h.
   802  
   803  // We use _GCC_LIMITS_H_ because we want this not to match
   804  //    any macros that the system's limits.h uses for its own purposes.
   805  
   806  type _onexit_t = uintptr /* stdlib.h:49:15 */
   807  
   808  type _div_t = struct {
   809  	quot int32
   810  	rem  int32
   811  } /* stdlib.h:59:11 */
   812  
   813  type div_t = _div_t /* stdlib.h:62:5 */
   814  
   815  type _ldiv_t = struct {
   816  	quot int32
   817  	rem  int32
   818  } /* stdlib.h:64:11 */
   819  
   820  type ldiv_t = _ldiv_t /* stdlib.h:67:5 */
   821  
   822  type _LDOUBLE = struct{ ld [10]uint8 } /* stdlib.h:76:5 */
   823  
   824  type _CRT_DOUBLE = struct{ x float64 } /* stdlib.h:83:5 */
   825  
   826  type _CRT_FLOAT = struct{ f float32 } /* stdlib.h:87:5 */
   827  
   828  type _LONGDOUBLE = struct{ x float64 } /* stdlib.h:94:5 */
   829  
   830  type _LDBL12 = struct{ ld12 [12]uint8 } /* stdlib.h:101:5 */
   831  
   832  type _purecall_handler = uintptr /* stdlib.h:142:16 */
   833  
   834  type _invalid_parameter_handler = uintptr /* stdlib.h:147:16 */
   835  
   836  type lldiv_t = struct {
   837  	quot int64
   838  	rem  int64
   839  } /* stdlib.h:699:61 */
   840  
   841  // *
   842  // This file has no copyright assigned and is placed in the Public Domain.
   843  // This file is part of the mingw-w64 runtime package.
   844  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   845  
   846  // *
   847  // This file has no copyright assigned and is placed in the Public Domain.
   848  // This file is part of the mingw-w64 runtime package.
   849  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   850  
   851  // Return codes for _heapwalk()
   852  
   853  // Values for _heapinfo.useflag
   854  
   855  // The structure used to walk through the heap with _heapwalk.
   856  type _heapinfo = struct {
   857  	_pentry  uintptr
   858  	_size    size_t
   859  	_useflag int32
   860  	_        [4]byte
   861  } /* malloc.h:46:11 */
   862  
   863  // *
   864  // This file has no copyright assigned and is placed in the Public Domain.
   865  // This file is part of the mingw-w64 runtime package.
   866  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   867  
   868  // *
   869  // This file has no copyright assigned and is placed in the Public Domain.
   870  // This file is part of the mingw-w64 runtime package.
   871  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   872  
   873  // Return codes for _heapwalk()
   874  
   875  // Values for _heapinfo.useflag
   876  
   877  // The structure used to walk through the heap with _heapwalk.
   878  type _HEAPINFO = _heapinfo /* malloc.h:50:5 */
   879  type _fsize_t = uint32     /* io.h:29:25 */
   880  
   881  type _finddata32_t = struct {
   882  	attrib      uint32
   883  	time_create int32
   884  	time_access int32
   885  	time_write  int32
   886  	size        _fsize_t
   887  	name        [260]int8
   888  } /* io.h:35:3 */
   889  
   890  type _finddata32i64_t = struct {
   891  	attrib      uint32
   892  	time_create int32
   893  	time_access int32
   894  	time_write  int32
   895  	size        int64
   896  	name        [260]int8
   897  	_           [4]byte
   898  } /* io.h:44:3 */
   899  
   900  type _finddata64i32_t = struct {
   901  	attrib      uint32
   902  	_           [4]byte
   903  	time_create int64
   904  	time_access int64
   905  	time_write  int64
   906  	size        _fsize_t
   907  	name        [260]int8
   908  } /* io.h:53:3 */
   909  
   910  type __finddata64_t = struct {
   911  	attrib      uint32
   912  	_           [4]byte
   913  	time_create int64
   914  	time_access int64
   915  	time_write  int64
   916  	size        int64
   917  	name        [260]int8
   918  	_           [4]byte
   919  } /* io.h:62:3 */
   920  
   921  type _wfinddata32_t = struct {
   922  	attrib      uint32
   923  	time_create int32
   924  	time_access int32
   925  	time_write  int32
   926  	size        _fsize_t
   927  	name        [260]wchar_t
   928  } /* io.h:94:3 */
   929  
   930  type _wfinddata32i64_t = struct {
   931  	attrib      uint32
   932  	time_create int32
   933  	time_access int32
   934  	time_write  int32
   935  	size        int64
   936  	name        [260]wchar_t
   937  } /* io.h:103:3 */
   938  
   939  type _wfinddata64i32_t = struct {
   940  	attrib      uint32
   941  	_           [4]byte
   942  	time_create int64
   943  	time_access int64
   944  	time_write  int64
   945  	size        _fsize_t
   946  	name        [260]wchar_t
   947  	_           [4]byte
   948  } /* io.h:112:3 */
   949  
   950  type _wfinddata64_t = struct {
   951  	attrib      uint32
   952  	_           [4]byte
   953  	time_create int64
   954  	time_access int64
   955  	time_write  int64
   956  	size        int64
   957  	name        [260]wchar_t
   958  } /* io.h:121:3 */
   959  
   960  // *
   961  // This file has no copyright assigned and is placed in the Public Domain.
   962  // This file is part of the mingw-w64 runtime package.
   963  // No warranty is given; refer to the file DISCLAIMER.PD within this package.
   964  
   965  var prog uintptr /* minigzip.c:336:13: */
   966  
   967  // ===========================================================================
   968  // Display error message and exit
   969  func error(tls *libc.TLS, msg uintptr) { /* minigzip.c:351:6: */
   970  	bp := tls.Alloc(16)
   971  	defer tls.Free(16)
   972  
   973  	libc.Xfprintf(tls, libc.X__acrt_iob_func(tls, uint32(2)), ts /* "%s: %s\n" */, libc.VaList(bp, prog, msg))
   974  	libc.Xexit(tls, 1)
   975  }
   976  
   977  // ===========================================================================
   978  // Compress input to output then close both files.
   979  
   980  func gz_compress(tls *libc.TLS, in uintptr, out gzFile) { /* minigzip.c:362:6: */
   981  	bp := tls.Alloc(16388)
   982  	defer tls.Free(16388)
   983  
   984  	// var buf [16384]int8 at bp, 16384
   985  
   986  	var len int32
   987  	// var err int32 at bp+16384, 4
   988  
   989  	for {
   990  		len = int32(libc.Xfread(tls, bp /* &buf[0] */, uint64(1), uint64(unsafe.Sizeof([16384]int8{})), in))
   991  		if libc.Xferror(tls, in) != 0 {
   992  			libc.Xperror(tls, ts+8 /* "fread" */)
   993  			libc.Xexit(tls, 1)
   994  		}
   995  		if len == 0 {
   996  			break
   997  		}
   998  
   999  		if z.Xgzwrite(tls, out, bp /* &buf[0] */, uint32(len)) != len {
  1000  			error(tls, z.Xgzerror(tls, out, bp+16384 /* &err */))
  1001  		}
  1002  	}
  1003  	libc.Xfclose(tls, in)
  1004  	if z.Xgzclose(tls, out) != 0 {
  1005  		error(tls, ts+14 /* "failed gzclose" */)
  1006  	}
  1007  }
  1008  
  1009  // ===========================================================================
  1010  // Uncompress input to output then close both files.
  1011  func gz_uncompress(tls *libc.TLS, in gzFile, out uintptr) { /* minigzip.c:430:6: */
  1012  	bp := tls.Alloc(16388)
  1013  	defer tls.Free(16388)
  1014  
  1015  	// var buf [16384]int8 at bp, 16384
  1016  
  1017  	var len int32
  1018  	// var err int32 at bp+16384, 4
  1019  
  1020  	for {
  1021  		len = z.Xgzread(tls, in, bp /* &buf[0] */, uint32(unsafe.Sizeof([16384]int8{})))
  1022  		if len < 0 {
  1023  			error(tls, z.Xgzerror(tls, in, bp+16384 /* &err */))
  1024  		}
  1025  		if len == 0 {
  1026  			break
  1027  		}
  1028  
  1029  		if int32(libc.Xfwrite(tls, bp /* &buf[0] */, uint64(1), uint64(uint32(len)), out)) != len {
  1030  			error(tls, ts+29 /* "failed fwrite" */)
  1031  		}
  1032  	}
  1033  	if libc.Xfclose(tls, out) != 0 {
  1034  		error(tls, ts+43 /* "failed fclose" */)
  1035  	}
  1036  
  1037  	if z.Xgzclose(tls, in) != 0 {
  1038  		error(tls, ts+14 /* "failed gzclose" */)
  1039  	}
  1040  }
  1041  
  1042  // ===========================================================================
  1043  // Compress the given file: create a corresponding .gz file and remove the
  1044  // original.
  1045  func file_compress(tls *libc.TLS, file uintptr, mode uintptr) { /* minigzip.c:457:6: */
  1046  	bp := tls.Alloc(1064)
  1047  	defer tls.Free(1064)
  1048  
  1049  	// var outfile [1024]int8 at bp+40, 1024
  1050  
  1051  	var in uintptr
  1052  	var out gzFile
  1053  
  1054  	if (libc.Xstrlen(tls, file) + libc.Xstrlen(tls, ts+57 /* ".gz" */)) >= size_t(unsafe.Sizeof([1024]int8{})) {
  1055  		libc.Xfprintf(tls, libc.X__acrt_iob_func(tls, uint32(2)), ts+61 /* "%s: filename too..." */, libc.VaList(bp, prog))
  1056  		libc.Xexit(tls, 1)
  1057  	}
  1058  
  1059  	snprintf(tls, bp+40 /* &outfile[0] */, uint64(unsafe.Sizeof([1024]int8{})), ts+84 /* "%s%s" */, libc.VaList(bp+8, file, ts+57 /* ".gz" */))
  1060  
  1061  	in = libc.Xfopen(tls, file, ts+89 /* "rb" */)
  1062  	if in == (uintptr(0)) {
  1063  		libc.Xperror(tls, file)
  1064  		libc.Xexit(tls, 1)
  1065  	}
  1066  	out = z.Xgzopen(tls, bp+40 /* &outfile[0] */, mode)
  1067  	if out == (uintptr(0)) {
  1068  		libc.Xfprintf(tls, libc.X__acrt_iob_func(tls, uint32(2)), ts+92 /* "%s: can't gzopen..." */, libc.VaList(bp+24, prog, bp+40 /* &outfile[0] */))
  1069  		libc.Xexit(tls, 1)
  1070  	}
  1071  	gz_compress(tls, in, out)
  1072  
  1073  	libc.Xunlink(tls, file)
  1074  }
  1075  
  1076  // ===========================================================================
  1077  // Uncompress the given file and remove the original.
  1078  func file_uncompress(tls *libc.TLS, file uintptr) { /* minigzip.c:496:6: */
  1079  	bp := tls.Alloc(1064)
  1080  	defer tls.Free(1064)
  1081  
  1082  	// var buf [1024]int8 at bp+40, 1024
  1083  
  1084  	var infile uintptr
  1085  	var outfile uintptr
  1086  	var out uintptr
  1087  	var in gzFile
  1088  	var len uint32 = uint32(libc.Xstrlen(tls, file))
  1089  
  1090  	if (size_t(len) + libc.Xstrlen(tls, ts+57 /* ".gz" */)) >= size_t(unsafe.Sizeof([1024]int8{})) {
  1091  		libc.Xfprintf(tls, libc.X__acrt_iob_func(tls, uint32(2)), ts+61 /* "%s: filename too..." */, libc.VaList(bp, prog))
  1092  		libc.Xexit(tls, 1)
  1093  	}
  1094  
  1095  	snprintf(tls, bp+40 /* &buf[0] */, uint64(unsafe.Sizeof([1024]int8{})), ts+113 /* "%s" */, libc.VaList(bp+8, file))
  1096  
  1097  	if (uint64(len) > (uint64(unsafe.Sizeof([4]int8{})) - uint64(1))) && (libc.Xstrcmp(tls, ((file+uintptr(len))-uintptr((uint64(unsafe.Sizeof([4]int8{}))-uint64(1)))), ts+57 /* ".gz" */) == 0) {
  1098  		infile = file
  1099  		outfile = bp + 40 /* &buf[0] */
  1100  		*(*int8)(unsafe.Pointer(outfile + uintptr((len - uint32(3))))) = int8(0)
  1101  	} else {
  1102  		outfile = file
  1103  		infile = bp + 40 /* &buf[0] */
  1104  		snprintf(tls, (bp + 40 /* &buf[0] */ + uintptr(len)), (uint64(unsafe.Sizeof([1024]int8{})) - uint64(len)), ts+113 /* "%s" */, libc.VaList(bp+16, ts+57 /* ".gz" */))
  1105  	}
  1106  	in = z.Xgzopen(tls, infile, ts+89 /* "rb" */)
  1107  	if in == (uintptr(0)) {
  1108  		libc.Xfprintf(tls, libc.X__acrt_iob_func(tls, uint32(2)), ts+92 /* "%s: can't gzopen..." */, libc.VaList(bp+24, prog, infile))
  1109  		libc.Xexit(tls, 1)
  1110  	}
  1111  	out = libc.Xfopen(tls, outfile, ts+116 /* "wb" */)
  1112  	if out == (uintptr(0)) {
  1113  		libc.Xperror(tls, file)
  1114  		libc.Xexit(tls, 1)
  1115  	}
  1116  
  1117  	gz_uncompress(tls, in, out)
  1118  
  1119  	libc.Xunlink(tls, infile)
  1120  }
  1121  
  1122  // ===========================================================================
  1123  // Usage:  minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...]
  1124  //   -c : write to standard output
  1125  //   -d : decompress
  1126  //   -f : compress with Z_FILTERED
  1127  //   -h : compress with Z_HUFFMAN_ONLY
  1128  //   -r : compress with Z_RLE
  1129  //   -1 to -9 : compression level
  1130  
  1131  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* minigzip.c:556:5: */
  1132  	bp := tls.Alloc(44)
  1133  	defer tls.Free(44)
  1134  
  1135  	var copyout int32 = 0
  1136  	var uncompr int32 = 0
  1137  	var file gzFile
  1138  	var bname uintptr
  1139  	// var outmode [20]int8 at bp+24, 20
  1140  
  1141  	snprintf(tls, bp+24 /* &outmode[0] */, uint64(unsafe.Sizeof([20]int8{})), ts+113 /* "%s" */, libc.VaList(bp, ts+119 /* "wb6 " */))
  1142  
  1143  	prog = *(*uintptr)(unsafe.Pointer(argv))
  1144  	bname = libc.Xstrrchr(tls, *(*uintptr)(unsafe.Pointer(argv)), '/')
  1145  	if bname != 0 {
  1146  		bname++
  1147  	} else {
  1148  		bname = *(*uintptr)(unsafe.Pointer(argv))
  1149  	}
  1150  	argc--
  1151  	argv += 8
  1152  
  1153  	if !(libc.Xstrcmp(tls, bname, ts+124 /* "gunzip" */) != 0) {
  1154  		uncompr = 1
  1155  	} else if !(libc.Xstrcmp(tls, bname, ts+131 /* "zcat" */) != 0) {
  1156  		copyout = libc.AssignInt32(&uncompr, 1)
  1157  	}
  1158  
  1159  	for argc > 0 {
  1160  		if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+136 /* "-c" */) == 0 {
  1161  			copyout = 1
  1162  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+139 /* "-d" */) == 0 {
  1163  			uncompr = 1
  1164  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+142 /* "-f" */) == 0 {
  1165  			*(*int8)(unsafe.Pointer(bp + 24 /* &outmode[0] */ + 3)) = int8('f')
  1166  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+145 /* "-h" */) == 0 {
  1167  			*(*int8)(unsafe.Pointer(bp + 24 /* &outmode[0] */ + 3)) = int8('h')
  1168  		} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+148 /* "-r" */) == 0 {
  1169  			*(*int8)(unsafe.Pointer(bp + 24 /* &outmode[0] */ + 3)) = int8('R')
  1170  		} else if (((int32(*(*int8)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(argv)))))) == '-') && (int32(*(*int8)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(argv))) + 1))) >= '1')) && (int32(*(*int8)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(argv))) + 1))) <= '9')) && (int32(*(*int8)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(argv))) + 2))) == 0) {
  1171  			*(*int8)(unsafe.Pointer(bp + 24 /* &outmode[0] */ + 2)) = *(*int8)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(argv))) + 1))
  1172  		} else {
  1173  			break
  1174  		}
  1175  		argc--
  1176  		argv += 8
  1177  	}
  1178  	if int32(*(*int8)(unsafe.Pointer(bp + 24 /* &outmode[0] */ + 3))) == ' ' {
  1179  		*(*int8)(unsafe.Pointer(bp + 24 /* &outmode[0] */ + 3)) = int8(0)
  1180  	}
  1181  	if argc == 0 {
  1182  		libc.Xsetmode(tls, libc.Xfileno(tls, libc.X__acrt_iob_func(tls, uint32(0))), 0x8000)
  1183  		libc.Xsetmode(tls, libc.Xfileno(tls, libc.X__acrt_iob_func(tls, uint32(1))), 0x8000)
  1184  		if uncompr != 0 {
  1185  			file = z.Xgzdopen(tls, libc.Xfileno(tls, libc.X__acrt_iob_func(tls, uint32(0))), ts+89 /* "rb" */)
  1186  			if file == (uintptr(0)) {
  1187  				error(tls, ts+151 /* "can't gzdopen st..." */)
  1188  			}
  1189  			gz_uncompress(tls, file, libc.X__acrt_iob_func(tls, uint32(1)))
  1190  		} else {
  1191  			file = z.Xgzdopen(tls, libc.Xfileno(tls, libc.X__acrt_iob_func(tls, uint32(1))), bp+24 /* &outmode[0] */)
  1192  			if file == (uintptr(0)) {
  1193  				error(tls, ts+171 /* "can't gzdopen st..." */)
  1194  			}
  1195  			gz_compress(tls, libc.X__acrt_iob_func(tls, uint32(0)), file)
  1196  		}
  1197  	} else {
  1198  		if copyout != 0 {
  1199  			libc.Xsetmode(tls, libc.Xfileno(tls, libc.X__acrt_iob_func(tls, uint32(1))), 0x8000)
  1200  		}
  1201  		for ok := true; ok; ok = func() bool { argv += 8; return libc.PreDecInt32(&argc, 1) != 0 }() {
  1202  			if uncompr != 0 {
  1203  				if copyout != 0 {
  1204  					file = z.Xgzopen(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+89 /* "rb" */)
  1205  					if file == (uintptr(0)) {
  1206  						libc.Xfprintf(tls, libc.X__acrt_iob_func(tls, uint32(2)), ts+92 /* "%s: can't gzopen..." */, libc.VaList(bp+8, prog, *(*uintptr)(unsafe.Pointer(argv))))
  1207  					} else {
  1208  						gz_uncompress(tls, file, libc.X__acrt_iob_func(tls, uint32(1)))
  1209  					}
  1210  				} else {
  1211  					file_uncompress(tls, *(*uintptr)(unsafe.Pointer(argv)))
  1212  				}
  1213  			} else {
  1214  				if copyout != 0 {
  1215  					var in uintptr = libc.Xfopen(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+89 /* "rb" */)
  1216  
  1217  					if in == (uintptr(0)) {
  1218  						libc.Xperror(tls, *(*uintptr)(unsafe.Pointer(argv)))
  1219  					} else {
  1220  						file = z.Xgzdopen(tls, libc.Xfileno(tls, libc.X__acrt_iob_func(tls, uint32(1))), bp+24 /* &outmode[0] */)
  1221  						if file == (uintptr(0)) {
  1222  							error(tls, ts+171 /* "can't gzdopen st..." */)
  1223  						}
  1224  
  1225  						gz_compress(tls, in, file)
  1226  					}
  1227  
  1228  				} else {
  1229  					file_compress(tls, *(*uintptr)(unsafe.Pointer(argv)), bp+24 /* &outmode[0] */)
  1230  				}
  1231  			}
  1232  		}
  1233  	}
  1234  	return 0
  1235  }
  1236  
  1237  var ts1 = "%s: %s\n\x00fread\x00failed gzclose\x00failed fwrite\x00failed fclose\x00.gz\x00%s: filename too long\n\x00%s%s\x00rb\x00%s: can't gzopen %s\n\x00%s\x00wb\x00wb6 \x00gunzip\x00zcat\x00-c\x00-d\x00-f\x00-h\x00-r\x00can't gzdopen stdin\x00can't gzdopen stdout\x00"
  1238  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data