@gtkx/runtime 1.0.0 → 1.1.0
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 +1 -1
- package/dist/application-class.d.ts +5 -0
- package/dist/application-class.d.ts.map +1 -1
- package/dist/application-class.js +11 -1
- package/dist/application-class.js.map +1 -1
- package/dist/callback.d.ts +2 -2
- package/dist/callback.d.ts.map +1 -1
- package/dist/callback.js +51 -54
- package/dist/callback.js.map +1 -1
- package/dist/default-application.d.ts +4 -0
- package/dist/default-application.d.ts.map +1 -0
- package/dist/default-application.js +17 -0
- package/dist/default-application.js.map +1 -0
- package/dist/descriptors.d.ts +25 -2
- package/dist/descriptors.d.ts.map +1 -1
- package/dist/descriptors.js +31 -9
- package/dist/descriptors.js.map +1 -1
- package/dist/exit-hook.js +13 -0
- package/dist/exit-hook.js.map +1 -1
- package/dist/fn.d.ts +5 -0
- package/dist/fn.d.ts.map +1 -1
- package/dist/fn.js +11 -13
- package/dist/fn.js.map +1 -1
- package/dist/folded-lengths.d.ts +16 -0
- package/dist/folded-lengths.d.ts.map +1 -0
- package/dist/folded-lengths.js +38 -0
- package/dist/folded-lengths.js.map +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/library.d.ts +2 -1
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +2 -1
- package/dist/library.js.map +1 -1
- package/dist/lifecycle.d.ts +16 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +44 -14
- package/dist/lifecycle.js.map +1 -1
- package/dist/listeners.d.ts.map +1 -1
- package/dist/listeners.js +16 -4
- package/dist/listeners.js.map +1 -1
- package/dist/native-value.js +2 -2
- package/dist/native-value.js.map +1 -1
- package/dist/object.d.ts +7 -2
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +7 -2
- package/dist/object.js.map +1 -1
- package/dist/param-spec.d.ts.map +1 -1
- package/dist/param-spec.js +18 -20
- package/dist/param-spec.js.map +1 -1
- package/dist/properties.d.ts +2 -1
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +13 -9
- package/dist/properties.js.map +1 -1
- package/dist/register-class.d.ts +30 -0
- package/dist/register-class.d.ts.map +1 -1
- package/dist/register-class.js +21 -7
- package/dist/register-class.js.map +1 -1
- package/dist/registry.d.ts +12 -3
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +24 -15
- package/dist/registry.js.map +1 -1
- package/dist/signal.d.ts +2 -2
- package/dist/signal.d.ts.map +1 -1
- package/dist/signal.js +22 -18
- package/dist/signal.js.map +1 -1
- package/dist/t.d.ts +2 -0
- package/dist/t.d.ts.map +1 -1
- package/dist/t.js +1 -0
- package/dist/t.js.map +1 -1
- package/dist/tuple.d.ts +6 -3
- package/dist/tuple.d.ts.map +1 -1
- package/dist/tuple.js +9 -7
- package/dist/tuple.js.map +1 -1
- package/dist/value.d.ts +3 -1
- package/dist/value.d.ts.map +1 -1
- package/dist/value.js +64 -18
- package/dist/value.js.map +1 -1
- package/dist/vfunc-call.d.ts.map +1 -1
- package/dist/vfunc-call.js +5 -1
- package/dist/vfunc-call.js.map +1 -1
- package/dist/vfunc.d.ts.map +1 -1
- package/dist/vfunc.js +9 -3
- package/dist/vfunc.js.map +1 -1
- package/package.json +14 -4
- package/src/application-class.ts +12 -2
- package/src/callback.ts +70 -66
- package/src/default-application.ts +21 -0
- package/src/descriptors.ts +69 -14
- package/src/exit-hook.ts +18 -0
- package/src/fn.ts +23 -13
- package/src/folded-lengths.ts +64 -0
- package/src/internal.ts +1 -0
- package/src/library.ts +2 -1
- package/src/lifecycle.ts +60 -14
- package/src/listeners.ts +22 -5
- package/src/native-value.ts +2 -2
- package/src/object.ts +7 -2
- package/src/param-spec.ts +21 -22
- package/src/properties.ts +23 -9
- package/src/register-class.ts +63 -8
- package/src/registry.ts +40 -18
- package/src/signal.ts +32 -28
- package/src/t.ts +3 -0
- package/src/tuple.ts +18 -12
- package/src/value.ts +94 -19
- package/src/vfunc-call.ts +5 -1
- package/src/vfunc.ts +10 -3
package/README.md
CHANGED
|
@@ -23,6 +23,11 @@ declare const shutDownThroughRun: (application: ShutdownApplication) => void;
|
|
|
23
23
|
* once per instance and crashes on a second parse, so {@link runApplication} and
|
|
24
24
|
* {@link quitApplication} only accept an application built here.
|
|
25
25
|
*
|
|
26
|
+
* Whatever `g_application_constructed` assigned to the process-wide default is handed straight back,
|
|
27
|
+
* so merely building an application never makes it what `Gio.Application.getDefault()` returns.
|
|
28
|
+
* {@link runApplication} is the only place that claims that default, which keeps it pointing at an
|
|
29
|
+
* application GTKX has actually started rather than at one that is still unregistered.
|
|
30
|
+
*
|
|
26
31
|
* @param base The application class to construct, such as `Gtk.Application`.
|
|
27
32
|
* @param props Construct properties, passed through unchanged.
|
|
28
33
|
* @returns An instance of a class derived from `base`, registered once per base class as its own GType.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-class.d.ts","sourceRoot":"","sources":["../src/application-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"application-class.d.ts","sourceRoot":"","sources":["../src/application-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,aAAa,CAAC;AAOzD,KAAK,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;AAErD;;;GAGG;AACH,KAAK,sBAAsB,GAAG;IAC1B,kGAAkG;IAClG,IAAI,IAAI,IAAI,CAAC;CAChB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IAC/B,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;CAC1D,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;CAC/B,CAAC;AAEF,8EAA8E;AAC9E,KAAK,gBAAgB,CAAC,CAAC,SAAS,sBAAsB,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AA2CjG,QAAA,MAAM,oBAAoB,GAAI,aAAa,MAAM,KAAG,WAAW,IAAI,2BAQlE,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,aAAa,mBAAmB,KAAG,IAY9D,CAAC;AAKF;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,iBAAiB,GAAI,CAAC,SAAS,sBAAsB,EAAE,CAAC,EAAE,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAAG,CAKxG,CAAC;AAEF,OAAO,EACH,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,GACnC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getOrInsert } from "@gtkx/utils";
|
|
2
|
+
import { releaseDefaultApplication } from "./default-application.js";
|
|
2
3
|
import { registerClass } from "./register-class.js";
|
|
3
4
|
import { getClassType } from "./registry.js";
|
|
4
5
|
import { typeName } from "./type.js";
|
|
@@ -59,10 +60,19 @@ const deriveApplicationClass = (base) => getOrInsert(derivedClasses, base, () =>
|
|
|
59
60
|
* once per instance and crashes on a second parse, so {@link runApplication} and
|
|
60
61
|
* {@link quitApplication} only accept an application built here.
|
|
61
62
|
*
|
|
63
|
+
* Whatever `g_application_constructed` assigned to the process-wide default is handed straight back,
|
|
64
|
+
* so merely building an application never makes it what `Gio.Application.getDefault()` returns.
|
|
65
|
+
* {@link runApplication} is the only place that claims that default, which keeps it pointing at an
|
|
66
|
+
* application GTKX has actually started rather than at one that is still unregistered.
|
|
67
|
+
*
|
|
62
68
|
* @param base The application class to construct, such as `Gtk.Application`.
|
|
63
69
|
* @param props Construct properties, passed through unchanged.
|
|
64
70
|
* @returns An instance of a class derived from `base`, registered once per base class as its own GType.
|
|
65
71
|
*/
|
|
66
|
-
const createApplication = (base, props) =>
|
|
72
|
+
const createApplication = (base, props) => {
|
|
73
|
+
const application = new (deriveApplicationClass(base))(props);
|
|
74
|
+
releaseDefaultApplication(application);
|
|
75
|
+
return application;
|
|
76
|
+
};
|
|
67
77
|
export { createApplication, isDerivedApplication, shutDownThroughRun, };
|
|
68
78
|
//# sourceMappingURL=application-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-class.js","sourceRoot":"","sources":["../src/application-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAwB7C,MAAM,cAAc,GAAgC,IAAI,OAAO,EAAE,CAAC;AAClE,MAAM,yBAAyB,GAAkB,IAAI,GAAG,EAAE,CAAC;AAC3D,MAAM,gBAAgB,GAAoB,IAAI,OAAO,EAAE,CAAC;AACxD,MAAM,wBAAwB,GAAoB,IAAI,OAAO,EAAE,CAAC;AAEhE,MAAM,eAAe,GAAG,CAAC,IAAc,EAAU,EAAE,CAAC,OAAO,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AAEvG,MAAM,qBAAqB,GAAG,CAAC,IAAsC,EAAoC,EAAE;IACvG,MAAM,kBAAmB,SAAQ,IAAI;QACjC,mBAAmB,CAAC,IAAc;YAC9B,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QAES,q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I,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;YAAS,CAAC;QACP,wBAAwB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAmC,IAAiB,EAAe,EAAE,CAChG,WAAW,CAAC,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAgB,CAAC;AAExF;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,CAAsC,IAA4B,EAAE,KAAQ,EAAK,EAAE;IACzG,MAAM,WAAW,GAAG,KAAK,sBAAsB,CAAC,IAAI,CAAyB,EAAC,KAAK,CAAC,CAAC;IACrF,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAEvC,OAAO,WAAW,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,EACH,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GAIrB,CAAC","sourcesContent":["import { type AnyClass, getOrInsert } from \"@gtkx/utils\";\nimport { releaseDefaultApplication } from \"./default-application.js\";\nimport { registerClass } from \"./register-class.js\";\nimport { getClassType } from \"./registry.js\";\nimport { typeName } from \"./type.js\";\nimport { callParent } from \"./vfunc-call.js\";\n\ntype CommandLineResult = [boolean, string[], number];\n\n/**\n * The GIO application surface {@link createApplication} builds on, which `Gio.Application` and\n * every subclass of it satisfies structurally.\n */\ntype CommandLineApplication = {\n /** Marks the application as quitting, so GLib's own `run` returns without driving a main loop. */\n quit(): void;\n};\n\ntype LocalCommandLineApplication = {\n runLocalCommandLine(argv: string[]): CommandLineResult;\n};\n\ntype ShutdownApplication = {\n run(argv: string[]): number;\n};\n\n/** An application class together with the construct properties it accepts. */\ntype ApplicationClass<T extends CommandLineApplication, P> = AnyClass<T> & (new (props: P) => T);\n\nconst derivedClasses: WeakMap<AnyClass, AnyClass> = new WeakMap();\nconst derivedApplicationClasses: Set<AnyClass> = new Set();\nconst quitApplications: WeakSet<object> = new WeakSet();\nconst shuttingDownApplications: WeakSet<object> = new WeakSet();\n\nconst derivedTypeName = (base: AnyClass): string => `Gtkx${typeName(getClassType(base)) ?? base.name}`;\n\nconst buildApplicationClass = (base: AnyClass<CommandLineApplication>): AnyClass<CommandLineApplication> => {\n class DerivedApplication extends base {\n runLocalCommandLine(argv: string[]): CommandLineResult {\n return this.vfuncLocalCommandLine(argv);\n }\n\n protected vfuncLocalCommandLine(argv: string[]): CommandLineResult {\n if (shuttingDownApplications.has(this)) {\n this.quit();\n\n return [true, argv, 0];\n }\n\n return callParent(DerivedApplication, \"vfuncLocalCommandLine\", this, argv) as CommandLineResult;\n }\n\n protected vfuncNameLost(): boolean {\n quitApplications.add(this);\n\n return callParent(DerivedApplication, \"vfuncNameLost\", this) as boolean;\n }\n\n override quit(): void {\n quitApplications.add(this);\n super.quit();\n }\n }\n\n const derived = registerClass(DerivedApplication, { typeName: derivedTypeName(base) });\n derivedApplicationClasses.add(derived);\n\n return derived;\n};\n\nconst isDerivedApplication = (application: object): application is LocalCommandLineApplication => {\n for (const derived of derivedApplicationClasses) {\n if (application instanceof derived) {\n return true;\n }\n }\n\n return false;\n};\n\nconst shutDownThroughRun = (application: ShutdownApplication): void => {\n if (!isDerivedApplication(application) || quitApplications.has(application)) {\n return;\n }\n\n shuttingDownApplications.add(application);\n\n try {\n application.run([]);\n } finally {\n shuttingDownApplications.delete(application);\n }\n};\n\nconst deriveApplicationClass = <T extends CommandLineApplication>(base: AnyClass<T>): AnyClass<T> =>\n getOrInsert(derivedClasses, base, () => buildApplicationClass(base)) as AnyClass<T>;\n\n/**\n * Constructs an application GTKX can shut down. GLib parses an application's command line at most\n * once per instance and crashes on a second parse, so {@link runApplication} and\n * {@link quitApplication} only accept an application built here.\n *\n * Whatever `g_application_constructed` assigned to the process-wide default is handed straight back,\n * so merely building an application never makes it what `Gio.Application.getDefault()` returns.\n * {@link runApplication} is the only place that claims that default, which keeps it pointing at an\n * application GTKX has actually started rather than at one that is still unregistered.\n *\n * @param base The application class to construct, such as `Gtk.Application`.\n * @param props Construct properties, passed through unchanged.\n * @returns An instance of a class derived from `base`, registered once per base class as its own GType.\n */\nconst createApplication = <T extends CommandLineApplication, P>(base: ApplicationClass<T, P>, props: P): T => {\n const application = new (deriveApplicationClass(base) as new (props: P) => T)(props);\n releaseDefaultApplication(application);\n\n return application;\n};\n\nexport {\n createApplication,\n isDerivedApplication,\n shutDownThroughRun,\n type ApplicationClass,\n type CommandLineApplication,\n type LocalCommandLineApplication,\n};\n"]}
|
package/dist/callback.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Descriptor } from "@gtkx/native";
|
|
2
2
|
import type { CallbackDescriptor } from "./descriptors.js";
|
|
3
3
|
type Callback = (...args: unknown[]) => unknown;
|
|
4
|
-
type
|
|
4
|
+
type CallbackKind = "vfunc" | "signal" | "callback";
|
|
5
5
|
type CallbackSpec = {
|
|
6
6
|
argDescriptors: Descriptor[];
|
|
7
7
|
returnDescriptor: Descriptor;
|
|
@@ -9,6 +9,6 @@ type CallbackSpec = {
|
|
|
9
9
|
};
|
|
10
10
|
declare const isCallerAllocatedOut: (descriptor: Descriptor) => boolean;
|
|
11
11
|
declare const wrapCallbackValue: (spec: CallbackDescriptor, callback: unknown) => unknown;
|
|
12
|
-
declare function wrapCallback(fn: Callback, spec: CallbackSpec,
|
|
12
|
+
declare function wrapCallback(fn: Callback, spec: CallbackSpec, kind: CallbackKind): Callback;
|
|
13
13
|
export { isCallerAllocatedOut, wrapCallbackValue, wrapCallback };
|
|
14
14
|
//# sourceMappingURL=callback.d.ts.map
|
package/dist/callback.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../src/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../src/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,kBAAkB,CAAC;AAQ1E,KAAK,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAChD,KAAK,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;AAOpD,KAAK,YAAY,GAAG;IAChB,cAAc,EAAE,UAAU,EAAE,CAAC;IAC7B,gBAAgB,EAAE,UAAU,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAoCF,QAAA,MAAM,oBAAoB,GAAI,YAAY,UAAU,KAAG,OACmD,CAAC;AAmN3G,QAAA,MAAM,iBAAiB,GAAI,MAAM,kBAAkB,EAAE,UAAU,OAAO,KAAG,OACa,CAAC;AAEvF,iBAAS,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAkBpF;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/callback.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { copy } from "@gtkx/native";
|
|
2
|
+
import { foldedLengthSources } from "./folded-lengths.js";
|
|
2
3
|
import { fromNative, toNative } from "./native-value.js";
|
|
3
4
|
import { getHandle } from "./registry.js";
|
|
4
5
|
import { splitTupleResult } from "./tuple.js";
|
|
5
6
|
import { copyValue } from "./value.js";
|
|
6
7
|
import { popSeedFrame, pushSeedFrame } from "./vfunc-seeds.js";
|
|
8
|
+
const CALLBACK_TRAITS = {
|
|
9
|
+
callback: { isInstanceBound: false, hasInstanceArg: false, hasFoldedLengths: true },
|
|
10
|
+
signal: { isInstanceBound: false, hasInstanceArg: true, hasFoldedLengths: false },
|
|
11
|
+
vfunc: { isInstanceBound: true, hasInstanceArg: true, hasFoldedLengths: true },
|
|
12
|
+
};
|
|
7
13
|
const fillCallerAllocatedBuffer = (descriptor, target, source) => {
|
|
8
14
|
if (descriptor.kind === "boxed" && descriptor.typeName === "GValue") {
|
|
9
15
|
copyValue(getHandle(target), getHandle(source));
|
|
@@ -46,29 +52,39 @@ const hasOutParamArg = (descriptor) => descriptor !== undefined && (descriptor.k
|
|
|
46
52
|
const hasRefOutParamArg = (descriptor) => descriptor?.kind === "ref" && descriptor.inout !== true;
|
|
47
53
|
const haveOutParamArgs = (effectiveTypes, start) => effectiveTypes.slice(start).some((descriptor) => hasOutParamArg(descriptor));
|
|
48
54
|
const haveRefOutParamArgs = (effectiveTypes, start) => effectiveTypes.slice(start).some((descriptor) => hasRefOutParamArg(descriptor));
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
const { innerDescriptor } = descriptor;
|
|
54
|
-
return innerDescriptor.kind === "array" ? innerDescriptor.sizeParamIndex : undefined;
|
|
55
|
-
};
|
|
56
|
-
const lengthOutParamIndices = (outParams) => {
|
|
57
|
-
const indices = new Map();
|
|
55
|
+
const groupOutParams = (outParams, lengthSources) => {
|
|
56
|
+
const groups = { lengthLinks: [], valueParams: [] };
|
|
58
57
|
for (const outParam of outParams) {
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
|
|
58
|
+
const sources = lengthSources.get(outParam.argIndex);
|
|
59
|
+
if (sources === undefined) {
|
|
60
|
+
groups.valueParams.push(outParam);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
groups.lengthLinks.push({ target: outParam, sources });
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
return
|
|
66
|
+
return groups;
|
|
67
|
+
};
|
|
68
|
+
const getLength = (value) => {
|
|
69
|
+
const length = value?.length;
|
|
70
|
+
return typeof length === "number" ? length : 0;
|
|
71
|
+
};
|
|
72
|
+
const lengthSourceValue = (source, outValues, primary) => source.kind === "return" ? primary : outValues.get(source.argIndex);
|
|
73
|
+
const foldedLength = (sources, outValues, primary) => Math.min(...sources.map((source) => getLength(lengthSourceValue(source, outValues, primary))));
|
|
74
|
+
const resolveOutValues = (groups, values, primary) => {
|
|
75
|
+
const outValues = new Map();
|
|
76
|
+
for (const [position, outParam] of groups.valueParams.entries()) {
|
|
77
|
+
outValues.set(outParam.argIndex, values[position]);
|
|
78
|
+
}
|
|
79
|
+
for (const link of groups.lengthLinks) {
|
|
80
|
+
outValues.set(link.target.argIndex, foldedLength(link.sources, outValues, primary));
|
|
81
|
+
}
|
|
82
|
+
return outValues;
|
|
65
83
|
};
|
|
66
84
|
const writeOutParams = (outParams, outValues) => {
|
|
67
|
-
const
|
|
68
|
-
for (const [position, outParam] of outParams.entries()) {
|
|
69
|
-
const outValue = outValues[position];
|
|
85
|
+
for (const outParam of outParams) {
|
|
70
86
|
const { descriptor } = outParam;
|
|
71
|
-
|
|
87
|
+
const outValue = outValues.get(outParam.argIndex);
|
|
72
88
|
if (descriptor.kind === "ref") {
|
|
73
89
|
outParam.value.value = toNative(descriptor.innerDescriptor, outValue);
|
|
74
90
|
}
|
|
@@ -76,30 +92,6 @@ const writeOutParams = (outParams, outValues) => {
|
|
|
76
92
|
fillCallerAllocatedBuffer(descriptor, outParam.value, outValue);
|
|
77
93
|
}
|
|
78
94
|
}
|
|
79
|
-
return written;
|
|
80
|
-
};
|
|
81
|
-
const groupOutParams = (outParams) => {
|
|
82
|
-
const lengths = lengthOutParamIndices(outParams);
|
|
83
|
-
const groups = { lengthLinks: [], valueParams: [] };
|
|
84
|
-
for (const outParam of outParams) {
|
|
85
|
-
const sourceIndex = lengths.get(outParam.argIndex);
|
|
86
|
-
if (sourceIndex === undefined) {
|
|
87
|
-
groups.valueParams.push(outParam);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
groups.lengthLinks.push({ target: outParam, sourceIndex });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return groups;
|
|
94
|
-
};
|
|
95
|
-
const getFoldedLength = (source) => {
|
|
96
|
-
const length = source?.length;
|
|
97
|
-
return typeof length === "number" ? length : 0;
|
|
98
|
-
};
|
|
99
|
-
const writeFoldedLengths = (lengthLinks, written) => {
|
|
100
|
-
for (const link of lengthLinks) {
|
|
101
|
-
link.target.value.value = getFoldedLength(written.get(link.sourceIndex));
|
|
102
|
-
}
|
|
103
95
|
};
|
|
104
96
|
const collectRefSeeds = (outParams) => {
|
|
105
97
|
const seeds = new Map();
|
|
@@ -123,7 +115,7 @@ const applyCallback = (plan, thisArg, inputs, outParams) => {
|
|
|
123
115
|
popSeedFrame();
|
|
124
116
|
}
|
|
125
117
|
};
|
|
126
|
-
const getThisArg = (
|
|
118
|
+
const getThisArg = (isInstanceBound, wrapped) => isInstanceBound ? (wrapped[0] ?? null) : null;
|
|
127
119
|
const wrapCallbackArgs = (effectiveTypes, rawArgs) => {
|
|
128
120
|
let index = 0;
|
|
129
121
|
for (const descriptor of effectiveTypes) {
|
|
@@ -141,23 +133,25 @@ const trimCallbackInputs = (plan, wrapped) => {
|
|
|
141
133
|
}
|
|
142
134
|
return wrapped;
|
|
143
135
|
};
|
|
136
|
+
const nativeReturn = (plan, primary) => toNative(plan.returnDescriptor, plan.hasPrimary ? primary : undefined);
|
|
144
137
|
const runCallback = (plan, rawArgs) => {
|
|
145
|
-
const { effectiveTypes
|
|
138
|
+
const { effectiveTypes } = plan;
|
|
146
139
|
wrapCallbackArgs(effectiveTypes, rawArgs);
|
|
147
|
-
const thisArg = getThisArg(plan.
|
|
140
|
+
const thisArg = getThisArg(plan.isInstanceBound, rawArgs);
|
|
148
141
|
if (!plan.hasOutParams) {
|
|
149
|
-
return
|
|
142
|
+
return nativeReturn(plan, plan.fn.apply(thisArg, trimCallbackInputs(plan, rawArgs)));
|
|
150
143
|
}
|
|
151
144
|
const { inputs, outParams } = partitionCallbackArgs(effectiveTypes, rawArgs, plan.start);
|
|
152
145
|
const result = applyCallback(plan, thisArg, inputs, outParams);
|
|
153
146
|
if (outParams.length === 0) {
|
|
154
|
-
return
|
|
147
|
+
return nativeReturn(plan, result);
|
|
155
148
|
}
|
|
156
|
-
const
|
|
157
|
-
const { primary, outValues } = splitTupleResult(result,
|
|
158
|
-
|
|
159
|
-
return
|
|
149
|
+
const groups = groupOutParams(outParams, plan.lengthSources);
|
|
150
|
+
const { primary, outValues } = splitTupleResult(result, plan.hasPrimary, groups.valueParams.length);
|
|
151
|
+
writeOutParams(outParams, resolveOutValues(groups, outValues, primary));
|
|
152
|
+
return nativeReturn(plan, primary);
|
|
160
153
|
};
|
|
154
|
+
const planLengthSources = (spec, hasFoldedLengths) => hasFoldedLengths ? foldedLengthSources(spec) : new Map();
|
|
161
155
|
const getEffectiveTypes = (spec) => {
|
|
162
156
|
const { userDataIndex } = spec;
|
|
163
157
|
if (userDataIndex === undefined) {
|
|
@@ -165,16 +159,19 @@ const getEffectiveTypes = (spec) => {
|
|
|
165
159
|
}
|
|
166
160
|
return spec.argDescriptors.filter((_, i) => i !== userDataIndex);
|
|
167
161
|
};
|
|
168
|
-
const wrapCallbackValue = (spec, callback) => callback == null ? callback : wrapCallback(callback, spec, "
|
|
169
|
-
function wrapCallback(fn, spec,
|
|
162
|
+
const wrapCallbackValue = (spec, callback) => callback == null ? callback : wrapCallback(callback, spec, "callback");
|
|
163
|
+
function wrapCallback(fn, spec, kind) {
|
|
170
164
|
const effectiveTypes = getEffectiveTypes(spec);
|
|
171
|
-
const
|
|
165
|
+
const { isInstanceBound, hasInstanceArg, hasFoldedLengths } = CALLBACK_TRAITS[kind];
|
|
166
|
+
const start = hasInstanceArg ? 1 : 0;
|
|
172
167
|
const plan = {
|
|
173
168
|
fn,
|
|
174
169
|
effectiveTypes,
|
|
175
170
|
returnDescriptor: spec.returnDescriptor,
|
|
171
|
+
hasPrimary: spec.returnDescriptor.kind !== "void",
|
|
176
172
|
start,
|
|
177
|
-
|
|
173
|
+
isInstanceBound,
|
|
174
|
+
lengthSources: planLengthSources(spec, hasFoldedLengths),
|
|
178
175
|
hasOutParams: haveOutParamArgs(effectiveTypes, start),
|
|
179
176
|
hasRefOutParams: haveRefOutParamArgs(effectiveTypes, start),
|
|
180
177
|
};
|
package/dist/callback.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.js","sourceRoot":"","sources":["../src/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAwB9E,MAAM,yBAAyB,GAAG,CAAC,UAAsB,EAAE,MAAc,EAAE,MAAc,EAAQ,EAAE;IAC/F,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClE,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAEhD,OAAO;IACX,CAAC;IAED,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACjG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QAE5D,OAAO;IACX,CAAC;IAED,MAAM,IAAI,KAA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,YAAY,CAAC,EAAY,EAAE,IAAkB,EAAE,QAA0B;IAC9E,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE1C,MAAM,IAAI,GAAiB;QACvB,EAAE;QACF,cAAc;QACd,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,KAAK;QACL,QAAQ;QACR,YAAY,EAAE,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC;QACrD,eAAe,EAAE,mBAAmB,CAAC,cAAc,EAAE,KAAK,CAAC;KAC9D,CAAC;IAEF,OAAO,CAAC,GAAG,OAAkB,EAAW,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { copy, type Descriptor } from \"@gtkx/native\";\nimport type { CallbackDescriptor, RefDescriptor } from \"./descriptors.js\";\nimport { fromNative, toNative } from \"./native-value.js\";\nimport { getHandle } from \"./registry.js\";\nimport { splitTupleResult } from \"./tuple.js\";\nimport { copyValue } from \"./value.js\";\nimport { popSeedFrame, pushSeedFrame, type RefSeeds } from \"./vfunc-seeds.js\";\n\ntype Callback = (...args: unknown[]) => unknown;\ntype CallbackReceiver = \"this\" | \"emitter\" | \"none\";\ntype OutParam = { value: unknown; descriptor: Descriptor; argIndex: number };\ntype LengthLink = { target: OutParam; sourceIndex: number };\ntype OutParamGroups = { lengthLinks: LengthLink[]; valueParams: OutParam[] };\n\ntype CallbackSpec = {\n argDescriptors: Descriptor[];\n returnDescriptor: Descriptor;\n userDataIndex?: number;\n};\n\ntype CallbackPlan = {\n fn: Callback;\n effectiveTypes: Descriptor[];\n returnDescriptor: Descriptor;\n start: number;\n receiver: CallbackReceiver;\n hasOutParams: boolean;\n hasRefOutParams: boolean;\n};\n\nconst fillCallerAllocatedBuffer = (descriptor: Descriptor, target: object, source: object): void => {\n if (descriptor.kind === \"boxed\" && descriptor.typeName === \"GValue\") {\n copyValue(getHandle(target), getHandle(source));\n\n return;\n }\n\n if ((descriptor.kind === \"boxed\" || descriptor.kind === \"struct\") && descriptor.size !== undefined) {\n copy(getHandle(target), getHandle(source), descriptor.size);\n\n return;\n }\n\n throw new Error(`Cannot write caller-allocated ${descriptor.kind} out-parameter: no known byte size`);\n};\n\nconst isCallerAllocatedOut = (descriptor: Descriptor): boolean =>\n (descriptor.kind === \"boxed\" || descriptor.kind === \"struct\") && descriptor.isCallerAllocated === true;\n\nconst collectRefArg = (\n descriptor: RefDescriptor,\n wrappedValue: unknown,\n inputs: unknown[],\n out: { params: OutParam[]; argIndex: number },\n): void => {\n if (descriptor.inout === true) {\n inputs.push((wrappedValue as { value: unknown }).value);\n }\n\n out.params.push({ value: wrappedValue, descriptor, argIndex: out.argIndex });\n};\n\nconst collectCallbackArg = (\n descriptor: Descriptor | undefined,\n wrappedValue: unknown,\n inputs: unknown[],\n out: { params: OutParam[]; argIndex: number },\n): void => {\n if (descriptor?.kind === \"ref\") {\n collectRefArg(descriptor, wrappedValue, inputs, out);\n\n return;\n }\n\n inputs.push(wrappedValue);\n\n if (descriptor !== undefined && isCallerAllocatedOut(descriptor)) {\n out.params.push({ value: wrappedValue, descriptor, argIndex: out.argIndex });\n }\n};\n\nconst partitionCallbackArgs = (\n effectiveTypes: Descriptor[],\n wrapped: unknown[],\n start: number,\n): { inputs: unknown[]; outParams: OutParam[] } => {\n const inputs: unknown[] = [];\n const params: OutParam[] = [];\n const collected = { params, argIndex: start };\n\n for (let i = start; i < effectiveTypes.length; i++) {\n collected.argIndex = i;\n collectCallbackArg(effectiveTypes[i], wrapped[i], inputs, collected);\n }\n\n return { inputs, outParams: params };\n};\n\nconst hasOutParamArg = (descriptor: Descriptor | undefined): boolean =>\n descriptor !== undefined && (descriptor.kind === \"ref\" || isCallerAllocatedOut(descriptor));\n\nconst hasRefOutParamArg = (descriptor: Descriptor | undefined): boolean =>\n descriptor?.kind === \"ref\" && descriptor.inout !== true;\n\nconst haveOutParamArgs = (effectiveTypes: Descriptor[], start: number): boolean =>\n effectiveTypes.slice(start).some((descriptor) => hasOutParamArg(descriptor));\n\nconst haveRefOutParamArgs = (effectiveTypes: Descriptor[], start: number): boolean =>\n effectiveTypes.slice(start).some((descriptor) => hasRefOutParamArg(descriptor));\n\nconst sizeParamIndexFor = (descriptor: Descriptor): number | undefined => {\n if (descriptor.kind !== \"ref\") {\n return undefined;\n }\n\n const { innerDescriptor } = descriptor;\n\n return innerDescriptor.kind === \"array\" ? innerDescriptor.sizeParamIndex : undefined;\n};\n\nconst lengthOutParamIndices = (outParams: OutParam[]): Map<number, number> => {\n const indices: Map<number, number> = new Map();\n\n for (const outParam of outParams) {\n const sizeParamIndex = sizeParamIndexFor(outParam.descriptor);\n\n if (sizeParamIndex !== undefined) {\n indices.set(sizeParamIndex, outParam.argIndex);\n }\n }\n\n return indices;\n};\n\nconst writeOutParams = (outParams: OutParam[], outValues: unknown[]): Map<number, unknown> => {\n const written: Map<number, unknown> = new Map();\n\n for (const [position, outParam] of outParams.entries()) {\n const outValue = outValues[position];\n const { descriptor } = outParam;\n written.set(outParam.argIndex, outValue);\n\n if (descriptor.kind === \"ref\") {\n (outParam.value as { value: unknown }).value = toNative(descriptor.innerDescriptor, outValue);\n } else if (outValue != null && outParam.value != null) {\n fillCallerAllocatedBuffer(descriptor, outParam.value, outValue);\n }\n }\n\n return written;\n};\n\nconst groupOutParams = (outParams: OutParam[]): OutParamGroups => {\n const lengths = lengthOutParamIndices(outParams);\n const groups: OutParamGroups = { lengthLinks: [], valueParams: [] };\n\n for (const outParam of outParams) {\n const sourceIndex = lengths.get(outParam.argIndex);\n\n if (sourceIndex === undefined) {\n groups.valueParams.push(outParam);\n } else {\n groups.lengthLinks.push({ target: outParam, sourceIndex });\n }\n }\n\n return groups;\n};\n\nconst getFoldedLength = (source: unknown): number => {\n const length = (source as { length?: unknown } | null | undefined)?.length;\n\n return typeof length === \"number\" ? length : 0;\n};\n\nconst writeFoldedLengths = (lengthLinks: LengthLink[], written: Map<number, unknown>): void => {\n for (const link of lengthLinks) {\n (link.target.value as { value: unknown }).value = getFoldedLength(written.get(link.sourceIndex));\n }\n};\n\nconst collectRefSeeds = (outParams: OutParam[]): RefSeeds => {\n const seeds: RefSeeds = new Map();\n\n for (const outParam of outParams) {\n const seed = (outParam.value as { value?: unknown } | null)?.value;\n\n if (seed != null && hasRefOutParamArg(outParam.descriptor)) {\n seeds.set(outParam.argIndex, seed);\n }\n }\n\n return seeds;\n};\n\nconst applyCallback = (plan: CallbackPlan, thisArg: unknown, inputs: unknown[], outParams: OutParam[]): unknown => {\n if (!plan.hasRefOutParams) {\n return plan.fn.apply(thisArg, inputs);\n }\n\n pushSeedFrame({ argDescriptors: plan.effectiveTypes, instance: thisArg, seeds: collectRefSeeds(outParams) });\n\n try {\n return plan.fn.apply(thisArg, inputs);\n } finally {\n popSeedFrame();\n }\n};\n\nconst getThisArg = (receiver: CallbackReceiver, wrapped: unknown[]): unknown =>\n receiver === \"this\" ? (wrapped[0] ?? null) : null;\n\nconst wrapCallbackArgs = (effectiveTypes: Descriptor[], rawArgs: unknown[]): void => {\n let index = 0;\n\n for (const descriptor of effectiveTypes) {\n rawArgs[index] = fromNative(descriptor, rawArgs[index]);\n index += 1;\n }\n};\n\nconst trimCallbackInputs = (plan: CallbackPlan, wrapped: unknown[]): unknown[] => {\n const count = plan.effectiveTypes.length;\n\n if (wrapped.length > count) {\n wrapped.length = count;\n }\n\n for (let index = 0; index < plan.start; index++) {\n wrapped.shift();\n }\n\n return wrapped;\n};\n\nconst runCallback = (plan: CallbackPlan, rawArgs: unknown[]): unknown => {\n const { effectiveTypes, returnDescriptor } = plan;\n wrapCallbackArgs(effectiveTypes, rawArgs);\n const thisArg = getThisArg(plan.receiver, rawArgs);\n\n if (!plan.hasOutParams) {\n return toNative(returnDescriptor, plan.fn.apply(thisArg, trimCallbackInputs(plan, rawArgs)));\n }\n\n const { inputs, outParams } = partitionCallbackArgs(effectiveTypes, rawArgs, plan.start);\n const result = applyCallback(plan, thisArg, inputs, outParams);\n\n if (outParams.length === 0) {\n return toNative(returnDescriptor, result);\n }\n\n const { lengthLinks, valueParams } = groupOutParams(outParams);\n const { primary, outValues } = splitTupleResult(result, returnDescriptor.kind !== \"void\", valueParams.length);\n writeFoldedLengths(lengthLinks, writeOutParams(valueParams, outValues));\n\n return toNative(returnDescriptor, primary);\n};\n\nconst getEffectiveTypes = (spec: CallbackSpec): Descriptor[] => {\n const { userDataIndex } = spec;\n\n if (userDataIndex === undefined) {\n return spec.argDescriptors;\n }\n\n return spec.argDescriptors.filter((_, i) => i !== userDataIndex);\n};\n\nconst wrapCallbackValue = (spec: CallbackDescriptor, callback: unknown): unknown =>\n callback == null ? callback : wrapCallback(callback as Callback, spec, \"none\");\n\nfunction wrapCallback(fn: Callback, spec: CallbackSpec, receiver: CallbackReceiver): Callback {\n const effectiveTypes = getEffectiveTypes(spec);\n const start = receiver === \"none\" ? 0 : 1;\n\n const plan: CallbackPlan = {\n fn,\n effectiveTypes,\n returnDescriptor: spec.returnDescriptor,\n start,\n receiver,\n hasOutParams: haveOutParamArgs(effectiveTypes, start),\n hasRefOutParams: haveRefOutParamArgs(effectiveTypes, start),\n };\n\n return (...rawArgs: unknown[]): unknown => runCallback(plan, rawArgs);\n}\n\nexport { isCallerAllocatedOut, wrapCallbackValue, wrapCallback };\n"]}
|
|
1
|
+
{"version":3,"file":"callback.js","sourceRoot":"","sources":["../src/callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAyC,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAA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AAC,CAAC;AAEvF,SAAS,YAAY,CAAC,EAAY,EAAE,IAAkB,EAAE,IAAkB;IACtE,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACpF,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAErC,MAAM,IAAI,GAAiB;QACvB,EAAE;QACF,cAAc;QACd,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM;QACjD,KAAK;QACL,eAAe;QACf,aAAa,EAAE,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,CAAC;QACxD,YAAY,EAAE,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC;QACrD,eAAe,EAAE,mBAAmB,CAAC,cAAc,EAAE,KAAK,CAAC;KAC9D,CAAC;IAEF,OAAO,CAAC,GAAG,OAAkB,EAAW,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { copy, type Descriptor } from \"@gtkx/native\";\nimport type { CallbackDescriptor, RefDescriptor } from \"./descriptors.js\";\nimport { foldedLengthSources, type LengthSource, type LengthSources } from \"./folded-lengths.js\";\nimport { fromNative, toNative } from \"./native-value.js\";\nimport { getHandle } from \"./registry.js\";\nimport { splitTupleResult } from \"./tuple.js\";\nimport { copyValue } from \"./value.js\";\nimport { popSeedFrame, pushSeedFrame, type RefSeeds } from \"./vfunc-seeds.js\";\n\ntype Callback = (...args: unknown[]) => unknown;\ntype CallbackKind = \"vfunc\" | \"signal\" | \"callback\";\ntype CallbackTraits = { isInstanceBound: boolean; hasInstanceArg: boolean; hasFoldedLengths: boolean };\ntype OutParam = { value: unknown; descriptor: Descriptor; argIndex: number };\ntype LengthLink = { target: OutParam; sources: LengthSource[] };\ntype OutParamGroups = { lengthLinks: LengthLink[]; valueParams: OutParam[] };\ntype OutValues = Map<number, unknown>;\n\ntype CallbackSpec = {\n argDescriptors: Descriptor[];\n returnDescriptor: Descriptor;\n userDataIndex?: number;\n};\n\ntype CallbackPlan = {\n fn: Callback;\n effectiveTypes: Descriptor[];\n returnDescriptor: Descriptor;\n hasPrimary: boolean;\n start: number;\n isInstanceBound: boolean;\n lengthSources: LengthSources;\n hasOutParams: boolean;\n hasRefOutParams: boolean;\n};\n\nconst CALLBACK_TRAITS: Record<CallbackKind, CallbackTraits> = {\n callback: { isInstanceBound: false, hasInstanceArg: false, hasFoldedLengths: true },\n signal: { isInstanceBound: false, hasInstanceArg: true, hasFoldedLengths: false },\n vfunc: { isInstanceBound: true, hasInstanceArg: true, hasFoldedLengths: true },\n};\n\nconst fillCallerAllocatedBuffer = (descriptor: Descriptor, target: object, source: object): void => {\n if (descriptor.kind === \"boxed\" && descriptor.typeName === \"GValue\") {\n copyValue(getHandle(target), getHandle(source));\n\n return;\n }\n\n if ((descriptor.kind === \"boxed\" || descriptor.kind === \"struct\") && descriptor.size !== undefined) {\n copy(getHandle(target), getHandle(source), descriptor.size);\n\n return;\n }\n\n throw new Error(`Cannot write caller-allocated ${descriptor.kind} out-parameter: no known byte size`);\n};\n\nconst isCallerAllocatedOut = (descriptor: Descriptor): boolean =>\n (descriptor.kind === \"boxed\" || descriptor.kind === \"struct\") && descriptor.isCallerAllocated === true;\n\nconst collectRefArg = (\n descriptor: RefDescriptor,\n wrappedValue: unknown,\n inputs: unknown[],\n out: { params: OutParam[]; argIndex: number },\n): void => {\n if (descriptor.inout === true) {\n inputs.push((wrappedValue as { value: unknown }).value);\n }\n\n out.params.push({ value: wrappedValue, descriptor, argIndex: out.argIndex });\n};\n\nconst collectCallbackArg = (\n descriptor: Descriptor | undefined,\n wrappedValue: unknown,\n inputs: unknown[],\n out: { params: OutParam[]; argIndex: number },\n): void => {\n if (descriptor?.kind === \"ref\") {\n collectRefArg(descriptor, wrappedValue, inputs, out);\n\n return;\n }\n\n inputs.push(wrappedValue);\n\n if (descriptor !== undefined && isCallerAllocatedOut(descriptor)) {\n out.params.push({ value: wrappedValue, descriptor, argIndex: out.argIndex });\n }\n};\n\nconst partitionCallbackArgs = (\n effectiveTypes: Descriptor[],\n wrapped: unknown[],\n start: number,\n): { inputs: unknown[]; outParams: OutParam[] } => {\n const inputs: unknown[] = [];\n const params: OutParam[] = [];\n const collected = { params, argIndex: start };\n\n for (let i = start; i < effectiveTypes.length; i++) {\n collected.argIndex = i;\n collectCallbackArg(effectiveTypes[i], wrapped[i], inputs, collected);\n }\n\n return { inputs, outParams: params };\n};\n\nconst hasOutParamArg = (descriptor: Descriptor | undefined): boolean =>\n descriptor !== undefined && (descriptor.kind === \"ref\" || isCallerAllocatedOut(descriptor));\n\nconst hasRefOutParamArg = (descriptor: Descriptor | undefined): boolean =>\n descriptor?.kind === \"ref\" && descriptor.inout !== true;\n\nconst haveOutParamArgs = (effectiveTypes: Descriptor[], start: number): boolean =>\n effectiveTypes.slice(start).some((descriptor) => hasOutParamArg(descriptor));\n\nconst haveRefOutParamArgs = (effectiveTypes: Descriptor[], start: number): boolean =>\n effectiveTypes.slice(start).some((descriptor) => hasRefOutParamArg(descriptor));\n\nconst groupOutParams = (outParams: OutParam[], lengthSources: LengthSources): OutParamGroups => {\n const groups: OutParamGroups = { lengthLinks: [], valueParams: [] };\n\n for (const outParam of outParams) {\n const sources = lengthSources.get(outParam.argIndex);\n\n if (sources === undefined) {\n groups.valueParams.push(outParam);\n } else {\n groups.lengthLinks.push({ target: outParam, sources });\n }\n }\n\n return groups;\n};\n\nconst getLength = (value: unknown): number => {\n const length = (value as { length?: unknown } | null | undefined)?.length;\n\n return typeof length === \"number\" ? length : 0;\n};\n\nconst lengthSourceValue = (source: LengthSource, outValues: OutValues, primary: unknown): unknown =>\n source.kind === \"return\" ? primary : outValues.get(source.argIndex);\n\nconst foldedLength = (sources: LengthSource[], outValues: OutValues, primary: unknown): number =>\n Math.min(...sources.map((source) => getLength(lengthSourceValue(source, outValues, primary))));\n\nconst resolveOutValues = (groups: OutParamGroups, values: unknown[], primary: unknown): OutValues => {\n const outValues: OutValues = new Map();\n\n for (const [position, outParam] of groups.valueParams.entries()) {\n outValues.set(outParam.argIndex, values[position]);\n }\n\n for (const link of groups.lengthLinks) {\n outValues.set(link.target.argIndex, foldedLength(link.sources, outValues, primary));\n }\n\n return outValues;\n};\n\nconst writeOutParams = (outParams: OutParam[], outValues: OutValues): void => {\n for (const outParam of outParams) {\n const { descriptor } = outParam;\n const outValue = outValues.get(outParam.argIndex);\n\n if (descriptor.kind === \"ref\") {\n (outParam.value as { value: unknown }).value = toNative(descriptor.innerDescriptor, outValue);\n } else if (outValue != null && outParam.value != null) {\n fillCallerAllocatedBuffer(descriptor, outParam.value, outValue);\n }\n }\n};\n\nconst collectRefSeeds = (outParams: OutParam[]): RefSeeds => {\n const seeds: RefSeeds = new Map();\n\n for (const outParam of outParams) {\n const seed = (outParam.value as { value?: unknown } | null)?.value;\n\n if (seed != null && hasRefOutParamArg(outParam.descriptor)) {\n seeds.set(outParam.argIndex, seed);\n }\n }\n\n return seeds;\n};\n\nconst applyCallback = (plan: CallbackPlan, thisArg: unknown, inputs: unknown[], outParams: OutParam[]): unknown => {\n if (!plan.hasRefOutParams) {\n return plan.fn.apply(thisArg, inputs);\n }\n\n pushSeedFrame({ argDescriptors: plan.effectiveTypes, instance: thisArg, seeds: collectRefSeeds(outParams) });\n\n try {\n return plan.fn.apply(thisArg, inputs);\n } finally {\n popSeedFrame();\n }\n};\n\nconst getThisArg = (isInstanceBound: boolean, wrapped: unknown[]): unknown =>\n isInstanceBound ? (wrapped[0] ?? null) : null;\n\nconst wrapCallbackArgs = (effectiveTypes: Descriptor[], rawArgs: unknown[]): void => {\n let index = 0;\n\n for (const descriptor of effectiveTypes) {\n rawArgs[index] = fromNative(descriptor, rawArgs[index]);\n index += 1;\n }\n};\n\nconst trimCallbackInputs = (plan: CallbackPlan, wrapped: unknown[]): unknown[] => {\n const count = plan.effectiveTypes.length;\n\n if (wrapped.length > count) {\n wrapped.length = count;\n }\n\n for (let index = 0; index < plan.start; index++) {\n wrapped.shift();\n }\n\n return wrapped;\n};\n\nconst nativeReturn = (plan: CallbackPlan, primary: unknown): unknown =>\n toNative(plan.returnDescriptor, plan.hasPrimary ? primary : undefined);\n\nconst runCallback = (plan: CallbackPlan, rawArgs: unknown[]): unknown => {\n const { effectiveTypes } = plan;\n wrapCallbackArgs(effectiveTypes, rawArgs);\n const thisArg = getThisArg(plan.isInstanceBound, rawArgs);\n\n if (!plan.hasOutParams) {\n return nativeReturn(plan, plan.fn.apply(thisArg, trimCallbackInputs(plan, rawArgs)));\n }\n\n const { inputs, outParams } = partitionCallbackArgs(effectiveTypes, rawArgs, plan.start);\n const result = applyCallback(plan, thisArg, inputs, outParams);\n\n if (outParams.length === 0) {\n return nativeReturn(plan, result);\n }\n\n const groups = groupOutParams(outParams, plan.lengthSources);\n const { primary, outValues } = splitTupleResult(result, plan.hasPrimary, groups.valueParams.length);\n writeOutParams(outParams, resolveOutValues(groups, outValues, primary));\n\n return nativeReturn(plan, primary);\n};\n\nconst planLengthSources = (spec: CallbackSpec, hasFoldedLengths: boolean): LengthSources =>\n hasFoldedLengths ? foldedLengthSources(spec) : new Map<number, LengthSource[]>();\n\nconst getEffectiveTypes = (spec: CallbackSpec): Descriptor[] => {\n const { userDataIndex } = spec;\n\n if (userDataIndex === undefined) {\n return spec.argDescriptors;\n }\n\n return spec.argDescriptors.filter((_, i) => i !== userDataIndex);\n};\n\nconst wrapCallbackValue = (spec: CallbackDescriptor, callback: unknown): unknown =>\n callback == null ? callback : wrapCallback(callback as Callback, spec, \"callback\");\n\nfunction wrapCallback(fn: Callback, spec: CallbackSpec, kind: CallbackKind): Callback {\n const effectiveTypes = getEffectiveTypes(spec);\n const { isInstanceBound, hasInstanceArg, hasFoldedLengths } = CALLBACK_TRAITS[kind];\n const start = hasInstanceArg ? 1 : 0;\n\n const plan: CallbackPlan = {\n fn,\n effectiveTypes,\n returnDescriptor: spec.returnDescriptor,\n hasPrimary: spec.returnDescriptor.kind !== \"void\",\n start,\n isInstanceBound,\n lengthSources: planLengthSources(spec, hasFoldedLengths),\n hasOutParams: haveOutParamArgs(effectiveTypes, start),\n hasRefOutParams: haveRefOutParamArgs(effectiveTypes, start),\n };\n\n return (...rawArgs: unknown[]): unknown => runCallback(plan, rawArgs);\n}\n\nexport { isCallerAllocatedOut, wrapCallbackValue, wrapCallback };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-application.d.ts","sourceRoot":"","sources":["../src/default-application.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,uBAAuB,GAAI,aAAa,MAAM,KAAG,IAEtD,CAAC;AAEF,QAAA,MAAM,yBAAyB,GAAI,aAAa,MAAM,KAAG,IAMxD,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { bind } from "./bind.js";
|
|
2
|
+
import { objectT, voidT } from "./descriptors.js";
|
|
3
|
+
import { GIO_LIB } from "./library.js";
|
|
4
|
+
import { getHandle } from "./registry.js";
|
|
5
|
+
const readDefaultApplication = bind(GIO_LIB, "g_application_get_default", [], objectT("borrowed"));
|
|
6
|
+
const writeDefaultApplication = bind(GIO_LIB, "g_application_set_default", [objectT("borrowed")], voidT);
|
|
7
|
+
const claimDefaultApplication = (application) => {
|
|
8
|
+
writeDefaultApplication(getHandle(application));
|
|
9
|
+
};
|
|
10
|
+
const releaseDefaultApplication = (application) => {
|
|
11
|
+
if (readDefaultApplication() !== application) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
writeDefaultApplication(null);
|
|
15
|
+
};
|
|
16
|
+
export { claimDefaultApplication, releaseDefaultApplication };
|
|
17
|
+
//# sourceMappingURL=default-application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-application.js","sourceRoot":"","sources":["../src/default-application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,EAAE,2BAA2B,EAAE,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AACnG,MAAM,uBAAuB,GAAG,IAAI,CAAC,OAAO,EAAE,2BAA2B,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAEzG,MAAM,uBAAuB,GAAG,CAAC,WAAmB,EAAQ,EAAE;IAC1D,uBAAuB,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAAC,WAAmB,EAAQ,EAAE;IAC5D,IAAI,sBAAsB,EAAE,KAAK,WAAW,EAAE,CAAC;QAC3C,OAAO;IACX,CAAC;IAED,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,CAAC","sourcesContent":["import { bind } from \"./bind.js\";\nimport { objectT, voidT } from \"./descriptors.js\";\nimport { GIO_LIB } from \"./library.js\";\nimport { getHandle } from \"./registry.js\";\n\nconst readDefaultApplication = bind(GIO_LIB, \"g_application_get_default\", [], objectT(\"borrowed\"));\nconst writeDefaultApplication = bind(GIO_LIB, \"g_application_set_default\", [objectT(\"borrowed\")], voidT);\n\nconst claimDefaultApplication = (application: object): void => {\n writeDefaultApplication(getHandle(application));\n};\n\nconst releaseDefaultApplication = (application: object): void => {\n if (readDefaultApplication() !== application) {\n return;\n }\n\n writeDefaultApplication(null);\n};\n\nexport { claimDefaultApplication, releaseDefaultApplication };\n"]}
|
package/dist/descriptors.d.ts
CHANGED
|
@@ -136,7 +136,10 @@ type BoxedOptions = {
|
|
|
136
136
|
/** Byte size of the value, needed to copy it into an inline field. */
|
|
137
137
|
size?: number;
|
|
138
138
|
};
|
|
139
|
-
/**
|
|
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
|
+
*/
|
|
140
143
|
type CallbackOptions = {
|
|
141
144
|
/** The callee also takes a destroy notify, which frees the closure once it is done with it. */
|
|
142
145
|
hasDestroy?: boolean;
|
|
@@ -153,11 +156,20 @@ type CallbackOptions = {
|
|
|
153
156
|
type ArrayOptions = {
|
|
154
157
|
/** Stride in bytes between elements stored inline in the array. */
|
|
155
158
|
elementSize?: number | undefined;
|
|
159
|
+
/** Position of the argument whose buffer a cursor array points into. */
|
|
160
|
+
baseParamIndex?: number | undefined;
|
|
156
161
|
/** Position of the argument carrying the element count, for a length-bounded array. */
|
|
157
162
|
sizeParamIndex?: number | undefined;
|
|
158
163
|
/** Element count of a fixed-length array. */
|
|
159
164
|
fixedSize?: number | undefined;
|
|
160
165
|
};
|
|
166
|
+
/** Where a cursor array's base buffer and total length come from. */
|
|
167
|
+
type CursorBounds = {
|
|
168
|
+
/** Position of the argument holding the buffer the cursor points into. */
|
|
169
|
+
baseParamIndex: number;
|
|
170
|
+
/** Position of the argument carrying that buffer's element count. */
|
|
171
|
+
sizeParamIndex: number;
|
|
172
|
+
};
|
|
161
173
|
/** How a ref-counted fundamental value is named, wrapped and stored. */
|
|
162
174
|
type FundamentalOptions = {
|
|
163
175
|
/** Whether a decoded value is owned by the caller; defaults to `"borrowed"`. */
|
|
@@ -169,6 +181,11 @@ type FundamentalOptions = {
|
|
|
169
181
|
/** The value is embedded in the containing struct rather than reached through a pointer. */
|
|
170
182
|
isInline?: boolean;
|
|
171
183
|
};
|
|
184
|
+
type FundamentalLifecycle = {
|
|
185
|
+
sharedLibrary: string;
|
|
186
|
+
refFnName: string;
|
|
187
|
+
unrefFnName: string;
|
|
188
|
+
};
|
|
172
189
|
/** How a plain C struct is stored and wrapped. */
|
|
173
190
|
type StructOptions = {
|
|
174
191
|
/** The caller owns the storage the callee fills, so a decoded value is borrowed instead of copied. */
|
|
@@ -233,6 +250,7 @@ declare const flagsT: (sharedLibrary: string, typeFnName: string, isSigned: bool
|
|
|
233
250
|
declare const boxedT: (typeName: string, options?: BoxedOptions) => BoxedDescriptor;
|
|
234
251
|
/** Builds a descriptor for a plain C struct. */
|
|
235
252
|
declare const structT: (ownership?: Ownership, options?: StructOptions) => StructDescriptor;
|
|
253
|
+
declare const fundamentalLifecycleFor: (typeName: string) => FundamentalLifecycle | undefined;
|
|
236
254
|
/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */
|
|
237
255
|
declare const fundamentalT: (sharedLibrary: string, refFnName: string, unrefFnName: string, options?: FundamentalOptions) => FundamentalDescriptor;
|
|
238
256
|
/** Builds a descriptor for an array of items in one of the supported container layouts. */
|
|
@@ -249,9 +267,14 @@ declare const gArrayT: (itemDescriptor: Descriptor, ownership?: Ownership, eleme
|
|
|
249
267
|
declare const byteArrayT: (ownership?: Ownership) => ArrayDescriptor;
|
|
250
268
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
251
269
|
declare const sizedArrayT: (itemDescriptor: Descriptor, sizeParamIndex: number, ownership?: Ownership, elementSize?: number) => ArrayDescriptor;
|
|
270
|
+
/**
|
|
271
|
+
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
272
|
+
* elements from where it points to the end of that buffer.
|
|
273
|
+
*/
|
|
274
|
+
declare const cursorArrayT: (itemDescriptor: Descriptor, bounds: CursorBounds, ownership?: Ownership, elementSize?: number) => ArrayDescriptor;
|
|
252
275
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
253
276
|
declare const fixedArrayT: (itemDescriptor: Descriptor, fixedSize: number, ownership?: Ownership, elementSize?: number) => ArrayDescriptor;
|
|
254
277
|
/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */
|
|
255
278
|
declare const callbackT: (argDescriptors: Descriptor[], returnDescriptor: Descriptor, options?: CallbackOptions) => CallbackDescriptor;
|
|
256
|
-
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, float32T, float64T, booleanT, voidT, unicharT, bufferT, stringT, objectT, refT, hashTableT, enumT, flagsT, boxedT, structT, fundamentalT, arrayT, listT, slistT, ptrArrayT, gArrayT, byteArrayT, sizedArrayT, fixedArrayT, callbackT, type BoxedDescriptor, type StructDescriptor, type FundamentalDescriptor, type ArrayDescriptor, type HashTableDescriptor, type CallbackDescriptor, type RefDescriptor, };
|
|
279
|
+
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, 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, };
|
|
257
280
|
//# 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;AAE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OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,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,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,GACrB,CAAC"}
|
package/dist/descriptors.js
CHANGED
|
@@ -32,6 +32,7 @@ const voidT = { kind: "void" };
|
|
|
32
32
|
const unicharT = { kind: "unichar" };
|
|
33
33
|
/** Descriptor for an opaque `gpointer`, taken from a typed array's memory or a numeric address. */
|
|
34
34
|
const bufferT = { kind: "buffer" };
|
|
35
|
+
const fundamentalLifecycles = new Map();
|
|
35
36
|
/**
|
|
36
37
|
* Builds a descriptor for a C string, whose optional length sizes the caller-allocated buffer
|
|
37
38
|
* used when the string is passed by reference.
|
|
@@ -112,12 +113,19 @@ const structT = (ownership = "borrowed", options = {}) => {
|
|
|
112
113
|
}
|
|
113
114
|
return result;
|
|
114
115
|
};
|
|
116
|
+
const recordFundamentalLifecycle = (typeName, lifecycle) => {
|
|
117
|
+
if (!fundamentalLifecycles.has(typeName)) {
|
|
118
|
+
fundamentalLifecycles.set(typeName, lifecycle);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const fundamentalLifecycleFor = (typeName) => fundamentalLifecycles.get(typeName);
|
|
115
122
|
/** Builds a descriptor for a fundamental type whose lifetime is managed by named ref and unref functions. */
|
|
116
123
|
const fundamentalT = (sharedLibrary, refFnName, unrefFnName, options = {}) => {
|
|
117
124
|
const ownership = options.ownership ?? "borrowed";
|
|
118
125
|
const result = { kind: "fundamental", ownership, sharedLibrary, refFnName, unrefFnName };
|
|
119
126
|
if (options.typeName !== undefined) {
|
|
120
127
|
result.typeName = options.typeName;
|
|
128
|
+
recordFundamentalLifecycle(options.typeName, { sharedLibrary, refFnName, unrefFnName });
|
|
121
129
|
}
|
|
122
130
|
if (options.wrapperClass !== undefined) {
|
|
123
131
|
result.wrapperClass = options.wrapperClass;
|
|
@@ -133,6 +141,9 @@ const arrayT = (itemDescriptor, arrayKind = "array", ownership = "borrowed", opt
|
|
|
133
141
|
if (options?.elementSize !== undefined) {
|
|
134
142
|
result.elementSize = options.elementSize;
|
|
135
143
|
}
|
|
144
|
+
if (options?.baseParamIndex !== undefined) {
|
|
145
|
+
result.baseParamIndex = options.baseParamIndex;
|
|
146
|
+
}
|
|
136
147
|
if (options?.sizeParamIndex !== undefined) {
|
|
137
148
|
result.sizeParamIndex = options.sizeParamIndex;
|
|
138
149
|
}
|
|
@@ -153,27 +164,38 @@ const gArrayT = (itemDescriptor, ownership = "borrowed", elementSize) => arrayT(
|
|
|
153
164
|
const byteArrayT = (ownership = "borrowed") => arrayT(uint8T, "gbytearray", ownership);
|
|
154
165
|
/** Builds a descriptor for a C array whose length is carried by another argument. */
|
|
155
166
|
const sizedArrayT = (itemDescriptor, sizeParamIndex, ownership = "borrowed", elementSize) => arrayT(itemDescriptor, "sized", ownership, { sizeParamIndex, elementSize });
|
|
167
|
+
/**
|
|
168
|
+
* Builds a descriptor for an out pointer into the buffer another argument supplied, decoded as the
|
|
169
|
+
* elements from where it points to the end of that buffer.
|
|
170
|
+
*/
|
|
171
|
+
const cursorArrayT = (itemDescriptor, bounds, ownership = "borrowed", elementSize) => arrayT(itemDescriptor, "cursor", ownership, { ...bounds, elementSize });
|
|
156
172
|
/** Builds a descriptor for a C array of a fixed length. */
|
|
157
173
|
const fixedArrayT = (itemDescriptor, fixedSize, ownership = "borrowed", elementSize) => arrayT(itemDescriptor, "fixed", ownership, { fixedSize, elementSize });
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const result = { kind: "callback", argDescriptors, returnDescriptor };
|
|
161
|
-
if (options?.hasDestroy !== undefined) {
|
|
174
|
+
const applyClosureOptions = (result, options) => {
|
|
175
|
+
if (options.hasDestroy !== undefined) {
|
|
162
176
|
result.hasDestroy = options.hasDestroy;
|
|
163
177
|
}
|
|
164
|
-
if (options
|
|
178
|
+
if (options.destroyKind !== undefined) {
|
|
165
179
|
result.destroyKind = options.destroyKind;
|
|
166
180
|
}
|
|
167
|
-
if (options
|
|
181
|
+
if (options.hasUserData !== undefined) {
|
|
168
182
|
result.hasUserData = options.hasUserData;
|
|
169
183
|
}
|
|
170
|
-
if (options
|
|
184
|
+
if (options.userDataIndex !== undefined) {
|
|
171
185
|
result.userDataIndex = options.userDataIndex;
|
|
172
186
|
}
|
|
173
|
-
if (options
|
|
187
|
+
if (options.scope !== undefined) {
|
|
174
188
|
result.scope = options.scope;
|
|
175
189
|
}
|
|
190
|
+
};
|
|
191
|
+
/** Builds a descriptor for a function pointer, marshalling a JavaScript function into a native closure. */
|
|
192
|
+
const callbackT = (argDescriptors, returnDescriptor, options) => {
|
|
193
|
+
const result = { kind: "callback", argDescriptors, returnDescriptor };
|
|
194
|
+
if (options === undefined) {
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
applyClosureOptions(result, options);
|
|
176
198
|
return result;
|
|
177
199
|
};
|
|
178
|
-
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, float32T, float64T, booleanT, voidT, unicharT, bufferT, stringT, objectT, refT, hashTableT, enumT, flagsT, boxedT, structT, fundamentalT, arrayT, listT, slistT, ptrArrayT, gArrayT, byteArrayT, sizedArrayT, fixedArrayT, callbackT, };
|
|
200
|
+
export { int8T, uint8T, int16T, uint16T, int32T, uint32T, int64T, uint64T, bigint64T, biguint64T, gtypeT, 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, };
|
|
179
201
|
//# sourceMappingURL=descriptors.js.map
|