-
Notifications
You must be signed in to change notification settings - Fork 0
/
zlib.h.js
287 lines (280 loc) · 9.18 KB
/
zlib.h.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/*
* This file was automatically generated. It is better to run the generator again, than to manually edit.
*
* @ffi-packager/ffi-generate v2.0.2
* - git commit v2.0.1-1-g2b4030d on branch develop
* - clang version 9.0.1-16
* https://github.com/node-ffi-packager/node-ffi-generate
*
* File:
* - Name: "zlib.h"
* - SHA256: 4ddc82b4af931ab55f44d977bde81bfbc4151b5dcdccc03142831a301b5ec3c8
*
* Generator options:
* - Library: null
* - Single file: true
* - Prefixes: []
* - Compiler arguments: []
*/
const FFI = require("ffi-napi");
const ref = require("ref-napi");
const ArrayType = require("ref-array-di")(ref);
const Struct = require("ref-struct-di")(ref);
const Union = require("ref-union-di")(ref);
const constants = {};
// NOTE: defining individual types as "global" constants to be able to reference them without any prefix.
const types = {};
const js_CString = ref.types.CString;
const js_int32 = ref.types.int32;
const js_uchar = ref.types.uchar;
const Byte = js_uchar;
const Bytef = Byte;
const BytefPointer = ref.refType(Bytef);
const js_uint32 = ref.types.uint32;
const uInt = js_uint32;
const js_ulong = ref.types.ulong;
const uLong = js_ulong;
const js_void = ref.types.void;
const js_voidPointer = ref.refType(js_void);
const internal_state = js_voidPointer;
const alloc_func = FFI.Function(ref.refType(js_void), [
js_voidPointer,
js_uint32,
js_uint32,
]);
const free_func = FFI.Function(ref.types.void, [
js_voidPointer,
js_voidPointer,
]);
const voidpf = js_voidPointer;
const z_stream_s = Struct({
next_in: BytefPointer,
avail_in: uInt,
total_in: uLong,
next_out: BytefPointer,
avail_out: uInt,
total_out: uLong,
msg: js_CString,
state: internal_state,
zalloc: alloc_func,
zfree: free_func,
opaque: voidpf,
data_type: js_int32,
adler: uLong,
reserved: uLong,
});
const z_stream = z_stream_s;
const z_streamPointer = ref.refType(z_stream);
const z_streamp = z_streamPointer;
const uIntPointer = ref.refType(uInt);
const js_uint32Pointer = ref.refType(js_uint32);
const js_int32Pointer = ref.refType(js_int32);
const gz_header_s = Struct({
text: js_int32,
time: uLong,
xflags: js_int32,
os: js_int32,
extra: BytefPointer,
extra_len: uInt,
extra_max: uInt,
name: BytefPointer,
name_max: uInt,
comment: BytefPointer,
comm_max: uInt,
hcrc: js_int32,
done: js_int32,
});
const gz_header = gz_header_s;
const gz_headerPointer = ref.refType(gz_header);
const gz_headerp = gz_headerPointer;
const js_long = ref.types.long;
const js_ucharPointer = ref.refType(js_uchar);
const in_func = FFI.Function(ref.types.uint32, [
js_voidPointer,
js_ucharPointer,
]);
const out_func = FFI.Function(ref.types.int32, [
js_voidPointer,
js_ucharPointer,
js_uint32,
]);
const uLongf = uLong;
const uLongfPointer = ref.refType(uLongf);
const uLongPointer = ref.refType(uLong);
const gzFile_s = js_voidPointer;
const gzFile = gzFile_s;
const voidp = js_voidPointer;
const size_t = js_ulong;
const z_size_t = size_t;
const voidpc = js_voidPointer;
const __off_t = js_long;
const off_t = __off_t;
const z_crc_t = js_uint32;
const z_crc_tPointer = ref.refType(z_crc_t);
const __va_list_tag = Struct({
gp_offset: js_uint32,
fp_offset: js_uint32,
overflow_arg_area: js_voidPointer,
reg_save_area: js_voidPointer,
});
const __va_list_tag_array_1 = ArrayType(__va_list_tag, 1);
const __builtin_va_list = __va_list_tag_array_1;
const va_list = __builtin_va_list;
types["Byte"] = Byte;
types["Bytef"] = Bytef;
types["BytefPointer"] = BytefPointer;
types["__builtin_va_list"] = __builtin_va_list;
types["__off_t"] = __off_t;
types["__va_list_tag"] = __va_list_tag;
types["__va_list_tag_array_1"] = __va_list_tag_array_1;
types["alloc_func"] = alloc_func;
types["free_func"] = free_func;
types["gzFile"] = gzFile;
types["gzFile_s"] = gzFile_s;
types["gz_header"] = gz_header;
types["gz_headerPointer"] = gz_headerPointer;
types["gz_header_s"] = gz_header_s;
types["gz_headerp"] = gz_headerp;
types["in_func"] = in_func;
types["internal_state"] = internal_state;
types["js_CString"] = js_CString;
types["js_int32"] = js_int32;
types["js_int32Pointer"] = js_int32Pointer;
types["js_long"] = js_long;
types["js_uchar"] = js_uchar;
types["js_ucharPointer"] = js_ucharPointer;
types["js_uint32"] = js_uint32;
types["js_uint32Pointer"] = js_uint32Pointer;
types["js_ulong"] = js_ulong;
types["js_void"] = js_void;
types["js_voidPointer"] = js_voidPointer;
types["off_t"] = off_t;
types["out_func"] = out_func;
types["size_t"] = size_t;
types["uInt"] = uInt;
types["uIntPointer"] = uIntPointer;
types["uLong"] = uLong;
types["uLongPointer"] = uLongPointer;
types["uLongf"] = uLongf;
types["uLongfPointer"] = uLongfPointer;
types["va_list"] = va_list;
types["voidp"] = voidp;
types["voidpc"] = voidpc;
types["voidpf"] = voidpf;
types["z_crc_t"] = z_crc_t;
types["z_crc_tPointer"] = z_crc_tPointer;
types["z_size_t"] = z_size_t;
types["z_stream"] = z_stream;
types["z_streamPointer"] = z_streamPointer;
types["z_stream_s"] = z_stream_s;
types["z_streamp"] = z_streamp;
const functions = new FFI.Library(null, {
adler32: [uLong, [uLong, BytefPointer, uInt]],
adler32_combine: [uLong, [uLong, uLong, off_t]],
adler32_z: [uLong, [uLong, BytefPointer, z_size_t]],
compress: [js_int32, [BytefPointer, uLongfPointer, BytefPointer, uLong]],
compress2: [
js_int32,
[BytefPointer, uLongfPointer, BytefPointer, uLong, js_int32],
],
compressBound: [uLong, [uLong]],
crc32: [uLong, [uLong, BytefPointer, uInt]],
crc32_combine: [uLong, [uLong, uLong, off_t]],
crc32_z: [uLong, [uLong, BytefPointer, z_size_t]],
deflate: [js_int32, [z_streamp, js_int32]],
deflateBound: [uLong, [z_streamp, uLong]],
deflateCopy: [js_int32, [z_streamp, z_streamp]],
deflateEnd: [js_int32, [z_streamp]],
deflateGetDictionary: [js_int32, [z_streamp, BytefPointer, uIntPointer]],
deflateInit2_: [
js_int32,
[
z_streamp,
js_int32,
js_int32,
js_int32,
js_int32,
js_int32,
js_CString,
js_int32,
],
],
deflateInit_: [js_int32, [z_streamp, js_int32, js_CString, js_int32]],
deflateParams: [js_int32, [z_streamp, js_int32, js_int32]],
deflatePending: [js_int32, [z_streamp, js_uint32Pointer, js_int32Pointer]],
deflatePrime: [js_int32, [z_streamp, js_int32, js_int32]],
deflateReset: [js_int32, [z_streamp]],
deflateResetKeep: [js_int32, [z_streamp]],
deflateSetDictionary: [js_int32, [z_streamp, BytefPointer, uInt]],
deflateSetHeader: [js_int32, [z_streamp, gz_headerp]],
deflateTune: [js_int32, [z_streamp, js_int32, js_int32, js_int32, js_int32]],
get_crc_table: [z_crc_tPointer, []],
gzbuffer: [js_int32, [gzFile, js_uint32]],
gzclearerr: [js_void, [gzFile]],
gzclose: [js_int32, [gzFile]],
gzclose_r: [js_int32, [gzFile]],
gzclose_w: [js_int32, [gzFile]],
gzdirect: [js_int32, [gzFile]],
gzdopen: [gzFile, [js_int32, js_CString]],
gzeof: [js_int32, [gzFile]],
gzerror: [js_CString, [gzFile, js_int32Pointer]],
gzflush: [js_int32, [gzFile, js_int32]],
gzfread: [z_size_t, [voidp, z_size_t, z_size_t, gzFile]],
gzfwrite: [z_size_t, [voidpc, z_size_t, z_size_t, gzFile]],
gzgetc: [js_int32, [gzFile]],
gzgetc_: [js_int32, [gzFile]],
gzgets: [js_CString, [gzFile, js_CString, js_int32]],
gzoffset: [off_t, [gzFile]],
gzopen: [gzFile, [js_CString, js_CString]],
gzprintf: [js_int32, [gzFile, js_CString]],
gzputc: [js_int32, [gzFile, js_int32]],
gzputs: [js_int32, [gzFile, js_CString]],
gzread: [js_int32, [gzFile, voidp, js_uint32]],
gzrewind: [js_int32, [gzFile]],
gzseek: [off_t, [gzFile, off_t, js_int32]],
gzsetparams: [js_int32, [gzFile, js_int32, js_int32]],
gztell: [off_t, [gzFile]],
gzungetc: [js_int32, [js_int32, gzFile]],
gzvprintf: [js_int32, [gzFile, js_CString, va_list]],
gzwrite: [js_int32, [gzFile, voidpc, js_uint32]],
inflate: [js_int32, [z_streamp, js_int32]],
inflateBack: [
js_int32,
[z_streamp, in_func, js_voidPointer, out_func, js_voidPointer],
],
inflateBackEnd: [js_int32, [z_streamp]],
inflateBackInit_: [
js_int32,
[z_streamp, js_int32, js_ucharPointer, js_CString, js_int32],
],
inflateCodesUsed: [js_ulong, [z_streamp]],
inflateCopy: [js_int32, [z_streamp, z_streamp]],
inflateEnd: [js_int32, [z_streamp]],
inflateGetDictionary: [js_int32, [z_streamp, BytefPointer, uIntPointer]],
inflateGetHeader: [js_int32, [z_streamp, gz_headerp]],
inflateInit2_: [js_int32, [z_streamp, js_int32, js_CString, js_int32]],
inflateInit_: [js_int32, [z_streamp, js_CString, js_int32]],
inflateMark: [js_long, [z_streamp]],
inflatePrime: [js_int32, [z_streamp, js_int32, js_int32]],
inflateReset: [js_int32, [z_streamp]],
inflateReset2: [js_int32, [z_streamp, js_int32]],
inflateResetKeep: [js_int32, [z_streamp]],
inflateSetDictionary: [js_int32, [z_streamp, BytefPointer, uInt]],
inflateSync: [js_int32, [z_streamp]],
inflateSyncPoint: [js_int32, [z_streamp]],
inflateUndermine: [js_int32, [z_streamp, js_int32]],
inflateValidate: [js_int32, [z_streamp, js_int32]],
uncompress: [js_int32, [BytefPointer, uLongfPointer, BytefPointer, uLong]],
uncompress2: [
js_int32,
[BytefPointer, uLongfPointer, BytefPointer, uLongPointer],
],
zError: [js_CString, [js_int32]],
zlibCompileFlags: [uLong, []],
zlibVersion: [js_CString, []],
});
module.exports = {
constants,
types,
functions,
};