@gtkx/runtime 1.5.0 → 2.0.0-beta.1
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 +36 -36
- package/dist/descriptors.d.ts.map +1 -1
- package/dist/descriptors.js +65 -26
- package/dist/descriptors.js.map +1 -1
- package/dist/element-metadata.d.ts +9 -0
- package/dist/element-metadata.d.ts.map +1 -0
- package/dist/element-metadata.js +14 -0
- package/dist/element-metadata.js.map +1 -0
- package/dist/fn.d.ts +8 -2
- package/dist/fn.d.ts.map +1 -1
- package/dist/fn.js +43 -13
- 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 +4 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -26
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +5 -2
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -2
- package/dist/internal.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 +41 -5
- package/dist/native-value.js.map +1 -1
- package/dist/properties.d.ts +1 -1
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +2 -11
- package/dist/properties.js.map +1 -1
- package/dist/register-class.d.ts +45 -249
- package/dist/register-class.d.ts.map +1 -1
- package/dist/register-class.js +38 -1
- package/dist/register-class.js.map +1 -1
- package/dist/registry.d.ts +26 -3
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +75 -20
- package/dist/registry.js.map +1 -1
- package/dist/signal.d.ts.map +1 -1
- package/dist/signal.js +9 -22
- 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 +10 -1
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js +21 -2
- package/dist/type.js.map +1 -1
- package/dist/value.d.ts.map +1 -1
- package/dist/value.js +26 -4
- 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 +15 -6
- 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 +126 -44
- package/src/element-metadata.ts +24 -0
- package/src/fn.ts +64 -15
- package/src/folded-lengths.ts +23 -10
- package/src/index.ts +5 -24
- package/src/internal.ts +9 -2
- package/src/native-value.ts +54 -5
- package/src/properties.ts +3 -16
- package/src/register-class.ts +104 -249
- package/src/registry.ts +110 -19
- package/src/signal.ts +9 -34
- package/src/t.ts +5 -21
- package/src/type.ts +34 -1
- package/src/value.ts +37 -5
- package/src/variant.ts +2 -6
- package/src/vfunc-call.ts +3 -16
package/dist/descriptors.d.ts
CHANGED
|
@@ -64,10 +64,13 @@ type BooleanDescriptor = Extract<Descriptor, {
|
|
|
64
64
|
type StringDescriptor = Extract<Descriptor, {
|
|
65
65
|
kind: "string";
|
|
66
66
|
}>;
|
|
67
|
-
/** Descriptor variant for a `GObject
|
|
67
|
+
/** Descriptor variant for a `GObject`, extended with the statically declared type of its value. */
|
|
68
68
|
type ObjectDescriptor = Extract<Descriptor, {
|
|
69
69
|
kind: "object";
|
|
70
|
-
}
|
|
70
|
+
}> & {
|
|
71
|
+
/** Retains and supplies the declared wrapper when no more-derived wrapper is registered. */
|
|
72
|
+
fallbackClass?: () => AnyClass;
|
|
73
|
+
};
|
|
71
74
|
/** Descriptor variant for a `gunichar`. */
|
|
72
75
|
type UnicharDescriptor = Extract<Descriptor, {
|
|
73
76
|
kind: "unichar";
|
|
@@ -80,10 +83,13 @@ type VoidDescriptor = Extract<Descriptor, {
|
|
|
80
83
|
type BufferDescriptor = Extract<Descriptor, {
|
|
81
84
|
kind: "buffer";
|
|
82
85
|
}>;
|
|
83
|
-
/** Descriptor variant for a `GBoxed` value. */
|
|
86
|
+
/** Descriptor variant for a `GBoxed` value, extended with the statically declared type of its value. */
|
|
84
87
|
type BoxedDescriptor = Extract<Descriptor, {
|
|
85
88
|
kind: "boxed";
|
|
86
|
-
}
|
|
89
|
+
}> & {
|
|
90
|
+
/** Retains and supplies the declared wrapper when none is registered. */
|
|
91
|
+
fallbackClass?: () => AnyClass;
|
|
92
|
+
};
|
|
87
93
|
/** Descriptor variant for a plain C struct, extended with the class its decoded value is wrapped in. */
|
|
88
94
|
type StructDescriptor = Extract<Descriptor, {
|
|
89
95
|
kind: "struct";
|
|
@@ -97,6 +103,8 @@ type FundamentalDescriptor = Extract<Descriptor, {
|
|
|
97
103
|
}> & {
|
|
98
104
|
/** Class a decoded value is wrapped in; without it the wrapper comes from the type named by `typeName`. */
|
|
99
105
|
wrapperClass?: AnyClass;
|
|
106
|
+
/** Retains and supplies the declared wrapper after checking the runtime-type registry. */
|
|
107
|
+
fallbackClass?: () => AnyClass;
|
|
100
108
|
};
|
|
101
109
|
/** Descriptor variant for an array of items in one of the supported container layouts. */
|
|
102
110
|
type ArrayDescriptor = Extract<Descriptor, {
|
|
@@ -135,11 +143,10 @@ type BoxedOptions = {
|
|
|
135
143
|
freeFnName?: string;
|
|
136
144
|
/** Byte size of the value, needed to copy it into an inline field. */
|
|
137
145
|
size?: number;
|
|
146
|
+
/** Returns the wrapper class of the declared type, used when none is registered for the GType. */
|
|
147
|
+
fallbackClass?: () => AnyClass;
|
|
138
148
|
};
|
|
139
|
-
/**
|
|
140
|
-
* What the bindings do with a callback's return value, how the callee takes its closure, and how
|
|
141
|
-
* long that closure has to stay alive.
|
|
142
|
-
*/
|
|
149
|
+
/** Callback result, closure ownership, and lifetime options. */
|
|
143
150
|
type CallbackOptions = {
|
|
144
151
|
/** The callee also takes a destroy notify, which frees the closure once it is done with it. */
|
|
145
152
|
hasDestroy?: boolean;
|
|
@@ -149,10 +156,7 @@ type CallbackOptions = {
|
|
|
149
156
|
hasUserData?: boolean;
|
|
150
157
|
/** Position of `user_data` among the callback's own arguments, dropped before the closure is called. */
|
|
151
158
|
userDataIndex?: number;
|
|
152
|
-
/**
|
|
153
|
-
* The callback's C signature ends with a `GError**`, which receives a `GError` built from
|
|
154
|
-
* whatever the JavaScript function throws while the callback returns its failure value.
|
|
155
|
-
*/
|
|
159
|
+
/** Converts a thrown value to the callback's trailing `GError**`. */
|
|
156
160
|
canThrow?: boolean;
|
|
157
161
|
/** Lifetime of the closure; defaults to `notified` when `hasDestroy` is set and `call` otherwise. */
|
|
158
162
|
scope?: CallbackDescriptor["scope"];
|
|
@@ -169,12 +173,10 @@ type ArrayOptions = {
|
|
|
169
173
|
fixedSize?: number | undefined;
|
|
170
174
|
/** Whether the array carries raw bytes, and so decodes to a `Uint8Array` rather than to numbers. */
|
|
171
175
|
isBytes?: boolean | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* Whether the caller supplies the storage for a fixed-length out array: the runtime allocates
|
|
174
|
-
* a buffer of the element stride times the fixed element count, passes its pointer, and
|
|
175
|
-
* decodes the elements the callee wrote into it.
|
|
176
|
-
*/
|
|
176
|
+
/** Allocates and decodes caller-owned storage for a fixed-length out array. */
|
|
177
177
|
isCallerAllocated?: boolean | undefined;
|
|
178
|
+
/** Adds a zero element after the declared length. */
|
|
179
|
+
isZeroTerminated?: boolean | undefined;
|
|
178
180
|
};
|
|
179
181
|
/** Where a cursor array's base buffer and total length come from. */
|
|
180
182
|
type CursorBounds = {
|
|
@@ -191,6 +193,8 @@ type FundamentalOptions = {
|
|
|
191
193
|
typeName?: string;
|
|
192
194
|
/** Class a decoded value is wrapped in, instead of the one registered for `typeName`. */
|
|
193
195
|
wrapperClass?: AnyClass;
|
|
196
|
+
/** Returns the wrapper class of the declared type, used when none is registered for the value's type. */
|
|
197
|
+
fallbackClass?: () => AnyClass;
|
|
194
198
|
/** The caller owns the storage the callee fills, so a decoded value is borrowed instead of acquired. */
|
|
195
199
|
isCallerAllocated?: boolean;
|
|
196
200
|
/** The value is embedded in the containing struct rather than reached through a pointer. */
|
|
@@ -211,6 +215,12 @@ type StructOptions = {
|
|
|
211
215
|
size?: number;
|
|
212
216
|
/** Class a decoded value is wrapped in, instead of the one registered for its GType. */
|
|
213
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;
|
|
214
224
|
};
|
|
215
225
|
/** Descriptor for a `gint8`, marshalled as a number. */
|
|
216
226
|
declare const int8T: Int8Descriptor;
|
|
@@ -247,24 +257,17 @@ declare const unicharT: UnicharDescriptor;
|
|
|
247
257
|
/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */
|
|
248
258
|
declare const bufferT: BufferDescriptor;
|
|
249
259
|
declare const isGtypeDescriptor: (descriptor: Descriptor) => descriptor is TypeDescriptor;
|
|
250
|
-
/**
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
declare const stringT: (ownership?: Ownership, length?: number) => StringDescriptor;
|
|
255
|
-
/** Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType. */
|
|
256
|
-
declare const objectT: (ownership?: Ownership) => 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;
|
|
257
264
|
/** Wraps a descriptor in a pointer to it, for an output or inout argument. */
|
|
258
265
|
declare const refT: (innerDescriptor: Descriptor, isInout?: boolean) => RefDescriptor;
|
|
259
266
|
/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */
|
|
260
267
|
declare const hashTableT: (keyDescriptor: Descriptor, valueDescriptor: Descriptor, ownership?: Ownership) => HashTableDescriptor;
|
|
261
|
-
/** Builds
|
|
262
|
-
declare const enumT: (sharedLibrary: string, typeFnName: string, isSigned: boolean) => EnumDescriptor;
|
|
263
|
-
/**
|
|
264
|
-
* Builds a descriptor for a flags type, resolving its GType from the named `get_type` function.
|
|
265
|
-
* For flags without a registered GType, pass empty library and function names and supply `mask`,
|
|
266
|
-
* the union of all valid bits, which invalid combinations are rejected against.
|
|
267
|
-
*/
|
|
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. */
|
|
268
271
|
declare const flagsT: (sharedLibrary: string, typeFnName: string, isSigned: boolean, mask?: number) => FlagsDescriptor;
|
|
269
272
|
/** Builds a descriptor for a `GBoxed` value of the named type. */
|
|
270
273
|
declare const boxedT: (typeName: string, options?: BoxedOptions) => BoxedDescriptor;
|
|
@@ -287,14 +290,11 @@ declare const gArrayT: (itemDescriptor: Descriptor, ownership?: Ownership, optio
|
|
|
287
290
|
declare const byteArrayT: (ownership?: Ownership) => ArrayDescriptor;
|
|
288
291
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
289
292
|
declare const sizedArrayT: (itemDescriptor: Descriptor, sizeParamIndex: number, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
290
|
-
/**
|
|
291
|
-
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
292
|
-
* elements from where it points to the end of that buffer.
|
|
293
|
-
*/
|
|
293
|
+
/** Builds an out-array cursor into another argument's buffer. */
|
|
294
294
|
declare const cursorArrayT: (itemDescriptor: Descriptor, bounds: CursorBounds, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
295
295
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
296
296
|
declare const fixedArrayT: (itemDescriptor: Descriptor, fixedSize: number, ownership?: Ownership, options?: ArrayOptions) => ArrayDescriptor;
|
|
297
297
|
/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */
|
|
298
298
|
declare const callbackT: (argDescriptors: Descriptor[], returnDescriptor: Descriptor, options?: CallbackOptions) => CallbackDescriptor;
|
|
299
|
-
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, isGtypeDescriptor, float32T, float64T, booleanT, voidT, unicharT, bufferT, stringT, objectT, refT, hashTableT, enumT, flagsT, boxedT, structT, fundamentalLifecycleFor, fundamentalT, arrayT, listT, slistT, ptrArrayT, gArrayT, byteArrayT, sizedArrayT, fixedArrayT, cursorArrayT, callbackT, type BoxedDescriptor, type StructDescriptor, type FundamentalDescriptor, type ArrayDescriptor, type HashTableDescriptor, type CallbackDescriptor, type RefDescriptor, };
|
|
299
|
+
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, isGtypeDescriptor, float32T, float64T, booleanT, voidT, unicharT, bufferT, stringT, objectT, refT, hashTableT, enumT, flagsT, boxedT, structT, fundamentalLifecycleFor, fundamentalT, arrayT, listT, slistT, ptrArrayT, gArrayT, byteArrayT, sizedArrayT, fixedArrayT, cursorArrayT, callbackT, type BoxedDescriptor, type ObjectDescriptor, type StructDescriptor, type FundamentalDescriptor, type ArrayDescriptor, type HashTableDescriptor, type CallbackDescriptor, type RefDescriptor, };
|
|
300
300
|
//# sourceMappingURL=descriptors.d.ts.map
|
|
@@ -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,CAAC,CAAC;AAC5D,yCAAyC;AACzC,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAC9D,yCAAyC;AACzC,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAC9D,0CAA0C;AAC1C,KAAK,gBAAgB,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAChE,yCAAyC;AACzC,KAAK,eAAe,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAC9D,0CAA0C;AA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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,13 +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
|
-
|
|
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
|
+
};
|
|
44
59
|
/** Wraps a descriptor in a pointer to it, for an output or inout argument. */
|
|
45
60
|
const refT = (innerDescriptor, isInout = false) => isInout ? { kind: "ref", innerDescriptor, inout: true } : { kind: "ref", innerDescriptor };
|
|
46
61
|
/** Builds a descriptor for a `GHashTable`, marshalled as an array of key/value pairs. */
|
|
@@ -50,18 +65,20 @@ const hashTableT = (keyDescriptor, valueDescriptor, ownership = "borrowed") => (
|
|
|
50
65
|
valueDescriptor,
|
|
51
66
|
ownership,
|
|
52
67
|
});
|
|
53
|
-
/** Builds
|
|
54
|
-
const enumT = (sharedLibrary, typeFnName, isSigned) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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. */
|
|
65
82
|
const flagsT = (sharedLibrary, typeFnName, isSigned, mask) => {
|
|
66
83
|
const result = {
|
|
67
84
|
kind: "flags",
|
|
@@ -87,6 +104,9 @@ const applyBoxedNames = (result, options) => {
|
|
|
87
104
|
};
|
|
88
105
|
const applyBoxedOptions = (result, options) => {
|
|
89
106
|
applyBoxedNames(result, options);
|
|
107
|
+
if (options.fallbackClass !== undefined) {
|
|
108
|
+
result.fallbackClass = options.fallbackClass;
|
|
109
|
+
}
|
|
90
110
|
if (options.isCallerAllocated) {
|
|
91
111
|
result.isCallerAllocated = true;
|
|
92
112
|
}
|
|
@@ -107,6 +127,18 @@ const boxedT = (typeName, options = {}) => {
|
|
|
107
127
|
applyBoxedOptions(result, options);
|
|
108
128
|
return result;
|
|
109
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
|
+
};
|
|
110
142
|
/** Builds a descriptor for a plain C struct. */
|
|
111
143
|
const structT = (ownership = "borrowed", options = {}) => {
|
|
112
144
|
const result = { kind: "struct", ownership };
|
|
@@ -122,6 +154,7 @@ const structT = (ownership = "borrowed", options = {}) => {
|
|
|
122
154
|
if (options.isInline) {
|
|
123
155
|
result.isInline = true;
|
|
124
156
|
}
|
|
157
|
+
applyStructLifecycle(result, options);
|
|
125
158
|
return result;
|
|
126
159
|
};
|
|
127
160
|
const recordFundamentalLifecycle = (typeName, lifecycle) => {
|
|
@@ -130,6 +163,14 @@ const recordFundamentalLifecycle = (typeName, lifecycle) => {
|
|
|
130
163
|
}
|
|
131
164
|
};
|
|
132
165
|
const fundamentalLifecycleFor = (typeName) => fundamentalLifecycles.get(typeName);
|
|
166
|
+
const applyFundamentalClasses = (result, options) => {
|
|
167
|
+
if (options.wrapperClass !== undefined) {
|
|
168
|
+
result.wrapperClass = options.wrapperClass;
|
|
169
|
+
}
|
|
170
|
+
if (options.fallbackClass !== undefined) {
|
|
171
|
+
result.fallbackClass = options.fallbackClass;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
133
174
|
/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */
|
|
134
175
|
const fundamentalT = (sharedLibrary, refFnName, unrefFnName, options = {}) => {
|
|
135
176
|
const ownership = options.ownership ?? "borrowed";
|
|
@@ -138,9 +179,7 @@ const fundamentalT = (sharedLibrary, refFnName, unrefFnName, options = {}) => {
|
|
|
138
179
|
result.typeName = options.typeName;
|
|
139
180
|
recordFundamentalLifecycle(options.typeName, { sharedLibrary, refFnName, unrefFnName });
|
|
140
181
|
}
|
|
141
|
-
|
|
142
|
-
result.wrapperClass = options.wrapperClass;
|
|
143
|
-
}
|
|
182
|
+
applyFundamentalClasses(result, options);
|
|
144
183
|
if (options.isCallerAllocated) {
|
|
145
184
|
result.isCallerAllocated = true;
|
|
146
185
|
}
|
|
@@ -176,6 +215,9 @@ const arrayT = (itemDescriptor, arrayKind = "array", ownership = "borrowed", opt
|
|
|
176
215
|
if (options.isCallerAllocated === true) {
|
|
177
216
|
result.isCallerAllocated = true;
|
|
178
217
|
}
|
|
218
|
+
if (options.isZeroTerminated === true) {
|
|
219
|
+
result.isZeroTerminated = true;
|
|
220
|
+
}
|
|
179
221
|
return result;
|
|
180
222
|
};
|
|
181
223
|
/** Builds a descriptor for a `GList` of items. */
|
|
@@ -190,10 +232,7 @@ const gArrayT = (itemDescriptor, ownership = "borrowed", options = {}) => arrayT
|
|
|
190
232
|
const byteArrayT = (ownership = "borrowed") => arrayT(uint8T, "gbytearray", ownership, { isBytes: true });
|
|
191
233
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
192
234
|
const sizedArrayT = (itemDescriptor, sizeParamIndex, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "sized", ownership, { ...options, sizeParamIndex });
|
|
193
|
-
/**
|
|
194
|
-
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
195
|
-
* elements from where it points to the end of that buffer.
|
|
196
|
-
*/
|
|
235
|
+
/** Builds an out-array cursor into another argument's buffer. */
|
|
197
236
|
const cursorArrayT = (itemDescriptor, bounds, ownership = "borrowed", options = {}) => arrayT(itemDescriptor, "cursor", ownership, { ...options, ...bounds });
|
|
198
237
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
199
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":"AA6KA,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,0DAA0D;AAC1D,MAAM,OAAO,GAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACrD,yDAAyD;AACzD,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClD,0DAA0D;AAC1D,MAAM,OAAO,GAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACrD,kGAAkG;AAClG,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAClD,mGAAmG;AACnG,MAAM,OAAO,GAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACrD,2FAA2F;AAC3F,MAAM,SAAS,GAAuB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC3D,4FAA4F;AAC5F,MAAM,UAAU,GAAwB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAC9D,uGAAuG;AACvG,MAAM,MAAM,GAAmB,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACjE,iCAAiC;AACjC,MAAM,QAAQ,GAAsB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACxD,kCAAkC;AAClC,MAAM,QAAQ,GAAsB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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,GAQZ,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/** Descriptor variant for a `GObject`. */\ntype ObjectDescriptor = Extract<Descriptor, { kind: \"object\" }>;\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/** Descriptor variant for a `GBoxed` value. */\ntype BoxedDescriptor = Extract<Descriptor, { kind: \"boxed\" }>;\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\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};\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 /** 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/** Builds a descriptor for a `GObject`, wrapped in the class registered for its runtime GType. */\nconst objectT = (ownership: Ownership = \"borrowed\"): ObjectDescriptor => ({ kind: \"object\", ownership });\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.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\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 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 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 StructDescriptor,\n type FundamentalDescriptor,\n type ArrayDescriptor,\n type HashTableDescriptor,\n type Callback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AO,CAAC,aAAa,CAAC;IACjD,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACvC,CAAC;AACL,CAAC,CAAC;AAEF,2GAA2G;AAC3G,MAAM,SAAS,GAAG,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 /** 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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ElementPropertyEntry = [name: string, flags: number, defaultValue?: unknown];
|
|
2
|
+
declare const registeredElementSignals: Record<string, Record<string, string>>;
|
|
3
|
+
declare const registeredElementProperties: Record<string, Record<string, ElementPropertyEntry>>;
|
|
4
|
+
declare const registerElementMetadata: (name: string, _parent: string | undefined, ownSignals: Record<string, string>, ownProperties: Record<string, ElementPropertyEntry>) => string;
|
|
5
|
+
declare const elementMetadataVersion: () => number;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export { type ElementPropertyEntry, registerElementMetadata };
|
|
8
|
+
export { elementMetadataVersion, registeredElementProperties, registeredElementSignals };
|
|
9
|
+
//# sourceMappingURL=element-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-metadata.d.ts","sourceRoot":"","sources":["../src/element-metadata.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAElF,QAAA,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,CAAC;AAC5E,QAAA,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAM,CAAC;AAG7F,QAAA,MAAM,uBAAuB,GACzB,MAAM,MAAM,EACZ,SAAS,MAAM,GAAG,SAAS,EAC3B,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,eAAe,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,KACpD,MAMF,CAAC;AAEF,QAAA,MAAM,sBAAsB,QAAO,MAAuB,CAAC;AAE3D,gBAAgB;AAChB,OAAO,EAAE,KAAK,oBAAoB,EAAE,uBAAuB,EAAE,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const registeredElementSignals = {};
|
|
2
|
+
const registeredElementProperties = {};
|
|
3
|
+
const state = { version: 0 };
|
|
4
|
+
const registerElementMetadata = (name, _parent, ownSignals, ownProperties) => {
|
|
5
|
+
registeredElementSignals[name] = ownSignals;
|
|
6
|
+
registeredElementProperties[name] = ownProperties;
|
|
7
|
+
state.version += 1;
|
|
8
|
+
return name;
|
|
9
|
+
};
|
|
10
|
+
const elementMetadataVersion = () => state.version;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export { registerElementMetadata };
|
|
13
|
+
export { elementMetadataVersion, registeredElementProperties, registeredElementSignals };
|
|
14
|
+
//# sourceMappingURL=element-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-metadata.js","sourceRoot":"","sources":["../src/element-metadata.ts"],"names":[],"mappings":"AAEA,MAAM,wBAAwB,GAA2C,EAAE,CAAC;AAC5E,MAAM,2BAA2B,GAAyD,EAAE,CAAC;AAC7F,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAE7B,MAAM,uBAAuB,GAAG,CAC5B,IAAY,EACZ,OAA2B,EAC3B,UAAkC,EAClC,aAAmD,EAC7C,EAAE;IACR,wBAAwB,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;IAC5C,2BAA2B,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC;IAClD,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;IAEnB,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,GAAW,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;AAE3D,gBAAgB;AAChB,OAAO,EAA6B,uBAAuB,EAAE,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["type ElementPropertyEntry = [name: string, flags: number, defaultValue?: unknown];\n\nconst registeredElementSignals: Record<string, Record<string, string>> = {};\nconst registeredElementProperties: Record<string, Record<string, ElementPropertyEntry>> = {};\nconst state = { version: 0 };\n\nconst registerElementMetadata = (\n name: string,\n _parent: string | undefined,\n ownSignals: Record<string, string>,\n ownProperties: Record<string, ElementPropertyEntry>,\n): string => {\n registeredElementSignals[name] = ownSignals;\n registeredElementProperties[name] = ownProperties;\n state.version += 1;\n\n return name;\n};\n\nconst elementMetadataVersion = (): number => state.version;\n\n/** @internal */\nexport { type ElementPropertyEntry, registerElementMetadata };\nexport { elementMetadataVersion, registeredElementProperties, registeredElementSignals };\n"]}
|
package/dist/fn.d.ts
CHANGED
|
@@ -29,10 +29,16 @@ declare function fromNativeCallable(descriptor: ExternalObject<CallDescriptor>,
|
|
|
29
29
|
* Binds a symbol in a shared library to a callable that marshals its inputs and packs output
|
|
30
30
|
* arguments into the result. When the spec sets `canThrow`, the reported `GError` is thrown.
|
|
31
31
|
*
|
|
32
|
+
* A plain spec is bound when `fn` is called, so a malformed descriptor throws at binding time.
|
|
33
|
+
* Passing a function returning the spec instead defers building the descriptors and the binding
|
|
34
|
+
* to the first call, so describing such a binding costs nothing until something calls it and a
|
|
35
|
+
* module full of them loads without touching the shared library.
|
|
36
|
+
*
|
|
32
37
|
* @param sharedLibrary Shared library the symbol is looked up in.
|
|
33
38
|
* @param symbol Name of the C symbol to bind.
|
|
34
|
-
* @param spec Argument and return descriptors the call is marshalled through
|
|
39
|
+
* @param spec Argument and return descriptors the call is marshalled through, or a function
|
|
40
|
+
* returning them, which defers building the descriptors and the binding to the first call.
|
|
35
41
|
*/
|
|
36
|
-
declare function fn(sharedLibrary: string, symbol: string, spec: FnSpec): (...inputs: unknown[]) => unknown;
|
|
42
|
+
declare function fn(sharedLibrary: string, symbol: string, spec: FnSpec | (() => FnSpec)): (...inputs: unknown[]) => unknown;
|
|
37
43
|
export { buildNativeArgTypes, fn, fromNativeCallable };
|
|
38
44
|
//# sourceMappingURL=fn.d.ts.map
|
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,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,GAAG,EAAgF,MAAM,UAAU,CAAC;AAWlH,wDAAwD;AACxD,KAAK,MAAM,GAAG;IACV,uFAAuF;IACvF,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,+FAA+F;IAC/F,OAAO,EAAE,UAAU,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iGAAiG;IACjG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gGAAgG;IAChG,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAmBF,QAAA,MAAM,mBAAmB,GAAI,MAAM,GAAG,EAAE,EAAE,UAAU,OAAO,KAAG,UAAU,EAYvE,CAAC;
|
|
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,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,GAAG,EAAgF,MAAM,UAAU,CAAC;AAWlH,wDAAwD;AACxD,KAAK,MAAM,GAAG;IACV,uFAAuF;IACvF,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,+FAA+F;IAC/F,OAA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