goscript 0.0.50 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/analysis.go +513 -325
- package/compiler/compiler.go +39 -6
- package/compiler/expr-call-async.go +90 -23
- package/compiler/expr.go +0 -44
- package/compiler/sanitize.go +1 -2
- package/compiler/spec-struct.go +3 -3
- package/compiler/spec.go +0 -21
- package/compiler/stmt-assign.go +0 -6
- package/compiler/stmt-select.go +52 -1
- package/compiler/type-assert.go +6 -6
- package/compiler/type.go +3 -3
- package/dist/gs/builtin/builtin.d.ts +0 -1
- package/dist/gs/builtin/builtin.js +0 -9
- package/dist/gs/builtin/builtin.js.map +1 -1
- package/dist/gs/builtin/channel.d.ts +5 -3
- package/dist/gs/builtin/channel.js +14 -17
- package/dist/gs/builtin/channel.js.map +1 -1
- package/dist/gs/context/context.js +2 -2
- package/dist/gs/context/context.js.map +1 -1
- package/dist/gs/runtime/runtime.d.ts +1 -1
- package/dist/gs/runtime/runtime.js +1 -1
- package/dist/gs/syscall/constants.d.ts +24 -0
- package/dist/gs/syscall/constants.js +27 -0
- package/dist/gs/syscall/constants.js.map +1 -0
- package/dist/gs/syscall/env.d.ts +6 -0
- package/dist/gs/syscall/env.js +43 -0
- package/dist/gs/syscall/env.js.map +1 -0
- package/dist/gs/syscall/errors.d.ts +111 -0
- package/dist/gs/syscall/errors.js +547 -0
- package/dist/gs/syscall/errors.js.map +1 -0
- package/dist/gs/syscall/fs.d.ts +29 -0
- package/dist/gs/syscall/fs.js +53 -0
- package/dist/gs/syscall/fs.js.map +1 -0
- package/dist/gs/syscall/index.d.ts +6 -80
- package/dist/gs/syscall/index.js +12 -168
- package/dist/gs/syscall/index.js.map +1 -1
- package/dist/gs/syscall/rawconn.d.ts +7 -0
- package/dist/gs/syscall/rawconn.js +19 -0
- package/dist/gs/syscall/rawconn.js.map +1 -0
- package/dist/gs/syscall/types.d.ts +12 -0
- package/dist/gs/syscall/types.js +2 -0
- package/dist/gs/syscall/types.js.map +1 -0
- package/dist/gs/time/time.d.ts +2 -2
- package/dist/gs/time/time.js +12 -9
- package/dist/gs/time/time.js.map +1 -1
- package/go.mod +1 -1
- package/gs/builtin/builtin.ts +0 -11
- package/gs/builtin/channel.ts +39 -17
- package/gs/context/context.ts +6 -2
- package/gs/context/meta.json +16 -0
- package/gs/runtime/runtime.ts +1 -1
- package/gs/syscall/constants.ts +29 -0
- package/gs/syscall/env.ts +47 -0
- package/gs/syscall/errors.ts +658 -0
- package/gs/syscall/fs.ts +62 -0
- package/gs/syscall/index.ts +12 -207
- package/gs/syscall/rawconn.ts +23 -0
- package/gs/syscall/types.ts +18 -0
- package/gs/time/meta.json +6 -0
- package/gs/time/time.ts +16 -13
- package/gs/unicode/meta.json +24 -0
- package/package.json +1 -1
- package/gs/unicode/unicode.go +0 -38
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
import * as $ from '@goscript/builtin/index.js'
|
|
2
|
+
import { Errno } from './types.js'
|
|
3
|
+
|
|
4
|
+
export const EPERM: Errno = {
|
|
5
|
+
Error: () => 'operation not permitted',
|
|
6
|
+
Is: (target: $.GoError) => target === EPERM,
|
|
7
|
+
Errno: () => 1,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ENOENT: Errno = {
|
|
11
|
+
Error: () => 'no such file or directory',
|
|
12
|
+
Is: (target: $.GoError) => target === ENOENT,
|
|
13
|
+
Errno: () => 2,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ESRCH: Errno = {
|
|
17
|
+
Error: () => 'no such process',
|
|
18
|
+
Is: (target: $.GoError) => target === ESRCH,
|
|
19
|
+
Errno: () => 3,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const EINTR: Errno = {
|
|
23
|
+
Error: () => 'interrupted system call',
|
|
24
|
+
Is: (target: $.GoError) => target === EINTR,
|
|
25
|
+
Errno: () => 4,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const EIO: Errno = {
|
|
29
|
+
Error: () => 'I/O error',
|
|
30
|
+
Is: (target: $.GoError) => target === EIO,
|
|
31
|
+
Errno: () => 5,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const ENXIO: Errno = {
|
|
35
|
+
Error: () => 'no such device or address',
|
|
36
|
+
Is: (target: $.GoError) => target === ENXIO,
|
|
37
|
+
Errno: () => 6,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const E2BIG: Errno = {
|
|
41
|
+
Error: () => 'argument list too long',
|
|
42
|
+
Is: (target: $.GoError) => target === E2BIG,
|
|
43
|
+
Errno: () => 7,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const ENOEXEC: Errno = {
|
|
47
|
+
Error: () => 'exec format error',
|
|
48
|
+
Is: (target: $.GoError) => target === ENOEXEC,
|
|
49
|
+
Errno: () => 8,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const EBADF: Errno = {
|
|
53
|
+
Error: () => 'bad file number',
|
|
54
|
+
Is: (target: $.GoError) => target === EBADF,
|
|
55
|
+
Errno: () => 9,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const ECHILD: Errno = {
|
|
59
|
+
Error: () => 'no child processes',
|
|
60
|
+
Is: (target: $.GoError) => target === ECHILD,
|
|
61
|
+
Errno: () => 10,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const EAGAIN: Errno = {
|
|
65
|
+
Error: () => 'try again',
|
|
66
|
+
Is: (target: $.GoError) => target === EAGAIN,
|
|
67
|
+
Errno: () => 11,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const ENOMEM: Errno = {
|
|
71
|
+
Error: () => 'out of memory',
|
|
72
|
+
Is: (target: $.GoError) => target === ENOMEM,
|
|
73
|
+
Errno: () => 12,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const EACCES: Errno = {
|
|
77
|
+
Error: () => 'permission denied',
|
|
78
|
+
Is: (target: $.GoError) => target === EACCES,
|
|
79
|
+
Errno: () => 13,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const EFAULT: Errno = {
|
|
83
|
+
Error: () => 'bad address',
|
|
84
|
+
Is: (target: $.GoError) => target === EFAULT,
|
|
85
|
+
Errno: () => 14,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const EBUSY: Errno = {
|
|
89
|
+
Error: () => 'device or resource busy',
|
|
90
|
+
Is: (target: $.GoError) => target === EBUSY,
|
|
91
|
+
Errno: () => 16,
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const EEXIST: Errno = {
|
|
95
|
+
Error: () => 'file exists',
|
|
96
|
+
Is: (target: $.GoError) => target === EEXIST,
|
|
97
|
+
Errno: () => 17,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const EXDEV: Errno = {
|
|
101
|
+
Error: () => 'cross-device link',
|
|
102
|
+
Is: (target: $.GoError) => target === EXDEV,
|
|
103
|
+
Errno: () => 18,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const ENODEV: Errno = {
|
|
107
|
+
Error: () => 'no such device',
|
|
108
|
+
Is: (target: $.GoError) => target === ENODEV,
|
|
109
|
+
Errno: () => 19,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const ENOTDIR: Errno = {
|
|
113
|
+
Error: () => 'not a directory',
|
|
114
|
+
Is: (target: $.GoError) => target === ENOTDIR,
|
|
115
|
+
Errno: () => 20,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const EISDIR: Errno = {
|
|
119
|
+
Error: () => 'is a directory',
|
|
120
|
+
Is: (target: $.GoError) => target === EISDIR,
|
|
121
|
+
Errno: () => 21,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const EINVAL: Errno = {
|
|
125
|
+
Error: () => 'invalid argument',
|
|
126
|
+
Is: (target: $.GoError) => target === EINVAL,
|
|
127
|
+
Errno: () => 22,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const ENFILE: Errno = {
|
|
131
|
+
Error: () => 'file table overflow',
|
|
132
|
+
Is: (target: $.GoError) => target === ENFILE,
|
|
133
|
+
Errno: () => 23,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const EMFILE: Errno = {
|
|
137
|
+
Error: () => 'too many open files',
|
|
138
|
+
Is: (target: $.GoError) => target === EMFILE,
|
|
139
|
+
Errno: () => 24,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export const ENOTTY: Errno = {
|
|
143
|
+
Error: () => 'not a typewriter',
|
|
144
|
+
Is: (target: $.GoError) => target === ENOTTY,
|
|
145
|
+
Errno: () => 25,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const EFBIG: Errno = {
|
|
149
|
+
Error: () => 'file too large',
|
|
150
|
+
Is: (target: $.GoError) => target === EFBIG,
|
|
151
|
+
Errno: () => 27,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const ENOSPC: Errno = {
|
|
155
|
+
Error: () => 'no space left on device',
|
|
156
|
+
Is: (target: $.GoError) => target === ENOSPC,
|
|
157
|
+
Errno: () => 28,
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export const ESPIPE: Errno = {
|
|
161
|
+
Error: () => 'illegal seek',
|
|
162
|
+
Is: (target: $.GoError) => target === ESPIPE,
|
|
163
|
+
Errno: () => 29,
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const EROFS: Errno = {
|
|
167
|
+
Error: () => 'read-only file system',
|
|
168
|
+
Is: (target: $.GoError) => target === EROFS,
|
|
169
|
+
Errno: () => 30,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const EMLINK: Errno = {
|
|
173
|
+
Error: () => 'too many links',
|
|
174
|
+
Is: (target: $.GoError) => target === EMLINK,
|
|
175
|
+
Errno: () => 31,
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const EPIPE: Errno = {
|
|
179
|
+
Error: () => 'broken pipe',
|
|
180
|
+
Is: (target: $.GoError) => target === EPIPE,
|
|
181
|
+
Errno: () => 32,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export const EDOM: Errno = {
|
|
185
|
+
Error: () => 'math arg out of domain of func',
|
|
186
|
+
Is: (target: $.GoError) => target === EDOM,
|
|
187
|
+
Errno: () => 33,
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export const ERANGE: Errno = {
|
|
191
|
+
Error: () => 'result too large',
|
|
192
|
+
Is: (target: $.GoError) => target === ERANGE,
|
|
193
|
+
Errno: () => 34,
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export const EDEADLK: Errno = {
|
|
197
|
+
Error: () => 'deadlock condition',
|
|
198
|
+
Is: (target: $.GoError) => target === EDEADLK,
|
|
199
|
+
Errno: () => 35,
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const ENAMETOOLONG: Errno = {
|
|
203
|
+
Error: () => 'file name too long',
|
|
204
|
+
Is: (target: $.GoError) => target === ENAMETOOLONG,
|
|
205
|
+
Errno: () => 36,
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export const ENOLCK: Errno = {
|
|
209
|
+
Error: () => 'no record locks available',
|
|
210
|
+
Is: (target: $.GoError) => target === ENOLCK,
|
|
211
|
+
Errno: () => 37,
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export const ENOSYS: Errno = {
|
|
215
|
+
Error: () => 'function not implemented',
|
|
216
|
+
Is: (target: $.GoError) => target === ENOSYS,
|
|
217
|
+
Errno: () => 38,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export const ENOTEMPTY: Errno = {
|
|
221
|
+
Error: () => 'directory not empty',
|
|
222
|
+
Is: (target: $.GoError) => target === ENOTEMPTY,
|
|
223
|
+
Errno: () => 39,
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export const ELOOP: Errno = {
|
|
227
|
+
Error: () => 'too many symbolic links',
|
|
228
|
+
Is: (target: $.GoError) => target === ELOOP,
|
|
229
|
+
Errno: () => 40,
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export const ENOMSG: Errno = {
|
|
233
|
+
Error: () => 'no message of desired type',
|
|
234
|
+
Is: (target: $.GoError) => target === ENOMSG,
|
|
235
|
+
Errno: () => 42,
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export const EIDRM: Errno = {
|
|
239
|
+
Error: () => 'identifier removed',
|
|
240
|
+
Is: (target: $.GoError) => target === EIDRM,
|
|
241
|
+
Errno: () => 43,
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export const ECHRNG: Errno = {
|
|
245
|
+
Error: () => 'channel number out of range',
|
|
246
|
+
Is: (target: $.GoError) => target === ECHRNG,
|
|
247
|
+
Errno: () => 44,
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export const EL2NSYNC: Errno = {
|
|
251
|
+
Error: () => 'level 2 not synchronized',
|
|
252
|
+
Is: (target: $.GoError) => target === EL2NSYNC,
|
|
253
|
+
Errno: () => 45,
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export const EL3HLT: Errno = {
|
|
257
|
+
Error: () => 'level 3 halted',
|
|
258
|
+
Is: (target: $.GoError) => target === EL3HLT,
|
|
259
|
+
Errno: () => 46,
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export const EL3RST: Errno = {
|
|
263
|
+
Error: () => 'level 3 reset',
|
|
264
|
+
Is: (target: $.GoError) => target === EL3RST,
|
|
265
|
+
Errno: () => 47,
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export const ELNRNG: Errno = {
|
|
269
|
+
Error: () => 'link number out of range',
|
|
270
|
+
Is: (target: $.GoError) => target === ELNRNG,
|
|
271
|
+
Errno: () => 48,
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export const EUNATCH: Errno = {
|
|
275
|
+
Error: () => 'protocol driver not attached',
|
|
276
|
+
Is: (target: $.GoError) => target === EUNATCH,
|
|
277
|
+
Errno: () => 49,
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export const ENOCSI: Errno = {
|
|
281
|
+
Error: () => 'no CSI structure available',
|
|
282
|
+
Is: (target: $.GoError) => target === ENOCSI,
|
|
283
|
+
Errno: () => 50,
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export const EL2HLT: Errno = {
|
|
287
|
+
Error: () => 'level 2 halted',
|
|
288
|
+
Is: (target: $.GoError) => target === EL2HLT,
|
|
289
|
+
Errno: () => 51,
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export const EBADE: Errno = {
|
|
293
|
+
Error: () => 'invalid exchange',
|
|
294
|
+
Is: (target: $.GoError) => target === EBADE,
|
|
295
|
+
Errno: () => 52,
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export const EBADR: Errno = {
|
|
299
|
+
Error: () => 'invalid request descriptor',
|
|
300
|
+
Is: (target: $.GoError) => target === EBADR,
|
|
301
|
+
Errno: () => 53,
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export const EXFULL: Errno = {
|
|
305
|
+
Error: () => 'exchange full',
|
|
306
|
+
Is: (target: $.GoError) => target === EXFULL,
|
|
307
|
+
Errno: () => 54,
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export const ENOANO: Errno = {
|
|
311
|
+
Error: () => 'no anode',
|
|
312
|
+
Is: (target: $.GoError) => target === ENOANO,
|
|
313
|
+
Errno: () => 55,
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export const EBADRQC: Errno = {
|
|
317
|
+
Error: () => 'invalid request code',
|
|
318
|
+
Is: (target: $.GoError) => target === EBADRQC,
|
|
319
|
+
Errno: () => 56,
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export const EBADSLT: Errno = {
|
|
323
|
+
Error: () => 'invalid slot',
|
|
324
|
+
Is: (target: $.GoError) => target === EBADSLT,
|
|
325
|
+
Errno: () => 57,
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export const EDEADLOCK: Errno = EDEADLK // File locking deadlock error
|
|
329
|
+
|
|
330
|
+
export const EBFONT: Errno = {
|
|
331
|
+
Error: () => 'bad font file fmt',
|
|
332
|
+
Is: (target: $.GoError) => target === EBFONT,
|
|
333
|
+
Errno: () => 59,
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export const ENOSTR: Errno = {
|
|
337
|
+
Error: () => 'device not a stream',
|
|
338
|
+
Is: (target: $.GoError) => target === ENOSTR,
|
|
339
|
+
Errno: () => 60,
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export const ENODATA: Errno = {
|
|
343
|
+
Error: () => 'no data (for no delay io)',
|
|
344
|
+
Is: (target: $.GoError) => target === ENODATA,
|
|
345
|
+
Errno: () => 61,
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export const ETIME: Errno = {
|
|
349
|
+
Error: () => 'timer expired',
|
|
350
|
+
Is: (target: $.GoError) => target === ETIME,
|
|
351
|
+
Errno: () => 62,
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export const ENOSR: Errno = {
|
|
355
|
+
Error: () => 'out of streams resources',
|
|
356
|
+
Is: (target: $.GoError) => target === ENOSR,
|
|
357
|
+
Errno: () => 63,
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export const ENONET: Errno = {
|
|
361
|
+
Error: () => 'machine is not on the network',
|
|
362
|
+
Is: (target: $.GoError) => target === ENONET,
|
|
363
|
+
Errno: () => 64,
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export const ENOPKG: Errno = {
|
|
367
|
+
Error: () => 'package not installed',
|
|
368
|
+
Is: (target: $.GoError) => target === ENOPKG,
|
|
369
|
+
Errno: () => 65,
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export const EREMOTE: Errno = {
|
|
373
|
+
Error: () => 'the object is remote',
|
|
374
|
+
Is: (target: $.GoError) => target === EREMOTE,
|
|
375
|
+
Errno: () => 66,
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export const ENOLINK: Errno = {
|
|
379
|
+
Error: () => 'the link has been severed',
|
|
380
|
+
Is: (target: $.GoError) => target === ENOLINK,
|
|
381
|
+
Errno: () => 67,
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export const EADV: Errno = {
|
|
385
|
+
Error: () => 'advertise error',
|
|
386
|
+
Is: (target: $.GoError) => target === EADV,
|
|
387
|
+
Errno: () => 68,
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export const ESRMNT: Errno = {
|
|
391
|
+
Error: () => 'srmount error',
|
|
392
|
+
Is: (target: $.GoError) => target === ESRMNT,
|
|
393
|
+
Errno: () => 69,
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export const ECOMM: Errno = {
|
|
397
|
+
Error: () => 'communication error on send',
|
|
398
|
+
Is: (target: $.GoError) => target === ECOMM,
|
|
399
|
+
Errno: () => 70,
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export const EPROTO: Errno = {
|
|
403
|
+
Error: () => 'protocol error',
|
|
404
|
+
Is: (target: $.GoError) => target === EPROTO,
|
|
405
|
+
Errno: () => 71,
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export const EMULTIHOP: Errno = {
|
|
409
|
+
Error: () => 'multihop attempted',
|
|
410
|
+
Is: (target: $.GoError) => target === EMULTIHOP,
|
|
411
|
+
Errno: () => 72,
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export const EDOTDOT: Errno = {
|
|
415
|
+
Error: () => 'cross mount point (not really error)',
|
|
416
|
+
Is: (target: $.GoError) => target === EDOTDOT,
|
|
417
|
+
Errno: () => 73,
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export const EBADMSG: Errno = {
|
|
421
|
+
Error: () => 'trying to read unreadable message',
|
|
422
|
+
Is: (target: $.GoError) => target === EBADMSG,
|
|
423
|
+
Errno: () => 74,
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export const EOVERFLOW: Errno = {
|
|
427
|
+
Error: () => 'value too large for defined data type',
|
|
428
|
+
Is: (target: $.GoError) => target === EOVERFLOW,
|
|
429
|
+
Errno: () => 75,
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
export const ENOTUNIQ: Errno = {
|
|
433
|
+
Error: () => 'given log. name not unique',
|
|
434
|
+
Is: (target: $.GoError) => target === ENOTUNIQ,
|
|
435
|
+
Errno: () => 76,
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export const EBADFD: Errno = {
|
|
439
|
+
Error: () => 'f.d. invalid for this operation',
|
|
440
|
+
Is: (target: $.GoError) => target === EBADFD,
|
|
441
|
+
Errno: () => 77,
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export const EREMCHG: Errno = {
|
|
445
|
+
Error: () => 'remote address changed',
|
|
446
|
+
Is: (target: $.GoError) => target === EREMCHG,
|
|
447
|
+
Errno: () => 78,
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export const ELIBACC: Errno = {
|
|
451
|
+
Error: () => "can't access a needed shared lib",
|
|
452
|
+
Is: (target: $.GoError) => target === ELIBACC,
|
|
453
|
+
Errno: () => 79,
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export const ELIBBAD: Errno = {
|
|
457
|
+
Error: () => 'accessing a corrupted shared lib',
|
|
458
|
+
Is: (target: $.GoError) => target === ELIBBAD,
|
|
459
|
+
Errno: () => 80,
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export const ELIBSCN: Errno = {
|
|
463
|
+
Error: () => '.lib section in a.out corrupted',
|
|
464
|
+
Is: (target: $.GoError) => target === ELIBSCN,
|
|
465
|
+
Errno: () => 81,
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export const ELIBMAX: Errno = {
|
|
469
|
+
Error: () => 'attempting to link in too many libs',
|
|
470
|
+
Is: (target: $.GoError) => target === ELIBMAX,
|
|
471
|
+
Errno: () => 82,
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export const ELIBEXEC: Errno = {
|
|
475
|
+
Error: () => 'attempting to exec a shared library',
|
|
476
|
+
Is: (target: $.GoError) => target === ELIBEXEC,
|
|
477
|
+
Errno: () => 83,
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export const EILSEQ: Errno = {
|
|
481
|
+
Error: () => 'illegal byte sequence',
|
|
482
|
+
Is: (target: $.GoError) => target === EILSEQ,
|
|
483
|
+
Errno: () => 84,
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export const EUSERS: Errno = {
|
|
487
|
+
Error: () => 'too many users',
|
|
488
|
+
Is: (target: $.GoError) => target === EUSERS,
|
|
489
|
+
Errno: () => 87,
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export const ENOTSOCK: Errno = {
|
|
493
|
+
Error: () => 'socket operation on non-socket',
|
|
494
|
+
Is: (target: $.GoError) => target === ENOTSOCK,
|
|
495
|
+
Errno: () => 88,
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
export const EDESTADDRREQ: Errno = {
|
|
499
|
+
Error: () => 'destination address required',
|
|
500
|
+
Is: (target: $.GoError) => target === EDESTADDRREQ,
|
|
501
|
+
Errno: () => 89,
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export const EMSGSIZE: Errno = {
|
|
505
|
+
Error: () => 'message too long',
|
|
506
|
+
Is: (target: $.GoError) => target === EMSGSIZE,
|
|
507
|
+
Errno: () => 90,
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
export const EPROTOTYPE: Errno = {
|
|
511
|
+
Error: () => 'protocol wrong type for socket',
|
|
512
|
+
Is: (target: $.GoError) => target === EPROTOTYPE,
|
|
513
|
+
Errno: () => 91,
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export const ENOPROTOOPT: Errno = {
|
|
517
|
+
Error: () => 'protocol not available',
|
|
518
|
+
Is: (target: $.GoError) => target === ENOPROTOOPT,
|
|
519
|
+
Errno: () => 92,
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export const EPROTONOSUPPORT: Errno = {
|
|
523
|
+
Error: () => 'unknown protocol',
|
|
524
|
+
Is: (target: $.GoError) => target === EPROTONOSUPPORT,
|
|
525
|
+
Errno: () => 93,
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export const ESOCKTNOSUPPORT: Errno = {
|
|
529
|
+
Error: () => 'socket type not supported',
|
|
530
|
+
Is: (target: $.GoError) => target === ESOCKTNOSUPPORT,
|
|
531
|
+
Errno: () => 94,
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export const EOPNOTSUPP: Errno = {
|
|
535
|
+
Error: () => 'operation not supported on transport endpoint',
|
|
536
|
+
Is: (target: $.GoError) => target === EOPNOTSUPP,
|
|
537
|
+
Errno: () => 95,
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export const EPFNOSUPPORT: Errno = {
|
|
541
|
+
Error: () => 'protocol family not supported',
|
|
542
|
+
Is: (target: $.GoError) => target === EPFNOSUPPORT,
|
|
543
|
+
Errno: () => 96,
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export const EAFNOSUPPORT: Errno = {
|
|
547
|
+
Error: () => 'address family not supported by protocol family',
|
|
548
|
+
Is: (target: $.GoError) => target === EAFNOSUPPORT,
|
|
549
|
+
Errno: () => 97,
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export const EADDRINUSE: Errno = {
|
|
553
|
+
Error: () => 'address already in use',
|
|
554
|
+
Is: (target: $.GoError) => target === EADDRINUSE,
|
|
555
|
+
Errno: () => 98,
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export const EADDRNOTAVAIL: Errno = {
|
|
559
|
+
Error: () => 'address not available',
|
|
560
|
+
Is: (target: $.GoError) => target === EADDRNOTAVAIL,
|
|
561
|
+
Errno: () => 99,
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export const ENETDOWN: Errno = {
|
|
565
|
+
Error: () => 'network interface is not configured',
|
|
566
|
+
Is: (target: $.GoError) => target === ENETDOWN,
|
|
567
|
+
Errno: () => 100,
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export const ENETUNREACH: Errno = {
|
|
571
|
+
Error: () => 'network is unreachable',
|
|
572
|
+
Is: (target: $.GoError) => target === ENETUNREACH,
|
|
573
|
+
Errno: () => 101,
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export const ENETRESET: Errno = {
|
|
577
|
+
Error: () => 'network dropped connection because of reset',
|
|
578
|
+
Is: (target: $.GoError) => target === ENETRESET,
|
|
579
|
+
Errno: () => 102,
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export const ECONNABORTED: Errno = {
|
|
583
|
+
Error: () => 'connection aborted',
|
|
584
|
+
Is: (target: $.GoError) => target === ECONNABORTED,
|
|
585
|
+
Errno: () => 103,
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export const ECONNRESET: Errno = {
|
|
589
|
+
Error: () => 'connection reset by peer',
|
|
590
|
+
Is: (target: $.GoError) => target === ECONNRESET,
|
|
591
|
+
Errno: () => 104,
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export const ENOBUFS: Errno = {
|
|
595
|
+
Error: () => 'no buffer space available',
|
|
596
|
+
Is: (target: $.GoError) => target === ENOBUFS,
|
|
597
|
+
Errno: () => 105,
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export const EISCONN: Errno = {
|
|
601
|
+
Error: () => 'socket is already connected',
|
|
602
|
+
Is: (target: $.GoError) => target === EISCONN,
|
|
603
|
+
Errno: () => 106,
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export const ENOTCONN: Errno = {
|
|
607
|
+
Error: () => 'socket is not connected',
|
|
608
|
+
Is: (target: $.GoError) => target === ENOTCONN,
|
|
609
|
+
Errno: () => 107,
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export const ESHUTDOWN: Errno = {
|
|
613
|
+
Error: () => "can't send after socket shutdown",
|
|
614
|
+
Is: (target: $.GoError) => target === ESHUTDOWN,
|
|
615
|
+
Errno: () => 108,
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export const ETOOMANYREFS: Errno = {
|
|
619
|
+
Error: () => 'too many references: cannot splice',
|
|
620
|
+
Is: (target: $.GoError) => target === ETOOMANYREFS,
|
|
621
|
+
Errno: () => 109,
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export const ETIMEDOUT: Errno = {
|
|
625
|
+
Error: () => 'connection timed out',
|
|
626
|
+
Is: (target: $.GoError) => target === ETIMEDOUT,
|
|
627
|
+
Errno: () => 110,
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export const ECONNREFUSED: Errno = {
|
|
631
|
+
Error: () => 'connection refused',
|
|
632
|
+
Is: (target: $.GoError) => target === ECONNREFUSED,
|
|
633
|
+
Errno: () => 111,
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export const EHOSTDOWN: Errno = {
|
|
637
|
+
Error: () => 'host is down',
|
|
638
|
+
Is: (target: $.GoError) => target === EHOSTDOWN,
|
|
639
|
+
Errno: () => 112,
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export const EHOSTUNREACH: Errno = {
|
|
643
|
+
Error: () => 'host is unreachable',
|
|
644
|
+
Is: (target: $.GoError) => target === EHOSTUNREACH,
|
|
645
|
+
Errno: () => 113,
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
export const EALREADY: Errno = {
|
|
649
|
+
Error: () => 'socket already connected',
|
|
650
|
+
Is: (target: $.GoError) => target === EALREADY,
|
|
651
|
+
Errno: () => 114,
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export const EDQUOT: Errno = {
|
|
655
|
+
Error: () => 'quota exceeded',
|
|
656
|
+
Is: (target: $.GoError) => target === EDQUOT,
|
|
657
|
+
Errno: () => 122,
|
|
658
|
+
}
|
package/gs/syscall/fs.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as $ from '@goscript/builtin/index.js'
|
|
2
|
+
import { ENOSYS } from './errors.js'
|
|
3
|
+
|
|
4
|
+
// Dirent structure with Reclen field
|
|
5
|
+
export class Dirent {
|
|
6
|
+
public Name: $.Bytes = new Uint8Array(0)
|
|
7
|
+
public Reclen: number = 0
|
|
8
|
+
constructor(init?: any) {
|
|
9
|
+
if (init?.Name) this.Name = init.Name
|
|
10
|
+
if (init?.Reclen) this.Reclen = init.Reclen
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Stat_t structure stub
|
|
15
|
+
export class Stat_t {
|
|
16
|
+
public Dev: number = 0
|
|
17
|
+
public Ino: number = 0
|
|
18
|
+
public Mode: number = 0
|
|
19
|
+
public Nlink: number = 0
|
|
20
|
+
public Uid: number = 0
|
|
21
|
+
public Gid: number = 0
|
|
22
|
+
public Rdev: number = 0
|
|
23
|
+
public Size: number = 0
|
|
24
|
+
public Blksize: number = 0
|
|
25
|
+
public Blocks: number = 0
|
|
26
|
+
public Atime: number = 0
|
|
27
|
+
public Mtime: number = 0
|
|
28
|
+
public Ctime: number = 0
|
|
29
|
+
public AtimeNsec: number = 0
|
|
30
|
+
public MtimeNsec: number = 0
|
|
31
|
+
public CtimeNsec: number = 0
|
|
32
|
+
|
|
33
|
+
constructor(init?: any) {
|
|
34
|
+
if (init) {
|
|
35
|
+
Object.assign(this, init)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public clone(): Stat_t {
|
|
40
|
+
return new Stat_t(this)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Additional missing syscall functions
|
|
45
|
+
export function Open(
|
|
46
|
+
_path: string,
|
|
47
|
+
_flag: number,
|
|
48
|
+
_perm: number,
|
|
49
|
+
): [number, $.GoError] {
|
|
50
|
+
return [-1, ENOSYS]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function Sysctl(_name: string): [string, $.GoError] {
|
|
54
|
+
return ['', ENOSYS]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Getpagesize returns the underlying system's memory page size.
|
|
58
|
+
export function Getpagesize(): number {
|
|
59
|
+
// Return a standard page size for JavaScript environment
|
|
60
|
+
// Most systems use 4096 bytes as the default page size
|
|
61
|
+
return 4096
|
|
62
|
+
}
|