@gtkx/codegen 1.0.0-rc.3 → 1.0.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 +8 -9
- package/dist/analysis/descriptor-render.d.ts +9 -4
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +51 -61
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +7 -7
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +7 -7
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +1 -2
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +25 -22
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
- package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
- package/dist/analysis/nul-terminated-bytes.js +18 -0
- package/dist/analysis/nul-terminated-bytes.js.map +1 -0
- package/dist/analysis/param-capability.d.ts +5 -0
- package/dist/analysis/param-capability.d.ts.map +1 -0
- package/dist/analysis/param-capability.js +130 -0
- package/dist/analysis/param-capability.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +13 -6
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +44 -20
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +3 -5
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/analysis/type-shape.d.ts +8 -0
- package/dist/analysis/type-shape.d.ts.map +1 -0
- package/dist/analysis/type-shape.js +12 -0
- package/dist/analysis/type-shape.js.map +1 -0
- package/dist/compile.d.ts +1 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +2 -1
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +79 -3
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +68 -13
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +4 -4
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +32 -20
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/handwritten-props.d.ts +9 -0
- package/dist/docs/handwritten-props.d.ts.map +1 -0
- package/dist/docs/handwritten-props.js +149 -0
- package/dist/docs/handwritten-props.js.map +1 -0
- package/dist/docs/pipeline.d.ts +4 -4
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +6 -6
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +25 -5
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +90 -28
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +22 -0
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +129 -44
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +3 -6
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +6 -8
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +3 -11
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +0 -7
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +2 -2
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +11 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +22 -0
- package/dist/gir/annotations.d.ts.map +1 -0
- package/dist/gir/annotations.js +15 -0
- package/dist/gir/annotations.js.map +1 -0
- package/dist/gir/callback.d.ts +1 -0
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +1 -0
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +32 -1
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +8 -3
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +21 -1
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +9 -9
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +19 -4
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +7 -11
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +15 -0
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +7 -0
- package/dist/gir/gir-path.d.ts.map +1 -1
- package/dist/gir/gir-path.js +7 -0
- package/dist/gir/gir-path.js.map +1 -1
- package/dist/gir/libraries.d.ts +13 -2
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +11 -0
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +36 -0
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +34 -0
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +38 -0
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +4 -5
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +39 -0
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +7 -7
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +3 -1
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +6 -3
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +1 -0
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +16 -0
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +3 -3
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +22 -0
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +3 -2
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +5 -4
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +0 -3
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +36 -1
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +2 -3
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +2 -1
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +20 -0
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.js.map +1 -1
- package/dist/index.d.ts +18 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +3 -0
- package/dist/internal.js.map +1 -0
- package/dist/jsx.d.ts +7 -12
- package/dist/jsx.d.ts.map +1 -1
- package/dist/jsx.js +18 -19
- package/dist/jsx.js.map +1 -1
- package/dist/khronos/args.d.ts +7 -6
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +29 -7
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/doc-context.d.ts +29 -0
- package/dist/khronos/doc-context.d.ts.map +1 -0
- package/dist/khronos/doc-context.js +29 -0
- package/dist/khronos/doc-context.js.map +1 -0
- package/dist/khronos/extensions.d.ts +13 -0
- package/dist/khronos/extensions.d.ts.map +1 -0
- package/dist/khronos/extensions.js +49 -0
- package/dist/khronos/extensions.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +17 -11
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +104 -46
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +42 -3
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +218 -63
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +9 -6
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +96 -26
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/notes.d.ts +19 -0
- package/dist/khronos/notes.d.ts.map +1 -0
- package/dist/khronos/notes.js +35 -0
- package/dist/khronos/notes.js.map +1 -0
- package/dist/khronos/param-pair.d.ts +1 -1
- package/dist/khronos/param-pair.d.ts.map +1 -1
- package/dist/khronos/param-pair.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +3 -1
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +59 -28
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +5 -5
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +8 -8
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +8 -6
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +35 -26
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +21 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +47 -34
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +16 -10
- package/dist/react/element-config.d.ts.map +1 -1
- package/dist/react/element-config.js +22 -15
- package/dist/react/element-config.js.map +1 -1
- package/dist/runner.d.ts +33 -21
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +19 -20
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +2 -3
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +2 -2
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/callable-doc.d.ts +11 -0
- package/dist/store/gi/callable-doc.d.ts.map +1 -0
- package/dist/store/gi/callable-doc.js +62 -0
- package/dist/store/gi/callable-doc.js.map +1 -0
- package/dist/store/gi/callables.d.ts +3 -1
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +16 -16
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +2 -2
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +5 -3
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/closure-invocation.d.ts +4 -0
- package/dist/store/gi/closure-invocation.d.ts.map +1 -0
- package/dist/store/gi/closure-invocation.js +22 -0
- package/dist/store/gi/closure-invocation.js.map +1 -0
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +3 -4
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +18 -20
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/doc-spec.d.ts +14 -0
- package/dist/store/gi/doc-spec.d.ts.map +1 -0
- package/dist/store/gi/doc-spec.js +23 -0
- package/dist/store/gi/doc-spec.js.map +1 -0
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +29 -16
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +28 -17
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +130 -16
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +3 -5
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +9 -1
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +92 -47
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +4 -1
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +5 -1
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +3 -2
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +2 -2
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +4 -2
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +10 -11
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +3 -1
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +4 -2
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +6 -11
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +1 -5
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +3 -2
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +1 -1
- package/dist/store/gi/registration.js +2 -2
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/return-wrap.d.ts +1 -1
- package/dist/store/gi/return-wrap.d.ts.map +1 -1
- package/dist/store/gi/return-wrap.js +4 -4
- package/dist/store/gi/return-wrap.js.map +1 -1
- package/dist/store/gi/runtime-override.d.ts +2 -1
- package/dist/store/gi/runtime-override.d.ts.map +1 -1
- package/dist/store/gi/runtime-override.js +8 -5
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +27 -31
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts +1 -10
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +1 -10
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +16 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +214 -51
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +2 -3
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/element-components.d.ts +1 -3
- package/dist/store/jsx/element-components.d.ts.map +1 -1
- package/dist/store/jsx/element-components.js +6 -8
- package/dist/store/jsx/element-components.js.map +1 -1
- package/dist/store/jsx/element-prop-imports.d.ts +1 -4
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-imports.js +0 -2
- package/dist/store/jsx/element-prop-imports.js.map +1 -1
- package/dist/store/jsx/element-prop-types.d.ts +3 -1
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-types.js +7 -2
- package/dist/store/jsx/element-prop-types.js.map +1 -1
- package/dist/store/jsx/generated-elements.d.ts +29 -0
- package/dist/store/jsx/generated-elements.d.ts.map +1 -0
- package/dist/store/jsx/generated-elements.js +30 -0
- package/dist/store/jsx/generated-elements.js.map +1 -0
- package/dist/store/jsx/intrinsic-elements.d.ts +4 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
- package/dist/store/jsx/intrinsic-elements.js.map +1 -1
- package/dist/store/jsx/jsx.d.ts.map +1 -1
- package/dist/store/jsx/jsx.js +13 -12
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.js +9 -9
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx/omitted-props.d.ts +2 -4
- package/dist/store/jsx/omitted-props.d.ts.map +1 -1
- package/dist/store/jsx/omitted-props.js +2 -4
- package/dist/store/jsx/omitted-props.js.map +1 -1
- package/dist/store/jsx/pipeline.d.ts +4 -2
- package/dist/store/jsx/pipeline.d.ts.map +1 -1
- package/dist/store/jsx/pipeline.js +3 -2
- package/dist/store/jsx/pipeline.js.map +1 -1
- package/dist/store/jsx/props.d.ts +1 -7
- package/dist/store/jsx/props.d.ts.map +1 -1
- package/dist/store/jsx/props.js +16 -8
- package/dist/store/jsx/props.js.map +1 -1
- package/dist/store/jsx-store.d.ts +2 -3
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +3 -3
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/resolve-store.d.ts +28 -0
- package/dist/store/resolve-store.d.ts.map +1 -0
- package/dist/store/resolve-store.js +65 -0
- package/dist/store/resolve-store.js.map +1 -0
- package/dist/store/store-fs.d.ts +5 -1
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +6 -4
- package/dist/store/store-fs.js.map +1 -1
- package/dist/writer/context.d.ts +2 -1
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +3 -0
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc-tags.d.ts +21 -0
- package/dist/writer/doc-tags.d.ts.map +1 -0
- package/dist/writer/doc-tags.js +38 -0
- package/dist/writer/doc-tags.js.map +1 -0
- package/dist/writer/doc.d.ts +3 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +19 -6
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +1 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +64 -15
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/module.d.ts +8 -2
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +13 -1
- package/dist/writer/module.js.map +1 -1
- package/overrides/gdk/rgba.ts.ejs +26 -0
- package/overrides/gobject/object.ts.ejs +56 -11
- package/overrides/gobject/value.ts.ejs +7 -0
- package/overrides/graphene/structs.ts.ejs +55 -0
- package/package.json +7 -11
- package/src/analysis/descriptor-render.ts +67 -73
- package/src/analysis/descriptor.ts +13 -16
- package/src/analysis/inheritance.ts +35 -34
- package/src/analysis/nul-terminated-bytes.ts +31 -0
- package/src/analysis/param-capability.ts +172 -0
- package/src/analysis/param-structure.ts +90 -32
- package/src/analysis/ts-type.ts +4 -6
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +3 -2
- package/src/docs/api-reference.ts +162 -28
- package/src/docs/element-page.ts +53 -47
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +10 -10
- package/src/docs/render.ts +153 -39
- package/src/docs/symbol-page.ts +230 -80
- package/src/fingerprint.ts +8 -14
- package/src/gi.ts +4 -11
- package/src/gir/ancestry.ts +15 -1
- package/src/gir/annotations.ts +37 -0
- package/src/gir/callback.ts +2 -0
- package/src/gir/class.ts +42 -4
- package/src/gir/enum.ts +30 -10
- package/src/gir/field.ts +24 -13
- package/src/gir/function.ts +15 -0
- package/src/gir/gir-path.ts +7 -0
- package/src/gir/libraries.ts +23 -2
- package/src/gir/library.ts +51 -2
- package/src/gir/namespace.ts +41 -5
- package/src/gir/parameter.ts +47 -7
- package/src/gir/parse.ts +8 -2
- package/src/gir/primitives.ts +1 -0
- package/src/gir/property.ts +18 -3
- package/src/gir/record.ts +24 -2
- package/src/gir/size.ts +8 -6
- package/src/gir/type-id.ts +51 -7
- package/src/gir/type-ref.ts +2 -1
- package/src/gir/type.ts +50 -6
- package/src/index.ts +18 -16
- package/src/internal.ts +2 -0
- package/src/jsx.ts +26 -26
- package/src/khronos/args.ts +37 -14
- package/src/khronos/doc-context.ts +62 -0
- package/src/khronos/extensions.ts +85 -0
- package/src/khronos/jsdoc.ts +152 -56
- package/src/khronos/model.ts +314 -69
- package/src/khronos/modules.ts +134 -40
- package/src/khronos/notes.ts +74 -0
- package/src/khronos/param-pair.ts +1 -1
- package/src/khronos/pipeline.ts +95 -42
- package/src/khronos/plan.ts +12 -13
- package/src/khronos/render.ts +62 -50
- package/src/khronos/select.ts +91 -50
- package/src/react/element-config.ts +21 -18
- package/src/runner.ts +51 -40
- package/src/store/compile-store.ts +4 -5
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +23 -17
- package/src/store/gi/callback.ts +3 -2
- package/src/store/gi/class.ts +6 -3
- package/src/store/gi/closure-invocation.ts +26 -0
- package/src/store/gi/constant.ts +3 -6
- package/src/store/gi/constructor-props.ts +19 -23
- package/src/store/gi/doc-spec.ts +38 -0
- package/src/store/gi/enum.ts +55 -20
- package/src/store/gi/function.ts +44 -26
- package/src/store/gi/interface.ts +214 -26
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +126 -68
- package/src/store/gi/param-marshal.ts +15 -1
- package/src/store/gi/pipeline.ts +7 -2
- package/src/store/gi/properties.ts +3 -2
- package/src/store/gi/property-accessor.ts +14 -11
- package/src/store/gi/record-constructor.ts +6 -1
- package/src/store/gi/record-field-accessor.ts +9 -13
- package/src/store/gi/record-layout.ts +1 -5
- package/src/store/gi/record.ts +8 -2
- package/src/store/gi/registration.ts +3 -3
- package/src/store/gi/return-wrap.ts +5 -5
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +36 -37
- package/src/store/gi/value-marshalable.ts +1 -10
- package/src/store/gi/vtable.ts +361 -60
- package/src/store/gi-store.ts +2 -4
- package/src/store/jsx/element-components.ts +8 -11
- package/src/store/jsx/element-prop-imports.ts +6 -5
- package/src/store/jsx/element-prop-types.ts +10 -2
- package/src/store/jsx/generated-elements.ts +60 -0
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +15 -13
- package/src/store/jsx/metadata.ts +10 -10
- package/src/store/jsx/omitted-props.ts +2 -4
- package/src/store/jsx/pipeline.ts +6 -4
- package/src/store/jsx/props.ts +22 -9
- package/src/store/jsx-store.ts +5 -7
- package/src/store/resolve-store.ts +100 -0
- package/src/store/store-fs.ts +12 -5
- package/src/writer/context.ts +5 -1
- package/src/writer/doc-tags.ts +70 -0
- package/src/writer/doc.ts +29 -6
- package/src/writer/gtk-doc.ts +82 -15
- package/src/writer/module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B,CAAC","sourcesContent":["import type { ParseContext, TypeId } from \"./type-id.js\";\nimport {\n attr,\n getChild,\n getChildren,\n getDoc,\n intAttr,\n isAttrTrue,\n nameAttr,\n parseEnumAttr,\n type RawNode,\n} from \"./parse.js\";\nimport { typeRefFromNode } from \"./type-ref.js\";\n\ntype ParameterDirection = \"in\" | \"out\" | \"inout\";\ntype ParameterTransfer = \"none\" | \"full\" | \"container\";\ntype CallbackScope = \"call\" | \"notified\" | \"async\" | \"forever\";\n\ntype GirParameter = {\n name: string;\n type: TypeId | undefined;\n direction: ParameterDirection;\n transferOwnership: ParameterTransfer;\n nullable: boolean;\n optional: boolean;\n callerAllocates: boolean;\n scope: CallbackScope | undefined;\n closureIndex: number | undefined;\n destroyIndex: number | undefined;\n isVarargs: boolean;\n};\n\ntype GirReturnValue = {\n type: TypeId | undefined;\n transferOwnership: ParameterTransfer;\n nullable: boolean;\n skip: boolean;\n};\n\ntype GirCallable = {\n name: string;\n doc: string | undefined;\n parameters: GirParameter[];\n returnValue: GirReturnValue;\n throws: boolean;\n introspectable: boolean;\n};\n\nconst DIRECTIONS: Set<ParameterDirection> = new Set([\"in\", \"out\", \"inout\"]);\nconst TRANSFERS: Set<ParameterTransfer> = new Set([\"none\", \"full\", \"container\"]);\nconst SCOPES: Set<CallbackScope> = new Set([\"call\", \"notified\", \"async\", \"forever\"]);\n\nconst transferOwnership = (node: RawNode): ParameterTransfer =>\n parseEnumAttr(attr(node, \"transfer-ownership\"), TRANSFERS, \"none\", \"transfer-ownership\");\n\n// `allow-none` is the legacy spelling of two different attributes: on an in-parameter it means the\n// value may be NULL (`nullable`), but on an out-parameter it means the caller may pass a NULL\n// location (`optional`). Folding it into `nullable` for an out-parameter would claim the returned\n// value can be null for the 494 out-parameters across the installed GIRs that only say `allow-none`.\nconst isInDirection = (node: RawNode): boolean =>\n parseEnumAttr(attr(node, \"direction\"), DIRECTIONS, \"in\", \"direction\") === \"in\";\n\nconst hasNullableAttr = (node: RawNode): boolean =>\n isAttrTrue(node, \"nullable\") || (isInDirection(node) && isAttrTrue(node, \"allow-none\"));\n\nconst hasOptionalAttr = (node: RawNode): boolean =>\n isAttrTrue(node, \"optional\") || (!isInDirection(node) && isAttrTrue(node, \"allow-none\"));\n\nconst parameterFromNode = (node: RawNode, context: ParseContext): GirParameter => ({\n name: nameAttr(node),\n type: typeRefFromNode(node, context),\n direction: parseEnumAttr(attr(node, \"direction\"), DIRECTIONS, \"in\", \"direction\"),\n transferOwnership: transferOwnership(node),\n nullable: hasNullableAttr(node),\n optional: hasOptionalAttr(node),\n callerAllocates: isAttrTrue(node, \"caller-allocates\"),\n scope: parseEnumAttr(attr(node, \"scope\"), SCOPES, undefined, \"scope\"),\n closureIndex: intAttr(node, \"closure\"),\n destroyIndex: intAttr(node, \"destroy\"),\n isVarargs: getChild(node, \"varargs\") !== undefined,\n});\n\nconst isOutParameter = (parameter: GirParameter): boolean =>\n parameter.direction === \"out\" && !parameter.callerAllocates;\n\nconst isCallerAllocatedOut = (parameter: GirParameter): boolean =>\n parameter.direction === \"out\" && parameter.callerAllocates;\n\nconst isInoutParameter = (parameter: GirParameter): boolean => parameter.direction === \"inout\";\n\nconst returnValueFromNode = (node: RawNode | undefined, context: ParseContext): GirReturnValue => {\n if (node === undefined) {\n return { type: undefined, transferOwnership: \"none\", nullable: false, skip: false };\n }\n\n return {\n type: typeRefFromNode(node, context),\n transferOwnership: transferOwnership(node),\n nullable: hasNullableAttr(node),\n skip: isAttrTrue(node, \"skip\"),\n };\n};\n\nconst parseCallable = (node: RawNode, context: ParseContext): GirCallable => {\n const parametersNode = getChild(node, \"parameters\");\n const parameterNodes = getChildren(parametersNode, \"parameter\");\n\n return {\n name: nameAttr(node),\n doc: getDoc(node),\n parameters: parameterNodes.map((parameter) => parameterFromNode(parameter, context)),\n returnValue: returnValueFromNode(getChild(node, \"return-value\"), context),\n throws: isAttrTrue(node, \"throws\"),\n introspectable: isAttrTrue(node, \"introspectable\", true),\n };\n};\n\nexport {\n transferOwnership,\n parameterFromNode,\n isOutParameter,\n isCallerAllocatedOut,\n isInoutParameter,\n parseCallable,\n type ParameterTransfer,\n type GirParameter,\n type GirReturnValue,\n type GirCallable,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/gir/parameter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EACH,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,GAEhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0EhD,MAAM,UAAU,GAA4B,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5E,MAAM,SAAS,GAA2B,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AACjF,MAAM,MAAM,GAAuB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAErF,MAAM,iBAAiB,GAAG,CAAC,IAAa,EAAqB,EAAE,CAC3D,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,oBAAoB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAE7F,MAAM,aAAa,GAAG,CAAC,IAAa,EAAW,EAAE,CAC7C,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;AAEnF,MAAM,eAAe,GAAG,CAAC,IAAa,EAAW,EAAE,CAC/C,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,YAAY,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AAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpF,WAAW,EAAE,mBAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC;QACzE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC;QAClC,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC;KAC3D,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EACH,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,GAKhB,CAAC","sourcesContent":["import type { ParseContext, TypeId } from \"./type-id.js\";\nimport { documentedFromNode, type GirAnnotations } from \"./annotations.js\";\nimport {\n attr,\n getChild,\n getChildren,\n getDoc,\n intAttr,\n isAttrTrue,\n nameAttr,\n parseEnumAttr,\n type RawNode,\n} from \"./parse.js\";\nimport { typeRefFromNode } from \"./type-ref.js\";\n\n/** Which way a parameter's value travels: into the call, back out of it, or both. */\ntype ParameterDirection = \"in\" | \"out\" | \"inout\";\n/** How much of a value the receiver takes ownership of: none, the whole value, or only its container. */\ntype ParameterTransfer = \"none\" | \"full\" | \"container\";\n/**\n * How long a callback parameter stays valid: for the duration of the call, until its destroy notify runs,\n * until the asynchronous operation invokes it, or forever.\n */\ntype CallbackScope = \"call\" | \"notified\" | \"async\" | \"forever\";\n\n/** A parameter of a {@link GirCallable}, with the annotations that decide how it is marshalled. */\ntype GirParameter = {\n /** The name GIR gives the parameter. */\n name: string;\n /** What the parameter holds, absent when the GIR node declares no type. */\n type: TypeId | undefined;\n /** The C spelling of the parameter's type, taken from its `type` or `array` child. */\n cType: string | undefined;\n /** Documentation prose from GIR, emitted as the parameter's `@param` text. */\n doc: string | undefined;\n /** Decides whether the parameter is an argument, part of the returned tuple, or both. */\n direction: ParameterDirection;\n /** Ownership the marshalling descriptor is generated with, deciding whether the receiver frees the value. */\n transferOwnership: ParameterTransfer;\n /** Whether the value may be null. */\n nullable: boolean;\n /** Whether the caller may leave the parameter out entirely. */\n optional: boolean;\n /** Whether the caller supplies the storage an out parameter writes into. */\n callerAllocates: boolean;\n /** How long a callback parameter stays valid, absent when GIR carries no scope annotation. */\n scope: CallbackScope | undefined;\n /** Position of the parameter carrying the callback's user data. */\n closureIndex: number | undefined;\n /** Position of the parameter carrying the callback's destroy notify. */\n destroyIndex: number | undefined;\n /** Whether the parameter is the `...` varargs marker. */\n isVarargs: boolean;\n};\n\n/** What a {@link GirCallable} hands back, with the annotations that decide how it is marshalled. */\ntype GirReturnValue = {\n /** What the callable returns, absent when the GIR node declares no type. */\n type: TypeId | undefined;\n /** Documentation prose from GIR, emitted as the callable's `@returns` text. */\n doc: string | undefined;\n /** How much ownership the caller takes of the returned value. */\n transferOwnership: ParameterTransfer;\n /** Whether the returned value may be null. */\n nullable: boolean;\n /** Whether GIR marks the value as skipped, keeping it out of the generated signature. */\n skip: boolean;\n};\n\n/** Anything GIR describes with parameters and a return value: functions, methods, signals, and callbacks. */\ntype GirCallable = {\n /** The name GIR gives the callable. */\n name: string;\n /** The callable's documentation text, absent when GIR carries none. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the callable. */\n annotations: GirAnnotations;\n /** The parameters the callable takes, in declaration order. */\n parameters: GirParameter[];\n /** What the callable hands back. */\n returnValue: GirReturnValue;\n /** Whether the callable reports failure through a trailing `GError`. */\n throws: boolean;\n /** Whether GIR exposes the callable to bindings. */\n introspectable: boolean;\n};\n\nconst DIRECTIONS: Set<ParameterDirection> = new Set([\"in\", \"out\", \"inout\"]);\nconst TRANSFERS: Set<ParameterTransfer> = new Set([\"none\", \"full\", \"container\"]);\nconst SCOPES: Set<CallbackScope> = new Set([\"call\", \"notified\", \"async\", \"forever\"]);\n\nconst transferOwnership = (node: RawNode): ParameterTransfer =>\n parseEnumAttr(attr(node, \"transfer-ownership\"), TRANSFERS, \"none\", \"transfer-ownership\");\n\nconst isInDirection = (node: RawNode): boolean =>\n parseEnumAttr(attr(node, \"direction\"), DIRECTIONS, \"in\", \"direction\") === \"in\";\n\nconst hasNullableAttr = (node: RawNode): boolean =>\n isAttrTrue(node, \"nullable\") || (isInDirection(node) && isAttrTrue(node, \"allow-none\"));\n\nconst hasOptionalAttr = (node: RawNode): boolean =>\n isAttrTrue(node, \"optional\") || (!isInDirection(node) && isAttrTrue(node, \"allow-none\"));\n\nconst parameterCType = (node: RawNode): string | undefined =>\n attr(getChild(node, \"type\"), \"c:type\") ?? attr(getChild(node, \"array\"), \"c:type\");\n\nconst parameterFromNode = (node: RawNode, context: ParseContext): GirParameter => ({\n name: nameAttr(node),\n type: typeRefFromNode(node, context),\n cType: parameterCType(node),\n doc: getDoc(node),\n direction: parseEnumAttr(attr(node, \"direction\"), DIRECTIONS, \"in\", \"direction\"),\n transferOwnership: transferOwnership(node),\n nullable: hasNullableAttr(node),\n optional: hasOptionalAttr(node),\n callerAllocates: isAttrTrue(node, \"caller-allocates\"),\n scope: parseEnumAttr(attr(node, \"scope\"), SCOPES, undefined, \"scope\"),\n closureIndex: intAttr(node, \"closure\"),\n destroyIndex: intAttr(node, \"destroy\"),\n isVarargs: getChild(node, \"varargs\") !== undefined,\n});\n\nconst isOutParameter = (parameter: GirParameter): boolean =>\n parameter.direction === \"out\" && !parameter.callerAllocates;\n\nconst isCallerAllocatedOut = (parameter: GirParameter): boolean =>\n parameter.direction === \"out\" && parameter.callerAllocates;\n\nconst isInoutParameter = (parameter: GirParameter): boolean => parameter.direction === \"inout\";\n\nconst returnValueFromNode = (node: RawNode | undefined, context: ParseContext): GirReturnValue => {\n if (node === undefined) {\n return { type: undefined, doc: undefined, transferOwnership: \"none\", nullable: false, skip: false };\n }\n\n return {\n type: typeRefFromNode(node, context),\n doc: getDoc(node),\n transferOwnership: transferOwnership(node),\n nullable: hasNullableAttr(node),\n skip: isAttrTrue(node, \"skip\"),\n };\n};\n\nconst parseCallable = (node: RawNode, context: ParseContext): GirCallable => {\n const parametersNode = getChild(node, \"parameters\");\n const parameterNodes = getChildren(parametersNode, \"parameter\");\n\n return {\n ...documentedFromNode(node),\n parameters: parameterNodes.map((parameter) => parameterFromNode(parameter, context)),\n returnValue: returnValueFromNode(getChild(node, \"return-value\"), context),\n throws: isAttrTrue(node, \"throws\"),\n introspectable: isAttrTrue(node, \"introspectable\", true),\n };\n};\n\nexport {\n transferOwnership,\n parameterFromNode,\n isOutParameter,\n isCallerAllocatedOut,\n isInoutParameter,\n parseCallable,\n type ParameterTransfer,\n type GirParameter,\n type GirReturnValue,\n type GirCallable,\n};\n"]}
|
package/dist/gir/parse.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** An element of the parsed GIR XML: attributes under `@_`-prefixed keys, children under their tag names. */
|
|
1
2
|
type RawNode = Record<string, unknown>;
|
|
2
3
|
declare const GIR_CONSTRUCTOR_TAG = "gir-constructor";
|
|
3
4
|
declare const parseGirFile: (path: string) => RawNode;
|
|
@@ -9,5 +10,6 @@ declare const parseEnumAttr: <T extends string, F extends T | undefined>(raw: st
|
|
|
9
10
|
declare const getChildren: (node: RawNode | undefined, tag: string) => RawNode[];
|
|
10
11
|
declare const getChild: (node: RawNode | undefined, tag: string) => RawNode | undefined;
|
|
11
12
|
declare const getDoc: (node: RawNode | undefined) => string | undefined;
|
|
12
|
-
|
|
13
|
+
declare const getDocDeprecated: (node: RawNode | undefined) => string | undefined;
|
|
14
|
+
export { GIR_CONSTRUCTOR_TAG, parseGirFile, attr, isAttrTrue, nameAttr, intAttr, parseEnumAttr, getChildren, getChild, getDoc, getDocDeprecated, type RawNode, };
|
|
13
15
|
//# sourceMappingURL=parse.d.ts.map
|
package/dist/gir/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/gir/parse.ts"],"names":[],"mappings":"AAGA,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO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mD,CAAC;AAEnH,OAAO,EACH,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,OAAO,EACP,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,KAAK,OAAO,GACf,CAAC"}
|
package/dist/gir/parse.js
CHANGED
|
@@ -13,6 +13,7 @@ const MULTI_TAGS = new Set([
|
|
|
13
13
|
"alias",
|
|
14
14
|
"union",
|
|
15
15
|
"method",
|
|
16
|
+
"virtual-method",
|
|
16
17
|
"constructor",
|
|
17
18
|
"property",
|
|
18
19
|
"field",
|
|
@@ -100,11 +101,11 @@ const docTextFromObject = (value) => {
|
|
|
100
101
|
const text = value["#text"];
|
|
101
102
|
return typeof text === "string" ? normalizeDoc(text) : undefined;
|
|
102
103
|
};
|
|
103
|
-
const
|
|
104
|
+
const docElementText = (node, tag) => {
|
|
104
105
|
if (node === undefined) {
|
|
105
106
|
return undefined;
|
|
106
107
|
}
|
|
107
|
-
const value = firstDocValue(node
|
|
108
|
+
const value = firstDocValue(node[tag]);
|
|
108
109
|
if (typeof value === "string") {
|
|
109
110
|
return normalizeDoc(value);
|
|
110
111
|
}
|
|
@@ -113,5 +114,7 @@ const getDoc = (node) => {
|
|
|
113
114
|
}
|
|
114
115
|
return docTextFromObject(value);
|
|
115
116
|
};
|
|
116
|
-
|
|
117
|
+
const getDoc = (node) => docElementText(node, "doc");
|
|
118
|
+
const getDocDeprecated = (node) => docElementText(node, "doc-deprecated");
|
|
119
|
+
export { GIR_CONSTRUCTOR_TAG, parseGirFile, attr, isAttrTrue, nameAttr, intAttr, parseEnumAttr, getChildren, getChild, getDoc, getDocDeprecated, };
|
|
117
120
|
//# sourceMappingURL=parse.js.map
|
package/dist/gir/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/gir/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,M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AC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC9F,MAAM,gBAAgB,GAAG,CAAC,IAAyB,EAAsB,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAEnH,OAAO,EACH,mBAAmB,EACnB,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,OAAO,EACP,aAAa,EACb,WAAW,EACX,QAAQ,EACR,MAAM,EACN,gBAAgB,GAEnB,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { createXmlParser } from \"../xml.js\";\n\n/** An element of the parsed GIR XML: attributes under `@_`-prefixed keys, children under their tag names. */\ntype RawNode = Record<string, unknown>;\n\nconst MULTI_TAGS: Set<string> = new Set([\n \"include\",\n \"class\",\n \"interface\",\n \"record\",\n \"enumeration\",\n \"bitfield\",\n \"callback\",\n \"function\",\n \"constant\",\n \"alias\",\n \"union\",\n \"method\",\n \"virtual-method\",\n \"constructor\",\n \"property\",\n \"field\",\n \"glib:signal\",\n \"implements\",\n \"prerequisite\",\n \"member\",\n \"parameter\",\n]);\n\nconst GIR_CONSTRUCTOR_TAG = \"gir-constructor\";\nconst RESERVED_TAG_RENAMES: Map<string, string> = new Map([[\"constructor\", GIR_CONSTRUCTOR_TAG]]);\nconst RENAMED_MULTI_TAGS: Set<string> = new Set([...MULTI_TAGS].map((tag) => renameReservedTag(tag)));\n\nconst PARSER = createXmlParser({\n trimValues: true,\n transformTagName: renameReservedTag,\n isArray: (name) => RENAMED_MULTI_TAGS.has(name),\n});\n\nfunction renameReservedTag(tag: string): string {\n return RESERVED_TAG_RENAMES.get(tag) ?? tag;\n}\n\nconst parseGirFile = (path: string): RawNode => {\n const xml = readFileSync(path, \"utf8\");\n\n return PARSER.parse(xml) as RawNode;\n};\n\nconst attr = (node: RawNode | undefined, name: string): string | undefined => {\n if (node === undefined) {\n return undefined;\n }\n\n const value = node[`@_${name}`];\n\n return typeof value === \"string\" ? value : undefined;\n};\n\nconst isAttrTrue = (node: RawNode | undefined, name: string, isTrueByDefault = false): boolean => {\n const value = attr(node, name);\n\n if (value === undefined) {\n return isTrueByDefault;\n }\n\n return value === \"1\";\n};\n\nconst nameAttr = (node: RawNode): string => attr(node, \"name\") ?? \"\";\n\nconst intAttr = (node: RawNode, name: string): number | undefined => {\n const raw = attr(node, name);\n\n return raw === undefined ? undefined : Number(raw);\n};\n\nconst enumMember = <T extends string>(raw: string, members: Set<T>, label: string): T => {\n for (const member of members) {\n if (member === raw) {\n return member;\n }\n }\n\n throw new Error(`Unknown ${label} value \"${raw}\"`);\n};\n\nconst parseEnumAttr = <T extends string, F extends T | undefined>(\n raw: string | undefined,\n members: Set<T>,\n fallback: F,\n label: string,\n): T | F => (raw === undefined ? fallback : enumMember(raw, members, label));\n\nconst getChildren = (node: RawNode | undefined, tag: string): RawNode[] => {\n if (node === undefined) {\n return [];\n }\n\n const value = node[tag];\n\n if (value === undefined) {\n return [];\n }\n\n if (Array.isArray(value)) {\n return value as RawNode[];\n }\n\n return [value as RawNode];\n};\n\nconst getChild = (node: RawNode | undefined, tag: string): RawNode | undefined => {\n if (node === undefined) {\n return undefined;\n }\n\n const value = node[tag];\n\n if (value === undefined) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value.length === 0 ? undefined : (value[0] as RawNode);\n }\n\n return value as RawNode;\n};\n\nconst normalizeDoc = (text: string): string | undefined => {\n const trimmed = text.trim();\n\n return trimmed.length === 0 ? undefined : trimmed;\n};\n\nconst firstDocValue = (raw: unknown): unknown => (Array.isArray(raw) ? raw[0] : raw);\n\nconst docTextFromObject = (value: object): string | undefined => {\n const text = (value as RawNode)[\"#text\"];\n\n return typeof text === \"string\" ? normalizeDoc(text) : undefined;\n};\n\nconst docElementText = (node: RawNode | undefined, tag: string): string | undefined => {\n if (node === undefined) {\n return undefined;\n }\n\n const value = firstDocValue(node[tag]);\n\n if (typeof value === \"string\") {\n return normalizeDoc(value);\n }\n\n if (value === null || typeof value !== \"object\") {\n return undefined;\n }\n\n return docTextFromObject(value);\n};\n\nconst getDoc = (node: RawNode | undefined): string | undefined => docElementText(node, \"doc\");\nconst getDocDeprecated = (node: RawNode | undefined): string | undefined => docElementText(node, \"doc-deprecated\");\n\nexport {\n GIR_CONSTRUCTOR_TAG,\n parseGirFile,\n attr,\n isAttrTrue,\n nameAttr,\n intAttr,\n parseEnumAttr,\n getChildren,\n getChild,\n getDoc,\n getDocDeprecated,\n type RawNode,\n};\n"]}
|
package/dist/gir/primitives.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** A fundamental C type GIR can name, collapsed to the marshalling category GTKX treats it as. */
|
|
1
2
|
type PrimitiveCategory = "void" | "boolean" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "int64" | "uint64" | "bigint64" | "biguint64" | "gtype" | "float32" | "float64" | "string" | "unichar" | "pointer";
|
|
2
3
|
declare const PRIMITIVE_SIZE: Record<PrimitiveCategory, number>;
|
|
3
4
|
declare const PRIMITIVE_TS_TYPE: Record<PrimitiveCategory, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/gir/primitives.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAChB,MAAM,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;AAEd,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAmBrD,CAAC;AAsDF,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAmBxD,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,iBAAiB,GAAG,SAAwC,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/gir/primitives.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,KAAK,iBAAiB,GAChB,MAAM,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,WAAW,GACX,OAAO,GACP,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;AAEd,QAAA,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAmBrD,CAAC;AAsDF,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAmBxD,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,iBAAiB,GAAG,SAAwC,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/gir/primitives.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/gir/primitives.ts"],"names":[],"mappings":"AAqBA,MAAM,cAAc,GAAsC;IACtD,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,O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pB,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAiC,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAA0B,CAAC","sourcesContent":["/** A fundamental C type GIR can name, collapsed to the marshalling category GTKX treats it as. */\ntype PrimitiveCategory =\n | \"void\" |\n \"boolean\" |\n \"int8\" |\n \"uint8\" |\n \"int16\" |\n \"uint16\" |\n \"int32\" |\n \"uint32\" |\n \"int64\" |\n \"uint64\" |\n \"bigint64\" |\n \"biguint64\" |\n \"gtype\" |\n \"float32\" |\n \"float64\" |\n \"string\" |\n \"unichar\" |\n \"pointer\";\n\nconst PRIMITIVE_SIZE: Record<PrimitiveCategory, number> = {\n void: 0,\n boolean: 4,\n int8: 1,\n uint8: 1,\n int16: 2,\n uint16: 2,\n int32: 4,\n uint32: 4,\n int64: 8,\n uint64: 8,\n bigint64: 8,\n biguint64: 8,\n gtype: 8,\n float32: 4,\n float64: 8,\n string: 8,\n unichar: 4,\n pointer: 8,\n};\n\nconst PRIMITIVE_BY_NAME: Map<string, PrimitiveCategory> = new Map([\n [\"none\", \"void\"],\n [\"void\", \"void\"],\n [\"gboolean\", \"boolean\"],\n [\"gchar\", \"int8\"],\n [\"gint8\", \"int8\"],\n [\"guchar\", \"uint8\"],\n [\"guint8\", \"uint8\"],\n [\"gshort\", \"int16\"],\n [\"gint16\", \"int16\"],\n [\"gushort\", \"uint16\"],\n [\"guint16\", \"uint16\"],\n [\"gint\", \"int32\"],\n [\"gint32\", \"int32\"],\n [\"int\", \"int32\"],\n [\"int8\", \"int8\"],\n [\"uint8\", \"uint8\"],\n [\"int16\", \"int16\"],\n [\"uint16\", \"uint16\"],\n [\"int32\", \"int32\"],\n [\"uint32\", \"uint32\"],\n [\"int64\", \"bigint64\"],\n [\"uint64\", \"biguint64\"],\n [\"guint\", \"uint32\"],\n [\"guint32\", \"uint32\"],\n [\"glong\", \"bigint64\"],\n [\"gint64\", \"bigint64\"],\n [\"long\", \"bigint64\"],\n [\"gssize\", \"int64\"],\n [\"gintptr\", \"int64\"],\n [\"gulong\", \"biguint64\"],\n [\"guint64\", \"biguint64\"],\n [\"gsize\", \"uint64\"],\n [\"guintptr\", \"uint64\"],\n [\"GType\", \"gtype\"],\n [\"time_t\", \"bigint64\"],\n [\"pid_t\", \"int32\"],\n [\"uid_t\", \"uint32\"],\n [\"gid_t\", \"uint32\"],\n [\"gfloat\", \"float32\"],\n [\"float\", \"float32\"],\n [\"gdouble\", \"float64\"],\n [\"double\", \"float64\"],\n [\"long double\", \"float64\"],\n [\"utf8\", \"string\"],\n [\"filename\", \"string\"],\n [\"gchararray\", \"string\"],\n [\"gunichar\", \"unichar\"],\n [\"gpointer\", \"pointer\"],\n [\"gconstpointer\", \"pointer\"],\n] as const);\n\nconst PRIMITIVE_TS_TYPE: Record<PrimitiveCategory, string> = {\n void: \"void\",\n boolean: \"boolean\",\n int8: \"number\",\n uint8: \"number\",\n int16: \"number\",\n uint16: \"number\",\n int32: \"number\",\n uint32: \"number\",\n int64: \"number\",\n uint64: \"number\",\n bigint64: \"bigint\",\n biguint64: \"bigint\",\n gtype: \"bigint\",\n float32: \"number\",\n float64: \"number\",\n string: \"string\",\n unichar: \"string\",\n pointer: \"number\",\n};\n\nconst primitiveCategory = (name: string): PrimitiveCategory | undefined => PRIMITIVE_BY_NAME.get(name);\n\nexport { PRIMITIVE_SIZE, PRIMITIVE_TS_TYPE, primitiveCategory, type PrimitiveCategory };\n"]}
|
package/dist/gir/property.d.ts
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import type { ParseContext, TypeId } from "./type-id.js";
|
|
2
|
+
import { type GirAnnotations } from "./annotations.js";
|
|
2
3
|
import { type ParameterTransfer } from "./parameter.js";
|
|
3
4
|
import { type RawNode } from "./parse.js";
|
|
5
|
+
/** A GObject property declared on a class or interface, with the annotations its accessors are generated from. */
|
|
4
6
|
type GirProperty = {
|
|
7
|
+
/** Canonical property name, dashed the way GObject registers it. */
|
|
5
8
|
name: string;
|
|
9
|
+
/** Documentation prose from GIR, emitted as the accessor's JSDoc. */
|
|
6
10
|
doc: string | undefined;
|
|
11
|
+
/** Release and deprecation annotations GIR carries on the property. */
|
|
12
|
+
annotations: GirAnnotations;
|
|
13
|
+
/** The property's value type, absent when GIR declares none. */
|
|
7
14
|
type: TypeId | undefined;
|
|
15
|
+
/** Whether GObject exposes the value for reading, which admits a generated getter. */
|
|
8
16
|
readable: boolean;
|
|
17
|
+
/** Whether GObject accepts a value for the property, which admits a generated setter. */
|
|
9
18
|
writable: boolean;
|
|
19
|
+
/** Whether GObject sets the property during construction, using its default when none is supplied. */
|
|
10
20
|
construct: boolean;
|
|
21
|
+
/** Whether the property can only be set at construction. */
|
|
11
22
|
constructOnly: boolean;
|
|
23
|
+
/** Whether GIR exposes the property to bindings. */
|
|
12
24
|
introspectable: boolean;
|
|
25
|
+
/** How ownership of the value transfers, which decides the descriptor the accessors marshal through. */
|
|
13
26
|
transferOwnership: ParameterTransfer;
|
|
27
|
+
/** Method GIR names as reading the property, which the generated getter delegates to. */
|
|
14
28
|
getter: string | undefined;
|
|
29
|
+
/** Method GIR names as writing the property, which the generated setter delegates to. */
|
|
15
30
|
setter: string | undefined;
|
|
31
|
+
/** The property's default, as GIR spells it. */
|
|
16
32
|
defaultValue: string | undefined;
|
|
17
33
|
};
|
|
18
34
|
declare const isConstructableProperty: (property: GirProperty) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/gir/property.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/gir/property.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
|
+
import { documentedFromNode } from "./annotations.js";
|
|
1
2
|
import { transferOwnership } from "./parameter.js";
|
|
2
|
-
import { attr,
|
|
3
|
+
import { attr, isAttrTrue } from "./parse.js";
|
|
3
4
|
import { typeRefFromNode } from "./type-ref.js";
|
|
4
5
|
const isConstructableProperty = (property) => property.writable || property.construct || property.constructOnly;
|
|
5
6
|
const propertyFromNode = (node, context) => ({
|
|
6
|
-
|
|
7
|
-
doc: getDoc(node),
|
|
7
|
+
...documentedFromNode(node),
|
|
8
8
|
type: typeRefFromNode(node, context),
|
|
9
9
|
readable: isAttrTrue(node, "readable", true),
|
|
10
10
|
writable: isAttrTrue(node, "writable"),
|
package/dist/gir/property.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../src/gir/property.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../src/gir/property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAA0B,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAgB,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAgChD,MAAM,uBAAuB,GAAG,CAAC,QAAqB,EAAW,EAAE,CAC/D,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,aAAa,CAAC;AAEtE,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAE,OAAqB,EAAe,EAAE,CAAC,CAAC;IAC7E,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAC3B,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC;IACpC,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC;IAC5C,QAAQ,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC;IACtC,SAAS,EAAE,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC;IACxC,aAAa,EAAE,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC;IACjD,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC;IACxD,iBAAiB,EAAE,iBAAiB,CAAC,IAAI,CAAC;IAC1C,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;IAC5B,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;IAC5B,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC;CAC5C,CAAC,CAAC;AAEH,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAoB,CAAC","sourcesContent":["import type { ParseContext, TypeId } from \"./type-id.js\";\nimport { documentedFromNode, type GirAnnotations } from \"./annotations.js\";\nimport { type ParameterTransfer, transferOwnership } from \"./parameter.js\";\nimport { attr, isAttrTrue, type RawNode } from \"./parse.js\";\nimport { typeRefFromNode } from \"./type-ref.js\";\n\n/** A GObject property declared on a class or interface, with the annotations its accessors are generated from. */\ntype GirProperty = {\n /** Canonical property name, dashed the way GObject registers it. */\n name: string;\n /** Documentation prose from GIR, emitted as the accessor's JSDoc. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the property. */\n annotations: GirAnnotations;\n /** The property's value type, absent when GIR declares none. */\n type: TypeId | undefined;\n /** Whether GObject exposes the value for reading, which admits a generated getter. */\n readable: boolean;\n /** Whether GObject accepts a value for the property, which admits a generated setter. */\n writable: boolean;\n /** Whether GObject sets the property during construction, using its default when none is supplied. */\n construct: boolean;\n /** Whether the property can only be set at construction. */\n constructOnly: boolean;\n /** Whether GIR exposes the property to bindings. */\n introspectable: boolean;\n /** How ownership of the value transfers, which decides the descriptor the accessors marshal through. */\n transferOwnership: ParameterTransfer;\n /** Method GIR names as reading the property, which the generated getter delegates to. */\n getter: string | undefined;\n /** Method GIR names as writing the property, which the generated setter delegates to. */\n setter: string | undefined;\n /** The property's default, as GIR spells it. */\n defaultValue: string | undefined;\n};\n\nconst isConstructableProperty = (property: GirProperty): boolean =>\n property.writable || property.construct || property.constructOnly;\n\nconst propertyFromNode = (node: RawNode, context: ParseContext): GirProperty => ({\n ...documentedFromNode(node),\n type: typeRefFromNode(node, context),\n readable: isAttrTrue(node, \"readable\", true),\n writable: isAttrTrue(node, \"writable\"),\n construct: isAttrTrue(node, \"construct\"),\n constructOnly: isAttrTrue(node, \"construct-only\"),\n introspectable: isAttrTrue(node, \"introspectable\", true),\n transferOwnership: transferOwnership(node),\n getter: attr(node, \"getter\"),\n setter: attr(node, \"setter\"),\n defaultValue: attr(node, \"default-value\"),\n});\n\nexport { isConstructableProperty, propertyFromNode, type GirProperty };\n"]}
|
package/dist/gir/record.d.ts
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
1
|
import type { ParseContext } from "./type-id.js";
|
|
2
|
+
import { type GirAnnotations } from "./annotations.js";
|
|
2
3
|
import { type GirField } from "./field.js";
|
|
3
4
|
import { type GirFunction } from "./function.js";
|
|
4
5
|
import { type RawNode } from "./parse.js";
|
|
6
|
+
/** A C struct or union declared by a GIR namespace: a plain record, a boxed type, or a GObject vtable. */
|
|
5
7
|
type GirRecord = {
|
|
8
|
+
/** Whether the record is the class or interface struct holding another type's virtual methods. */
|
|
6
9
|
isVtable: boolean;
|
|
10
|
+
/** Name within the declaring namespace, such as `"TextIter"`. */
|
|
7
11
|
name: string;
|
|
12
|
+
/** Raw gtk-doc text from the GIR, undefined when the record is undocumented. */
|
|
8
13
|
doc: string | undefined;
|
|
14
|
+
/** Release and deprecation annotations GIR carries on the record. */
|
|
15
|
+
annotations: GirAnnotations;
|
|
16
|
+
/** C struct name, such as `"GtkTextIter"`. */
|
|
9
17
|
cType: string | undefined;
|
|
18
|
+
/** GLib type name the record is registered under, present when it is a boxed type. */
|
|
10
19
|
glibTypeName: string | undefined;
|
|
20
|
+
/** Name of the function registering the record's GType, such as `"gtk_text_iter_get_type"`. */
|
|
11
21
|
glibGetType: string | undefined;
|
|
22
|
+
/** Name of the function taking a reference, for reference-counted records. */
|
|
12
23
|
glibRefFunc: string | undefined;
|
|
24
|
+
/** Name of the function dropping a reference, for reference-counted records. */
|
|
13
25
|
glibUnrefFunc: string | undefined;
|
|
26
|
+
/** Name of the function duplicating an instance, used when the record has no ref function. */
|
|
14
27
|
copyFunc: string | undefined;
|
|
28
|
+
/** Name of the function releasing an instance, used when the record has no unref function. */
|
|
15
29
|
freeFunc: string | undefined;
|
|
30
|
+
/** Whether the struct is only ever handled behind a pointer, so its layout stays hidden. */
|
|
16
31
|
disguised: boolean;
|
|
32
|
+
/** Whether the struct's fields are private, so instances cannot be allocated or read directly. */
|
|
17
33
|
opaque: boolean;
|
|
34
|
+
/** Whether the record is exposed to language bindings. */
|
|
18
35
|
introspectable: boolean;
|
|
36
|
+
/** Struct members: the named fields first, then the anonymous inline unions, then the inline records. */
|
|
19
37
|
fields: GirField[];
|
|
38
|
+
/** Functions taking an instance of the record as their first argument. */
|
|
20
39
|
methods: GirFunction[];
|
|
40
|
+
/** Functions returning a new instance of the record. */
|
|
21
41
|
constructors: GirFunction[];
|
|
42
|
+
/** Functions scoped to the record but taking no instance. */
|
|
22
43
|
functions: GirFunction[];
|
|
44
|
+
/** Whether the record is a union, so its fields overlap instead of following one another. */
|
|
23
45
|
isUnion: boolean;
|
|
24
46
|
};
|
|
25
47
|
declare const recordFromNode: (node: RawNode, isVtable: boolean, isUnion: boolean, context: ParseContext) => GirRecord;
|
package/dist/gir/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/gir/record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MA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ChB,0DAA0D;IAC1D,cAAc,EAAE,OAAO,CAAC;IACxB,yGAAyG;IACzG,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,0EAA0E;IAC1E,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,wDAAwD;IACxD,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,6DAA6D;IAC7D,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,6FAA6F;IAC7F,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,cAAc,GAChB,MAAM,OAAO,EACb,UAAU,OAAO,EACjB,SAAS,OAAO,EAChB,SAAS,YAAY,KACtB,SAmBD,CAAC;AAEH,QAAA,MAAM,cAAc,GAAI,MAAM,OAAO,KAAG,OAA+D,CAAC;AAExG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,CAAC"}
|
package/dist/gir/record.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { documentedFromNode } from "./annotations.js";
|
|
1
2
|
import { collectFields } from "./field.js";
|
|
2
3
|
import { functionFromNode } from "./function.js";
|
|
3
|
-
import { attr, getChildren,
|
|
4
|
+
import { attr, getChildren, GIR_CONSTRUCTOR_TAG, isAttrTrue } from "./parse.js";
|
|
4
5
|
const recordFromNode = (node, isVtable, isUnion, context) => ({
|
|
5
6
|
isVtable,
|
|
7
|
+
...documentedFromNode(node),
|
|
6
8
|
name: attr(node, "name") ?? attr(node, "glib:name") ?? "",
|
|
7
|
-
doc: getDoc(node),
|
|
8
9
|
cType: attr(node, "c:type"),
|
|
9
10
|
glibTypeName: attr(node, "glib:type-name"),
|
|
10
11
|
glibGetType: attr(node, "glib:get-type"),
|
package/dist/gir/record.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/gir/record.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAC;AAC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,CAAC;IACxD,MAAM,EAAE,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC;IACpC,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvF,YAAY,EAAE,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnG,SAAS,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACnF,OAAO;CACV,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,IAAa,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,0BAA0B,CAAC,KAAK,SAAS,CAAC;AAExG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAkB,CAAC","sourcesContent":["import type { ParseContext } from \"./type-id.js\";\nimport { documentedFromNode, type GirAnnotations } from \"./annotations.js\";\nimport { collectFields, type GirField } from \"./field.js\";\nimport { functionFromNode, type GirFunction } from \"./function.js\";\nimport { attr, getChildren, GIR_CONSTRUCTOR_TAG, isAttrTrue, type RawNode } from \"./parse.js\";\n\n/** A C struct or union declared by a GIR namespace: a plain record, a boxed type, or a GObject vtable. */\ntype GirRecord = {\n /** Whether the record is the class or interface struct holding another type's virtual methods. */\n isVtable: boolean;\n /** Name within the declaring namespace, such as `\"TextIter\"`. */\n name: string;\n /** Raw gtk-doc text from the GIR, undefined when the record is undocumented. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the record. */\n annotations: GirAnnotations;\n /** C struct name, such as `\"GtkTextIter\"`. */\n cType: string | undefined;\n /** GLib type name the record is registered under, present when it is a boxed type. */\n glibTypeName: string | undefined;\n /** Name of the function registering the record's GType, such as `\"gtk_text_iter_get_type\"`. */\n glibGetType: string | undefined;\n /** Name of the function taking a reference, for reference-counted records. */\n glibRefFunc: string | undefined;\n /** Name of the function dropping a reference, for reference-counted records. */\n glibUnrefFunc: string | undefined;\n /** Name of the function duplicating an instance, used when the record has no ref function. */\n copyFunc: string | undefined;\n /** Name of the function releasing an instance, used when the record has no unref function. */\n freeFunc: string | undefined;\n /** Whether the struct is only ever handled behind a pointer, so its layout stays hidden. */\n disguised: boolean;\n /** Whether the struct's fields are private, so instances cannot be allocated or read directly. */\n opaque: boolean;\n /** Whether the record is exposed to language bindings. */\n introspectable: boolean;\n /** Struct members: the named fields first, then the anonymous inline unions, then the inline records. */\n fields: GirField[];\n /** Functions taking an instance of the record as their first argument. */\n methods: GirFunction[];\n /** Functions returning a new instance of the record. */\n constructors: GirFunction[];\n /** Functions scoped to the record but taking no instance. */\n functions: GirFunction[];\n /** Whether the record is a union, so its fields overlap instead of following one another. */\n isUnion: boolean;\n};\n\nconst recordFromNode = (\n node: RawNode,\n isVtable: boolean,\n isUnion: boolean,\n context: ParseContext,\n): GirRecord => ({\n isVtable,\n ...documentedFromNode(node),\n name: attr(node, \"name\") ?? attr(node, \"glib:name\") ?? \"\",\n cType: attr(node, \"c:type\"),\n glibTypeName: attr(node, \"glib:type-name\"),\n glibGetType: attr(node, \"glib:get-type\"),\n glibRefFunc: attr(node, \"glib:ref-func\"),\n glibUnrefFunc: attr(node, \"glib:unref-func\"),\n copyFunc: attr(node, \"copy-function\"),\n freeFunc: attr(node, \"free-function\"),\n disguised: isAttrTrue(node, \"disguised\"),\n opaque: isAttrTrue(node, \"opaque\"),\n introspectable: isAttrTrue(node, \"introspectable\", true),\n fields: collectFields(node, context),\n methods: getChildren(node, \"method\").map((method) => functionFromNode(method, context)),\n constructors: getChildren(node, GIR_CONSTRUCTOR_TAG).map((ctor) => functionFromNode(ctor, context)),\n functions: getChildren(node, \"function\").map((fn) => functionFromNode(fn, context)),\n isUnion,\n});\n\nconst isVtableRecord = (node: RawNode): boolean => attr(node, \"glib:is-gtype-struct-for\") !== undefined;\n\nexport { recordFromNode, isVtableRecord, type GirRecord };\n"]}
|
package/dist/gir/size.d.ts
CHANGED
|
@@ -8,14 +8,15 @@ type FieldSlot = {
|
|
|
8
8
|
bitOffset: number | undefined;
|
|
9
9
|
bitWidth: number | undefined;
|
|
10
10
|
};
|
|
11
|
+
type FieldSlots = {
|
|
12
|
+
slots: FieldSlot[];
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
11
15
|
type FieldLayoutInput = {
|
|
12
16
|
layout: FieldLayout;
|
|
13
17
|
bits: number | undefined;
|
|
14
18
|
};
|
|
15
19
|
declare const layoutOfPrimitive: (category: PrimitiveCategory) => FieldLayout;
|
|
16
|
-
declare const computeFieldSlots: (fields: FieldLayoutInput[], isUnion?: boolean) =>
|
|
17
|
-
slots: FieldSlot[];
|
|
18
|
-
size: number;
|
|
19
|
-
};
|
|
20
|
+
declare const computeFieldSlots: (fields: FieldLayoutInput[], isUnion?: boolean) => FieldSlots;
|
|
20
21
|
export { layoutOfPrimitive, computeFieldSlots, type FieldLayout, type FieldSlot, type FieldLayoutInput };
|
|
21
22
|
//# sourceMappingURL=size.d.ts.map
|
package/dist/gir/size.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/gir/size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzE,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,SAAS,GAAG;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AASF,QAAA,MAAM,iBAAiB,GAAI,UAAU,iBAAiB,KAAG,WAIxD,CAAC;
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/gir/size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzE,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,SAAS,GAAG;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG;IACd,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AASF,QAAA,MAAM,iBAAiB,GAAI,UAAU,iBAAiB,KAAG,WAIxD,CAAC;AA+EF,QAAA,MAAM,iBAAiB,GAAI,QAAQ,gBAAgB,EAAE,EAAE,iBAAe,KAAG,UACL,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
package/dist/gir/size.js
CHANGED
|
@@ -26,9 +26,6 @@ const pushPlainField = (state, slots, field, align) => {
|
|
|
26
26
|
slots.push({ byteOffset, bitOffset: undefined, bitWidth: undefined });
|
|
27
27
|
state.bitCursor = (byteOffset + field.layout.size) * 8;
|
|
28
28
|
};
|
|
29
|
-
// SysV AMD64 places a bit-field at the current bit offset whenever it still fits inside a storage
|
|
30
|
-
// unit of its declared type aligned to that type's alignment, so the unit the cursor already sits in
|
|
31
|
-
// may have room even though the cursor is not on a unit boundary.
|
|
32
29
|
const pushBitfield = (input) => {
|
|
33
30
|
const { state, slots, field, align, bits } = input;
|
|
34
31
|
const unitStart = floorDown(floorDown(state.bitCursor, 8) / 8, align);
|
package/dist/gir/size.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/gir/size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/gir/size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AA4BzE,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAU,EAAE,CAAC,KAAK,GAAG,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC;AAE1F,MAAM,iBAAiB,GAAG,CAAC,QAA2B,EAAe,EAAE;IACnE,MAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEtC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAU,EAAE;IACxD,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;IAEnC,OAAO,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;AACpE,CAAC,CAAC;A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AO;IACX,CAAC;IAED,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAA0B,EAAc,EAAE;IAClE,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAsB,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAE/D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;AACrF,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,MAA0B,EAAE,OAAO,GAAG,KAAK,EAAc,EAAE,CAClF,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAA2D,CAAC","sourcesContent":["import { PRIMITIVE_SIZE, type PrimitiveCategory } from \"./primitives.js\";\n\ntype FieldLayout = {\n size: number;\n align: number;\n};\n\ntype FieldSlot = {\n byteOffset: number;\n bitOffset: number | undefined;\n bitWidth: number | undefined;\n};\n\ntype FieldSlots = {\n slots: FieldSlot[];\n size: number;\n};\n\ntype FieldLayoutInput = {\n layout: FieldLayout;\n bits: number | undefined;\n};\n\ntype StructLayoutState = {\n bitCursor: number;\n maxAlign: number;\n};\n\nconst floorDown = (value: number, multiple: number): number => value - (value % multiple);\n\nconst layoutOfPrimitive = (category: PrimitiveCategory): FieldLayout => {\n const size = PRIMITIVE_SIZE[category];\n\n return { size, align: size === 0 ? 1 : size };\n};\n\nconst roundUp = (value: number, multiple: number): number => {\n if (multiple <= 1) {\n return value;\n }\n\n const remainder = value % multiple;\n\n return remainder === 0 ? value : value + (multiple - remainder);\n};\n\nconst computeUnionSlots = (fields: FieldLayoutInput[]): FieldSlots => {\n let maxSize = 0;\n let maxAlign = 1;\n\n const slots = fields.map((field) => {\n maxSize = Math.max(maxSize, field.layout.size);\n maxAlign = Math.max(maxAlign, field.layout.align);\n\n return { byteOffset: 0, bitOffset: field.bits === undefined ? undefined : 0, bitWidth: field.bits };\n });\n\n return { slots, size: roundUp(maxSize, maxAlign) };\n};\n\nconst pushPlainField = (state: StructLayoutState, slots: FieldSlot[], field: FieldLayoutInput, align: number): void => {\n const byteOffset = roundUp(roundUp(state.bitCursor, 8) / 8, align);\n slots.push({ byteOffset, bitOffset: undefined, bitWidth: undefined });\n state.bitCursor = (byteOffset + field.layout.size) * 8;\n};\n\nconst pushBitfield = (input: {\n state: StructLayoutState;\n slots: FieldSlot[];\n field: FieldLayoutInput;\n align: number;\n bits: number;\n}): void => {\n const { state, slots, field, align, bits } = input;\n const unitStart = floorDown(floorDown(state.bitCursor, 8) / 8, align);\n const isFitsInCurrentUnit = state.bitCursor + bits <= (unitStart + field.layout.size) * 8;\n const byteOffset = isFitsInCurrentUnit ? unitStart : roundUp(roundUp(state.bitCursor, 8) / 8, align);\n\n if (!isFitsInCurrentUnit) {\n state.bitCursor = byteOffset * 8;\n }\n\n slots.push({ byteOffset, bitOffset: state.bitCursor - byteOffset * 8, bitWidth: bits });\n state.bitCursor += bits;\n};\n\nconst processStructField = (state: StructLayoutState, slots: FieldSlot[], field: FieldLayoutInput): void => {\n const align = Math.max(1, field.layout.align);\n\n if (align > state.maxAlign) {\n state.maxAlign = align;\n }\n\n if (field.bits === undefined) {\n pushPlainField(state, slots, field, align);\n\n return;\n }\n\n pushBitfield({ state, slots, field, align, bits: field.bits });\n};\n\nconst computeStructSlots = (fields: FieldLayoutInput[]): FieldSlots => {\n const slots: FieldSlot[] = [];\n const state: StructLayoutState = { bitCursor: 0, maxAlign: 1 };\n\n for (const field of fields) {\n processStructField(state, slots, field);\n }\n\n return { slots, size: roundUp(roundUp(state.bitCursor, 8) / 8, state.maxAlign) };\n};\n\nconst computeFieldSlots = (fields: FieldLayoutInput[], isUnion = false): FieldSlots =>\n isUnion ? computeUnionSlots(fields) : computeStructSlots(fields);\n\nexport { layoutOfPrimitive, computeFieldSlots, type FieldLayout, type FieldSlot, type FieldLayoutInput };\n"]}
|
package/dist/gir/type-id.d.ts
CHANGED
|
@@ -1,44 +1,79 @@
|
|
|
1
1
|
import type { RawNode } from "./parse.js";
|
|
2
2
|
import type { PrimitiveCategory } from "./primitives.js";
|
|
3
|
+
/** A reference to a parsed type: the type table holding it, and its slot in that table. */
|
|
3
4
|
type TypeId = {
|
|
5
|
+
/** Id of the table holding the type: a namespace's, or the internal one primitives and varargs intern into. */
|
|
4
6
|
nsId: number;
|
|
7
|
+
/** Slot the type occupies in that table. */
|
|
5
8
|
id: number;
|
|
6
9
|
};
|
|
10
|
+
/** Which GLib container a {@link ListType} is. */
|
|
7
11
|
type ListFlavor = (typeof LIST_FLAVOR_BY_NAME)[keyof typeof LIST_FLAVOR_BY_NAME];
|
|
12
|
+
/** A type that marshals directly as a value, such as `gint` or `utf8`. */
|
|
8
13
|
type PrimitiveType = {
|
|
14
|
+
/** Discriminates {@link StructuralType}. */
|
|
9
15
|
kind: "primitive";
|
|
16
|
+
/** The scalar the type marshals as. */
|
|
10
17
|
category: PrimitiveCategory;
|
|
11
18
|
};
|
|
19
|
+
/** The trailing `...` argument list of a variadic C function. */
|
|
12
20
|
type VarargsType = {
|
|
21
|
+
/** Discriminates {@link StructuralType}. */
|
|
13
22
|
kind: "varargs";
|
|
14
23
|
};
|
|
24
|
+
/** A C array, along with whatever the GIR says about how its length is determined. */
|
|
15
25
|
type CArrayType = {
|
|
26
|
+
/** Discriminates {@link StructuralType}. */
|
|
16
27
|
kind: "carray";
|
|
28
|
+
/** Type of the array's elements, paired with `elementCType` to build the element descriptor. */
|
|
17
29
|
element: TypeId;
|
|
30
|
+
/** C declaration of an element, which tells an inline struct apart from a pointer to one. */
|
|
18
31
|
elementCType: string | undefined;
|
|
32
|
+
/** C declaration of the array itself. */
|
|
33
|
+
arrayCType: string | undefined;
|
|
34
|
+
/** Index of the parameter, or of the sibling record field, carrying the length. */
|
|
19
35
|
lengthParameterIndex: number | undefined;
|
|
36
|
+
/** Element count when the array has a fixed size. */
|
|
20
37
|
fixedSize: number | undefined;
|
|
21
|
-
|
|
38
|
+
/** Whether the array ends at a null element. */
|
|
39
|
+
isZeroTerminated: boolean;
|
|
22
40
|
};
|
|
41
|
+
/** A GLib list or array container over a single element type. */
|
|
23
42
|
type ListType = {
|
|
43
|
+
/** Discriminates {@link StructuralType}. */
|
|
24
44
|
kind: "list";
|
|
45
|
+
/** Which container the type is. */
|
|
25
46
|
flavor: ListFlavor;
|
|
47
|
+
/** Type the container's elements marshal as, which the list descriptor wraps. */
|
|
26
48
|
element: TypeId;
|
|
27
49
|
};
|
|
50
|
+
/** A `GLib.HashTable`. */
|
|
28
51
|
type HashTableType = {
|
|
52
|
+
/** Discriminates {@link StructuralType}. */
|
|
29
53
|
kind: "hashtable";
|
|
54
|
+
/** Type the keys marshal as, rendered as the key half of a `Record` or `Map`. */
|
|
30
55
|
key: TypeId;
|
|
56
|
+
/** Type the values marshal as, rendered as the value half of a `Record` or `Map`. */
|
|
31
57
|
value: TypeId;
|
|
32
58
|
};
|
|
59
|
+
/** A type the GIR describes by its structure rather than by a name it declares. */
|
|
33
60
|
type StructuralType = PrimitiveType | VarargsType | CArrayType | ListType | HashTableType;
|
|
61
|
+
/** The hooks the GIR parsers use to reference and register types while walking one namespace. */
|
|
34
62
|
type ParseContext = {
|
|
63
|
+
/** Id of the namespace being parsed. */
|
|
35
64
|
nsId: number;
|
|
65
|
+
/** Resolves a GIR type name, optionally namespace-qualified, reserving a slot when it is not parsed yet. */
|
|
36
66
|
findType(name: string): TypeId;
|
|
67
|
+
/** Interns a primitive type and returns its id. */
|
|
37
68
|
addPrimitive(category: PrimitiveCategory): TypeId;
|
|
69
|
+
/** Interns the varargs type and returns its id. */
|
|
38
70
|
addVarargs(): TypeId;
|
|
71
|
+
/** Registers an unnamed container type in the namespace and returns its id. */
|
|
39
72
|
addContainer(type: CArrayType | ListType | HashTableType): TypeId;
|
|
73
|
+
/** Parses an inline `<callback>` node, registers it as an unnamed type, and returns its id. */
|
|
40
74
|
addAnonymousCallback(node: RawNode): TypeId;
|
|
41
75
|
};
|
|
76
|
+
/** GIR type names of the GLib containers, mapped to the {@link ListFlavor} each one parses to. */
|
|
42
77
|
declare const LIST_FLAVOR_BY_NAME: {
|
|
43
78
|
readonly "GLib.List": "glist";
|
|
44
79
|
readonly "GLib.SList": "gslist";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-id.d.ts","sourceRoot":"","sources":["../../src/gir/type-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,KAAK,MAAM,GAAG;
|
|
1
|
+
{"version":3,"file":"type-id.d.ts","sourceRoot":"","sources":["../../src/gir/type-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,2FAA2F;AAC3F,KAAK,MAAM,GAAG;IACV,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,kDAAkD;AAClD,KAAK,UAAU,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBA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AC;IACb,4GAA4G;IAC5G,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,mDAAmD;IACnD,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAAC;IAClD,mDAAmD;IACnD,UAAU,IAAI,MAAM,CAAC;IACrB,+EAA+E;IAC/E,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;IAClE,+FAA+F;IAC/F,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CAC/C,CAAC;AAEF,kGAAkG;AAClG,QAAA,MAAM,mBAAmB;;;;;;CAMf,CAAC;AAEX,QAAA,MAAM,qBAAqB,GAAI,KAAK,UAAU,KAAG,OACiD,CAAC;AAEnG,OAAO,EACH,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,GACpB,CAAC"}
|
package/dist/gir/type-id.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** GIR type names of the GLib containers, mapped to the {@link ListFlavor} each one parses to. */
|
|
1
2
|
const LIST_FLAVOR_BY_NAME = {
|
|
2
3
|
"GLib.List": "glist",
|
|
3
4
|
"GLib.SList": "gslist",
|
|
@@ -5,8 +6,6 @@ const LIST_FLAVOR_BY_NAME = {
|
|
|
5
6
|
"GLib.Array": "garray",
|
|
6
7
|
"GLib.ByteArray": "gbytearray",
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
// way to recover its length, so it is a bare pointer rather than something that can be walked.
|
|
10
|
-
const hasUnknownArrayLength = (ref) => !ref.zeroTerminated && ref.lengthParameterIndex === undefined && ref.fixedSize === undefined;
|
|
9
|
+
const hasUnknownArrayLength = (ref) => !ref.isZeroTerminated && ref.lengthParameterIndex === undefined && ref.fixedSize === undefined;
|
|
11
10
|
export { hasUnknownArrayLength, LIST_FLAVOR_BY_NAME, };
|
|
12
11
|
//# sourceMappingURL=type-id.js.map
|
package/dist/gir/type-id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-id.js","sourceRoot":"","sources":["../../src/gir/type-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-id.js","sourceRoot":"","sources":["../../src/gir/type-id.ts"],"names":[],"mappings":"AAqFA,kGAAkG;AAClG,MAAM,mBAAmB,GAAG;IACxB,WAAW,EAAE,OAAO;IACpB,YAAY,EAAE,QAAQ;IACtB,eAAe,EAAE,WAAW;IAC5B,YAAY,EAAE,QAAQ;IACtB,gBAAgB,EAAE,YAAY;CACxB,CAAC;AAEX,MAAM,qBAAqB,GAAG,CAAC,GAAe,EAAW,EAAE,CACvD,CAAC,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,oBAAoB,KAAK,SAAS,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC;AAEnG,OAAO,EACH,qBAAqB,EACrB,mBAAmB,GAQtB,CAAC","sourcesContent":["import type { RawNode } from \"./parse.js\";\nimport type { PrimitiveCategory } from \"./primitives.js\";\n\n/** A reference to a parsed type: the type table holding it, and its slot in that table. */\ntype TypeId = {\n /** Id of the table holding the type: a namespace's, or the internal one primitives and varargs intern into. */\n nsId: number;\n /** Slot the type occupies in that table. */\n id: number;\n};\n\n/** Which GLib container a {@link ListType} is. */\ntype ListFlavor = (typeof LIST_FLAVOR_BY_NAME)[keyof typeof LIST_FLAVOR_BY_NAME];\n\n/** A type that marshals directly as a value, such as `gint` or `utf8`. */\ntype PrimitiveType = {\n /** Discriminates {@link StructuralType}. */\n kind: \"primitive\";\n /** The scalar the type marshals as. */\n category: PrimitiveCategory;\n};\n\n/** The trailing `...` argument list of a variadic C function. */\ntype VarargsType = {\n /** Discriminates {@link StructuralType}. */\n kind: \"varargs\";\n};\n\n/** A C array, along with whatever the GIR says about how its length is determined. */\ntype CArrayType = {\n /** Discriminates {@link StructuralType}. */\n kind: \"carray\";\n /** Type of the array's elements, paired with `elementCType` to build the element descriptor. */\n element: TypeId;\n /** C declaration of an element, which tells an inline struct apart from a pointer to one. */\n elementCType: string | undefined;\n /** C declaration of the array itself. */\n arrayCType: string | undefined;\n /** Index of the parameter, or of the sibling record field, carrying the length. */\n lengthParameterIndex: number | undefined;\n /** Element count when the array has a fixed size. */\n fixedSize: number | undefined;\n /** Whether the array ends at a null element. */\n isZeroTerminated: boolean;\n};\n\n/** A GLib list or array container over a single element type. */\ntype ListType = {\n /** Discriminates {@link StructuralType}. */\n kind: \"list\";\n /** Which container the type is. */\n flavor: ListFlavor;\n /** Type the container's elements marshal as, which the list descriptor wraps. */\n element: TypeId;\n};\n\n/** A `GLib.HashTable`. */\ntype HashTableType = {\n /** Discriminates {@link StructuralType}. */\n kind: \"hashtable\";\n /** Type the keys marshal as, rendered as the key half of a `Record` or `Map`. */\n key: TypeId;\n /** Type the values marshal as, rendered as the value half of a `Record` or `Map`. */\n value: TypeId;\n};\n\n/** A type the GIR describes by its structure rather than by a name it declares. */\ntype StructuralType = PrimitiveType | VarargsType | CArrayType | ListType | HashTableType;\n\n/** The hooks the GIR parsers use to reference and register types while walking one namespace. */\ntype ParseContext = {\n /** Id of the namespace being parsed. */\n nsId: number;\n /** Resolves a GIR type name, optionally namespace-qualified, reserving a slot when it is not parsed yet. */\n findType(name: string): TypeId;\n /** Interns a primitive type and returns its id. */\n addPrimitive(category: PrimitiveCategory): TypeId;\n /** Interns the varargs type and returns its id. */\n addVarargs(): TypeId;\n /** Registers an unnamed container type in the namespace and returns its id. */\n addContainer(type: CArrayType | ListType | HashTableType): TypeId;\n /** Parses an inline `<callback>` node, registers it as an unnamed type, and returns its id. */\n addAnonymousCallback(node: RawNode): TypeId;\n};\n\n/** GIR type names of the GLib containers, mapped to the {@link ListFlavor} each one parses to. */\nconst LIST_FLAVOR_BY_NAME = {\n \"GLib.List\": \"glist\",\n \"GLib.SList\": \"gslist\",\n \"GLib.PtrArray\": \"gptrarray\",\n \"GLib.Array\": \"garray\",\n \"GLib.ByteArray\": \"gbytearray\",\n} as const;\n\nconst hasUnknownArrayLength = (ref: CArrayType): boolean =>\n !ref.isZeroTerminated && ref.lengthParameterIndex === undefined && ref.fixedSize === undefined;\n\nexport {\n hasUnknownArrayLength,\n LIST_FLAVOR_BY_NAME,\n type TypeId,\n type ListFlavor,\n type CArrayType,\n type ListType,\n type HashTableType,\n type StructuralType,\n type ParseContext,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-ref.d.ts","sourceRoot":"","sources":["../../src/gir/type-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEtG,OAAO,EAAyD,KAAK,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAUrH,QAAA,MAAM,eAAe,GAAI,QAAQ,OAAO,GAAG,SAAS,EAAE,SAAS,YAAY,KAAG,MAAM,GAAG,SA4BtF,CAAC;
|
|
1
|
+
{"version":3,"file":"type-ref.d.ts","sourceRoot":"","sources":["../../src/gir/type-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEtG,OAAO,EAAyD,KAAK,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAUrH,QAAA,MAAM,eAAe,GAAI,QAAQ,OAAO,GAAG,SAAS,EAAE,SAAS,YAAY,KAAG,MAAM,GAAG,SA4BtF,CAAC;AA6DF,QAAA,MAAM,sBAAsB,GAAI,MAAM,MAAM,KAAG,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAQzE,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,CAAC"}
|