modernc.org/z@v1.7.4/internal/example_netbsd_amd64.go (about) 1 // Code generated by 'ccgo -lmodernc.org/z/lib -o internal/example_netbsd_amd64.go -trace-translation-units /tmp/go-generate-2662545308/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 _ 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 = int32 /* <builtin>:15:24 */ 29 30 // $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ 31 32 // Written by Klaus Klein <kleink@NetBSD.org>, December 22, 1999. 33 // Public domain. 34 35 type max_align_t = struct{ _v uintptr } /* stddef.h:75:3 */ 36 37 type z_size_t = size_t /* zconf.h:248:21 */ 38 39 // Maximum value for memLevel in deflateInit2 40 41 // Maximum value for windowBits in deflateInit2 and inflateInit2. 42 // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 43 // created by gzip. (Files created by minigzip can still be extracted by 44 // gzip.) 45 46 // The memory requirements for deflate are (in bytes): 47 // (1 << (windowBits+2)) + (1 << (memLevel+9)) 48 // that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 49 // plus a few kilobytes for small objects. For example, if you want to reduce 50 // the default memory requirements from 256K to 128K, compile with 51 // make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 52 // Of course this will generally degrade compression (there's no free lunch). 53 // 54 // The memory requirements for inflate are (in bytes) 1 << windowBits 55 // that is, 32K for windowBits=15 (default value) plus about 7 kilobytes 56 // for small objects. 57 58 // Type declarations 59 60 // The following definitions for FAR are needed only for MSDOS mixed 61 // model programming (small or medium model with some far allocations). 62 // This was tested only with MSC; for other MSDOS compilers you may have 63 // to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 64 // just define FAR to be empty. 65 66 type Byte = uint8 /* zconf.h:391:24 */ // 8 bits 67 type uInt = uint32 /* zconf.h:393:24 */ // 16 bits or more 68 type uLong = uint64 /* zconf.h:394:24 */ // 32 bits or more 69 70 type Bytef = Byte /* zconf.h:400:22 */ 71 type charf = int8 /* zconf.h:402:19 */ 72 type intf = int32 /* zconf.h:403:19 */ 73 type uIntf = uInt /* zconf.h:404:19 */ 74 type uLongf = uLong /* zconf.h:405:19 */ 75 76 type voidpc = uintptr /* zconf.h:408:23 */ 77 type voidpf = uintptr /* zconf.h:409:23 */ 78 type voidp = uintptr /* zconf.h:410:23 */ 79 80 // $NetBSD: limits.h,v 1.40 2016/08/04 06:43:43 christos Exp $ 81 82 // Copyright (c) 1988, 1993 83 // The Regents of the University of California. All rights reserved. 84 // 85 // Redistribution and use in source and binary forms, with or without 86 // modification, are permitted provided that the following conditions 87 // are met: 88 // 1. Redistributions of source code must retain the above copyright 89 // notice, this list of conditions and the following disclaimer. 90 // 2. Redistributions in binary form must reproduce the above copyright 91 // notice, this list of conditions and the following disclaimer in the 92 // documentation and/or other materials provided with the distribution. 93 // 3. Neither the name of the University nor the names of its contributors 94 // may be used to endorse or promote products derived from this software 95 // without specific prior written permission. 96 // 97 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 98 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 99 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 100 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 101 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 102 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 103 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 104 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 105 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 106 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 107 // SUCH DAMAGE. 108 // 109 // @(#)limits.h 8.2 (Berkeley) 1/4/94 110 111 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 112 113 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 114 // Public domain. 115 // 116 // NOTE: Do not protect this header against multiple inclusion. Doing 117 // so can have subtle side-effects due to header file inclusion order 118 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 119 // protect each CPP macro that we want to supply. 120 121 // Feature-test macros are defined by several standards, and allow an 122 // application to specify what symbols they want the system headers to 123 // expose, and hence what standard they want them to conform to. 124 // There are two classes of feature-test macros. The first class 125 // specify complete standards, and if one of these is defined, header 126 // files will try to conform to the relevant standard. They are: 127 // 128 // ANSI macros: 129 // _ANSI_SOURCE ANSI C89 130 // 131 // POSIX macros: 132 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 133 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 134 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 135 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 136 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 137 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 138 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 139 // 140 // X/Open macros: 141 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 142 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 143 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 144 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 145 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 146 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 147 // 148 // NetBSD macros: 149 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 150 // 151 // If more than one of these "major" feature-test macros is defined, 152 // then the set of facilities provided (and namespace used) is the 153 // union of that specified by the relevant standards, and in case of 154 // conflict, the earlier standard in the above list has precedence (so 155 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 156 // of rename() that's used is the POSIX one). If none of the "major" 157 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 158 // 159 // There are also "minor" feature-test macros, which enable extra 160 // functionality in addition to some base standard. They should be 161 // defined along with one of the "major" macros. The "minor" macros 162 // are: 163 // 164 // _REENTRANT 165 // _ISOC99_SOURCE 166 // _ISOC11_SOURCE 167 // _LARGEFILE_SOURCE Large File Support 168 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 169 170 // We have not implemented these yet 171 // 172 // _POSIX_THREAD_ATTR_STACKADDR 173 // _POSIX_THREAD_ATTR_STACKSIZE 174 // _POSIX_THREAD_CPUTIME 175 // _POSIX_THREAD_PRIORITY_SCHEDULING 176 // _POSIX_THREAD_PRIO_INHERIT 177 // _POSIX_THREAD_PRIO_PROTECT 178 // _POSIX_THREAD_PROCESS_SHARED 179 // _POSIX_THREAD_SAFE_FUNCTIONS 180 // _POSIX_THREAD_SPORADIC_SERVER 181 182 // The following 3 are defined in 183 // Open Group Base Specifications Issue 7 184 185 // These are the correct names, defined in terms of the above 186 // except for PTHREAD_KEYS_MAX which is bigger than standard 187 // mandated minimum value _POSIX_THREAD_KEYS_MAX. 188 // Not yet: PTHREAD_STACK_MIN 189 190 // X/Open CAE Specifications, 191 // adopted in IEEE Std 1003.1-2001 XSI. 192 193 // IEEE Std 1003.1-2001 TSF 194 195 // Always ensure that this is consistent with <stdio.h> 196 197 // X/Open Extended API set 2 (a.k.a. C063) 198 // This hides unimplemented functions from GNU configure until 199 // we are done implementing them. 200 201 // $NetBSD: limits.h,v 1.15 2019/01/21 20:22:48 dholland Exp $ 202 203 // Copyright (c) 1988 The Regents of the University of California. 204 // All rights reserved. 205 // 206 // Redistribution and use in source and binary forms, with or without 207 // modification, are permitted provided that the following conditions 208 // are met: 209 // 1. Redistributions of source code must retain the above copyright 210 // notice, this list of conditions and the following disclaimer. 211 // 2. Redistributions in binary form must reproduce the above copyright 212 // notice, this list of conditions and the following disclaimer in the 213 // documentation and/or other materials provided with the distribution. 214 // 3. Neither the name of the University nor the names of its contributors 215 // may be used to endorse or promote products derived from this software 216 // without specific prior written permission. 217 // 218 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 219 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 220 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 221 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 222 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 223 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 224 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 225 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 226 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 227 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 228 // SUCH DAMAGE. 229 // 230 // @(#)limits.h 7.2 (Berkeley) 6/28/90 231 232 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 233 234 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 235 // Public domain. 236 // 237 // NOTE: Do not protect this header against multiple inclusion. Doing 238 // so can have subtle side-effects due to header file inclusion order 239 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 240 // protect each CPP macro that we want to supply. 241 242 // Feature-test macros are defined by several standards, and allow an 243 // application to specify what symbols they want the system headers to 244 // expose, and hence what standard they want them to conform to. 245 // There are two classes of feature-test macros. The first class 246 // specify complete standards, and if one of these is defined, header 247 // files will try to conform to the relevant standard. They are: 248 // 249 // ANSI macros: 250 // _ANSI_SOURCE ANSI C89 251 // 252 // POSIX macros: 253 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 254 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 255 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 256 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 257 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 258 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 259 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 260 // 261 // X/Open macros: 262 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 263 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 264 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 265 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 266 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 267 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 268 // 269 // NetBSD macros: 270 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 271 // 272 // If more than one of these "major" feature-test macros is defined, 273 // then the set of facilities provided (and namespace used) is the 274 // union of that specified by the relevant standards, and in case of 275 // conflict, the earlier standard in the above list has precedence (so 276 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 277 // of rename() that's used is the POSIX one). If none of the "major" 278 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 279 // 280 // There are also "minor" feature-test macros, which enable extra 281 // functionality in addition to some base standard. They should be 282 // defined along with one of the "major" macros. The "minor" macros 283 // are: 284 // 285 // _REENTRANT 286 // _ISOC99_SOURCE 287 // _ISOC11_SOURCE 288 // _LARGEFILE_SOURCE Large File Support 289 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 290 291 // $NetBSD: syslimits.h,v 1.28 2015/08/21 07:19:39 uebayasi Exp $ 292 293 // Copyright (c) 1988, 1993 294 // The Regents of the University of California. All rights reserved. 295 // 296 // Redistribution and use in source and binary forms, with or without 297 // modification, are permitted provided that the following conditions 298 // are met: 299 // 1. Redistributions of source code must retain the above copyright 300 // notice, this list of conditions and the following disclaimer. 301 // 2. Redistributions in binary form must reproduce the above copyright 302 // notice, this list of conditions and the following disclaimer in the 303 // documentation and/or other materials provided with the distribution. 304 // 3. Neither the name of the University nor the names of its contributors 305 // may be used to endorse or promote products derived from this software 306 // without specific prior written permission. 307 // 308 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 309 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 310 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 311 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 312 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 313 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 314 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 315 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 316 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 317 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 318 // SUCH DAMAGE. 319 // 320 // @(#)syslimits.h 8.1 (Berkeley) 6/2/93 321 322 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 323 324 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 325 // Public domain. 326 // 327 // NOTE: Do not protect this header against multiple inclusion. Doing 328 // so can have subtle side-effects due to header file inclusion order 329 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 330 // protect each CPP macro that we want to supply. 331 332 // Feature-test macros are defined by several standards, and allow an 333 // application to specify what symbols they want the system headers to 334 // expose, and hence what standard they want them to conform to. 335 // There are two classes of feature-test macros. The first class 336 // specify complete standards, and if one of these is defined, header 337 // files will try to conform to the relevant standard. They are: 338 // 339 // ANSI macros: 340 // _ANSI_SOURCE ANSI C89 341 // 342 // POSIX macros: 343 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 344 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 345 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 346 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 347 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 348 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 349 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 350 // 351 // X/Open macros: 352 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 353 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 354 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 355 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 356 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 357 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 358 // 359 // NetBSD macros: 360 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 361 // 362 // If more than one of these "major" feature-test macros is defined, 363 // then the set of facilities provided (and namespace used) is the 364 // union of that specified by the relevant standards, and in case of 365 // conflict, the earlier standard in the above list has precedence (so 366 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 367 // of rename() that's used is the POSIX one). If none of the "major" 368 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 369 // 370 // There are also "minor" feature-test macros, which enable extra 371 // functionality in addition to some base standard. They should be 372 // defined along with one of the "major" macros. The "minor" macros 373 // are: 374 // 375 // _REENTRANT 376 // _ISOC99_SOURCE 377 // _ISOC11_SOURCE 378 // _LARGEFILE_SOURCE Large File Support 379 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 380 381 // kept in sync with MAXNAMLEN 382 383 // IEEE Std 1003.1c-95, adopted in X/Open CAE Specification Issue 5 Version 2 384 385 // X/Open CAE Specification Issue 5 Version 2 386 387 type z_crc_t = uint32 /* zconf.h:429:17 */ 388 389 type int8_t = int8 /* types.h:54:18 */ 390 391 type uint8_t = uint8 /* types.h:59:19 */ 392 393 type int16_t = int16 /* types.h:64:19 */ 394 395 type uint16_t = uint16 /* types.h:69:20 */ 396 397 type int32_t = int32 /* types.h:74:19 */ 398 399 type uint32_t = uint32 /* types.h:79:20 */ 400 401 type int64_t = int64 /* types.h:84:19 */ 402 403 type uint64_t = uint64 /* types.h:89:20 */ 404 405 type u_int8_t = uint8_t /* types.h:93:18 */ 406 type u_int16_t = uint16_t /* types.h:94:18 */ 407 type u_int32_t = uint32_t /* types.h:95:18 */ 408 type u_int64_t = uint64_t /* types.h:96:18 */ 409 410 // $NetBSD: endian.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ 411 412 // $NetBSD: endian.h,v 1.30 2016/02/27 21:37:35 christos Exp $ 413 414 // Copyright (c) 1987, 1991, 1993 415 // The Regents of the University of California. All rights reserved. 416 // 417 // Redistribution and use in source and binary forms, with or without 418 // modification, are permitted provided that the following conditions 419 // are met: 420 // 1. Redistributions of source code must retain the above copyright 421 // notice, this list of conditions and the following disclaimer. 422 // 2. Redistributions in binary form must reproduce the above copyright 423 // notice, this list of conditions and the following disclaimer in the 424 // documentation and/or other materials provided with the distribution. 425 // 3. Neither the name of the University nor the names of its contributors 426 // may be used to endorse or promote products derived from this software 427 // without specific prior written permission. 428 // 429 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 430 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 431 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 432 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 433 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 434 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 435 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 436 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 437 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 438 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 439 // SUCH DAMAGE. 440 // 441 // @(#)endian.h 8.1 (Berkeley) 6/11/93 442 443 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 444 445 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 446 // Public domain. 447 // 448 // NOTE: Do not protect this header against multiple inclusion. Doing 449 // so can have subtle side-effects due to header file inclusion order 450 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 451 // protect each CPP macro that we want to supply. 452 453 // Feature-test macros are defined by several standards, and allow an 454 // application to specify what symbols they want the system headers to 455 // expose, and hence what standard they want them to conform to. 456 // There are two classes of feature-test macros. The first class 457 // specify complete standards, and if one of these is defined, header 458 // files will try to conform to the relevant standard. They are: 459 // 460 // ANSI macros: 461 // _ANSI_SOURCE ANSI C89 462 // 463 // POSIX macros: 464 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 465 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 466 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 467 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 468 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 469 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 470 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 471 // 472 // X/Open macros: 473 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 474 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 475 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 476 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 477 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 478 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 479 // 480 // NetBSD macros: 481 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 482 // 483 // If more than one of these "major" feature-test macros is defined, 484 // then the set of facilities provided (and namespace used) is the 485 // union of that specified by the relevant standards, and in case of 486 // conflict, the earlier standard in the above list has precedence (so 487 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 488 // of rename() that's used is the POSIX one). If none of the "major" 489 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 490 // 491 // There are also "minor" feature-test macros, which enable extra 492 // functionality in addition to some base standard. They should be 493 // defined along with one of the "major" macros. The "minor" macros 494 // are: 495 // 496 // _REENTRANT 497 // _ISOC99_SOURCE 498 // _ISOC11_SOURCE 499 // _LARGEFILE_SOURCE Large File Support 500 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 501 502 // Definitions for byte order, according to byte significance from low 503 // address to high. 504 505 // C-family endian-ness definitions 506 507 // $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ 508 509 // - 510 // Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. 511 // All rights reserved. 512 // 513 // This code is derived from software contributed to The NetBSD Foundation 514 // by Jun-ichiro itojun Hagino and by Klaus Klein. 515 // 516 // Redistribution and use in source and binary forms, with or without 517 // modification, are permitted provided that the following conditions 518 // are met: 519 // 1. Redistributions of source code must retain the above copyright 520 // notice, this list of conditions and the following disclaimer. 521 // 2. Redistributions in binary form must reproduce the above copyright 522 // notice, this list of conditions and the following disclaimer in the 523 // documentation and/or other materials provided with the distribution. 524 // 525 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 526 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 527 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 528 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 529 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 530 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 531 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 532 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 533 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 534 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 535 // POSSIBILITY OF SUCH DAMAGE. 536 537 // $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ 538 539 // * Copyright (c) 1991, 1993 540 // The Regents of the University of California. All rights reserved. 541 // 542 // This code is derived from software contributed to Berkeley by 543 // Berkeley Software Design, Inc. 544 // 545 // Redistribution and use in source and binary forms, with or without 546 // modification, are permitted provided that the following conditions 547 // are met: 548 // 1. Redistributions of source code must retain the above copyright 549 // notice, this list of conditions and the following disclaimer. 550 // 2. Redistributions in binary form must reproduce the above copyright 551 // notice, this list of conditions and the following disclaimer in the 552 // documentation and/or other materials provided with the distribution. 553 // 3. Neither the name of the University nor the names of its contributors 554 // may be used to endorse or promote products derived from this software 555 // without specific prior written permission. 556 // 557 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 558 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 559 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 560 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 561 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 562 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 563 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 564 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 565 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 566 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 567 // SUCH DAMAGE. 568 // 569 // @(#)cdefs.h 8.8 (Berkeley) 1/9/95 570 571 // $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ 572 573 // - 574 // Copyright (c) 1982, 1986, 1991, 1993, 1994 575 // The Regents of the University of California. All rights reserved. 576 // (c) UNIX System Laboratories, Inc. 577 // All or some portions of this file are derived from material licensed 578 // to the University of California by American Telephone and Telegraph 579 // Co. or Unix System Laboratories, Inc. and are reproduced herein with 580 // the permission of UNIX System Laboratories, Inc. 581 // 582 // Redistribution and use in source and binary forms, with or without 583 // modification, are permitted provided that the following conditions 584 // are met: 585 // 1. Redistributions of source code must retain the above copyright 586 // notice, this list of conditions and the following disclaimer. 587 // 2. Redistributions in binary form must reproduce the above copyright 588 // notice, this list of conditions and the following disclaimer in the 589 // documentation and/or other materials provided with the distribution. 590 // 3. Neither the name of the University nor the names of its contributors 591 // may be used to endorse or promote products derived from this software 592 // without specific prior written permission. 593 // 594 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 595 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 596 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 597 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 598 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 599 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 600 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 601 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 602 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 603 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 604 // SUCH DAMAGE. 605 // 606 // @(#)types.h 8.4 (Berkeley) 1/21/94 607 608 type in_addr_t = uint32 /* endian.h:58:21 */ 609 610 type in_port_t = uint16 /* endian.h:63:21 */ 611 612 func __byte_swap_u64_variable(tls *libc.TLS, x uint64_t) uint64_t { /* byte_swap.h:48:1: */ 613 panic(`/usr/include/machine/byte_swap.h:50:2: assembler statements not supported`) 614 return x 615 } 616 617 func __byte_swap_u32_variable(tls *libc.TLS, x uint32_t) uint32_t { /* byte_swap.h:57:1: */ 618 panic(`/usr/include/machine/byte_swap.h:59:2: assembler statements not supported`) 619 return x 620 } 621 622 func __byte_swap_u16_variable(tls *libc.TLS, x uint16_t) uint16_t { /* byte_swap.h:66:1: */ 623 panic(`/usr/include/machine/byte_swap.h:68:2: assembler statements not supported`) 624 return x 625 } 626 627 // $NetBSD: bswap.h,v 1.19 2015/03/12 15:28:16 christos Exp $ 628 629 // Written by Manuel Bouyer. Public domain 630 631 // $NetBSD: stdint.h,v 1.8 2018/11/06 16:26:44 maya Exp $ 632 633 // - 634 // Copyright (c) 2001, 2004 The NetBSD Foundation, Inc. 635 // All rights reserved. 636 // 637 // This code is derived from software contributed to The NetBSD Foundation 638 // by Klaus Klein. 639 // 640 // Redistribution and use in source and binary forms, with or without 641 // modification, are permitted provided that the following conditions 642 // are met: 643 // 1. Redistributions of source code must retain the above copyright 644 // notice, this list of conditions and the following disclaimer. 645 // 2. Redistributions in binary form must reproduce the above copyright 646 // notice, this list of conditions and the following disclaimer in the 647 // documentation and/or other materials provided with the distribution. 648 // 649 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 650 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 651 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 652 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 653 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 654 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 655 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 656 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 657 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 658 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 659 // POSSIBILITY OF SUCH DAMAGE. 660 661 // $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ 662 663 // * Copyright (c) 1991, 1993 664 // The Regents of the University of California. All rights reserved. 665 // 666 // This code is derived from software contributed to Berkeley by 667 // Berkeley Software Design, Inc. 668 // 669 // Redistribution and use in source and binary forms, with or without 670 // modification, are permitted provided that the following conditions 671 // are met: 672 // 1. Redistributions of source code must retain the above copyright 673 // notice, this list of conditions and the following disclaimer. 674 // 2. Redistributions in binary form must reproduce the above copyright 675 // notice, this list of conditions and the following disclaimer in the 676 // documentation and/or other materials provided with the distribution. 677 // 3. Neither the name of the University nor the names of its contributors 678 // may be used to endorse or promote products derived from this software 679 // without specific prior written permission. 680 // 681 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 682 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 683 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 684 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 685 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 686 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 687 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 688 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 689 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 690 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 691 // SUCH DAMAGE. 692 // 693 // @(#)cdefs.h 8.8 (Berkeley) 1/9/95 694 695 // $NetBSD: int_types.h,v 1.7 2014/07/25 21:43:13 joerg Exp $ 696 697 // - 698 // Copyright (c) 1990 The Regents of the University of California. 699 // All rights reserved. 700 // 701 // Redistribution and use in source and binary forms, with or without 702 // modification, are permitted provided that the following conditions 703 // are met: 704 // 1. Redistributions of source code must retain the above copyright 705 // notice, this list of conditions and the following disclaimer. 706 // 2. Redistributions in binary form must reproduce the above copyright 707 // notice, this list of conditions and the following disclaimer in the 708 // documentation and/or other materials provided with the distribution. 709 // 3. Neither the name of the University nor the names of its contributors 710 // may be used to endorse or promote products derived from this software 711 // without specific prior written permission. 712 // 713 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 714 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 715 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 716 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 717 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 718 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 719 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 720 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 721 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 722 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 723 // SUCH DAMAGE. 724 // 725 // from: @(#)types.h 7.5 (Berkeley) 3/9/91 726 727 type intptr_t = int64 /* stdint.h:79:20 */ 728 729 type uintptr_t = uint64 /* stdint.h:84:21 */ 730 731 // $NetBSD: int_mwgwtypes.h,v 1.8 2014/07/25 21:43:13 joerg Exp $ 732 733 // - 734 // Copyright (c) 2001 The NetBSD Foundation, Inc. 735 // All rights reserved. 736 // 737 // This code is derived from software contributed to The NetBSD Foundation 738 // by Klaus Klein. 739 // 740 // Redistribution and use in source and binary forms, with or without 741 // modification, are permitted provided that the following conditions 742 // are met: 743 // 1. Redistributions of source code must retain the above copyright 744 // notice, this list of conditions and the following disclaimer. 745 // 2. Redistributions in binary form must reproduce the above copyright 746 // notice, this list of conditions and the following disclaimer in the 747 // documentation and/or other materials provided with the distribution. 748 // 749 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 750 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 751 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 752 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 753 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 754 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 755 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 756 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 757 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 758 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 759 // POSSIBILITY OF SUCH DAMAGE. 760 761 // $NetBSD: common_int_mwgwtypes.h,v 1.1 2014/07/25 21:43:13 joerg Exp $ 762 763 // - 764 // Copyright (c) 2014 The NetBSD Foundation, Inc. 765 // All rights reserved. 766 // 767 // This code is derived from software contributed to The NetBSD Foundation 768 // by Joerg Sonnenberger. 769 // 770 // Redistribution and use in source and binary forms, with or without 771 // modification, are permitted provided that the following conditions 772 // are met: 773 // 1. Redistributions of source code must retain the above copyright 774 // notice, this list of conditions and the following disclaimer. 775 // 2. Redistributions in binary form must reproduce the above copyright 776 // notice, this list of conditions and the following disclaimer in the 777 // documentation and/or other materials provided with the distribution. 778 // 779 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 780 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 781 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 782 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 783 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 784 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 785 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 786 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 787 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 788 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 789 // POSSIBILITY OF SUCH DAMAGE. 790 791 // 7.18.1 Integer types 792 793 // 7.18.1.2 Minimum-width integer types 794 795 type int_least8_t = int8 /* common_int_mwgwtypes.h:45:32 */ 796 type uint_least8_t = uint8 /* common_int_mwgwtypes.h:46:32 */ 797 type int_least16_t = int16 /* common_int_mwgwtypes.h:47:32 */ 798 type uint_least16_t = uint16 /* common_int_mwgwtypes.h:48:32 */ 799 type int_least32_t = int32 /* common_int_mwgwtypes.h:49:32 */ 800 type uint_least32_t = uint32 /* common_int_mwgwtypes.h:50:32 */ 801 type int_least64_t = int64 /* common_int_mwgwtypes.h:51:32 */ 802 type uint_least64_t = uint64 /* common_int_mwgwtypes.h:52:32 */ 803 804 // 7.18.1.3 Fastest minimum-width integer types 805 type int_fast8_t = int32 /* common_int_mwgwtypes.h:55:32 */ 806 type uint_fast8_t = uint32 /* common_int_mwgwtypes.h:56:32 */ 807 type int_fast16_t = int32 /* common_int_mwgwtypes.h:57:32 */ 808 type uint_fast16_t = uint32 /* common_int_mwgwtypes.h:58:32 */ 809 type int_fast32_t = int32 /* common_int_mwgwtypes.h:59:32 */ 810 type uint_fast32_t = uint32 /* common_int_mwgwtypes.h:60:32 */ 811 type int_fast64_t = int64 /* common_int_mwgwtypes.h:61:32 */ 812 type uint_fast64_t = uint64 /* common_int_mwgwtypes.h:62:32 */ 813 814 // 7.18.1.5 Greatest-width integer types 815 816 type intmax_t = int64 /* common_int_mwgwtypes.h:66:33 */ 817 type uintmax_t = uint64 /* common_int_mwgwtypes.h:67:32 */ 818 819 type u_char = uint8 /* types.h:101:23 */ 820 type u_short = uint16 /* types.h:102:24 */ 821 type u_int = uint32 /* types.h:103:22 */ 822 type u_long = uint64 /* types.h:104:23 */ 823 824 type unchar = uint8 /* types.h:106:23 */ // Sys V compatibility 825 type ushort = uint16 /* types.h:107:24 */ // Sys V compatibility 826 type uint = uint32 /* types.h:108:22 */ // Sys V compatibility 827 type ulong = uint64 /* types.h:109:23 */ // Sys V compatibility 828 829 type u_quad_t = uint64_t /* types.h:112:18 */ // quads 830 type quad_t = int64_t /* types.h:113:18 */ 831 type qaddr_t = uintptr /* types.h:114:16 */ 832 833 // The types longlong_t and u_longlong_t exist for use with the 834 // Sun-derived XDR routines involving these types, and their usage 835 // in other contexts is discouraged. Further note that these types 836 // may not be equivalent to "long long" and "unsigned long long", 837 // they are only guaranteed to be signed and unsigned 64-bit types 838 // respectively. Portable programs that need 64-bit types should use 839 // the C99 types int64_t and uint64_t instead. 840 841 type longlong_t = int64_t /* types.h:126:18 */ // for XDR 842 type u_longlong_t = uint64_t /* types.h:127:18 */ // for XDR 843 844 type blkcnt_t = int64_t /* types.h:129:18 */ // fs block count 845 type blksize_t = int32_t /* types.h:130:18 */ // fs optimal block size 846 847 type fsblkcnt_t = uint64 /* types.h:133:22 */ // fs block count (statvfs) 848 849 type fsfilcnt_t = uint64 /* types.h:138:22 */ // fs file count 850 851 // We don't and shouldn't use caddr_t in the kernel anymore 852 type caddr_t = uintptr /* types.h:145:19 */ // core address 853 854 type daddr_t = int64_t /* types.h:154:18 */ // disk address 855 856 type dev_t = uint64_t /* types.h:157:18 */ // device number 857 type fixpt_t = uint32_t /* types.h:158:18 */ // fixed point number 858 859 type gid_t = uint32 /* types.h:161:18 */ // group id 860 861 type id_t = uint32_t /* types.h:165:18 */ // group id, process id or user id 862 type ino_t = uint64_t /* types.h:166:18 */ // inode number 863 type key_t = int64 /* types.h:167:15 */ // IPC key (for Sys V IPC) 864 865 type mode_t = uint32 /* types.h:170:18 */ // permissions 866 867 type nlink_t = uint32_t /* types.h:174:18 */ // link count 868 869 type off_t = int64 /* types.h:177:18 */ // file offset 870 871 type pid_t = int32 /* types.h:182:18 */ // process id 872 type lwpid_t = int32_t /* types.h:185:18 */ // LWP id 873 type rlim_t = uint64_t /* types.h:186:18 */ // resource limit 874 type segsz_t = int32_t /* types.h:187:18 */ // segment size 875 type swblk_t = int32_t /* types.h:188:18 */ // swap offset 876 877 type uid_t = uint32 /* types.h:191:18 */ // user id 878 879 type mqd_t = int32 /* types.h:195:14 */ 880 881 type cpuid_t = uint64 /* types.h:197:23 */ 882 883 type psetid_t = int32 /* types.h:199:14 */ 884 885 type clock_t = uint32 /* types.h:268:24 */ 886 887 type ssize_t = int64 /* types.h:284:24 */ 888 889 type time_t = int64 /* types.h:289:23 */ 890 891 type clockid_t = int32 /* types.h:294:26 */ 892 893 type timer_t = int32 /* types.h:299:24 */ 894 895 type suseconds_t = int32 /* types.h:304:27 */ 896 897 type useconds_t = uint32 /* types.h:309:26 */ 898 899 // 32 = 2 ^ 5 900 901 // Select uses bit fields of file descriptors. These macros manipulate 902 // such bit fields. Note: FD_SETSIZE may be defined by the user. 903 904 type fd_set1 = struct{ fds_bits [8]uint32 } /* fd_set.h:66:9 */ 905 906 // 32 = 2 ^ 5 907 908 // Select uses bit fields of file descriptors. These macros manipulate 909 // such bit fields. Note: FD_SETSIZE may be defined by the user. 910 911 type fd_set = fd_set1 /* fd_set.h:68:3 */ 912 913 // Expose our internals if we are not required to hide them. 914 915 type kauth_cred_t = uintptr /* types.h:318:27 */ 916 917 type pri_t = int32 /* types.h:320:13 */ 918 919 // $NetBSD: pthread_types.h,v 1.23 2017/09/09 23:21:45 kamil Exp $ 920 921 // - 922 // Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. 923 // All rights reserved. 924 // 925 // This code is derived from software contributed to The NetBSD Foundation 926 // by Nathan J. Williams. 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 // 937 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 938 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 939 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 940 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 941 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 942 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 943 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 944 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 945 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 946 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 947 // POSSIBILITY OF SUCH DAMAGE. 948 949 // We use the "pthread_spin_t" name internally; "pthread_spinlock_t" is the 950 // POSIX spinlock object. 951 // 952 // C++ expects to be using PTHREAD_FOO_INITIALIZER as a member initializer. 953 // This does not work for volatile types. Since C++ does not touch the guts 954 // of those types, we do not include volatile in the C++ definitions. 955 type pthread_spin_t = uint8 /* pthread_types.h:43:29 */ 956 957 // Copied from PTQ_HEAD in pthread_queue.h 958 959 type pthread_queue_struct_t = struct { 960 ptqh_first uintptr 961 ptqh_last uintptr 962 } /* pthread_types.h:61:1 */ 963 964 type pthread_queue_t = pthread_queue_struct_t /* pthread_types.h:62:39 */ 965 type __pthread_attr_st = struct { 966 pta_magic uint32 967 pta_flags int32 968 pta_private uintptr 969 } /* pthread_types.h:65:1 */ 970 971 type __pthread_mutex_st = struct { 972 ptm_magic uint32 973 ptm_errorcheck uint8 974 ptm_pad1 [3]uint8_t 975 __8 struct{ ptm_ceiling uint8 } 976 ptm_pad2 [3]uint8_t 977 _ [4]byte 978 ptm_owner pthread_t 979 ptm_waiters uintptr 980 ptm_recursed uint32 981 _ [4]byte 982 ptm_spare2 uintptr 983 } /* pthread_types.h:66:1 */ 984 985 type __pthread_mutexattr_st = struct { 986 ptma_magic uint32 987 _ [4]byte 988 ptma_private uintptr 989 } /* pthread_types.h:67:1 */ 990 991 type __pthread_cond_st = struct { 992 ptc_magic uint32 993 ptc_lock uint8 994 _ [3]byte 995 ptc_waiters pthread_queue_t 996 ptc_mutex uintptr 997 ptc_private uintptr 998 } /* pthread_types.h:68:1 */ 999 1000 type __pthread_condattr_st = struct { 1001 ptca_magic uint32 1002 _ [4]byte 1003 ptca_private uintptr 1004 } /* pthread_types.h:69:1 */ 1005 1006 type __pthread_rwlock_st = struct { 1007 ptr_magic uint32 1008 ptr_interlock uint8 1009 _ [3]byte 1010 ptr_rblocked pthread_queue_t 1011 ptr_wblocked pthread_queue_t 1012 ptr_nreaders uint32 1013 _ [4]byte 1014 ptr_owner pthread_t 1015 ptr_private uintptr 1016 } /* pthread_types.h:71:1 */ 1017 1018 type __pthread_rwlockattr_st = struct { 1019 ptra_magic uint32 1020 _ [4]byte 1021 ptra_private uintptr 1022 } /* pthread_types.h:72:1 */ 1023 1024 type __pthread_barrier_st = struct { 1025 ptb_magic uint32 1026 ptb_lock pthread_spin_t 1027 _ [3]byte 1028 ptb_waiters pthread_queue_t 1029 ptb_initcount uint32 1030 ptb_curcount uint32 1031 ptb_generation uint32 1032 _ [4]byte 1033 ptb_private uintptr 1034 } /* pthread_types.h:73:1 */ 1035 1036 type __pthread_barrierattr_st = struct { 1037 ptba_magic uint32 1038 _ [4]byte 1039 ptba_private uintptr 1040 } /* pthread_types.h:74:1 */ 1041 1042 type pthread_t = uintptr /* pthread_types.h:76:29 */ 1043 type pthread_attr_t = __pthread_attr_st /* pthread_types.h:77:34 */ 1044 type pthread_mutex_t = __pthread_mutex_st /* pthread_types.h:78:35 */ 1045 type pthread_mutexattr_t = __pthread_mutexattr_st /* pthread_types.h:79:39 */ 1046 type pthread_cond_t = __pthread_cond_st /* pthread_types.h:80:34 */ 1047 type pthread_condattr_t = __pthread_condattr_st /* pthread_types.h:81:38 */ 1048 type __pthread_once_st = struct { 1049 pto_mutex pthread_mutex_t 1050 pto_done int32 1051 _ [4]byte 1052 } /* pthread_types.h:82:9 */ 1053 1054 type pthread_once_t = __pthread_once_st /* pthread_types.h:82:34 */ 1055 type __pthread_spinlock_st = struct { 1056 pts_magic uint32 1057 pts_spin uint8 1058 _ [3]byte 1059 pts_flags int32 1060 } /* pthread_types.h:83:9 */ 1061 1062 type pthread_spinlock_t = __pthread_spinlock_st /* pthread_types.h:83:38 */ 1063 type pthread_rwlock_t = __pthread_rwlock_st /* pthread_types.h:84:36 */ 1064 type pthread_rwlockattr_t = __pthread_rwlockattr_st /* pthread_types.h:85:40 */ 1065 type pthread_barrier_t = __pthread_barrier_st /* pthread_types.h:86:37 */ 1066 type pthread_barrierattr_t = __pthread_barrierattr_st /* pthread_types.h:87:41 */ 1067 type pthread_key_t = int32 /* pthread_types.h:88:13 */ 1068 1069 // $NetBSD: stdarg.h,v 1.4.24.1 2020/04/02 19:17:04 martin Exp $ 1070 1071 // - 1072 // Copyright (c) 1991, 1993 1073 // The Regents of the University of California. All rights reserved. 1074 // 1075 // Redistribution and use in source and binary forms, with or without 1076 // modification, are permitted provided that the following conditions 1077 // are met: 1078 // 1. Redistributions of source code must retain the above copyright 1079 // notice, this list of conditions and the following disclaimer. 1080 // 2. Redistributions in binary form must reproduce the above copyright 1081 // notice, this list of conditions and the following disclaimer in the 1082 // documentation and/or other materials provided with the distribution. 1083 // 3. Neither the name of the University nor the names of its contributors 1084 // may be used to endorse or promote products derived from this software 1085 // without specific prior written permission. 1086 // 1087 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1088 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1089 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1090 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1091 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1092 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1093 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1094 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1095 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1096 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1097 // SUCH DAMAGE. 1098 // 1099 // @(#)stdarg.h 8.1 (Berkeley) 6/10/93 1100 1101 // $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ 1102 1103 // * Copyright (c) 1991, 1993 1104 // The Regents of the University of California. All rights reserved. 1105 // 1106 // This code is derived from software contributed to Berkeley by 1107 // Berkeley Software Design, Inc. 1108 // 1109 // Redistribution and use in source and binary forms, with or without 1110 // modification, are permitted provided that the following conditions 1111 // are met: 1112 // 1. Redistributions of source code must retain the above copyright 1113 // notice, this list of conditions and the following disclaimer. 1114 // 2. Redistributions in binary form must reproduce the above copyright 1115 // notice, this list of conditions and the following disclaimer in the 1116 // documentation and/or other materials provided with the distribution. 1117 // 3. Neither the name of the University nor the names of its contributors 1118 // may be used to endorse or promote products derived from this software 1119 // without specific prior written permission. 1120 // 1121 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1122 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1123 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1124 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1125 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1126 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1127 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1128 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1129 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1130 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1131 // SUCH DAMAGE. 1132 // 1133 // @(#)cdefs.h 8.8 (Berkeley) 1/9/95 1134 1135 // $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ 1136 1137 // - 1138 // Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. 1139 // All rights reserved. 1140 // 1141 // This code is derived from software contributed to The NetBSD Foundation 1142 // by Jun-ichiro itojun Hagino and by Klaus Klein. 1143 // 1144 // Redistribution and use in source and binary forms, with or without 1145 // modification, are permitted provided that the following conditions 1146 // are met: 1147 // 1. Redistributions of source code must retain the above copyright 1148 // notice, this list of conditions and the following disclaimer. 1149 // 2. Redistributions in binary form must reproduce the above copyright 1150 // notice, this list of conditions and the following disclaimer in the 1151 // documentation and/or other materials provided with the distribution. 1152 // 1153 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1154 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1155 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1156 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1157 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1158 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1159 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1160 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1161 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1162 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1163 // POSSIBILITY OF SUCH DAMAGE. 1164 1165 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 1166 1167 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 1168 // Public domain. 1169 // 1170 // NOTE: Do not protect this header against multiple inclusion. Doing 1171 // so can have subtle side-effects due to header file inclusion order 1172 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 1173 // protect each CPP macro that we want to supply. 1174 1175 // Feature-test macros are defined by several standards, and allow an 1176 // application to specify what symbols they want the system headers to 1177 // expose, and hence what standard they want them to conform to. 1178 // There are two classes of feature-test macros. The first class 1179 // specify complete standards, and if one of these is defined, header 1180 // files will try to conform to the relevant standard. They are: 1181 // 1182 // ANSI macros: 1183 // _ANSI_SOURCE ANSI C89 1184 // 1185 // POSIX macros: 1186 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 1187 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 1188 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 1189 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 1190 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 1191 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 1192 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 1193 // 1194 // X/Open macros: 1195 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 1196 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 1197 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 1198 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 1199 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 1200 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 1201 // 1202 // NetBSD macros: 1203 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 1204 // 1205 // If more than one of these "major" feature-test macros is defined, 1206 // then the set of facilities provided (and namespace used) is the 1207 // union of that specified by the relevant standards, and in case of 1208 // conflict, the earlier standard in the above list has precedence (so 1209 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 1210 // of rename() that's used is the POSIX one). If none of the "major" 1211 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 1212 // 1213 // There are also "minor" feature-test macros, which enable extra 1214 // functionality in addition to some base standard. They should be 1215 // defined along with one of the "major" macros. The "minor" macros 1216 // are: 1217 // 1218 // _REENTRANT 1219 // _ISOC99_SOURCE 1220 // _ISOC11_SOURCE 1221 // _LARGEFILE_SOURCE Large File Support 1222 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 1223 1224 type va_list = uintptr /* stdarg.h:53:19 */ // getsubopt(3) external variable 1225 1226 // MVS linker does not support external names larger than 8 bytes 1227 1228 // 1229 // The 'zlib' compression library provides in-memory compression and 1230 // decompression functions, including integrity checks of the uncompressed data. 1231 // This version of the library supports only one compression method (deflation) 1232 // but other algorithms will be added later and will have the same stream 1233 // interface. 1234 // 1235 // Compression can be done in a single step if the buffers are large enough, 1236 // or can be done by repeated calls of the compression function. In the latter 1237 // case, the application must provide more input and/or consume the output 1238 // (providing more output space) before each call. 1239 // 1240 // The compressed data format used by default by the in-memory functions is 1241 // the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped 1242 // around a deflate stream, which is itself documented in RFC 1951. 1243 // 1244 // The library also supports reading and writing files in gzip (.gz) format 1245 // with an interface similar to that of stdio using the functions that start 1246 // with "gz". The gzip format is different from the zlib format. gzip is a 1247 // gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. 1248 // 1249 // This library can optionally read and write gzip and raw deflate streams in 1250 // memory as well. 1251 // 1252 // The zlib format was designed to be compact and fast for use in memory 1253 // and on communications channels. The gzip format was designed for single- 1254 // file compression on file systems, has a larger header than zlib to maintain 1255 // directory information, and uses a different, slower check method than zlib. 1256 // 1257 // The library does not install any signal handler. The decoder checks 1258 // the consistency of the compressed data, so the library should never crash 1259 // even in the case of corrupted input. 1260 1261 type alloc_func = uintptr /* zlib.h:81:16 */ 1262 type free_func = uintptr /* zlib.h:82:16 */ 1263 1264 type z_stream_s = struct { 1265 next_in uintptr 1266 avail_in uInt 1267 _ [4]byte 1268 total_in uLong 1269 next_out uintptr 1270 avail_out uInt 1271 _ [4]byte 1272 total_out uLong 1273 msg uintptr 1274 state uintptr 1275 zalloc alloc_func 1276 zfree free_func 1277 opaque voidpf 1278 data_type int32 1279 _ [4]byte 1280 adler uLong 1281 reserved uLong 1282 } /* zlib.h:86:9 */ 1283 1284 type z_stream = z_stream_s /* zlib.h:106:3 */ 1285 1286 type z_streamp = uintptr /* zlib.h:108:22 */ 1287 1288 // 1289 // gzip header information passed to and from zlib routines. See RFC 1952 1290 // for more details on the meanings of these fields. 1291 type gz_header_s = struct { 1292 text int32 1293 _ [4]byte 1294 time uLong 1295 xflags int32 1296 os int32 1297 extra uintptr 1298 extra_len uInt 1299 extra_max uInt 1300 name uintptr 1301 name_max uInt 1302 _ [4]byte 1303 comment uintptr 1304 comm_max uInt 1305 hcrc int32 1306 done int32 1307 _ [4]byte 1308 } /* zlib.h:114:9 */ 1309 1310 // 1311 // gzip header information passed to and from zlib routines. See RFC 1952 1312 // for more details on the meanings of these fields. 1313 type gz_header = gz_header_s /* zlib.h:129:3 */ 1314 1315 type gz_headerp = uintptr /* zlib.h:131:23 */ 1316 // 1317 // inflateGetHeader() requests that gzip header information be stored in the 1318 // provided gz_header structure. inflateGetHeader() may be called after 1319 // inflateInit2() or inflateReset(), and before the first call of inflate(). 1320 // As inflate() processes the gzip stream, head->done is zero until the header 1321 // is completed, at which time head->done is set to one. If a zlib stream is 1322 // being decoded, then head->done is set to -1 to indicate that there will be 1323 // no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be 1324 // used to force inflate() to return immediately after header processing is 1325 // complete and before any actual data is decompressed. 1326 // 1327 // The text, time, xflags, and os fields are filled in with the gzip header 1328 // contents. hcrc is set to true if there is a header CRC. (The header CRC 1329 // was valid if done is set to one.) If extra is not Z_NULL, then extra_max 1330 // contains the maximum number of bytes to write to extra. Once done is true, 1331 // extra_len contains the actual extra field length, and extra contains the 1332 // extra field, or that field truncated if extra_max is less than extra_len. 1333 // If name is not Z_NULL, then up to name_max characters are written there, 1334 // terminated with a zero unless the length is greater than name_max. If 1335 // comment is not Z_NULL, then up to comm_max characters are written there, 1336 // terminated with a zero unless the length is greater than comm_max. When any 1337 // of extra, name, or comment are not Z_NULL and the respective field is not 1338 // present in the header, then that field is set to Z_NULL to signal its 1339 // absence. This allows the use of deflateSetHeader() with the returned 1340 // structure to duplicate the header. However if those fields are set to 1341 // allocated memory, then the application will need to save those pointers 1342 // elsewhere so that they can be eventually freed. 1343 // 1344 // If inflateGetHeader is not used, then the header information is simply 1345 // discarded. The header is always checked for validity, including the header 1346 // CRC if present. inflateReset() will reset the process to discard the header 1347 // information. The application would need to call inflateGetHeader() again to 1348 // retrieve the header from the next gzip stream. 1349 // 1350 // inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source 1351 // stream state was inconsistent. 1352 1353 // 1354 // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, 1355 // unsigned char FAR *window)); 1356 // 1357 // Initialize the internal stream state for decompression using inflateBack() 1358 // calls. The fields zalloc, zfree and opaque in strm must be initialized 1359 // before the call. If zalloc and zfree are Z_NULL, then the default library- 1360 // derived memory allocation routines are used. windowBits is the base two 1361 // logarithm of the window size, in the range 8..15. window is a caller 1362 // supplied buffer of that size. Except for special applications where it is 1363 // assured that deflate was used with small window sizes, windowBits must be 15 1364 // and a 32K byte window must be supplied to be able to decompress general 1365 // deflate streams. 1366 // 1367 // See inflateBack() for the usage of these routines. 1368 // 1369 // inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of 1370 // the parameters are invalid, Z_MEM_ERROR if the internal state could not be 1371 // allocated, or Z_VERSION_ERROR if the version of the library does not match 1372 // the version of the header file. 1373 1374 type in_func = uintptr /* zlib.h:1092:18 */ 1375 type out_func = uintptr /* zlib.h:1094:13 */ 1376 // 1377 // Same as uncompress, except that sourceLen is a pointer, where the 1378 // length of the source is *sourceLen. On return, *sourceLen is the number of 1379 // source bytes consumed. 1380 1381 // gzip file access functions 1382 1383 // 1384 // This library supports reading and writing files in gzip (.gz) format with 1385 // an interface similar to that of stdio, using the functions that start with 1386 // "gz". The gzip format is different from the zlib format. gzip is a gzip 1387 // wrapper, documented in RFC 1952, wrapped around a deflate stream. 1388 1389 type gzFile_s = struct { 1390 have uint32 1391 _ [4]byte 1392 next uintptr 1393 pos int64 1394 } /* zlib.h:1300:9 */ 1395 1396 // 1397 // Same as uncompress, except that sourceLen is a pointer, where the 1398 // length of the source is *sourceLen. On return, *sourceLen is the number of 1399 // source bytes consumed. 1400 1401 // gzip file access functions 1402 1403 // 1404 // This library supports reading and writing files in gzip (.gz) format with 1405 // an interface similar to that of stdio, using the functions that start with 1406 // "gz". The gzip format is different from the zlib format. gzip is a gzip 1407 // wrapper, documented in RFC 1952, wrapped around a deflate stream. 1408 1409 type gzFile = uintptr /* zlib.h:1300:25 */ 1410 1411 // $NetBSD: stdio.h,v 1.97.18.1 2020/03/30 18:54:56 martin Exp $ 1412 1413 // - 1414 // Copyright (c) 1990, 1993 1415 // The Regents of the University of California. All rights reserved. 1416 // 1417 // This code is derived from software contributed to Berkeley by 1418 // Chris Torek. 1419 // 1420 // Redistribution and use in source and binary forms, with or without 1421 // modification, are permitted provided that the following conditions 1422 // are met: 1423 // 1. Redistributions of source code must retain the above copyright 1424 // notice, this list of conditions and the following disclaimer. 1425 // 2. Redistributions in binary form must reproduce the above copyright 1426 // notice, this list of conditions and the following disclaimer in the 1427 // documentation and/or other materials provided with the distribution. 1428 // 3. Neither the name of the University nor the names of its contributors 1429 // may be used to endorse or promote products derived from this software 1430 // without specific prior written permission. 1431 // 1432 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1433 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1434 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1435 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1436 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1437 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1438 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1439 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1440 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1441 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1442 // SUCH DAMAGE. 1443 // 1444 // @(#)stdio.h 8.5 (Berkeley) 4/29/95 1445 1446 // $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ 1447 1448 // * Copyright (c) 1991, 1993 1449 // The Regents of the University of California. All rights reserved. 1450 // 1451 // This code is derived from software contributed to Berkeley by 1452 // Berkeley Software Design, Inc. 1453 // 1454 // Redistribution and use in source and binary forms, with or without 1455 // modification, are permitted provided that the following conditions 1456 // are met: 1457 // 1. Redistributions of source code must retain the above copyright 1458 // notice, this list of conditions and the following disclaimer. 1459 // 2. Redistributions in binary form must reproduce the above copyright 1460 // notice, this list of conditions and the following disclaimer in the 1461 // documentation and/or other materials provided with the distribution. 1462 // 3. Neither the name of the University nor the names of its contributors 1463 // may be used to endorse or promote products derived from this software 1464 // without specific prior written permission. 1465 // 1466 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1467 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1468 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1469 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1470 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1471 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1472 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1473 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1474 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1475 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1476 // SUCH DAMAGE. 1477 // 1478 // @(#)cdefs.h 8.8 (Berkeley) 1/9/95 1479 1480 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 1481 1482 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 1483 // Public domain. 1484 // 1485 // NOTE: Do not protect this header against multiple inclusion. Doing 1486 // so can have subtle side-effects due to header file inclusion order 1487 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 1488 // protect each CPP macro that we want to supply. 1489 1490 // Feature-test macros are defined by several standards, and allow an 1491 // application to specify what symbols they want the system headers to 1492 // expose, and hence what standard they want them to conform to. 1493 // There are two classes of feature-test macros. The first class 1494 // specify complete standards, and if one of these is defined, header 1495 // files will try to conform to the relevant standard. They are: 1496 // 1497 // ANSI macros: 1498 // _ANSI_SOURCE ANSI C89 1499 // 1500 // POSIX macros: 1501 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 1502 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 1503 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 1504 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 1505 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 1506 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 1507 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 1508 // 1509 // X/Open macros: 1510 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 1511 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 1512 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 1513 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 1514 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 1515 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 1516 // 1517 // NetBSD macros: 1518 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 1519 // 1520 // If more than one of these "major" feature-test macros is defined, 1521 // then the set of facilities provided (and namespace used) is the 1522 // union of that specified by the relevant standards, and in case of 1523 // conflict, the earlier standard in the above list has precedence (so 1524 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 1525 // of rename() that's used is the POSIX one). If none of the "major" 1526 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 1527 // 1528 // There are also "minor" feature-test macros, which enable extra 1529 // functionality in addition to some base standard. They should be 1530 // defined along with one of the "major" macros. The "minor" macros 1531 // are: 1532 // 1533 // _REENTRANT 1534 // _ISOC99_SOURCE 1535 // _ISOC11_SOURCE 1536 // _LARGEFILE_SOURCE Large File Support 1537 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 1538 1539 // $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ 1540 1541 // - 1542 // Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. 1543 // All rights reserved. 1544 // 1545 // This code is derived from software contributed to The NetBSD Foundation 1546 // by Jun-ichiro itojun Hagino and by Klaus Klein. 1547 // 1548 // Redistribution and use in source and binary forms, with or without 1549 // modification, are permitted provided that the following conditions 1550 // are met: 1551 // 1. Redistributions of source code must retain the above copyright 1552 // notice, this list of conditions and the following disclaimer. 1553 // 2. Redistributions in binary form must reproduce the above copyright 1554 // notice, this list of conditions and the following disclaimer in the 1555 // documentation and/or other materials provided with the distribution. 1556 // 1557 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1558 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1559 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1560 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1561 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1562 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1563 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1564 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1565 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1566 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1567 // POSSIBILITY OF SUCH DAMAGE. 1568 1569 // $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ 1570 1571 // Written by Klaus Klein <kleink@NetBSD.org>, December 22, 1999. 1572 // Public domain. 1573 1574 // This is fairly grotesque, but pure ANSI code must not inspect the 1575 // innards of an fpos_t anyway. The library internally uses off_t, 1576 // which we assume is exactly as big as eight chars. 1577 type __sfpos = struct { 1578 _pos int64 1579 _mbstate_in struct { 1580 __mbstateL int64 1581 _ [120]byte 1582 } 1583 _mbstate_out struct { 1584 __mbstateL int64 1585 _ [120]byte 1586 } 1587 } /* stdio.h:67:9 */ 1588 1589 // $NetBSD: stdio.h,v 1.97.18.1 2020/03/30 18:54:56 martin Exp $ 1590 1591 // - 1592 // Copyright (c) 1990, 1993 1593 // The Regents of the University of California. All rights reserved. 1594 // 1595 // This code is derived from software contributed to Berkeley by 1596 // Chris Torek. 1597 // 1598 // Redistribution and use in source and binary forms, with or without 1599 // modification, are permitted provided that the following conditions 1600 // are met: 1601 // 1. Redistributions of source code must retain the above copyright 1602 // notice, this list of conditions and the following disclaimer. 1603 // 2. Redistributions in binary form must reproduce the above copyright 1604 // notice, this list of conditions and the following disclaimer in the 1605 // documentation and/or other materials provided with the distribution. 1606 // 3. Neither the name of the University nor the names of its contributors 1607 // may be used to endorse or promote products derived from this software 1608 // without specific prior written permission. 1609 // 1610 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1611 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1612 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1613 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1614 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1615 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1616 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1617 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1618 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1619 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1620 // SUCH DAMAGE. 1621 // 1622 // @(#)stdio.h 8.5 (Berkeley) 4/29/95 1623 1624 // $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ 1625 1626 // * Copyright (c) 1991, 1993 1627 // The Regents of the University of California. All rights reserved. 1628 // 1629 // This code is derived from software contributed to Berkeley by 1630 // Berkeley Software Design, Inc. 1631 // 1632 // Redistribution and use in source and binary forms, with or without 1633 // modification, are permitted provided that the following conditions 1634 // are met: 1635 // 1. Redistributions of source code must retain the above copyright 1636 // notice, this list of conditions and the following disclaimer. 1637 // 2. Redistributions in binary form must reproduce the above copyright 1638 // notice, this list of conditions and the following disclaimer in the 1639 // documentation and/or other materials provided with the distribution. 1640 // 3. Neither the name of the University nor the names of its contributors 1641 // may be used to endorse or promote products derived from this software 1642 // without specific prior written permission. 1643 // 1644 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1645 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1646 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1647 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1648 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1649 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1650 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1651 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1652 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1653 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1654 // SUCH DAMAGE. 1655 // 1656 // @(#)cdefs.h 8.8 (Berkeley) 1/9/95 1657 1658 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 1659 1660 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 1661 // Public domain. 1662 // 1663 // NOTE: Do not protect this header against multiple inclusion. Doing 1664 // so can have subtle side-effects due to header file inclusion order 1665 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 1666 // protect each CPP macro that we want to supply. 1667 1668 // Feature-test macros are defined by several standards, and allow an 1669 // application to specify what symbols they want the system headers to 1670 // expose, and hence what standard they want them to conform to. 1671 // There are two classes of feature-test macros. The first class 1672 // specify complete standards, and if one of these is defined, header 1673 // files will try to conform to the relevant standard. They are: 1674 // 1675 // ANSI macros: 1676 // _ANSI_SOURCE ANSI C89 1677 // 1678 // POSIX macros: 1679 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 1680 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 1681 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 1682 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 1683 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 1684 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 1685 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 1686 // 1687 // X/Open macros: 1688 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 1689 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 1690 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 1691 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 1692 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 1693 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 1694 // 1695 // NetBSD macros: 1696 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 1697 // 1698 // If more than one of these "major" feature-test macros is defined, 1699 // then the set of facilities provided (and namespace used) is the 1700 // union of that specified by the relevant standards, and in case of 1701 // conflict, the earlier standard in the above list has precedence (so 1702 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 1703 // of rename() that's used is the POSIX one). If none of the "major" 1704 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 1705 // 1706 // There are also "minor" feature-test macros, which enable extra 1707 // functionality in addition to some base standard. They should be 1708 // defined along with one of the "major" macros. The "minor" macros 1709 // are: 1710 // 1711 // _REENTRANT 1712 // _ISOC99_SOURCE 1713 // _ISOC11_SOURCE 1714 // _LARGEFILE_SOURCE Large File Support 1715 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 1716 1717 // $NetBSD: ansi.h,v 1.14 2011/07/17 20:54:54 joerg Exp $ 1718 1719 // - 1720 // Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc. 1721 // All rights reserved. 1722 // 1723 // This code is derived from software contributed to The NetBSD Foundation 1724 // by Jun-ichiro itojun Hagino and by Klaus Klein. 1725 // 1726 // Redistribution and use in source and binary forms, with or without 1727 // modification, are permitted provided that the following conditions 1728 // are met: 1729 // 1. Redistributions of source code must retain the above copyright 1730 // notice, this list of conditions and the following disclaimer. 1731 // 2. Redistributions in binary form must reproduce the above copyright 1732 // notice, this list of conditions and the following disclaimer in the 1733 // documentation and/or other materials provided with the distribution. 1734 // 1735 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1736 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1737 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1738 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1739 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1740 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1741 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1742 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1743 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1744 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1745 // POSSIBILITY OF SUCH DAMAGE. 1746 1747 // $NetBSD: null.h,v 1.9 2010/07/06 11:56:20 kleink Exp $ 1748 1749 // Written by Klaus Klein <kleink@NetBSD.org>, December 22, 1999. 1750 // Public domain. 1751 1752 // This is fairly grotesque, but pure ANSI code must not inspect the 1753 // innards of an fpos_t anyway. The library internally uses off_t, 1754 // which we assume is exactly as big as eight chars. 1755 type fpos_t = __sfpos /* stdio.h:70:3 */ 1756 1757 // NB: to fit things in six character monocase externals, the stdio 1758 // code uses the prefix `__s' for stdio objects, typically followed 1759 // by a three-character attempt at a mnemonic. 1760 1761 // stdio buffers 1762 type __sbuf = struct { 1763 _base uintptr 1764 _size int32 1765 _ [4]byte 1766 } /* stdio.h:81:1 */ 1767 1768 // stdio state variables. 1769 // 1770 // The following always hold: 1771 // 1772 // if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), 1773 // _lbfsize is -_bf._size, else _lbfsize is 0 1774 // if _flags&__SRD, _w is 0 1775 // if _flags&__SWR, _r is 0 1776 // 1777 // This ensures that the getc and putc macros (or inline functions) never 1778 // try to write or read from a file that is in `read' or `write' mode. 1779 // (Moreover, they can, and do, automatically switch from read mode to 1780 // write mode, and back, on "r+" and "w+" files.) 1781 // 1782 // _lbfsize is used only to make the inline line-buffered output stream 1783 // code as compact as possible. 1784 // 1785 // _ub, _up, and _ur are used when ungetc() pushes back more characters 1786 // than fit in the current _bf, or when ungetc() pushes back a character 1787 // that does not match the previous one in _bf. When this happens, 1788 // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff 1789 // _ub._base!=NULL) and _up and _ur save the current values of _p and _r. 1790 // 1791 // NB: see WARNING above before changing the layout of this structure! 1792 type __sFILE = struct { 1793 _p uintptr 1794 _r int32 1795 _w int32 1796 _flags uint16 1797 _file int16 1798 _ [4]byte 1799 _bf struct { 1800 _base uintptr 1801 _size int32 1802 _ [4]byte 1803 } 1804 _lbfsize int32 1805 _ [4]byte 1806 _cookie uintptr 1807 _close uintptr 1808 _read uintptr 1809 _seek uintptr 1810 _write uintptr 1811 _ext struct { 1812 _base uintptr 1813 _size int32 1814 _ [4]byte 1815 } 1816 _up uintptr 1817 _ur int32 1818 _ubuf [3]uint8 1819 _nbuf [1]uint8 1820 _flush uintptr 1821 _lb_unused [8]int8 1822 _blksize int32 1823 _ [4]byte 1824 _offset int64 1825 } /* stdio.h:112:9 */ 1826 1827 // stdio state variables. 1828 // 1829 // The following always hold: 1830 // 1831 // if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), 1832 // _lbfsize is -_bf._size, else _lbfsize is 0 1833 // if _flags&__SRD, _w is 0 1834 // if _flags&__SWR, _r is 0 1835 // 1836 // This ensures that the getc and putc macros (or inline functions) never 1837 // try to write or read from a file that is in `read' or `write' mode. 1838 // (Moreover, they can, and do, automatically switch from read mode to 1839 // write mode, and back, on "r+" and "w+" files.) 1840 // 1841 // _lbfsize is used only to make the inline line-buffered output stream 1842 // code as compact as possible. 1843 // 1844 // _ub, _up, and _ur are used when ungetc() pushes back more characters 1845 // than fit in the current _bf, or when ungetc() pushes back a character 1846 // that does not match the previous one in _bf. When this happens, 1847 // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff 1848 // _ub._base!=NULL) and _up and _ur save the current values of _p and _r. 1849 // 1850 // NB: see WARNING above before changing the layout of this structure! 1851 type FILE = __sFILE /* stdio.h:146:3 */ 1852 1853 type locale_t = uintptr /* stdio.h:543:25 */ 1854 1855 // $NetBSD: stdlib.h,v 1.121 2019/01/05 09:16:46 maya Exp $ 1856 1857 // - 1858 // Copyright (c) 1990, 1993 1859 // The Regents of the University of California. All rights reserved. 1860 // 1861 // Redistribution and use in source and binary forms, with or without 1862 // modification, are permitted provided that the following conditions 1863 // are met: 1864 // 1. Redistributions of source code must retain the above copyright 1865 // notice, this list of conditions and the following disclaimer. 1866 // 2. Redistributions in binary form must reproduce the above copyright 1867 // notice, this list of conditions and the following disclaimer in the 1868 // documentation and/or other materials provided with the distribution. 1869 // 3. Neither the name of the University nor the names of its contributors 1870 // may be used to endorse or promote products derived from this software 1871 // without specific prior written permission. 1872 // 1873 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1874 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1875 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1876 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1877 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1878 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1879 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1880 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1881 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1882 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1883 // SUCH DAMAGE. 1884 // 1885 // @(#)stdlib.h 8.5 (Berkeley) 5/19/95 1886 1887 // $NetBSD: cdefs.h,v 1.141 2019/02/21 21:34:05 christos Exp $ 1888 1889 // * Copyright (c) 1991, 1993 1890 // The Regents of the University of California. All rights reserved. 1891 // 1892 // This code is derived from software contributed to Berkeley by 1893 // Berkeley Software Design, Inc. 1894 // 1895 // Redistribution and use in source and binary forms, with or without 1896 // modification, are permitted provided that the following conditions 1897 // are met: 1898 // 1. Redistributions of source code must retain the above copyright 1899 // notice, this list of conditions and the following disclaimer. 1900 // 2. Redistributions in binary form must reproduce the above copyright 1901 // notice, this list of conditions and the following disclaimer in the 1902 // documentation and/or other materials provided with the distribution. 1903 // 3. Neither the name of the University nor the names of its contributors 1904 // may be used to endorse or promote products derived from this software 1905 // without specific prior written permission. 1906 // 1907 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1908 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1909 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1910 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1911 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1912 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1913 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1914 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1915 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1916 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1917 // SUCH DAMAGE. 1918 // 1919 // @(#)cdefs.h 8.8 (Berkeley) 1/9/95 1920 1921 // $NetBSD: featuretest.h,v 1.10 2013/04/26 18:29:06 christos Exp $ 1922 1923 // Written by Klaus Klein <kleink@NetBSD.org>, February 2, 1998. 1924 // Public domain. 1925 // 1926 // NOTE: Do not protect this header against multiple inclusion. Doing 1927 // so can have subtle side-effects due to header file inclusion order 1928 // and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE. Instead, 1929 // protect each CPP macro that we want to supply. 1930 1931 // Feature-test macros are defined by several standards, and allow an 1932 // application to specify what symbols they want the system headers to 1933 // expose, and hence what standard they want them to conform to. 1934 // There are two classes of feature-test macros. The first class 1935 // specify complete standards, and if one of these is defined, header 1936 // files will try to conform to the relevant standard. They are: 1937 // 1938 // ANSI macros: 1939 // _ANSI_SOURCE ANSI C89 1940 // 1941 // POSIX macros: 1942 // _POSIX_SOURCE == 1 IEEE Std 1003.1 (version?) 1943 // _POSIX_C_SOURCE == 1 IEEE Std 1003.1-1990 1944 // _POSIX_C_SOURCE == 2 IEEE Std 1003.2-1992 1945 // _POSIX_C_SOURCE == 199309L IEEE Std 1003.1b-1993 1946 // _POSIX_C_SOURCE == 199506L ISO/IEC 9945-1:1996 1947 // _POSIX_C_SOURCE == 200112L IEEE Std 1003.1-2001 1948 // _POSIX_C_SOURCE == 200809L IEEE Std 1003.1-2008 1949 // 1950 // X/Open macros: 1951 // _XOPEN_SOURCE System Interfaces and Headers, Issue 4, Ver 2 1952 // _XOPEN_SOURCE_EXTENDED == 1 XSH4.2 UNIX extensions 1953 // _XOPEN_SOURCE == 500 System Interfaces and Headers, Issue 5 1954 // _XOPEN_SOURCE == 520 Networking Services (XNS), Issue 5.2 1955 // _XOPEN_SOURCE == 600 IEEE Std 1003.1-2001, XSI option 1956 // _XOPEN_SOURCE == 700 IEEE Std 1003.1-2008, XSI option 1957 // 1958 // NetBSD macros: 1959 // _NETBSD_SOURCE == 1 Make all NetBSD features available. 1960 // 1961 // If more than one of these "major" feature-test macros is defined, 1962 // then the set of facilities provided (and namespace used) is the 1963 // union of that specified by the relevant standards, and in case of 1964 // conflict, the earlier standard in the above list has precedence (so 1965 // if both _POSIX_C_SOURCE and _NETBSD_SOURCE are defined, the version 1966 // of rename() that's used is the POSIX one). If none of the "major" 1967 // feature-test macros is defined, _NETBSD_SOURCE is assumed. 1968 // 1969 // There are also "minor" feature-test macros, which enable extra 1970 // functionality in addition to some base standard. They should be 1971 // defined along with one of the "major" macros. The "minor" macros 1972 // are: 1973 // 1974 // _REENTRANT 1975 // _ISOC99_SOURCE 1976 // _ISOC11_SOURCE 1977 // _LARGEFILE_SOURCE Large File Support 1978 // <http://ftp.sas.com/standards/large.file/x_open.20Mar96.html> 1979 1980 // $NetBSD: types.h,v 1.102 2018/11/06 16:26:44 maya Exp $ 1981 1982 // - 1983 // Copyright (c) 1982, 1986, 1991, 1993, 1994 1984 // The Regents of the University of California. All rights reserved. 1985 // (c) UNIX System Laboratories, Inc. 1986 // All or some portions of this file are derived from material licensed 1987 // to the University of California by American Telephone and Telegraph 1988 // Co. or Unix System Laboratories, Inc. and are reproduced herein with 1989 // the permission of UNIX System Laboratories, Inc. 1990 // 1991 // Redistribution and use in source and binary forms, with or without 1992 // modification, are permitted provided that the following conditions 1993 // are met: 1994 // 1. Redistributions of source code must retain the above copyright 1995 // notice, this list of conditions and the following disclaimer. 1996 // 2. Redistributions in binary form must reproduce the above copyright 1997 // notice, this list of conditions and the following disclaimer in the 1998 // documentation and/or other materials provided with the distribution. 1999 // 3. Neither the name of the University nor the names of its contributors 2000 // may be used to endorse or promote products derived from this software 2001 // without specific prior written permission. 2002 // 2003 // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2004 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2005 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2006 // ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2007 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2008 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2009 // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2010 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2011 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2012 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2013 // SUCH DAMAGE. 2014 // 2015 // @(#)types.h 8.4 (Berkeley) 1/21/94 2016 2017 // $NetBSD: ansi.h,v 1.11 2019/05/07 03:49:26 kamil Exp $ 2018 2019 // $NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $ 2020 2021 // - 2022 // Copyright (c) 2014 The NetBSD Foundation, Inc. 2023 // All rights reserved. 2024 // 2025 // This code is derived from software contributed to The NetBSD Foundation 2026 // by Matt Thomas of 3am Software Foundry. 2027 // 2028 // Redistribution and use in source and binary forms, with or without 2029 // modification, are permitted provided that the following conditions 2030 // are met: 2031 // 1. Redistributions of source code must retain the above copyright 2032 // notice, this list of conditions and the following disclaimer. 2033 // 2. Redistributions in binary form must reproduce the above copyright 2034 // notice, this list of conditions and the following disclaimer in the 2035 // documentation and/or other materials provided with the distribution. 2036 // 2037 // THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2038 // ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2039 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2040 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2041 // BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2042 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2043 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2044 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2045 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2046 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2047 // POSSIBILITY OF SUCH DAMAGE. 2048 2049 type div_t = struct { 2050 quot int32 2051 rem int32 2052 } /* stdlib.h:59:3 */ 2053 2054 type ldiv_t = struct { 2055 quot int64 2056 rem int64 2057 } /* stdlib.h:64:3 */ 2058 2059 type lldiv_t = struct { 2060 quot int64 2061 rem int64 2062 } /* stdlib.h:74:3 */ 2063 2064 type qdiv_t = struct { 2065 quot quad_t 2066 rem quad_t 2067 } /* stdlib.h:81:3 */ 2068 2069 var hello = *(*[14]int8)(unsafe.Pointer(ts /* "hello, hello!" */)) /* example.c:29:21 */ 2070 // "hello world" would be more standard, but the repeated "hello" 2071 // stresses the compression code better, sorry... 2072 2073 var dictionary = *(*[6]int8)(unsafe.Pointer(ts + 14 /* "hello" */)) /* example.c:34:19 */ 2074 var dictId uLong /* example.c:35:14: */ 2075 2076 var zalloc alloc_func = uintptr(0) /* example.c:77:19 */ 2077 var zfree free_func = uintptr(0) /* example.c:78:18 */ 2078 2079 // =========================================================================== 2080 // Test compress() and uncompress() 2081 func test_compress(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:88:6: */ 2082 bp := tls.Alloc(56) 2083 defer tls.Free(56) 2084 *(*uLong)(unsafe.Pointer(bp + 40)) = comprLen 2085 *(*uLong)(unsafe.Pointer(bp + 48)) = uncomprLen 2086 2087 var err int32 2088 var len uLong = (libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello))) + uint64(1)) 2089 2090 err = z.Xcompress(tls, compr, bp+40 /* &comprLen */, uintptr(uintptr(unsafe.Pointer(&hello))), len) 2091 { 2092 if err != 0 { 2093 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+34 /* "compress" */, err)) 2094 libc.Xexit(tls, 1) 2095 } 2096 } 2097 2098 libc.Xstrcpy(tls, uncompr, ts+43 /* "garbage" */) 2099 2100 err = z.Xuncompress(tls, uncompr, bp+48 /* &uncomprLen */, compr, *(*uLong)(unsafe.Pointer(bp + 40 /* comprLen */))) 2101 { 2102 if err != 0 { 2103 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+51 /* "uncompress" */, err)) 2104 libc.Xexit(tls, 1) 2105 } 2106 } 2107 2108 if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 { 2109 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+62 /* "bad uncompress\n" */, 0) 2110 libc.Xexit(tls, 1) 2111 } else { 2112 libc.Xprintf(tls, ts+78 /* "uncompress(): %s..." */, libc.VaList(bp+32, uncompr)) 2113 } 2114 } 2115 2116 // =========================================================================== 2117 // Test read/write of .gz files 2118 func test_gzio(tls *libc.TLS, fname uintptr, uncompr uintptr, uncomprLen uLong) { /* example.c:114:6: */ 2119 bp := tls.Alloc(84) 2120 defer tls.Free(84) 2121 2122 // var err int32 at bp+80, 4 2123 2124 var len int32 = (int32(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + 1) 2125 var file gzFile 2126 var pos int64 2127 2128 file = z.Xgzopen(tls, fname, ts+96 /* "wb" */) 2129 if file == (uintptr(0)) { 2130 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+99 /* "gzopen error\n" */, 0) 2131 libc.Xexit(tls, 1) 2132 } 2133 z.Xgzputc(tls, file, 'h') 2134 if z.Xgzputs(tls, file, ts+113 /* "ello" */) != 4 { 2135 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+118 /* "gzputs err: %s\n" */, libc.VaList(bp, z.Xgzerror(tls, file, bp+80 /* &err */))) 2136 libc.Xexit(tls, 1) 2137 } 2138 if z.Xgzprintf(tls, file, ts+134 /* ", %s!" */, libc.VaList(bp+8, ts+14 /* "hello" */)) != 8 { 2139 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+140 /* "gzprintf err: %s..." */, libc.VaList(bp+16, z.Xgzerror(tls, file, bp+80 /* &err */))) 2140 libc.Xexit(tls, 1) 2141 } 2142 z.Xgzseek(tls, file, 1, 1) // add one zero byte 2143 z.Xgzclose(tls, file) 2144 2145 file = z.Xgzopen(tls, fname, ts+158 /* "rb" */) 2146 if file == (uintptr(0)) { 2147 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+99 /* "gzopen error\n" */, 0) 2148 libc.Xexit(tls, 1) 2149 } 2150 libc.Xstrcpy(tls, uncompr, ts+43 /* "garbage" */) 2151 2152 if z.Xgzread(tls, file, uncompr, uint32(uncomprLen)) != len { 2153 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+161 /* "gzread err: %s\n" */, libc.VaList(bp+24, z.Xgzerror(tls, file, bp+80 /* &err */))) 2154 libc.Xexit(tls, 1) 2155 } 2156 if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 { 2157 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+177 /* "bad gzread: %s\n" */, libc.VaList(bp+32, uncompr)) 2158 libc.Xexit(tls, 1) 2159 } else { 2160 libc.Xprintf(tls, ts+193 /* "gzread(): %s\n" */, libc.VaList(bp+40, uncompr)) 2161 } 2162 2163 pos = z.Xgzseek(tls, file, -8, 1) 2164 if (pos != int64(6)) || (z.Xgztell(tls, file) != pos) { 2165 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+207, /* "gzseek error, po..." */ 2166 libc.VaList(bp+48, pos, z.Xgztell(tls, file))) 2167 libc.Xexit(tls, 1) 2168 } 2169 2170 if (func() int32 { 2171 if (*gzFile_s)(unsafe.Pointer(file)).have != 0 { 2172 return int32(func() uint8 { 2173 (*gzFile_s)(unsafe.Pointer(file)).have-- 2174 (*gzFile_s)(unsafe.Pointer(file)).pos++ 2175 return *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&((*gzFile_s)(unsafe.Pointer(file)).next), 1))) 2176 }()) 2177 } 2178 return z.Xgzgetc(tls, file) 2179 }()) != ' ' { 2180 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+242 /* "gzgetc error\n" */, 0) 2181 libc.Xexit(tls, 1) 2182 } 2183 2184 if z.Xgzungetc(tls, ' ', file) != ' ' { 2185 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+256 /* "gzungetc error\n" */, 0) 2186 libc.Xexit(tls, 1) 2187 } 2188 2189 z.Xgzgets(tls, file, uncompr, int32(uncomprLen)) 2190 if libc.Xstrlen(tls, uncompr) != uint64(7) { // " hello!" 2191 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+272 /* "gzgets err after..." */, libc.VaList(bp+64, z.Xgzerror(tls, file, bp+80 /* &err */))) 2192 libc.Xexit(tls, 1) 2193 } 2194 if libc.Xstrcmp(tls, uncompr, (uintptr(unsafe.Pointer(&hello))+uintptr(6))) != 0 { 2195 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+301 /* "bad gzgets after..." */, 0) 2196 libc.Xexit(tls, 1) 2197 } else { 2198 libc.Xprintf(tls, ts+326 /* "gzgets() after g..." */, libc.VaList(bp+72, uncompr)) 2199 } 2200 2201 z.Xgzclose(tls, file) 2202 } 2203 2204 // =========================================================================== 2205 // Test deflate() with small buffers 2206 func test_deflate(tls *libc.TLS, compr uintptr, comprLen uLong) { /* example.c:200:6: */ 2207 bp := tls.Alloc(176) 2208 defer tls.Free(176) 2209 2210 // var c_stream z_stream at bp+64, 112 2211 // compression stream 2212 var err int32 2213 var len uLong = (libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello))) + uint64(1)) 2214 2215 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zalloc = zalloc 2216 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zfree = zfree 2217 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).opaque = uintptr(0) 2218 2219 err = z.XdeflateInit_(tls, bp+64 /* &c_stream */, -1, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2220 { 2221 if err != 0 { 2222 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+360 /* "deflateInit" */, err)) 2223 libc.Xexit(tls, 1) 2224 } 2225 } 2226 2227 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello))) 2228 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_out = compr 2229 2230 for ((*z_stream)(unsafe.Pointer(bp+64 /* &c_stream */)).total_in != len) && ((*z_stream)(unsafe.Pointer(bp+64 /* &c_stream */)).total_out < comprLen) { 2231 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = libc.AssignPtrUint32(bp+64 /* &c_stream */ +32 /* &.avail_out */, uInt(1)) // force small buffers 2232 err = z.Xdeflate(tls, bp+64 /* &c_stream */, 0) 2233 { 2234 if err != 0 { 2235 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+372 /* "deflate" */, err)) 2236 libc.Xexit(tls, 1) 2237 } 2238 } 2239 2240 } 2241 // Finish the stream, still forcing small buffers: 2242 for { 2243 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_out = uInt(1) 2244 err = z.Xdeflate(tls, bp+64 /* &c_stream */, 4) 2245 if err == 1 { 2246 break 2247 } 2248 { 2249 if err != 0 { 2250 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+372 /* "deflate" */, err)) 2251 libc.Xexit(tls, 1) 2252 } 2253 } 2254 2255 } 2256 2257 err = z.XdeflateEnd(tls, bp+64 /* &c_stream */) 2258 { 2259 if err != 0 { 2260 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+48, ts+380 /* "deflateEnd" */, err)) 2261 libc.Xexit(tls, 1) 2262 } 2263 } 2264 2265 } 2266 2267 // =========================================================================== 2268 // Test inflate() with small buffers 2269 func test_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:238:6: */ 2270 bp := tls.Alloc(168) 2271 defer tls.Free(168) 2272 2273 var err int32 2274 // var d_stream z_stream at bp+56, 112 2275 // decompression stream 2276 2277 libc.Xstrcpy(tls, uncompr, ts+43 /* "garbage" */) 2278 2279 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc 2280 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree 2281 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0) 2282 2283 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr 2284 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(0) 2285 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr 2286 2287 err = z.XinflateInit_(tls, bp+56 /* &d_stream */, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2288 { 2289 if err != 0 { 2290 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+391 /* "inflateInit" */, err)) 2291 libc.Xexit(tls, 1) 2292 } 2293 } 2294 2295 for ((*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).total_out < uncomprLen) && ((*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).total_in < comprLen) { 2296 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = libc.AssignPtrUint32(bp+56 /* &d_stream */ +32 /* &.avail_out */, uInt(1)) // force small buffers 2297 err = z.Xinflate(tls, bp+56 /* &d_stream */, 0) 2298 if err == 1 { 2299 break 2300 } 2301 { 2302 if err != 0 { 2303 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+403 /* "inflate" */, err)) 2304 libc.Xexit(tls, 1) 2305 } 2306 } 2307 2308 } 2309 2310 err = z.XinflateEnd(tls, bp+56 /* &d_stream */) 2311 { 2312 if err != 0 { 2313 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+411 /* "inflateEnd" */, err)) 2314 libc.Xexit(tls, 1) 2315 } 2316 } 2317 2318 if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 { 2319 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+422 /* "bad inflate\n" */, 0) 2320 libc.Xexit(tls, 1) 2321 } else { 2322 libc.Xprintf(tls, ts+435 /* "inflate(): %s\n" */, libc.VaList(bp+48, uncompr)) 2323 } 2324 } 2325 2326 // =========================================================================== 2327 // Test deflate() with large buffers and dynamic change of compression level 2328 func test_large_deflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:279:6: */ 2329 bp := tls.Alloc(192) 2330 defer tls.Free(192) 2331 2332 // var c_stream z_stream at bp+80, 112 2333 // compression stream 2334 var err int32 2335 2336 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).zalloc = zalloc 2337 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).zfree = zfree 2338 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).opaque = uintptr(0) 2339 2340 err = z.XdeflateInit_(tls, bp+80 /* &c_stream */, 1, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2341 { 2342 if err != 0 { 2343 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+360 /* "deflateInit" */, err)) 2344 libc.Xexit(tls, 1) 2345 } 2346 } 2347 2348 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_out = compr 2349 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_out = uInt(comprLen) 2350 2351 // At this point, uncompr is still mostly zeroes, so it should compress 2352 // very well: 2353 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = uncompr 2354 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(uncomprLen) 2355 err = z.Xdeflate(tls, bp+80 /* &c_stream */, 0) 2356 { 2357 if err != 0 { 2358 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+372 /* "deflate" */, err)) 2359 libc.Xexit(tls, 1) 2360 } 2361 } 2362 2363 if (*z_stream)(unsafe.Pointer(bp+80 /* &c_stream */)).avail_in != uInt(0) { 2364 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+450 /* "deflate not gree..." */, 0) 2365 libc.Xexit(tls, 1) 2366 } 2367 2368 // Feed in already compressed data and switch to no compression: 2369 z.XdeflateParams(tls, bp+80 /* &c_stream */, 0, 0) 2370 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = compr 2371 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = (uInt(comprLen) / uInt(2)) 2372 err = z.Xdeflate(tls, bp+80 /* &c_stream */, 0) 2373 { 2374 if err != 0 { 2375 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+372 /* "deflate" */, err)) 2376 libc.Xexit(tls, 1) 2377 } 2378 } 2379 2380 // Switch back to compressing mode: 2381 z.XdeflateParams(tls, bp+80 /* &c_stream */, 9, 1) 2382 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = uncompr 2383 (*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(uncomprLen) 2384 err = z.Xdeflate(tls, bp+80 /* &c_stream */, 0) 2385 { 2386 if err != 0 { 2387 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+48, ts+372 /* "deflate" */, err)) 2388 libc.Xexit(tls, 1) 2389 } 2390 } 2391 2392 err = z.Xdeflate(tls, bp+80 /* &c_stream */, 4) 2393 if err != 1 { 2394 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+470 /* "deflate should r..." */, 0) 2395 libc.Xexit(tls, 1) 2396 } 2397 err = z.XdeflateEnd(tls, bp+80 /* &c_stream */) 2398 { 2399 if err != 0 { 2400 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+64, ts+380 /* "deflateEnd" */, err)) 2401 libc.Xexit(tls, 1) 2402 } 2403 } 2404 2405 } 2406 2407 // =========================================================================== 2408 // Test inflate() with large buffers 2409 func test_large_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:334:6: */ 2410 bp := tls.Alloc(168) 2411 defer tls.Free(168) 2412 2413 var err int32 2414 // var d_stream z_stream at bp+56, 112 2415 // decompression stream 2416 2417 libc.Xstrcpy(tls, uncompr, ts+43 /* "garbage" */) 2418 2419 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc 2420 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree 2421 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0) 2422 2423 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr 2424 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(comprLen) 2425 2426 err = z.XinflateInit_(tls, bp+56 /* &d_stream */, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2427 { 2428 if err != 0 { 2429 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+391 /* "inflateInit" */, err)) 2430 libc.Xexit(tls, 1) 2431 } 2432 } 2433 2434 for { 2435 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr // discard the output 2436 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_out = uInt(uncomprLen) 2437 err = z.Xinflate(tls, bp+56 /* &d_stream */, 0) 2438 if err == 1 { 2439 break 2440 } 2441 { 2442 if err != 0 { 2443 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+506 /* "large inflate" */, err)) 2444 libc.Xexit(tls, 1) 2445 } 2446 } 2447 2448 } 2449 2450 err = z.XinflateEnd(tls, bp+56 /* &d_stream */) 2451 { 2452 if err != 0 { 2453 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+411 /* "inflateEnd" */, err)) 2454 libc.Xexit(tls, 1) 2455 } 2456 } 2457 2458 if (*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).total_out != ((uint64(2) * uncomprLen) + (comprLen / uint64(2))) { 2459 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+520 /* "bad large inflat..." */, libc.VaList(bp+48, (*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).total_out)) 2460 libc.Xexit(tls, 1) 2461 } else { 2462 libc.Xprintf(tls, ts+544 /* "large_inflate():..." */, 0) 2463 } 2464 } 2465 2466 // =========================================================================== 2467 // Test deflate() with full flush 2468 func test_flush(tls *libc.TLS, compr uintptr, comprLen uintptr) { /* example.c:375:6: */ 2469 bp := tls.Alloc(176) 2470 defer tls.Free(176) 2471 2472 // var c_stream z_stream at bp+64, 112 2473 // compression stream 2474 var err int32 2475 var len uInt = (uInt(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + uInt(1)) 2476 2477 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zalloc = zalloc 2478 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zfree = zfree 2479 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).opaque = uintptr(0) 2480 2481 err = z.XdeflateInit_(tls, bp+64 /* &c_stream */, -1, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2482 { 2483 if err != 0 { 2484 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+360 /* "deflateInit" */, err)) 2485 libc.Xexit(tls, 1) 2486 } 2487 } 2488 2489 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello))) 2490 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_out = compr 2491 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = uInt(3) 2492 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_out = uInt(*(*uLong)(unsafe.Pointer(comprLen))) 2493 err = z.Xdeflate(tls, bp+64 /* &c_stream */, 3) 2494 { 2495 if err != 0 { 2496 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+372 /* "deflate" */, err)) 2497 libc.Xexit(tls, 1) 2498 } 2499 } 2500 2501 *(*Byte)(unsafe.Pointer(compr + 3))++ // force an error in first compressed block 2502 (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = (len - uInt(3)) 2503 2504 err = z.Xdeflate(tls, bp+64 /* &c_stream */, 4) 2505 if err != 1 { 2506 { 2507 if err != 0 { 2508 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+372 /* "deflate" */, err)) 2509 libc.Xexit(tls, 1) 2510 } 2511 } 2512 2513 } 2514 err = z.XdeflateEnd(tls, bp+64 /* &c_stream */) 2515 { 2516 if err != 0 { 2517 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+48, ts+380 /* "deflateEnd" */, err)) 2518 libc.Xexit(tls, 1) 2519 } 2520 } 2521 2522 *(*uLong)(unsafe.Pointer(comprLen)) = (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).total_out 2523 } 2524 2525 // =========================================================================== 2526 // Test inflateSync() 2527 func test_sync(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:413:6: */ 2528 bp := tls.Alloc(184) 2529 defer tls.Free(184) 2530 2531 var err int32 2532 // var d_stream z_stream at bp+72, 112 2533 // decompression stream 2534 2535 libc.Xstrcpy(tls, uncompr, ts+43 /* "garbage" */) 2536 2537 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).zalloc = zalloc 2538 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).zfree = zfree 2539 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).opaque = uintptr(0) 2540 2541 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).next_in = compr 2542 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_in = uInt(2) // just read the zlib header 2543 2544 err = z.XinflateInit_(tls, bp+72 /* &d_stream */, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2545 { 2546 if err != 0 { 2547 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+391 /* "inflateInit" */, err)) 2548 libc.Xexit(tls, 1) 2549 } 2550 } 2551 2552 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).next_out = uncompr 2553 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_out = uInt(uncomprLen) 2554 2555 err = z.Xinflate(tls, bp+72 /* &d_stream */, 0) 2556 { 2557 if err != 0 { 2558 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+403 /* "inflate" */, err)) 2559 libc.Xexit(tls, 1) 2560 } 2561 } 2562 2563 (*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_in = (uInt(comprLen) - uInt(2)) // read all compressed data 2564 err = z.XinflateSync(tls, bp+72 /* &d_stream */) /* but skip the damaged part */ 2565 { 2566 if err != 0 { 2567 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+565 /* "inflateSync" */, err)) 2568 libc.Xexit(tls, 1) 2569 } 2570 } 2571 2572 err = z.Xinflate(tls, bp+72 /* &d_stream */, 4) 2573 if err != (-3) { 2574 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+577 /* "inflate should r..." */, 0) 2575 // Because of incorrect adler32 2576 libc.Xexit(tls, 1) 2577 } 2578 err = z.XinflateEnd(tls, bp+72 /* &d_stream */) 2579 { 2580 if err != 0 { 2581 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+48, ts+411 /* "inflateEnd" */, err)) 2582 libc.Xexit(tls, 1) 2583 } 2584 } 2585 2586 libc.Xprintf(tls, ts+611 /* "after inflateSyn..." */, libc.VaList(bp+64, uncompr)) 2587 } 2588 2589 // =========================================================================== 2590 // Test deflate() with preset dictionary 2591 func test_dict_deflate(tls *libc.TLS, compr uintptr, comprLen uLong) { /* example.c:457:6: */ 2592 bp := tls.Alloc(160) 2593 defer tls.Free(160) 2594 2595 // var c_stream z_stream at bp+48, 112 2596 // compression stream 2597 var err int32 2598 2599 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).zalloc = zalloc 2600 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).zfree = zfree 2601 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).opaque = uintptr(0) 2602 2603 err = z.XdeflateInit_(tls, bp+48 /* &c_stream */, 9, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2604 { 2605 if err != 0 { 2606 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+360 /* "deflateInit" */, err)) 2607 libc.Xexit(tls, 1) 2608 } 2609 } 2610 2611 err = z.XdeflateSetDictionary(tls, bp+48, /* &c_stream */ 2612 uintptr(uintptr(unsafe.Pointer(&dictionary))), uint32(int32(unsafe.Sizeof(dictionary)))) 2613 { 2614 if err != 0 { 2615 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+639 /* "deflateSetDictio..." */, err)) 2616 libc.Xexit(tls, 1) 2617 } 2618 } 2619 2620 dictId = (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).adler 2621 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).next_out = compr 2622 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).avail_out = uInt(comprLen) 2623 2624 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello))) 2625 (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).avail_in = (uInt(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + uInt(1)) 2626 2627 err = z.Xdeflate(tls, bp+48 /* &c_stream */, 4) 2628 if err != 1 { 2629 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+470 /* "deflate should r..." */, 0) 2630 libc.Xexit(tls, 1) 2631 } 2632 err = z.XdeflateEnd(tls, bp+48 /* &c_stream */) 2633 { 2634 if err != 0 { 2635 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+380 /* "deflateEnd" */, err)) 2636 libc.Xexit(tls, 1) 2637 } 2638 } 2639 2640 } 2641 2642 // =========================================================================== 2643 // Test inflate() with a preset dictionary 2644 func test_dict_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:494:6: */ 2645 bp := tls.Alloc(168) 2646 defer tls.Free(168) 2647 2648 var err int32 2649 // var d_stream z_stream at bp+56, 112 2650 // decompression stream 2651 2652 libc.Xstrcpy(tls, uncompr, ts+43 /* "garbage" */) 2653 2654 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc 2655 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree 2656 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0) 2657 2658 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr 2659 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(comprLen) 2660 2661 err = z.XinflateInit_(tls, bp+56 /* &d_stream */, ts+353 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{}))) 2662 { 2663 if err != 0 { 2664 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp, ts+391 /* "inflateInit" */, err)) 2665 libc.Xexit(tls, 1) 2666 } 2667 } 2668 2669 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr 2670 (*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_out = uInt(uncomprLen) 2671 2672 for { 2673 err = z.Xinflate(tls, bp+56 /* &d_stream */, 0) 2674 if err == 1 { 2675 break 2676 } 2677 if err == 2 { 2678 if (*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).adler != dictId { 2679 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+660 /* "unexpected dicti..." */, 0) 2680 libc.Xexit(tls, 1) 2681 } 2682 err = z.XinflateSetDictionary(tls, bp+56 /* &d_stream */, uintptr(uintptr(unsafe.Pointer(&dictionary))), 2683 uint32(int32(unsafe.Sizeof(dictionary)))) 2684 } 2685 { 2686 if err != 0 { 2687 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+16, ts+682 /* "inflate with dic..." */, err)) 2688 libc.Xexit(tls, 1) 2689 } 2690 } 2691 2692 } 2693 2694 err = z.XinflateEnd(tls, bp+56 /* &d_stream */) 2695 { 2696 if err != 0 { 2697 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+20 /* "%s error: %d\n" */, libc.VaList(bp+32, ts+411 /* "inflateEnd" */, err)) 2698 libc.Xexit(tls, 1) 2699 } 2700 } 2701 2702 if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 { 2703 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+700 /* "bad inflate with..." */, 0) 2704 libc.Xexit(tls, 1) 2705 } else { 2706 libc.Xprintf(tls, ts+723 /* "inflate with dic..." */, libc.VaList(bp+48, uncompr)) 2707 } 2708 } 2709 2710 // =========================================================================== 2711 // Usage: example [output.gz [input.gz]] 2712 2713 func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* example.c:545:5: */ 2714 bp := tls.Alloc(32) 2715 defer tls.Free(32) 2716 2717 var compr uintptr 2718 var uncompr uintptr 2719 *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) = (uint64(10000) * uint64(unsafe.Sizeof(int32(0)))) // don't overflow on MSDOS 2720 var uncomprLen uLong = *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) 2721 2722 if int32(*(*int8)(unsafe.Pointer(z.XzlibVersion(tls)))) != int32(*(*int8)(unsafe.Pointer(myVersion))) { 2723 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+752 /* "incompatible zli..." */, 0) 2724 libc.Xexit(tls, 1) 2725 2726 } else if libc.Xstrcmp(tls, z.XzlibVersion(tls), ts+353 /* "1.2.11" */) != 0 { 2727 libc.Xfprintf(tls, (uintptr(unsafe.Pointer(&libc.X__sF)) + 2*152), ts+779 /* "warning: differe..." */, 0) 2728 } 2729 2730 libc.Xprintf(tls, ts+812, /* "zlib version %s ..." */ 2731 libc.VaList(bp, ts+353 /* "1.2.11" */, 0x12b0, z.XzlibCompileFlags(tls))) 2732 2733 compr = libc.Xcalloc(tls, uint64(uInt(*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)))), uint64(1)) 2734 uncompr = libc.Xcalloc(tls, uint64(uInt(uncomprLen)), uint64(1)) 2735 // compr and uncompr are cleared to avoid reading uninitialized 2736 // data and to ensure that uncompr compresses well. 2737 if (compr == uintptr(0)) || (uncompr == uintptr(0)) { 2738 libc.Xprintf(tls, ts+861 /* "out of memory\n" */, 0) 2739 libc.Xexit(tls, 1) 2740 } 2741 2742 test_compress(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen) 2743 2744 test_gzio(tls, func() uintptr { 2745 if argc > 1 { 2746 return *(*uintptr)(unsafe.Pointer(argv + 1*8)) 2747 } 2748 return ts + 876 /* "foo.gz" */ 2749 }(), 2750 uncompr, uncomprLen) 2751 2752 test_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */))) 2753 test_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen) 2754 2755 test_large_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen) 2756 test_large_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen) 2757 2758 test_flush(tls, compr, bp+24 /* &comprLen */) 2759 test_sync(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen) 2760 *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) = uncomprLen 2761 2762 test_dict_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */))) 2763 test_dict_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen) 2764 2765 libc.Xfree(tls, compr) 2766 libc.Xfree(tls, uncompr) 2767 2768 return 0 2769 } 2770 2771 var myVersion uintptr = ts + 353 /* "1.2.11" */ /* example.c:552:22 */ 2772 2773 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" 2774 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data