@gtkx/runtime 1.6.0 → 2.0.0-beta.2
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/README.md +5 -5
- package/dist/application-class.d.ts +1 -1
- package/dist/application-class.d.ts.map +1 -1
- package/dist/application-class.js +1 -2
- package/dist/application-class.js.map +1 -1
- package/dist/arg.d.ts +4 -1
- package/dist/arg.d.ts.map +1 -1
- package/dist/arg.js.map +1 -1
- package/dist/bind.d.ts.map +1 -1
- package/dist/bind.js +1 -9
- package/dist/bind.js.map +1 -1
- package/dist/callback.d.ts +6 -1
- package/dist/callback.d.ts.map +1 -1
- package/dist/callback.js +33 -21
- package/dist/callback.js.map +1 -1
- package/dist/closure.d.ts +3 -1
- package/dist/closure.d.ts.map +1 -1
- package/dist/closure.js +17 -6
- package/dist/closure.js.map +1 -1
- package/dist/descriptors.d.ts +22 -51
- package/dist/descriptors.d.ts.map +1 -1
- package/dist/descriptors.js +53 -27
- package/dist/descriptors.js.map +1 -1
- package/dist/fn.d.ts.map +1 -1
- package/dist/fn.js +23 -9
- package/dist/fn.js.map +1 -1
- package/dist/folded-lengths.d.ts +2 -1
- package/dist/folded-lengths.d.ts.map +1 -1
- package/dist/folded-lengths.js +17 -7
- package/dist/folded-lengths.js.map +1 -1
- package/dist/index.d.ts +2 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -24
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +18 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +14 -2
- package/dist/internal.js.map +1 -1
- package/dist/listeners.d.ts +3 -13
- package/dist/listeners.d.ts.map +1 -1
- package/dist/listeners.js +12 -12
- package/dist/listeners.js.map +1 -1
- package/dist/mixin.d.ts +5 -3
- package/dist/mixin.d.ts.map +1 -1
- package/dist/mixin.js +36 -9
- package/dist/mixin.js.map +1 -1
- package/dist/native-value.d.ts +9 -1
- package/dist/native-value.d.ts.map +1 -1
- package/dist/native-value.js +20 -3
- package/dist/native-value.js.map +1 -1
- package/dist/object.d.ts +11 -0
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +18 -25
- package/dist/object.js.map +1 -1
- package/dist/properties.d.ts +5 -3
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +67 -23
- package/dist/properties.js.map +1 -1
- package/dist/property-brand.d.ts +5 -0
- package/dist/property-brand.d.ts.map +1 -0
- package/dist/property-brand.js +5 -0
- package/dist/property-brand.js.map +1 -0
- package/dist/register-class.d.ts +142 -264
- package/dist/register-class.d.ts.map +1 -1
- package/dist/register-class.js +19 -37
- package/dist/register-class.js.map +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +4 -4
- package/dist/registry.js.map +1 -1
- package/dist/signal-brand.d.ts +12 -0
- package/dist/signal-brand.d.ts.map +1 -0
- package/dist/signal-brand.js +6 -0
- package/dist/signal-brand.js.map +1 -0
- package/dist/signal.d.ts +39 -2
- package/dist/signal.d.ts.map +1 -1
- package/dist/signal.js +84 -27
- package/dist/signal.js.map +1 -1
- package/dist/t.d.ts +5 -21
- package/dist/t.d.ts.map +1 -1
- package/dist/t.js +1 -5
- package/dist/t.js.map +1 -1
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js +8 -2
- package/dist/type.js.map +1 -1
- package/dist/value.d.ts.map +1 -1
- package/dist/value.js +7 -1
- package/dist/value.js.map +1 -1
- package/dist/variant.d.ts +2 -6
- package/dist/variant.d.ts.map +1 -1
- package/dist/variant.js.map +1 -1
- package/dist/vfunc-call.d.ts.map +1 -1
- package/dist/vfunc-call.js +2 -11
- package/dist/vfunc-call.js.map +1 -1
- package/package.json +9 -5
- package/src/application-class.ts +2 -2
- package/src/arg.ts +4 -1
- package/src/bind.ts +1 -12
- package/src/callback.ts +53 -29
- package/src/closure.ts +31 -6
- package/src/descriptors.ts +95 -59
- package/src/fn.ts +31 -10
- package/src/folded-lengths.ts +23 -10
- package/src/index.ts +2 -24
- package/src/internal.ts +43 -2
- package/src/listeners.ts +21 -26
- package/src/mixin.ts +55 -9
- package/src/native-value.ts +24 -3
- package/src/object.ts +55 -5
- package/src/properties.ts +90 -26
- package/src/property-brand.ts +5 -0
- package/src/register-class.ts +338 -341
- package/src/registry.ts +4 -4
- package/src/signal-brand.ts +29 -0
- package/src/signal.ts +185 -39
- package/src/t.ts +5 -21
- package/src/type.ts +10 -2
- package/src/value.ts +9 -1
- package/src/variant.ts +2 -6
- package/src/vfunc-call.ts +3 -16
package/dist/descriptors.d.ts
CHANGED
|
@@ -68,12 +68,7 @@ type StringDescriptor = Extract<Descriptor, {
|
|
|
68
68
|
type ObjectDescriptor = Extract<Descriptor, {
|
|
69
69
|
kind: "object";
|
|
70
70
|
}> & {
|
|
71
|
-
/**
|
|
72
|
-
* Returns the wrapper class of the value's declared type. Referencing the class here keeps it
|
|
73
|
-
* in a tree-shaken bundle; the registry is still consulted first, so the thunk only decides
|
|
74
|
-
* the wrapper when no class is registered for the value's runtime type or an ancestor below
|
|
75
|
-
* the declared one.
|
|
76
|
-
*/
|
|
71
|
+
/** Retains and supplies the declared wrapper when no more-derived wrapper is registered. */
|
|
77
72
|
fallbackClass?: () => AnyClass;
|
|
78
73
|
};
|
|
79
74
|
/** Descriptor variant for a `gunichar`. */
|
|
@@ -92,10 +87,7 @@ type BufferDescriptor = Extract<Descriptor, {
|
|
|
92
87
|
type BoxedDescriptor = Extract<Descriptor, {
|
|
93
88
|
kind: "boxed";
|
|
94
89
|
}> & {
|
|
95
|
-
/**
|
|
96
|
-
* Returns the wrapper class of the value's declared type, used when no class is registered
|
|
97
|
-
* for the boxed GType. Referencing the class here keeps it in a tree-shaken bundle.
|
|
98
|
-
*/
|
|
90
|
+
/** Retains and supplies the declared wrapper when none is registered. */
|
|
99
91
|
fallbackClass?: () => AnyClass;
|
|
100
92
|
};
|
|
101
93
|
/** Descriptor variant for a plain C struct, extended with the class its decoded value is wrapped in. */
|
|
@@ -111,12 +103,7 @@ type FundamentalDescriptor = Extract<Descriptor, {
|
|
|
111
103
|
}> & {
|
|
112
104
|
/** Class a decoded value is wrapped in; without it the wrapper comes from the type named by `typeName`. */
|
|
113
105
|
wrapperClass?: AnyClass;
|
|
114
|
-
/**
|
|
115
|
-
* Returns the wrapper class of the value's declared type, used when no class is registered
|
|
116
|
-
* for the value's runtime type or an ancestor. Referencing the class here keeps it in a
|
|
117
|
-
* tree-shaken bundle. Unlike `wrapperClass`, the registry is consulted first, so a value of
|
|
118
|
-
* a more derived registered type keeps its own wrapper.
|
|
119
|
-
*/
|
|
106
|
+
/** Retains and supplies the declared wrapper after checking the runtime-type registry. */
|
|
120
107
|
fallbackClass?: () => AnyClass;
|
|
121
108
|
};
|
|
122
109
|
/** Descriptor variant for an array of items in one of the supported container layouts. */
|
|
@@ -159,10 +146,7 @@ type BoxedOptions = {
|
|
|
159
146
|
/** Returns the wrapper class of the declared type, used when none is registered for the GType. */
|
|
160
147
|
fallbackClass?: () => AnyClass;
|
|
161
148
|
};
|
|
162
|
-
/**
|
|
163
|
-
* What the bindings do with a callback's return value, how the callee takes its closure, and how
|
|
164
|
-
* long that closure has to stay alive.
|
|
165
|
-
*/
|
|
149
|
+
/** Callback result, closure ownership, and lifetime options. */
|
|
166
150
|
type CallbackOptions = {
|
|
167
151
|
/** The callee also takes a destroy notify, which frees the closure once it is done with it. */
|
|
168
152
|
hasDestroy?: boolean;
|
|
@@ -172,10 +156,7 @@ type CallbackOptions = {
|
|
|
172
156
|
hasUserData?: boolean;
|
|
173
157
|
/** Position of `user_data` among the callback's own arguments, dropped before the closure is called. */
|
|
174
158
|
userDataIndex?: number;
|
|
175
|
-
/**
|
|
176
|
-
* The callback's C signature ends with a `GError**`, which receives a `GError` built from
|
|
177
|
-
* whatever the JavaScript function throws while the callback returns its failure value.
|
|
178
|
-
*/
|
|
159
|
+
/** Converts a thrown value to the callback's trailing `GError**`. */
|
|
179
160
|
canThrow?: boolean;
|
|
180
161
|
/** Lifetime of the closure; defaults to `notified` when `hasDestroy` is set and `call` otherwise. */
|
|
181
162
|
scope?: CallbackDescriptor["scope"];
|
|
@@ -192,12 +173,10 @@ type ArrayOptions = {
|
|
|
192
173
|
fixedSize?: number | undefined;
|
|
193
174
|
/** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */
|
|
194
175
|
isBytes?: boolean | undefined;
|
|
195
|
-
/**
|
|
196
|
-
* Whether the caller supplies the storage for a fixed-length out array: the runtime allocates
|
|
197
|
-
* a buffer of the element stride times the fixed element count, passes its pointer, and
|
|
198
|
-
* decodes the elements the callee wrote into it.
|
|
199
|
-
*/
|
|
176
|
+
/** Allocates and decodes caller-owned storage for a fixed-length out array. */
|
|
200
177
|
isCallerAllocated?: boolean | undefined;
|
|
178
|
+
/** Adds a zero element after the declared length. */
|
|
179
|
+
isZeroTerminated?: boolean | undefined;
|
|
201
180
|
};
|
|
202
181
|
/** Where a cursor array's base buffer and total length come from. */
|
|
203
182
|
type CursorBounds = {
|
|
@@ -236,6 +215,12 @@ type StructOptions = {
|
|
|
236
215
|
size?: number;
|
|
237
216
|
/** Class a decoded value is wrapped in, instead of the one registered for its GType. */
|
|
238
217
|
wrapperClass?: AnyClass;
|
|
218
|
+
/** Library the struct's declared copy and free functions are resolved from; without it neither is used. */
|
|
219
|
+
sharedLibrary?: string;
|
|
220
|
+
/** Function duplicating an instance, used instead of a byte copy when the struct declares one. */
|
|
221
|
+
copyFnName?: string;
|
|
222
|
+
/** Function releasing an instance, used instead of `g_free` when the struct declares one. */
|
|
223
|
+
freeFnName?: string;
|
|
239
224
|
};
|
|
240
225
|
/** Descriptor for a `gint8`, marshalled as a number. */
|
|
241
226
|
declare const int8T: Int8Descriptor;
|
|
@@ -272,28 +257,17 @@ declare const unicharT: UnicharDescriptor;
|
|
|
272
257
|
/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */
|
|
273
258
|
declare const bufferT: BufferDescriptor;
|
|
274
259
|
declare const isGtypeDescriptor: (descriptor: Descriptor) => descriptor is TypeDescriptor;
|
|
275
|
-
/**
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
declare const stringT: (ownership?: Ownership, length?: number) => StringDescriptor;
|
|
280
|
-
/**
|
|
281
|
-
* Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType.
|
|
282
|
-
* `fallbackClass` names the wrapper class of the declared type, retaining it in tree-shaken
|
|
283
|
-
* bundles and wrapping the value in it when nothing at least as derived is registered.
|
|
284
|
-
*/
|
|
285
|
-
declare const objectT: (ownership?: Ownership, fallbackClass?: () => AnyClass) => ObjectDescriptor;
|
|
260
|
+
/** Builds a C-string descriptor, including optional buffer length and record-owned storage. */
|
|
261
|
+
declare const stringT: (ownership?: Ownership, length?: number, hasOwnedStorage?: boolean) => StringDescriptor;
|
|
262
|
+
/** Builds a runtime-typed `GObject` descriptor with an optional retained fallback class. */
|
|
263
|
+
declare const objectT: (ownership?: Ownership, fallbackClass?: () => AnyClass, typeName?: string) => ObjectDescriptor;
|
|
286
264
|
/** Wraps a descriptor in a pointer to it, for an output or inout argument. */
|
|
287
265
|
declare const refT: (innerDescriptor: Descriptor, isInout?: boolean) => RefDescriptor;
|
|
288
266
|
/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */
|
|
289
267
|
declare const hashTableT: (keyDescriptor: Descriptor, valueDescriptor: Descriptor, ownership?: Ownership) => HashTableDescriptor;
|
|
290
|
-
/** Builds
|
|
291
|
-
declare const enumT: (sharedLibrary: string, typeFnName: string, isSigned: boolean) => EnumDescriptor;
|
|
292
|
-
/**
|
|
293
|
-
* Builds a descriptor for a flags type, resolving its GType from the named `get_type` function.
|
|
294
|
-
* For flags without a registered GType, pass empty library and function names and supply `mask`,
|
|
295
|
-
* the union of all valid bits, which invalid combinations are rejected against.
|
|
296
|
-
*/
|
|
268
|
+
/** Builds an enum descriptor from a GType function or an explicit set of members. */
|
|
269
|
+
declare const enumT: (sharedLibrary: string, typeFnName: string, isSigned: boolean, members?: number[]) => EnumDescriptor;
|
|
270
|
+
/** Builds a flags descriptor from a GType function or an explicit bit mask. */
|
|
297
271
|
declare const flagsT: (sharedLibrary: string, typeFnName: string, isSigned: boolean, mask?: number) => FlagsDescriptor;
|
|
298
272
|
/** Builds a descriptor for a `GBoxed` value of the named type. */
|
|
299
273
|
declare const boxedT: (typeName: string, options?: BoxedOptions) => BoxedDescriptor;
|
|
@@ -316,10 +290,7 @@ declare const gArrayT: (itemDescriptor: Descriptor, ownership?: Ownership, optio
|
|
|
316
290
|
declare const byteArrayT: (ownership?: Ownership) => ArrayDescriptor;
|
|
317
291
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
318
292
|
declare const sizedArrayT: (itemDescriptor: Descriptor, sizeParamIndex: number, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
319
|
-
/**
|
|
320
|
-
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
321
|
-
* elements from where it points to the end of that buffer.
|
|
322
|
-
*/
|
|
293
|
+
/** Builds an out-array cursor into another argument's buffer. */
|
|
323
294
|
declare const cursorArrayT: (itemDescriptor: Descriptor, bounds: CursorBounds, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
324
295
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
325
296
|
declare const fixedArrayT: (itemDescriptor: Descriptor, fixedSize: number, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../src/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,wCAAwC;AACxC,KAAK,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,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YAAY,EACpB,YAAW,SAAsB,EACjC,UAAS,YAAiB,KAC3B,eAAyF,CAAC;AAE7F,2DAA2D;AAC3D,QAAA,MAAM,WAAW,GACb,gBAAgB,UAAU,EAC1B,WAAW,MAAM,EACjB,YAAW,SAAsB,EACjC,UAAS,YAAiB,KAC3B,eAAwF,CAAC;AAgC5F,2GAA2G;AAC3G,QAAA,MAAM,SAAS,GACX,gBAAgB,UAAU,EAAE,EAC5B,kBAAkB,UAAU,EAC5B,UAAU,eAAe,KAC1B,kBAUF,CAAC;AAEF,OAAO,EACH,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACrB,CAAC"}
|
package/dist/descriptors.js
CHANGED
|
@@ -34,17 +34,28 @@ const unicharT = { kind: "unichar" };
|
|
|
34
34
|
const bufferT = { kind: "buffer" };
|
|
35
35
|
const fundamentalLifecycles = new Map();
|
|
36
36
|
const isGtypeDescriptor = (descriptor) => descriptor.kind === "biguint64" && "type" in descriptor;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
/** Builds a C-string descriptor, including optional buffer length and record-owned storage. */
|
|
38
|
+
const stringT = (ownership = "borrowed", length, hasOwnedStorage) => {
|
|
39
|
+
const result = { kind: "string", ownership };
|
|
40
|
+
if (length !== undefined) {
|
|
41
|
+
result.length = length;
|
|
42
|
+
}
|
|
43
|
+
if (hasOwnedStorage === true) {
|
|
44
|
+
result.hasOwnedStorage = true;
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
/** Builds a runtime-typed `GObject` descriptor with an optional retained fallback class. */
|
|
49
|
+
const objectT = (ownership = "borrowed", fallbackClass, typeName) => {
|
|
50
|
+
const result = { kind: "object", ownership };
|
|
51
|
+
if (fallbackClass !== undefined) {
|
|
52
|
+
result.fallbackClass = fallbackClass;
|
|
53
|
+
}
|
|
54
|
+
if (typeName !== undefined) {
|
|
55
|
+
result.typeName = typeName;
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
48
59
|
/** Wraps a descriptor in a pointer to it, for an output or inout argument. */
|
|
49
60
|
const refT = (innerDescriptor, isInout = false) => isInout ? { kind: "ref", innerDescriptor, inout: true } : { kind: "ref", innerDescriptor };
|
|
50
61
|
/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */
|
|
@@ -54,18 +65,20 @@ const hashTableT = (keyDescriptor, valueDescriptor, ownership = "borrowed") => (
|
|
|
54
65
|
valueDescriptor,
|
|
55
66
|
ownership,
|
|
56
67
|
});
|
|
57
|
-
/** Builds
|
|
58
|
-
const enumT = (sharedLibrary, typeFnName, isSigned) =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
/** Builds an enum descriptor from a GType function or an explicit set of members. */
|
|
69
|
+
const enumT = (sharedLibrary, typeFnName, isSigned, members) => {
|
|
70
|
+
const result = {
|
|
71
|
+
kind: "enum",
|
|
72
|
+
sharedLibrary,
|
|
73
|
+
getTypeFnName: typeFnName,
|
|
74
|
+
isSigned,
|
|
75
|
+
};
|
|
76
|
+
if (members !== undefined) {
|
|
77
|
+
result.members = members;
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
/** Builds a flags descriptor from a GType function or an explicit bit mask. */
|
|
69
82
|
const flagsT = (sharedLibrary, typeFnName, isSigned, mask) => {
|
|
70
83
|
const result = {
|
|
71
84
|
kind: "flags",
|
|
@@ -114,6 +127,18 @@ const boxedT = (typeName, options = {}) => {
|
|
|
114
127
|
applyBoxedOptions(result, options);
|
|
115
128
|
return result;
|
|
116
129
|
};
|
|
130
|
+
const applyStructLifecycle = (result, options) => {
|
|
131
|
+
if (options.sharedLibrary === undefined) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
result.sharedLibrary = options.sharedLibrary;
|
|
135
|
+
if (options.copyFnName !== undefined) {
|
|
136
|
+
result.copyFnName = options.copyFnName;
|
|
137
|
+
}
|
|
138
|
+
if (options.freeFnName !== undefined) {
|
|
139
|
+
result.freeFnName = options.freeFnName;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
117
142
|
/** Builds a descriptor for a plain C struct. */
|
|
118
143
|
const structT = (ownership = "borrowed", options = {}) => {
|
|
119
144
|
const result = { kind: "struct", ownership };
|
|
@@ -129,6 +154,7 @@ const structT = (ownership = "borrowed", options = {}) => {
|
|
|
129
154
|
if (options.isInline) {
|
|
130
155
|
result.isInline = true;
|
|
131
156
|
}
|
|
157
|
+
applyStructLifecycle(result, options);
|
|
132
158
|
return result;
|
|
133
159
|
};
|
|
134
160
|
const recordFundamentalLifecycle = (typeName, lifecycle) => {
|
|
@@ -189,6 +215,9 @@ const arrayT = (itemDescriptor, arrayKind = "array", ownership = "borrowed", opt
|
|
|
189
215
|
if (options.isCallerAllocated === true) {
|
|
190
216
|
result.isCallerAllocated = true;
|
|
191
217
|
}
|
|
218
|
+
if (options.isZeroTerminated === true) {
|
|
219
|
+
result.isZeroTerminated = true;
|
|
220
|
+
}
|
|
192
221
|
return result;
|
|
193
222
|
};
|
|
194
223
|
/** Builds a descriptor for a `GList` of items. */
|
|
@@ -203,10 +232,7 @@ const gArrayT = (itemDescriptor, ownership = "borrowed", options = {}) => arrayT
|
|
|
203
232
|
const byteArrayT = (ownership = "borrowed") => arrayT(uint8T, "gbytearray", ownership, { isBytes: true });
|
|
204
233
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
205
234
|
const sizedArrayT = (itemDescriptor, sizeParamIndex, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "sized", ownership, { ...options, sizeParamIndex });
|
|
206
|
-
/**
|
|
207
|
-
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
208
|
-
* elements from where it points to the end of that buffer.
|
|
209
|
-
*/
|
|
235
|
+
/** Builds an out-array cursor into another argument's buffer. */
|
|
210
236
|
const cursorArrayT = (itemDescriptor, bounds, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "cursor", ownership, { ...options, ...bounds });
|
|
211
237
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
212
238
|
const fixedArrayT = (itemDescriptor, fixedSize, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "fixed", ownership, { ...options, fixedSize });
|
package/dist/descriptors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../src/descriptors.ts"],"names":[],"mappings":"AAyMA,wDAAwD;AACxD,MAAM,KAAK,GAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/C,yDAAyD;AACzD,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClD,yDAAyD;AACzD,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClD,0DAA0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CACd,cAA4B,EAC5B,gBAA4B,EAC5B,OAAyB,EACP,EAAE;IACpB,MAAM,MAAM,GAAuB,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;IAE1F,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EACH,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,GASZ,CAAC","sourcesContent":["import type { ArrayKind, Descriptor, Ownership } from \"@gtkx/native\";\nimport type { AnyClass } from \"@gtkx/utils\";\n\n/** Descriptor variant for a `gint8`. */\ntype Int8Descriptor = Extract<Descriptor, { kind: \"int8\" }>;\n/** Descriptor variant for a `guint8`. */\ntype Uint8Descriptor = Extract<Descriptor, { kind: \"uint8\" }>;\n/** Descriptor variant for a `gint16`. */\ntype Int16Descriptor = Extract<Descriptor, { kind: \"int16\" }>;\n/** Descriptor variant for a `guint16`. */\ntype Uint16Descriptor = Extract<Descriptor, { kind: \"uint16\" }>;\n/** Descriptor variant for a `gint32`. */\ntype Int32Descriptor = Extract<Descriptor, { kind: \"int32\" }>;\n/** Descriptor variant for a `guint32`. */\ntype Uint32Descriptor = Extract<Descriptor, { kind: \"uint32\" }>;\n/** Descriptor variant for a `gint64` marshalled as a number. */\ntype Int64Descriptor = Extract<Descriptor, { kind: \"int64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a number. */\ntype Uint64Descriptor = Extract<Descriptor, { kind: \"uint64\" }>;\n/** Descriptor variant for a `gint64` marshalled as a bigint. */\ntype BigInt64Descriptor = Extract<Descriptor, { kind: \"bigint64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a bigint. */\ntype BigUint64Descriptor = Extract<Descriptor, { kind: \"biguint64\" }>;\n/** Descriptor variant for a `gfloat`. */\ntype Float32Descriptor = Extract<Descriptor, { kind: \"float32\" }>;\n/** Descriptor variant for a `gdouble`. */\ntype Float64Descriptor = Extract<Descriptor, { kind: \"float64\" }>;\n/** Descriptor variant for an enumeration, carrying the library and `get_type` symbol its GType comes from. */\ntype EnumDescriptor = Extract<Descriptor, { kind: \"enum\" }>;\n/** Descriptor variant for a flags type, carrying the library and `get_type` symbol its GType comes from. */\ntype FlagsDescriptor = Extract<Descriptor, { kind: \"flags\" }>;\n/** Descriptor variant for a `gboolean`. */\ntype BooleanDescriptor = Extract<Descriptor, { kind: \"boolean\" }>;\n/** Descriptor variant for a C string. */\ntype StringDescriptor = Extract<Descriptor, { kind: \"string\" }>;\n\n/** Descriptor variant for a `GObject`, extended with the statically declared type of its value. */\ntype ObjectDescriptor = Extract<Descriptor, { kind: \"object\" }> & {\n /**\n * Returns the wrapper class of the value's declared type. Referencing the class here keeps it\n * in a tree-shaken bundle; the registry is still consulted first, so the thunk only decides\n * the wrapper when no class is registered for the value's runtime type or an ancestor below\n * the declared one.\n */\n fallbackClass?: () => AnyClass;\n};\n\n/** Descriptor variant for a `gunichar`. */\ntype UnicharDescriptor = Extract<Descriptor, { kind: \"unichar\" }>;\n/** Descriptor variant for the absence of a value. */\ntype VoidDescriptor = Extract<Descriptor, { kind: \"void\" }>;\n/** Descriptor variant for an opaque `gpointer`. */\ntype BufferDescriptor = Extract<Descriptor, { kind: \"buffer\" }>;\n\n/** Descriptor variant for a `GBoxed` value, extended with the statically declared type of its value. */\ntype BoxedDescriptor = Extract<Descriptor, { kind: \"boxed\" }> & {\n /**\n * Returns the wrapper class of the value's declared type, used when no class is registered\n * for the boxed GType. Referencing the class here keeps it in a tree-shaken bundle.\n */\n fallbackClass?: () => AnyClass;\n};\n\n/** Descriptor variant for a plain C struct, extended with the class its decoded value is wrapped in. */\ntype StructDescriptor = Extract<Descriptor, { kind: \"struct\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the value's own GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor variant for a ref-counted fundamental type, extended with the class its decoded value is wrapped in. */\ntype FundamentalDescriptor = Extract<Descriptor, { kind: \"fundamental\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the type named by `typeName`. */\n wrapperClass?: AnyClass;\n /**\n * Returns the wrapper class of the value's declared type, used when no class is registered\n * for the value's runtime type or an ancestor. Referencing the class here keeps it in a\n * tree-shaken bundle. Unlike `wrapperClass`, the registry is consulted first, so a value of\n * a more derived registered type keeps its own wrapper.\n */\n fallbackClass?: () => AnyClass;\n};\n\n/** Descriptor variant for an array of items in one of the supported container layouts. */\ntype ArrayDescriptor = Extract<Descriptor, { kind: \"array\" }>;\n/** Descriptor variant for a `GHashTable`, marshalled as an array of key/value pairs. */\ntype HashTableDescriptor = Extract<Descriptor, { kind: \"hashtable\" }>;\n/** Descriptor variant for a function pointer a JavaScript function is marshalled into. */\ntype CallbackDescriptor = Extract<Descriptor, { kind: \"callback\" }>;\n/** Descriptor variant for a pointer to another descriptor's value, for an output or inout argument. */\ntype RefDescriptor = Extract<Descriptor, { kind: \"ref\" }>;\n\n/** Descriptor for a `GType`: a `guint64` marked so it resolves to `G_TYPE_GTYPE` rather than an integer. */\ntype TypeDescriptor = BigUint64Descriptor & {\n /** Distinguishes a GType from a plain `guint64` when the GLib type and the GValue type are resolved. */\n type: true;\n};\n\n/** How a boxed value is stored, and where its GType and free function are resolved from. */\ntype BoxedOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** Library `getTypeFnName` and `freeFnName` are resolved in. */\n sharedLibrary?: string;\n /** Symbol returning the boxed GType, used when the type is not already registered under its name. */\n getTypeFnName?: string;\n /** Symbol that frees the value, for a boxed type with no GType of its own. */\n freeFnName?: string;\n /** Byte size of the value, needed to copy it into an inline field. */\n size?: number;\n /** Returns the wrapper class of the declared type, used when none is registered for the GType. */\n fallbackClass?: () => AnyClass;\n};\n\n/**\n * What the bindings do with a callback's return value, how the callee takes its closure, and how\n * long that closure has to stay alive.\n */\ntype CallbackOptions = {\n /** The callee also takes a destroy notify, which frees the closure once it is done with it. */\n hasDestroy?: boolean;\n /** Signature of that destroy notify; defaults to `destroyNotify`, a one-argument `GDestroyNotify`. */\n destroyKind?: CallbackDescriptor[\"destroyKind\"];\n /** The callee also takes a `user_data` pointer; without one the closure can never be freed. */\n hasUserData?: boolean;\n /** Position of `user_data` among the callback's own arguments, dropped before the closure is called. */\n userDataIndex?: number;\n /**\n * The callback's C signature ends with a `GError**`, which receives a `GError` built from\n * whatever the JavaScript function throws while the callback returns its failure value.\n */\n canThrow?: boolean;\n /** Lifetime of the closure; defaults to `notified` when `hasDestroy` is set and `call` otherwise. */\n scope?: CallbackDescriptor[\"scope\"];\n};\n\n/** The lengths and strides a C array layout needs beyond its element type. */\ntype ArrayOptions = {\n /** Stride in bytes between elements stored inline in the array. */\n elementSize?: number | undefined;\n /** Position of the argument whose buffer a cursor array points into. */\n baseParamIndex?: number | undefined;\n /** Position of the argument carrying the element count, for a length-bounded array. */\n sizeParamIndex?: number | undefined;\n /** Element count of a fixed-length array. */\n fixedSize?: number | undefined;\n /** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */\n isBytes?: boolean | undefined;\n /**\n * Whether the caller supplies the storage for a fixed-length out array: the runtime allocates\n * a buffer of the element stride times the fixed element count, passes its pointer, and\n * decodes the elements the callee wrote into it.\n */\n isCallerAllocated?: boolean | undefined;\n};\n\n/** Where a cursor array's base buffer and total length come from. */\ntype CursorBounds = {\n /** Position of the argument holding the buffer the cursor points into. */\n baseParamIndex: number;\n /** Position of the argument carrying that buffer's element count. */\n sizeParamIndex: number;\n};\n\n/** How a ref-counted fundamental value is named, wrapped and stored. */\ntype FundamentalOptions = {\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** GLib type name the wrapper class is looked up by. */\n typeName?: string;\n /** Class a decoded value is wrapped in, instead of the one registered for `typeName`. */\n wrapperClass?: AnyClass;\n /** Returns the wrapper class of the declared type, used when none is registered for the value's type. */\n fallbackClass?: () => AnyClass;\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of acquired. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n};\n\ntype FundamentalLifecycle = {\n sharedLibrary: string;\n refFnName: string;\n unrefFnName: string;\n};\n\n/** How a plain C struct is stored and wrapped. */\ntype StructOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Byte size of the struct, needed to copy it rather than borrow the pointer. */\n size?: number;\n /** Class a decoded value is wrapped in, instead of the one registered for its GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor for a `gint8`, marshalled as a number. */\nconst int8T: Int8Descriptor = { kind: \"int8\" };\n/** Descriptor for a `guint8`, marshalled as a number. */\nconst uint8T: Uint8Descriptor = { kind: \"uint8\" };\n/** Descriptor for a `gint16`, marshalled as a number. */\nconst int16T: Int16Descriptor = { kind: \"int16\" };\n/** Descriptor for a `guint16`, marshalled as a number. */\nconst uint16T: Uint16Descriptor = { kind: \"uint16\" };\n/** Descriptor for a `gint32`, marshalled as a number. */\nconst int32T: Int32Descriptor = { kind: \"int32\" };\n/** Descriptor for a `guint32`, marshalled as a number. */\nconst uint32T: Uint32Descriptor = { kind: \"uint32\" };\n/** Descriptor for a `gint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst int64T: Int64Descriptor = { kind: \"int64\" };\n/** Descriptor for a `guint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst uint64T: Uint64Descriptor = { kind: \"uint64\" };\n/** Descriptor for a `gint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst bigint64T: BigInt64Descriptor = { kind: \"bigint64\" };\n/** Descriptor for a `guint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst biguint64T: BigUint64Descriptor = { kind: \"biguint64\" };\n/** Descriptor for a `GType`, marshalled as a bigint and recognized as a GType by GValue conversion. */\nconst gtypeT: TypeDescriptor = { kind: \"biguint64\", type: true };\n/** Descriptor for a `gfloat`. */\nconst float32T: Float32Descriptor = { kind: \"float32\" };\n/** Descriptor for a `gdouble`. */\nconst float64T: Float64Descriptor = { kind: \"float64\" };\n/** Descriptor for a `gboolean`, marshalled as a JavaScript boolean. */\nconst booleanT: BooleanDescriptor = { kind: \"boolean\" };\n/** Descriptor for the absence of a value, used as the return descriptor of a `void` function. */\nconst voidT: VoidDescriptor = { kind: \"void\" };\n/** Descriptor for a `gunichar`, marshalled as a single-character string or a codepoint number. */\nconst unicharT: UnicharDescriptor = { kind: \"unichar\" };\n/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */\nconst bufferT: BufferDescriptor = { kind: \"buffer\" };\nconst fundamentalLifecycles: Map<string, FundamentalLifecycle> = new Map();\n\nconst isGtypeDescriptor = (descriptor: Descriptor): descriptor is TypeDescriptor =>\n descriptor.kind === \"biguint64\" && \"type\" in descriptor;\n\n/**\n * Builds a descriptor for a C string, whose optional length sizes the caller-allocated buffer\n * used when the string is passed by reference.\n */\nconst stringT = (ownership: Ownership = \"borrowed\", length?: number): StringDescriptor =>\n length === undefined ? { kind: \"string\", ownership } : { kind: \"string\", ownership, length };\n\n/**\n * Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType.\n * `fallbackClass` names the wrapper class of the declared type, retaining it in tree-shaken\n * bundles and wrapping the value in it when nothing at least as derived is registered.\n */\nconst objectT = (ownership: Ownership = \"borrowed\", fallbackClass?: () => AnyClass): ObjectDescriptor =>\n fallbackClass === undefined ? { kind: \"object\", ownership } : { kind: \"object\", ownership, fallbackClass };\n\n/** Wraps a descriptor in a pointer to it, for an output or inout argument. */\nconst refT = (innerDescriptor: Descriptor, isInout = false): RefDescriptor =>\n isInout ? { kind: \"ref\", innerDescriptor, inout: true } : { kind: \"ref\", innerDescriptor };\n\n/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */\nconst hashTableT = (\n keyDescriptor: Descriptor,\n valueDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n): HashTableDescriptor => ({\n kind: \"hashtable\",\n keyDescriptor,\n valueDescriptor,\n ownership,\n});\n\n/** Builds a descriptor for an enumeration, resolving its GType from the named `get_type` function. */\nconst enumT = (sharedLibrary: string, typeFnName: string, isSigned: boolean): EnumDescriptor => ({\n kind: \"enum\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n});\n\n/**\n * Builds a descriptor for a flags type, resolving its GType from the named `get_type` function.\n * For flags without a registered GType, pass empty library and function names and supply `mask`,\n * the union of all valid bits, which invalid combinations are rejected against.\n */\nconst flagsT = (sharedLibrary: string, typeFnName: string, isSigned: boolean, mask?: number): FlagsDescriptor => {\n const result: FlagsDescriptor = {\n kind: \"flags\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n };\n\n if (mask !== undefined) {\n result.mask = mask;\n }\n\n return result;\n};\n\nconst applyBoxedNames = (result: BoxedDescriptor, options: BoxedOptions): void => {\n if (options.sharedLibrary !== undefined) {\n result.sharedLibrary = options.sharedLibrary;\n }\n\n if (options.getTypeFnName !== undefined) {\n result.getTypeFnName = options.getTypeFnName;\n }\n\n if (options.freeFnName !== undefined) {\n result.freeFnName = options.freeFnName;\n }\n};\n\nconst applyBoxedOptions = (result: BoxedDescriptor, options: BoxedOptions): void => {\n applyBoxedNames(result, options);\n\n if (options.fallbackClass !== undefined) {\n result.fallbackClass = options.fallbackClass;\n }\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n};\n\n/** Builds a descriptor for a `GBoxed` value of the named type. */\nconst boxedT = (typeName: string, options: BoxedOptions = {}): BoxedDescriptor => {\n const result: BoxedDescriptor = {\n kind: \"boxed\",\n ownership: options.ownership ?? \"borrowed\",\n typeName,\n };\n\n applyBoxedOptions(result, options);\n\n return result;\n};\n\n/** Builds a descriptor for a plain C struct. */\nconst structT = (ownership: Ownership = \"borrowed\", options: StructOptions = {}): StructDescriptor => {\n const result: StructDescriptor = { kind: \"struct\", ownership };\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\nconst recordFundamentalLifecycle = (typeName: string, lifecycle: FundamentalLifecycle): void => {\n if (!fundamentalLifecycles.has(typeName)) {\n fundamentalLifecycles.set(typeName, lifecycle);\n }\n};\n\nconst fundamentalLifecycleFor = (typeName: string): FundamentalLifecycle | undefined =>\n fundamentalLifecycles.get(typeName);\n\nconst applyFundamentalClasses = (result: FundamentalDescriptor, options: FundamentalOptions): void => {\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.fallbackClass !== undefined) {\n result.fallbackClass = options.fallbackClass;\n }\n};\n\n/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */\nconst fundamentalT = (\n sharedLibrary: string,\n refFnName: string,\n unrefFnName: string,\n options: FundamentalOptions = {},\n): FundamentalDescriptor => {\n const ownership = options.ownership ?? \"borrowed\";\n const result: FundamentalDescriptor = { kind: \"fundamental\", ownership, sharedLibrary, refFnName, unrefFnName };\n\n if (options.typeName !== undefined) {\n result.typeName = options.typeName;\n recordFundamentalLifecycle(options.typeName, { sharedLibrary, refFnName, unrefFnName });\n }\n\n applyFundamentalClasses(result, options);\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\nconst applyArrayBounds = (result: ArrayDescriptor, options: ArrayOptions): void => {\n if (options.baseParamIndex !== undefined) {\n result.baseParamIndex = options.baseParamIndex;\n }\n\n if (options.sizeParamIndex !== undefined) {\n result.sizeParamIndex = options.sizeParamIndex;\n }\n\n if (options.fixedSize !== undefined) {\n result.fixedSize = options.fixedSize;\n }\n};\n\n/** Builds a descriptor for an array of items in one of the supported container layouts. */\nconst arrayT = (\n itemDescriptor: Descriptor,\n arrayKind: ArrayKind = \"array\",\n ownership: Ownership = \"borrowed\",\n options?: ArrayOptions,\n): ArrayDescriptor => {\n const result: ArrayDescriptor = { kind: \"array\", itemDescriptor, arrayKind, ownership };\n\n if (options === undefined) {\n return result;\n }\n\n applyArrayBounds(result, options);\n\n if (options.elementSize !== undefined) {\n result.elementSize = options.elementSize;\n }\n\n if (options.isBytes === true) {\n result.isBytes = true;\n }\n\n if (options.isCallerAllocated === true) {\n result.isCallerAllocated = true;\n }\n\n return result;\n};\n\n/** Builds a descriptor for a `GList` of items. */\nconst listT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"glist\", ownership, options);\n\n/** Builds a descriptor for a `GSList` of items. */\nconst slistT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"gslist\", ownership, options);\n\n/** Builds a descriptor for a `GPtrArray` of items. */\nconst ptrArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"gptrarray\", ownership, options);\n\n/** Builds a descriptor for a `GArray` of items. */\nconst gArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"garray\", ownership, options);\n\n/** Builds a descriptor for a `GByteArray`. */\nconst byteArrayT = (ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(uint8T, \"gbytearray\", ownership, { isBytes: true });\n\n/** Builds a descriptor for a C array whose length is carried by another argument. */\nconst sizedArrayT = (\n itemDescriptor: Descriptor,\n sizeParamIndex: number,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"sized\", ownership, { ...options, sizeParamIndex });\n\n/**\n * Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the\n * elements from where it points to the end of that buffer.\n */\nconst cursorArrayT = (\n itemDescriptor: Descriptor,\n bounds: CursorBounds,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"cursor\", ownership, { ...options, ...bounds });\n\n/** Builds a descriptor for a C array of a fixed length. */\nconst fixedArrayT = (\n itemDescriptor: Descriptor,\n fixedSize: number,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"fixed\", ownership, { ...options, fixedSize });\n\nconst applyClosureLifetimeOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {\n if (options.hasDestroy !== undefined) {\n result.hasDestroy = options.hasDestroy;\n }\n\n if (options.destroyKind !== undefined) {\n result.destroyKind = options.destroyKind;\n }\n\n if (options.scope !== undefined) {\n result.scope = options.scope;\n }\n};\n\nconst applyClosureOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {\n applyClosureLifetimeOptions(result, options);\n\n if (options.hasUserData !== undefined) {\n result.hasUserData = options.hasUserData;\n }\n\n if (options.userDataIndex !== undefined) {\n result.userDataIndex = options.userDataIndex;\n }\n\n if (options.canThrow !== undefined) {\n result.canThrow = options.canThrow;\n }\n};\n\n/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */\nconst callbackT = (\n argDescriptors: Descriptor[],\n returnDescriptor: Descriptor,\n options?: CallbackOptions,\n): CallbackDescriptor => {\n const result: CallbackDescriptor = { kind: \"callback\", argDescriptors, returnDescriptor };\n\n if (options === undefined) {\n return result;\n }\n\n applyClosureOptions(result, options);\n\n return result;\n};\n\nexport {\n int8T,\n uint8T,\n int16T,\n uint16T,\n int32T,\n uint32T,\n int64T,\n uint64T,\n bigint64T,\n biguint64T,\n gtypeT,\n isGtypeDescriptor,\n float32T,\n float64T,\n booleanT,\n voidT,\n unicharT,\n bufferT,\n stringT,\n objectT,\n refT,\n hashTableT,\n enumT,\n flagsT,\n boxedT,\n structT,\n fundamentalLifecycleFor,\n fundamentalT,\n arrayT,\n listT,\n slistT,\n ptrArrayT,\n gArrayT,\n byteArrayT,\n sizedArrayT,\n fixedArrayT,\n cursorArrayT,\n callbackT,\n type BoxedDescriptor,\n type ObjectDescriptor,\n type StructDescriptor,\n type FundamentalDescriptor,\n type ArrayDescriptor,\n type HashTableDescriptor,\n type CallbackDescriptor,\n type RefDescriptor,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../src/descriptors.ts"],"names":[],"mappings":"AA0LA,wDAAwD;AACxD,MAAM,KAAK,GAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/C,yDAAyD;AACzD,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClD,yDAAyD;AACzD,MAAM,MAAM,GAAoB,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I,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC;IAE1F,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,mBAAmB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EACH,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,uBAAuB,EACvB,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,SAAS,GASZ,CAAC","sourcesContent":["import type { ArrayKind, Descriptor, Ownership } from \"@gtkx/native\";\nimport type { AnyClass } from \"@gtkx/utils\";\n\n/** Descriptor variant for a `gint8`. */\ntype Int8Descriptor = Extract<Descriptor, { kind: \"int8\" }>;\n/** Descriptor variant for a `guint8`. */\ntype Uint8Descriptor = Extract<Descriptor, { kind: \"uint8\" }>;\n/** Descriptor variant for a `gint16`. */\ntype Int16Descriptor = Extract<Descriptor, { kind: \"int16\" }>;\n/** Descriptor variant for a `guint16`. */\ntype Uint16Descriptor = Extract<Descriptor, { kind: \"uint16\" }>;\n/** Descriptor variant for a `gint32`. */\ntype Int32Descriptor = Extract<Descriptor, { kind: \"int32\" }>;\n/** Descriptor variant for a `guint32`. */\ntype Uint32Descriptor = Extract<Descriptor, { kind: \"uint32\" }>;\n/** Descriptor variant for a `gint64` marshalled as a number. */\ntype Int64Descriptor = Extract<Descriptor, { kind: \"int64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a number. */\ntype Uint64Descriptor = Extract<Descriptor, { kind: \"uint64\" }>;\n/** Descriptor variant for a `gint64` marshalled as a bigint. */\ntype BigInt64Descriptor = Extract<Descriptor, { kind: \"bigint64\" }>;\n/** Descriptor variant for a `guint64` marshalled as a bigint. */\ntype BigUint64Descriptor = Extract<Descriptor, { kind: \"biguint64\" }>;\n/** Descriptor variant for a `gfloat`. */\ntype Float32Descriptor = Extract<Descriptor, { kind: \"float32\" }>;\n/** Descriptor variant for a `gdouble`. */\ntype Float64Descriptor = Extract<Descriptor, { kind: \"float64\" }>;\n/** Descriptor variant for an enumeration, carrying the library and `get_type` symbol its GType comes from. */\ntype EnumDescriptor = Extract<Descriptor, { kind: \"enum\" }>;\n/** Descriptor variant for a flags type, carrying the library and `get_type` symbol its GType comes from. */\ntype FlagsDescriptor = Extract<Descriptor, { kind: \"flags\" }>;\n/** Descriptor variant for a `gboolean`. */\ntype BooleanDescriptor = Extract<Descriptor, { kind: \"boolean\" }>;\n/** Descriptor variant for a C string. */\ntype StringDescriptor = Extract<Descriptor, { kind: \"string\" }>;\n\n/** Descriptor variant for a `GObject`, extended with the statically declared type of its value. */\ntype ObjectDescriptor = Extract<Descriptor, { kind: \"object\" }> & {\n /** Retains and supplies the declared wrapper when no more-derived wrapper is registered. */\n fallbackClass?: () => AnyClass;\n};\n\n/** Descriptor variant for a `gunichar`. */\ntype UnicharDescriptor = Extract<Descriptor, { kind: \"unichar\" }>;\n/** Descriptor variant for the absence of a value. */\ntype VoidDescriptor = Extract<Descriptor, { kind: \"void\" }>;\n/** Descriptor variant for an opaque `gpointer`. */\ntype BufferDescriptor = Extract<Descriptor, { kind: \"buffer\" }>;\n\n/** Descriptor variant for a `GBoxed` value, extended with the statically declared type of its value. */\ntype BoxedDescriptor = Extract<Descriptor, { kind: \"boxed\" }> & {\n /** Retains and supplies the declared wrapper when none is registered. */\n fallbackClass?: () => AnyClass;\n};\n\n/** Descriptor variant for a plain C struct, extended with the class its decoded value is wrapped in. */\ntype StructDescriptor = Extract<Descriptor, { kind: \"struct\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the value's own GType. */\n wrapperClass?: AnyClass;\n};\n\n/** Descriptor variant for a ref-counted fundamental type, extended with the class its decoded value is wrapped in. */\ntype FundamentalDescriptor = Extract<Descriptor, { kind: \"fundamental\" }> & {\n /** Class a decoded value is wrapped in; without it the wrapper comes from the type named by `typeName`. */\n wrapperClass?: AnyClass;\n /** Retains and supplies the declared wrapper after checking the runtime-type registry. */\n fallbackClass?: () => AnyClass;\n};\n\n/** Descriptor variant for an array of items in one of the supported container layouts. */\ntype ArrayDescriptor = Extract<Descriptor, { kind: \"array\" }>;\n/** Descriptor variant for a `GHashTable`, marshalled as an array of key/value pairs. */\ntype HashTableDescriptor = Extract<Descriptor, { kind: \"hashtable\" }>;\n/** Descriptor variant for a function pointer a JavaScript function is marshalled into. */\ntype CallbackDescriptor = Extract<Descriptor, { kind: \"callback\" }>;\n/** Descriptor variant for a pointer to another descriptor's value, for an output or inout argument. */\ntype RefDescriptor = Extract<Descriptor, { kind: \"ref\" }>;\n\n/** Descriptor for a `GType`: a `guint64` marked so it resolves to `G_TYPE_GTYPE` rather than an integer. */\ntype TypeDescriptor = BigUint64Descriptor & {\n /** Distinguishes a GType from a plain `guint64` when the GLib type and the GValue type are resolved. */\n type: true;\n};\n\n/** How a boxed value is stored, and where its GType and free function are resolved from. */\ntype BoxedOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** Library `getTypeFnName` and `freeFnName` are resolved in. */\n sharedLibrary?: string;\n /** Symbol returning the boxed GType, used when the type is not already registered under its name. */\n getTypeFnName?: string;\n /** Symbol that frees the value, for a boxed type with no GType of its own. */\n freeFnName?: string;\n /** Byte size of the value, needed to copy it into an inline field. */\n size?: number;\n /** Returns the wrapper class of the declared type, used when none is registered for the GType. */\n fallbackClass?: () => AnyClass;\n};\n\n/** Callback result, closure ownership, and lifetime options. */\ntype CallbackOptions = {\n /** The callee also takes a destroy notify, which frees the closure once it is done with it. */\n hasDestroy?: boolean;\n /** Signature of that destroy notify; defaults to `destroyNotify`, a one-argument `GDestroyNotify`. */\n destroyKind?: CallbackDescriptor[\"destroyKind\"];\n /** The callee also takes a `user_data` pointer; without one the closure can never be freed. */\n hasUserData?: boolean;\n /** Position of `user_data` among the callback's own arguments, dropped before the closure is called. */\n userDataIndex?: number;\n /** Converts a thrown value to the callback's trailing `GError**`. */\n canThrow?: boolean;\n /** Lifetime of the closure; defaults to `notified` when `hasDestroy` is set and `call` otherwise. */\n scope?: CallbackDescriptor[\"scope\"];\n};\n\n/** The lengths and strides a C array layout needs beyond its element type. */\ntype ArrayOptions = {\n /** Stride in bytes between elements stored inline in the array. */\n elementSize?: number | undefined;\n /** Position of the argument whose buffer a cursor array points into. */\n baseParamIndex?: number | undefined;\n /** Position of the argument carrying the element count, for a length-bounded array. */\n sizeParamIndex?: number | undefined;\n /** Element count of a fixed-length array. */\n fixedSize?: number | undefined;\n /** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */\n isBytes?: boolean | undefined;\n /** Allocates and decodes caller-owned storage for a fixed-length out array. */\n isCallerAllocated?: boolean | undefined;\n /** Adds a zero element after the declared length. */\n isZeroTerminated?: boolean | undefined;\n};\n\n/** Where a cursor array's base buffer and total length come from. */\ntype CursorBounds = {\n /** Position of the argument holding the buffer the cursor points into. */\n baseParamIndex: number;\n /** Position of the argument carrying that buffer's element count. */\n sizeParamIndex: number;\n};\n\n/** How a ref-counted fundamental value is named, wrapped and stored. */\ntype FundamentalOptions = {\n /** Whether a decoded value is owned by the caller; defaults to `\"borrowed\"`. */\n ownership?: Ownership;\n /** GLib type name the wrapper class is looked up by. */\n typeName?: string;\n /** Class a decoded value is wrapped in, instead of the one registered for `typeName`. */\n wrapperClass?: AnyClass;\n /** Returns the wrapper class of the declared type, used when none is registered for the value's type. */\n fallbackClass?: () => AnyClass;\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of acquired. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n};\n\ntype FundamentalLifecycle = {\n sharedLibrary: string;\n refFnName: string;\n unrefFnName: string;\n};\n\n/** How a plain C struct is stored and wrapped. */\ntype StructOptions = {\n /** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */\n isCallerAllocated?: boolean;\n /** The value is embedded in the containing struct rather than reached through a pointer. */\n isInline?: boolean;\n /** Byte size of the struct, needed to copy it rather than borrow the pointer. */\n size?: number;\n /** Class a decoded value is wrapped in, instead of the one registered for its GType. */\n wrapperClass?: AnyClass;\n /** Library the struct's declared copy and free functions are resolved from; without it neither is used. */\n sharedLibrary?: string;\n /** Function duplicating an instance, used instead of a byte copy when the struct declares one. */\n copyFnName?: string;\n /** Function releasing an instance, used instead of `g_free` when the struct declares one. */\n freeFnName?: string;\n};\n\n/** Descriptor for a `gint8`, marshalled as a number. */\nconst int8T: Int8Descriptor = { kind: \"int8\" };\n/** Descriptor for a `guint8`, marshalled as a number. */\nconst uint8T: Uint8Descriptor = { kind: \"uint8\" };\n/** Descriptor for a `gint16`, marshalled as a number. */\nconst int16T: Int16Descriptor = { kind: \"int16\" };\n/** Descriptor for a `guint16`, marshalled as a number. */\nconst uint16T: Uint16Descriptor = { kind: \"uint16\" };\n/** Descriptor for a `gint32`, marshalled as a number. */\nconst int32T: Int32Descriptor = { kind: \"int32\" };\n/** Descriptor for a `guint32`, marshalled as a number. */\nconst uint32T: Uint32Descriptor = { kind: \"uint32\" };\n/** Descriptor for a `gint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst int64T: Int64Descriptor = { kind: \"int64\" };\n/** Descriptor for a `guint64`, marshalled as a number and rejected outside the 2^53 safe range. */\nconst uint64T: Uint64Descriptor = { kind: \"uint64\" };\n/** Descriptor for a `gint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst bigint64T: BigInt64Descriptor = { kind: \"bigint64\" };\n/** Descriptor for a `guint64`, marshalled as a bigint so the full 64-bit range survives. */\nconst biguint64T: BigUint64Descriptor = { kind: \"biguint64\" };\n/** Descriptor for a `GType`, marshalled as a bigint and recognized as a GType by GValue conversion. */\nconst gtypeT: TypeDescriptor = { kind: \"biguint64\", type: true };\n/** Descriptor for a `gfloat`. */\nconst float32T: Float32Descriptor = { kind: \"float32\" };\n/** Descriptor for a `gdouble`. */\nconst float64T: Float64Descriptor = { kind: \"float64\" };\n/** Descriptor for a `gboolean`, marshalled as a JavaScript boolean. */\nconst booleanT: BooleanDescriptor = { kind: \"boolean\" };\n/** Descriptor for the absence of a value, used as the return descriptor of a `void` function. */\nconst voidT: VoidDescriptor = { kind: \"void\" };\n/** Descriptor for a `gunichar`, marshalled as a single-character string or a codepoint number. */\nconst unicharT: UnicharDescriptor = { kind: \"unichar\" };\n/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */\nconst bufferT: BufferDescriptor = { kind: \"buffer\" };\nconst fundamentalLifecycles: Map<string, FundamentalLifecycle> = new Map();\n\nconst isGtypeDescriptor = (descriptor: Descriptor): descriptor is TypeDescriptor =>\n descriptor.kind === \"biguint64\" && \"type\" in descriptor;\n\n/** Builds a C-string descriptor, including optional buffer length and record-owned storage. */\nconst stringT = (\n ownership: Ownership = \"borrowed\",\n length?: number,\n hasOwnedStorage?: boolean,\n): StringDescriptor => {\n const result: StringDescriptor = { kind: \"string\", ownership };\n\n if (length !== undefined) {\n result.length = length;\n }\n\n if (hasOwnedStorage === true) {\n result.hasOwnedStorage = true;\n }\n\n return result;\n};\n\n/** Builds a runtime-typed `GObject` descriptor with an optional retained fallback class. */\nconst objectT = (\n ownership: Ownership = \"borrowed\",\n fallbackClass?: () => AnyClass,\n typeName?: string,\n): ObjectDescriptor => {\n const result: ObjectDescriptor = { kind: \"object\", ownership };\n\n if (fallbackClass !== undefined) {\n result.fallbackClass = fallbackClass;\n }\n\n if (typeName !== undefined) {\n result.typeName = typeName;\n }\n\n return result;\n};\n\n/** Wraps a descriptor in a pointer to it, for an output or inout argument. */\nconst refT = (innerDescriptor: Descriptor, isInout = false): RefDescriptor =>\n isInout ? { kind: \"ref\", innerDescriptor, inout: true } : { kind: \"ref\", innerDescriptor };\n\n/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */\nconst hashTableT = (\n keyDescriptor: Descriptor,\n valueDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n): HashTableDescriptor => ({\n kind: \"hashtable\",\n keyDescriptor,\n valueDescriptor,\n ownership,\n});\n\n/** Builds an enum descriptor from a GType function or an explicit set of members. */\nconst enumT = (\n sharedLibrary: string,\n typeFnName: string,\n isSigned: boolean,\n members?: number[],\n): EnumDescriptor => {\n const result: EnumDescriptor = {\n kind: \"enum\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n };\n\n if (members !== undefined) {\n result.members = members;\n }\n\n return result;\n};\n\n/** Builds a flags descriptor from a GType function or an explicit bit mask. */\nconst flagsT = (sharedLibrary: string, typeFnName: string, isSigned: boolean, mask?: number): FlagsDescriptor => {\n const result: FlagsDescriptor = {\n kind: \"flags\",\n sharedLibrary,\n getTypeFnName: typeFnName,\n isSigned,\n };\n\n if (mask !== undefined) {\n result.mask = mask;\n }\n\n return result;\n};\n\nconst applyBoxedNames = (result: BoxedDescriptor, options: BoxedOptions): void => {\n if (options.sharedLibrary !== undefined) {\n result.sharedLibrary = options.sharedLibrary;\n }\n\n if (options.getTypeFnName !== undefined) {\n result.getTypeFnName = options.getTypeFnName;\n }\n\n if (options.freeFnName !== undefined) {\n result.freeFnName = options.freeFnName;\n }\n};\n\nconst applyBoxedOptions = (result: BoxedDescriptor, options: BoxedOptions): void => {\n applyBoxedNames(result, options);\n\n if (options.fallbackClass !== undefined) {\n result.fallbackClass = options.fallbackClass;\n }\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n};\n\n/** Builds a descriptor for a `GBoxed` value of the named type. */\nconst boxedT = (typeName: string, options: BoxedOptions = {}): BoxedDescriptor => {\n const result: BoxedDescriptor = {\n kind: \"boxed\",\n ownership: options.ownership ?? \"borrowed\",\n typeName,\n };\n\n applyBoxedOptions(result, options);\n\n return result;\n};\n\nconst applyStructLifecycle = (result: StructDescriptor, options: StructOptions): void => {\n if (options.sharedLibrary === undefined) {\n return;\n }\n\n result.sharedLibrary = options.sharedLibrary;\n\n if (options.copyFnName !== undefined) {\n result.copyFnName = options.copyFnName;\n }\n\n if (options.freeFnName !== undefined) {\n result.freeFnName = options.freeFnName;\n }\n};\n\n/** Builds a descriptor for a plain C struct. */\nconst structT = (ownership: Ownership = \"borrowed\", options: StructOptions = {}): StructDescriptor => {\n const result: StructDescriptor = { kind: \"struct\", ownership };\n\n if (options.size !== undefined) {\n result.size = options.size;\n }\n\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n applyStructLifecycle(result, options);\n\n return result;\n};\n\nconst recordFundamentalLifecycle = (typeName: string, lifecycle: FundamentalLifecycle): void => {\n if (!fundamentalLifecycles.has(typeName)) {\n fundamentalLifecycles.set(typeName, lifecycle);\n }\n};\n\nconst fundamentalLifecycleFor = (typeName: string): FundamentalLifecycle | undefined =>\n fundamentalLifecycles.get(typeName);\n\nconst applyFundamentalClasses = (result: FundamentalDescriptor, options: FundamentalOptions): void => {\n if (options.wrapperClass !== undefined) {\n result.wrapperClass = options.wrapperClass;\n }\n\n if (options.fallbackClass !== undefined) {\n result.fallbackClass = options.fallbackClass;\n }\n};\n\n/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */\nconst fundamentalT = (\n sharedLibrary: string,\n refFnName: string,\n unrefFnName: string,\n options: FundamentalOptions = {},\n): FundamentalDescriptor => {\n const ownership = options.ownership ?? \"borrowed\";\n const result: FundamentalDescriptor = { kind: \"fundamental\", ownership, sharedLibrary, refFnName, unrefFnName };\n\n if (options.typeName !== undefined) {\n result.typeName = options.typeName;\n recordFundamentalLifecycle(options.typeName, { sharedLibrary, refFnName, unrefFnName });\n }\n\n applyFundamentalClasses(result, options);\n\n if (options.isCallerAllocated) {\n result.isCallerAllocated = true;\n }\n\n if (options.isInline) {\n result.isInline = true;\n }\n\n return result;\n};\n\nconst applyArrayBounds = (result: ArrayDescriptor, options: ArrayOptions): void => {\n if (options.baseParamIndex !== undefined) {\n result.baseParamIndex = options.baseParamIndex;\n }\n\n if (options.sizeParamIndex !== undefined) {\n result.sizeParamIndex = options.sizeParamIndex;\n }\n\n if (options.fixedSize !== undefined) {\n result.fixedSize = options.fixedSize;\n }\n};\n\n/** Builds a descriptor for an array of items in one of the supported container layouts. */\nconst arrayT = (\n itemDescriptor: Descriptor,\n arrayKind: ArrayKind = \"array\",\n ownership: Ownership = \"borrowed\",\n options?: ArrayOptions,\n): ArrayDescriptor => {\n const result: ArrayDescriptor = { kind: \"array\", itemDescriptor, arrayKind, ownership };\n\n if (options === undefined) {\n return result;\n }\n\n applyArrayBounds(result, options);\n\n if (options.elementSize !== undefined) {\n result.elementSize = options.elementSize;\n }\n\n if (options.isBytes === true) {\n result.isBytes = true;\n }\n\n if (options.isCallerAllocated === true) {\n result.isCallerAllocated = true;\n }\n\n if (options.isZeroTerminated === true) {\n result.isZeroTerminated = true;\n }\n\n return result;\n};\n\n/** Builds a descriptor for a `GList` of items. */\nconst listT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"glist\", ownership, options);\n\n/** Builds a descriptor for a `GSList` of items. */\nconst slistT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"gslist\", ownership, options);\n\n/** Builds a descriptor for a `GPtrArray` of items. */\nconst ptrArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"gptrarray\", ownership, options);\n\n/** Builds a descriptor for a `GArray` of items. */\nconst gArrayT = (\n itemDescriptor: Descriptor,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"garray\", ownership, options);\n\n/** Builds a descriptor for a `GByteArray`. */\nconst byteArrayT = (ownership: Ownership = \"borrowed\"): ArrayDescriptor =>\n arrayT(uint8T, \"gbytearray\", ownership, { isBytes: true });\n\n/** Builds a descriptor for a C array whose length is carried by another argument. */\nconst sizedArrayT = (\n itemDescriptor: Descriptor,\n sizeParamIndex: number,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"sized\", ownership, { ...options, sizeParamIndex });\n\n/** Builds an out-array cursor into another argument's buffer. */\nconst cursorArrayT = (\n itemDescriptor: Descriptor,\n bounds: CursorBounds,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"cursor\", ownership, { ...options, ...bounds });\n\n/** Builds a descriptor for a C array of a fixed length. */\nconst fixedArrayT = (\n itemDescriptor: Descriptor,\n fixedSize: number,\n ownership: Ownership = \"borrowed\",\n options: ArrayOptions = {},\n): ArrayDescriptor => arrayT(itemDescriptor, \"fixed\", ownership, { ...options, fixedSize });\n\nconst applyClosureLifetimeOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {\n if (options.hasDestroy !== undefined) {\n result.hasDestroy = options.hasDestroy;\n }\n\n if (options.destroyKind !== undefined) {\n result.destroyKind = options.destroyKind;\n }\n\n if (options.scope !== undefined) {\n result.scope = options.scope;\n }\n};\n\nconst applyClosureOptions = (result: CallbackDescriptor, options: CallbackOptions): void => {\n applyClosureLifetimeOptions(result, options);\n\n if (options.hasUserData !== undefined) {\n result.hasUserData = options.hasUserData;\n }\n\n if (options.userDataIndex !== undefined) {\n result.userDataIndex = options.userDataIndex;\n }\n\n if (options.canThrow !== undefined) {\n result.canThrow = options.canThrow;\n }\n};\n\n/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */\nconst callbackT = (\n argDescriptors: Descriptor[],\n returnDescriptor: Descriptor,\n options?: CallbackOptions,\n): CallbackDescriptor => {\n const result: CallbackDescriptor = { kind: \"callback\", argDescriptors, returnDescriptor };\n\n if (options === undefined) {\n return result;\n }\n\n applyClosureOptions(result, options);\n\n return result;\n};\n\nexport {\n int8T,\n uint8T,\n int16T,\n uint16T,\n int32T,\n uint32T,\n int64T,\n uint64T,\n bigint64T,\n biguint64T,\n gtypeT,\n isGtypeDescriptor,\n float32T,\n float64T,\n booleanT,\n voidT,\n unicharT,\n bufferT,\n stringT,\n objectT,\n refT,\n hashTableT,\n enumT,\n flagsT,\n boxedT,\n structT,\n fundamentalLifecycleFor,\n fundamentalT,\n arrayT,\n listT,\n slistT,\n ptrArrayT,\n gArrayT,\n byteArrayT,\n sizedArrayT,\n fixedArrayT,\n cursorArrayT,\n callbackT,\n type BoxedDescriptor,\n type ObjectDescriptor,\n type StructDescriptor,\n type FundamentalDescriptor,\n type ArrayDescriptor,\n type HashTableDescriptor,\n type CallbackDescriptor,\n type RefDescriptor,\n};\n"]}
|
package/dist/fn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fn.d.ts","sourceRoot":"","sources":["../src/fn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAE5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAA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CAAC;AAuKF,iBAAS,kBAAkB,CACvB,UAAU,EAAE,cAAc,CAAC,cAAc,CAAC,EAC1C,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,QAAQ,GAAG,SAAS,GACzC,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO,CAoCnC;AAaD;;;;;;;;;;;;;GAaG;AACH,iBAAS,EAAE,CACP,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAC9B,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO,CAYnC;AAED,OAAO,EAAE,mBAAmB,EAAE,EAAE,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/fn.js
CHANGED
|
@@ -85,10 +85,24 @@ const isPassThroughPlan = (plan, index) => plan.inputIndex === index &&
|
|
|
85
85
|
!plan.isCallerAllocated &&
|
|
86
86
|
!plan.carriesGtype &&
|
|
87
87
|
plan.arg.type.kind !== "callback";
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const KINDS_PASSED_AS_POINTER = new Set([
|
|
89
|
+
"array",
|
|
90
|
+
"boxed",
|
|
91
|
+
"buffer",
|
|
92
|
+
"callback",
|
|
93
|
+
"fundamental",
|
|
94
|
+
"hashtable",
|
|
95
|
+
"object",
|
|
96
|
+
"string",
|
|
97
|
+
"struct",
|
|
98
|
+
]);
|
|
99
|
+
const requiredInputs = (plans) => plans
|
|
100
|
+
.filter((plan) => plan.requiresInput && plan.arg.isRequired === true)
|
|
101
|
+
.map((plan) => ({ index: plan.inputIndex, rejectsNull: KINDS_PASSED_AS_POINTER.has(plan.arg.type.kind) }));
|
|
102
|
+
const assertRequiredInputs = (required, inputs) => {
|
|
103
|
+
for (const { index, rejectsNull } of required) {
|
|
104
|
+
const input = inputs[index];
|
|
105
|
+
if (input === undefined || (rejectsNull && input === null)) {
|
|
92
106
|
throw new TypeError(`Missing required argument at position ${String(index + 1)}`);
|
|
93
107
|
}
|
|
94
108
|
}
|
|
@@ -107,9 +121,9 @@ const returnReader = (spec) => spec.isReturnUnpacked === true
|
|
|
107
121
|
: (nativeResult) => fromNative(spec.returns, nativeResult);
|
|
108
122
|
const directCallable = (descriptor, readReturn, hasPrimary, plans) => {
|
|
109
123
|
const argCount = plans.length;
|
|
110
|
-
const
|
|
124
|
+
const required = requiredInputs(plans);
|
|
111
125
|
const marshal = (inputs) => {
|
|
112
|
-
assertRequiredInputs(
|
|
126
|
+
assertRequiredInputs(required, inputs);
|
|
113
127
|
return readReturn(call(descriptor, resizeInputs(inputs, argCount)));
|
|
114
128
|
};
|
|
115
129
|
if (hasPrimary) {
|
|
@@ -129,11 +143,11 @@ function fromNativeCallable(descriptor, spec, getRefSeeds) {
|
|
|
129
143
|
if (!canThrow && arePassThrough) {
|
|
130
144
|
return directCallable(descriptor, readReturn, hasPrimary, plans);
|
|
131
145
|
}
|
|
132
|
-
const
|
|
146
|
+
const required = requiredInputs(plans);
|
|
133
147
|
const shape = (inputs, nativeValues, nativeResult) => packTupleResult(readOutParams(outPlans, inputs, nativeValues), readReturn(nativeResult), hasPrimary);
|
|
134
148
|
if (canThrow) {
|
|
135
149
|
return (...inputs) => {
|
|
136
|
-
assertRequiredInputs(
|
|
150
|
+
assertRequiredInputs(required, inputs);
|
|
137
151
|
const nativeValues = buildNativeValues(plans, inputs, getRefSeeds?.());
|
|
138
152
|
const errorRef = { value: null };
|
|
139
153
|
nativeValues.push(errorRef);
|
|
@@ -143,7 +157,7 @@ function fromNativeCallable(descriptor, spec, getRefSeeds) {
|
|
|
143
157
|
};
|
|
144
158
|
}
|
|
145
159
|
return (...inputs) => {
|
|
146
|
-
assertRequiredInputs(
|
|
160
|
+
assertRequiredInputs(required, inputs);
|
|
147
161
|
const nativeValues = buildNativeValues(plans, inputs, getRefSeeds?.());
|
|
148
162
|
return shape(inputs, nativeValues, call(descriptor, nativeValues));
|
|
149
163
|
};
|