diff --git a/.gitignore b/.gitignore index 27bff9c06..75ea53926 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ __pycache__/ .context/logs/ .context/.scratchpad.key .claude/settings.local.json +ocgtk/.claude/settings.local.json .claude/worktrees/ +ocgtk/.claude/worktrees/ diff --git a/CLAUDE.md b/CLAUDE.md index 84d07db73..6e20d0511 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -142,16 +142,20 @@ For generating GTK bindings from GObject Introspection (GIR) files: bash scripts/generate-bindings.sh ``` -This builds the generator, generates reference files for all 9 namespaces, then generates bindings with correct cross-namespace dependencies. +This builds the generator, generates reference files for all 9 namespaces, then generates bindings with correct cross-namespace dependencies. Override files in `ocgtk/overrides/` are applied automatically (one per namespace). **To regenerate a single library manually:** ```bash cd ocgtk -dune exec src/tools/gir_gen/gir_gen.exe -- generate /usr/share/gir-1.0/Gtk-4.0.gir src/gtk +dune exec src/tools/gir_gen/gir_gen.exe -- generate \ + -o overrides/gtk.sexp \ + /usr/share/gir-1.0/Gtk-4.0.gir src/gtk ``` NOTE: For other libraries, use `src/`. For example, src/pango for Pango, src/gsk for GSK, src/gdk for GDK, etc. +**Override files** (`ocgtk/overrides/.sexp`) control which entities are ignored during generation and set version guards on enum/bitfield members. Pass `-o overrides/.sexp` to `generate` or `references`. See [README_GIR_GEN.md — Override System](ocgtk/src/tools/README_GIR_GEN.md#override-system). + **⚠️ IMPORTANT:** Use `src/gtk` NOT `src/gtk/generated` as the output directory. The generator automatically creates the `generated/` subdirectory. Using `src/gtk/generated` will create a nested `src/gtk/generated/generated/` directory. diff --git a/README.md b/README.md index 86f764640..3ee606d8d 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ This library is distributed under the terms of the GNU Library General Public Li - **Development Setup**: [SETUP.md](SETUP.md) - **Security Guidelines**: [SECURITY_GUIDELINES.md](SECURITY_GUIDELINES.md) - **GIR Code Generation**: [ocgtk/src/tools/README_GIR_GEN.md](ocgtk/src/tools/README_GIR_GEN.md) +- **GIR Override Files**: [ocgtk/overrides/](ocgtk/overrides/) — per-namespace sexp files controlling entity ignores and version guards ## Resources diff --git a/ocgtk/.claude/settings.local.json b/ocgtk/.claude/settings.local.json deleted file mode 100644 index 293d7b6d7..000000000 --- a/ocgtk/.claude/settings.local.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(dune runtest:*)", - "Bash(_build/default/src/tools/gir_gen/main.exe:*)", - "Bash(dune exec:*)", - "Bash(dune build:*)", - "Bash(timeout 120 dune runtest:*)", - "Bash(tee:*)", - "Bash(pkill:*)", - "Bash(_build/default/src/tools/test_gir_gen/test_gir_gen.exe)", - "Bash(cat:*)", - "Bash(xargs cat:*)", - "Bash(find:*)", - "WebSearch", - "Bash(opam install:*)", - "Bash(ocamlfind query:*)", - "Bash(xargs ls:*)", - "Bash(dune clean:*)", - "Bash(ls:*)", - "Bash(pkg-config:*)", - "Bash(grep:*)", - "Bash(git stash:*)", - "Skill(ctx:ctx-add-learning)", - "WebFetch(domain:v2.ocaml.org)", - "WebFetch(domain:ocaml.org)", - "WebFetch(domain:raw.githubusercontent.com)", - "WebFetch(domain:api.github.com)" - ], - "deny": [], - "ask": [] - } -} diff --git a/ocgtk/architecture/README.md b/ocgtk/architecture/README.md index 952a7ad0c..3413d5e86 100644 --- a/ocgtk/architecture/README.md +++ b/ocgtk/architecture/README.md @@ -34,25 +34,30 @@ Generated code lives in `src//generated/`: ## gir_gen Architecture -### Pipeline (4 Layers) +### Pipeline ``` -GIR XML - │ - ├─► parse/gir_parser.ml ──► types.ml (AST) - │ │ - │ ▼ - │ type_mappings.ml - │ │ - ├──────────────────────────────┼──────────────────────────────┐ - ▼ ▼ ▼ -generate/ generate/ generate/ -c_stubs.ml layer1/*.ml class_gen*.ml -(Layer 0: C FFI) (Layer 1: Low-level ML) (Layer 2: High-level) - │ │ │ - ▼ ▼ ▼ -ml_*_gen.c widget.mli/ml gWidget.ml -C stubs External functions OCaml classes +GIR XML overrides/.sexp + │ │ + ▼ ▼ +parse/gir_parser.ml override_parser.ml + │ │ + └──────── AST ───────┘ + │ + override_apply.ml (filter ignored entities, set versions) + │ + ▼ + type_mappings.ml (build generation context) + │ + ┌─────────────┼──────────────────┐ + ▼ ▼ ▼ +generate/ generate/ generate/ +c_stubs.ml layer1/*.ml class_gen*.ml +(Layer 0: C) (Layer 1: ML) (Layer 2: ML) + │ │ │ + ▼ ▼ ▼ +ml_*_gen.c widget.mli/ml gWidget.ml +C stubs External decls OCaml classes ``` **Layer 3** (Signals): `generate/signal_gen.ml` produces `gWidget_signals` classes. @@ -62,11 +67,14 @@ C stubs External functions OCaml classes | Module | Purpose | |--------|---------| | `types.ml` | AST for GIR elements (classes, methods, enums, records) | -| `parse/gir_parser.ml` | XML parsing → AST | +| `parse/gir_parser.ml` | XML parsing → AST; reads `version` XML attrs on members/fields | | `type_mappings.ml` | C→OCaml type mapping (`gint`→`int`, etc.) + cross-namespace resolution | +| `override_types.ml` | Override type definitions (ignore, version actions) | +| `override_parser.ml` | S-expression parser for `overrides/.sexp` files | +| `override_apply.ml` | Apply overrides to AST before ctx build (filter + version) | | `dependency_analysis.ml` | Tarjan SCC for cyclic dependency handling | -| `filtering.ml` | Method/property filtering (out params, unknown types) | -| `exclude_list.ml` | Platform-specific skips, variadic functions | +| `filtering.ml` | Method/property filtering (out params, unknown types, varargs) | +| `exclude_list.ml` | Residual structural skips (`*Private` records, etc.) | ### Generation Modules @@ -106,12 +114,34 @@ Cyclic dependencies (e.g., `Application` ↔ `Window`) are combined into single - Generates `application_and__window_and__window_group.ml` - Type references: simple names within cycle (`Window.t`), qualified across cycles +### Override System + +Per-namespace override files (`ocgtk/overrides/.sexp`) configure what gets +generated without modifying the generator source. Applied in `override_apply.ml` +**before** the type-mapping context is built — ignored entities are absent from +`ctx`, so methods referencing them are naturally skipped by the existing +unknown-type filter in `filtering.ml`. + +Two actions are supported: +- `(ignore)` — remove the entity/component entirely from all generation stages +- `(version "X.Y")` — set a version field, which feeds into `#if` C version guards + +Version guards appear at two granularities: +- **Entity-level**: wraps the entire C converter/stub (`#if MACRO(X,Y,0)`) +- **Member-level**: wraps individual `case`/`else if` branches inside a converter + +See [`gir_gen/overrides.md`](gir_gen/overrides.md) for the design rationale and +[`README_GIR_GEN.md`](../src/tools/README_GIR_GEN.md#override-system) for the file format. + ### Cross-Namespace Types -Resolved via reference files (`_refs.txt`): +Resolved via reference files (`_build/references/-references.sexp`): - Classes/records: `Ocgtk_..Wrappers..t` - Enums/bitfields: `Ocgtk_..` +The `gir_gen references` command also accepts `-o .sexp` so ignored entities +are excluded from reference output. + ## Key Documentation - **[README_GIR_GEN.md](../src/tools/README_GIR_GEN.md)** - Complete generator usage and status diff --git a/ocgtk/architecture/gir_gen/overrides.md b/ocgtk/architecture/gir_gen/overrides.md new file mode 100644 index 000000000..0b2ac1acc --- /dev/null +++ b/ocgtk/architecture/gir_gen/overrides.md @@ -0,0 +1,153 @@ +# GIR Override System Architecture + +The override system lets per-namespace sexp files control what the generator emits +without touching generator source. It replaces the former hardcoded exclusion lists +in `exclude_list.ml`, `filtering.ml`, and `gir_parser.ml`. + +## Files + +``` +ocgtk/overrides/ # One file per namespace, committed to the repo + cairo.sexp + gio.sexp + gdk.sexp + graphene.sexp + gdkpixbuf.sexp + pango.sexp + pangocairo.sexp + gsk.sexp + gtk.sexp + +src/tools/gir_gen/ + override_types.ml/.mli # Override type definitions + override_parser.ml/.mli # S-expression parser + override_apply.ml/.mli # Apply overrides to parsed GIR data +``` + +## Pipeline Position + +Override application happens **after GIR parsing, before ctx build**: + +``` +gir_parser.ml → raw AST → override_apply.ml → filtered AST → type_mappings ctx → generators +``` + +This ordering is required. Ignored entities must be absent from `ctx` so that +`find_type_mapping_for_gir_type` returns `None` for their types, causing any methods +that reference them to be silently skipped by the existing unknown-type filter in +`filtering.ml`. If overrides were applied after ctx build, ignored types would still +appear in the context and their referencing methods would be generated. + +## Type Model (`override_types.ml`) + +```ocaml +type override_action = Ignore | Set_version of string + +type component_override = { component_name : string; action : override_action } + +type class_override = { + class_name : string; + class_action : override_action option; + constructors : component_override list; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +(* interface_override, record_override, enum_override, bitfield_override: similar *) + +type library_overrides = { + library_name : string; + classes : class_override list; + interfaces : interface_override list; + records : record_override list; + enums : enum_override list; + bitfields : bitfield_override list; + functions : component_override list; +} +``` + +`[@@deriving eq]` on all types enables structural equality for tests. +`[@@deriving sexp]` is also derived but is **not** used for the human-authored file +format — the derived sexp mirrors OCaml record structure verbatim and would be +unreadable. The hand-written parser in `override_parser.ml` is the authoritative +parser. The derived sexp is used only for round-trip tests. + +## Parser (`override_parser.ml`) + +Reads the human-friendly format: + +```sexp +(overrides + (library "Gtk") + (class Widget + (method foo (ignore)) + (property bar (version "4.14")) + ) + (enumeration StateFlags + (member new_flag (version "4.16")) + ) +) +``` + +Key parser decisions: +- **Hard error on malformed sexp**: halts generation immediately +- **Hard error on duplicate entities/components**: two `(class Widget ...)` in the + same file is always rejected +- **Warning on unknown names**: override references an entity or component not in the + GIR data — generation continues, warning is printed (catches typos) +- **`(function ...)` is context-disambiguated**: at the top level of `(overrides ...)` + it's a namespace-level function; nested inside `(record ...)` or `(enumeration ...)` + it's an entity-level function. No extra keyword needed. +- **Bitfield members use `member` keyword** (same as enum members), stored in + `bitfield_override.flags` + +## Apply (`override_apply.ml`) + +`apply_overrides` processes entities in a single pass: + +1. **Entity-level ignore** (`class_action = Some Ignore`): removes the entity from + all lists. Silently drops any component overrides on the same entity. +2. **Entity-level version** (`class_action = Some (Set_version v)`): sets the version + field on the surviving entity, then processes component overrides. +3. **Component-level ignore**: removes the method/property/etc. from the entity's list. +4. **Component-level version**: updates `member_version`/`flag_version`/`field_version` + on the surviving component. + +Implementation uses a single generic `apply_entity_overrides` helper to avoid the +5-way copy-paste that existed in the original draft. + +`apply_result` contains: +- Filtered entity lists +- `ignored_entities : string list` — names of removed entities (for logging) +- `warnings : string list` — unknown entity/component name warnings + +## Version Guards + +Member versions feed into C code generation in `enum_code.ml`: + +- **Enum converters**: each `case` in the C-to-OCaml switch and each `else if` branch + in the OCaml-to-C chain can be individually wrapped in `#if MACRO(X,Y,0)`. +- **Bitfield converters**: same for `if (flags & ...)` branches. +- **`_decls.h` headers**: converter declarations in `_decls.h` are also guarded + so dependent namespaces don't see symbols that don't exist at their compile target. + +The `emit_member_branch` helper in `enum_code.ml` handles the `#if`/`#else caml_failwith`/`#endif` +pattern. The `#else` branch calls `caml_failwith` so that OCaml code passing a version-guarded +variant to an older library fails at runtime with a clear message rather than silently hitting +the unknown-value default handler. + +Member version vs. class version: +- If `member_version <= class_version`, the member guard is redundant (the outer class + guard already covers it) and is omitted. +- If `member_version > class_version` (or class has no version), the member guard is + emitted as an inner `#if` inside the converter. + +## Updating Override Files + +Override files are generated once with `gir_gen overrides` (extracts `Since X.Y` +from GIR `` text), then hand-edited to add `(ignore)` entries. When GTK +upgrades, re-run `gir_gen overrides` and merge the diff. + +The recommended workflow is `bash scripts/generate-bindings.sh` from the repository +root, which wires `-o overrides/.sexp` into all 9 `generate` and `references` +invocations automatically. diff --git a/ocgtk/docs/plans/overrides.md b/ocgtk/docs/plans/overrides.md new file mode 100644 index 000000000..701ee74ef --- /dev/null +++ b/ocgtk/docs/plans/overrides.md @@ -0,0 +1,1171 @@ +# GIR Overrides System - Implementation Plan + +**Status: ✅ ALL PHASES COMPLETE (2026-04-05)** + +## Overview + +A s-expression-based override file system that allows manual configuration of GIR +generation behaviour per-library. This replaces scattered hardcoded exclusion lists +(`exclude_list.ml`, `filtering.ml`) with per-namespace configuration files in +`ocgtk/overrides/`. + +The system covers: +- **Ignoring** entire entities (classes, interfaces, records, enums, bitfields, functions) + or their sub-components (methods, constructors, properties, signals, fields, members) +- **Version overrides** on entities or sub-components (sets the `version` field used for + C `#if` version guards) +- **Future extension points** for other per-entity configuration + +## Reference: GIR Type Hierarchy + +From `types.ml`, the data model that the override file must address: + +``` +generation_context +├── classes : gir_class list +│ ├── constructors : gir_constructor list (ctor_name) +│ ├── methods : gir_method list (method_name) +│ ├── properties : gir_property list (prop_name) +│ └── signals : gir_signal list (signal_name) +├── interfaces : gir_interface list +│ ├── methods : gir_method list (method_name) +│ ├── properties : gir_property list (prop_name) +│ └── signals : gir_signal list (signal_name) +├── enums : gir_enum list +│ ├── members : gir_enum_member list (member_name) +│ └── functions : gir_function list (function_name) +├── bitfields : gir_bitfield list +│ └── flags : gir_bitfield_member list (flag_name) +├── records : gir_record list +│ ├── fields : gir_record_field list (field_name + field_version) +│ ├── constructors : gir_constructor list (ctor_name) +│ ├── methods : gir_method list (method_name) +│ └── functions : gir_function list (function_name) +``` + +Standalone functions also exist at namespace level (parsed but currently less prominent). + +## S-Expression Format + +```sexp +(overrides + (library "Gtk") + + ;; Ignore an entire class (all sub-components are skipped) + (class Justification (ignore)) + + ;; Class with sub-component overrides + (class Widget + (constructor new (ignore)) + (method create (ignore)) + (method notify_destroy (version "4.53")) + (property sensitive (version "4.10")) + (signal destroy (ignore)) + ) + + ;; Interface overrides + (interface Actionable + (method get_action_name (ignore)) + (property action_name (version "4.12")) + (signal activate (ignore)) + ) + + ;; Record overrides + (record TextIter + (field user_data (ignore)) + (field start (version "4.14")) + (constructor new (ignore)) + (method get_text (version "4.14")) + (function get_slice (ignore)) + ) + + ;; Enum overrides + (enumeration RGBA + (member RGB283 (ignore)) + (member NEW_COLOR (version "4.14")) + (function parse (ignore)) + ) + + ;; Bitfield overrides + (bitfield StateFlags + (member ACTIVE (ignore)) + (member NEW_STATE (version "4.14")) + ) + + ;; Standalone function ignore + (function some_utility_function (ignore)) +) +``` + +## Override File Storage + +Override files live in a top-level `ocgtk/overrides/` directory, one per library: + +``` +ocgtk/overrides/ + cairo.sexp + gio.sexp + gdk.sexp + graphene.sexp + gdkpixbuf.sexp + pango.sexp + pangocairo.sexp + gsk.sexp + gtk.sexp +``` + +Naming convention: lowercase namespace name + `.sexp`. The file is passed to +`gir_gen generate` via `-o overrides/.sexp` in `generate-bindings.sh`. + +### Design Decisions + +1. **`ignore` means "do not generate"** - removes the entity/component from all + generation stages (C stubs, Layer 1, Layer 2, signals, dune modules). + +2. **`version` applies at both entity and component level** - if the GIR already + has a version, the override replaces it; if not, it adds one. This feeds into + `Version_guard` for `#if` guard generation. + + - **Entity-level** `(version "X.Y")` sets the entity's top-level version field + (e.g. `gir_class.version`, `gir_enum.enum_version`). This is the right way to + annotate classes/records/enums that were added in a specific library version, + which becomes a class-level C `#if` guard (see `gtk-versioning.md` Phase 2). + Component overrides on the same entity are still applied. + + - **Component-level** `(method foo (version "X.Y"))` sets the version on that + specific member/method/field. This becomes an inner member-level guard nested + inside any class-level guard. + +3. **Entity names are GIR names** (e.g. `Widget`, `RGBA`, `StateFlags`) - the same + names as they appear in the GIR XML. No normalization needed for matching. + +4. **One `(overrides ...)` form per file** - the top-level form groups a `(library ...)` + declaration and the entity overrides. + +5. **Library name is metadata** - for documentation/validation but not currently used + for filtering (the generator processes one library at a time anyway). + +6. **Entity-level ignore takes precedence** - if `(class Widget (ignore) (method foo ...))` + is specified, the entire class is ignored and sub-component overrides are silently + skipped. No warning needed (the ignore is intentional and comprehensive). + +7. **Duplicate entity names always rejected** - two `(class Widget ...)` entries in the + same file is always a parse error that halts generation, regardless of content. To + express a class-level ignore alongside component overrides, use a single entry: + `(class Widget (ignore) (method foo ...))`. Duplicate component names within an + entity (e.g., two `(method foo ...)` in the same class) are also rejected. + +8. **Parse failure is a hard error** - a malformed override file halts generation + immediately. No partial overrides are applied. Unknown entity/component names + produce a warning but do not halt generation (catches typos). + +9. **Bitfield members use `member` keyword** - bitfield overrides use `(member NAME ...)` + not `(flag NAME ...)`. Both enum and bitfield member overrides use the same keyword. + The parser stores these in the `flags` field of `bitfield_override` (matching + `gir_bitfield.flags`). This is purely an internal naming distinction. + +10. **`(function ...)` is context-disambiguated** - the `function` keyword is used for + both standalone namespace-level functions (at the top level of `(overrides ...)`) and + for record/enum-level functions (nested inside a `(record ...)` or `(enumeration ...)` + form). The parser position provides unambiguous context; no separate keyword is needed. + +--- + +## Phase 1: Override Types and S-Expression Parsing ✅ COMPLETE (2026-04-04) + +**Goal**: Define the OCaml types for overrides and build a parser from s-expressions. + +**Implementation notes:** +- Test files live in `src/tools/test_gir_gen/` (not `ocgtk/test_gir_gen/`) to match existing test structure +- Parser handles both `(ignore)` (list form) and `ignore` (atom form) for component actions, since sexplib parses `(ignore)` as `List [Atom "ignore"]` +- `parse_overrides_from_string` writes to a temp file and uses `Sexp.load_sexp` — avoids dealing with sexplib's incremental `parse` API +- `Sexp.load_sexp` raises `Failure` for malformed sexps (not `Parse_error`), so both are caught +- Duplicate detection uses a Hashtbl keyed by `(kind, name)` — first error stops iteration +- Fixed existing `gir_parser.ml` to include `member_version = None`, `flag_version = None`, `field_version = None` in record constructions (Task 1.1b dependency) +- Fixed ppxlib 0.35.0 API changes in `ml_ast_helpers.ml` (`Ptyp_alias` and `Pexp_function` constructors changed) + +### Task 1.1: Define Override Types (new file: `override_types.ml`) ✅ + +Create `ocgtk/src/tools/gir_gen/override_types.mli` and `ocgtk/src/tools/gir_gen/override_types.ml`. + +Types to define (following code guidelines: exhaustive matching, named intermediates, +`.mli` for public API, labelled arguments): + +```ocaml +(* override_types.mli *) + +(** What to do for a specific entity or sub-component *) +type override_action = + | Ignore + | Set_version of string +[@@deriving sexp, eq] + +(** Override for a sub-component of an entity (method, property, etc.) *) +type component_override = { + component_name : string; + action : override_action; +} +[@@deriving sexp, eq] + +(** Override for a class *) +type class_override = { + class_name : string; + class_action : override_action option; (* None = no class-level override *) + constructors : component_override list; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +[@@deriving sexp, eq] + +(** Override for an interface *) +type interface_override = { + interface_name : string; + interface_action : override_action option; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +[@@deriving sexp, eq] + +(** Override for a record *) +type record_override = { + record_name : string; + record_action : override_action option; + fields : component_override list; + constructors : component_override list; + methods : component_override list; + functions : component_override list; + (** Record-level functions. Parsed from `(function ...)` inside a `(record ...)` block. + Distinct from top-level `library_overrides.functions` (namespace-level). *) +} +[@@deriving sexp, eq] + +(** Override for an enumeration *) +type enum_override = { + enum_name : string; + enum_action : override_action option; + members : component_override list; + functions : component_override list; +} +[@@deriving sexp, eq] + +(** Override for a bitfield. + NOTE: The sexp format uses `(member NAME ...)` for bitfield members, matching + the enum keyword. The parser maps this to the `flags` field. See Design Decision #9. *) +type bitfield_override = { + bitfield_name : string; + bitfield_action : override_action option; + flags : component_override list; + (** Populated from `(member ...)` in the sexp (same keyword as enum members). *) +} +[@@deriving sexp, eq] + +(** Top-level overrides container *) +type library_overrides = { + library_name : string; + classes : class_override list; + interfaces : interface_override list; + records : record_override list; + enums : enum_override list; + bitfields : bitfield_override list; + functions : component_override list; + (** Standalone namespace-level functions. Parsed from `(function ...)` at the + top level of the `(overrides ...)` form, not nested inside any entity. *) +} +[@@deriving sexp, eq] +``` + +**Code guidelines reference**: +- `module-boundaries.md`: `.mli` file with documented types +- `type-safety.md`: variant types (`override_action`) instead of strings +- `pattern-matching.md`: exhaustive matching required + +### Task 1.1b: Extend GIR Types with Member Version Fields ✅ + +GIR XML *sometimes* includes `version` attributes on `` and `` +elements (e.g. some GDK4 and GTK4 members use `version="4.x"`), and `` text +may also contain "Since X.Y" annotations. We need per-member/per-field versioning +to support version-guarded C code generation. + +Add version fields to `types.ml`: + +```ocaml +type gir_enum_member = { + member_name : string; + member_value : int; + c_identifier : string; + member_doc : string option; + member_version : string option; (* NEW - read from version XML attr by gir_parser *) +} + +type gir_bitfield_member = { + flag_name : string; + flag_value : int; + flag_c_identifier : string; + flag_doc : string option; + flag_version : string option; (* NEW - read from version XML attr by gir_parser *) +} + +type gir_record_field = { + field_name : string; + field_type : gir_type option; + readable : bool; + writable : bool; + field_doc : string option; + field_version : string option; (* NEW - read from version XML attr by gir_parser *) +} +``` + +**Implementation note**: `gir_parser.ml` reads these from the `version` XML attribute +on each element. The `gir_gen overrides` extractor (Phase 3) extracts "Since X.Y" from +`` text — it does NOT duplicate what the parser already reads from XML attributes. +The override system (`override_apply.ml`) can additionally set these fields from override +sexp files when neither source provides a version. + +### Task 1.2: Write Unit Tests for Override Types ✅ + +Created `ocgtk/src/tools/test_gir_gen/test_override_types.ml` — 12 tests covering +construction of each override type, equality via `[@@deriving eq]`, and library_overrides. + +### Task 1.3: Build S-Expression Parser (new file: `override_parser.ml`) ✅ + +Created `ocgtk/src/tools/gir_gen/override_parser.mli` and +`ocgtk/src/tools/gir_gen/override_parser.ml`. + +Use `sexplib` (already a dependency) to parse s-expressions. The module provides: + +```ocaml +(* override_parser.mli *) + +(** Parse errors with context *) +type parse_error = + | Invalid_format of { location : string; message : string } + | Unknown_entity_kind of string + | Duplicate_entity of { kind : string; name : string } + | Duplicate_component of { entity : string; component_kind : string; name : string } + | Invalid_version of { name : string; version : string; reason : string } + +val format_error : parse_error -> string +(** Format a parse error as a human-readable message. *) + +val parse_overrides : string -> (Override_types.library_overrides, parse_error) result +(** [parse_overrides filename] reads and parses the override file. + Returns [Error] with context on any parse failure. *) + +val parse_overrides_from_string : string -> (Override_types.library_overrides, parse_error) result +(** [parse_overrides_from_string content] parses overrides from a string. + Useful for testing. *) +``` + +Implementation approach: +1. Use `Sexplib.Sexp.parse_string` / `Sexplib.Sexp.load_sexp_conv_exn` to read the file +2. Write a recursive function that pattern-matches on the s-expression structure +3. Use `Result` types for error handling (per `error-handling.md`) +4. Use bind operators to flatten chains (per `nesting-and-control-flow.md`) +5. Validate: no duplicate entity names, no duplicate component names within an entity, + version strings are well-formed (reuse `Version_guard.parse_version` for validation) + +Duplicate handling rules: +- **Duplicate entity names rejected**: two `(class Widget ...)` entries in the same file + is always a hard error, regardless of their contents. To express class-level ignore with + component overrides, put both in a single `(class Widget (ignore) (method foo ...))` entry. +- **Duplicate component names within an entity rejected**: two `(method foo ...)` entries + in the same class override is a hard error + +`(function ...)` disambiguation: +- `(function name ...)` at the **top level** of the `(overrides ...)` form → standalone + namespace-level function, stored in `library_overrides.functions` +- `(function name ...)` **nested inside** a `(record ...)` or `(enumeration ...)` form → + entity-level function, stored in `record_override.functions` / `enum_override.functions` +- No new keywords are needed — parser position provides unambiguous context + +The parser must handle: +- `(class Name (ignore))` — class-level ignore with no component overrides +- `(class Name (ignore) (method m (ignore)))` — class-level ignore with component overrides + in the same entry; class ignore takes precedence, component overrides silently skipped +- `(class Name (method m (ignore)) (method n (version "4.12")))` — component overrides only +- Nested forms for constructors, methods, properties, signals, fields, members, functions +- `(function ...)` at top level vs. inside record/enum (context-based disambiguation) + +**Code guidelines reference**: +- `error-handling.md`: Result types, contextual errors +- `partial-functions.md`: no `List.hd`, use pattern matching +- `pattern-matching.md`: exhaustive, no catch-all + +### Task 1.4: Write Parser Unit Tests ✅ + +Created `ocgtk/src/tools/test_gir_gen/test_override_parser.ml` — 22 tests covering: +- All entity types (class, interface, record, enumeration, bitfield, function) +- Version overrides and validation +- Error cases (malformed sexp, unknown entity, invalid version, duplicate entity) +- Class ignore + component overrides in same entry + +### Task 1.5: Update Dune Build File ✅ + +Updated `ocgtk/src/tools/test_gir_gen/dune` (added `test_override_types` and +`test_override_parser` to modules list) and `test_gir_gen.ml` (registered +new test suites). No changes to gir_gen library dune — `include_subdirs qualified` +auto-discovers new `.ml` files. + +--- + +## Phase 2: Override Application ✅ COMPLETE (2026-04-04, refactored 2026-04-05) + +**Goal**: Apply parsed overrides to the GIR data structures after parsing, before generation. + +**Implementation notes:** +- `override_apply.ml`: refactored (2026-04-05) to use a single `apply_entity_overrides` + generic helper replacing 5 near-identical per-entity functions (~100 lines removed) +- `override_parser.ml`: `parse_overrides_from_string` cleaned up to use `Sexp.of_string` + directly instead of a temp-file round-trip +- Original: single-pass `filter_map` per entity type (class, interface, record, + enum, bitfield, function) — each `process_entity` call does one `List.find_opt` for the + override, then dispatches on the action with exhaustive pattern matching +- Entity-level `Set_version` sets the entity version field then applies component overrides + (not a no-op as in the original draft) +- Generic `apply_components_by_name` helper used for all component filter+version passes +- Generic `check_unknown_entity_names` helper replaces 5 near-identical functions +- `~functions:[]` in `gir_gen.ml` is intentional — `parse_gir_file` does not extract + top-level namespace functions + +### Task 2.1: Define Override Application Module (new file: `override_apply.ml`) + +Create `ocgtk/src/tools/gir_gen/override_apply.mli` and `ocgtk/src/tools/gir_gen/override_apply.ml`. + +```ocaml +(* override_apply.mli *) + +(** Result of applying overrides *) +type apply_result = { + classes : Types.gir_class list; + interfaces : Types.gir_interface list; + enums : Types.gir_enum list; + bitfields : Types.gir_bitfield list; + records : Types.gir_record list; + functions : Types.gir_function list; (* standalone namespace-level functions *) + ignored_entities : string list; (* names of ignored entities for logging *) + warnings : string list; (* warnings for unknown entity/component names *) +} + +val apply_overrides : + overrides:Override_types.library_overrides -> + classes:Types.gir_class list -> + interfaces:Types.gir_interface list -> + enums:Types.gir_enum list -> + bitfields:Types.gir_bitfield list -> + records:Types.gir_record list -> + functions:Types.gir_function list -> + apply_result +(** Apply overrides to parsed GIR data. Filters out ignored entities and + applies version overrides to remaining ones. + + ORDERING: This must be called before building the type-mapping context (ctx). + Ignored entities must be absent from ctx so that find_type_mapping_for_gir_type + returns None for their types, causing methods that reference them to be skipped + by the existing unknown-type checks in filtering.ml. *) +``` + +Implementation strategy: + +1. **Entity-level ignore**: Filter the entity lists. For each class override with + `(ignore)`, remove that class from the list. Similarly for interfaces, records, + enums, bitfields. + +2. **Component-level ignore**: For surviving entities, filter their sub-lists. + For a class with `(method create (ignore))`, remove `create` from its `methods` list. + +3. **Entity-level version override**: For surviving entities, set the entity's + version field: `{ cls with version = Some v }` for classes/interfaces/records, + `{ enm with enum_version = Some v }` for enums, `{ bf with bitfield_version = Some v }` + for bitfields. Component overrides are still applied after the entity-level version + is set. This becomes a class-level C `#if` guard (see `gtk-versioning.md` Phase 2). + +4. **Component-level version override**: For surviving entities/components, update + the component's version field. For enum members and bitfield flags, this updates + `member_version` and `flag_version` — the **only** source for these since GIR + does not provide member-level versions. Same for record fields (`field_version`). + +5. **Unknown name warnings**: When an override references an entity or component name + that doesn't exist in the parsed GIR data, add a warning to `apply_result.warnings`. + This catches typos without blocking generation. + +Key implementation details: +- Use `List.filter_map` over entities with a single-pass `process_entity` function + that both checks ignore and applies overrides (avoids multiple `List.find_opt` passes) +- Use `apply_components_by_name` generic helper for component-level filter+version +- Use record update syntax (per `code-reuse.md`) +- Use `check_unknown_entity_names` generic helper (replaces 5 near-identical functions) +- `~functions:[]` is correct in the `gir_gen.ml` calls — `parse_gir_file` does not + extract top-level namespace functions, so there is nothing to filter + +**Code guidelines reference**: +- `code-reuse.md`: record update syntax, extract common patterns +- `naming-and-intermediates.md`: named predicates +- `module-boundaries.md`: `.mli` with labelled arguments + +### Task 2.2: Write Override Application Unit Tests ✅ + +Created `ocgtk/src/tools/test_gir_gen/test_override_apply.ml` — 24 tests covering: + +- Test class ignore removes it from the list +- Test method ignore removes it from the class's methods +- Test version override sets the version field +- Test version override replaces existing version +- Test interface, record, enum, bitfield overrides +- Test that ignored entities appear in `ignored_entities` list +- Test combined: class ignore + component ignore on surviving class +- Test empty overrides = no changes +- Test unknown entity name produces a warning in `apply_result.warnings` +- Test unknown component name produces a warning in `apply_result.warnings` +- Test class ignore takes precedence over component overrides (no warning for + component overrides under ignored entity) + +### Task 2.3: Integrate into Generation Pipeline ✅ + +Modified `ocgtk/src/tools/gir_gen/gir_gen.ml`: + +1. **Add CLI argument**: + ```ocaml + let overrides_arg = + let doc = "Override file (s-expression) for GIR generation configuration" in + Arg.(value & opt (some file) None & info [ "o"; "overrides" ] ~docv:"FILE" ~doc) + ``` + +2. **Update `generate_bindings` signature** to accept `overrides_file`: + ```ocaml + let generate_bindings filter_file gir_file output_dir reference_files overrides_file = + ``` + +3. **After parsing** (after the `Gir_parser.parse_gir_file` call, before building the + type-mapping context), load and apply overrides. **Overrides must be applied before + `ctx` is built** — ignored entities must be absent from the type-mapping so that + `find_type_mapping_for_gir_type` returns `None` for their types, causing methods that + reference them to be skipped by the existing unknown-type checks. A parse error is a + **hard error** that halts generation. Unknown entity/component names produce a **warning**: + ```ocaml + let classes, interfaces, enums, bitfields, records, functions = + match overrides_file with + | None -> classes, interfaces, enums, bitfields, records, functions + | Some file -> + printf "Loading overrides from %s\n" file; + match Override_parser.parse_overrides file with + | Error e -> + eprintf "Error: override parse failed: %s\n" (Override_parser.format_error e); + exit 1 + | Ok ov -> + let result = Override_apply.apply_overrides ~overrides:ov + ~classes ~interfaces ~enums ~bitfields ~records ~functions in + List.iter result.warnings ~f:(fun w -> eprintf "Warning: %s\n" w); + result.classes, result.interfaces, result.enums, + result.bitfields, result.records, result.functions + (* Build type-mapping ctx AFTER this point *) + ``` + +4. **Update `generate_cmd`** term to include the new argument: + ```ocaml + Term.(ret (const generate_bindings $ filter_arg $ gir_file_arg $ + output_dir_arg $ reference_files_arg $ overrides_arg)) + ``` + +5. **Update man page** with override examples. + +**Code guidelines reference**: +- `abstractions.md`: layered module dependencies (parser → apply → pipeline) +- `module-boundaries.md`: labelled args for same-type params + +### Task 2.4: Integrate Overrides into References Generation ✅ + +The `gir_gen references` subcommand generates cross-namespace +reference files. Ignored entities must be excluded from references — otherwise another +namespace could reference a type that doesn't exist in the generated bindings. + +Currently `generate_references` filters classes via `Filtering.should_generate_class` +and records via `Filtering.should_generate_record`, but includes all interfaces, enums, +and bitfields unconditionally. Overrides are not consulted. + +Changes to `generate_references`: + +1. **Add overrides argument** — accept an optional override file path +2. **Parse and apply overrides** — call `Override_parser.parse_overrides` and + `Override_apply.apply_overrides` on the parsed GIR data before building the + reference entity list +3. **Filter ignored entities** — use the filtered result from `apply_overrides` + instead of the raw parsed lists + +```ocaml +let generate_references gir_file output_file overrides_file = + let repository, namespace, classes, interfaces, enums, bitfields, records = + Gir_gen_lib.Parse.Gir_parser.parse_gir_file gir_file [] + in + (* Apply overrides to filter ignored entities from references. + References generation uses raw GIR data — no type-mapping context needed here. *) + let classes, interfaces, enums, bitfields, records = + match overrides_file with + | None -> classes, interfaces, enums, bitfields, records + | Some file -> + match Override_parser.parse_overrides file with + | Error e -> + eprintf "Error: %s\n" (Override_parser.format_error e); + exit 1 + | Ok ov -> + let result = Override_apply.apply_overrides ~overrides:ov + ~classes ~interfaces ~enums ~bitfields ~records ~functions in + result.classes, result.interfaces, result.enums, + result.bitfields, result.records + in + (* Build entities from filtered lists... *) +``` + +4. **Update `references_cmd`** term to include overrides argument: + ```ocaml + let overrides_arg_refs = + let doc = "Override file for filtering references" in + Arg.(value & opt (some file) None & info [ "o"; "overrides" ] ~docv:"FILE" ~doc) + ``` + +5. **Update `generate-bindings.sh`** — pass `-o` to `gir_gen references` calls too + +--- + +## Phase 3: Extract Versions from GIR and Generate Initial Override Files ✅ COMPLETE (2026-04-05) + +**Goal**: Build a tool to extract "Since" version info from GIR doc comments, then +generate complete initial override files combining those versions with the ignore +entries migrated from hardcoded lists. + +**Note**: This phase must be completed before Phase 4. Phase 4 removes hardcoded +exclusion lists and the `is_platform_specific_type` parser guards — the override files +created here must be in place first, and the gir_parser.ml guard removal and the override +file creation should land in the same commit to avoid a window where entities are parsed +but not yet filtered. + +### Inventory of Hardcoded Static Lists (for reference) + +These are the lists whose data feeds into the initial override files (code removal +happens in Phase 4). Note: `PageSetupUnixDialog` and `PrintUnixDialog` appear in +both `platform_specific_type_exclude_list` and `should_skip_class` — generate only +one `(class X (ignore))` entry each in the override file: + +| Source | Entries | Override form | +|--------|---------|---------------| +| `exclude_list.ml` `variadic_function_exclude_list` | 3 functions | `(function (ignore))` | +| `exclude_list.ml` `platform_specific_type_exclude_list` | 9 types | `(class (ignore))` | +| `exclude_list.ml` `function_exclude_list` | 1 function | `(function (ignore))` | +| `exclude_list.ml` `should_skip_class` | 8 classes | `(class (ignore))` | +| `filtering.ml` `property_exclude_list` | 1 pair | `(class (property (ignore)))` | +| `filtering.ml` `banned_records` | 3 records | `(record (ignore))` | +| `gir_parser.ml` `is_platform_specific_type` | enum/bitfield parse skip | `(enumeration (ignore))` | + +### Task 3.1: Build Override Extraction Tool (`gir_gen overrides` subcommand) + +Add a new `overrides` subcommand to `gir_gen` (following the pattern of the existing +`references` subcommand). This tool reads a GIR XML file and produces an override +sexp file containing version overrides extracted from `` "Since" comments. + +**What it extracts**: For every `` in `` and ``, +and every `` in ``, it looks for a `` child element whose text +matches `Since[: ]` (with flexible spacing, punctuation, and position in +the doc string). When found, it emits: + +**Note**: The extractor reads only `` text, not the `version` XML attribute. +Version XML attributes on `` and `` elements are already parsed +natively by `gir_parser.ml` into `member_version`/`flag_version`/`field_version` +and used directly in code generation — they do not need to appear in override files. + +```sexp +(enumeration ApplicationFlags + (member default_flags (version "2.74")) + (member non_unique (version "2.30")) +) +``` + +**Version extraction regex**: Match `Since[:\s]+(\d+\.\d+(?:\.\d+)?)` in doc text. +This handles: +- `Since 2.26` +- `Since: 2.74` +- `(Since: 1.16).` +- `Since 1.50` at end of multiline doc + +**Parser changes required** to extract doc text: +- `parse_enumeration` member block: stop calling `skip_element input 1` after member + attributes. Instead, parse child elements and extract `` text when present. + Set `member_doc = Some doc_text` when found. (Search for `parse_enumeration` in + `gir_parser.ml` — avoid hardcoded line numbers.) +- `parse_bitfield` member block: same change. +- Record field parsing: same change — extract `` text for fields instead of skipping. + +**CLI**: +``` +gir_gen overrides GIR_FILE OUTPUT_FILE +``` + +**Output**: A partial override file — only `(library ...)` and member/field version +entries. No `(ignore)` entries (those are added manually in Task 3.2). + +### Task 3.2: Generate Complete Initial Override Files for All Libraries + +For each namespace, create the final override file by combining: + +1. **Version entries** from the extractor (Task 3.1 output) +2. **Ignore entries** migrated from the hardcoded lists (see `gtk.sexp` example below) +3. **Manually identified** entries (any additional known exclusions) + +Example for `ocgtk/overrides/gtk.sexp`: + +```sexp +(overrides + (library "Gtk") + + ;; Migrated from should_skip_class skip_list + (class PrintJob (ignore)) + (class PrintUnixDialog (ignore)) + (class PageSetupUnixDialog (ignore)) + (class Printer (ignore)) + (class PixbufNonAnim (ignore)) + (class BroadwayRenderer (ignore)) + (class NglRenderer (ignore)) + (class SettingsBackend (ignore)) + + ;; Migrated from platform_specific_type_exclude_list + ;; (PageSetupUnixDialog and PrintUnixDialog already above — no duplicate entries) + (class PrintCapabilities (ignore)) + (class PageSetup (ignore)) + (class PrintSettings (ignore)) + (class PrintContext (ignore)) + (class PrintOperation (ignore)) + (class PrintOperationPreview (ignore)) + (class License (ignore)) + + ;; Previously skipped at parse time via is_platform_specific_type + ;; These enums/bitfields are now parsed but ignored by overrides + (enumeration License (ignore)) + + ;; Migrated from property_exclude_list + (class IconPaintable + (property is-symbolic (ignore)) + ) + + ;; Migrated from banned_records + (record PrintBackend (ignore)) + (record PixbufModule (ignore)) + (record PixbufModulePattern (ignore)) + + ;; Migrated from variadic_function_exclude_list + (function gtk_text_buffer_insert_with_tags (ignore)) + (function gtk_text_buffer_insert_with_tags_by_name (ignore)) + (function gtk_text_buffer_create_tag (ignore)) + + ;; Migrated from function_exclude_list + (function gtk_tree_model_filter_get_virtual_root (ignore)) + + ;; Version entries extracted from GIR "Since" comments + ;; (populated by gir_gen overrides output) + (enumeration SomeEnum + (member some_member (version "4.14")) + ) + (record SomeRecord + (field some_field (version "4.10")) + ) + ;; ... etc +) +``` + +Create placeholder files for other namespaces (even if initially empty beyond +`(library ...)`): + +```sexp +(overrides (library "Cairo")) +``` + +**Verification**: Run `gir_gen generate` with each override file and compare output +to the pre-override baseline. The only differences should be: +- Previously-excluded entities now absent (migrated to override ignores) +- Version guards now present on members that had "Since" comments + +--- + +## Phase 4: Filtering Integration and Hardcoded List Removal ✅ COMPLETE (2026-04-05) + +**Goal**: Verify that override-based ignores produce identical filtering behaviour +to the existing hardcoded lists, then remove the redundant hardcoded entries. + +### Task 4.1: Remove Hardcoded Entries Covered by Overrides + +With overrides now integrated into the pipeline (Phase 2) and the initial override +files created in Phase 3 (which immediately precedes this phase), the hardcoded +exclusion lists that have corresponding override entries become redundant dead code. +Remove them: + +1. **`exclude_list.ml`**: + - Remove `variadic_function_exclude_list` and `is_variadic_function` — the + 3 GTK functions are now `(function ... (ignore))` in the override file. + Code-level `varargs` detection (`List.exists p.varargs`) stays active. + - Remove `platform_specific_type_exclude_list`, `is_platform_specific_type`, + `type_name_exclude_list`, `is_excluded_type_name` — all entries migrated to + `(class ... (ignore))` overrides + - Remove `function_exclude_list`, `is_excluded_function` — migrated + - Remove `should_skip_class` skip_list — migrated + +2. **`filtering.ml`**: + - Remove `property_exclude_list` and its check in `should_generate_property` — + migrated to `(class IconPaintable (property is-symbolic (ignore)))` + - Remove `banned_records` from `should_skip_private_record` — migrated to + `(record ... (ignore))`. Keep the `*Private` suffix check (structural). + +3. **`gir_parser.ml`**: + - Remove `is_platform_specific_type` call in `parse_enumeration` (line 65) — + previously-skipped enums are now parsed and ignored by overrides + - Remove `is_platform_specific_type` call in `parse_bitfield` (line 144) — same + +4. **Update all callers** of removed functions: + - `filtering.ml:has_simple_type` — remove `is_excluded_type_name` check at line 13 + (the `find_type_mapping_for_gir_type` call that follows is the authoritative guard; + ignored types are already absent from `ctx` because overrides are applied first) + - `filtering.ml:should_skip_method_binding` — remove `is_excluded_function`, + `is_variadic_function`, and `is_excluded_type_name` checks on return/param types + (lines ~222, ~224, ~247, ~258; the `varargs` param check and unknown-type check stay) + - `filtering.ml:should_generate_class` — remove `should_skip_class` check + - `filtering.ml:should_generate_interface` — remove `should_skip_class` check + - `filtering.ml:should_generate_property` — remove `property_exclude_list` check + - `library_module.ml` — remove `should_skip_class` check (search for it, line numbers shift) + - `layer1_property.ml` — remove `is_excluded_type_name` check (search for it) + +**Not removed** (stays in code — these are dynamic/structural, not name-based): +- `should_skip_method` / `should_skip_constructor` — unknown type checks +- `should_skip_private_record` `*Private` suffix pattern +- `is_gtype_struct_for` check +- `should_generate_function` — `introspectable` attribute check +- Code-level `varargs` detection + +### Task 4.2: Write Integration Tests + +Create `ocgtk/test_gir_gen/test_override_integration.ml`: + +- Parse a minimal GIR XML string, apply overrides, verify filtered result +- Test that ignored class does not appear in `generation_context.classes` +- Test that ignored method does not appear in surviving class's methods +- Test version override propagates correctly to the generation context +- **Regression test**: run full generation with override file, compare against + baseline from before hardcoded list removal — output must be identical +- Test that references generation also excludes ignored entities + +--- + +## Phase 5: Round-Trip and End-to-End Tests ✅ COMPLETE (2026-04-05) + +### Task 5.1: Round-Trip S-Expression Tests + +In `test_override_parser.ml`, add: + +- First add `sexp` to the `[@@deriving eq]` annotations in `override_types.ml` and `.mli` + (they currently only derive `eq` — `sexp` was deferred because the human-readable override + file format is hand-parsed, but sexp serialisation is still useful for round-trip tests) +- Generate override content from `library_overrides` using `sexplib` (`sexp_of_library_overrides`) +- Parse it back with `parse_overrides_from_string` +- Verify structural equality using `equal_library_overrides` +- Test with complex multi-entity override files + +**Note**: The `[@@deriving sexp]` output format (verbose, record-structured) is NOT the +human-authored override file format — it is only used here for serialisation in tests. +The hand-written parser remains the authoritative parser for `.sexp` override files. + +### Task 5.2: End-to-End Smoke Test + +Create `ocgtk/test_gir_gen/test_override_e2e.ml`: + +- Use a small synthetic GIR file (inline XML) +- Create an override file that ignores one class and one method +- Run the generation pipeline with overrides +- Verify the output does not contain the ignored class/method +- Verify the output contains the non-ignored entities + +--- + +## Phase 6: Enum/Bitfield Member Version Guards in C Generation ✅ COMPLETE (2026-04-05) + +**Goal**: Generate `#if` version guards around individual enum/bitfield member +cases in C converter functions, so that members added in newer library versions +produce compile-time-protected code. + +### Background + +Currently, version guards on enums/bitfields wrap the **entire** C converter function +(`enum_code.ml`, `c_stub_enum.ml`). Per-member versioning is absent because GIR +does not provide `version` on `` elements. + +With the override system, member versions become available (set via `(member FOO +(version "4.14"))` in the override file). The C converters must now emit `#if` +guards around individual `case` (enum) or `if (flags & ...)` (bitfield) branches. + +**Approach A** (chosen): When the compiled GTK is older than the member's version, +the `#else` branch calls `caml_failwith` with a descriptive error. The OCaml type +always contains all variants (no conditional compilation in OCaml). This matches +the existing `emit_with_member_guard` pattern used for methods and constructors. + +### Task 6.1: Write Version Guard Helper for Enum/Bitfield Members + +Create a helper function in `enum_code.ml` (or `c_stub_helpers.ml` for reuse) +that wraps a single converter branch with a version guard: + +```ocaml +val emit_member_guard : + namespace:string -> + class_version:string option -> + member_version:string option -> + fallback_msg:string -> + stub:string -> + Buffer.t -> + unit +``` + +This is a simplified version of `c_stub_helpers.emit_with_member_guard`: +- On `Member_guard v`: emit `#if MACRO(...)` / `stub` / `#else` / `caml_failwith(msg)` / `#endif` +- On `No_guard` or `Class_guard`: emit `stub` unchanged +- Reuse `Version_guard.resolve_guard` and `Version_guard.emit_c_guard` + +### Task 6.2: Update `generate_c_enum_converters` (`enum_code.ml`) + +Modify the C-to-OCaml converter (`switch`/`case`): +```c + case GTK_JUSTIFY_LEFT: return caml_hash_variant("LEFT"); +#if GTK_CHECK_VERSION(4,14,0) + case GTK_JUSTIFY_NEW_VALUE: return caml_hash_variant("NEW_VALUE"); +#endif +``` + +Modify the OCaml-to-C converter (`if`/`else if` chain): +```c + if (val == caml_hash_variant("LEFT")) return GTK_JUSTIFY_LEFT; +#if GTK_CHECK_VERSION(4,14,0) + else if (val == caml_hash_variant("NEW_VALUE")) return GTK_JUSTIFY_NEW_VALUE; +#else + else if (val == caml_hash_variant("NEW_VALUE")) + caml_failwith("GtkJustification.NEW_VALUE requires GTK 4.14"); +#endif +``` + +For the `switch` version (C-to-OCaml): the `default:` case already handles unknown +values by calling `caml_failwith`, so the `#else` branch just omits the `case`. + +For the `if` chain (OCaml-to-C): the `#else` branch must have a handler so that +if OCaml code passes the variant to an older GTK, we fail at runtime rather than +silently reaching the final `else` handler. + +The function needs: +- `~namespace:string` (already passed) +- `~class_version:string option` (add parameter — available from `enum.enum_version`) +- Per-member: `member.member_version` + +### Task 6.3: Update `generate_c_bitfield_converters` (`enum_code.ml`) + +Same pattern for bitfield converters. + +C-to-OCaml (`if (flags & ...)`): +```c + if (flags & GTK_STATE_FLAG_NORMAL) { ... } +#if GTK_CHECK_VERSION(4,14,0) + if (flags & GTK_STATE_FLAG_NEW_FLAG) { ... } +#endif +``` + +OCaml-to-C (`if`/`else if` matching tag): +```c + if (tag == caml_hash_variant("NORMAL")) result |= GTK_STATE_FLAG_NORMAL; +#if GTK_CHECK_VERSION(4,14,0) + else if (tag == caml_hash_variant("NEW_FLAG")) result |= GTK_STATE_FLAG_NEW_FLAG; +#else + else if (tag == caml_hash_variant("NEW_FLAG")) + caml_failwith("GtkStateFlags.NEW_FLAG requires GTK 4.14"); +#endif +``` + +### Task 6.4: Update `generate_enum_files` in `gir_gen.ml` + +Pass `~class_version` to the updated converter generation functions. (Search for +`generate_c_enum_converters` in `gir_gen.ml` — line numbers shift with refactoring.) The call is currently: + +```ocaml +Enum_code.generate_c_enum_converters ~namespace:namespace.name enum +``` + +Change to: + +```ocaml +Enum_code.generate_c_enum_converters ~namespace:namespace.name + ~class_version:enum.enum_version enum +``` + +Same for `generate_c_bitfield_converters` with `bitfield.bitfield_version`. + +### Task 6.5: OCaml Type Definitions — No Change (Documented Limitation) + +The `.mli` file always emits all enum/bitfield variants unconditionally. +OCaml has no preprocessor, so conditional compilation is impossible. + +**Known limitation**: If OCaml code constructs a variant whose member requires a +newer GTK version, and the program runs against an older GTK, the C converter +will call `caml_failwith` at runtime. This is documented and acceptable — it +matches how versioned methods work (the OCaml function always exists, the C stub +may fail at runtime on older libraries). + +### Task 6.6: Write Unit Tests + +Create `ocgtk/test_gir_gen/test_enum_member_version.ml`: + +- Test that enum member with `member_version = None` produces no guards (baseline) +- Test that enum member with `member_version = Some "4.14"` produces `#if` guards + when `enum_version = None` +- Test that enum member with `member_version` <= `enum_version` produces no + inner guard (covered by outer class guard) +- Test that enum member with `member_version` > `enum_version` produces an + inner `#if` guard +- Test bitfield equivalents +- Test that `#else` branch contains `caml_failwith` with member name and version +- Test the C-to-OCaml direction (switch case guarded) +- Test the OCaml-to-C direction (if-else chain guarded with fallback) + +--- + +## Phase 7: Build Script and Documentation Updates ✅ COMPLETE (2026-04-05) + +### Task 7.1: Update `generate-bindings.sh` ✅ + +`OVERRIDES_DIR="$WORKSPACE_ROOT/overrides"` added. All 9 `references` and `generate` +invocations pass `-o "$OVERRIDES_DIR/.sexp"`. + +### Task 7.2: Update README_GIR_GEN.md ✅ + +- Commands section updated: `overrides` added as third command +- Generate and references options updated: `-o/--overrides FILE` documented +- Overrides command section added with CLI example +- New "Override System" section added: format reference with full sexp example, + file location convention, workflow for updating override files + +### Task 7.3: Update Root README.md ✅ + +Link to `ocgtk/overrides/` directory added to Key Documents section. + +### Task 7.4: Update scripts/README.md ✅ + +Rewritten to cover all 9 namespaces, both generation phases, and the `-o` flag. +Override files section added. + +### Task 7.5: Update CLAUDE.md ✅ + +Single-library regeneration example updated to include `-o overrides/.sexp`. +Override files note added. + +--- + +## File Summary + +| File | Purpose | Phase | +|------|---------|-------| +| `ocgtk/src/tools/gir_gen/override_types.mli` | Override type definitions (public) | 1 | +| `ocgtk/src/tools/gir_gen/override_types.ml` | Override type implementations | 1 | +| `ocgtk/src/tools/gir_gen/override_parser.mli` | Parser public interface | 1 | +| `ocgtk/src/tools/gir_gen/override_parser.ml` | S-expression parser | 1 | +| `ocgtk/src/tools/gir_gen/override_apply.mli` | Application public interface | 2 | +| `ocgtk/src/tools/gir_gen/override_apply.ml` | Apply overrides to GIR data | 2 | +| `ocgtk/src/tools/gir_gen/gir_gen.ml` | Add CLI arg, integrate pipeline | 2 | +| `ocgtk/test_gir_gen/test_override_types.ml` | Type tests | 1 | +| `ocgtk/test_gir_gen/test_override_parser.ml` | Parser tests | 1 | +| `ocgtk/test_gir_gen/test_override_apply.ml` | Application tests | 2 | +| `ocgtk/src/tools/gir_gen/parse/gir_parser.ml` | Extract doc text for members/flags/fields | 3 | +| `ocgtk/src/tools/gir_gen/gir_gen.ml` | Add `overrides` subcommand | 3 | +| `ocgtk/overrides/gtk.sexp` | GTK override file (versions + ignores) | 3 | +| `ocgtk/overrides/cairo.sexp` | Cairo override file (placeholder) | 3 | +| `ocgtk/overrides/gio.sexp` | GIO override file (placeholder) | 3 | +| `ocgtk/overrides/gdk.sexp` | GDK override file (placeholder) | 3 | +| `ocgtk/overrides/graphene.sexp` | Graphene override file (placeholder) | 3 | +| `ocgtk/overrides/gdkpixbuf.sexp` | GdkPixbuf override file (placeholder) | 3 | +| `ocgtk/overrides/pango.sexp` | Pango override file (placeholder) | 3 | +| `ocgtk/overrides/pangocairo.sexp` | PangoCairo override file (placeholder) | 3 | +| `ocgtk/overrides/gsk.sexp` | GSK override file (placeholder) | 3 | +| `ocgtk/src/tools/gir_gen/exclude_list.ml` | Remove migrated hardcoded lists | 4 | +| `ocgtk/src/tools/gir_gen/generate/filtering.ml` | Remove migrated hardcoded lists | 4 | +| `ocgtk/src/tools/gir_gen/parse/gir_parser.ml` | Remove is_platform_specific_type calls | 4 | +| `ocgtk/test_gir_gen/test_override_integration.ml` | Integration tests + regression | 4 | +| `ocgtk/test_gir_gen/test_override_e2e.ml` | End-to-end tests | 5 | +| `ocgtk/src/tools/gir_gen/generate/enum_code.ml` | Add member version guards to C converters | 6 | +| `ocgtk/src/tools/gir_gen/gir_gen.ml` | Pass class_version to enum/bitfield converters | 6 | +| `ocgtk/test_gir_gen/test_enum_member_version.ml` | Enum/bitfield member version tests | 6 | +| `scripts/generate-bindings.sh` | Add -o override flags to generate + references | 7 | +| `ocgtk/src/tools/README_GIR_GEN.md` | Document override system | 7 | +| `README.md` | Mention override system | 7 | +| `scripts/README.md` | Document override file pickup | 7 | + +## Dependencies Between Phases + +``` +Phase 1 (Types + Parser) + └──> Phase 2 (Apply + Pipeline Integration) + ├──> Phase 3 (Extract Versions + Create Override Files) + │ └──> Phase 4 (Remove Hardcoded Lists + Verify) + │ └──> Phase 5 (E2E Tests) + └──> Phase 6 (Enum/Bitfield Member Version Guards) + └──> Phase 7 (Build Script + Docs) +``` + +Tasks within each phase can be worked on in parallel except: +- Task 1.3 depends on 1.1 and 1.1b (parser needs types) +- Task 1.4 depends on 1.3 (parser tests need parser) +- Task 2.2 depends on 2.1 (apply tests need apply module) +- Task 2.3 and 2.4 depend on 2.1 (pipeline integration needs apply module) +- Phase 3 depends on Phase 2 (extraction tool uses parser, override files applied via pipeline) +- Phase 4 depends on Phase 3 (override files must exist before removing hardcoded lists; + gir_parser.ml guard removal and override file creation should land in the same commit) +- Phase 5 depends on Phase 4 (E2E tests verify the complete integrated system) +- Phase 6 depends on Phase 2 (needs member_version fields and override application) +- Phase 7 depends on Phase 3 and 4 (script needs override files to exist, code is clean) + +## Design Considerations + +### Why s-expressions and not TOML/YAML/JSON? + +1. **Already in the toolchain**: `sexplib` + `ppx_sexp_conv` are existing dependencies +2. **Recursive structure**: Overrides are naturally hierarchical (entity → components) +3. **Simplicity**: No schema definition needed; sexplib handles parsing +4. **Consistency**: Reference files already use s-expressions + +### Why filter at the list level rather than changing filtering functions? + +1. **Minimal invasiveness**: No changes to ~15 existing `should_generate_*`/`should_skip_*` + functions across `filtering.ml`, `exclude_list.ml` +2. **Clean layering**: Overrides operate at the data level, filtering operates at the + generation decision level +3. **Composability**: Both systems compose naturally — ignore by override, then filter + by type-mapping/technical constraints + +### Why not merge overrides into `exclude_list.ml`? + +1. **Separation of concerns**: User configuration vs. hardcoded technical exclusions +2. **Different lifecycle**: Overrides are user-editable; exclude lists are developer-maintained +3. **Override semantics**: Overrides also set versions, not just ignore + +### Future Extensions + +The override format can be extended with: +- `(rename new_name)` — rename an entity in generated code +- `(ocaml_type "custom_type")` — override the OCaml type mapping +- `(generate_layer2 false)` — skip Layer 2 generation for specific entities +- `(c_prefix "custom_")` — override C symbol prefix +- Multiple `(overrides ...)` blocks for multi-library configurations + +These are not in scope for this plan but the type structure supports them via +new `override_action` variants. + +## Code Style Requirements + +All code must adhere to: +- **[Code Guidelines Index](../code_guidelines/index.md)** and all linked sub-documents +- **Max 2 levels of nesting** — use `let*`/`let+` bind operators +- **Result over exceptions** — parse errors as `Result` +- **Named intermediates** — no 3+ stage anonymous pipelines +- **Exhaustive matching** — no catch-all `_` +- **Total functions** — no `List.hd`, `Option.get`, `int_of_string` +- **Type-specific equality** — `String.equal`, not `Stdlib.(=)` +- **`.mli` files** for all public modules +- **Labelled arguments** for 2+ same-type params +- **Record update syntax** for partial record construction diff --git a/ocgtk/overrides/cairo.sexp b/ocgtk/overrides/cairo.sexp new file mode 100644 index 000000000..a5381bfb7 --- /dev/null +++ b/ocgtk/overrides/cairo.sexp @@ -0,0 +1,3 @@ +(overrides + (library "cairo") +) diff --git a/ocgtk/overrides/gdk.sexp b/ocgtk/overrides/gdk.sexp new file mode 100644 index 000000000..f9591139c --- /dev/null +++ b/ocgtk/overrides/gdk.sexp @@ -0,0 +1,3 @@ +(overrides + (library "Gdk") +) diff --git a/ocgtk/overrides/gdkpixbuf.sexp b/ocgtk/overrides/gdkpixbuf.sexp new file mode 100644 index 000000000..0a6f5d133 --- /dev/null +++ b/ocgtk/overrides/gdkpixbuf.sexp @@ -0,0 +1,17 @@ +(overrides + (library "GdkPixbuf") + + ;; Internal types not in public GdkPixbuf headers — their C types are + ;; not declared in gdk-pixbuf.h, causing gdkpixbuf_decls.h to fail + (class PixbufNonAnim (ignore)) + (record PixbufModule (ignore)) + (record PixbufModulePattern (ignore)) + + (enumeration InterpType + (member hyper (version "2.38")) + ) + + (bitfield PixbufFormatFlags + (member threadsafe (version "2.28")) + ) +) diff --git a/ocgtk/overrides/gio.sexp b/ocgtk/overrides/gio.sexp new file mode 100644 index 000000000..b7bbfb9e9 --- /dev/null +++ b/ocgtk/overrides/gio.sexp @@ -0,0 +1,224 @@ +(overrides + (library "Gio") + + ;; GSettingsBackend requires #define G_SETTINGS_ENABLE_BACKEND before + ;; including gsettingsbackend.h — not suitable for general use + (class SettingsBackend (ignore)) + + (enumeration DBusError + (member unknown_object (version "2.42")) + (member unknown_interface (version "2.42")) + (member unknown_property (version "2.42")) + (member property_read_only (version "2.42")) + ) + + (enumeration FileAttributeType + (member stringv (version "2.22")) + ) + + (enumeration FileMonitorEvent + (member renamed (version "2.46")) + (member moved_in (version "2.46")) + (member moved_out (version "2.46")) + ) + + (enumeration IOErrorEnum + (member too_many_open_files (version "2.20")) + (member not_initialized (version "2.22")) + (member address_in_use (version "2.22")) + (member partial_input (version "2.24")) + (member invalid_data (version "2.24")) + (member dbus_error (version "2.26")) + (member host_unreachable (version "2.26")) + (member network_unreachable (version "2.26")) + (member connection_refused (version "2.26")) + (member proxy_failed (version "2.26")) + (member proxy_auth_failed (version "2.26")) + (member proxy_need_auth (version "2.26")) + (member proxy_not_allowed (version "2.26")) + (member broken_pipe (version "2.36")) + (member connection_closed (version "2.44")) + (member not_connected (version "2.44")) + (member message_too_large (version "2.48")) + (member no_such_device (version "2.74")) + (member destination_unset (version "2.80")) + ) + + (enumeration TlsChannelBindingType + (member exporter (version "2.74")) + ) + + (enumeration TlsError + (member inappropriate_fallback (version "2.60")) + (member bad_certificate_password (version "2.72")) + ) + + (bitfield AppInfoCreateFlags + (member supports_startup_notification (version "2.26")) + ) + + (bitfield ApplicationFlags + (member default_flags (version "2.74")) + (member non_unique (version "2.30")) + (member can_override_app_id (version "2.48")) + (member allow_replacement (version "2.60")) + (member replace (version "2.60")) + ) + + (bitfield AskPasswordFlags + (member tcrypt (version "2.58")) + ) + + (bitfield BusNameOwnerFlags + (member do_not_queue (version "2.54")) + ) + + (bitfield DBusCallFlags + (member allow_interactive_authorization (version "2.46")) + ) + + (bitfield DBusConnectionFlags + (member authentication_require_same_user (version "2.68")) + (member cross_namespace (version "2.74")) + ) + + (bitfield DBusMessageFlags + (member allow_interactive_authorization (version "2.46")) + ) + + (bitfield DBusProxyFlags + (member get_invalidated_properties (version "2.32")) + (member no_match_rule (version "2.72")) + ) + + (bitfield DBusServerFlags + (member authentication_require_same_user (version "2.68")) + ) + + (bitfield FileCopyFlags + (member target_default_modified_time (version "2.80")) + ) + + (bitfield FileCreateFlags + (member replace_destination (version "2.20")) + ) + + (bitfield FileMonitorFlags + (member watch_hard_links (version "2.36")) + (member watch_moves (version "2.46")) + ) + + (bitfield SubprocessFlags + (member search_path_from_envp (version "2.72")) + ) + + (bitfield TlsCertificateFlags + (member no_flags (version "2.74")) + ) + + (bitfield TlsPasswordFlags + (member pkcs11_user (version "2.70")) + (member pkcs11_security_officer (version "2.70")) + (member pkcs11_context_specific (version "2.70")) + ) + + (record AppInfoIface + (field can_delete (version "2.20")) + (field do_delete (version "2.20")) + (field get_commandline (version "2.20")) + (field get_display_name (version "2.24")) + (field launch_uris_async (version "2.60")) + (field launch_uris_finish (version "2.60")) + ) + + (record ApplicationClass + (field run_mainloop (version "2.32")) + (field dbus_register (version "2.34")) + (field dbus_unregister (version "2.34")) + (field handle_local_options (version "2.40")) + (field name_lost (version "2.60")) + ) + + (record DriveIface + (field get_start_stop_type (version "2.22")) + (field can_start (version "2.22")) + (field can_start_degraded (version "2.22")) + (field start (version "2.22")) + (field start_finish (version "2.22")) + (field can_stop (version "2.22")) + (field stop (version "2.22")) + (field stop_finish (version "2.22")) + (field stop_button (version "2.22")) + (field eject_with_operation (version "2.22")) + (field eject_with_operation_finish (version "2.22")) + (field get_sort_key (version "2.32")) + (field get_symbolic_icon (version "2.34")) + (field is_removable (version "2.50")) + ) + + (record DtlsConnectionInterface + (field set_advertised_protocols (version "2.60")) + (field get_negotiated_protocol (version "2.60")) + (field get_binding_data (version "2.66")) + ) + + (record FileIface + (field move_async (version "2.72")) + (field move_finish (version "2.72")) + (field open_readwrite (version "2.22")) + (field open_readwrite_async (version "2.22")) + (field open_readwrite_finish (version "2.22")) + (field create_readwrite (version "2.22")) + (field create_readwrite_async (version "2.22")) + (field create_readwrite_finish (version "2.22")) + (field replace_readwrite (version "2.22")) + (field replace_readwrite_async (version "2.22")) + (field replace_readwrite_finish (version "2.22")) + (field start_mountable (version "2.22")) + (field start_mountable_finish (version "2.22")) + (field stop_mountable (version "2.22")) + (field stop_mountable_finish (version "2.22")) + (field supports_thread_contexts (version "2.22")) + (field unmount_mountable_with_operation (version "2.22")) + (field unmount_mountable_with_operation_finish (version "2.22")) + (field eject_mountable_with_operation (version "2.22")) + (field eject_mountable_with_operation_finish (version "2.22")) + (field poll_mountable (version "2.22")) + (field poll_mountable_finish (version "2.22")) + (field measure_disk_usage (version "2.38")) + (field measure_disk_usage_async (version "2.38")) + (field measure_disk_usage_finish (version "2.38")) + ) + + (record IconIface + (field to_tokens (version "2.20")) + (field from_tokens (version "2.20")) + (field serialize (version "2.38")) + ) + + (record MountIface + (field unmount_with_operation (version "2.22")) + (field unmount_with_operation_finish (version "2.22")) + (field eject_with_operation (version "2.22")) + (field eject_with_operation_finish (version "2.22")) + (field get_default_location (version "2.24")) + (field get_sort_key (version "2.32")) + (field get_symbolic_icon (version "2.34")) + ) + + (record SocketConnectableIface + (field to_string (version "2.48")) + ) + + (record TlsConnectionClass + (field get_binding_data (version "2.66")) + (field get_negotiated_protocol (version "2.70")) + ) + + (record VolumeIface + (field eject_with_operation (version "2.22")) + (field eject_with_operation_finish (version "2.22")) + (field get_sort_key (version "2.32")) + (field get_symbolic_icon (version "2.34")) + ) +) diff --git a/ocgtk/overrides/graphene.sexp b/ocgtk/overrides/graphene.sexp new file mode 100644 index 000000000..6f6caddbf --- /dev/null +++ b/ocgtk/overrides/graphene.sexp @@ -0,0 +1,30 @@ +(overrides + (library "Graphene") + + (enumeration EulerOrder + (member sxyz (version "1.10")) + (member sxyx (version "1.10")) + (member sxzy (version "1.10")) + (member sxzx (version "1.10")) + (member syzx (version "1.10")) + (member syzy (version "1.10")) + (member syxz (version "1.10")) + (member syxy (version "1.10")) + (member szxy (version "1.10")) + (member szxz (version "1.10")) + (member szyx (version "1.10")) + (member szyz (version "1.10")) + (member rzyx (version "1.10")) + (member rxyx (version "1.10")) + (member ryzx (version "1.10")) + (member rxzx (version "1.10")) + (member rxzy (version "1.10")) + (member ryzy (version "1.10")) + (member rzxy (version "1.10")) + (member ryxy (version "1.10")) + (member ryxz (version "1.10")) + (member rzxz (version "1.10")) + (member rxyz (version "1.10")) + (member rzyz (version "1.10")) + ) +) diff --git a/ocgtk/overrides/gsk.sexp b/ocgtk/overrides/gsk.sexp new file mode 100644 index 000000000..5d33ee7d6 --- /dev/null +++ b/ocgtk/overrides/gsk.sexp @@ -0,0 +1,8 @@ +(overrides + (library "Gsk") + + ;; Platform-specific renderers — GskBroadwayRenderer/GskNglRenderer are not + ;; in public GSK headers on standard installs + (class BroadwayRenderer (ignore)) + (class NglRenderer (ignore)) +) diff --git a/ocgtk/overrides/gtk.sexp b/ocgtk/overrides/gtk.sexp new file mode 100644 index 000000000..3474ad76d --- /dev/null +++ b/ocgtk/overrides/gtk.sexp @@ -0,0 +1,34 @@ +(overrides + (library "Gtk") + + ;; Migrated from exclude_list.ml should_skip_class skip_list + (class PrintJob (ignore)) + (class PrintUnixDialog (ignore)) + (class PageSetupUnixDialog (ignore)) + (class Printer (ignore)) + ;; PrintCapabilities (bitfield) and License (enum) were never generated on main + ;; (they were skipped at parse time by is_platform_specific_type guard) + (bitfield PrintCapabilities (ignore)) + (enumeration License (ignore)) + + ;; PrintBackend is an internal GTK type not in public headers + (record PrintBackend (ignore)) + + ;; Migrated from filtering.ml property_exclude_list + (class IconPaintable + (property is-symbolic (ignore)) + ) + + ;; Migrated from exclude_list.ml variadic_function_exclude_list + ;; These are class methods (matched by GIR method name, not c_identifier) + (class TextBuffer + (method insert_with_tags (ignore)) + (method insert_with_tags_by_name (ignore)) + (method create_tag (ignore)) + ) + + ;; Migrated from exclude_list.ml function_exclude_list + ;; gtk_tree_model_filter_get_virtual_root not present in GTK 4.0 GIR — + ;; this entry will produce a warning but is kept for documentation + ;; (function gtk_tree_model_filter_get_virtual_root (ignore)) +) diff --git a/ocgtk/overrides/pango.sexp b/ocgtk/overrides/pango.sexp new file mode 100644 index 000000000..add38e84f --- /dev/null +++ b/ocgtk/overrides/pango.sexp @@ -0,0 +1,136 @@ +(overrides + (library "Pango") + + (enumeration AttrType + (member font_features (version "1.38")) + (member foreground_alpha (version "1.38")) + (member background_alpha (version "1.38")) + (member allow_breaks (version "1.44")) + (member show (version "1.44")) + (member insert_hyphens (version "1.44")) + (member overline (version "1.46")) + (member overline_color (version "1.46")) + (member line_height (version "1.50")) + (member absolute_line_height (version "1.50")) + (member word (version "1.50")) + (member sentence (version "1.50")) + (member baseline_shift (version "1.50")) + (member font_scale (version "1.50")) + ) + + (enumeration BidiType + (member lri (version "1.48.6")) + (member rli (version "1.48.6")) + (member fsi (version "1.48.6")) + (member pdi (version "1.48.6")) + ) + + (enumeration Script + (member new_tai_lue (version "1.10")) + (member buginese (version "1.10")) + (member glagolitic (version "1.10")) + (member tifinagh (version "1.10")) + (member syloti_nagri (version "1.10")) + (member old_persian (version "1.10")) + (member kharoshthi (version "1.10")) + (member unknown (version "1.14")) + (member balinese (version "1.14")) + (member cuneiform (version "1.14")) + (member phoenician (version "1.14")) + (member phags_pa (version "1.14")) + (member nko (version "1.14")) + (member kayah_li (version "1.20.1")) + (member lepcha (version "1.20.1")) + (member rejang (version "1.20.1")) + (member sundanese (version "1.20.1")) + (member saurashtra (version "1.20.1")) + (member cham (version "1.20.1")) + (member ol_chiki (version "1.20.1")) + (member vai (version "1.20.1")) + (member carian (version "1.20.1")) + (member lycian (version "1.20.1")) + (member lydian (version "1.20.1")) + (member batak (version "1.32")) + (member brahmi (version "1.32")) + (member mandaic (version "1.32")) + (member chakma (version "1.32")) + (member meroitic_cursive (version "1.32")) + (member meroitic_hieroglyphs (version "1.32")) + (member miao (version "1.32")) + (member sharada (version "1.32")) + (member sora_sompeng (version "1.32")) + (member takri (version "1.32")) + (member bassa_vah (version "1.40")) + (member caucasian_albanian (version "1.40")) + (member duployan (version "1.40")) + (member elbasan (version "1.40")) + (member grantha (version "1.40")) + (member khojki (version "1.40")) + (member khudawadi (version "1.40")) + (member linear_a (version "1.40")) + (member mahajani (version "1.40")) + (member manichaean (version "1.40")) + (member mende_kikakui (version "1.40")) + (member modi (version "1.40")) + (member mro (version "1.40")) + (member nabataean (version "1.40")) + (member old_north_arabian (version "1.40")) + (member old_permic (version "1.40")) + (member pahawh_hmong (version "1.40")) + (member palmyrene (version "1.40")) + (member pau_cin_hau (version "1.40")) + (member psalter_pahlavi (version "1.40")) + (member siddham (version "1.40")) + (member tirhuta (version "1.40")) + (member warang_citi (version "1.40")) + (member ahom (version "1.40")) + (member anatolian_hieroglyphs (version "1.40")) + (member hatran (version "1.40")) + (member multani (version "1.40")) + (member old_hungarian (version "1.40")) + (member signwriting (version "1.40")) + ) + + (enumeration TabAlign + (member right (version "1.50")) + (member center (version "1.50")) + (member decimal (version "1.50")) + ) + + (enumeration Variant + (member all_small_caps (version "1.50")) + (member petite_caps (version "1.50")) + (member all_petite_caps (version "1.50")) + (member unicase (version "1.50")) + (member title_caps (version "1.50")) + ) + + (enumeration Weight + (member thin (version "1.24")) + (member semilight (version "1.36.7")) + (member book (version "1.24")) + (member medium (version "1.24")) + (member ultraheavy (version "1.24")) + ) + + (bitfield FontMask + (member gravity (version "1.16")) + (member variations (version "1.42")) + ) + + (record Analysis + (field flags (version "1.16")) + (field script (version "1.18")) + ) + + (record GlyphVisAttr + (field is_color (version "1.50")) + ) + + (record LogAttr + (field is_expandable_space (version "1.18")) + (field is_word_boundary (version "1.22")) + (field break_inserts_hyphen (version "1.50")) + (field break_removes_preceding (version "1.50")) + ) +) diff --git a/ocgtk/overrides/pangocairo.sexp b/ocgtk/overrides/pangocairo.sexp new file mode 100644 index 000000000..68bbd003e --- /dev/null +++ b/ocgtk/overrides/pangocairo.sexp @@ -0,0 +1,3 @@ +(overrides + (library "PangoCairo") +) diff --git a/ocgtk/src/gdk/generated/gdk_enums.mli b/ocgtk/src/gdk/generated/gdk_enums.mli index 09fad0a78..bd57c5974 100644 --- a/ocgtk/src/gdk/generated/gdk_enums.mli +++ b/ocgtk/src/gdk/generated/gdk_enums.mli @@ -3,238 +3,440 @@ (* AxisUse - enumeration *) type axisuse = [ + (** the axis is ignored. *) | `IGNORE + (** the axis is used as the x axis. *) | `X + (** the axis is used as the y axis. *) | `Y + (** the axis is used as the scroll x delta *) | `DELTA_X + (** the axis is used as the scroll y delta *) | `DELTA_Y + (** the axis is used for pressure information. *) | `PRESSURE + (** the axis is used for x tilt information. *) | `XTILT + (** the axis is used for y tilt information. *) | `YTILT + (** the axis is used for wheel information. *) | `WHEEL + (** the axis is used for pen/tablet distance information *) | `DISTANCE + (** the axis is used for pen rotation information *) | `ROTATION + (** the axis is used for pen slider information *) | `SLIDER + (** a constant equal to the numerically highest axis value. *) | `LAST ] (* CrossingMode - enumeration *) type crossingmode = [ + (** crossing because of pointer motion. *) | `NORMAL + (** crossing because a grab is activated. *) | `GRAB + (** crossing because a grab is deactivated. *) | `UNGRAB + (** crossing because a GTK grab is activated. *) | `GTK_GRAB + (** crossing because a GTK grab is deactivated. *) | `GTK_UNGRAB + (** crossing because a GTK widget changed + state (e.g. sensitivity). *) | `STATE_CHANGED + (** crossing because a touch sequence has begun, + this event is synthetic as the pointer might have not left the surface. *) | `TOUCH_BEGIN + (** crossing because a touch sequence has ended, + this event is synthetic as the pointer might have not left the surface. *) | `TOUCH_END + (** crossing because of a device switch (i.e. + a mouse taking control of the pointer after a touch device), this event + is synthetic as the pointer didn’t leave the surface. *) | `DEVICE_SWITCH ] (* DevicePadFeature - enumeration *) type devicepadfeature = [ + (** a button *) | `BUTTON + (** a ring-shaped interactive area *) | `RING + (** a straight interactive area *) | `STRIP ] (* DeviceToolType - enumeration *) type devicetooltype = [ + (** Tool is of an unknown type. *) | `UNKNOWN + (** Tool is a standard tablet stylus. *) | `PEN + (** Tool is standard tablet eraser. *) | `ERASER + (** Tool is a brush stylus. *) | `BRUSH + (** Tool is a pencil stylus. *) | `PENCIL + (** Tool is an airbrush stylus. *) | `AIRBRUSH + (** Tool is a mouse. *) | `MOUSE + (** Tool is a lens cursor. *) | `LENS ] (* DmabufError - enumeration *) type dmabuferror = [ + (** Dmabuf support is not available, because the OS + is not Linux, or it was explicitly disabled at compile- or runtime *) | `NOT_AVAILABLE + (** The requested format is not supported *) | `UNSUPPORTED_FORMAT + (** GTK failed to create the resource for other + reasons *) | `CREATION_FAILED ] (* DragCancelReason - enumeration *) type dragcancelreason = [ + (** There is no suitable drop target. *) | `NO_TARGET + (** Drag cancelled by the user *) | `USER_CANCELLED + (** Unspecified error. *) | `ERROR ] (* EventType - enumeration *) type eventtype = [ + (** the window manager has requested that the toplevel surface be + hidden or destroyed, usually when the user clicks on a special icon in the + title bar. *) | `DELETE + (** the pointer (usually a mouse) has moved. *) | `MOTION_NOTIFY + (** a mouse button has been pressed. *) | `BUTTON_PRESS + (** a mouse button has been released. *) | `BUTTON_RELEASE + (** a key has been pressed. *) | `KEY_PRESS + (** a key has been released. *) | `KEY_RELEASE + (** the pointer has entered the surface. *) | `ENTER_NOTIFY + (** the pointer has left the surface. *) | `LEAVE_NOTIFY + (** the keyboard focus has entered or left the surface. *) | `FOCUS_CHANGE + (** an input device has moved into contact with a sensing + surface (e.g. a touchscreen or graphics tablet). *) | `PROXIMITY_IN + (** an input device has moved out of contact with a sensing + surface. *) | `PROXIMITY_OUT + (** the mouse has entered the surface while a drag is in progress. *) | `DRAG_ENTER + (** the mouse has left the surface while a drag is in progress. *) | `DRAG_LEAVE + (** the mouse has moved in the surface while a drag is in + progress. *) | `DRAG_MOTION + (** a drop operation onto the surface has started. *) | `DROP_START + (** the scroll wheel was turned *) | `SCROLL + (** a pointer or keyboard grab was broken. *) | `GRAB_BROKEN + (** A new touch event sequence has just started. *) | `TOUCH_BEGIN + (** A touch event sequence has been updated. *) | `TOUCH_UPDATE + (** A touch event sequence has finished. *) | `TOUCH_END + (** A touch event sequence has been canceled. *) | `TOUCH_CANCEL + (** A touchpad swipe gesture event, the current state + is determined by its phase field. *) | `TOUCHPAD_SWIPE + (** A touchpad pinch gesture event, the current state + is determined by its phase field. *) | `TOUCHPAD_PINCH + (** A tablet pad button press event. *) | `PAD_BUTTON_PRESS + (** A tablet pad button release event. *) | `PAD_BUTTON_RELEASE + (** A tablet pad axis event from a "ring". *) | `PAD_RING + (** A tablet pad axis event from a "strip". *) | `PAD_STRIP + (** A tablet pad group mode change. *) | `PAD_GROUP_MODE + (** A touchpad hold gesture event, the current state is determined by its phase +field. *) | `TOUCHPAD_HOLD + (** marks the end of the GdkEventType enumeration. *) | `EVENT_LAST ] (* FullscreenMode - enumeration *) type fullscreenmode = [ + (** Fullscreen on current monitor only. *) | `CURRENT_MONITOR + (** Span across all monitors when fullscreen. *) | `ALL_MONITORS ] (* GLError - enumeration *) type glerror = [ + (** OpenGL support is not available *) | `NOT_AVAILABLE + (** The requested visual format is not supported *) | `UNSUPPORTED_FORMAT + (** The requested profile is not supported *) | `UNSUPPORTED_PROFILE + (** The shader compilation failed *) | `COMPILATION_FAILED + (** The shader linking failed *) | `LINK_FAILED ] (* Gravity - enumeration *) type gravity = [ + (** the reference point is at the top left corner. *) | `NORTH_WEST + (** the reference point is in the middle of the top edge. *) | `NORTH + (** the reference point is at the top right corner. *) | `NORTH_EAST + (** the reference point is at the middle of the left edge. *) | `WEST + (** the reference point is at the center of the surface. *) | `CENTER + (** the reference point is at the middle of the right edge. *) | `EAST + (** the reference point is at the lower left corner. *) | `SOUTH_WEST + (** the reference point is at the middle of the lower edge. *) | `SOUTH + (** the reference point is at the lower right corner. *) | `SOUTH_EAST + (** the reference point is at the top left corner of the + surface itself, ignoring window manager decorations. *) | `STATIC ] (* InputSource - enumeration *) type inputsource = [ + (** the device is a mouse. (This will be reported for the core + pointer, even if it is something else, such as a trackball.) *) | `MOUSE + (** the device is a stylus of a graphics tablet or similar device. *) | `PEN + (** the device is a keyboard. *) | `KEYBOARD + (** the device is a direct-input touch device, such + as a touchscreen or tablet *) | `TOUCHSCREEN + (** the device is an indirect touch device, such + as a touchpad *) | `TOUCHPAD + (** the device is a trackpoint *) | `TRACKPOINT + (** the device is a "pad", a collection of buttons, + rings and strips found in drawing tablets *) | `TABLET_PAD ] (* KeyMatch - enumeration *) type keymatch = [ + (** The key event does not match *) | `NONE + (** The key event matches if keyboard state + (specifically, the currently active group) is ignored *) | `PARTIAL + (** The key event matches *) | `EXACT ] (* MemoryFormat - enumeration *) type memoryformat = [ + (** 4 bytes; for blue, green, red, alpha. + The color values are premultiplied with the alpha value. *) | `B8G8R8A8_PREMULTIPLIED + (** 4 bytes; for alpha, red, green, blue. + The color values are premultiplied with the alpha value. *) | `A8R8G8B8_PREMULTIPLIED + (** 4 bytes; for red, green, blue, alpha + The color values are premultiplied with the alpha value. *) | `R8G8B8A8_PREMULTIPLIED + (** 4 bytes; for blue, green, red, alpha. *) | `B8G8R8A8 + (** 4 bytes; for alpha, red, green, blue. *) | `A8R8G8B8 + (** 4 bytes; for red, green, blue, alpha. *) | `R8G8B8A8 + (** 4 bytes; for alpha, blue, green, red. *) | `A8B8G8R8 + (** 3 bytes; for red, green, blue. The data is opaque. *) | `R8G8B8 + (** 3 bytes; for blue, green, red. The data is opaque. *) | `B8G8R8 + (** 3 guint16 values; for red, green, blue. *) | `R16G16B16 + (** 4 guint16 values; for red, green, blue, alpha. The color values are +premultiplied with the alpha value. *) | `R16G16B16A16_PREMULTIPLIED + (** 4 guint16 values; for red, green, blue, alpha. *) | `R16G16B16A16 + (** 3 half-float values; for red, green, blue. The data is opaque. *) | `R16G16B16_FLOAT + (** 4 half-float values; for red, green, blue and alpha. The color values are +premultiplied with the alpha value. *) | `R16G16B16A16_FLOAT_PREMULTIPLIED + (** 4 half-float values; for red, green, blue and alpha. *) | `R16G16B16A16_FLOAT + (** 3 float values; for red, green, blue. *) | `R32G32B32_FLOAT + (** 4 float values; for red, green, blue and alpha. The color values are +premultiplied with the alpha value. *) | `R32G32B32A32_FLOAT_PREMULTIPLIED + (** 4 float values; for red, green, blue and alpha. *) | `R32G32B32A32_FLOAT + (** 2 bytes; for grayscale, alpha. The color values are premultiplied with the +alpha value. *) | `G8A8_PREMULTIPLIED + (** 2 bytes; for grayscale, alpha. *) | `G8A8 + (** One byte; for grayscale. The data is opaque. *) | `G8 + (** 2 guint16 values; for grayscale, alpha. The color values are premultiplied +with the alpha value. *) | `G16A16_PREMULTIPLIED + (** 2 guint16 values; for grayscale, alpha. *) | `G16A16 + (** One guint16 value; for grayscale. The data is opaque. *) | `G16 + (** One byte; for alpha. *) | `A8 + (** One guint16 value; for alpha. *) | `A16 + (** One half-float value; for alpha. *) | `A16_FLOAT + (** One float value; for alpha. *) | `A32_FLOAT + (** 4 bytes; for alpha, blue, green, red, The color values are premultiplied with +the alpha value. *) | `A8B8G8R8_PREMULTIPLIED + (** 4 bytes; for blue, green, red, unused. *) | `B8G8R8X8 + (** 4 bytes; for unused, red, green, blue. *) | `X8R8G8B8 + (** 4 bytes; for red, green, blue, unused. *) | `R8G8B8X8 + (** 4 bytes; for unused, blue, green, red. *) | `X8B8G8R8 + (** The number of formats. This value will change as + more formats get added, so do not rely on its concrete integer. *) | `N_FORMATS ] (* NotifyType - enumeration *) type notifytype = [ + (** the surface is entered from an ancestor or + left towards an ancestor. *) | `ANCESTOR + (** the pointer moves between an ancestor and an + inferior of the surface. *) | `VIRTUAL + (** the surface is entered from an inferior or + left towards an inferior. *) | `INFERIOR + (** the surface is entered from or left towards + a surface which is neither an ancestor nor an inferior. *) | `NONLINEAR + (** the pointer moves between two surfaces + which are not ancestors of each other and the surface is part of + the ancestor chain between one of these surfaces and their least + common ancestor. *) | `NONLINEAR_VIRTUAL + (** an unknown type of enter/leave event occurred. *) | `UNKNOWN ] (* ScrollDirection - enumeration *) type scrolldirection = [ + (** the surface is scrolled up. *) | `UP + (** the surface is scrolled down. *) | `DOWN + (** the surface is scrolled to the left. *) | `LEFT + (** the surface is scrolled to the right. *) | `RIGHT + (** the scrolling is determined by the delta values + in scroll events. See gdk_scroll_event_get_deltas() *) | `SMOOTH ] (* ScrollUnit - enumeration *) type scrollunit = [ + (** The delta is in number of wheel clicks. *) | `WHEEL + (** The delta is in surface pixels to scroll directly + on screen. *) | `SURFACE ] (* SubpixelLayout - enumeration *) type subpixellayout = [ + (** The layout is not known *) | `UNKNOWN + (** Not organized in this way *) | `NONE + (** The layout is horizontal, the order is RGB *) | `HORIZONTAL_RGB + (** The layout is horizontal, the order is BGR *) | `HORIZONTAL_BGR + (** The layout is vertical, the order is RGB *) | `VERTICAL_RGB + (** The layout is vertical, the order is BGR *) | `VERTICAL_BGR ] (* SurfaceEdge - enumeration *) type surfaceedge = [ + (** the top left corner. *) | `NORTH_WEST + (** the top edge. *) | `NORTH + (** the top right corner. *) | `NORTH_EAST + (** the left edge. *) | `WEST + (** the right edge. *) | `EAST + (** the lower left corner. *) | `SOUTH_WEST + (** the lower edge. *) | `SOUTH + (** the lower right corner. *) | `SOUTH_EAST ] (* TextureError - enumeration *) type textureerror = [ + (** Not enough memory to handle this image *) | `TOO_LARGE + (** The image data appears corrupted *) | `CORRUPT_IMAGE + (** The image contains features + that cannot be loaded *) | `UNSUPPORTED_CONTENT + (** The image format is not supported *) | `UNSUPPORTED_FORMAT ] @@ -247,28 +449,46 @@ type titlebargesture = [ (* TouchpadGesturePhase - enumeration *) type touchpadgesturephase = [ + (** The gesture has begun. *) | `BEGIN + (** The gesture has been updated. *) | `UPDATE + (** The gesture was finished, changes + should be permanently applied. *) | `END + (** The gesture was cancelled, all + changes should be undone. *) | `CANCEL ] (* VulkanError - enumeration *) type vulkanerror = [ + (** Vulkan is not supported on this backend or has not been + compiled in. *) | `UNSUPPORTED + (** Vulkan support is not available on this Surface *) | `NOT_AVAILABLE ] (* AnchorHints - bitfield/flags *) type anchorhints_flag = [ + (** allow flipping anchors horizontally *) | `FLIP_X + (** allow flipping anchors vertically *) | `FLIP_Y + (** allow sliding surface horizontally *) | `SLIDE_X + (** allow sliding surface vertically *) | `SLIDE_Y + (** allow resizing surface horizontally *) | `RESIZE_X + (** allow resizing surface vertically *) | `RESIZE_Y + (** allow flipping anchors on both axes *) | `FLIP + (** allow sliding surface on both axes *) | `SLIDE + (** allow resizing surface on both axes *) | `RESIZE ] @@ -276,16 +496,27 @@ type anchorhints = anchorhints_flag list (* AxisFlags - bitfield/flags *) type axisflags_flag = [ + (** X axis is present *) | `X + (** Y axis is present *) | `Y + (** Scroll X delta axis is present *) | `DELTA_X + (** Scroll Y delta axis is present *) | `DELTA_Y + (** Pressure axis is present *) | `PRESSURE + (** X tilt axis is present *) | `XTILT + (** Y tilt axis is present *) | `YTILT + (** Wheel axis is present *) | `WHEEL + (** Distance axis is present *) | `DISTANCE + (** Z-axis rotation is present *) | `ROTATION + (** Slider axis is present *) | `SLIDER ] @@ -293,9 +524,16 @@ type axisflags = axisflags_flag list (* DragAction - bitfield/flags *) type dragaction_flag = [ + (** Copy the data. *) | `COPY + (** Move the data, i.e. first copy it, then delete + it from the source using the DELETE target of the X selection protocol. *) | `MOVE + (** Add a link to the data. Note that this is only + useful if source and destination agree on what it means, and is not + supported on all platforms. *) | `LINK + (** Ask the user what to do with the data. *) | `ASK ] @@ -303,13 +541,21 @@ type dragaction = dragaction_flag list (* FrameClockPhase - bitfield/flags *) type frameclockphase_flag = [ + (** no phase *) | `NONE + (** corresponds to GdkFrameClock::flush-events. Should not be handled by applications. *) | `FLUSH_EVENTS + (** corresponds to GdkFrameClock::before-paint. Should not be handled by applications. *) | `BEFORE_PAINT + (** corresponds to GdkFrameClock::update. *) | `UPDATE + (** corresponds to GdkFrameClock::layout. Should not be handled by applications. *) | `LAYOUT + (** corresponds to GdkFrameClock::paint. *) | `PAINT + (** corresponds to GdkFrameClock::resume-events. Should not be handled by applications. *) | `RESUME_EVENTS + (** corresponds to GdkFrameClock::after-paint. Should not be handled by applications. *) | `AFTER_PAINT ] @@ -317,7 +563,9 @@ type frameclockphase = frameclockphase_flag list (* GLAPI - bitfield/flags *) type glapi_flag = [ + (** The OpenGL API *) | `GL + (** The OpenGL ES API *) | `GLES ] @@ -325,18 +573,34 @@ type glapi = glapi_flag list (* ModifierType - bitfield/flags *) type modifiertype_flag = [ + (** No modifier. *) | `NO_MODIFIER_MASK + (** the Shift key. *) | `SHIFT_MASK + (** a Lock key (depending on the modifier mapping of the + X server this may either be CapsLock or ShiftLock). *) | `LOCK_MASK + (** the Control key. *) | `CONTROL_MASK + (** the fourth modifier key (it depends on the modifier + mapping of the X server which key is interpreted as this modifier, but + normally it is the Alt key). *) | `ALT_MASK + (** the first mouse button. *) | `BUTTON1_MASK + (** the second mouse button. *) | `BUTTON2_MASK + (** the third mouse button. *) | `BUTTON3_MASK + (** the fourth mouse button. *) | `BUTTON4_MASK + (** the fifth mouse button. *) | `BUTTON5_MASK + (** the Super modifier *) | `SUPER_MASK + (** the Hyper modifier *) | `HYPER_MASK + (** the Meta modifier *) | `META_MASK ] @@ -344,7 +608,13 @@ type modifiertype = modifiertype_flag list (* PaintableFlags - bitfield/flags *) type paintableflags_flag = [ + (** The size is immutable. + The [signal@Gdk.Paintable::invalidate-size] signal will never be + emitted. *) | `SIZE + (** The content is immutable. + The [signal@Gdk.Paintable::invalidate-contents] signal will never be + emitted. *) | `CONTENTS ] @@ -352,13 +622,21 @@ type paintableflags = paintableflags_flag list (* SeatCapabilities - bitfield/flags *) type seatcapabilities_flag = [ + (** No input capabilities *) | `NONE + (** The seat has a pointer (e.g. mouse) *) | `POINTER + (** The seat has touchscreen(s) attached *) | `TOUCH + (** The seat has drawing tablet(s) attached *) | `TABLET_STYLUS + (** The seat has keyboard(s) attached *) | `KEYBOARD + (** The seat has drawing tablet pad(s) attached *) | `TABLET_PAD + (** The union of all pointing capabilities *) | `ALL_POINTING + (** The union of all capabilities *) | `ALL ] @@ -366,22 +644,39 @@ type seatcapabilities = seatcapabilities_flag list (* ToplevelState - bitfield/flags *) type toplevelstate_flag = [ + (** the surface is minimized *) | `MINIMIZED + (** the surface is maximized *) | `MAXIMIZED + (** the surface is sticky *) | `STICKY + (** the surface is maximized without decorations *) | `FULLSCREEN + (** the surface is kept above other surfaces *) | `ABOVE + (** the surface is kept below other surfaces *) | `BELOW + (** the surface is presented as focused (with active decorations) *) | `FOCUSED + (** the surface is in a tiled state *) | `TILED + (** whether the top edge is tiled *) | `TOP_TILED + (** whether the top edge is resizable *) | `TOP_RESIZABLE + (** whether the right edge is tiled *) | `RIGHT_TILED + (** whether the right edge is resizable *) | `RIGHT_RESIZABLE + (** whether the bottom edge is tiled *) | `BOTTOM_TILED + (** whether the bottom edge is resizable *) | `BOTTOM_RESIZABLE + (** whether the left edge is tiled *) | `LEFT_TILED + (** whether the left edge is resizable *) | `LEFT_RESIZABLE + (** the surface is not visible to the user *) | `SUSPENDED ] diff --git a/ocgtk/src/gdk/generated/ml_gdk_enums_gen.c b/ocgtk/src/gdk/generated/ml_gdk_enums_gen.c index 8809d4cbc..8ef2bf340 100644 --- a/ocgtk/src/gdk/generated/ml_gdk_enums_gen.c +++ b/ocgtk/src/gdk/generated/ml_gdk_enums_gen.c @@ -252,7 +252,10 @@ value Val_GdkEventType(GdkEventType val) { case GDK_PAD_RING: return caml_hash_variant("PAD_RING"); /* `PAD_RING */ case GDK_PAD_STRIP: return caml_hash_variant("PAD_STRIP"); /* `PAD_STRIP */ case GDK_PAD_GROUP_MODE: return caml_hash_variant("PAD_GROUP_MODE"); /* `PAD_GROUP_MODE */ +#if GTK_CHECK_VERSION(4,6,0) case GDK_TOUCHPAD_HOLD: return caml_hash_variant("TOUCHPAD_HOLD"); /* `TOUCHPAD_HOLD */ + +#endif case GDK_EVENT_LAST: return caml_hash_variant("EVENT_LAST"); /* `EVENT_LAST */ default: { char msg[128]; @@ -293,7 +296,12 @@ GdkEventType GdkEventType_val(value val) { else if (val == caml_hash_variant("PAD_RING")) return GDK_PAD_RING; /* `PAD_RING */ else if (val == caml_hash_variant("PAD_STRIP")) return GDK_PAD_STRIP; /* `PAD_STRIP */ else if (val == caml_hash_variant("PAD_GROUP_MODE")) return GDK_PAD_GROUP_MODE; /* `PAD_GROUP_MODE */ +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("TOUCHPAD_HOLD")) return GDK_TOUCHPAD_HOLD; /* `TOUCHPAD_HOLD */ + +#else + else if (val == caml_hash_variant("TOUCHPAD_HOLD")) caml_failwith("GdkEventType.TOUCHPAD_HOLD requires 4.6"); +#endif else if (val == caml_hash_variant("EVENT_LAST")) return GDK_EVENT_LAST; /* `EVENT_LAST */ else { char msg[128]; @@ -479,30 +487,99 @@ value Val_GdkMemoryFormat(GdkMemoryFormat val) { case GDK_MEMORY_A8B8G8R8: return caml_hash_variant("A8B8G8R8"); /* `A8B8G8R8 */ case GDK_MEMORY_R8G8B8: return caml_hash_variant("R8G8B8"); /* `R8G8B8 */ case GDK_MEMORY_B8G8R8: return caml_hash_variant("B8G8R8"); /* `B8G8R8 */ +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16: return caml_hash_variant("R16G16B16"); /* `R16G16B16 */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16_PREMULTIPLIED: return caml_hash_variant("R16G16B16A16_PREMULTIPLIED"); /* `R16G16B16A16_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16: return caml_hash_variant("R16G16B16A16"); /* `R16G16B16A16 */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16_FLOAT: return caml_hash_variant("R16G16B16_FLOAT"); /* `R16G16B16_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED: return caml_hash_variant("R16G16B16A16_FLOAT_PREMULTIPLIED"); /* `R16G16B16A16_FLOAT_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16_FLOAT: return caml_hash_variant("R16G16B16A16_FLOAT"); /* `R16G16B16A16_FLOAT */ + +#endif case GDK_MEMORY_R32G32B32_FLOAT: return caml_hash_variant("R32G32B32_FLOAT"); /* `R32G32B32_FLOAT */ +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: return caml_hash_variant("R32G32B32A32_FLOAT_PREMULTIPLIED"); /* `R32G32B32A32_FLOAT_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R32G32B32A32_FLOAT: return caml_hash_variant("R32G32B32A32_FLOAT"); /* `R32G32B32A32_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G8A8_PREMULTIPLIED: return caml_hash_variant("G8A8_PREMULTIPLIED"); /* `G8A8_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G8A8: return caml_hash_variant("G8A8"); /* `G8A8 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G8: return caml_hash_variant("G8"); /* `G8 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G16A16_PREMULTIPLIED: return caml_hash_variant("G16A16_PREMULTIPLIED"); /* `G16A16_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G16A16: return caml_hash_variant("G16A16"); /* `G16A16 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G16: return caml_hash_variant("G16"); /* `G16 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A8: return caml_hash_variant("A8"); /* `A8 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A16: return caml_hash_variant("A16"); /* `A16 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A16_FLOAT: return caml_hash_variant("A16_FLOAT"); /* `A16_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A32_FLOAT: return caml_hash_variant("A32_FLOAT"); /* `A32_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_A8B8G8R8_PREMULTIPLIED: return caml_hash_variant("A8B8G8R8_PREMULTIPLIED"); /* `A8B8G8R8_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_B8G8R8X8: return caml_hash_variant("B8G8R8X8"); /* `B8G8R8X8 */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_X8R8G8B8: return caml_hash_variant("X8R8G8B8"); /* `X8R8G8B8 */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_R8G8B8X8: return caml_hash_variant("R8G8B8X8"); /* `R8G8B8X8 */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_X8B8G8R8: return caml_hash_variant("X8B8G8R8"); /* `X8B8G8R8 */ + +#endif case GDK_MEMORY_N_FORMATS: return caml_hash_variant("N_FORMATS"); /* `N_FORMATS */ default: { char msg[128]; @@ -524,30 +601,145 @@ GdkMemoryFormat GdkMemoryFormat_val(value val) { else if (val == caml_hash_variant("A8B8G8R8")) return GDK_MEMORY_A8B8G8R8; /* `A8B8G8R8 */ else if (val == caml_hash_variant("R8G8B8")) return GDK_MEMORY_R8G8B8; /* `R8G8B8 */ else if (val == caml_hash_variant("B8G8R8")) return GDK_MEMORY_B8G8R8; /* `B8G8R8 */ +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16")) return GDK_MEMORY_R16G16B16; /* `R16G16B16 */ + +#else + else if (val == caml_hash_variant("R16G16B16")) caml_failwith("GdkMemoryFormat.R16G16B16 requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16_PREMULTIPLIED")) return GDK_MEMORY_R16G16B16A16_PREMULTIPLIED; /* `R16G16B16A16_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("R16G16B16A16_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.R16G16B16A16_PREMULTIPLIED requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16")) return GDK_MEMORY_R16G16B16A16; /* `R16G16B16A16 */ + +#else + else if (val == caml_hash_variant("R16G16B16A16")) caml_failwith("GdkMemoryFormat.R16G16B16A16 requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16_FLOAT")) return GDK_MEMORY_R16G16B16_FLOAT; /* `R16G16B16_FLOAT */ + +#else + else if (val == caml_hash_variant("R16G16B16_FLOAT")) caml_failwith("GdkMemoryFormat.R16G16B16_FLOAT requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16_FLOAT_PREMULTIPLIED")) return GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED; /* `R16G16B16A16_FLOAT_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("R16G16B16A16_FLOAT_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.R16G16B16A16_FLOAT_PREMULTIPLIED requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16_FLOAT")) return GDK_MEMORY_R16G16B16A16_FLOAT; /* `R16G16B16A16_FLOAT */ + +#else + else if (val == caml_hash_variant("R16G16B16A16_FLOAT")) caml_failwith("GdkMemoryFormat.R16G16B16A16_FLOAT requires 4.6"); +#endif else if (val == caml_hash_variant("R32G32B32_FLOAT")) return GDK_MEMORY_R32G32B32_FLOAT; /* `R32G32B32_FLOAT */ +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R32G32B32A32_FLOAT_PREMULTIPLIED")) return GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED; /* `R32G32B32A32_FLOAT_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("R32G32B32A32_FLOAT_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.R32G32B32A32_FLOAT_PREMULTIPLIED requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R32G32B32A32_FLOAT")) return GDK_MEMORY_R32G32B32A32_FLOAT; /* `R32G32B32A32_FLOAT */ + +#else + else if (val == caml_hash_variant("R32G32B32A32_FLOAT")) caml_failwith("GdkMemoryFormat.R32G32B32A32_FLOAT requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G8A8_PREMULTIPLIED")) return GDK_MEMORY_G8A8_PREMULTIPLIED; /* `G8A8_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("G8A8_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.G8A8_PREMULTIPLIED requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G8A8")) return GDK_MEMORY_G8A8; /* `G8A8 */ + +#else + else if (val == caml_hash_variant("G8A8")) caml_failwith("GdkMemoryFormat.G8A8 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G8")) return GDK_MEMORY_G8; /* `G8 */ + +#else + else if (val == caml_hash_variant("G8")) caml_failwith("GdkMemoryFormat.G8 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G16A16_PREMULTIPLIED")) return GDK_MEMORY_G16A16_PREMULTIPLIED; /* `G16A16_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("G16A16_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.G16A16_PREMULTIPLIED requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G16A16")) return GDK_MEMORY_G16A16; /* `G16A16 */ + +#else + else if (val == caml_hash_variant("G16A16")) caml_failwith("GdkMemoryFormat.G16A16 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G16")) return GDK_MEMORY_G16; /* `G16 */ + +#else + else if (val == caml_hash_variant("G16")) caml_failwith("GdkMemoryFormat.G16 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A8")) return GDK_MEMORY_A8; /* `A8 */ + +#else + else if (val == caml_hash_variant("A8")) caml_failwith("GdkMemoryFormat.A8 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A16")) return GDK_MEMORY_A16; /* `A16 */ + +#else + else if (val == caml_hash_variant("A16")) caml_failwith("GdkMemoryFormat.A16 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A16_FLOAT")) return GDK_MEMORY_A16_FLOAT; /* `A16_FLOAT */ + +#else + else if (val == caml_hash_variant("A16_FLOAT")) caml_failwith("GdkMemoryFormat.A16_FLOAT requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A32_FLOAT")) return GDK_MEMORY_A32_FLOAT; /* `A32_FLOAT */ + +#else + else if (val == caml_hash_variant("A32_FLOAT")) caml_failwith("GdkMemoryFormat.A32_FLOAT requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("A8B8G8R8_PREMULTIPLIED")) return GDK_MEMORY_A8B8G8R8_PREMULTIPLIED; /* `A8B8G8R8_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("A8B8G8R8_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.A8B8G8R8_PREMULTIPLIED requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("B8G8R8X8")) return GDK_MEMORY_B8G8R8X8; /* `B8G8R8X8 */ + +#else + else if (val == caml_hash_variant("B8G8R8X8")) caml_failwith("GdkMemoryFormat.B8G8R8X8 requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("X8R8G8B8")) return GDK_MEMORY_X8R8G8B8; /* `X8R8G8B8 */ + +#else + else if (val == caml_hash_variant("X8R8G8B8")) caml_failwith("GdkMemoryFormat.X8R8G8B8 requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("R8G8B8X8")) return GDK_MEMORY_R8G8B8X8; /* `R8G8B8X8 */ + +#else + else if (val == caml_hash_variant("R8G8B8X8")) caml_failwith("GdkMemoryFormat.R8G8B8X8 requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("X8B8G8R8")) return GDK_MEMORY_X8B8G8R8; /* `X8B8G8R8 */ + +#else + else if (val == caml_hash_variant("X8B8G8R8")) caml_failwith("GdkMemoryFormat.X8B8G8R8 requires 4.14"); +#endif else if (val == caml_hash_variant("N_FORMATS")) return GDK_MEMORY_N_FORMATS; /* `N_FORMATS */ else { char msg[128]; @@ -1191,12 +1383,15 @@ value Val_GdkModifierType(GdkModifierType flags) { CAMLlocal2(result, cons); result = Val_emptylist; +#if GTK_CHECK_VERSION(4,14,0) if (flags & GDK_NO_MODIFIER_MASK) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("NO_MODIFIER_MASK"))); /* `NO_MODIFIER_MASK */ Store_field(cons, 1, result); result = cons; } + +#endif if (flags & GDK_SHIFT_MASK) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("SHIFT_MASK"))); /* `SHIFT_MASK */ @@ -1278,7 +1473,12 @@ GdkModifierType GdkModifierType_val(value list) { GdkModifierType result = 0; while (list != Val_emptylist) { int tag = Int_val(Field(list, 0)); +#if GTK_CHECK_VERSION(4,14,0) if (tag == caml_hash_variant("NO_MODIFIER_MASK")) result |= GDK_NO_MODIFIER_MASK; /* `NO_MODIFIER_MASK */ + +#else + if (tag == caml_hash_variant("NO_MODIFIER_MASK")) caml_failwith("GdkModifierType.NO_MODIFIER_MASK requires 4.14"); +#endif else if (tag == caml_hash_variant("SHIFT_MASK")) result |= GDK_SHIFT_MASK; /* `SHIFT_MASK */ else if (tag == caml_hash_variant("LOCK_MASK")) result |= GDK_LOCK_MASK; /* `LOCK_MASK */ else if (tag == caml_hash_variant("CONTROL_MASK")) result |= GDK_CONTROL_MASK; /* `CONTROL_MASK */ diff --git a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module.ml b/ocgtk/src/gdkpixbuf/generated/gPixbuf_module.ml deleted file mode 100644 index ab164b12c..000000000 --- a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* High-level class for PixbufModule *) -class pixbuf_module (obj : Pixbuf_module.t) = object (self) - - method as_pixbuf_module = obj -end - diff --git a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module.mli b/ocgtk/src/gdkpixbuf/generated/gPixbuf_module.mli deleted file mode 100644 index 5cb9adae1..000000000 --- a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module.mli +++ /dev/null @@ -1,5 +0,0 @@ -class pixbuf_module : Pixbuf_module.t -> - object - method as_pixbuf_module : Pixbuf_module.t - end - diff --git a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module_pattern.ml b/ocgtk/src/gdkpixbuf/generated/gPixbuf_module_pattern.ml deleted file mode 100644 index cae1c0f3f..000000000 --- a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module_pattern.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* High-level class for PixbufModulePattern *) -class pixbuf_module_pattern (obj : Pixbuf_module_pattern.t) = object (self) - - method as_pixbuf_module_pattern = obj -end - diff --git a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module_pattern.mli b/ocgtk/src/gdkpixbuf/generated/gPixbuf_module_pattern.mli deleted file mode 100644 index 8546c5460..000000000 --- a/ocgtk/src/gdkpixbuf/generated/gPixbuf_module_pattern.mli +++ /dev/null @@ -1,5 +0,0 @@ -class pixbuf_module_pattern : Pixbuf_module_pattern.t -> - object - method as_pixbuf_module_pattern : Pixbuf_module_pattern.t - end - diff --git a/ocgtk/src/gdkpixbuf/generated/gPixbuf_non_anim.ml b/ocgtk/src/gdkpixbuf/generated/gPixbuf_non_anim.ml deleted file mode 100644 index d4571be62..000000000 --- a/ocgtk/src/gdkpixbuf/generated/gPixbuf_non_anim.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* High-level class for PixbufNonAnim *) -class pixbuf_non_anim (obj : Pixbuf_non_anim.t) = object (self) - - method as_pixbuf_non_anim = obj -end - diff --git a/ocgtk/src/gdkpixbuf/generated/gPixbuf_non_anim.mli b/ocgtk/src/gdkpixbuf/generated/gPixbuf_non_anim.mli deleted file mode 100644 index 52b761dd8..000000000 --- a/ocgtk/src/gdkpixbuf/generated/gPixbuf_non_anim.mli +++ /dev/null @@ -1,5 +0,0 @@ -class pixbuf_non_anim : Pixbuf_non_anim.t -> - object - method as_pixbuf_non_anim : Pixbuf_non_anim.t - end - diff --git a/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_decls.h b/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_decls.h index 9bda29d0d..8d1af3db9 100644 --- a/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_decls.h +++ b/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_decls.h @@ -31,11 +31,6 @@ #define Val_GdkPixbufLoader(obj) ((value)(ml_gobject_val_of_ext(obj))) #endif /* Val_GdkPixbufLoader */ -#ifndef Val_GdkPixbufNonAnim -#define GdkPixbufNonAnim_val(val) ((GdkPixbufNonAnim*)ml_gobject_ext_of_val(val)) -#define Val_GdkPixbufNonAnim(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GdkPixbufNonAnim */ - #ifndef Val_GdkPixbufSimpleAnim #define GdkPixbufSimpleAnim_val(val) ((GdkPixbufSimpleAnim*)ml_gobject_ext_of_val(val)) #define Val_GdkPixbufSimpleAnim(obj) ((value)(ml_gobject_val_of_ext(obj))) diff --git a/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_enums.mli b/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_enums.mli index 51700e70f..0ef0edde5 100644 --- a/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_enums.mli +++ b/ocgtk/src/gdkpixbuf/generated/gdkpixbuf_enums.mli @@ -3,46 +3,90 @@ (* Colorspace - enumeration *) type colorspace = [ + (** Indicates a red/green/blue additive color space. *) | `RGB ] (* InterpType - enumeration *) type interptype = [ + (** Nearest neighbor sampling; this is the fastest + and lowest quality mode. Quality is normally unacceptable when scaling + down, but may be OK when scaling up. *) | `NEAREST + (** This is an accurate simulation of the PostScript + image operator without any interpolation enabled. Each pixel is + rendered as a tiny parallelogram of solid color, the edges of which + are implemented with antialiasing. It resembles nearest neighbor for + enlargement, and bilinear for reduction. *) | `TILES + (** Best quality/speed balance; use this mode by + default. Bilinear interpolation. For enlargement, it is + equivalent to point-sampling the ideal bilinear-interpolated image. + For reduction, it is equivalent to laying down small tiles and + integrating over the coverage area. *) | `BILINEAR + (** This is the slowest and highest quality + reconstruction function. It is derived from the hyperbolic filters in + Wolberg's "Digital Image Warping", and is formally defined as the + hyperbolic-filter sampling the ideal hyperbolic-filter interpolated + image (the filter is designed to be idempotent for 1:1 pixel mapping). + **Deprecated**: this interpolation filter is deprecated, as in reality + it has a lower quality than the @GDK_INTERP_BILINEAR filter + (Since: 2.38) *) | `HYPER ] (* PixbufAlphaMode - enumeration *) type pixbufalphamode = [ + (** A bilevel clipping mask (black and white) + will be created and used to draw the image. Pixels below 0.5 opacity + will be considered fully transparent, and all others will be + considered fully opaque. *) | `BILEVEL + (** For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL. + In the future it will do full alpha compositing. *) | `FULL ] (* PixbufError - enumeration *) type pixbuferror = [ + (** An image file was broken somehow. *) | `CORRUPT_IMAGE + (** Not enough memory. *) | `INSUFFICIENT_MEMORY + (** A bad option was passed to a pixbuf save module. *) | `BAD_OPTION + (** Unknown image type. *) | `UNKNOWN_TYPE + (** Don't know how to perform the + given operation on the type of image at hand. *) | `UNSUPPORTED_OPERATION + (** Generic failure code, something went wrong. *) | `FAILED + (** Only part of the animation was loaded. *) | `INCOMPLETE_ANIMATION ] (* PixbufRotation - enumeration *) type pixbufrotation = [ + (** No rotation. *) | `NONE + (** Rotate by 90 degrees. *) | `COUNTERCLOCKWISE + (** Rotate by 180 degrees. *) | `UPSIDEDOWN + (** Rotate by 270 degrees. *) | `CLOCKWISE ] (* PixbufFormatFlags - bitfield/flags *) type pixbufformatflags_flag = [ + (** the module can write out images in the format. *) | `WRITABLE + (** the image format is scalable *) | `SCALABLE + (** the module is threadsafe. gdk-pixbuf + ignores modules that are not marked as threadsafe. (Since 2.28). *) | `THREADSAFE ] diff --git a/ocgtk/src/gdkpixbuf/generated/ml_gdkpixbuf_enums_gen.c b/ocgtk/src/gdkpixbuf/generated/ml_gdkpixbuf_enums_gen.c index e139deeae..08182cf38 100644 --- a/ocgtk/src/gdkpixbuf/generated/ml_gdkpixbuf_enums_gen.c +++ b/ocgtk/src/gdkpixbuf/generated/ml_gdkpixbuf_enums_gen.c @@ -38,7 +38,10 @@ value Val_GdkPixbufInterpType(GdkInterpType val) { case GDK_INTERP_NEAREST: return caml_hash_variant("NEAREST"); /* `NEAREST */ case GDK_INTERP_TILES: return caml_hash_variant("TILES"); /* `TILES */ case GDK_INTERP_BILINEAR: return caml_hash_variant("BILINEAR"); /* `BILINEAR */ +#if GDK_PIXBUF_CHECK_VERSION(2,38,0) case GDK_INTERP_HYPER: return caml_hash_variant("HYPER"); /* `HYPER */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GdkInterpType value: %d", (int)val); @@ -53,7 +56,12 @@ GdkInterpType GdkPixbufInterpType_val(value val) { if (val == caml_hash_variant("NEAREST")) return GDK_INTERP_NEAREST; /* `NEAREST */ else if (val == caml_hash_variant("TILES")) return GDK_INTERP_TILES; /* `TILES */ else if (val == caml_hash_variant("BILINEAR")) return GDK_INTERP_BILINEAR; /* `BILINEAR */ +#if GDK_PIXBUF_CHECK_VERSION(2,38,0) else if (val == caml_hash_variant("HYPER")) return GDK_INTERP_HYPER; /* `HYPER */ + +#else + else if (val == caml_hash_variant("HYPER")) caml_failwith("GdkInterpType.HYPER requires 2.38"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GdkInterpType tag: %ld", val); @@ -182,6 +190,7 @@ value Val_GdkPixbufPixbufFormatFlags(GdkPixbufFormatFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GDK_PIXBUF_CHECK_VERSION(2,28,0) if (flags & GDK_PIXBUF_FORMAT_THREADSAFE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("THREADSAFE"))); /* `THREADSAFE */ @@ -189,6 +198,8 @@ value Val_GdkPixbufPixbufFormatFlags(GdkPixbufFormatFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -199,7 +210,12 @@ GdkPixbufFormatFlags GdkPixbufPixbufFormatFlags_val(value list) { int tag = Int_val(Field(list, 0)); if (tag == caml_hash_variant("WRITABLE")) result |= GDK_PIXBUF_FORMAT_WRITABLE; /* `WRITABLE */ else if (tag == caml_hash_variant("SCALABLE")) result |= GDK_PIXBUF_FORMAT_SCALABLE; /* `SCALABLE */ +#if GDK_PIXBUF_CHECK_VERSION(2,28,0) else if (tag == caml_hash_variant("THREADSAFE")) result |= GDK_PIXBUF_FORMAT_THREADSAFE; /* `THREADSAFE */ + +#else + else if (tag == caml_hash_variant("THREADSAFE")) caml_failwith("GdkPixbufFormatFlags.THREADSAFE requires 2.28"); +#endif list = Field(list, 1); } return result; diff --git a/ocgtk/src/gdkpixbuf/generated/pixbuf_module.ml b/ocgtk/src/gdkpixbuf/generated/pixbuf_module.ml deleted file mode 100644 index 2923f7e6e..000000000 --- a/ocgtk/src/gdkpixbuf/generated/pixbuf_module.ml +++ /dev/null @@ -1,51 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* PixbufModule: PixbufModule *) - -(** A `GdkPixbufModule` contains the necessary functions to load and save -images in a certain file format. - -If `GdkPixbuf` has been compiled with `GModule` support, it can be extended -by modules which can load (and perhaps also save) new image and animation -formats. - -## Implementing modules - -The `GdkPixbuf` interfaces needed for implementing modules are contained in -`gdk-pixbuf-io.h` (and `gdk-pixbuf-animation.h` if the module supports -animations). They are not covered by the same stability guarantees as the -regular GdkPixbuf API. To underline this fact, they are protected by the -`GDK_PIXBUF_ENABLE_BACKEND` pre-processor symbol. - -Each loadable module must contain a `GdkPixbufModuleFillVtableFunc` function -named `fill_vtable`, which will get called when the module -is loaded and must set the function pointers of the `GdkPixbufModule`. - -In order to make format-checking work before actually loading the modules -(which may require calling `dlopen` to load image libraries), modules export -their signatures (and other information) via the `fill_info` function. An -external utility, `gdk-pixbuf-query-loaders`, uses this to create a text -file containing a list of all available loaders and their signatures. -This file is then read at runtime by `GdkPixbuf` to obtain the list of -available loaders and their signatures. - -Modules may only implement a subset of the functionality available via -`GdkPixbufModule`. If a particular functionality is not implemented, the -`fill_vtable` function will simply not set the corresponding -function pointers of the `GdkPixbufModule` structure. If a module supports -incremental loading (i.e. provides `begin_load`, `stop_load` and -`load_increment`), it doesn't have to implement `load`, since `GdkPixbuf` -can supply a generic `load` implementation wrapping the incremental loading. - -## Installing modules - -Installing a module is a two-step process: - - - copy the module file(s) to the loader directory (normally - `$libdir/gdk-pixbuf-2.0/$version/loaders`, unless overridden by the - environment variable `GDK_PIXBUF_MODULEDIR`) - - call `gdk-pixbuf-query-loaders` to update the module file (normally - `$libdir/gdk-pixbuf-2.0/$version/loaders.cache`, unless overridden - by the environment variable `GDK_PIXBUF_MODULE_FILE`) *) -type t = [`pixbuf_module] Gobject.obj - -(* Methods *) diff --git a/ocgtk/src/gdkpixbuf/generated/pixbuf_module.mli b/ocgtk/src/gdkpixbuf/generated/pixbuf_module.mli deleted file mode 100644 index 2923f7e6e..000000000 --- a/ocgtk/src/gdkpixbuf/generated/pixbuf_module.mli +++ /dev/null @@ -1,51 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* PixbufModule: PixbufModule *) - -(** A `GdkPixbufModule` contains the necessary functions to load and save -images in a certain file format. - -If `GdkPixbuf` has been compiled with `GModule` support, it can be extended -by modules which can load (and perhaps also save) new image and animation -formats. - -## Implementing modules - -The `GdkPixbuf` interfaces needed for implementing modules are contained in -`gdk-pixbuf-io.h` (and `gdk-pixbuf-animation.h` if the module supports -animations). They are not covered by the same stability guarantees as the -regular GdkPixbuf API. To underline this fact, they are protected by the -`GDK_PIXBUF_ENABLE_BACKEND` pre-processor symbol. - -Each loadable module must contain a `GdkPixbufModuleFillVtableFunc` function -named `fill_vtable`, which will get called when the module -is loaded and must set the function pointers of the `GdkPixbufModule`. - -In order to make format-checking work before actually loading the modules -(which may require calling `dlopen` to load image libraries), modules export -their signatures (and other information) via the `fill_info` function. An -external utility, `gdk-pixbuf-query-loaders`, uses this to create a text -file containing a list of all available loaders and their signatures. -This file is then read at runtime by `GdkPixbuf` to obtain the list of -available loaders and their signatures. - -Modules may only implement a subset of the functionality available via -`GdkPixbufModule`. If a particular functionality is not implemented, the -`fill_vtable` function will simply not set the corresponding -function pointers of the `GdkPixbufModule` structure. If a module supports -incremental loading (i.e. provides `begin_load`, `stop_load` and -`load_increment`), it doesn't have to implement `load`, since `GdkPixbuf` -can supply a generic `load` implementation wrapping the incremental loading. - -## Installing modules - -Installing a module is a two-step process: - - - copy the module file(s) to the loader directory (normally - `$libdir/gdk-pixbuf-2.0/$version/loaders`, unless overridden by the - environment variable `GDK_PIXBUF_MODULEDIR`) - - call `gdk-pixbuf-query-loaders` to update the module file (normally - `$libdir/gdk-pixbuf-2.0/$version/loaders.cache`, unless overridden - by the environment variable `GDK_PIXBUF_MODULE_FILE`) *) -type t = [`pixbuf_module] Gobject.obj - -(* Methods *) diff --git a/ocgtk/src/gdkpixbuf/generated/pixbuf_module_pattern.ml b/ocgtk/src/gdkpixbuf/generated/pixbuf_module_pattern.ml deleted file mode 100644 index c2f29a6a6..000000000 --- a/ocgtk/src/gdkpixbuf/generated/pixbuf_module_pattern.ml +++ /dev/null @@ -1,36 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* PixbufModulePattern: PixbufModulePattern *) - -(** The signature prefix for a module. - -The signature of a module is a set of prefixes. Prefixes are encoded as -pairs of ordinary strings, where the second string, called the mask, if -not `NULL`, must be of the same length as the first one and may contain -' ', '!', 'x', 'z', and 'n' to indicate bytes that must be matched, -not matched, "don't-care"-bytes, zeros and non-zeros, respectively. - -Each prefix has an associated integer that describes the relevance of -the prefix, with 0 meaning a mismatch and 100 a "perfect match". - -Starting with gdk-pixbuf 2.8, the first byte of the mask may be '*', -indicating an unanchored pattern that matches not only at the beginning, -but also in the middle. Versions prior to 2.8 will interpret the '*' -like an 'x'. - -The signature of a module is stored as an array of -`GdkPixbufModulePatterns`. The array is terminated by a pattern -where the `prefix` is `NULL`. - -```c -GdkPixbufModulePattern *signature[] = { - { "abcdx", " !x z", 100 }, - { "bla", NULL, 90 }, - { NULL, NULL, 0 } -}; -``` - -In the example above, the signature matches e.g. "auud\0" with -relevance 100, and "blau" with relevance 90. *) -type t = [`pixbuf_module_pattern] Gobject.obj - -(* Methods *) diff --git a/ocgtk/src/gdkpixbuf/generated/pixbuf_module_pattern.mli b/ocgtk/src/gdkpixbuf/generated/pixbuf_module_pattern.mli deleted file mode 100644 index c2f29a6a6..000000000 --- a/ocgtk/src/gdkpixbuf/generated/pixbuf_module_pattern.mli +++ /dev/null @@ -1,36 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* PixbufModulePattern: PixbufModulePattern *) - -(** The signature prefix for a module. - -The signature of a module is a set of prefixes. Prefixes are encoded as -pairs of ordinary strings, where the second string, called the mask, if -not `NULL`, must be of the same length as the first one and may contain -' ', '!', 'x', 'z', and 'n' to indicate bytes that must be matched, -not matched, "don't-care"-bytes, zeros and non-zeros, respectively. - -Each prefix has an associated integer that describes the relevance of -the prefix, with 0 meaning a mismatch and 100 a "perfect match". - -Starting with gdk-pixbuf 2.8, the first byte of the mask may be '*', -indicating an unanchored pattern that matches not only at the beginning, -but also in the middle. Versions prior to 2.8 will interpret the '*' -like an 'x'. - -The signature of a module is stored as an array of -`GdkPixbufModulePatterns`. The array is terminated by a pattern -where the `prefix` is `NULL`. - -```c -GdkPixbufModulePattern *signature[] = { - { "abcdx", " !x z", 100 }, - { "bla", NULL, 90 }, - { NULL, NULL, 0 } -}; -``` - -In the example above, the signature matches e.g. "auud\0" with -relevance 100, and "blau" with relevance 90. *) -type t = [`pixbuf_module_pattern] Gobject.obj - -(* Methods *) diff --git a/ocgtk/src/gdkpixbuf/generated/pixbuf_non_anim.ml b/ocgtk/src/gdkpixbuf/generated/pixbuf_non_anim.ml deleted file mode 100644 index 287abe4de..000000000 --- a/ocgtk/src/gdkpixbuf/generated/pixbuf_non_anim.ml +++ /dev/null @@ -1,9 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* PixbufNonAnim: PixbufNonAnim *) - -type t = [`pixbuf_non_anim | `pixbuf_animation | `object_] Gobject.obj - -(** Create a new PixbufNonAnim *) -external new_ : Pixbuf.t -> t = "ml_gdk_pixbuf_non_anim_new" - -(* Methods *) diff --git a/ocgtk/src/gdkpixbuf/generated/pixbuf_non_anim.mli b/ocgtk/src/gdkpixbuf/generated/pixbuf_non_anim.mli deleted file mode 100644 index 287abe4de..000000000 --- a/ocgtk/src/gdkpixbuf/generated/pixbuf_non_anim.mli +++ /dev/null @@ -1,9 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* PixbufNonAnim: PixbufNonAnim *) - -type t = [`pixbuf_non_anim | `pixbuf_animation | `object_] Gobject.obj - -(** Create a new PixbufNonAnim *) -external new_ : Pixbuf.t -> t = "ml_gdk_pixbuf_non_anim_new" - -(* Methods *) diff --git a/ocgtk/src/gio/generated/gSettings.ml b/ocgtk/src/gio/generated/gSettings.ml index d70155967..6a8fcb6e6 100644 --- a/ocgtk/src/gio/generated/gSettings.ml +++ b/ocgtk/src/gio/generated/gSettings.ml @@ -30,7 +30,6 @@ class type settings_t = object method set_string : string -> string -> bool method set_strv : string -> string array option -> bool method set_uint : string -> int -> bool - method backend : GSettings_backend.settings_backend_t method delay_apply : bool method path : string method schema : string @@ -155,8 +154,6 @@ class settings (obj : Settings.t) : settings_t = object (self) fun key value -> (Settings.set_uint obj key value) - method backend = new GSettings_backend.settings_backend (Settings.get_backend obj) - method delay_apply = Settings.get_delay_apply obj method path = Settings.get_path obj @@ -174,21 +171,6 @@ let new_ (schema_id : string) : settings_t = let obj_ = Settings.new_ schema_id in new settings obj_ -let new_full (schema : Settings_schema.t) (backend : GSettings_backend.settings_backend_t option) (path : string option) : settings_t = - let backend = Option.map (fun c -> c#as_settings_backend) backend in - let obj_ = Settings.new_full schema backend path in - new settings obj_ - -let new_with_backend (schema_id : string) (backend : GSettings_backend.settings_backend_t) : settings_t = - let backend = backend#as_settings_backend in - let obj_ = Settings.new_with_backend schema_id backend in - new settings obj_ - -let new_with_backend_and_path (schema_id : string) (backend : GSettings_backend.settings_backend_t) (path : string) : settings_t = - let backend = backend#as_settings_backend in - let obj_ = Settings.new_with_backend_and_path schema_id backend path in - new settings obj_ - let new_with_path (schema_id : string) (path : string) : settings_t = let obj_ = Settings.new_with_path schema_id path in new settings obj_ diff --git a/ocgtk/src/gio/generated/gSettings.mli b/ocgtk/src/gio/generated/gSettings.mli index 7872c7df2..6226c2fd8 100644 --- a/ocgtk/src/gio/generated/gSettings.mli +++ b/ocgtk/src/gio/generated/gSettings.mli @@ -28,7 +28,6 @@ class type settings_t = object method set_string : string -> string -> bool method set_strv : string -> string array option -> bool method set_uint : string -> int -> bool - method backend : GSettings_backend.settings_backend_t method delay_apply : bool method path : string method schema : string @@ -40,7 +39,4 @@ end class settings : Settings.t -> settings_t val new_ : string -> settings_t -val new_full : Settings_schema.t -> GSettings_backend.settings_backend_t option -> string option -> settings_t -val new_with_backend : string -> GSettings_backend.settings_backend_t -> settings_t -val new_with_backend_and_path : string -> GSettings_backend.settings_backend_t -> string -> settings_t val new_with_path : string -> string -> settings_t diff --git a/ocgtk/src/gio/generated/gSettings_backend.ml b/ocgtk/src/gio/generated/gSettings_backend.ml deleted file mode 100644 index b6243ee6e..000000000 --- a/ocgtk/src/gio/generated/gSettings_backend.ml +++ /dev/null @@ -1,20 +0,0 @@ -class type settings_backend_t = object - method path_writable_changed : string -> unit - method writable_changed : string -> unit - method as_settings_backend : Settings_backend.t -end - -(* High-level class for SettingsBackend *) -class settings_backend (obj : Settings_backend.t) : settings_backend_t = object (self) - - method path_writable_changed : string -> unit = - fun path -> - (Settings_backend.path_writable_changed obj path) - - method writable_changed : string -> unit = - fun key -> - (Settings_backend.writable_changed obj key) - - method as_settings_backend = obj -end - diff --git a/ocgtk/src/gio/generated/gSettings_backend.mli b/ocgtk/src/gio/generated/gSettings_backend.mli deleted file mode 100644 index 2fe482ef1..000000000 --- a/ocgtk/src/gio/generated/gSettings_backend.mli +++ /dev/null @@ -1,8 +0,0 @@ -class type settings_backend_t = object - method path_writable_changed : string -> unit - method writable_changed : string -> unit - method as_settings_backend : Settings_backend.t -end - -class settings_backend : Settings_backend.t -> settings_backend_t - diff --git a/ocgtk/src/gio/generated/gSettings_backend_private.ml b/ocgtk/src/gio/generated/gSettings_backend_private.ml deleted file mode 100644 index 134622285..000000000 --- a/ocgtk/src/gio/generated/gSettings_backend_private.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* High-level class for SettingsBackendPrivate *) -class settings_backend_private (obj : Settings_backend_private.t) = object (self) - - method as_settings_backend_private = obj -end - diff --git a/ocgtk/src/gio/generated/gSettings_backend_private.mli b/ocgtk/src/gio/generated/gSettings_backend_private.mli deleted file mode 100644 index 360c83b00..000000000 --- a/ocgtk/src/gio/generated/gSettings_backend_private.mli +++ /dev/null @@ -1,5 +0,0 @@ -class settings_backend_private : Settings_backend_private.t -> - object - method as_settings_backend_private : Settings_backend_private.t - end - diff --git a/ocgtk/src/gio/generated/gio_decls.h b/ocgtk/src/gio/generated/gio_decls.h index fe053051e..d3be99fb6 100644 --- a/ocgtk/src/gio/generated/gio_decls.h +++ b/ocgtk/src/gio/generated/gio_decls.h @@ -410,11 +410,6 @@ #define Val_GSettings(obj) ((value)(ml_gobject_val_of_ext(obj))) #endif /* Val_GSettings */ -#ifndef Val_GSettingsBackend -#define GSettingsBackend_val(val) ((GSettingsBackend*)ml_gobject_ext_of_val(val)) -#define Val_GSettingsBackend(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GSettingsBackend */ - #ifndef Val_GSimpleAction #define GSimpleAction_val(val) ((GSimpleAction*)ml_gobject_ext_of_val(val)) #define Val_GSimpleAction(obj) ((value)(ml_gobject_val_of_ext(obj))) diff --git a/ocgtk/src/gio/generated/gio_enums.mli b/ocgtk/src/gio/generated/gio_enums.mli index befd06fb8..d94286472 100644 --- a/ocgtk/src/gio/generated/gio_enums.mli +++ b/ocgtk/src/gio/generated/gio_enums.mli @@ -3,462 +3,854 @@ (* BusType - enumeration *) type bustype = [ + (** An alias for the message bus that activated the process, if any. *) | `STARTER + (** Not a message bus. *) | `NONE + (** The system-wide message bus. *) | `SYSTEM + (** The login session message bus. *) | `SESSION ] (* ConverterResult - enumeration *) type converterresult = [ + (** There was an error during conversion. *) | `ERROR + (** Some data was consumed or produced *) | `CONVERTED + (** The conversion is finished *) | `FINISHED + (** Flushing is finished *) | `FLUSHED ] (* CredentialsType - enumeration *) type credentialstype = [ + (** Indicates an invalid native credential type. *) | `INVALID + (** The native credentials type is a `struct ucred`. *) | `LINUX_UCRED + (** The native credentials type is a `struct cmsgcred`. *) | `FREEBSD_CMSGCRED + (** The native credentials type is a `struct sockpeercred`. Added in 2.30. *) | `OPENBSD_SOCKPEERCRED + (** The native credentials type is a `ucred_t`. Added in 2.40. *) | `SOLARIS_UCRED + (** The native credentials type is a `struct unpcbid`. Added in 2.42. *) | `NETBSD_UNPCBID + (** The native credentials type is a `struct xucred`. Added in 2.66. *) | `APPLE_XUCRED + (** The native credentials type is a PID `DWORD`. Added in 2.72. *) | `WIN32_PID ] (* DBusError - enumeration *) type dbuserror = [ + (** A generic error; "something went wrong" - see the error message for +more. *) | `FAILED + (** There was not enough memory to complete an operation. *) | `NO_MEMORY + (** The bus doesn't know how to launch a service to supply the bus name +you wanted. *) | `SERVICE_UNKNOWN + (** The bus name you referenced doesn't exist (i.e. no application owns +it). *) | `NAME_HAS_NO_OWNER + (** No reply to a message expecting one, usually means a timeout occurred. *) | `NO_REPLY + (** Something went wrong reading or writing to a socket, for example. *) | `IO_ERROR + (** A D-Bus bus address was malformed. *) | `BAD_ADDRESS + (** Requested operation isn't supported (like ENOSYS on UNIX). *) | `NOT_SUPPORTED + (** Some limited resource is exhausted. *) | `LIMITS_EXCEEDED + (** Security restrictions don't allow doing what you're trying to do. *) | `ACCESS_DENIED + (** Authentication didn't work. *) | `AUTH_FAILED + (** Unable to connect to server (probably caused by ECONNREFUSED on a +socket). *) | `NO_SERVER + (** Certain timeout errors, possibly ETIMEDOUT on a socket. Note that +%G_DBUS_ERROR_NO_REPLY is used for message reply timeouts. Warning: +this is confusingly-named given that %G_DBUS_ERROR_TIMED_OUT also +exists. We can't fix it for compatibility reasons so just be +careful. *) | `TIMEOUT + (** No network access (probably ENETUNREACH on a socket). *) | `NO_NETWORK + (** Can't bind a socket since its address is in use (i.e. EADDRINUSE). *) | `ADDRESS_IN_USE + (** The connection is disconnected and you're trying to use it. *) | `DISCONNECTED + (** Invalid arguments passed to a method call. *) | `INVALID_ARGS + (** Missing file. *) | `FILE_NOT_FOUND + (** Existing file and the operation you're using does not silently overwrite. *) | `FILE_EXISTS + (** Method name you invoked isn't known by the object you invoked it on. *) | `UNKNOWN_METHOD + (** Certain timeout errors, e.g. while starting a service. Warning: this is +confusingly-named given that %G_DBUS_ERROR_TIMEOUT also exists. We +can't fix it for compatibility reasons so just be careful. *) | `TIMED_OUT + (** Tried to remove or modify a match rule that didn't exist. *) | `MATCH_RULE_NOT_FOUND + (** The match rule isn't syntactically valid. *) | `MATCH_RULE_INVALID + (** While starting a new process, the exec() call failed. *) | `SPAWN_EXEC_FAILED + (** While starting a new process, the fork() call failed. *) | `SPAWN_FORK_FAILED + (** While starting a new process, the child exited with a status code. *) | `SPAWN_CHILD_EXITED + (** While starting a new process, the child exited on a signal. *) | `SPAWN_CHILD_SIGNALED + (** While starting a new process, something went wrong. *) | `SPAWN_FAILED + (** We failed to setup the environment correctly. *) | `SPAWN_SETUP_FAILED + (** We failed to setup the config parser correctly. *) | `SPAWN_CONFIG_INVALID + (** Bus name was not valid. *) | `SPAWN_SERVICE_INVALID + (** Service file not found in system-services directory. *) | `SPAWN_SERVICE_NOT_FOUND + (** Permissions are incorrect on the setuid helper. *) | `SPAWN_PERMISSIONS_INVALID + (** Service file invalid (Name, User or Exec missing). *) | `SPAWN_FILE_INVALID + (** Tried to get a UNIX process ID and it wasn't available. *) | `SPAWN_NO_MEMORY + (** Tried to get a UNIX process ID and it wasn't available. *) | `UNIX_PROCESS_ID_UNKNOWN + (** A type signature is not valid. *) | `INVALID_SIGNATURE + (** A file contains invalid syntax or is otherwise broken. *) | `INVALID_FILE_CONTENT + (** Asked for SELinux security context and it wasn't available. *) | `SELINUX_SECURITY_CONTEXT_UNKNOWN + (** Asked for ADT audit data and it wasn't available. *) | `ADT_AUDIT_DATA_UNKNOWN + (** There's already an object with the requested object path. *) | `OBJECT_PATH_IN_USE + (** Object you invoked a method on isn't known. Since 2.42 *) | `UNKNOWN_OBJECT + (** Interface you invoked a method on isn't known by the object. Since 2.42 *) | `UNKNOWN_INTERFACE + (** Property you tried to access isn't known by the object. Since 2.42 *) | `UNKNOWN_PROPERTY + (** Property you tried to set is read-only. Since 2.42 *) | `PROPERTY_READ_ONLY ] (* DBusMessageByteOrder - enumeration *) type dbusmessagebyteorder = [ + (** The byte order is big endian. *) | `BIG_ENDIAN + (** The byte order is little endian. *) | `LITTLE_ENDIAN ] (* DBusMessageHeaderField - enumeration *) type dbusmessageheaderfield = [ + (** Not a valid header field. *) | `INVALID + (** The object path. *) | `PATH + (** The interface name. *) | `INTERFACE + (** The method or signal name. *) | `MEMBER + (** The name of the error that occurred. *) | `ERROR_NAME + (** The serial number the message is a reply to. *) | `REPLY_SERIAL + (** The name the message is intended for. *) | `DESTINATION + (** Unique name of the sender of the message (filled in by the bus). *) | `SENDER + (** The signature of the message body. *) | `SIGNATURE + (** The number of UNIX file descriptors that accompany the message. *) | `NUM_UNIX_FDS ] (* DBusMessageType - enumeration *) type dbusmessagetype = [ + (** Message is of invalid type. *) | `INVALID + (** Method call. *) | `METHOD_CALL + (** Method reply. *) | `METHOD_RETURN + (** Error reply. *) | `ERROR + (** Signal emission. *) | `SIGNAL ] (* DataStreamByteOrder - enumeration *) type datastreambyteorder = [ + (** Selects Big Endian byte order. *) | `BIG_ENDIAN + (** Selects Little Endian byte order. *) | `LITTLE_ENDIAN + (** Selects endianness based on host machine's architecture. *) | `HOST_ENDIAN ] (* DataStreamNewlineType - enumeration *) type datastreamnewlinetype = [ + (** Selects "LF" line endings, common on most modern UNIX platforms. *) | `LF + (** Selects "CR" line endings. *) | `CR + (** Selects "CR, LF" line ending, common on Microsoft Windows. *) | `CR_LF + (** Automatically try to handle any line ending type. *) | `ANY ] (* DriveStartStopType - enumeration *) type drivestartstoptype = [ + (** Unknown or drive doesn't support + start/stop. *) | `UNKNOWN + (** The stop method will physically + shut down the drive and e.g. power down the port the drive is + attached to. *) | `SHUTDOWN + (** The start/stop methods are used + for connecting/disconnect to the drive over the network. *) | `NETWORK + (** The start/stop methods will + assemble/disassemble a virtual drive from several physical + drives. *) | `MULTIDISK + (** The start/stop methods will + unlock/lock the disk (for example using the ATA SECURITY + UNLOCK DEVICE command) *) | `PASSWORD ] (* EmblemOrigin - enumeration *) type emblemorigin = [ + (** Emblem of unknown origin *) | `UNKNOWN + (** Emblem adds device-specific information *) | `DEVICE + (** Emblem depicts live metadata, such as "readonly" *) | `LIVEMETADATA + (** Emblem comes from a user-defined tag, e.g. set by nautilus (in the future) *) | `TAG ] (* FileAttributeStatus - enumeration *) type fileattributestatus = [ + (** Attribute value is unset (empty). *) | `UNSET + (** Attribute value is set. *) | `SET + (** Indicates an error in setting the value. *) | `ERROR_SETTING ] (* FileAttributeType - enumeration *) type fileattributetype = [ + (** indicates an invalid or uninitialized type. *) | `INVALID + (** a null terminated UTF8 string. *) | `STRING + (** a zero terminated string of non-zero bytes. *) | `BYTE_STRING + (** a boolean value. *) | `BOOLEAN + (** an unsigned 4-byte/32-bit integer. *) | `UINT32 + (** a signed 4-byte/32-bit integer. *) | `INT32 + (** an unsigned 8-byte/64-bit integer. *) | `UINT64 + (** a signed 8-byte/64-bit integer. *) | `INT64 + (** a #GObject. *) | `OBJECT + (** a %NULL terminated char **. Since 2.22 *) | `STRINGV ] (* FileMonitorEvent - enumeration *) type filemonitorevent = [ + (** a file changed. *) | `CHANGED + (** a hint that this was probably the last change in a set of changes. *) | `CHANGES_DONE_HINT + (** a file was deleted. *) | `DELETED + (** a file was created. *) | `CREATED + (** a file attribute was changed. *) | `ATTRIBUTE_CHANGED + (** the file location will soon be unmounted. *) | `PRE_UNMOUNT + (** the file location was unmounted. *) | `UNMOUNTED + (** the file was moved -- only sent if the + (deprecated) %G_FILE_MONITOR_SEND_MOVED flag is set *) | `MOVED + (** the file was renamed within the + current directory -- only sent if the %G_FILE_MONITOR_WATCH_MOVES + flag is set. Since: 2.46. *) | `RENAMED + (** the file was moved into the + monitored directory from another location -- only sent if the + %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46. *) | `MOVED_IN + (** the file was moved out of the + monitored directory to another location -- only sent if the + %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46 *) | `MOVED_OUT ] (* FileType - enumeration *) type filetype = [ + (** File's type is unknown. *) | `UNKNOWN + (** File handle represents a regular file. *) | `REGULAR + (** File handle represents a directory. *) | `DIRECTORY + (** File handle represents a symbolic link + (Unix systems). *) | `SYMBOLIC_LINK + (** File is a "special" file, such as a socket, fifo, + block device, or character device. *) | `SPECIAL + (** File is a shortcut (Windows systems). *) | `SHORTCUT + (** File is a mountable location. *) | `MOUNTABLE ] (* FilesystemPreviewType - enumeration *) type filesystempreviewtype = [ + (** Only preview files if user has explicitly requested it. *) | `IF_ALWAYS + (** Preview files if user has requested preview of "local" files. *) | `IF_LOCAL + (** Never preview files. *) | `NEVER ] (* IOErrorEnum - enumeration *) type ioerrorenum = [ + (** Generic error condition for when an operation fails + and no more specific #GIOErrorEnum value is defined. *) | `FAILED + (** File not found. *) | `NOT_FOUND + (** File already exists. *) | `EXISTS + (** File is a directory. *) | `IS_DIRECTORY + (** File is not a directory. *) | `NOT_DIRECTORY + (** File is a directory that isn't empty. *) | `NOT_EMPTY + (** File is not a regular file. *) | `NOT_REGULAR_FILE + (** File is not a symbolic link. *) | `NOT_SYMBOLIC_LINK + (** File cannot be mounted. *) | `NOT_MOUNTABLE_FILE + (** Filename is too many characters. *) | `FILENAME_TOO_LONG + (** Filename is invalid or contains invalid characters. *) | `INVALID_FILENAME + (** File contains too many symbolic links. *) | `TOO_MANY_LINKS + (** No space left on drive. *) | `NO_SPACE + (** Invalid argument. *) | `INVALID_ARGUMENT + (** Permission denied. *) | `PERMISSION_DENIED + (** Operation (or one of its parameters) not supported *) | `NOT_SUPPORTED + (** File isn't mounted. *) | `NOT_MOUNTED + (** File is already mounted. *) | `ALREADY_MOUNTED + (** File was closed. *) | `CLOSED + (** Operation was cancelled. See #GCancellable. *) | `CANCELLED + (** Operations are still pending. *) | `PENDING + (** File is read only. *) | `READ_ONLY + (** Backup couldn't be created. *) | `CANT_CREATE_BACKUP + (** File's Entity Tag was incorrect. *) | `WRONG_ETAG + (** Operation timed out. *) | `TIMED_OUT + (** Operation would be recursive. *) | `WOULD_RECURSE + (** File is busy. *) | `BUSY + (** Operation would block. *) | `WOULD_BLOCK + (** Host couldn't be found (remote operations). *) | `HOST_NOT_FOUND + (** Operation would merge files. *) | `WOULD_MERGE + (** Operation failed and a helper program has + already interacted with the user. Do not display any error dialog. *) | `FAILED_HANDLED + (** The current process has too many files + open and can't open any more. Duplicate descriptors do count toward + this limit. Since 2.20 *) | `TOO_MANY_OPEN_FILES + (** The object has not been initialized. Since 2.22 *) | `NOT_INITIALIZED + (** The requested address is already in use. Since 2.22 *) | `ADDRESS_IN_USE + (** Need more input to finish operation. Since 2.24 *) | `PARTIAL_INPUT + (** The input data was invalid. Since 2.24 *) | `INVALID_DATA + (** A remote object generated an error that + doesn't correspond to a locally registered #GError error + domain. Use g_dbus_error_get_remote_error() to extract the D-Bus + error name and g_dbus_error_strip_remote_error() to fix up the + message so it matches what was received on the wire. Since 2.26. *) | `DBUS_ERROR + (** Host unreachable. Since 2.26 *) | `HOST_UNREACHABLE + (** Network unreachable. Since 2.26 *) | `NETWORK_UNREACHABLE + (** Connection refused. Since 2.26 *) | `CONNECTION_REFUSED + (** Connection to proxy server failed. Since 2.26 *) | `PROXY_FAILED + (** Proxy authentication failed. Since 2.26 *) | `PROXY_AUTH_FAILED + (** Proxy server needs authentication. Since 2.26 *) | `PROXY_NEED_AUTH + (** Proxy connection is not allowed by ruleset. + Since 2.26 *) | `PROXY_NOT_ALLOWED + (** Broken pipe. Since 2.36 *) | `BROKEN_PIPE + (** Connection closed by peer. Note that this + is the same code as %G_IO_ERROR_BROKEN_PIPE; before 2.44 some + "connection closed" errors returned %G_IO_ERROR_BROKEN_PIPE, but others + returned %G_IO_ERROR_FAILED. Now they should all return the same + value, which has this more logical name. Since 2.44. *) | `CONNECTION_CLOSED + (** Transport endpoint is not connected. Since 2.44 *) | `NOT_CONNECTED + (** Message too large. Since 2.48. *) | `MESSAGE_TOO_LARGE + (** No such device found. Since 2.74 *) | `NO_SUCH_DEVICE + (** Destination address unset. Since 2.80 *) | `DESTINATION_UNSET ] (* IOModuleScopeFlags - enumeration *) type iomodulescopeflags = [ + (** No module scan flags *) | `NONE + (** When using this scope to load or + scan modules, automatically block a modules which has the same base + basename as previously loaded module. *) | `BLOCK_DUPLICATES ] (* MemoryMonitorWarningLevel - enumeration *) type memorymonitorwarninglevel = [ + (** Memory on the device is low, processes + should free up unneeded resources (for example, in-memory caches) so they can + be used elsewhere. *) | `LOW + (** Same as @G_MEMORY_MONITOR_WARNING_LEVEL_LOW + but the device has even less free memory, so processes should try harder to free + up unneeded resources. If your process does not need to stay running, it is a + good time for it to quit. *) | `MEDIUM + (** The system will soon start terminating + processes to reclaim memory, including background processes. *) | `CRITICAL ] (* MountOperationResult - enumeration *) type mountoperationresult = [ + (** The request was fulfilled and the + user specified data is now available *) | `HANDLED + (** The user requested the mount operation + to be aborted *) | `ABORTED + (** The request was unhandled (i.e. not + implemented) *) | `UNHANDLED ] (* NetworkConnectivity - enumeration *) type networkconnectivity = [ + (** The host is not configured with a + route to the Internet; it may or may not be connected to a local + network. *) | `LOCAL + (** The host is connected to a network, but + does not appear to be able to reach the full Internet, perhaps + due to upstream network problems. *) | `LIMITED + (** The host is behind a captive portal and + cannot reach the full Internet. *) | `PORTAL + (** The host is connected to a network, and + appears to be able to reach the full Internet. *) | `FULL ] (* NotificationPriority - enumeration *) type notificationpriority = [ + (** the default priority, to be used for the + majority of notifications (for example email messages, software updates, + completed download/sync operations) *) | `NORMAL + (** for notifications that do not require + immediate attention - typically used for contextual background + information, such as contact birthdays or local weather *) | `LOW + (** for events that require more attention, + usually because responses are time-sensitive (for example chat and SMS + messages or alarms) *) | `HIGH + (** for urgent notifications, or notifications + that require a response in a short space of time (for example phone calls + or emergency warnings) *) | `URGENT ] (* PasswordSave - enumeration *) type passwordsave = [ + (** never save a password. *) | `NEVER + (** save a password for the session. *) | `FOR_SESSION + (** save a password permanently. *) | `PERMANENTLY ] (* PollableReturn - enumeration *) type pollablereturn = [ + (** Generic error condition for when an operation fails. *) | `FAILED + (** The operation was successfully finished. *) | `OK + (** The operation would block. *) | `WOULD_BLOCK ] (* ResolverError - enumeration *) type resolvererror = [ + (** the requested name/address/service was not + found *) | `NOT_FOUND + (** the requested information could not + be looked up due to a network error or similar problem *) | `TEMPORARY_FAILURE + (** unknown error *) | `INTERNAL ] (* ResolverRecordType - enumeration *) type resolverrecordtype = [ + (** look up DNS SRV records for a domain *) | `SRV + (** look up DNS MX records for a domain *) | `MX + (** look up DNS TXT records for a name *) | `TXT + (** look up DNS SOA records for a zone *) | `SOA + (** look up DNS NS records for a domain *) | `NS ] (* ResourceError - enumeration *) type resourceerror = [ + (** no file was found at the requested path *) | `NOT_FOUND + (** unknown error *) | `INTERNAL ] (* SocketClientEvent - enumeration *) type socketclientevent = [ + (** The client is doing a DNS lookup. *) | `RESOLVING + (** The client has completed a DNS lookup. *) | `RESOLVED + (** The client is connecting to a remote + host (either a proxy or the destination server). *) | `CONNECTING + (** The client has connected to a remote + host. *) | `CONNECTED + (** The client is negotiating + with a proxy to connect to the destination server. *) | `PROXY_NEGOTIATING + (** The client has negotiated + with the proxy server. *) | `PROXY_NEGOTIATED + (** The client is performing a + TLS handshake. *) | `TLS_HANDSHAKING + (** The client has performed a + TLS handshake. *) | `TLS_HANDSHAKED + (** The client is done with a particular + #GSocketConnectable. *) | `COMPLETE ] (* SocketFamily - enumeration *) type socketfamily = [ + (** no address family *) | `INVALID + (** the UNIX domain family *) | `UNIX + (** the IPv4 family *) | `IPV4 + (** the IPv6 family *) | `IPV6 ] (* SocketListenerEvent - enumeration *) type socketlistenerevent = [ + (** The listener is about to bind a socket. *) | `BINDING + (** The listener has bound a socket. *) | `BOUND + (** The listener is about to start + listening on this socket. *) | `LISTENING + (** The listener is now listening on + this socket. *) | `LISTENED ] (* SocketProtocol - enumeration *) type socketprotocol = [ + (** The protocol type is unknown *) | `UNKNOWN + (** The default protocol for the family/type *) | `DEFAULT + (** TCP over IP *) | `TCP + (** UDP over IP *) | `UDP + (** SCTP over IP *) | `SCTP ] (* SocketType - enumeration *) type sockettype = [ + (** Type unknown or wrong *) | `INVALID + (** Reliable connection-based byte streams (e.g. TCP). *) | `STREAM + (** Connectionless, unreliable datagram passing. + (e.g. UDP) *) | `DATAGRAM + (** Reliable connection-based passing of datagrams + of fixed maximum length (e.g. SCTP). *) | `SEQPACKET ] (* TlsAuthenticationMode - enumeration *) type tlsauthenticationmode = [ + (** client authentication not required *) | `NONE + (** client authentication is requested *) | `REQUESTED + (** client authentication is required *) | `REQUIRED ] (* TlsCertificateRequestFlags - enumeration *) type tlscertificaterequestflags = [ + (** No flags *) | `NONE ] (* TlsChannelBindingError - enumeration *) type tlschannelbindingerror = [ + (** Either entire binding + retrieval facility or specific binding type is not implemented in the + TLS backend. *) | `NOT_IMPLEMENTED + (** The handshake is not yet + complete on the connection which is a strong requirement for any existing + binding type. *) | `INVALID_STATE + (** Handshake is complete but + binding data is not available. That normally indicates the TLS + implementation failed to provide the binding data. For example, some + implementations do not provide a peer certificate for resumed connections. *) | `NOT_AVAILABLE + (** Binding type is not supported + on the current connection. This error could be triggered when requesting + `tls-server-end-point` binding data for a certificate which has no hash + function or uses multiple hash functions. *) | `NOT_SUPPORTED + (** Any other backend error + preventing binding data retrieval. *) | `GENERAL_ERROR ] (* TlsChannelBindingType - enumeration *) type tlschannelbindingtype = [ + (** [`tls-unique`](https://tools.ietf.org/html/rfc5929#section-3) binding + type *) | `UNIQUE + (** [`tls-server-end-point`](https://tools.ietf.org/html/rfc5929#section-4) + binding type *) | `SERVER_END_POINT + (** [`tls-exporter`](https://www.rfc-editor.org/rfc/rfc9266.html) binding + type. Since: 2.74 *) | `EXPORTER ] (* TlsDatabaseLookupFlags - enumeration *) type tlsdatabaselookupflags = [ + (** No lookup flags *) | `NONE + (** Restrict lookup to certificates that have + a private key. *) | `KEYPAIR ] (* TlsError - enumeration *) type tlserror = [ + (** No TLS provider is available *) | `UNAVAILABLE + (** Miscellaneous TLS error *) | `MISC + (** The certificate presented could not + be parsed or failed validation. *) | `BAD_CERTIFICATE + (** The TLS handshake failed because the + peer does not seem to be a TLS server. *) | `NOT_TLS + (** The TLS handshake failed because the + peer's certificate was not acceptable. *) | `HANDSHAKE + (** The TLS handshake failed because + the server requested a client-side certificate, but none was + provided. See g_tls_connection_set_certificate(). *) | `CERTIFICATE_REQUIRED + (** The TLS connection was closed without proper + notice, which may indicate an attack. See + g_tls_connection_set_require_close_notify(). *) | `EOF + (** The TLS handshake failed + because the client sent the fallback SCSV, indicating a protocol + downgrade attack. Since: 2.60 *) | `INAPPROPRIATE_FALLBACK + (** The certificate failed + to load because a password was incorrect. Since: 2.72 *) | `BAD_CERTIFICATE_PASSWORD ] (* TlsInteractionResult - enumeration *) type tlsinteractionresult = [ + (** The interaction was unhandled (i.e. not + implemented). *) | `UNHANDLED + (** The interaction completed, and resulting data + is available. *) | `HANDLED + (** The interaction has failed, or was cancelled. + and the operation should be aborted. *) | `FAILED ] (* TlsProtocolVersion - enumeration *) type tlsprotocolversion = [ + (** No protocol version or unknown protocol version *) | `UNKNOWN + (** SSL 3.0, which is insecure and should not be used *) | `SSL_3_0 + (** TLS 1.0, which is insecure and should not be used *) | `TLS_1_0 + (** TLS 1.1, which is insecure and should not be used *) | `TLS_1_1 + (** TLS 1.2, defined by [RFC 5246](https://datatracker.ietf.org/doc/html/rfc5246) *) | `TLS_1_2 + (** TLS 1.3, defined by [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446) *) | `TLS_1_3 + (** DTLS 1.0, which is insecure and should not be used *) | `DTLS_1_0 + (** DTLS 1.2, defined by [RFC 6347](https://datatracker.ietf.org/doc/html/rfc6347) *) | `DTLS_1_2 ] (* TlsRehandshakeMode - enumeration *) type tlsrehandshakemode = [ + (** Never allow rehandshaking *) | `NEVER + (** Allow safe rehandshaking only *) | `SAFELY + (** Allow unsafe rehandshaking *) | `UNSAFELY ] (* UnixSocketAddressType - enumeration *) type unixsocketaddresstype = [ + (** invalid *) | `INVALID + (** anonymous *) | `ANONYMOUS + (** a filesystem path *) | `PATH + (** an abstract name *) | `ABSTRACT + (** an abstract name, 0-padded + to the full length of a unix socket name *) | `ABSTRACT_PADDED ] (* ZlibCompressorFormat - enumeration *) type zlibcompressorformat = [ + (** deflate compression with zlib header *) | `ZLIB + (** gzip file format *) | `GZIP + (** deflate compression with no header *) | `RAW ] (* AppInfoCreateFlags - bitfield/flags *) type appinfocreateflags_flag = [ + (** No flags. *) | `NONE + (** Application opens in a terminal window. *) | `NEEDS_TERMINAL + (** Application supports URI arguments. *) | `SUPPORTS_URIS + (** Application supports startup notification. Since 2.26 *) | `SUPPORTS_STARTUP_NOTIFICATION ] @@ -466,16 +858,55 @@ type appinfocreateflags = appinfocreateflags_flag list (* ApplicationFlags - bitfield/flags *) type applicationflags_flag = [ + (** Default. Deprecated in 2.74, use + %G_APPLICATION_DEFAULT_FLAGS instead *) | `FLAGS_NONE + (** Default flags. Since: 2.74 *) | `DEFAULT_FLAGS + (** Run as a service. In this mode, registration + fails if the service is already running, and the application + will initially wait up to 10 seconds for an initial activation + message to arrive. *) | `IS_SERVICE + (** Don't try to become the primary instance. *) | `IS_LAUNCHER + (** This application handles opening files (in + the primary instance). Note that this flag only affects the default + implementation of local_command_line(), and has no effect if + %G_APPLICATION_HANDLES_COMMAND_LINE is given. + See g_application_run() for details. *) | `HANDLES_OPEN + (** This application handles command line + arguments (in the primary instance). Note that this flag only affect + the default implementation of local_command_line(). + See g_application_run() for details. *) | `HANDLES_COMMAND_LINE + (** Send the environment of the + launching process to the primary instance. Set this flag if your + application is expected to behave differently depending on certain + environment variables. For instance, an editor might be expected + to use the `GIT_COMMITTER_NAME` environment variable + when editing a git commit message. The environment is available + to the #GApplication::command-line signal handler, via + g_application_command_line_getenv(). *) | `SEND_ENVIRONMENT + (** Make no attempts to do any of the typical + single-instance application negotiation, even if the application + ID is given. The application neither attempts to become the + owner of the application ID nor does it check if an existing + owner already exists. Everything occurs in the local process. + Since: 2.30. *) | `NON_UNIQUE + (** Allow users to override the + application ID from the command line with `--gapplication-app-id`. + Since: 2.48 *) | `CAN_OVERRIDE_APP_ID + (** Allow another instance to take over + the bus name. Since: 2.60 *) | `ALLOW_REPLACEMENT + (** Take over from another instance. This flag is + usually set by passing `--gapplication-replace` on the commandline. + Since: 2.60 *) | `REPLACE ] @@ -483,11 +914,17 @@ type applicationflags = applicationflags_flag list (* AskPasswordFlags - bitfield/flags *) type askpasswordflags_flag = [ + (** operation requires a password. *) | `NEED_PASSWORD + (** operation requires a username. *) | `NEED_USERNAME + (** operation requires a domain. *) | `NEED_DOMAIN + (** operation supports saving settings. *) | `SAVING_SUPPORTED + (** operation supports anonymous users. *) | `ANONYMOUS_SUPPORTED + (** operation takes TCRYPT parameters (Since: 2.58) *) | `TCRYPT ] @@ -495,9 +932,15 @@ type askpasswordflags = askpasswordflags_flag list (* BusNameOwnerFlags - bitfield/flags *) type busnameownerflags_flag = [ + (** No flags set. *) | `NONE + (** Allow another message bus connection to claim the name. *) | `ALLOW_REPLACEMENT + (** If another message bus connection owns the name and have +specified %G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection. *) | `REPLACE + (** If another message bus connection owns the name, immediately +return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54) *) | `DO_NOT_QUEUE ] @@ -505,7 +948,11 @@ type busnameownerflags = busnameownerflags_flag list (* BusNameWatcherFlags - bitfield/flags *) type busnamewatcherflags_flag = [ + (** No flags set. *) | `NONE + (** If no-one owns the name when +beginning to watch the name, ask the bus to launch an owner for the +name. *) | `AUTO_START ] @@ -513,8 +960,11 @@ type busnamewatcherflags = busnamewatcherflags_flag list (* ConverterFlags - bitfield/flags *) type converterflags_flag = [ + (** No flags. *) | `NONE + (** At end of input data *) | `INPUT_AT_END + (** Flush data *) | `FLUSH ] @@ -522,8 +972,14 @@ type converterflags = converterflags_flag list (* DBusCallFlags - bitfield/flags *) type dbuscallflags_flag = [ + (** No flags set. *) | `NONE + (** The bus must not launch +an owner for the destination name in response to this method +invocation. *) | `NO_AUTO_START + (** the caller is prepared to +wait for interactive authorization. Since 2.46. *) | `ALLOW_INTERACTIVE_AUTHORIZATION ] @@ -531,7 +987,10 @@ type dbuscallflags = dbuscallflags_flag list (* DBusCapabilityFlags - bitfield/flags *) type dbuscapabilityflags_flag = [ + (** No flags set. *) | `NONE + (** The connection +supports exchanging UNIX file descriptors with the remote peer. *) | `UNIX_FD_PASSING ] @@ -539,13 +998,31 @@ type dbuscapabilityflags = dbuscapabilityflags_flag list (* DBusConnectionFlags - bitfield/flags *) type dbusconnectionflags_flag = [ + (** No flags set. *) | `NONE + (** Perform authentication against server. *) | `AUTHENTICATION_CLIENT + (** Perform authentication against client. *) | `AUTHENTICATION_SERVER + (** When +authenticating as a server, allow the anonymous authentication +method. *) | `AUTHENTICATION_ALLOW_ANONYMOUS + (** Pass this flag if connecting to a peer that is a +message bus. This means that the Hello() method will be invoked as part of the connection setup. *) | `MESSAGE_BUS_CONNECTION + (** If set, processing of D-Bus messages is +delayed until g_dbus_connection_start_message_processing() is called. *) | `DELAY_MESSAGE_PROCESSING + (** When authenticating +as a server, require the UID of the peer to be the same as the UID of the server. (Since: 2.68) *) | `AUTHENTICATION_REQUIRE_SAME_USER + (** When authenticating, try to use + protocols that work across a Linux user namespace boundary, even if this + reduces interoperability with older D-Bus implementations. This currently + affects client-side `EXTERNAL` authentication, for which this flag makes + connections to a server in another user namespace succeed, but causes + a deadlock when connecting to a GDBus server older than 2.73.3. Since: 2.74 *) | `CROSS_NAMESPACE ] @@ -553,7 +1030,12 @@ type dbusconnectionflags = dbusconnectionflags_flag list (* DBusInterfaceSkeletonFlags - bitfield/flags *) type dbusinterfaceskeletonflags_flag = [ + (** No flags set. *) | `NONE + (** Each method invocation is handled in + a thread dedicated to the invocation. This means that the method implementation can use blocking IO + without blocking any other part of the process. It also means that the method implementation must + use locking to access data structures used by other threads. *) | `HANDLE_METHOD_INVOCATIONS_IN_THREAD ] @@ -561,9 +1043,16 @@ type dbusinterfaceskeletonflags = dbusinterfaceskeletonflags_flag list (* DBusMessageFlags - bitfield/flags *) type dbusmessageflags_flag = [ + (** No flags set. *) | `NONE + (** A reply is not expected. *) | `NO_REPLY_EXPECTED + (** The bus must not launch an +owner for the destination name in response to this message. *) | `NO_AUTO_START + (** If set on a method +call, this flag means that the caller is prepared to wait for interactive +authorization. Since 2.46. *) | `ALLOW_INTERACTIVE_AUTHORIZATION ] @@ -571,7 +1060,12 @@ type dbusmessageflags = dbusmessageflags_flag list (* DBusObjectManagerClientFlags - bitfield/flags *) type dbusobjectmanagerclientflags_flag = [ + (** No flags set. *) | `NONE + (** If not set and the + manager is for a well-known name, then request the bus to launch + an owner for the name if no-one owns the name. This flag can only + be used in managers for well-known names. *) | `DO_NOT_AUTO_START ] @@ -579,8 +1073,11 @@ type dbusobjectmanagerclientflags = dbusobjectmanagerclientflags_flag list (* DBusPropertyInfoFlags - bitfield/flags *) type dbuspropertyinfoflags_flag = [ + (** No flags set. *) | `NONE + (** Property is readable. *) | `READABLE + (** Property is writable. *) | `WRITABLE ] @@ -588,12 +1085,26 @@ type dbuspropertyinfoflags = dbuspropertyinfoflags_flag list (* DBusProxyFlags - bitfield/flags *) type dbusproxyflags_flag = [ + (** No flags set. *) | `NONE + (** Don't load properties. *) | `DO_NOT_LOAD_PROPERTIES + (** Don't connect to signals on the remote object. *) | `DO_NOT_CONNECT_SIGNALS + (** If the proxy is for a well-known name, +do not ask the bus to launch an owner during proxy initialization or a method call. +This flag is only meaningful in proxies for well-known names. *) | `DO_NOT_AUTO_START + (** If set, the property value for any __invalidated property__ will be (asynchronously) retrieved upon receiving the [`PropertiesChanged`](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties) D-Bus signal and the property will not cause emission of the #GDBusProxy::g-properties-changed signal. When the value is received the #GDBusProxy::g-properties-changed signal is emitted for the property along with the retrieved value. Since 2.32. *) | `GET_INVALIDATED_PROPERTIES + (** If the proxy is for a well-known name, +do not ask the bus to launch an owner during proxy initialization, but allow it to be +autostarted by a method call. This flag is only meaningful in proxies for well-known names, +and only if %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is not also specified. *) | `DO_NOT_AUTO_START_AT_CONSTRUCTION + (** Don't actually send the AddMatch D-Bus + call for this signal subscription. This gives you more control + over which match rules you add (but you must add them manually). (Since: 2.72) *) | `NO_MATCH_RULE ] @@ -601,7 +1112,11 @@ type dbusproxyflags = dbusproxyflags_flag list (* DBusSendMessageFlags - bitfield/flags *) type dbussendmessageflags_flag = [ + (** No flags set. *) | `NONE + (** Do not automatically +assign a serial number from the #GDBusConnection object when +sending a message. *) | `PRESERVE_SERIAL ] @@ -609,9 +1124,17 @@ type dbussendmessageflags = dbussendmessageflags_flag list (* DBusServerFlags - bitfield/flags *) type dbusserverflags_flag = [ + (** No flags set. *) | `NONE + (** All #GDBusServer::new-connection +signals will run in separated dedicated threads (see signal for +details). *) | `RUN_IN_THREAD + (** Allow the anonymous +authentication method. *) | `AUTHENTICATION_ALLOW_ANONYMOUS + (** Require the UID of the +peer to be the same as the UID of the server when authenticating. (Since: 2.68) *) | `AUTHENTICATION_REQUIRE_SAME_USER ] @@ -619,9 +1142,18 @@ type dbusserverflags = dbusserverflags_flag list (* DBusSignalFlags - bitfield/flags *) type dbussignalflags_flag = [ + (** No flags set. *) | `NONE + (** Don't actually send the AddMatch +D-Bus call for this signal subscription. This gives you more control +over which match rules you add (but you must add them manually). *) | `NO_MATCH_RULE + (** Match first arguments that +contain a bus or interface name with the given namespace. *) | `MATCH_ARG0_NAMESPACE + (** Match first arguments that +contain an object path that is either equivalent to the given path, +or one of the paths is a subpath of the other. *) | `MATCH_ARG0_PATH ] @@ -629,7 +1161,11 @@ type dbussignalflags = dbussignalflags_flag list (* DBusSubtreeFlags - bitfield/flags *) type dbussubtreeflags_flag = [ + (** No flags set. *) | `NONE + (** Method calls to objects not in the enumerated range + will still be dispatched. This is useful if you want + to dynamically spawn objects in the subtree. *) | `DISPATCH_TO_UNENUMERATED_NODES ] @@ -637,6 +1173,7 @@ type dbussubtreeflags = dbussubtreeflags_flag list (* DriveStartFlags - bitfield/flags *) type drivestartflags_flag = [ + (** No flags set. *) | `NONE ] @@ -644,8 +1181,11 @@ type drivestartflags = drivestartflags_flag list (* FileAttributeInfoFlags - bitfield/flags *) type fileattributeinfoflags_flag = [ + (** no flags set. *) | `NONE + (** copy the attribute values when the file is copied. *) | `COPY_WITH_FILE + (** copy the attribute values when the file is moved. *) | `COPY_WHEN_MOVED ] @@ -653,13 +1193,22 @@ type fileattributeinfoflags = fileattributeinfoflags_flag list (* FileCopyFlags - bitfield/flags *) type filecopyflags_flag = [ + (** No flags set. *) | `NONE + (** Overwrite any existing files *) | `OVERWRITE + (** Make a backup of any existing files. *) | `BACKUP + (** Don't follow symlinks. *) | `NOFOLLOW_SYMLINKS + (** Copy all file metadata instead of just default set used for copy (see #GFileInfo). *) | `ALL_METADATA + (** Don't use copy and delete fallback if native move not supported. *) | `NO_FALLBACK_FOR_MOVE + (** Leaves target file with default perms, instead of setting the source file perms. *) | `TARGET_DEFAULT_PERMS + (** Use default modification + timestamps instead of copying them from the source file. Since 2.80 *) | `TARGET_DEFAULT_MODIFIED_TIME ] @@ -667,8 +1216,21 @@ type filecopyflags = filecopyflags_flag list (* FileCreateFlags - bitfield/flags *) type filecreateflags_flag = [ + (** No flags set. *) | `NONE + (** Create a file that can only be + accessed by the current user. *) | `PRIVATE + (** Replace the destination + as if it didn't exist before. Don't try to keep any old + permissions, replace instead of following links. This + is generally useful if you're doing a "copy over" + rather than a "save new version of" replace operation. + You can think of it as "unlink destination" before + writing to it, although the implementation may not + be exactly like that. This flag can only be used with + g_file_replace() and its variants, including g_file_replace_contents(). + Since 2.20 *) | `REPLACE_DESTINATION ] @@ -676,9 +1238,22 @@ type filecreateflags = filecreateflags_flag list (* FileMeasureFlags - bitfield/flags *) type filemeasureflags_flag = [ + (** No flags set. *) | `NONE + (** Report any error encountered + while traversing the directory tree. Normally errors are only + reported for the toplevel file. *) | `REPORT_ANY_ERROR + (** Tally usage based on apparent file + sizes. Normally, the block-size is used, if available, as this is a + more accurate representation of disk space used. + Compare with `du --apparent-size`. + Since GLib 2.78. and similarly to `du` since GNU Coreutils 9.2, this will + ignore the sizes of file types other than regular files and links, as the + sizes of other file types are not specified in a standard way. *) | `APPARENT_SIZE + (** Do not cross mount point boundaries. + Compare with `du -x`. *) | `NO_XDEV ] @@ -686,10 +1261,24 @@ type filemeasureflags = filemeasureflags_flag list (* FileMonitorFlags - bitfield/flags *) type filemonitorflags_flag = [ + (** No flags set. *) | `NONE + (** Watch for mount events. *) | `WATCH_MOUNTS + (** Pair DELETED and CREATED events caused + by file renames (moves) and send a single G_FILE_MONITOR_EVENT_MOVED + event instead (NB: not supported on all backends; the default + behaviour -without specifying this flag- is to send single DELETED + and CREATED events). Deprecated since 2.46: use + %G_FILE_MONITOR_WATCH_MOVES instead. *) | `SEND_MOVED + (** Watch for changes to the file made + via another hard link. Since 2.36. *) | `WATCH_HARD_LINKS + (** Watch for rename operations on a + monitored directory. This causes %G_FILE_MONITOR_EVENT_RENAMED, + %G_FILE_MONITOR_EVENT_MOVED_IN and %G_FILE_MONITOR_EVENT_MOVED_OUT + events to be emitted when possible. Since: 2.46. *) | `WATCH_MOVES ] @@ -697,7 +1286,9 @@ type filemonitorflags = filemonitorflags_flag list (* FileQueryInfoFlags - bitfield/flags *) type filequeryinfoflags_flag = [ + (** No flags set. *) | `NONE + (** Don't follow symlinks. *) | `NOFOLLOW_SYMLINKS ] @@ -705,9 +1296,16 @@ type filequeryinfoflags = filequeryinfoflags_flag list (* IOStreamSpliceFlags - bitfield/flags *) type iostreamspliceflags_flag = [ + (** Do not close either stream. *) | `NONE + (** Close the first stream after + the splice. *) | `CLOSE_STREAM1 + (** Close the second stream after + the splice. *) | `CLOSE_STREAM2 + (** Wait for both splice operations to finish + before calling the callback. *) | `WAIT_FOR_BOTH ] @@ -715,6 +1313,7 @@ type iostreamspliceflags = iostreamspliceflags_flag list (* MountMountFlags - bitfield/flags *) type mountmountflags_flag = [ + (** No flags set. *) | `NONE ] @@ -722,7 +1321,10 @@ type mountmountflags = mountmountflags_flag list (* MountUnmountFlags - bitfield/flags *) type mountunmountflags_flag = [ + (** No flags set. *) | `NONE + (** Unmount even if there are outstanding + file operations on the mount. *) | `FORCE ] @@ -730,8 +1332,13 @@ type mountunmountflags = mountunmountflags_flag list (* OutputStreamSpliceFlags - bitfield/flags *) type outputstreamspliceflags_flag = [ + (** Do not close either stream. *) | `NONE + (** Close the source stream after + the splice. *) | `CLOSE_SOURCE + (** Close the target stream after + the splice. *) | `CLOSE_TARGET ] @@ -739,8 +1346,11 @@ type outputstreamspliceflags = outputstreamspliceflags_flag list (* ResolverNameLookupFlags - bitfield/flags *) type resolvernamelookupflags_flag = [ + (** default behavior (same as g_resolver_lookup_by_name()) *) | `DEFAULT + (** only resolve ipv4 addresses *) | `IPV4_ONLY + (** only resolve ipv6 addresses *) | `IPV6_ONLY ] @@ -748,7 +1358,9 @@ type resolvernamelookupflags = resolvernamelookupflags_flag list (* ResourceFlags - bitfield/flags *) type resourceflags_flag = [ + (** No flags set. *) | `NONE + (** The file is compressed. *) | `COMPRESSED ] @@ -756,6 +1368,7 @@ type resourceflags = resourceflags_flag list (* ResourceLookupFlags - bitfield/flags *) type resourcelookupflags_flag = [ + (** No flags set. *) | `NONE ] @@ -763,11 +1376,22 @@ type resourcelookupflags = resourcelookupflags_flag list (* SettingsBindFlags - bitfield/flags *) type settingsbindflags_flag = [ + (** Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET` *) | `DEFAULT + (** Update the #GObject property when the setting changes. + It is an error to use this flag if the property is not writable. *) | `GET + (** Update the setting when the #GObject property changes. + It is an error to use this flag if the property is not readable. *) | `SET + (** Do not try to bind a "sensitivity" property to the writability of the setting *) | `NO_SENSITIVITY + (** When set in addition to %G_SETTINGS_BIND_GET, set the #GObject property + value initially from the setting, but do not listen for changes of the setting *) | `GET_NO_CHANGES + (** When passed to g_settings_bind(), uses a pair of mapping functions that invert + the boolean value when mapping between the setting and the property. The setting and property must both + be booleans. You cannot pass this flag to g_settings_bind_with_mapping(). *) | `INVERT_BOOLEAN ] @@ -775,9 +1399,15 @@ type settingsbindflags = settingsbindflags_flag list (* SocketMsgFlags - bitfield/flags *) type socketmsgflags_flag = [ + (** No flags. *) | `NONE + (** Request to send/receive out of band data. *) | `OOB + (** Read data from the socket without removing it from + the queue. *) | `PEEK + (** Don't use a gateway to send out the packet, + only send to hosts on directly connected networks. *) | `DONTROUTE ] @@ -785,15 +1415,41 @@ type socketmsgflags = socketmsgflags_flag list (* SubprocessFlags - bitfield/flags *) type subprocessflags_flag = [ + (** No flags. *) | `NONE + (** create a pipe for the stdin of the + spawned process that can be accessed with + g_subprocess_get_stdin_pipe(). *) | `STDIN_PIPE + (** stdin is inherited from the + calling process. *) | `STDIN_INHERIT + (** create a pipe for the stdout of the + spawned process that can be accessed with + g_subprocess_get_stdout_pipe(). *) | `STDOUT_PIPE + (** silence the stdout of the spawned + process (ie: redirect to `/dev/null`). *) | `STDOUT_SILENCE + (** create a pipe for the stderr of the + spawned process that can be accessed with + g_subprocess_get_stderr_pipe(). *) | `STDERR_PIPE + (** silence the stderr of the spawned + process (ie: redirect to `/dev/null`). *) | `STDERR_SILENCE + (** merge the stderr of the spawned + process with whatever the stdout happens to be. This is a good way + of directing both streams to a common log file, for example. *) | `STDERR_MERGE + (** spawned processes will inherit the + file descriptors of their parent, unless those descriptors have + been explicitly marked as close-on-exec. This flag has no effect + over the "standard" file descriptors (stdin, stdout, stderr). *) | `INHERIT_FDS + (** if path searching is + needed when spawning the subprocess, use the `PATH` in the launcher + environment. (Since: 2.72) *) | `SEARCH_PATH_FROM_ENVP ] @@ -801,6 +1457,7 @@ type subprocessflags = subprocessflags_flag list (* TestDBusFlags - bitfield/flags *) type testdbusflags_flag = [ + (** No flags. *) | `NONE ] @@ -808,14 +1465,30 @@ type testdbusflags = testdbusflags_flag list (* TlsCertificateFlags - bitfield/flags *) type tlscertificateflags_flag = [ + (** No flags set. Since: 2.74 *) | `NO_FLAGS + (** The signing certificate authority is + not known. *) | `UNKNOWN_CA + (** The certificate does not match the + expected identity of the site that it was retrieved from. *) | `BAD_IDENTITY + (** The certificate's activation time + is still in the future *) | `NOT_ACTIVATED + (** The certificate has expired *) | `EXPIRED + (** The certificate has been revoked + according to the #GTlsConnection's certificate revocation list. *) | `REVOKED + (** The certificate's algorithm is + considered insecure. *) | `INSECURE + (** Some other error occurred validating + the certificate *) | `GENERIC_ERROR + (** the combination of all of the above + flags *) | `VALIDATE_ALL ] @@ -823,6 +1496,7 @@ type tlscertificateflags = tlscertificateflags_flag list (* TlsDatabaseVerifyFlags - bitfield/flags *) type tlsdatabaseverifyflags_flag = [ + (** No verification flags *) | `NONE ] @@ -830,12 +1504,24 @@ type tlsdatabaseverifyflags = tlsdatabaseverifyflags_flag list (* TlsPasswordFlags - bitfield/flags *) type tlspasswordflags_flag = [ + (** No flags *) | `NONE + (** The password was wrong, and the user should retry. *) | `RETRY + (** Hint to the user that the password has been + wrong many times, and the user may not have many chances left. *) | `MANY_TRIES + (** Hint to the user that this is the last try to get + this password right. *) | `FINAL_TRY + (** For PKCS #11, the user PIN is required. + Since: 2.70. *) | `PKCS11_USER + (** For PKCS #11, the security officer + PIN is required. Since: 2.70. *) | `PKCS11_SECURITY_OFFICER + (** For PKCS #11, the context-specific + PIN is required. Since: 2.70. *) | `PKCS11_CONTEXT_SPECIFIC ] diff --git a/ocgtk/src/gio/generated/ml_gio_enums_gen.c b/ocgtk/src/gio/generated/ml_gio_enums_gen.c index e2ed62527..45f08804b 100644 --- a/ocgtk/src/gio/generated/ml_gio_enums_gen.c +++ b/ocgtk/src/gio/generated/ml_gio_enums_gen.c @@ -160,10 +160,22 @@ value Val_GioDBusError(GDBusError val) { case G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN: return caml_hash_variant("SELINUX_SECURITY_CONTEXT_UNKNOWN"); /* `SELINUX_SECURITY_CONTEXT_UNKNOWN */ case G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN: return caml_hash_variant("ADT_AUDIT_DATA_UNKNOWN"); /* `ADT_AUDIT_DATA_UNKNOWN */ case G_DBUS_ERROR_OBJECT_PATH_IN_USE: return caml_hash_variant("OBJECT_PATH_IN_USE"); /* `OBJECT_PATH_IN_USE */ +#if GLIB_CHECK_VERSION(2,42,0) case G_DBUS_ERROR_UNKNOWN_OBJECT: return caml_hash_variant("UNKNOWN_OBJECT"); /* `UNKNOWN_OBJECT */ + +#endif +#if GLIB_CHECK_VERSION(2,42,0) case G_DBUS_ERROR_UNKNOWN_INTERFACE: return caml_hash_variant("UNKNOWN_INTERFACE"); /* `UNKNOWN_INTERFACE */ + +#endif +#if GLIB_CHECK_VERSION(2,42,0) case G_DBUS_ERROR_UNKNOWN_PROPERTY: return caml_hash_variant("UNKNOWN_PROPERTY"); /* `UNKNOWN_PROPERTY */ + +#endif +#if GLIB_CHECK_VERSION(2,42,0) case G_DBUS_ERROR_PROPERTY_READ_ONLY: return caml_hash_variant("PROPERTY_READ_ONLY"); /* `PROPERTY_READ_ONLY */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GDBusError value: %d", (int)val); @@ -216,10 +228,30 @@ GDBusError GioDBusError_val(value val) { else if (val == caml_hash_variant("SELINUX_SECURITY_CONTEXT_UNKNOWN")) return G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN; /* `SELINUX_SECURITY_CONTEXT_UNKNOWN */ else if (val == caml_hash_variant("ADT_AUDIT_DATA_UNKNOWN")) return G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN; /* `ADT_AUDIT_DATA_UNKNOWN */ else if (val == caml_hash_variant("OBJECT_PATH_IN_USE")) return G_DBUS_ERROR_OBJECT_PATH_IN_USE; /* `OBJECT_PATH_IN_USE */ +#if GLIB_CHECK_VERSION(2,42,0) else if (val == caml_hash_variant("UNKNOWN_OBJECT")) return G_DBUS_ERROR_UNKNOWN_OBJECT; /* `UNKNOWN_OBJECT */ + +#else + else if (val == caml_hash_variant("UNKNOWN_OBJECT")) caml_failwith("GDBusError.UNKNOWN_OBJECT requires 2.42"); +#endif +#if GLIB_CHECK_VERSION(2,42,0) else if (val == caml_hash_variant("UNKNOWN_INTERFACE")) return G_DBUS_ERROR_UNKNOWN_INTERFACE; /* `UNKNOWN_INTERFACE */ + +#else + else if (val == caml_hash_variant("UNKNOWN_INTERFACE")) caml_failwith("GDBusError.UNKNOWN_INTERFACE requires 2.42"); +#endif +#if GLIB_CHECK_VERSION(2,42,0) else if (val == caml_hash_variant("UNKNOWN_PROPERTY")) return G_DBUS_ERROR_UNKNOWN_PROPERTY; /* `UNKNOWN_PROPERTY */ + +#else + else if (val == caml_hash_variant("UNKNOWN_PROPERTY")) caml_failwith("GDBusError.UNKNOWN_PROPERTY requires 2.42"); +#endif +#if GLIB_CHECK_VERSION(2,42,0) else if (val == caml_hash_variant("PROPERTY_READ_ONLY")) return G_DBUS_ERROR_PROPERTY_READ_ONLY; /* `PROPERTY_READ_ONLY */ + +#else + else if (val == caml_hash_variant("PROPERTY_READ_ONLY")) caml_failwith("GDBusError.PROPERTY_READ_ONLY requires 2.42"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GDBusError tag: %ld", val); @@ -505,7 +537,10 @@ value Val_GioFileAttributeType(GFileAttributeType val) { case G_FILE_ATTRIBUTE_TYPE_UINT64: return caml_hash_variant("UINT64"); /* `UINT64 */ case G_FILE_ATTRIBUTE_TYPE_INT64: return caml_hash_variant("INT64"); /* `INT64 */ case G_FILE_ATTRIBUTE_TYPE_OBJECT: return caml_hash_variant("OBJECT"); /* `OBJECT */ +#if GLIB_CHECK_VERSION(2,22,0) case G_FILE_ATTRIBUTE_TYPE_STRINGV: return caml_hash_variant("STRINGV"); /* `STRINGV */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GFileAttributeType value: %d", (int)val); @@ -526,7 +561,12 @@ GFileAttributeType GioFileAttributeType_val(value val) { else if (val == caml_hash_variant("UINT64")) return G_FILE_ATTRIBUTE_TYPE_UINT64; /* `UINT64 */ else if (val == caml_hash_variant("INT64")) return G_FILE_ATTRIBUTE_TYPE_INT64; /* `INT64 */ else if (val == caml_hash_variant("OBJECT")) return G_FILE_ATTRIBUTE_TYPE_OBJECT; /* `OBJECT */ +#if GLIB_CHECK_VERSION(2,22,0) else if (val == caml_hash_variant("STRINGV")) return G_FILE_ATTRIBUTE_TYPE_STRINGV; /* `STRINGV */ + +#else + else if (val == caml_hash_variant("STRINGV")) caml_failwith("GFileAttributeType.STRINGV requires 2.22"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GFileAttributeType tag: %ld", val); @@ -546,9 +586,18 @@ value Val_GioFileMonitorEvent(GFileMonitorEvent val) { case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: return caml_hash_variant("PRE_UNMOUNT"); /* `PRE_UNMOUNT */ case G_FILE_MONITOR_EVENT_UNMOUNTED: return caml_hash_variant("UNMOUNTED"); /* `UNMOUNTED */ case G_FILE_MONITOR_EVENT_MOVED: return caml_hash_variant("MOVED"); /* `MOVED */ +#if GLIB_CHECK_VERSION(2,46,0) case G_FILE_MONITOR_EVENT_RENAMED: return caml_hash_variant("RENAMED"); /* `RENAMED */ + +#endif +#if GLIB_CHECK_VERSION(2,46,0) case G_FILE_MONITOR_EVENT_MOVED_IN: return caml_hash_variant("MOVED_IN"); /* `MOVED_IN */ + +#endif +#if GLIB_CHECK_VERSION(2,46,0) case G_FILE_MONITOR_EVENT_MOVED_OUT: return caml_hash_variant("MOVED_OUT"); /* `MOVED_OUT */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GFileMonitorEvent value: %d", (int)val); @@ -568,9 +617,24 @@ GFileMonitorEvent GioFileMonitorEvent_val(value val) { else if (val == caml_hash_variant("PRE_UNMOUNT")) return G_FILE_MONITOR_EVENT_PRE_UNMOUNT; /* `PRE_UNMOUNT */ else if (val == caml_hash_variant("UNMOUNTED")) return G_FILE_MONITOR_EVENT_UNMOUNTED; /* `UNMOUNTED */ else if (val == caml_hash_variant("MOVED")) return G_FILE_MONITOR_EVENT_MOVED; /* `MOVED */ +#if GLIB_CHECK_VERSION(2,46,0) else if (val == caml_hash_variant("RENAMED")) return G_FILE_MONITOR_EVENT_RENAMED; /* `RENAMED */ + +#else + else if (val == caml_hash_variant("RENAMED")) caml_failwith("GFileMonitorEvent.RENAMED requires 2.46"); +#endif +#if GLIB_CHECK_VERSION(2,46,0) else if (val == caml_hash_variant("MOVED_IN")) return G_FILE_MONITOR_EVENT_MOVED_IN; /* `MOVED_IN */ + +#else + else if (val == caml_hash_variant("MOVED_IN")) caml_failwith("GFileMonitorEvent.MOVED_IN requires 2.46"); +#endif +#if GLIB_CHECK_VERSION(2,46,0) else if (val == caml_hash_variant("MOVED_OUT")) return G_FILE_MONITOR_EVENT_MOVED_OUT; /* `MOVED_OUT */ + +#else + else if (val == caml_hash_variant("MOVED_OUT")) caml_failwith("GFileMonitorEvent.MOVED_OUT requires 2.46"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GFileMonitorEvent tag: %ld", val); @@ -677,24 +741,78 @@ value Val_GioIOErrorEnum(GIOErrorEnum val) { case G_IO_ERROR_HOST_NOT_FOUND: return caml_hash_variant("HOST_NOT_FOUND"); /* `HOST_NOT_FOUND */ case G_IO_ERROR_WOULD_MERGE: return caml_hash_variant("WOULD_MERGE"); /* `WOULD_MERGE */ case G_IO_ERROR_FAILED_HANDLED: return caml_hash_variant("FAILED_HANDLED"); /* `FAILED_HANDLED */ +#if GLIB_CHECK_VERSION(2,20,0) case G_IO_ERROR_TOO_MANY_OPEN_FILES: return caml_hash_variant("TOO_MANY_OPEN_FILES"); /* `TOO_MANY_OPEN_FILES */ + +#endif +#if GLIB_CHECK_VERSION(2,22,0) case G_IO_ERROR_NOT_INITIALIZED: return caml_hash_variant("NOT_INITIALIZED"); /* `NOT_INITIALIZED */ + +#endif +#if GLIB_CHECK_VERSION(2,22,0) case G_IO_ERROR_ADDRESS_IN_USE: return caml_hash_variant("ADDRESS_IN_USE"); /* `ADDRESS_IN_USE */ + +#endif +#if GLIB_CHECK_VERSION(2,24,0) case G_IO_ERROR_PARTIAL_INPUT: return caml_hash_variant("PARTIAL_INPUT"); /* `PARTIAL_INPUT */ + +#endif +#if GLIB_CHECK_VERSION(2,24,0) case G_IO_ERROR_INVALID_DATA: return caml_hash_variant("INVALID_DATA"); /* `INVALID_DATA */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_DBUS_ERROR: return caml_hash_variant("DBUS_ERROR"); /* `DBUS_ERROR */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_HOST_UNREACHABLE: return caml_hash_variant("HOST_UNREACHABLE"); /* `HOST_UNREACHABLE */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_NETWORK_UNREACHABLE: return caml_hash_variant("NETWORK_UNREACHABLE"); /* `NETWORK_UNREACHABLE */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_CONNECTION_REFUSED: return caml_hash_variant("CONNECTION_REFUSED"); /* `CONNECTION_REFUSED */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_PROXY_FAILED: return caml_hash_variant("PROXY_FAILED"); /* `PROXY_FAILED */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_PROXY_AUTH_FAILED: return caml_hash_variant("PROXY_AUTH_FAILED"); /* `PROXY_AUTH_FAILED */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_PROXY_NEED_AUTH: return caml_hash_variant("PROXY_NEED_AUTH"); /* `PROXY_NEED_AUTH */ + +#endif +#if GLIB_CHECK_VERSION(2,26,0) case G_IO_ERROR_PROXY_NOT_ALLOWED: return caml_hash_variant("PROXY_NOT_ALLOWED"); /* `PROXY_NOT_ALLOWED */ + +#endif +#if GLIB_CHECK_VERSION(2,36,0) case G_IO_ERROR_BROKEN_PIPE: return caml_hash_variant("BROKEN_PIPE"); /* `BROKEN_PIPE */ + +#endif +#if GLIB_CHECK_VERSION(2,44,0) case G_IO_ERROR_NOT_CONNECTED: return caml_hash_variant("NOT_CONNECTED"); /* `NOT_CONNECTED */ + +#endif +#if GLIB_CHECK_VERSION(2,48,0) case G_IO_ERROR_MESSAGE_TOO_LARGE: return caml_hash_variant("MESSAGE_TOO_LARGE"); /* `MESSAGE_TOO_LARGE */ + +#endif +#if GLIB_CHECK_VERSION(2,74,0) case G_IO_ERROR_NO_SUCH_DEVICE: return caml_hash_variant("NO_SUCH_DEVICE"); /* `NO_SUCH_DEVICE */ + +#endif +#if GLIB_CHECK_VERSION(2,80,0) case G_IO_ERROR_DESTINATION_UNSET: return caml_hash_variant("DESTINATION_UNSET"); /* `DESTINATION_UNSET */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GIOErrorEnum value: %d", (int)val); @@ -737,25 +855,120 @@ GIOErrorEnum GioIOErrorEnum_val(value val) { else if (val == caml_hash_variant("HOST_NOT_FOUND")) return G_IO_ERROR_HOST_NOT_FOUND; /* `HOST_NOT_FOUND */ else if (val == caml_hash_variant("WOULD_MERGE")) return G_IO_ERROR_WOULD_MERGE; /* `WOULD_MERGE */ else if (val == caml_hash_variant("FAILED_HANDLED")) return G_IO_ERROR_FAILED_HANDLED; /* `FAILED_HANDLED */ +#if GLIB_CHECK_VERSION(2,20,0) else if (val == caml_hash_variant("TOO_MANY_OPEN_FILES")) return G_IO_ERROR_TOO_MANY_OPEN_FILES; /* `TOO_MANY_OPEN_FILES */ + +#else + else if (val == caml_hash_variant("TOO_MANY_OPEN_FILES")) caml_failwith("GIOErrorEnum.TOO_MANY_OPEN_FILES requires 2.20"); +#endif +#if GLIB_CHECK_VERSION(2,22,0) else if (val == caml_hash_variant("NOT_INITIALIZED")) return G_IO_ERROR_NOT_INITIALIZED; /* `NOT_INITIALIZED */ + +#else + else if (val == caml_hash_variant("NOT_INITIALIZED")) caml_failwith("GIOErrorEnum.NOT_INITIALIZED requires 2.22"); +#endif +#if GLIB_CHECK_VERSION(2,22,0) else if (val == caml_hash_variant("ADDRESS_IN_USE")) return G_IO_ERROR_ADDRESS_IN_USE; /* `ADDRESS_IN_USE */ + +#else + else if (val == caml_hash_variant("ADDRESS_IN_USE")) caml_failwith("GIOErrorEnum.ADDRESS_IN_USE requires 2.22"); +#endif +#if GLIB_CHECK_VERSION(2,24,0) else if (val == caml_hash_variant("PARTIAL_INPUT")) return G_IO_ERROR_PARTIAL_INPUT; /* `PARTIAL_INPUT */ + +#else + else if (val == caml_hash_variant("PARTIAL_INPUT")) caml_failwith("GIOErrorEnum.PARTIAL_INPUT requires 2.24"); +#endif +#if GLIB_CHECK_VERSION(2,24,0) else if (val == caml_hash_variant("INVALID_DATA")) return G_IO_ERROR_INVALID_DATA; /* `INVALID_DATA */ + +#else + else if (val == caml_hash_variant("INVALID_DATA")) caml_failwith("GIOErrorEnum.INVALID_DATA requires 2.24"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("DBUS_ERROR")) return G_IO_ERROR_DBUS_ERROR; /* `DBUS_ERROR */ + +#else + else if (val == caml_hash_variant("DBUS_ERROR")) caml_failwith("GIOErrorEnum.DBUS_ERROR requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("HOST_UNREACHABLE")) return G_IO_ERROR_HOST_UNREACHABLE; /* `HOST_UNREACHABLE */ + +#else + else if (val == caml_hash_variant("HOST_UNREACHABLE")) caml_failwith("GIOErrorEnum.HOST_UNREACHABLE requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("NETWORK_UNREACHABLE")) return G_IO_ERROR_NETWORK_UNREACHABLE; /* `NETWORK_UNREACHABLE */ + +#else + else if (val == caml_hash_variant("NETWORK_UNREACHABLE")) caml_failwith("GIOErrorEnum.NETWORK_UNREACHABLE requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("CONNECTION_REFUSED")) return G_IO_ERROR_CONNECTION_REFUSED; /* `CONNECTION_REFUSED */ + +#else + else if (val == caml_hash_variant("CONNECTION_REFUSED")) caml_failwith("GIOErrorEnum.CONNECTION_REFUSED requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("PROXY_FAILED")) return G_IO_ERROR_PROXY_FAILED; /* `PROXY_FAILED */ + +#else + else if (val == caml_hash_variant("PROXY_FAILED")) caml_failwith("GIOErrorEnum.PROXY_FAILED requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("PROXY_AUTH_FAILED")) return G_IO_ERROR_PROXY_AUTH_FAILED; /* `PROXY_AUTH_FAILED */ + +#else + else if (val == caml_hash_variant("PROXY_AUTH_FAILED")) caml_failwith("GIOErrorEnum.PROXY_AUTH_FAILED requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("PROXY_NEED_AUTH")) return G_IO_ERROR_PROXY_NEED_AUTH; /* `PROXY_NEED_AUTH */ + +#else + else if (val == caml_hash_variant("PROXY_NEED_AUTH")) caml_failwith("GIOErrorEnum.PROXY_NEED_AUTH requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,26,0) else if (val == caml_hash_variant("PROXY_NOT_ALLOWED")) return G_IO_ERROR_PROXY_NOT_ALLOWED; /* `PROXY_NOT_ALLOWED */ + +#else + else if (val == caml_hash_variant("PROXY_NOT_ALLOWED")) caml_failwith("GIOErrorEnum.PROXY_NOT_ALLOWED requires 2.26"); +#endif +#if GLIB_CHECK_VERSION(2,36,0) else if (val == caml_hash_variant("BROKEN_PIPE")) return G_IO_ERROR_BROKEN_PIPE; /* `BROKEN_PIPE */ + +#else + else if (val == caml_hash_variant("BROKEN_PIPE")) caml_failwith("GIOErrorEnum.BROKEN_PIPE requires 2.36"); +#endif +#if GLIB_CHECK_VERSION(2,44,0) else if (val == caml_hash_variant("CONNECTION_CLOSED")) return G_IO_ERROR_CONNECTION_CLOSED; /* `CONNECTION_CLOSED */ + +#else + else if (val == caml_hash_variant("CONNECTION_CLOSED")) caml_failwith("GIOErrorEnum.CONNECTION_CLOSED requires 2.44"); +#endif +#if GLIB_CHECK_VERSION(2,44,0) else if (val == caml_hash_variant("NOT_CONNECTED")) return G_IO_ERROR_NOT_CONNECTED; /* `NOT_CONNECTED */ + +#else + else if (val == caml_hash_variant("NOT_CONNECTED")) caml_failwith("GIOErrorEnum.NOT_CONNECTED requires 2.44"); +#endif +#if GLIB_CHECK_VERSION(2,48,0) else if (val == caml_hash_variant("MESSAGE_TOO_LARGE")) return G_IO_ERROR_MESSAGE_TOO_LARGE; /* `MESSAGE_TOO_LARGE */ + +#else + else if (val == caml_hash_variant("MESSAGE_TOO_LARGE")) caml_failwith("GIOErrorEnum.MESSAGE_TOO_LARGE requires 2.48"); +#endif +#if GLIB_CHECK_VERSION(2,74,0) else if (val == caml_hash_variant("NO_SUCH_DEVICE")) return G_IO_ERROR_NO_SUCH_DEVICE; /* `NO_SUCH_DEVICE */ + +#else + else if (val == caml_hash_variant("NO_SUCH_DEVICE")) caml_failwith("GIOErrorEnum.NO_SUCH_DEVICE requires 2.74"); +#endif +#if GLIB_CHECK_VERSION(2,80,0) else if (val == caml_hash_variant("DESTINATION_UNSET")) return G_IO_ERROR_DESTINATION_UNSET; /* `DESTINATION_UNSET */ + +#else + else if (val == caml_hash_variant("DESTINATION_UNSET")) caml_failwith("GIOErrorEnum.DESTINATION_UNSET requires 2.80"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GIOErrorEnum tag: %ld", val); @@ -1348,7 +1561,10 @@ value Val_GioTlsChannelBindingType(GTlsChannelBindingType val) { switch (val) { case G_TLS_CHANNEL_BINDING_TLS_UNIQUE: return caml_hash_variant("UNIQUE"); /* `UNIQUE */ case G_TLS_CHANNEL_BINDING_TLS_SERVER_END_POINT: return caml_hash_variant("SERVER_END_POINT"); /* `SERVER_END_POINT */ +#if GLIB_CHECK_VERSION(2,74,0) case G_TLS_CHANNEL_BINDING_TLS_EXPORTER: return caml_hash_variant("EXPORTER"); /* `EXPORTER */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GTlsChannelBindingType value: %d", (int)val); @@ -1362,7 +1578,12 @@ value Val_GioTlsChannelBindingType(GTlsChannelBindingType val) { GTlsChannelBindingType GioTlsChannelBindingType_val(value val) { if (val == caml_hash_variant("UNIQUE")) return G_TLS_CHANNEL_BINDING_TLS_UNIQUE; /* `UNIQUE */ else if (val == caml_hash_variant("SERVER_END_POINT")) return G_TLS_CHANNEL_BINDING_TLS_SERVER_END_POINT; /* `SERVER_END_POINT */ +#if GLIB_CHECK_VERSION(2,74,0) else if (val == caml_hash_variant("EXPORTER")) return G_TLS_CHANNEL_BINDING_TLS_EXPORTER; /* `EXPORTER */ + +#else + else if (val == caml_hash_variant("EXPORTER")) caml_failwith("GTlsChannelBindingType.EXPORTER requires 2.74"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GTlsChannelBindingType tag: %ld", val); @@ -1413,8 +1634,14 @@ value Val_GioTlsError(GTlsError val) { case G_TLS_ERROR_HANDSHAKE: return caml_hash_variant("HANDSHAKE"); /* `HANDSHAKE */ case G_TLS_ERROR_CERTIFICATE_REQUIRED: return caml_hash_variant("CERTIFICATE_REQUIRED"); /* `CERTIFICATE_REQUIRED */ case G_TLS_ERROR_EOF: return caml_hash_variant("EOF"); /* `EOF */ +#if GLIB_CHECK_VERSION(2,60,0) case G_TLS_ERROR_INAPPROPRIATE_FALLBACK: return caml_hash_variant("INAPPROPRIATE_FALLBACK"); /* `INAPPROPRIATE_FALLBACK */ + +#endif +#if GLIB_CHECK_VERSION(2,72,0) case G_TLS_ERROR_BAD_CERTIFICATE_PASSWORD: return caml_hash_variant("BAD_CERTIFICATE_PASSWORD"); /* `BAD_CERTIFICATE_PASSWORD */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GTlsError value: %d", (int)val); @@ -1433,8 +1660,18 @@ GTlsError GioTlsError_val(value val) { else if (val == caml_hash_variant("HANDSHAKE")) return G_TLS_ERROR_HANDSHAKE; /* `HANDSHAKE */ else if (val == caml_hash_variant("CERTIFICATE_REQUIRED")) return G_TLS_ERROR_CERTIFICATE_REQUIRED; /* `CERTIFICATE_REQUIRED */ else if (val == caml_hash_variant("EOF")) return G_TLS_ERROR_EOF; /* `EOF */ +#if GLIB_CHECK_VERSION(2,60,0) else if (val == caml_hash_variant("INAPPROPRIATE_FALLBACK")) return G_TLS_ERROR_INAPPROPRIATE_FALLBACK; /* `INAPPROPRIATE_FALLBACK */ + +#else + else if (val == caml_hash_variant("INAPPROPRIATE_FALLBACK")) caml_failwith("GTlsError.INAPPROPRIATE_FALLBACK requires 2.60"); +#endif +#if GLIB_CHECK_VERSION(2,72,0) else if (val == caml_hash_variant("BAD_CERTIFICATE_PASSWORD")) return G_TLS_ERROR_BAD_CERTIFICATE_PASSWORD; /* `BAD_CERTIFICATE_PASSWORD */ + +#else + else if (val == caml_hash_variant("BAD_CERTIFICATE_PASSWORD")) caml_failwith("GTlsError.BAD_CERTIFICATE_PASSWORD requires 2.72"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GTlsError tag: %ld", val); @@ -1638,6 +1875,7 @@ value Val_GioAppInfoCreateFlags(GAppInfoCreateFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,26,0) if (flags & G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("SUPPORTS_STARTUP_NOTIFICATION"))); /* `SUPPORTS_STARTUP_NOTIFICATION */ @@ -1645,6 +1883,8 @@ value Val_GioAppInfoCreateFlags(GAppInfoCreateFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -1656,7 +1896,12 @@ GAppInfoCreateFlags GioAppInfoCreateFlags_val(value list) { if (tag == caml_hash_variant("NONE")) result |= G_APP_INFO_CREATE_NONE; /* `NONE */ else if (tag == caml_hash_variant("NEEDS_TERMINAL")) result |= G_APP_INFO_CREATE_NEEDS_TERMINAL; /* `NEEDS_TERMINAL */ else if (tag == caml_hash_variant("SUPPORTS_URIS")) result |= G_APP_INFO_CREATE_SUPPORTS_URIS; /* `SUPPORTS_URIS */ +#if GLIB_CHECK_VERSION(2,26,0) else if (tag == caml_hash_variant("SUPPORTS_STARTUP_NOTIFICATION")) result |= G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION; /* `SUPPORTS_STARTUP_NOTIFICATION */ + +#else + else if (tag == caml_hash_variant("SUPPORTS_STARTUP_NOTIFICATION")) caml_failwith("GAppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION requires 2.26"); +#endif list = Field(list, 1); } return result; @@ -1675,12 +1920,15 @@ value Val_GioApplicationFlags(GApplicationFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,74,0) if (flags & G_APPLICATION_DEFAULT_FLAGS) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("DEFAULT_FLAGS"))); /* `DEFAULT_FLAGS */ Store_field(cons, 1, result); result = cons; } + +#endif if (flags & G_APPLICATION_IS_SERVICE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("IS_SERVICE"))); /* `IS_SERVICE */ @@ -1711,24 +1959,34 @@ value Val_GioApplicationFlags(GApplicationFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,30,0) if (flags & G_APPLICATION_NON_UNIQUE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("NON_UNIQUE"))); /* `NON_UNIQUE */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,48,0) if (flags & G_APPLICATION_CAN_OVERRIDE_APP_ID) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("CAN_OVERRIDE_APP_ID"))); /* `CAN_OVERRIDE_APP_ID */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,60,0) if (flags & G_APPLICATION_ALLOW_REPLACEMENT) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("ALLOW_REPLACEMENT"))); /* `ALLOW_REPLACEMENT */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,60,0) if (flags & G_APPLICATION_REPLACE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("REPLACE"))); /* `REPLACE */ @@ -1736,6 +1994,8 @@ value Val_GioApplicationFlags(GApplicationFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -1745,16 +2005,41 @@ GApplicationFlags GioApplicationFlags_val(value list) { while (list != Val_emptylist) { int tag = Int_val(Field(list, 0)); if (tag == caml_hash_variant("FLAGS_NONE")) result |= G_APPLICATION_FLAGS_NONE; /* `FLAGS_NONE */ +#if GLIB_CHECK_VERSION(2,74,0) else if (tag == caml_hash_variant("DEFAULT_FLAGS")) result |= G_APPLICATION_DEFAULT_FLAGS; /* `DEFAULT_FLAGS */ + +#else + else if (tag == caml_hash_variant("DEFAULT_FLAGS")) caml_failwith("GApplicationFlags.DEFAULT_FLAGS requires 2.74"); +#endif else if (tag == caml_hash_variant("IS_SERVICE")) result |= G_APPLICATION_IS_SERVICE; /* `IS_SERVICE */ else if (tag == caml_hash_variant("IS_LAUNCHER")) result |= G_APPLICATION_IS_LAUNCHER; /* `IS_LAUNCHER */ else if (tag == caml_hash_variant("HANDLES_OPEN")) result |= G_APPLICATION_HANDLES_OPEN; /* `HANDLES_OPEN */ else if (tag == caml_hash_variant("HANDLES_COMMAND_LINE")) result |= G_APPLICATION_HANDLES_COMMAND_LINE; /* `HANDLES_COMMAND_LINE */ else if (tag == caml_hash_variant("SEND_ENVIRONMENT")) result |= G_APPLICATION_SEND_ENVIRONMENT; /* `SEND_ENVIRONMENT */ +#if GLIB_CHECK_VERSION(2,30,0) else if (tag == caml_hash_variant("NON_UNIQUE")) result |= G_APPLICATION_NON_UNIQUE; /* `NON_UNIQUE */ + +#else + else if (tag == caml_hash_variant("NON_UNIQUE")) caml_failwith("GApplicationFlags.NON_UNIQUE requires 2.30"); +#endif +#if GLIB_CHECK_VERSION(2,48,0) else if (tag == caml_hash_variant("CAN_OVERRIDE_APP_ID")) result |= G_APPLICATION_CAN_OVERRIDE_APP_ID; /* `CAN_OVERRIDE_APP_ID */ + +#else + else if (tag == caml_hash_variant("CAN_OVERRIDE_APP_ID")) caml_failwith("GApplicationFlags.CAN_OVERRIDE_APP_ID requires 2.48"); +#endif +#if GLIB_CHECK_VERSION(2,60,0) else if (tag == caml_hash_variant("ALLOW_REPLACEMENT")) result |= G_APPLICATION_ALLOW_REPLACEMENT; /* `ALLOW_REPLACEMENT */ + +#else + else if (tag == caml_hash_variant("ALLOW_REPLACEMENT")) caml_failwith("GApplicationFlags.ALLOW_REPLACEMENT requires 2.60"); +#endif +#if GLIB_CHECK_VERSION(2,60,0) else if (tag == caml_hash_variant("REPLACE")) result |= G_APPLICATION_REPLACE; /* `REPLACE */ + +#else + else if (tag == caml_hash_variant("REPLACE")) caml_failwith("GApplicationFlags.REPLACE requires 2.60"); +#endif list = Field(list, 1); } return result; @@ -1798,6 +2083,7 @@ value Val_GioAskPasswordFlags(GAskPasswordFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,58,0) if (flags & G_ASK_PASSWORD_TCRYPT) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("TCRYPT"))); /* `TCRYPT */ @@ -1805,6 +2091,8 @@ value Val_GioAskPasswordFlags(GAskPasswordFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -1818,7 +2106,12 @@ GAskPasswordFlags GioAskPasswordFlags_val(value list) { else if (tag == caml_hash_variant("NEED_DOMAIN")) result |= G_ASK_PASSWORD_NEED_DOMAIN; /* `NEED_DOMAIN */ else if (tag == caml_hash_variant("SAVING_SUPPORTED")) result |= G_ASK_PASSWORD_SAVING_SUPPORTED; /* `SAVING_SUPPORTED */ else if (tag == caml_hash_variant("ANONYMOUS_SUPPORTED")) result |= G_ASK_PASSWORD_ANONYMOUS_SUPPORTED; /* `ANONYMOUS_SUPPORTED */ +#if GLIB_CHECK_VERSION(2,58,0) else if (tag == caml_hash_variant("TCRYPT")) result |= G_ASK_PASSWORD_TCRYPT; /* `TCRYPT */ + +#else + else if (tag == caml_hash_variant("TCRYPT")) caml_failwith("GAskPasswordFlags.TCRYPT requires 2.58"); +#endif list = Field(list, 1); } return result; @@ -1849,6 +2142,7 @@ value Val_GioBusNameOwnerFlags(GBusNameOwnerFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,54,0) if (flags & G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("DO_NOT_QUEUE"))); /* `DO_NOT_QUEUE */ @@ -1856,6 +2150,8 @@ value Val_GioBusNameOwnerFlags(GBusNameOwnerFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -1867,7 +2163,12 @@ GBusNameOwnerFlags GioBusNameOwnerFlags_val(value list) { if (tag == caml_hash_variant("NONE")) result |= G_BUS_NAME_OWNER_FLAGS_NONE; /* `NONE */ else if (tag == caml_hash_variant("ALLOW_REPLACEMENT")) result |= G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT; /* `ALLOW_REPLACEMENT */ else if (tag == caml_hash_variant("REPLACE")) result |= G_BUS_NAME_OWNER_FLAGS_REPLACE; /* `REPLACE */ +#if GLIB_CHECK_VERSION(2,54,0) else if (tag == caml_hash_variant("DO_NOT_QUEUE")) result |= G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE; /* `DO_NOT_QUEUE */ + +#else + else if (tag == caml_hash_variant("DO_NOT_QUEUE")) caml_failwith("GBusNameOwnerFlags.DO_NOT_QUEUE requires 2.54"); +#endif list = Field(list, 1); } return result; @@ -1975,6 +2276,7 @@ value Val_GioDBusCallFlags(GDBusCallFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,46,0) if (flags & G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("ALLOW_INTERACTIVE_AUTHORIZATION"))); /* `ALLOW_INTERACTIVE_AUTHORIZATION */ @@ -1982,6 +2284,8 @@ value Val_GioDBusCallFlags(GDBusCallFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -1992,7 +2296,12 @@ GDBusCallFlags GioDBusCallFlags_val(value list) { int tag = Int_val(Field(list, 0)); if (tag == caml_hash_variant("NONE")) result |= G_DBUS_CALL_FLAGS_NONE; /* `NONE */ else if (tag == caml_hash_variant("NO_AUTO_START")) result |= G_DBUS_CALL_FLAGS_NO_AUTO_START; /* `NO_AUTO_START */ +#if GLIB_CHECK_VERSION(2,46,0) else if (tag == caml_hash_variant("ALLOW_INTERACTIVE_AUTHORIZATION")) result |= G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION; /* `ALLOW_INTERACTIVE_AUTHORIZATION */ + +#else + else if (tag == caml_hash_variant("ALLOW_INTERACTIVE_AUTHORIZATION")) caml_failwith("GDBusCallFlags.ALLOW_INTERACTIVE_AUTHORIZATION requires 2.46"); +#endif list = Field(list, 1); } return result; @@ -2080,12 +2389,16 @@ value Val_GioDBusConnectionFlags(GDBusConnectionFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,68,0) if (flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("AUTHENTICATION_REQUIRE_SAME_USER"))); /* `AUTHENTICATION_REQUIRE_SAME_USER */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,74,0) if (flags & G_DBUS_CONNECTION_FLAGS_CROSS_NAMESPACE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("CROSS_NAMESPACE"))); /* `CROSS_NAMESPACE */ @@ -2093,6 +2406,8 @@ value Val_GioDBusConnectionFlags(GDBusConnectionFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2107,8 +2422,18 @@ GDBusConnectionFlags GioDBusConnectionFlags_val(value list) { else if (tag == caml_hash_variant("AUTHENTICATION_ALLOW_ANONYMOUS")) result |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; /* `AUTHENTICATION_ALLOW_ANONYMOUS */ else if (tag == caml_hash_variant("MESSAGE_BUS_CONNECTION")) result |= G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION; /* `MESSAGE_BUS_CONNECTION */ else if (tag == caml_hash_variant("DELAY_MESSAGE_PROCESSING")) result |= G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING; /* `DELAY_MESSAGE_PROCESSING */ +#if GLIB_CHECK_VERSION(2,68,0) else if (tag == caml_hash_variant("AUTHENTICATION_REQUIRE_SAME_USER")) result |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER; /* `AUTHENTICATION_REQUIRE_SAME_USER */ + +#else + else if (tag == caml_hash_variant("AUTHENTICATION_REQUIRE_SAME_USER")) caml_failwith("GDBusConnectionFlags.AUTHENTICATION_REQUIRE_SAME_USER requires 2.68"); +#endif +#if GLIB_CHECK_VERSION(2,74,0) else if (tag == caml_hash_variant("CROSS_NAMESPACE")) result |= G_DBUS_CONNECTION_FLAGS_CROSS_NAMESPACE; /* `CROSS_NAMESPACE */ + +#else + else if (tag == caml_hash_variant("CROSS_NAMESPACE")) caml_failwith("GDBusConnectionFlags.CROSS_NAMESPACE requires 2.74"); +#endif list = Field(list, 1); } return result; @@ -2178,6 +2503,7 @@ value Val_GioDBusMessageFlags(GDBusMessageFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,46,0) if (flags & G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("ALLOW_INTERACTIVE_AUTHORIZATION"))); /* `ALLOW_INTERACTIVE_AUTHORIZATION */ @@ -2185,6 +2511,8 @@ value Val_GioDBusMessageFlags(GDBusMessageFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2196,7 +2524,12 @@ GDBusMessageFlags GioDBusMessageFlags_val(value list) { if (tag == caml_hash_variant("NONE")) result |= G_DBUS_MESSAGE_FLAGS_NONE; /* `NONE */ else if (tag == caml_hash_variant("NO_REPLY_EXPECTED")) result |= G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED; /* `NO_REPLY_EXPECTED */ else if (tag == caml_hash_variant("NO_AUTO_START")) result |= G_DBUS_MESSAGE_FLAGS_NO_AUTO_START; /* `NO_AUTO_START */ +#if GLIB_CHECK_VERSION(2,46,0) else if (tag == caml_hash_variant("ALLOW_INTERACTIVE_AUTHORIZATION")) result |= G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION; /* `ALLOW_INTERACTIVE_AUTHORIZATION */ + +#else + else if (tag == caml_hash_variant("ALLOW_INTERACTIVE_AUTHORIZATION")) caml_failwith("GDBusMessageFlags.ALLOW_INTERACTIVE_AUTHORIZATION requires 2.46"); +#endif list = Field(list, 1); } return result; @@ -2316,18 +2649,22 @@ value Val_GioDBusProxyFlags(GDBusProxyFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,32,0) if (flags & G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("GET_INVALIDATED_PROPERTIES"))); /* `GET_INVALIDATED_PROPERTIES */ Store_field(cons, 1, result); result = cons; } + +#endif if (flags & G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("DO_NOT_AUTO_START_AT_CONSTRUCTION"))); /* `DO_NOT_AUTO_START_AT_CONSTRUCTION */ Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,72,0) if (flags & G_DBUS_PROXY_FLAGS_NO_MATCH_RULE) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("NO_MATCH_RULE"))); /* `NO_MATCH_RULE */ @@ -2335,6 +2672,8 @@ value Val_GioDBusProxyFlags(GDBusProxyFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2347,9 +2686,19 @@ GDBusProxyFlags GioDBusProxyFlags_val(value list) { else if (tag == caml_hash_variant("DO_NOT_LOAD_PROPERTIES")) result |= G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES; /* `DO_NOT_LOAD_PROPERTIES */ else if (tag == caml_hash_variant("DO_NOT_CONNECT_SIGNALS")) result |= G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS; /* `DO_NOT_CONNECT_SIGNALS */ else if (tag == caml_hash_variant("DO_NOT_AUTO_START")) result |= G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START; /* `DO_NOT_AUTO_START */ +#if GLIB_CHECK_VERSION(2,32,0) else if (tag == caml_hash_variant("GET_INVALIDATED_PROPERTIES")) result |= G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES; /* `GET_INVALIDATED_PROPERTIES */ + +#else + else if (tag == caml_hash_variant("GET_INVALIDATED_PROPERTIES")) caml_failwith("GDBusProxyFlags.GET_INVALIDATED_PROPERTIES requires 2.32"); +#endif else if (tag == caml_hash_variant("DO_NOT_AUTO_START_AT_CONSTRUCTION")) result |= G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION; /* `DO_NOT_AUTO_START_AT_CONSTRUCTION */ +#if GLIB_CHECK_VERSION(2,72,0) else if (tag == caml_hash_variant("NO_MATCH_RULE")) result |= G_DBUS_PROXY_FLAGS_NO_MATCH_RULE; /* `NO_MATCH_RULE */ + +#else + else if (tag == caml_hash_variant("NO_MATCH_RULE")) caml_failwith("GDBusProxyFlags.NO_MATCH_RULE requires 2.72"); +#endif list = Field(list, 1); } return result; @@ -2419,6 +2768,7 @@ value Val_GioDBusServerFlags(GDBusServerFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,68,0) if (flags & G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("AUTHENTICATION_REQUIRE_SAME_USER"))); /* `AUTHENTICATION_REQUIRE_SAME_USER */ @@ -2426,6 +2776,8 @@ value Val_GioDBusServerFlags(GDBusServerFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2437,7 +2789,12 @@ GDBusServerFlags GioDBusServerFlags_val(value list) { if (tag == caml_hash_variant("NONE")) result |= G_DBUS_SERVER_FLAGS_NONE; /* `NONE */ else if (tag == caml_hash_variant("RUN_IN_THREAD")) result |= G_DBUS_SERVER_FLAGS_RUN_IN_THREAD; /* `RUN_IN_THREAD */ else if (tag == caml_hash_variant("AUTHENTICATION_ALLOW_ANONYMOUS")) result |= G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; /* `AUTHENTICATION_ALLOW_ANONYMOUS */ +#if GLIB_CHECK_VERSION(2,68,0) else if (tag == caml_hash_variant("AUTHENTICATION_REQUIRE_SAME_USER")) result |= G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER; /* `AUTHENTICATION_REQUIRE_SAME_USER */ + +#else + else if (tag == caml_hash_variant("AUTHENTICATION_REQUIRE_SAME_USER")) caml_failwith("GDBusServerFlags.AUTHENTICATION_REQUIRE_SAME_USER requires 2.68"); +#endif list = Field(list, 1); } return result; @@ -2652,6 +3009,7 @@ value Val_GioFileCopyFlags(GFileCopyFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,80,0) if (flags & G_FILE_COPY_TARGET_DEFAULT_MODIFIED_TIME) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("TARGET_DEFAULT_MODIFIED_TIME"))); /* `TARGET_DEFAULT_MODIFIED_TIME */ @@ -2659,6 +3017,8 @@ value Val_GioFileCopyFlags(GFileCopyFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2674,7 +3034,12 @@ GFileCopyFlags GioFileCopyFlags_val(value list) { else if (tag == caml_hash_variant("ALL_METADATA")) result |= G_FILE_COPY_ALL_METADATA; /* `ALL_METADATA */ else if (tag == caml_hash_variant("NO_FALLBACK_FOR_MOVE")) result |= G_FILE_COPY_NO_FALLBACK_FOR_MOVE; /* `NO_FALLBACK_FOR_MOVE */ else if (tag == caml_hash_variant("TARGET_DEFAULT_PERMS")) result |= G_FILE_COPY_TARGET_DEFAULT_PERMS; /* `TARGET_DEFAULT_PERMS */ +#if GLIB_CHECK_VERSION(2,80,0) else if (tag == caml_hash_variant("TARGET_DEFAULT_MODIFIED_TIME")) result |= G_FILE_COPY_TARGET_DEFAULT_MODIFIED_TIME; /* `TARGET_DEFAULT_MODIFIED_TIME */ + +#else + else if (tag == caml_hash_variant("TARGET_DEFAULT_MODIFIED_TIME")) caml_failwith("GFileCopyFlags.TARGET_DEFAULT_MODIFIED_TIME requires 2.80"); +#endif list = Field(list, 1); } return result; @@ -2698,6 +3063,7 @@ value Val_GioFileCreateFlags(GFileCreateFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,20,0) if (flags & G_FILE_CREATE_REPLACE_DESTINATION) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("REPLACE_DESTINATION"))); /* `REPLACE_DESTINATION */ @@ -2705,6 +3071,8 @@ value Val_GioFileCreateFlags(GFileCreateFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2715,7 +3083,12 @@ GFileCreateFlags GioFileCreateFlags_val(value list) { int tag = Int_val(Field(list, 0)); if (tag == caml_hash_variant("NONE")) result |= G_FILE_CREATE_NONE; /* `NONE */ else if (tag == caml_hash_variant("PRIVATE")) result |= G_FILE_CREATE_PRIVATE; /* `PRIVATE */ +#if GLIB_CHECK_VERSION(2,20,0) else if (tag == caml_hash_variant("REPLACE_DESTINATION")) result |= G_FILE_CREATE_REPLACE_DESTINATION; /* `REPLACE_DESTINATION */ + +#else + else if (tag == caml_hash_variant("REPLACE_DESTINATION")) caml_failwith("GFileCreateFlags.REPLACE_DESTINATION requires 2.20"); +#endif list = Field(list, 1); } return result; @@ -2796,12 +3169,16 @@ value Val_GioFileMonitorFlags(GFileMonitorFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,36,0) if (flags & G_FILE_MONITOR_WATCH_HARD_LINKS) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("WATCH_HARD_LINKS"))); /* `WATCH_HARD_LINKS */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,46,0) if (flags & G_FILE_MONITOR_WATCH_MOVES) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("WATCH_MOVES"))); /* `WATCH_MOVES */ @@ -2809,6 +3186,8 @@ value Val_GioFileMonitorFlags(GFileMonitorFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -2820,8 +3199,18 @@ GFileMonitorFlags GioFileMonitorFlags_val(value list) { if (tag == caml_hash_variant("NONE")) result |= G_FILE_MONITOR_NONE; /* `NONE */ else if (tag == caml_hash_variant("WATCH_MOUNTS")) result |= G_FILE_MONITOR_WATCH_MOUNTS; /* `WATCH_MOUNTS */ else if (tag == caml_hash_variant("SEND_MOVED")) result |= G_FILE_MONITOR_SEND_MOVED; /* `SEND_MOVED */ +#if GLIB_CHECK_VERSION(2,36,0) else if (tag == caml_hash_variant("WATCH_HARD_LINKS")) result |= G_FILE_MONITOR_WATCH_HARD_LINKS; /* `WATCH_HARD_LINKS */ + +#else + else if (tag == caml_hash_variant("WATCH_HARD_LINKS")) caml_failwith("GFileMonitorFlags.WATCH_HARD_LINKS requires 2.36"); +#endif +#if GLIB_CHECK_VERSION(2,46,0) else if (tag == caml_hash_variant("WATCH_MOVES")) result |= G_FILE_MONITOR_WATCH_MOVES; /* `WATCH_MOVES */ + +#else + else if (tag == caml_hash_variant("WATCH_MOVES")) caml_failwith("GFileMonitorFlags.WATCH_MOVES requires 2.46"); +#endif list = Field(list, 1); } return result; @@ -3299,6 +3688,7 @@ value Val_GioSubprocessFlags(GSubprocessFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,72,0) if (flags & G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("SEARCH_PATH_FROM_ENVP"))); /* `SEARCH_PATH_FROM_ENVP */ @@ -3306,6 +3696,8 @@ value Val_GioSubprocessFlags(GSubprocessFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -3323,7 +3715,12 @@ GSubprocessFlags GioSubprocessFlags_val(value list) { else if (tag == caml_hash_variant("STDERR_SILENCE")) result |= G_SUBPROCESS_FLAGS_STDERR_SILENCE; /* `STDERR_SILENCE */ else if (tag == caml_hash_variant("STDERR_MERGE")) result |= G_SUBPROCESS_FLAGS_STDERR_MERGE; /* `STDERR_MERGE */ else if (tag == caml_hash_variant("INHERIT_FDS")) result |= G_SUBPROCESS_FLAGS_INHERIT_FDS; /* `INHERIT_FDS */ +#if GLIB_CHECK_VERSION(2,72,0) else if (tag == caml_hash_variant("SEARCH_PATH_FROM_ENVP")) result |= G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP; /* `SEARCH_PATH_FROM_ENVP */ + +#else + else if (tag == caml_hash_variant("SEARCH_PATH_FROM_ENVP")) caml_failwith("GSubprocessFlags.SEARCH_PATH_FROM_ENVP requires 2.72"); +#endif list = Field(list, 1); } return result; @@ -3368,12 +3765,15 @@ value Val_GioTlsCertificateFlags(GTlsCertificateFlags flags) { CAMLlocal2(result, cons); result = Val_emptylist; +#if GLIB_CHECK_VERSION(2,74,0) if (flags & G_TLS_CERTIFICATE_NO_FLAGS) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("NO_FLAGS"))); /* `NO_FLAGS */ Store_field(cons, 1, result); result = cons; } + +#endif if (flags & G_TLS_CERTIFICATE_UNKNOWN_CA) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("UNKNOWN_CA"))); /* `UNKNOWN_CA */ @@ -3431,7 +3831,12 @@ GTlsCertificateFlags GioTlsCertificateFlags_val(value list) { GTlsCertificateFlags result = 0; while (list != Val_emptylist) { int tag = Int_val(Field(list, 0)); +#if GLIB_CHECK_VERSION(2,74,0) if (tag == caml_hash_variant("NO_FLAGS")) result |= G_TLS_CERTIFICATE_NO_FLAGS; /* `NO_FLAGS */ + +#else + if (tag == caml_hash_variant("NO_FLAGS")) caml_failwith("GTlsCertificateFlags.NO_FLAGS requires 2.74"); +#endif else if (tag == caml_hash_variant("UNKNOWN_CA")) result |= G_TLS_CERTIFICATE_UNKNOWN_CA; /* `UNKNOWN_CA */ else if (tag == caml_hash_variant("BAD_IDENTITY")) result |= G_TLS_CERTIFICATE_BAD_IDENTITY; /* `BAD_IDENTITY */ else if (tag == caml_hash_variant("NOT_ACTIVATED")) result |= G_TLS_CERTIFICATE_NOT_ACTIVATED; /* `NOT_ACTIVATED */ @@ -3508,18 +3913,25 @@ value Val_GioTlsPasswordFlags(GTlsPasswordFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GLIB_CHECK_VERSION(2,70,0) if (flags & G_TLS_PASSWORD_PKCS11_USER) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("PKCS11_USER"))); /* `PKCS11_USER */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,70,0) if (flags & G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("PKCS11_SECURITY_OFFICER"))); /* `PKCS11_SECURITY_OFFICER */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GLIB_CHECK_VERSION(2,70,0) if (flags & G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("PKCS11_CONTEXT_SPECIFIC"))); /* `PKCS11_CONTEXT_SPECIFIC */ @@ -3527,6 +3939,8 @@ value Val_GioTlsPasswordFlags(GTlsPasswordFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -3539,9 +3953,24 @@ GTlsPasswordFlags GioTlsPasswordFlags_val(value list) { else if (tag == caml_hash_variant("RETRY")) result |= G_TLS_PASSWORD_RETRY; /* `RETRY */ else if (tag == caml_hash_variant("MANY_TRIES")) result |= G_TLS_PASSWORD_MANY_TRIES; /* `MANY_TRIES */ else if (tag == caml_hash_variant("FINAL_TRY")) result |= G_TLS_PASSWORD_FINAL_TRY; /* `FINAL_TRY */ +#if GLIB_CHECK_VERSION(2,70,0) else if (tag == caml_hash_variant("PKCS11_USER")) result |= G_TLS_PASSWORD_PKCS11_USER; /* `PKCS11_USER */ + +#else + else if (tag == caml_hash_variant("PKCS11_USER")) caml_failwith("GTlsPasswordFlags.PKCS11_USER requires 2.70"); +#endif +#if GLIB_CHECK_VERSION(2,70,0) else if (tag == caml_hash_variant("PKCS11_SECURITY_OFFICER")) result |= G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER; /* `PKCS11_SECURITY_OFFICER */ + +#else + else if (tag == caml_hash_variant("PKCS11_SECURITY_OFFICER")) caml_failwith("GTlsPasswordFlags.PKCS11_SECURITY_OFFICER requires 2.70"); +#endif +#if GLIB_CHECK_VERSION(2,70,0) else if (tag == caml_hash_variant("PKCS11_CONTEXT_SPECIFIC")) result |= G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC; /* `PKCS11_CONTEXT_SPECIFIC */ + +#else + else if (tag == caml_hash_variant("PKCS11_CONTEXT_SPECIFIC")) caml_failwith("GTlsPasswordFlags.PKCS11_CONTEXT_SPECIFIC requires 2.70"); +#endif list = Field(list, 1); } return result; diff --git a/ocgtk/src/gio/generated/ml_settings_backend_gen.c b/ocgtk/src/gio/generated/ml_settings_backend_gen.c deleted file mode 100644 index c892d41bb..000000000 --- a/ocgtk/src/gio/generated/ml_settings_backend_gen.c +++ /dev/null @@ -1,39 +0,0 @@ -/* GENERATED CODE - DO NOT EDIT */ -/* C bindings for SettingsBackend */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "wrappers.h" - -#include -#include -#include -#include -#include -#include -#include -/* Include library-specific type conversions and forward declarations */ -#include "gio_decls.h" - - -CAMLexport CAMLprim value ml_g_settings_backend_writable_changed(value self, value arg1) -{ -CAMLparam2(self, arg1); - -g_settings_backend_writable_changed(GSettingsBackend_val(self), String_val(arg1)); -CAMLreturn(Val_unit); -} - -CAMLexport CAMLprim value ml_g_settings_backend_path_writable_changed(value self, value arg1) -{ -CAMLparam2(self, arg1); - -g_settings_backend_path_writable_changed(GSettingsBackend_val(self), String_val(arg1)); -CAMLreturn(Val_unit); -} diff --git a/ocgtk/src/gio/generated/ml_settings_gen.c b/ocgtk/src/gio/generated/ml_settings_gen.c index c00b097dd..95bbddbff 100644 --- a/ocgtk/src/gio/generated/ml_settings_gen.c +++ b/ocgtk/src/gio/generated/ml_settings_gen.c @@ -44,77 +44,6 @@ return Val_unit; } #endif -#if GLIB_CHECK_VERSION(2,32,0) - -CAMLexport CAMLprim value ml_g_settings_new_full(value arg1, value arg2, value arg3) -{ -CAMLparam3(arg1, arg2, arg3); - -GSettings *obj = g_settings_new_full(GSettingsSchema_val(arg1), Option_val(arg2, GSettingsBackend_val, NULL), String_option_val(arg3)); -if (obj) g_object_ref_sink(obj); - -CAMLreturn(Val_GSettings(obj)); -} -#else - -CAMLexport CAMLprim value ml_g_settings_new_full(value arg1, value arg2, value arg3) -{ -CAMLparam3(arg1, arg2, arg3); -(void)arg1; -(void)arg2; -(void)arg3; -caml_failwith("Settings requires GLib >= 2.32"); -return Val_unit; -} -#endif - -#if GLIB_CHECK_VERSION(2,26,0) - -CAMLexport CAMLprim value ml_g_settings_new_with_backend(value arg1, value arg2) -{ -CAMLparam2(arg1, arg2); - -GSettings *obj = g_settings_new_with_backend(String_val(arg1), GSettingsBackend_val(arg2)); -if (obj) g_object_ref_sink(obj); - -CAMLreturn(Val_GSettings(obj)); -} -#else - -CAMLexport CAMLprim value ml_g_settings_new_with_backend(value arg1, value arg2) -{ -CAMLparam2(arg1, arg2); -(void)arg1; -(void)arg2; -caml_failwith("Settings requires GLib >= 2.26"); -return Val_unit; -} -#endif - -#if GLIB_CHECK_VERSION(2,26,0) - -CAMLexport CAMLprim value ml_g_settings_new_with_backend_and_path(value arg1, value arg2, value arg3) -{ -CAMLparam3(arg1, arg2, arg3); - -GSettings *obj = g_settings_new_with_backend_and_path(String_val(arg1), GSettingsBackend_val(arg2), String_val(arg3)); -if (obj) g_object_ref_sink(obj); - -CAMLreturn(Val_GSettings(obj)); -} -#else - -CAMLexport CAMLprim value ml_g_settings_new_with_backend_and_path(value arg1, value arg2, value arg3) -{ -CAMLparam3(arg1, arg2, arg3); -(void)arg1; -(void)arg2; -(void)arg3; -caml_failwith("Settings requires GLib >= 2.26"); -return Val_unit; -} -#endif - #if GLIB_CHECK_VERSION(2,26,0) CAMLexport CAMLprim value ml_g_settings_new_with_path(value arg1, value arg2) @@ -712,23 +641,6 @@ g_settings_apply(GSettings_val(self)); CAMLreturn(Val_unit); } -CAMLexport CAMLprim value ml_g_settings_get_backend(value self) -{ - CAMLparam1(self); - CAMLlocal1(result); -GSettings *obj = (GSettings *)GSettings_val(self); - GSettingsBackend *prop_value; -GParamSpec *pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(obj), "backend"); -if (pspec == NULL) caml_failwith("ml_g_settings_get_backend: property 'backend' not found"); -GValue prop_gvalue = G_VALUE_INIT; -g_value_init(&prop_gvalue, pspec->value_type); - g_object_get_property(G_OBJECT(obj), "backend", &prop_gvalue); - prop_value = (GSettingsBackend*)g_value_get_object(&prop_gvalue); - - result = Val_GSettingsBackend(prop_value); -g_value_unset(&prop_gvalue); -CAMLreturn(result);} - #if GLIB_CHECK_VERSION(2,28,0) CAMLexport CAMLprim value ml_g_settings_get_delay_apply(value self) diff --git a/ocgtk/src/gio/generated/settings.ml b/ocgtk/src/gio/generated/settings.ml index 29aa025d9..e59b3f3e3 100644 --- a/ocgtk/src/gio/generated/settings.ml +++ b/ocgtk/src/gio/generated/settings.ml @@ -6,15 +6,6 @@ type t = [`settings | `object_] Gobject.obj (** Create a new Settings *) external new_ : string -> t = "ml_g_settings_new" -(** Create a new Settings *) -external new_full : Settings_schema.t -> Settings_backend.t option -> string option -> t = "ml_g_settings_new_full" - -(** Create a new Settings *) -external new_with_backend : string -> Settings_backend.t -> t = "ml_g_settings_new_with_backend" - -(** Create a new Settings *) -external new_with_backend_and_path : string -> Settings_backend.t -> string -> t = "ml_g_settings_new_with_backend_and_path" - (** Create a new Settings *) external new_with_path : string -> string -> t = "ml_g_settings_new_with_path" @@ -295,9 +286,6 @@ external apply : t -> unit = "ml_g_settings_apply" (* Properties *) -(** Get property: backend *) -external get_backend : t -> Settings_backend.t = "ml_g_settings_get_backend" - (** Get property: delay-apply *) external get_delay_apply : t -> bool = "ml_g_settings_get_delay_apply" diff --git a/ocgtk/src/gio/generated/settings.mli b/ocgtk/src/gio/generated/settings.mli index 29aa025d9..e59b3f3e3 100644 --- a/ocgtk/src/gio/generated/settings.mli +++ b/ocgtk/src/gio/generated/settings.mli @@ -6,15 +6,6 @@ type t = [`settings | `object_] Gobject.obj (** Create a new Settings *) external new_ : string -> t = "ml_g_settings_new" -(** Create a new Settings *) -external new_full : Settings_schema.t -> Settings_backend.t option -> string option -> t = "ml_g_settings_new_full" - -(** Create a new Settings *) -external new_with_backend : string -> Settings_backend.t -> t = "ml_g_settings_new_with_backend" - -(** Create a new Settings *) -external new_with_backend_and_path : string -> Settings_backend.t -> string -> t = "ml_g_settings_new_with_backend_and_path" - (** Create a new Settings *) external new_with_path : string -> string -> t = "ml_g_settings_new_with_path" @@ -295,9 +286,6 @@ external apply : t -> unit = "ml_g_settings_apply" (* Properties *) -(** Get property: backend *) -external get_backend : t -> Settings_backend.t = "ml_g_settings_get_backend" - (** Get property: delay-apply *) external get_delay_apply : t -> bool = "ml_g_settings_get_delay_apply" diff --git a/ocgtk/src/gio/generated/settings_backend.ml b/ocgtk/src/gio/generated/settings_backend.ml deleted file mode 100644 index 58be98b2b..000000000 --- a/ocgtk/src/gio/generated/settings_backend.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* SettingsBackend: SettingsBackend *) - -type t = [`settings_backend | `object_] Gobject.obj - -(* Methods *) -(** Signals that the writability of a single key has possibly changed. - -Since GSettings performs no locking operations for itself, this call -will always be made in response to external events. *) -external writable_changed : t -> string -> unit = "ml_g_settings_backend_writable_changed" - -(** Signals that the writability of all keys below a given path may have -changed. - -Since GSettings performs no locking operations for itself, this call -will always be made in response to external events. *) -external path_writable_changed : t -> string -> unit = "ml_g_settings_backend_path_writable_changed" - diff --git a/ocgtk/src/gio/generated/settings_backend.mli b/ocgtk/src/gio/generated/settings_backend.mli deleted file mode 100644 index 58be98b2b..000000000 --- a/ocgtk/src/gio/generated/settings_backend.mli +++ /dev/null @@ -1,19 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* SettingsBackend: SettingsBackend *) - -type t = [`settings_backend | `object_] Gobject.obj - -(* Methods *) -(** Signals that the writability of a single key has possibly changed. - -Since GSettings performs no locking operations for itself, this call -will always be made in response to external events. *) -external writable_changed : t -> string -> unit = "ml_g_settings_backend_writable_changed" - -(** Signals that the writability of all keys below a given path may have -changed. - -Since GSettings performs no locking operations for itself, this call -will always be made in response to external events. *) -external path_writable_changed : t -> string -> unit = "ml_g_settings_backend_path_writable_changed" - diff --git a/ocgtk/src/gio/generated/settings_backend_private.ml b/ocgtk/src/gio/generated/settings_backend_private.ml deleted file mode 100644 index 76af7459a..000000000 --- a/ocgtk/src/gio/generated/settings_backend_private.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* SettingsBackendPrivate: SettingsBackendPrivate *) - -type t = [`settings_backend_private] Gobject.obj - -(* Methods *) diff --git a/ocgtk/src/gio/generated/settings_backend_private.mli b/ocgtk/src/gio/generated/settings_backend_private.mli deleted file mode 100644 index 76af7459a..000000000 --- a/ocgtk/src/gio/generated/settings_backend_private.mli +++ /dev/null @@ -1,6 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* SettingsBackendPrivate: SettingsBackendPrivate *) - -type t = [`settings_backend_private] Gobject.obj - -(* Methods *) diff --git a/ocgtk/src/graphene/generated/graphene_enums.mli b/ocgtk/src/graphene/generated/graphene_enums.mli index 9e015a0a3..ef69236ab 100644 --- a/ocgtk/src/graphene/generated/graphene_enums.mli +++ b/ocgtk/src/graphene/generated/graphene_enums.mli @@ -3,43 +3,86 @@ (* EulerOrder - enumeration *) type eulerorder = [ + (** Rotate in the default order; the + default order is one of the following enumeration values *) | `DEFAULT + (** Rotate in the X, Y, and Z order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SXYZ *) | `XYZ + (** Rotate in the Y, Z, and X order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SYZX *) | `YZX + (** Rotate in the Z, X, and Y order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SZXY *) | `ZXY + (** Rotate in the X, Z, and Y order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SXZY *) | `XZY + (** Rotate in the Y, X, and Z order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SYXZ *) | `YXZ + (** Rotate in the Z, Y, and X order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SZYX *) | `ZYX + (** Defines a static rotation along the X, Y, and Z axes (Since: 1.10) *) | `SXYZ + (** Defines a static rotation along the X, Y, and X axes (Since: 1.10) *) | `SXYX + (** Defines a static rotation along the X, Z, and Y axes (Since: 1.10) *) | `SXZY + (** Defines a static rotation along the X, Z, and X axes (Since: 1.10) *) | `SXZX + (** Defines a static rotation along the Y, Z, and X axes (Since: 1.10) *) | `SYZX + (** Defines a static rotation along the Y, Z, and Y axes (Since: 1.10) *) | `SYZY + (** Defines a static rotation along the Y, X, and Z axes (Since: 1.10) *) | `SYXZ + (** Defines a static rotation along the Y, X, and Y axes (Since: 1.10) *) | `SYXY + (** Defines a static rotation along the Z, X, and Y axes (Since: 1.10) *) | `SZXY + (** Defines a static rotation along the Z, X, and Z axes (Since: 1.10) *) | `SZXZ + (** Defines a static rotation along the Z, Y, and X axes (Since: 1.10) *) | `SZYX + (** Defines a static rotation along the Z, Y, and Z axes (Since: 1.10) *) | `SZYZ + (** Defines a relative rotation along the Z, Y, and X axes (Since: 1.10) *) | `RZYX + (** Defines a relative rotation along the X, Y, and X axes (Since: 1.10) *) | `RXYX + (** Defines a relative rotation along the Y, Z, and X axes (Since: 1.10) *) | `RYZX + (** Defines a relative rotation along the X, Z, and X axes (Since: 1.10) *) | `RXZX + (** Defines a relative rotation along the X, Z, and Y axes (Since: 1.10) *) | `RXZY + (** Defines a relative rotation along the Y, Z, and Y axes (Since: 1.10) *) | `RYZY + (** Defines a relative rotation along the Z, X, and Y axes (Since: 1.10) *) | `RZXY + (** Defines a relative rotation along the Y, X, and Y axes (Since: 1.10) *) | `RYXY + (** Defines a relative rotation along the Y, X, and Z axes (Since: 1.10) *) | `RYXZ + (** Defines a relative rotation along the Z, X, and Z axes (Since: 1.10) *) | `RZXZ + (** Defines a relative rotation along the X, Y, and Z axes (Since: 1.10) *) | `RXYZ + (** Defines a relative rotation along the Z, Y, and Z axes (Since: 1.10) *) | `RZYZ ] (* RayIntersectionKind - enumeration *) type rayintersectionkind = [ + (** No intersection *) | `NONE + (** The ray is entering the intersected + object *) | `ENTER + (** The ray is leaving the intersected + object *) | `LEAVE ] diff --git a/ocgtk/src/graphene/generated/ml_graphene_enums_gen.c b/ocgtk/src/graphene/generated/ml_graphene_enums_gen.c index 7fca1427a..d9d29db17 100644 --- a/ocgtk/src/graphene/generated/ml_graphene_enums_gen.c +++ b/ocgtk/src/graphene/generated/ml_graphene_enums_gen.c @@ -19,30 +19,102 @@ value Val_GrapheneEulerOrder(graphene_euler_order_t val) { case GRAPHENE_EULER_ORDER_XZY: return caml_hash_variant("XZY"); /* `XZY */ case GRAPHENE_EULER_ORDER_YXZ: return caml_hash_variant("YXZ"); /* `YXZ */ case GRAPHENE_EULER_ORDER_ZYX: return caml_hash_variant("ZYX"); /* `ZYX */ +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SXYZ: return caml_hash_variant("SXYZ"); /* `SXYZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SXYX: return caml_hash_variant("SXYX"); /* `SXYX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SXZY: return caml_hash_variant("SXZY"); /* `SXZY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SXZX: return caml_hash_variant("SXZX"); /* `SXZX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SYZX: return caml_hash_variant("SYZX"); /* `SYZX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SYZY: return caml_hash_variant("SYZY"); /* `SYZY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SYXZ: return caml_hash_variant("SYXZ"); /* `SYXZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SYXY: return caml_hash_variant("SYXY"); /* `SYXY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SZXY: return caml_hash_variant("SZXY"); /* `SZXY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SZXZ: return caml_hash_variant("SZXZ"); /* `SZXZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SZYX: return caml_hash_variant("SZYX"); /* `SZYX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_SZYZ: return caml_hash_variant("SZYZ"); /* `SZYZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RZYX: return caml_hash_variant("RZYX"); /* `RZYX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RXYX: return caml_hash_variant("RXYX"); /* `RXYX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RYZX: return caml_hash_variant("RYZX"); /* `RYZX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RXZX: return caml_hash_variant("RXZX"); /* `RXZX */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RXZY: return caml_hash_variant("RXZY"); /* `RXZY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RYZY: return caml_hash_variant("RYZY"); /* `RYZY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RZXY: return caml_hash_variant("RZXY"); /* `RZXY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RYXY: return caml_hash_variant("RYXY"); /* `RYXY */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RYXZ: return caml_hash_variant("RYXZ"); /* `RYXZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RZXZ: return caml_hash_variant("RZXZ"); /* `RZXZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RXYZ: return caml_hash_variant("RXYZ"); /* `RXYZ */ + +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) case GRAPHENE_EULER_ORDER_RZYZ: return caml_hash_variant("RZYZ"); /* `RZYZ */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown graphene_euler_order_t value: %d", (int)val); @@ -61,30 +133,150 @@ graphene_euler_order_t GrapheneEulerOrder_val(value val) { else if (val == caml_hash_variant("XZY")) return GRAPHENE_EULER_ORDER_XZY; /* `XZY */ else if (val == caml_hash_variant("YXZ")) return GRAPHENE_EULER_ORDER_YXZ; /* `YXZ */ else if (val == caml_hash_variant("ZYX")) return GRAPHENE_EULER_ORDER_ZYX; /* `ZYX */ +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SXYZ")) return GRAPHENE_EULER_ORDER_SXYZ; /* `SXYZ */ + +#else + else if (val == caml_hash_variant("SXYZ")) caml_failwith("graphene_euler_order_t.SXYZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SXYX")) return GRAPHENE_EULER_ORDER_SXYX; /* `SXYX */ + +#else + else if (val == caml_hash_variant("SXYX")) caml_failwith("graphene_euler_order_t.SXYX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SXZY")) return GRAPHENE_EULER_ORDER_SXZY; /* `SXZY */ + +#else + else if (val == caml_hash_variant("SXZY")) caml_failwith("graphene_euler_order_t.SXZY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SXZX")) return GRAPHENE_EULER_ORDER_SXZX; /* `SXZX */ + +#else + else if (val == caml_hash_variant("SXZX")) caml_failwith("graphene_euler_order_t.SXZX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SYZX")) return GRAPHENE_EULER_ORDER_SYZX; /* `SYZX */ + +#else + else if (val == caml_hash_variant("SYZX")) caml_failwith("graphene_euler_order_t.SYZX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SYZY")) return GRAPHENE_EULER_ORDER_SYZY; /* `SYZY */ + +#else + else if (val == caml_hash_variant("SYZY")) caml_failwith("graphene_euler_order_t.SYZY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SYXZ")) return GRAPHENE_EULER_ORDER_SYXZ; /* `SYXZ */ + +#else + else if (val == caml_hash_variant("SYXZ")) caml_failwith("graphene_euler_order_t.SYXZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SYXY")) return GRAPHENE_EULER_ORDER_SYXY; /* `SYXY */ + +#else + else if (val == caml_hash_variant("SYXY")) caml_failwith("graphene_euler_order_t.SYXY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SZXY")) return GRAPHENE_EULER_ORDER_SZXY; /* `SZXY */ + +#else + else if (val == caml_hash_variant("SZXY")) caml_failwith("graphene_euler_order_t.SZXY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SZXZ")) return GRAPHENE_EULER_ORDER_SZXZ; /* `SZXZ */ + +#else + else if (val == caml_hash_variant("SZXZ")) caml_failwith("graphene_euler_order_t.SZXZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SZYX")) return GRAPHENE_EULER_ORDER_SZYX; /* `SZYX */ + +#else + else if (val == caml_hash_variant("SZYX")) caml_failwith("graphene_euler_order_t.SZYX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("SZYZ")) return GRAPHENE_EULER_ORDER_SZYZ; /* `SZYZ */ + +#else + else if (val == caml_hash_variant("SZYZ")) caml_failwith("graphene_euler_order_t.SZYZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RZYX")) return GRAPHENE_EULER_ORDER_RZYX; /* `RZYX */ + +#else + else if (val == caml_hash_variant("RZYX")) caml_failwith("graphene_euler_order_t.RZYX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RXYX")) return GRAPHENE_EULER_ORDER_RXYX; /* `RXYX */ + +#else + else if (val == caml_hash_variant("RXYX")) caml_failwith("graphene_euler_order_t.RXYX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RYZX")) return GRAPHENE_EULER_ORDER_RYZX; /* `RYZX */ + +#else + else if (val == caml_hash_variant("RYZX")) caml_failwith("graphene_euler_order_t.RYZX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RXZX")) return GRAPHENE_EULER_ORDER_RXZX; /* `RXZX */ + +#else + else if (val == caml_hash_variant("RXZX")) caml_failwith("graphene_euler_order_t.RXZX requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RXZY")) return GRAPHENE_EULER_ORDER_RXZY; /* `RXZY */ + +#else + else if (val == caml_hash_variant("RXZY")) caml_failwith("graphene_euler_order_t.RXZY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RYZY")) return GRAPHENE_EULER_ORDER_RYZY; /* `RYZY */ + +#else + else if (val == caml_hash_variant("RYZY")) caml_failwith("graphene_euler_order_t.RYZY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RZXY")) return GRAPHENE_EULER_ORDER_RZXY; /* `RZXY */ + +#else + else if (val == caml_hash_variant("RZXY")) caml_failwith("graphene_euler_order_t.RZXY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RYXY")) return GRAPHENE_EULER_ORDER_RYXY; /* `RYXY */ + +#else + else if (val == caml_hash_variant("RYXY")) caml_failwith("graphene_euler_order_t.RYXY requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RYXZ")) return GRAPHENE_EULER_ORDER_RYXZ; /* `RYXZ */ + +#else + else if (val == caml_hash_variant("RYXZ")) caml_failwith("graphene_euler_order_t.RYXZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RZXZ")) return GRAPHENE_EULER_ORDER_RZXZ; /* `RZXZ */ + +#else + else if (val == caml_hash_variant("RZXZ")) caml_failwith("graphene_euler_order_t.RZXZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RXYZ")) return GRAPHENE_EULER_ORDER_RXYZ; /* `RXYZ */ + +#else + else if (val == caml_hash_variant("RXYZ")) caml_failwith("graphene_euler_order_t.RXYZ requires 1.10"); +#endif +#if GRAPHENE_VERSION >= GRAPHENE_ENCODE_VERSION(1,10,0) else if (val == caml_hash_variant("RZYZ")) return GRAPHENE_EULER_ORDER_RZYZ; /* `RZYZ */ + +#else + else if (val == caml_hash_variant("RZYZ")) caml_failwith("graphene_euler_order_t.RZYZ requires 1.10"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown graphene_euler_order_t tag: %ld", val); diff --git a/ocgtk/src/gsk/generated/broadway_renderer.ml b/ocgtk/src/gsk/generated/broadway_renderer.ml deleted file mode 100644 index 466bebb45..000000000 --- a/ocgtk/src/gsk/generated/broadway_renderer.ml +++ /dev/null @@ -1,9 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* BroadwayRenderer: BroadwayRenderer *) - -type t = [`broadway_renderer | `renderer | `object_] Gobject.obj - -(** Create a new BroadwayRenderer *) -external new_ : unit -> t = "ml_gsk_broadway_renderer_new" - -(* Methods *) diff --git a/ocgtk/src/gsk/generated/broadway_renderer.mli b/ocgtk/src/gsk/generated/broadway_renderer.mli deleted file mode 100644 index 466bebb45..000000000 --- a/ocgtk/src/gsk/generated/broadway_renderer.mli +++ /dev/null @@ -1,9 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* BroadwayRenderer: BroadwayRenderer *) - -type t = [`broadway_renderer | `renderer | `object_] Gobject.obj - -(** Create a new BroadwayRenderer *) -external new_ : unit -> t = "ml_gsk_broadway_renderer_new" - -(* Methods *) diff --git a/ocgtk/src/gsk/generated/gBroadway_renderer.ml b/ocgtk/src/gsk/generated/gBroadway_renderer.ml deleted file mode 100644 index 4f5347265..000000000 --- a/ocgtk/src/gsk/generated/gBroadway_renderer.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* High-level class for BroadwayRenderer *) -class broadway_renderer (obj : Broadway_renderer.t) = object (self) - - method as_broadway_renderer = obj -end - diff --git a/ocgtk/src/gsk/generated/gBroadway_renderer.mli b/ocgtk/src/gsk/generated/gBroadway_renderer.mli deleted file mode 100644 index 998212ec9..000000000 --- a/ocgtk/src/gsk/generated/gBroadway_renderer.mli +++ /dev/null @@ -1,5 +0,0 @@ -class broadway_renderer : Broadway_renderer.t -> - object - method as_broadway_renderer : Broadway_renderer.t - end - diff --git a/ocgtk/src/gsk/generated/gNgl_renderer.ml b/ocgtk/src/gsk/generated/gNgl_renderer.ml deleted file mode 100644 index 7ef8248aa..000000000 --- a/ocgtk/src/gsk/generated/gNgl_renderer.ml +++ /dev/null @@ -1,6 +0,0 @@ -(* High-level class for NglRenderer *) -class ngl_renderer (obj : Ngl_renderer.t) = object (self) - - method as_ngl_renderer = obj -end - diff --git a/ocgtk/src/gsk/generated/gNgl_renderer.mli b/ocgtk/src/gsk/generated/gNgl_renderer.mli deleted file mode 100644 index 69d870199..000000000 --- a/ocgtk/src/gsk/generated/gNgl_renderer.mli +++ /dev/null @@ -1,5 +0,0 @@ -class ngl_renderer : Ngl_renderer.t -> - object - method as_ngl_renderer : Ngl_renderer.t - end - diff --git a/ocgtk/src/gsk/generated/gsk_decls.h b/ocgtk/src/gsk/generated/gsk_decls.h index 23c245515..cbb383d20 100644 --- a/ocgtk/src/gsk/generated/gsk_decls.h +++ b/ocgtk/src/gsk/generated/gsk_decls.h @@ -32,11 +32,6 @@ #define Val_GskBorderNode(obj) ((value)(ml_gobject_val_of_ext(obj))) #endif /* Val_GskBorderNode */ -#ifndef Val_GskBroadwayRenderer -#define GskBroadwayRenderer_val(val) ((GskBroadwayRenderer*)ml_gobject_ext_of_val(val)) -#define Val_GskBroadwayRenderer(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GskBroadwayRenderer */ - #ifndef Val_GskCairoNode #define GskCairoNode_val(val) ((GskCairoNode*)ml_gobject_ext_of_val(val)) #define Val_GskCairoNode(obj) ((value)(ml_gobject_val_of_ext(obj))) @@ -121,11 +116,6 @@ #endif /* Val_GskMaskNode */ #endif -#ifndef Val_GskNglRenderer -#define GskNglRenderer_val(val) ((GskNglRenderer*)ml_gobject_ext_of_val(val)) -#define Val_GskNglRenderer(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GskNglRenderer */ - #ifndef Val_GskOpacityNode #define GskOpacityNode_val(val) ((GskOpacityNode*)ml_gobject_ext_of_val(val)) #define Val_GskOpacityNode(obj) ((value)(ml_gobject_val_of_ext(obj))) diff --git a/ocgtk/src/gsk/generated/gsk_enums.mli b/ocgtk/src/gsk/generated/gsk_enums.mli index 0fc4096d2..998641a71 100644 --- a/ocgtk/src/gsk/generated/gsk_enums.mli +++ b/ocgtk/src/gsk/generated/gsk_enums.mli @@ -3,155 +3,293 @@ (* BlendMode - enumeration *) type blendmode = [ + (** The default blend mode, which specifies no blending *) | `DEFAULT + (** The source color is multiplied by the destination + and replaces the destination *) | `MULTIPLY + (** Multiplies the complements of the destination and source + color values, then complements the result. *) | `SCREEN + (** Multiplies or screens the colors, depending on the + destination color value. This is the inverse of hard-list *) | `OVERLAY + (** Selects the darker of the destination and source colors *) | `DARKEN + (** Selects the lighter of the destination and source colors *) | `LIGHTEN + (** Brightens the destination color to reflect the source color *) | `COLOR_DODGE + (** Darkens the destination color to reflect the source color *) | `COLOR_BURN + (** Multiplies or screens the colors, depending on the source color value *) | `HARD_LIGHT + (** Darkens or lightens the colors, depending on the source color value *) | `SOFT_LIGHT + (** Subtracts the darker of the two constituent colors from the lighter color *) | `DIFFERENCE + (** Produces an effect similar to that of the difference mode but lower in contrast *) | `EXCLUSION + (** Creates a color with the hue and saturation of the source color and the luminosity of the destination color *) | `COLOR + (** Creates a color with the hue of the source color and the saturation and luminosity of the destination color *) | `HUE + (** Creates a color with the saturation of the source color and the hue and luminosity of the destination color *) | `SATURATION + (** Creates a color with the luminosity of the source color and the hue and saturation of the destination color *) | `LUMINOSITY ] (* Corner - enumeration *) type corner = [ + (** The top left corner *) | `TOP_LEFT + (** The top right corner *) | `TOP_RIGHT + (** The bottom right corner *) | `BOTTOM_RIGHT + (** The bottom left corner *) | `BOTTOM_LEFT ] (* FillRule - enumeration *) type fillrule = [ + (** If the path crosses the ray from + left-to-right, counts +1. If the path crosses the ray + from right to left, counts -1. (Left and right are determined + from the perspective of looking along the ray from the starting + point.) If the total count is non-zero, the point will be filled. *) | `WINDING + (** Counts the total number of + intersections, without regard to the orientation of the contour. If + the total number of intersections is odd, the point will be + filled. *) | `EVEN_ODD ] (* GLUniformType - enumeration *) type gluniformtype = [ + (** No type, used for uninitialized or unspecified values. *) | `NONE + (** A float uniform *) | `FLOAT + (** A GLSL int / gint32 uniform *) | `INT + (** A GLSL uint / guint32 uniform *) | `UINT + (** A GLSL bool / gboolean uniform *) | `BOOL + (** A GLSL vec2 / graphene_vec2_t uniform *) | `VEC2 + (** A GLSL vec3 / graphene_vec3_t uniform *) | `VEC3 + (** A GLSL vec4 / graphene_vec4_t uniform *) | `VEC4 ] (* LineCap - enumeration *) type linecap = [ + (** Start and stop the line exactly at the start + and end point *) | `BUTT + (** Use a round ending, the center of the circle + is the start or end point *) | `ROUND + (** use squared ending, the center of the square + is the start or end point *) | `SQUARE ] (* LineJoin - enumeration *) type linejoin = [ + (** Use a sharp angled corner *) | `MITER + (** Use a round join, the center of the circle is + the join point *) | `ROUND + (** use a cut-off join, the join is cut off at half + the line width from the joint point *) | `BEVEL ] (* MaskMode - enumeration *) type maskmode = [ + (** Use the alpha channel of the mask *) | `ALPHA + (** Use the inverted alpha channel of the mask *) | `INVERTED_ALPHA + (** Use the luminance of the mask, + multiplied by mask alpha *) | `LUMINANCE + (** Use the inverted luminance of the mask, + multiplied by mask alpha *) | `INVERTED_LUMINANCE ] (* PathDirection - enumeration *) type pathdirection = [ + (** The tangent in path direction of the incoming side + of the path *) | `FROM_START + (** The tangent against path direction of the incoming side + of the path *) | `TO_START + (** The tangent in path direction of the outgoing side + of the path *) | `TO_END + (** The tangent against path direction of the outgoing + side of the path *) | `FROM_END ] (* PathOperation - enumeration *) type pathoperation = [ + (** A move-to operation, with 1 point describing the target point. *) | `MOVE + (** A close operation ending the current contour with a line back + to the starting point. Two points describe the start and end of the line. *) | `CLOSE + (** A line-to operation, with 2 points describing the start and + end point of a straight line. *) | `LINE + (** A curve-to operation describing a quadratic Bézier curve + with 3 points describing the start point, the control point and the end + point of the curve. *) | `QUAD + (** A curve-to operation describing a cubic Bézier curve with 4 + points describing the start point, the two control points and the end point + of the curve. *) | `CUBIC + (** A rational quadratic Bézier curve with 3 points describing + the start point, control point and end point of the curve. A weight for the + curve will be passed, too. *) | `CONIC ] (* RenderNodeType - enumeration *) type rendernodetype = [ + (** Error type. No node will ever have this type. *) | `NOT_A_RENDER_NODE + (** A node containing a stack of children *) | `CONTAINER_NODE + (** A node drawing a `cairo_surface_t` *) | `CAIRO_NODE + (** A node drawing a single color rectangle *) | `COLOR_NODE + (** A node drawing a linear gradient *) | `LINEAR_GRADIENT_NODE + (** A node drawing a repeating linear gradient *) | `REPEATING_LINEAR_GRADIENT_NODE + (** A node drawing a radial gradient *) | `RADIAL_GRADIENT_NODE + (** A node drawing a repeating radial gradient *) | `REPEATING_RADIAL_GRADIENT_NODE + (** A node drawing a conic gradient *) | `CONIC_GRADIENT_NODE + (** A node stroking a border around an area *) | `BORDER_NODE + (** A node drawing a `GdkTexture` *) | `TEXTURE_NODE + (** A node drawing an inset shadow *) | `INSET_SHADOW_NODE + (** A node drawing an outset shadow *) | `OUTSET_SHADOW_NODE + (** A node that renders its child after applying a matrix transform *) | `TRANSFORM_NODE + (** A node that changes the opacity of its child *) | `OPACITY_NODE + (** A node that applies a color matrix to every pixel *) | `COLOR_MATRIX_NODE + (** A node that repeats the child's contents *) | `REPEAT_NODE + (** A node that clips its child to a rectangular area *) | `CLIP_NODE + (** A node that clips its child to a rounded rectangle *) | `ROUNDED_CLIP_NODE + (** A node that draws a shadow below its child *) | `SHADOW_NODE + (** A node that blends two children together *) | `BLEND_NODE + (** A node that cross-fades between two children *) | `CROSS_FADE_NODE + (** A node containing a glyph string *) | `TEXT_NODE + (** A node that applies a blur *) | `BLUR_NODE + (** Debug information that does not affect the rendering *) | `DEBUG_NODE + (** A node that uses OpenGL fragment shaders to render *) | `GL_SHADER_NODE + (** A node drawing a `GdkTexture` scaled and filtered. *) | `TEXTURE_SCALE_NODE + (** A node that masks one child with another. *) | `MASK_NODE + (** A node that fills a path. *) | `FILL_NODE + (** A node that strokes a path. *) | `STROKE_NODE + (** A node that possibly redirects part of the scene graph to a subsurface. *) | `SUBSURFACE_NODE ] (* ScalingFilter - enumeration *) type scalingfilter = [ + (** linear interpolation filter *) | `LINEAR + (** nearest neighbor interpolation filter *) | `NEAREST + (** linear interpolation along each axis, + plus mipmap generation, with linear interpolation along the mipmap + levels *) | `TRILINEAR ] (* SerializationError - enumeration *) type serializationerror = [ + (** The format can not be identified *) | `UNSUPPORTED_FORMAT + (** The version of the data is not + understood *) | `UNSUPPORTED_VERSION + (** The given data may not exist in + a proper serialization *) | `INVALID_DATA ] (* TransformCategory - enumeration *) type transformcategory = [ + (** The category of the matrix has not been + determined. *) | `UNKNOWN + (** Analyzing the matrix concluded that it does + not fit in any other category. *) | `ANY + (** The matrix is a 3D matrix. This means that + the w column (the last column) has the values (0, 0, 0, 1). *) | `V3D + (** The matrix is a 2D matrix. This is equivalent + to graphene_matrix_is_2d() returning %TRUE. In particular, this + means that Cairo can deal with the matrix. *) | `V2D + (** The matrix is a combination of 2D scale + and 2D translation operations. In particular, this means that any + rectangle can be transformed exactly using this matrix. *) | `V2D_AFFINE + (** The matrix is a 2D translation. *) | `V2D_TRANSLATE + (** The matrix is the identity matrix. *) | `IDENTITY ] (* PathForeachFlags - bitfield/flags *) type pathforeachflags_flag = [ + (** The default behavior, only allow lines. *) | `ONLY_LINES + (** Allow emission of `GSK_PATH_QUAD` operations *) | `QUAD + (** Allow emission of `GSK_PATH_CUBIC` operations. *) | `CUBIC + (** Allow emission of `GSK_PATH_CONIC` operations. *) | `CONIC ] diff --git a/ocgtk/src/gsk/generated/ml_gsk_enums_gen.c b/ocgtk/src/gsk/generated/ml_gsk_enums_gen.c index 268a3b3d1..2491986ea 100644 --- a/ocgtk/src/gsk/generated/ml_gsk_enums_gen.c +++ b/ocgtk/src/gsk/generated/ml_gsk_enums_gen.c @@ -353,11 +353,26 @@ value Val_GskRenderNodeType(GskRenderNodeType val) { case GSK_BLUR_NODE: return caml_hash_variant("BLUR_NODE"); /* `BLUR_NODE */ case GSK_DEBUG_NODE: return caml_hash_variant("DEBUG_NODE"); /* `DEBUG_NODE */ case GSK_GL_SHADER_NODE: return caml_hash_variant("GL_SHADER_NODE"); /* `GL_SHADER_NODE */ +#if GTK_CHECK_VERSION(4,10,0) case GSK_TEXTURE_SCALE_NODE: return caml_hash_variant("TEXTURE_SCALE_NODE"); /* `TEXTURE_SCALE_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,10,0) case GSK_MASK_NODE: return caml_hash_variant("MASK_NODE"); /* `MASK_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GSK_FILL_NODE: return caml_hash_variant("FILL_NODE"); /* `FILL_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GSK_STROKE_NODE: return caml_hash_variant("STROKE_NODE"); /* `STROKE_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GSK_SUBSURFACE_NODE: return caml_hash_variant("SUBSURFACE_NODE"); /* `SUBSURFACE_NODE */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GskRenderNodeType value: %d", (int)val); @@ -395,11 +410,36 @@ GskRenderNodeType GskRenderNodeType_val(value val) { else if (val == caml_hash_variant("BLUR_NODE")) return GSK_BLUR_NODE; /* `BLUR_NODE */ else if (val == caml_hash_variant("DEBUG_NODE")) return GSK_DEBUG_NODE; /* `DEBUG_NODE */ else if (val == caml_hash_variant("GL_SHADER_NODE")) return GSK_GL_SHADER_NODE; /* `GL_SHADER_NODE */ +#if GTK_CHECK_VERSION(4,10,0) else if (val == caml_hash_variant("TEXTURE_SCALE_NODE")) return GSK_TEXTURE_SCALE_NODE; /* `TEXTURE_SCALE_NODE */ + +#else + else if (val == caml_hash_variant("TEXTURE_SCALE_NODE")) caml_failwith("GskRenderNodeType.TEXTURE_SCALE_NODE requires 4.10"); +#endif +#if GTK_CHECK_VERSION(4,10,0) else if (val == caml_hash_variant("MASK_NODE")) return GSK_MASK_NODE; /* `MASK_NODE */ + +#else + else if (val == caml_hash_variant("MASK_NODE")) caml_failwith("GskRenderNodeType.MASK_NODE requires 4.10"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("FILL_NODE")) return GSK_FILL_NODE; /* `FILL_NODE */ + +#else + else if (val == caml_hash_variant("FILL_NODE")) caml_failwith("GskRenderNodeType.FILL_NODE requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("STROKE_NODE")) return GSK_STROKE_NODE; /* `STROKE_NODE */ + +#else + else if (val == caml_hash_variant("STROKE_NODE")) caml_failwith("GskRenderNodeType.STROKE_NODE requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("SUBSURFACE_NODE")) return GSK_SUBSURFACE_NODE; /* `SUBSURFACE_NODE */ + +#else + else if (val == caml_hash_variant("SUBSURFACE_NODE")) caml_failwith("GskRenderNodeType.SUBSURFACE_NODE requires 4.14"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GskRenderNodeType tag: %ld", val); diff --git a/ocgtk/src/gsk/generated/ngl_renderer.ml b/ocgtk/src/gsk/generated/ngl_renderer.ml deleted file mode 100644 index 22f75aa08..000000000 --- a/ocgtk/src/gsk/generated/ngl_renderer.ml +++ /dev/null @@ -1,9 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* NglRenderer: NglRenderer *) - -type t = [`ngl_renderer | `renderer | `object_] Gobject.obj - -(** Create a new NglRenderer *) -external new_ : unit -> t = "ml_gsk_ngl_renderer_new" - -(* Methods *) diff --git a/ocgtk/src/gsk/generated/ngl_renderer.mli b/ocgtk/src/gsk/generated/ngl_renderer.mli deleted file mode 100644 index 22f75aa08..000000000 --- a/ocgtk/src/gsk/generated/ngl_renderer.mli +++ /dev/null @@ -1,9 +0,0 @@ -(* GENERATED CODE - DO NOT EDIT *) -(* NglRenderer: NglRenderer *) - -type t = [`ngl_renderer | `renderer | `object_] Gobject.obj - -(** Create a new NglRenderer *) -external new_ : unit -> t = "ml_gsk_ngl_renderer_new" - -(* Methods *) diff --git a/ocgtk/src/gtk/generated/gPage_setup.ml b/ocgtk/src/gtk/generated/gPage_setup.ml index 0661bedc4..5f4782bd7 100644 --- a/ocgtk/src/gtk/generated/gPage_setup.ml +++ b/ocgtk/src/gtk/generated/gPage_setup.ml @@ -1,4 +1,5 @@ class type page_setup_t = object + method copy : unit -> page_setup_t method get_bottom_margin : Gtk_enums.unit -> float method get_left_margin : Gtk_enums.unit -> float method get_orientation : unit -> Gtk_enums.pageorientation @@ -24,6 +25,10 @@ end (* High-level class for PageSetup *) class page_setup (obj : Page_setup.t) : page_setup_t = object (self) + method copy : unit -> page_setup_t = + fun () -> + new page_setup(Page_setup.copy obj) + method get_bottom_margin : Gtk_enums.unit -> float = fun unit -> (Page_setup.get_bottom_margin obj unit) diff --git a/ocgtk/src/gtk/generated/gPage_setup.mli b/ocgtk/src/gtk/generated/gPage_setup.mli index 141d0b3fa..d1bd5e39a 100644 --- a/ocgtk/src/gtk/generated/gPage_setup.mli +++ b/ocgtk/src/gtk/generated/gPage_setup.mli @@ -1,4 +1,5 @@ class type page_setup_t = object + method copy : unit -> page_setup_t method get_bottom_margin : Gtk_enums.unit -> float method get_left_margin : Gtk_enums.unit -> float method get_orientation : unit -> Gtk_enums.pageorientation diff --git a/ocgtk/src/gtk/generated/gPrint_backend.ml b/ocgtk/src/gtk/generated/gPrint_backend.ml index 4c1dfacc3..54692afbd 100644 --- a/ocgtk/src/gtk/generated/gPrint_backend.ml +++ b/ocgtk/src/gtk/generated/gPrint_backend.ml @@ -1,5 +1,9 @@ +class type print_backend_t = object + method as_print_backend : Print_backend.t +end + (* High-level class for PrintBackend *) -class print_backend (obj : Print_backend.t) = object (self) +class print_backend (obj : Print_backend.t) : print_backend_t = object (self) method as_print_backend = obj end diff --git a/ocgtk/src/gtk/generated/gPrint_backend.mli b/ocgtk/src/gtk/generated/gPrint_backend.mli index 3b33728ef..36f52e5e1 100644 --- a/ocgtk/src/gtk/generated/gPrint_backend.mli +++ b/ocgtk/src/gtk/generated/gPrint_backend.mli @@ -1,5 +1,6 @@ -class print_backend : Print_backend.t -> - object +class type print_backend_t = object method as_print_backend : Print_backend.t - end +end + +class print_backend : Print_backend.t -> print_backend_t diff --git a/ocgtk/src/gtk/generated/gPrint_context.ml b/ocgtk/src/gtk/generated/gPrint_context.ml index bdf17f1f7..c9bdef951 100644 --- a/ocgtk/src/gtk/generated/gPrint_context.ml +++ b/ocgtk/src/gtk/generated/gPrint_context.ml @@ -5,6 +5,7 @@ class type print_context_t = object method get_dpi_x : unit -> float method get_dpi_y : unit -> float method get_height : unit -> float + method get_page_setup : unit -> GPage_setup.page_setup_t method get_pango_fontmap : unit -> Ocgtk_pango.Pango.Font_map.font_map_t method get_width : unit -> float method set_cairo_context : Ocgtk_cairo.Cairo.Context.context_t -> float -> float -> unit @@ -38,6 +39,10 @@ class print_context (obj : Print_context.t) : print_context_t = object (self) fun () -> (Print_context.get_height obj) + method get_page_setup : unit -> GPage_setup.page_setup_t = + fun () -> + new GPage_setup.page_setup(Print_context.get_page_setup obj) + method get_pango_fontmap : unit -> Ocgtk_pango.Pango.Font_map.font_map_t = fun () -> new Ocgtk_pango.Pango.Font_map.font_map(Print_context.get_pango_fontmap obj) diff --git a/ocgtk/src/gtk/generated/gPrint_context.mli b/ocgtk/src/gtk/generated/gPrint_context.mli index 6d2b522d6..9caaa1cfe 100644 --- a/ocgtk/src/gtk/generated/gPrint_context.mli +++ b/ocgtk/src/gtk/generated/gPrint_context.mli @@ -5,6 +5,7 @@ class type print_context_t = object method get_dpi_x : unit -> float method get_dpi_y : unit -> float method get_height : unit -> float + method get_page_setup : unit -> GPage_setup.page_setup_t method get_pango_fontmap : unit -> Ocgtk_pango.Pango.Font_map.font_map_t method get_width : unit -> float method set_cairo_context : Ocgtk_cairo.Cairo.Context.context_t -> float -> float -> unit diff --git a/ocgtk/src/gtk/generated/gPrint_dialog.ml b/ocgtk/src/gtk/generated/gPrint_dialog.ml index bae6e78fd..29d5dc29d 100644 --- a/ocgtk/src/gtk/generated/gPrint_dialog.ml +++ b/ocgtk/src/gtk/generated/gPrint_dialog.ml @@ -1,11 +1,15 @@ class type print_dialog_t = object method get_accept_label : unit -> string method get_modal : unit -> bool + method get_page_setup : unit -> GPage_setup.page_setup_t + method get_print_settings : unit -> GPrint_settings.print_settings_t method get_title : unit -> string method print_file_finish : Ocgtk_gio.Gio.Async_result.async_result_t -> (bool, GError.t) result method print_finish : Ocgtk_gio.Gio.Async_result.async_result_t -> (Ocgtk_gio.Gio.Output_stream.output_stream_t option, GError.t) result method set_accept_label : string -> unit method set_modal : bool -> unit + method set_page_setup : GPage_setup.page_setup_t -> unit + method set_print_settings : GPrint_settings.print_settings_t -> unit method set_title : string -> unit method setup_finish : Ocgtk_gio.Gio.Async_result.async_result_t -> (Print_setup.t option, GError.t) result method as_print_dialog : Print_dialog.t @@ -22,6 +26,14 @@ class print_dialog (obj : Print_dialog.t) : print_dialog_t = object (self) fun () -> (Print_dialog.get_modal obj) + method get_page_setup : unit -> GPage_setup.page_setup_t = + fun () -> + new GPage_setup.page_setup(Print_dialog.get_page_setup obj) + + method get_print_settings : unit -> GPrint_settings.print_settings_t = + fun () -> + new GPrint_settings.print_settings(Print_dialog.get_print_settings obj) + method get_title : unit -> string = fun () -> (Print_dialog.get_title obj) @@ -44,6 +56,16 @@ class print_dialog (obj : Print_dialog.t) : print_dialog_t = object (self) fun modal -> (Print_dialog.set_modal obj modal) + method set_page_setup : GPage_setup.page_setup_t -> unit = + fun page_setup -> + let page_setup = page_setup#as_page_setup in + (Print_dialog.set_page_setup obj page_setup) + + method set_print_settings : GPrint_settings.print_settings_t -> unit = + fun print_settings -> + let print_settings = print_settings#as_print_settings in + (Print_dialog.set_print_settings obj print_settings) + method set_title : string -> unit = fun title -> (Print_dialog.set_title obj title) diff --git a/ocgtk/src/gtk/generated/gPrint_dialog.mli b/ocgtk/src/gtk/generated/gPrint_dialog.mli index d0a9a5a0d..a74a236e1 100644 --- a/ocgtk/src/gtk/generated/gPrint_dialog.mli +++ b/ocgtk/src/gtk/generated/gPrint_dialog.mli @@ -1,11 +1,15 @@ class type print_dialog_t = object method get_accept_label : unit -> string method get_modal : unit -> bool + method get_page_setup : unit -> GPage_setup.page_setup_t + method get_print_settings : unit -> GPrint_settings.print_settings_t method get_title : unit -> string method print_file_finish : Ocgtk_gio.Gio.Async_result.async_result_t -> (bool, GError.t) result method print_finish : Ocgtk_gio.Gio.Async_result.async_result_t -> (Ocgtk_gio.Gio.Output_stream.output_stream_t option, GError.t) result method set_accept_label : string -> unit method set_modal : bool -> unit + method set_page_setup : GPage_setup.page_setup_t -> unit + method set_print_settings : GPrint_settings.print_settings_t -> unit method set_title : string -> unit method setup_finish : Ocgtk_gio.Gio.Async_result.async_result_t -> (Print_setup.t option, GError.t) result method as_print_dialog : Print_dialog.t diff --git a/ocgtk/src/gtk/generated/gPrint_operation.ml b/ocgtk/src/gtk/generated/gPrint_operation.ml index 205c73696..331f6b703 100644 --- a/ocgtk/src/gtk/generated/gPrint_operation.ml +++ b/ocgtk/src/gtk/generated/gPrint_operation.ml @@ -4,10 +4,12 @@ class type print_operation_t = object inherit Gprint_operation_signals.print_operation_signals method cancel : unit -> unit method draw_page_finish : unit -> unit + method get_default_page_setup : unit -> GPage_setup.page_setup_t method get_embed_page_setup : unit -> bool method get_error : unit -> (unit, GError.t) result method get_has_selection : unit -> bool method get_n_pages_to_print : unit -> int + method get_print_settings : unit -> GPrint_settings.print_settings_t option method get_status : unit -> Gtk_enums.printstatus method get_status_string : unit -> string method get_support_selection : unit -> bool @@ -16,12 +18,14 @@ class type print_operation_t = object method set_allow_async : bool -> unit method set_current_page : int -> unit method set_custom_tab_label : string option -> unit + method set_default_page_setup : GPage_setup.page_setup_t option -> unit method set_defer_drawing : unit -> unit method set_embed_page_setup : bool -> unit method set_export_filename : string -> unit method set_has_selection : bool -> unit method set_job_name : string -> unit method set_n_pages : int -> unit + method set_print_settings : GPrint_settings.print_settings_t option -> unit method set_show_progress : bool -> unit method set_support_selection : bool -> unit method set_track_print_status : bool -> unit @@ -42,6 +46,10 @@ class print_operation (obj : Print_operation.t) : print_operation_t = object (se fun () -> (Print_operation.draw_page_finish obj) + method get_default_page_setup : unit -> GPage_setup.page_setup_t = + fun () -> + new GPage_setup.page_setup(Print_operation.get_default_page_setup obj) + method get_embed_page_setup : unit -> bool = fun () -> (Print_operation.get_embed_page_setup obj) @@ -58,6 +66,10 @@ class print_operation (obj : Print_operation.t) : print_operation_t = object (se fun () -> (Print_operation.get_n_pages_to_print obj) + method get_print_settings : unit -> GPrint_settings.print_settings_t option = + fun () -> + Option.map (fun ret -> new GPrint_settings.print_settings ret) (Print_operation.get_print_settings obj) + method get_status : unit -> Gtk_enums.printstatus = fun () -> (Print_operation.get_status obj) @@ -91,6 +103,11 @@ class print_operation (obj : Print_operation.t) : print_operation_t = object (se fun label -> (Print_operation.set_custom_tab_label obj label) + method set_default_page_setup : GPage_setup.page_setup_t option -> unit = + fun default_page_setup -> + let default_page_setup = Option.map (fun (c) -> c#as_page_setup) default_page_setup in + (Print_operation.set_default_page_setup obj default_page_setup) + method set_defer_drawing : unit -> unit = fun () -> (Print_operation.set_defer_drawing obj) @@ -115,6 +132,11 @@ class print_operation (obj : Print_operation.t) : print_operation_t = object (se fun n_pages -> (Print_operation.set_n_pages obj n_pages) + method set_print_settings : GPrint_settings.print_settings_t option -> unit = + fun print_settings -> + let print_settings = Option.map (fun (c) -> c#as_print_settings) print_settings in + (Print_operation.set_print_settings obj print_settings) + method set_show_progress : bool -> unit = fun show_progress -> (Print_operation.set_show_progress obj show_progress) diff --git a/ocgtk/src/gtk/generated/gPrint_operation.mli b/ocgtk/src/gtk/generated/gPrint_operation.mli index a4b4f4d14..4aa1975f7 100644 --- a/ocgtk/src/gtk/generated/gPrint_operation.mli +++ b/ocgtk/src/gtk/generated/gPrint_operation.mli @@ -2,10 +2,12 @@ class type print_operation_t = object inherit Gprint_operation_signals.print_operation_signals method cancel : unit -> unit method draw_page_finish : unit -> unit + method get_default_page_setup : unit -> GPage_setup.page_setup_t method get_embed_page_setup : unit -> bool method get_error : unit -> (unit, GError.t) result method get_has_selection : unit -> bool method get_n_pages_to_print : unit -> int + method get_print_settings : unit -> GPrint_settings.print_settings_t option method get_status : unit -> Gtk_enums.printstatus method get_status_string : unit -> string method get_support_selection : unit -> bool @@ -14,12 +16,14 @@ class type print_operation_t = object method set_allow_async : bool -> unit method set_current_page : int -> unit method set_custom_tab_label : string option -> unit + method set_default_page_setup : GPage_setup.page_setup_t option -> unit method set_defer_drawing : unit -> unit method set_embed_page_setup : bool -> unit method set_export_filename : string -> unit method set_has_selection : bool -> unit method set_job_name : string -> unit method set_n_pages : int -> unit + method set_print_settings : GPrint_settings.print_settings_t option -> unit method set_show_progress : bool -> unit method set_support_selection : bool -> unit method set_track_print_status : bool -> unit diff --git a/ocgtk/src/gtk/generated/gPrint_settings.ml b/ocgtk/src/gtk/generated/gPrint_settings.ml index b39bbbc14..9f1359794 100644 --- a/ocgtk/src/gtk/generated/gPrint_settings.ml +++ b/ocgtk/src/gtk/generated/gPrint_settings.ml @@ -1,4 +1,5 @@ class type print_settings_t = object + method copy : unit -> print_settings_t method get : string -> string option method get_bool : string -> bool method get_collate : unit -> bool @@ -71,6 +72,10 @@ end (* High-level class for PrintSettings *) class print_settings (obj : Print_settings.t) : print_settings_t = object (self) + method copy : unit -> print_settings_t = + fun () -> + new print_settings(Print_settings.copy obj) + method get : string -> string option = fun key -> (Print_settings.get obj key) diff --git a/ocgtk/src/gtk/generated/gPrint_settings.mli b/ocgtk/src/gtk/generated/gPrint_settings.mli index 11315b14d..e0a83d95d 100644 --- a/ocgtk/src/gtk/generated/gPrint_settings.mli +++ b/ocgtk/src/gtk/generated/gPrint_settings.mli @@ -1,4 +1,5 @@ class type print_settings_t = object + method copy : unit -> print_settings_t method get : string -> string option method get_bool : string -> bool method get_collate : unit -> bool diff --git a/ocgtk/src/gtk/generated/gPrint_setup.ml b/ocgtk/src/gtk/generated/gPrint_setup.ml index 517694ff8..1f4926dba 100644 --- a/ocgtk/src/gtk/generated/gPrint_setup.ml +++ b/ocgtk/src/gtk/generated/gPrint_setup.ml @@ -1,4 +1,6 @@ class type print_setup_t = object + method get_page_setup : unit -> GPage_setup.page_setup_t option + method get_print_settings : unit -> GPrint_settings.print_settings_t option method ref : unit -> Print_setup.t method unref : unit -> unit method as_print_setup : Print_setup.t @@ -7,6 +9,14 @@ end (* High-level class for PrintSetup *) class print_setup (obj : Print_setup.t) : print_setup_t = object (self) + method get_page_setup : unit -> GPage_setup.page_setup_t option = + fun () -> + Option.map (fun ret -> new GPage_setup.page_setup ret) (Print_setup.get_page_setup obj) + + method get_print_settings : unit -> GPrint_settings.print_settings_t option = + fun () -> + Option.map (fun ret -> new GPrint_settings.print_settings ret) (Print_setup.get_print_settings obj) + method ref : unit -> Print_setup.t = fun () -> (Print_setup.ref obj) diff --git a/ocgtk/src/gtk/generated/gPrint_setup.mli b/ocgtk/src/gtk/generated/gPrint_setup.mli index 85de267eb..66b3e4eaf 100644 --- a/ocgtk/src/gtk/generated/gPrint_setup.mli +++ b/ocgtk/src/gtk/generated/gPrint_setup.mli @@ -1,4 +1,6 @@ class type print_setup_t = object + method get_page_setup : unit -> GPage_setup.page_setup_t option + method get_print_settings : unit -> GPrint_settings.print_settings_t option method ref : unit -> Print_setup.t method unref : unit -> unit method as_print_setup : Print_setup.t diff --git a/ocgtk/src/gtk/generated/gdk_enums.mli b/ocgtk/src/gtk/generated/gdk_enums.mli index 09fad0a78..bd57c5974 100644 --- a/ocgtk/src/gtk/generated/gdk_enums.mli +++ b/ocgtk/src/gtk/generated/gdk_enums.mli @@ -3,238 +3,440 @@ (* AxisUse - enumeration *) type axisuse = [ + (** the axis is ignored. *) | `IGNORE + (** the axis is used as the x axis. *) | `X + (** the axis is used as the y axis. *) | `Y + (** the axis is used as the scroll x delta *) | `DELTA_X + (** the axis is used as the scroll y delta *) | `DELTA_Y + (** the axis is used for pressure information. *) | `PRESSURE + (** the axis is used for x tilt information. *) | `XTILT + (** the axis is used for y tilt information. *) | `YTILT + (** the axis is used for wheel information. *) | `WHEEL + (** the axis is used for pen/tablet distance information *) | `DISTANCE + (** the axis is used for pen rotation information *) | `ROTATION + (** the axis is used for pen slider information *) | `SLIDER + (** a constant equal to the numerically highest axis value. *) | `LAST ] (* CrossingMode - enumeration *) type crossingmode = [ + (** crossing because of pointer motion. *) | `NORMAL + (** crossing because a grab is activated. *) | `GRAB + (** crossing because a grab is deactivated. *) | `UNGRAB + (** crossing because a GTK grab is activated. *) | `GTK_GRAB + (** crossing because a GTK grab is deactivated. *) | `GTK_UNGRAB + (** crossing because a GTK widget changed + state (e.g. sensitivity). *) | `STATE_CHANGED + (** crossing because a touch sequence has begun, + this event is synthetic as the pointer might have not left the surface. *) | `TOUCH_BEGIN + (** crossing because a touch sequence has ended, + this event is synthetic as the pointer might have not left the surface. *) | `TOUCH_END + (** crossing because of a device switch (i.e. + a mouse taking control of the pointer after a touch device), this event + is synthetic as the pointer didn’t leave the surface. *) | `DEVICE_SWITCH ] (* DevicePadFeature - enumeration *) type devicepadfeature = [ + (** a button *) | `BUTTON + (** a ring-shaped interactive area *) | `RING + (** a straight interactive area *) | `STRIP ] (* DeviceToolType - enumeration *) type devicetooltype = [ + (** Tool is of an unknown type. *) | `UNKNOWN + (** Tool is a standard tablet stylus. *) | `PEN + (** Tool is standard tablet eraser. *) | `ERASER + (** Tool is a brush stylus. *) | `BRUSH + (** Tool is a pencil stylus. *) | `PENCIL + (** Tool is an airbrush stylus. *) | `AIRBRUSH + (** Tool is a mouse. *) | `MOUSE + (** Tool is a lens cursor. *) | `LENS ] (* DmabufError - enumeration *) type dmabuferror = [ + (** Dmabuf support is not available, because the OS + is not Linux, or it was explicitly disabled at compile- or runtime *) | `NOT_AVAILABLE + (** The requested format is not supported *) | `UNSUPPORTED_FORMAT + (** GTK failed to create the resource for other + reasons *) | `CREATION_FAILED ] (* DragCancelReason - enumeration *) type dragcancelreason = [ + (** There is no suitable drop target. *) | `NO_TARGET + (** Drag cancelled by the user *) | `USER_CANCELLED + (** Unspecified error. *) | `ERROR ] (* EventType - enumeration *) type eventtype = [ + (** the window manager has requested that the toplevel surface be + hidden or destroyed, usually when the user clicks on a special icon in the + title bar. *) | `DELETE + (** the pointer (usually a mouse) has moved. *) | `MOTION_NOTIFY + (** a mouse button has been pressed. *) | `BUTTON_PRESS + (** a mouse button has been released. *) | `BUTTON_RELEASE + (** a key has been pressed. *) | `KEY_PRESS + (** a key has been released. *) | `KEY_RELEASE + (** the pointer has entered the surface. *) | `ENTER_NOTIFY + (** the pointer has left the surface. *) | `LEAVE_NOTIFY + (** the keyboard focus has entered or left the surface. *) | `FOCUS_CHANGE + (** an input device has moved into contact with a sensing + surface (e.g. a touchscreen or graphics tablet). *) | `PROXIMITY_IN + (** an input device has moved out of contact with a sensing + surface. *) | `PROXIMITY_OUT + (** the mouse has entered the surface while a drag is in progress. *) | `DRAG_ENTER + (** the mouse has left the surface while a drag is in progress. *) | `DRAG_LEAVE + (** the mouse has moved in the surface while a drag is in + progress. *) | `DRAG_MOTION + (** a drop operation onto the surface has started. *) | `DROP_START + (** the scroll wheel was turned *) | `SCROLL + (** a pointer or keyboard grab was broken. *) | `GRAB_BROKEN + (** A new touch event sequence has just started. *) | `TOUCH_BEGIN + (** A touch event sequence has been updated. *) | `TOUCH_UPDATE + (** A touch event sequence has finished. *) | `TOUCH_END + (** A touch event sequence has been canceled. *) | `TOUCH_CANCEL + (** A touchpad swipe gesture event, the current state + is determined by its phase field. *) | `TOUCHPAD_SWIPE + (** A touchpad pinch gesture event, the current state + is determined by its phase field. *) | `TOUCHPAD_PINCH + (** A tablet pad button press event. *) | `PAD_BUTTON_PRESS + (** A tablet pad button release event. *) | `PAD_BUTTON_RELEASE + (** A tablet pad axis event from a "ring". *) | `PAD_RING + (** A tablet pad axis event from a "strip". *) | `PAD_STRIP + (** A tablet pad group mode change. *) | `PAD_GROUP_MODE + (** A touchpad hold gesture event, the current state is determined by its phase +field. *) | `TOUCHPAD_HOLD + (** marks the end of the GdkEventType enumeration. *) | `EVENT_LAST ] (* FullscreenMode - enumeration *) type fullscreenmode = [ + (** Fullscreen on current monitor only. *) | `CURRENT_MONITOR + (** Span across all monitors when fullscreen. *) | `ALL_MONITORS ] (* GLError - enumeration *) type glerror = [ + (** OpenGL support is not available *) | `NOT_AVAILABLE + (** The requested visual format is not supported *) | `UNSUPPORTED_FORMAT + (** The requested profile is not supported *) | `UNSUPPORTED_PROFILE + (** The shader compilation failed *) | `COMPILATION_FAILED + (** The shader linking failed *) | `LINK_FAILED ] (* Gravity - enumeration *) type gravity = [ + (** the reference point is at the top left corner. *) | `NORTH_WEST + (** the reference point is in the middle of the top edge. *) | `NORTH + (** the reference point is at the top right corner. *) | `NORTH_EAST + (** the reference point is at the middle of the left edge. *) | `WEST + (** the reference point is at the center of the surface. *) | `CENTER + (** the reference point is at the middle of the right edge. *) | `EAST + (** the reference point is at the lower left corner. *) | `SOUTH_WEST + (** the reference point is at the middle of the lower edge. *) | `SOUTH + (** the reference point is at the lower right corner. *) | `SOUTH_EAST + (** the reference point is at the top left corner of the + surface itself, ignoring window manager decorations. *) | `STATIC ] (* InputSource - enumeration *) type inputsource = [ + (** the device is a mouse. (This will be reported for the core + pointer, even if it is something else, such as a trackball.) *) | `MOUSE + (** the device is a stylus of a graphics tablet or similar device. *) | `PEN + (** the device is a keyboard. *) | `KEYBOARD + (** the device is a direct-input touch device, such + as a touchscreen or tablet *) | `TOUCHSCREEN + (** the device is an indirect touch device, such + as a touchpad *) | `TOUCHPAD + (** the device is a trackpoint *) | `TRACKPOINT + (** the device is a "pad", a collection of buttons, + rings and strips found in drawing tablets *) | `TABLET_PAD ] (* KeyMatch - enumeration *) type keymatch = [ + (** The key event does not match *) | `NONE + (** The key event matches if keyboard state + (specifically, the currently active group) is ignored *) | `PARTIAL + (** The key event matches *) | `EXACT ] (* MemoryFormat - enumeration *) type memoryformat = [ + (** 4 bytes; for blue, green, red, alpha. + The color values are premultiplied with the alpha value. *) | `B8G8R8A8_PREMULTIPLIED + (** 4 bytes; for alpha, red, green, blue. + The color values are premultiplied with the alpha value. *) | `A8R8G8B8_PREMULTIPLIED + (** 4 bytes; for red, green, blue, alpha + The color values are premultiplied with the alpha value. *) | `R8G8B8A8_PREMULTIPLIED + (** 4 bytes; for blue, green, red, alpha. *) | `B8G8R8A8 + (** 4 bytes; for alpha, red, green, blue. *) | `A8R8G8B8 + (** 4 bytes; for red, green, blue, alpha. *) | `R8G8B8A8 + (** 4 bytes; for alpha, blue, green, red. *) | `A8B8G8R8 + (** 3 bytes; for red, green, blue. The data is opaque. *) | `R8G8B8 + (** 3 bytes; for blue, green, red. The data is opaque. *) | `B8G8R8 + (** 3 guint16 values; for red, green, blue. *) | `R16G16B16 + (** 4 guint16 values; for red, green, blue, alpha. The color values are +premultiplied with the alpha value. *) | `R16G16B16A16_PREMULTIPLIED + (** 4 guint16 values; for red, green, blue, alpha. *) | `R16G16B16A16 + (** 3 half-float values; for red, green, blue. The data is opaque. *) | `R16G16B16_FLOAT + (** 4 half-float values; for red, green, blue and alpha. The color values are +premultiplied with the alpha value. *) | `R16G16B16A16_FLOAT_PREMULTIPLIED + (** 4 half-float values; for red, green, blue and alpha. *) | `R16G16B16A16_FLOAT + (** 3 float values; for red, green, blue. *) | `R32G32B32_FLOAT + (** 4 float values; for red, green, blue and alpha. The color values are +premultiplied with the alpha value. *) | `R32G32B32A32_FLOAT_PREMULTIPLIED + (** 4 float values; for red, green, blue and alpha. *) | `R32G32B32A32_FLOAT + (** 2 bytes; for grayscale, alpha. The color values are premultiplied with the +alpha value. *) | `G8A8_PREMULTIPLIED + (** 2 bytes; for grayscale, alpha. *) | `G8A8 + (** One byte; for grayscale. The data is opaque. *) | `G8 + (** 2 guint16 values; for grayscale, alpha. The color values are premultiplied +with the alpha value. *) | `G16A16_PREMULTIPLIED + (** 2 guint16 values; for grayscale, alpha. *) | `G16A16 + (** One guint16 value; for grayscale. The data is opaque. *) | `G16 + (** One byte; for alpha. *) | `A8 + (** One guint16 value; for alpha. *) | `A16 + (** One half-float value; for alpha. *) | `A16_FLOAT + (** One float value; for alpha. *) | `A32_FLOAT + (** 4 bytes; for alpha, blue, green, red, The color values are premultiplied with +the alpha value. *) | `A8B8G8R8_PREMULTIPLIED + (** 4 bytes; for blue, green, red, unused. *) | `B8G8R8X8 + (** 4 bytes; for unused, red, green, blue. *) | `X8R8G8B8 + (** 4 bytes; for red, green, blue, unused. *) | `R8G8B8X8 + (** 4 bytes; for unused, blue, green, red. *) | `X8B8G8R8 + (** The number of formats. This value will change as + more formats get added, so do not rely on its concrete integer. *) | `N_FORMATS ] (* NotifyType - enumeration *) type notifytype = [ + (** the surface is entered from an ancestor or + left towards an ancestor. *) | `ANCESTOR + (** the pointer moves between an ancestor and an + inferior of the surface. *) | `VIRTUAL + (** the surface is entered from an inferior or + left towards an inferior. *) | `INFERIOR + (** the surface is entered from or left towards + a surface which is neither an ancestor nor an inferior. *) | `NONLINEAR + (** the pointer moves between two surfaces + which are not ancestors of each other and the surface is part of + the ancestor chain between one of these surfaces and their least + common ancestor. *) | `NONLINEAR_VIRTUAL + (** an unknown type of enter/leave event occurred. *) | `UNKNOWN ] (* ScrollDirection - enumeration *) type scrolldirection = [ + (** the surface is scrolled up. *) | `UP + (** the surface is scrolled down. *) | `DOWN + (** the surface is scrolled to the left. *) | `LEFT + (** the surface is scrolled to the right. *) | `RIGHT + (** the scrolling is determined by the delta values + in scroll events. See gdk_scroll_event_get_deltas() *) | `SMOOTH ] (* ScrollUnit - enumeration *) type scrollunit = [ + (** The delta is in number of wheel clicks. *) | `WHEEL + (** The delta is in surface pixels to scroll directly + on screen. *) | `SURFACE ] (* SubpixelLayout - enumeration *) type subpixellayout = [ + (** The layout is not known *) | `UNKNOWN + (** Not organized in this way *) | `NONE + (** The layout is horizontal, the order is RGB *) | `HORIZONTAL_RGB + (** The layout is horizontal, the order is BGR *) | `HORIZONTAL_BGR + (** The layout is vertical, the order is RGB *) | `VERTICAL_RGB + (** The layout is vertical, the order is BGR *) | `VERTICAL_BGR ] (* SurfaceEdge - enumeration *) type surfaceedge = [ + (** the top left corner. *) | `NORTH_WEST + (** the top edge. *) | `NORTH + (** the top right corner. *) | `NORTH_EAST + (** the left edge. *) | `WEST + (** the right edge. *) | `EAST + (** the lower left corner. *) | `SOUTH_WEST + (** the lower edge. *) | `SOUTH + (** the lower right corner. *) | `SOUTH_EAST ] (* TextureError - enumeration *) type textureerror = [ + (** Not enough memory to handle this image *) | `TOO_LARGE + (** The image data appears corrupted *) | `CORRUPT_IMAGE + (** The image contains features + that cannot be loaded *) | `UNSUPPORTED_CONTENT + (** The image format is not supported *) | `UNSUPPORTED_FORMAT ] @@ -247,28 +449,46 @@ type titlebargesture = [ (* TouchpadGesturePhase - enumeration *) type touchpadgesturephase = [ + (** The gesture has begun. *) | `BEGIN + (** The gesture has been updated. *) | `UPDATE + (** The gesture was finished, changes + should be permanently applied. *) | `END + (** The gesture was cancelled, all + changes should be undone. *) | `CANCEL ] (* VulkanError - enumeration *) type vulkanerror = [ + (** Vulkan is not supported on this backend or has not been + compiled in. *) | `UNSUPPORTED + (** Vulkan support is not available on this Surface *) | `NOT_AVAILABLE ] (* AnchorHints - bitfield/flags *) type anchorhints_flag = [ + (** allow flipping anchors horizontally *) | `FLIP_X + (** allow flipping anchors vertically *) | `FLIP_Y + (** allow sliding surface horizontally *) | `SLIDE_X + (** allow sliding surface vertically *) | `SLIDE_Y + (** allow resizing surface horizontally *) | `RESIZE_X + (** allow resizing surface vertically *) | `RESIZE_Y + (** allow flipping anchors on both axes *) | `FLIP + (** allow sliding surface on both axes *) | `SLIDE + (** allow resizing surface on both axes *) | `RESIZE ] @@ -276,16 +496,27 @@ type anchorhints = anchorhints_flag list (* AxisFlags - bitfield/flags *) type axisflags_flag = [ + (** X axis is present *) | `X + (** Y axis is present *) | `Y + (** Scroll X delta axis is present *) | `DELTA_X + (** Scroll Y delta axis is present *) | `DELTA_Y + (** Pressure axis is present *) | `PRESSURE + (** X tilt axis is present *) | `XTILT + (** Y tilt axis is present *) | `YTILT + (** Wheel axis is present *) | `WHEEL + (** Distance axis is present *) | `DISTANCE + (** Z-axis rotation is present *) | `ROTATION + (** Slider axis is present *) | `SLIDER ] @@ -293,9 +524,16 @@ type axisflags = axisflags_flag list (* DragAction - bitfield/flags *) type dragaction_flag = [ + (** Copy the data. *) | `COPY + (** Move the data, i.e. first copy it, then delete + it from the source using the DELETE target of the X selection protocol. *) | `MOVE + (** Add a link to the data. Note that this is only + useful if source and destination agree on what it means, and is not + supported on all platforms. *) | `LINK + (** Ask the user what to do with the data. *) | `ASK ] @@ -303,13 +541,21 @@ type dragaction = dragaction_flag list (* FrameClockPhase - bitfield/flags *) type frameclockphase_flag = [ + (** no phase *) | `NONE + (** corresponds to GdkFrameClock::flush-events. Should not be handled by applications. *) | `FLUSH_EVENTS + (** corresponds to GdkFrameClock::before-paint. Should not be handled by applications. *) | `BEFORE_PAINT + (** corresponds to GdkFrameClock::update. *) | `UPDATE + (** corresponds to GdkFrameClock::layout. Should not be handled by applications. *) | `LAYOUT + (** corresponds to GdkFrameClock::paint. *) | `PAINT + (** corresponds to GdkFrameClock::resume-events. Should not be handled by applications. *) | `RESUME_EVENTS + (** corresponds to GdkFrameClock::after-paint. Should not be handled by applications. *) | `AFTER_PAINT ] @@ -317,7 +563,9 @@ type frameclockphase = frameclockphase_flag list (* GLAPI - bitfield/flags *) type glapi_flag = [ + (** The OpenGL API *) | `GL + (** The OpenGL ES API *) | `GLES ] @@ -325,18 +573,34 @@ type glapi = glapi_flag list (* ModifierType - bitfield/flags *) type modifiertype_flag = [ + (** No modifier. *) | `NO_MODIFIER_MASK + (** the Shift key. *) | `SHIFT_MASK + (** a Lock key (depending on the modifier mapping of the + X server this may either be CapsLock or ShiftLock). *) | `LOCK_MASK + (** the Control key. *) | `CONTROL_MASK + (** the fourth modifier key (it depends on the modifier + mapping of the X server which key is interpreted as this modifier, but + normally it is the Alt key). *) | `ALT_MASK + (** the first mouse button. *) | `BUTTON1_MASK + (** the second mouse button. *) | `BUTTON2_MASK + (** the third mouse button. *) | `BUTTON3_MASK + (** the fourth mouse button. *) | `BUTTON4_MASK + (** the fifth mouse button. *) | `BUTTON5_MASK + (** the Super modifier *) | `SUPER_MASK + (** the Hyper modifier *) | `HYPER_MASK + (** the Meta modifier *) | `META_MASK ] @@ -344,7 +608,13 @@ type modifiertype = modifiertype_flag list (* PaintableFlags - bitfield/flags *) type paintableflags_flag = [ + (** The size is immutable. + The [signal@Gdk.Paintable::invalidate-size] signal will never be + emitted. *) | `SIZE + (** The content is immutable. + The [signal@Gdk.Paintable::invalidate-contents] signal will never be + emitted. *) | `CONTENTS ] @@ -352,13 +622,21 @@ type paintableflags = paintableflags_flag list (* SeatCapabilities - bitfield/flags *) type seatcapabilities_flag = [ + (** No input capabilities *) | `NONE + (** The seat has a pointer (e.g. mouse) *) | `POINTER + (** The seat has touchscreen(s) attached *) | `TOUCH + (** The seat has drawing tablet(s) attached *) | `TABLET_STYLUS + (** The seat has keyboard(s) attached *) | `KEYBOARD + (** The seat has drawing tablet pad(s) attached *) | `TABLET_PAD + (** The union of all pointing capabilities *) | `ALL_POINTING + (** The union of all capabilities *) | `ALL ] @@ -366,22 +644,39 @@ type seatcapabilities = seatcapabilities_flag list (* ToplevelState - bitfield/flags *) type toplevelstate_flag = [ + (** the surface is minimized *) | `MINIMIZED + (** the surface is maximized *) | `MAXIMIZED + (** the surface is sticky *) | `STICKY + (** the surface is maximized without decorations *) | `FULLSCREEN + (** the surface is kept above other surfaces *) | `ABOVE + (** the surface is kept below other surfaces *) | `BELOW + (** the surface is presented as focused (with active decorations) *) | `FOCUSED + (** the surface is in a tiled state *) | `TILED + (** whether the top edge is tiled *) | `TOP_TILED + (** whether the top edge is resizable *) | `TOP_RESIZABLE + (** whether the right edge is tiled *) | `RIGHT_TILED + (** whether the right edge is resizable *) | `RIGHT_RESIZABLE + (** whether the bottom edge is tiled *) | `BOTTOM_TILED + (** whether the bottom edge is resizable *) | `BOTTOM_RESIZABLE + (** whether the left edge is tiled *) | `LEFT_TILED + (** whether the left edge is resizable *) | `LEFT_RESIZABLE + (** the surface is not visible to the user *) | `SUSPENDED ] diff --git a/ocgtk/src/gtk/generated/gdkpixbuf_enums.mli b/ocgtk/src/gtk/generated/gdkpixbuf_enums.mli index 51700e70f..0ef0edde5 100644 --- a/ocgtk/src/gtk/generated/gdkpixbuf_enums.mli +++ b/ocgtk/src/gtk/generated/gdkpixbuf_enums.mli @@ -3,46 +3,90 @@ (* Colorspace - enumeration *) type colorspace = [ + (** Indicates a red/green/blue additive color space. *) | `RGB ] (* InterpType - enumeration *) type interptype = [ + (** Nearest neighbor sampling; this is the fastest + and lowest quality mode. Quality is normally unacceptable when scaling + down, but may be OK when scaling up. *) | `NEAREST + (** This is an accurate simulation of the PostScript + image operator without any interpolation enabled. Each pixel is + rendered as a tiny parallelogram of solid color, the edges of which + are implemented with antialiasing. It resembles nearest neighbor for + enlargement, and bilinear for reduction. *) | `TILES + (** Best quality/speed balance; use this mode by + default. Bilinear interpolation. For enlargement, it is + equivalent to point-sampling the ideal bilinear-interpolated image. + For reduction, it is equivalent to laying down small tiles and + integrating over the coverage area. *) | `BILINEAR + (** This is the slowest and highest quality + reconstruction function. It is derived from the hyperbolic filters in + Wolberg's "Digital Image Warping", and is formally defined as the + hyperbolic-filter sampling the ideal hyperbolic-filter interpolated + image (the filter is designed to be idempotent for 1:1 pixel mapping). + **Deprecated**: this interpolation filter is deprecated, as in reality + it has a lower quality than the @GDK_INTERP_BILINEAR filter + (Since: 2.38) *) | `HYPER ] (* PixbufAlphaMode - enumeration *) type pixbufalphamode = [ + (** A bilevel clipping mask (black and white) + will be created and used to draw the image. Pixels below 0.5 opacity + will be considered fully transparent, and all others will be + considered fully opaque. *) | `BILEVEL + (** For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL. + In the future it will do full alpha compositing. *) | `FULL ] (* PixbufError - enumeration *) type pixbuferror = [ + (** An image file was broken somehow. *) | `CORRUPT_IMAGE + (** Not enough memory. *) | `INSUFFICIENT_MEMORY + (** A bad option was passed to a pixbuf save module. *) | `BAD_OPTION + (** Unknown image type. *) | `UNKNOWN_TYPE + (** Don't know how to perform the + given operation on the type of image at hand. *) | `UNSUPPORTED_OPERATION + (** Generic failure code, something went wrong. *) | `FAILED + (** Only part of the animation was loaded. *) | `INCOMPLETE_ANIMATION ] (* PixbufRotation - enumeration *) type pixbufrotation = [ + (** No rotation. *) | `NONE + (** Rotate by 90 degrees. *) | `COUNTERCLOCKWISE + (** Rotate by 180 degrees. *) | `UPSIDEDOWN + (** Rotate by 270 degrees. *) | `CLOCKWISE ] (* PixbufFormatFlags - bitfield/flags *) type pixbufformatflags_flag = [ + (** the module can write out images in the format. *) | `WRITABLE + (** the image format is scalable *) | `SCALABLE + (** the module is threadsafe. gdk-pixbuf + ignores modules that are not marked as threadsafe. (Since 2.28). *) | `THREADSAFE ] diff --git a/ocgtk/src/gtk/generated/gobject_enums.mli b/ocgtk/src/gtk/generated/gobject_enums.mli index 506c6d2d3..32c9ff6fa 100644 --- a/ocgtk/src/gtk/generated/gobject_enums.mli +++ b/ocgtk/src/gtk/generated/gobject_enums.mli @@ -3,9 +3,22 @@ (* BindingFlags - bitfield/flags *) type bindingflags_flag = [ + (** The default binding; if the source property + changes, the target property is updated with its value. *) | `DEFAULT + (** Bidirectional binding; if either the + property of the source or the property of the target changes, + the other is updated. *) | `BIDIRECTIONAL + (** Synchronize the values of the source and + target properties when creating the binding; the direction of + the synchronization is always from the source to the target. *) | `SYNC_CREATE + (** If the two properties being bound are + booleans, setting one to %TRUE will result in the other being + set to %FALSE and vice versa. This flag will only work for + boolean properties, and cannot be used when passing custom + transformation functions to g_object_bind_property_full(). *) | `INVERT_BOOLEAN ] @@ -13,8 +26,14 @@ type bindingflags = bindingflags_flag list (* ConnectFlags - bitfield/flags *) type connectflags_flag = [ + (** Default behaviour (no special flags). Since: 2.74 *) | `DEFAULT + (** If set, the handler should be called after the + default handler of the signal. Normally, the handler is called before + the default handler. *) | `AFTER + (** If set, the instance and data should be swapped when + calling the handler; see g_signal_connect_swapped() for an example. *) | `SWAPPED ] @@ -34,17 +53,45 @@ type iocondition = iocondition_flag list (* ParamFlags - bitfield/flags *) type paramflags_flag = [ + (** the parameter is readable *) | `READABLE + (** the parameter is writable *) | `WRITABLE + (** alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE *) | `READWRITE + (** the parameter will be set upon object construction *) | `CONSTRUCT + (** the parameter can only be set upon object construction *) | `CONSTRUCT_ONLY + (** upon parameter conversion (see g_param_value_convert()) + strict validation is not required *) | `LAX_VALIDATION + (** the string used as name when constructing the + parameter is guaranteed to remain valid and + unmodified for the lifetime of the parameter. + Since 2.8 *) | `STATIC_NAME + (** internal *) | `PRIVATE + (** the string used as nick when constructing the + parameter is guaranteed to remain valid and + unmmodified for the lifetime of the parameter. + Since 2.8 *) | `STATIC_NICK + (** the string used as blurb when constructing the + parameter is guaranteed to remain valid and + unmodified for the lifetime of the parameter. + Since 2.8 *) | `STATIC_BLURB + (** calls to g_object_set_property() for this + property will not automatically result in a "notify" signal being + emitted: the implementation must call g_object_notify() themselves + in case the property actually changes. Since: 2.42. *) | `EXPLICIT_NOTIFY + (** the parameter is deprecated and will be removed + in a future version. A warning will be generated if it is used + while running with G_ENABLE_DIAGNOSTIC=1. + Since 2.26 *) | `DEPRECATED ] @@ -52,15 +99,38 @@ type paramflags = paramflags_flag list (* SignalFlags - bitfield/flags *) type signalflags_flag = [ + (** Invoke the object method handler in the first emission stage. *) | `RUN_FIRST + (** Invoke the object method handler in the third emission stage. *) | `RUN_LAST + (** Invoke the object method handler in the last emission stage. *) | `RUN_CLEANUP + (** Signals being emitted for an object while currently being in + emission for this very object will not be emitted recursively, + but instead cause the first emission to be restarted. *) | `NO_RECURSE + (** This signal supports "::detail" appendices to the signal name + upon handler connections and emissions. *) | `DETAILED + (** Action signals are signals that may freely be emitted on alive + objects from user code via g_signal_emit() and friends, without + the need of being embedded into extra code that performs pre or + post emission adjustments on the object. They can also be thought + of as object methods which can be called generically by + third-party code. *) | `ACTION + (** No emissions hooks are supported for this signal. *) | `NO_HOOKS + (** Varargs signal emission will always collect the + arguments, even if there are no signal handlers connected. Since 2.30. *) | `MUST_COLLECT + (** The signal is deprecated and will be removed + in a future version. A warning will be generated if it is connected while + running with G_ENABLE_DIAGNOSTIC=1. Since 2.32. *) | `DEPRECATED + (** Only used in #GSignalAccumulator accumulator + functions for the #GSignalInvocationHint::run_type field to mark the first + call to the accumulator function for a signal emission. Since 2.68. *) | `ACCUMULATOR_FIRST_RUN ] @@ -68,11 +138,17 @@ type signalflags = signalflags_flag list (* SignalMatchType - bitfield/flags *) type signalmatchtype_flag = [ + (** The signal id must be equal. *) | `ID + (** The signal detail must be equal. *) | `DETAIL + (** The closure must be the same. *) | `CLOSURE + (** The C closure callback must be the same. *) | `FUNC + (** The closure data must be the same. *) | `DATA + (** Only unblocked signals may be matched. *) | `UNBLOCKED ] @@ -80,10 +156,15 @@ type signalmatchtype = signalmatchtype_flag list (* TypeDebugFlags - bitfield/flags *) type typedebugflags_flag = [ + (** Print no messages *) | `NONE + (** Print messages about object bookkeeping *) | `OBJECTS + (** Print messages about signal emissions *) | `SIGNALS + (** Keep a count of instances of each type *) | `INSTANCE_COUNT + (** Mask covering all debug flags *) | `MASK ] @@ -91,10 +172,21 @@ type typedebugflags = typedebugflags_flag list (* TypeFlags - bitfield/flags *) type typeflags_flag = [ + (** No special flags. Since: 2.74 *) | `NONE + (** Indicates an abstract type. No instances can be + created for an abstract type *) | `ABSTRACT + (** Indicates an abstract value type, i.e. a type + that introduces a value table, but can't be used for + g_value_init() *) | `VALUE_ABSTRACT + (** Indicates a final type. A final type is a non-derivable + leaf node in a deep derivable type hierarchy tree. Since: 2.70 *) | `FINAL + (** The type is deprecated and may be removed in a + future version. A warning will be emitted if it is instantiated while + running with `G_ENABLE_DIAGNOSTIC=1`. Since 2.76 *) | `DEPRECATED ] @@ -102,9 +194,13 @@ type typeflags = typeflags_flag list (* TypeFundamentalFlags - bitfield/flags *) type typefundamentalflags_flag = [ + (** Indicates a classed type *) | `CLASSED + (** Indicates an instantiatable type (implies classed) *) | `INSTANTIATABLE + (** Indicates a flat derivable type *) | `DERIVABLE + (** Indicates a deep derivable type (implies derivable) *) | `DEEP_DERIVABLE ] diff --git a/ocgtk/src/gtk/generated/graphene_enums.mli b/ocgtk/src/gtk/generated/graphene_enums.mli index 9e015a0a3..ef69236ab 100644 --- a/ocgtk/src/gtk/generated/graphene_enums.mli +++ b/ocgtk/src/gtk/generated/graphene_enums.mli @@ -3,43 +3,86 @@ (* EulerOrder - enumeration *) type eulerorder = [ + (** Rotate in the default order; the + default order is one of the following enumeration values *) | `DEFAULT + (** Rotate in the X, Y, and Z order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SXYZ *) | `XYZ + (** Rotate in the Y, Z, and X order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SYZX *) | `YZX + (** Rotate in the Z, X, and Y order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SZXY *) | `ZXY + (** Rotate in the X, Z, and Y order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SXZY *) | `XZY + (** Rotate in the Y, X, and Z order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SYXZ *) | `YXZ + (** Rotate in the Z, Y, and X order. Deprecated in + Graphene 1.10, it's an alias for %GRAPHENE_EULER_ORDER_SZYX *) | `ZYX + (** Defines a static rotation along the X, Y, and Z axes (Since: 1.10) *) | `SXYZ + (** Defines a static rotation along the X, Y, and X axes (Since: 1.10) *) | `SXYX + (** Defines a static rotation along the X, Z, and Y axes (Since: 1.10) *) | `SXZY + (** Defines a static rotation along the X, Z, and X axes (Since: 1.10) *) | `SXZX + (** Defines a static rotation along the Y, Z, and X axes (Since: 1.10) *) | `SYZX + (** Defines a static rotation along the Y, Z, and Y axes (Since: 1.10) *) | `SYZY + (** Defines a static rotation along the Y, X, and Z axes (Since: 1.10) *) | `SYXZ + (** Defines a static rotation along the Y, X, and Y axes (Since: 1.10) *) | `SYXY + (** Defines a static rotation along the Z, X, and Y axes (Since: 1.10) *) | `SZXY + (** Defines a static rotation along the Z, X, and Z axes (Since: 1.10) *) | `SZXZ + (** Defines a static rotation along the Z, Y, and X axes (Since: 1.10) *) | `SZYX + (** Defines a static rotation along the Z, Y, and Z axes (Since: 1.10) *) | `SZYZ + (** Defines a relative rotation along the Z, Y, and X axes (Since: 1.10) *) | `RZYX + (** Defines a relative rotation along the X, Y, and X axes (Since: 1.10) *) | `RXYX + (** Defines a relative rotation along the Y, Z, and X axes (Since: 1.10) *) | `RYZX + (** Defines a relative rotation along the X, Z, and X axes (Since: 1.10) *) | `RXZX + (** Defines a relative rotation along the X, Z, and Y axes (Since: 1.10) *) | `RXZY + (** Defines a relative rotation along the Y, Z, and Y axes (Since: 1.10) *) | `RYZY + (** Defines a relative rotation along the Z, X, and Y axes (Since: 1.10) *) | `RZXY + (** Defines a relative rotation along the Y, X, and Y axes (Since: 1.10) *) | `RYXY + (** Defines a relative rotation along the Y, X, and Z axes (Since: 1.10) *) | `RYXZ + (** Defines a relative rotation along the Z, X, and Z axes (Since: 1.10) *) | `RZXZ + (** Defines a relative rotation along the X, Y, and Z axes (Since: 1.10) *) | `RXYZ + (** Defines a relative rotation along the Z, Y, and Z axes (Since: 1.10) *) | `RZYZ ] (* RayIntersectionKind - enumeration *) type rayintersectionkind = [ + (** No intersection *) | `NONE + (** The ray is entering the intersected + object *) | `ENTER + (** The ray is leaving the intersected + object *) | `LEAVE ] diff --git a/ocgtk/src/gtk/generated/gsk_enums.mli b/ocgtk/src/gtk/generated/gsk_enums.mli index 0fc4096d2..998641a71 100644 --- a/ocgtk/src/gtk/generated/gsk_enums.mli +++ b/ocgtk/src/gtk/generated/gsk_enums.mli @@ -3,155 +3,293 @@ (* BlendMode - enumeration *) type blendmode = [ + (** The default blend mode, which specifies no blending *) | `DEFAULT + (** The source color is multiplied by the destination + and replaces the destination *) | `MULTIPLY + (** Multiplies the complements of the destination and source + color values, then complements the result. *) | `SCREEN + (** Multiplies or screens the colors, depending on the + destination color value. This is the inverse of hard-list *) | `OVERLAY + (** Selects the darker of the destination and source colors *) | `DARKEN + (** Selects the lighter of the destination and source colors *) | `LIGHTEN + (** Brightens the destination color to reflect the source color *) | `COLOR_DODGE + (** Darkens the destination color to reflect the source color *) | `COLOR_BURN + (** Multiplies or screens the colors, depending on the source color value *) | `HARD_LIGHT + (** Darkens or lightens the colors, depending on the source color value *) | `SOFT_LIGHT + (** Subtracts the darker of the two constituent colors from the lighter color *) | `DIFFERENCE + (** Produces an effect similar to that of the difference mode but lower in contrast *) | `EXCLUSION + (** Creates a color with the hue and saturation of the source color and the luminosity of the destination color *) | `COLOR + (** Creates a color with the hue of the source color and the saturation and luminosity of the destination color *) | `HUE + (** Creates a color with the saturation of the source color and the hue and luminosity of the destination color *) | `SATURATION + (** Creates a color with the luminosity of the source color and the hue and saturation of the destination color *) | `LUMINOSITY ] (* Corner - enumeration *) type corner = [ + (** The top left corner *) | `TOP_LEFT + (** The top right corner *) | `TOP_RIGHT + (** The bottom right corner *) | `BOTTOM_RIGHT + (** The bottom left corner *) | `BOTTOM_LEFT ] (* FillRule - enumeration *) type fillrule = [ + (** If the path crosses the ray from + left-to-right, counts +1. If the path crosses the ray + from right to left, counts -1. (Left and right are determined + from the perspective of looking along the ray from the starting + point.) If the total count is non-zero, the point will be filled. *) | `WINDING + (** Counts the total number of + intersections, without regard to the orientation of the contour. If + the total number of intersections is odd, the point will be + filled. *) | `EVEN_ODD ] (* GLUniformType - enumeration *) type gluniformtype = [ + (** No type, used for uninitialized or unspecified values. *) | `NONE + (** A float uniform *) | `FLOAT + (** A GLSL int / gint32 uniform *) | `INT + (** A GLSL uint / guint32 uniform *) | `UINT + (** A GLSL bool / gboolean uniform *) | `BOOL + (** A GLSL vec2 / graphene_vec2_t uniform *) | `VEC2 + (** A GLSL vec3 / graphene_vec3_t uniform *) | `VEC3 + (** A GLSL vec4 / graphene_vec4_t uniform *) | `VEC4 ] (* LineCap - enumeration *) type linecap = [ + (** Start and stop the line exactly at the start + and end point *) | `BUTT + (** Use a round ending, the center of the circle + is the start or end point *) | `ROUND + (** use squared ending, the center of the square + is the start or end point *) | `SQUARE ] (* LineJoin - enumeration *) type linejoin = [ + (** Use a sharp angled corner *) | `MITER + (** Use a round join, the center of the circle is + the join point *) | `ROUND + (** use a cut-off join, the join is cut off at half + the line width from the joint point *) | `BEVEL ] (* MaskMode - enumeration *) type maskmode = [ + (** Use the alpha channel of the mask *) | `ALPHA + (** Use the inverted alpha channel of the mask *) | `INVERTED_ALPHA + (** Use the luminance of the mask, + multiplied by mask alpha *) | `LUMINANCE + (** Use the inverted luminance of the mask, + multiplied by mask alpha *) | `INVERTED_LUMINANCE ] (* PathDirection - enumeration *) type pathdirection = [ + (** The tangent in path direction of the incoming side + of the path *) | `FROM_START + (** The tangent against path direction of the incoming side + of the path *) | `TO_START + (** The tangent in path direction of the outgoing side + of the path *) | `TO_END + (** The tangent against path direction of the outgoing + side of the path *) | `FROM_END ] (* PathOperation - enumeration *) type pathoperation = [ + (** A move-to operation, with 1 point describing the target point. *) | `MOVE + (** A close operation ending the current contour with a line back + to the starting point. Two points describe the start and end of the line. *) | `CLOSE + (** A line-to operation, with 2 points describing the start and + end point of a straight line. *) | `LINE + (** A curve-to operation describing a quadratic Bézier curve + with 3 points describing the start point, the control point and the end + point of the curve. *) | `QUAD + (** A curve-to operation describing a cubic Bézier curve with 4 + points describing the start point, the two control points and the end point + of the curve. *) | `CUBIC + (** A rational quadratic Bézier curve with 3 points describing + the start point, control point and end point of the curve. A weight for the + curve will be passed, too. *) | `CONIC ] (* RenderNodeType - enumeration *) type rendernodetype = [ + (** Error type. No node will ever have this type. *) | `NOT_A_RENDER_NODE + (** A node containing a stack of children *) | `CONTAINER_NODE + (** A node drawing a `cairo_surface_t` *) | `CAIRO_NODE + (** A node drawing a single color rectangle *) | `COLOR_NODE + (** A node drawing a linear gradient *) | `LINEAR_GRADIENT_NODE + (** A node drawing a repeating linear gradient *) | `REPEATING_LINEAR_GRADIENT_NODE + (** A node drawing a radial gradient *) | `RADIAL_GRADIENT_NODE + (** A node drawing a repeating radial gradient *) | `REPEATING_RADIAL_GRADIENT_NODE + (** A node drawing a conic gradient *) | `CONIC_GRADIENT_NODE + (** A node stroking a border around an area *) | `BORDER_NODE + (** A node drawing a `GdkTexture` *) | `TEXTURE_NODE + (** A node drawing an inset shadow *) | `INSET_SHADOW_NODE + (** A node drawing an outset shadow *) | `OUTSET_SHADOW_NODE + (** A node that renders its child after applying a matrix transform *) | `TRANSFORM_NODE + (** A node that changes the opacity of its child *) | `OPACITY_NODE + (** A node that applies a color matrix to every pixel *) | `COLOR_MATRIX_NODE + (** A node that repeats the child's contents *) | `REPEAT_NODE + (** A node that clips its child to a rectangular area *) | `CLIP_NODE + (** A node that clips its child to a rounded rectangle *) | `ROUNDED_CLIP_NODE + (** A node that draws a shadow below its child *) | `SHADOW_NODE + (** A node that blends two children together *) | `BLEND_NODE + (** A node that cross-fades between two children *) | `CROSS_FADE_NODE + (** A node containing a glyph string *) | `TEXT_NODE + (** A node that applies a blur *) | `BLUR_NODE + (** Debug information that does not affect the rendering *) | `DEBUG_NODE + (** A node that uses OpenGL fragment shaders to render *) | `GL_SHADER_NODE + (** A node drawing a `GdkTexture` scaled and filtered. *) | `TEXTURE_SCALE_NODE + (** A node that masks one child with another. *) | `MASK_NODE + (** A node that fills a path. *) | `FILL_NODE + (** A node that strokes a path. *) | `STROKE_NODE + (** A node that possibly redirects part of the scene graph to a subsurface. *) | `SUBSURFACE_NODE ] (* ScalingFilter - enumeration *) type scalingfilter = [ + (** linear interpolation filter *) | `LINEAR + (** nearest neighbor interpolation filter *) | `NEAREST + (** linear interpolation along each axis, + plus mipmap generation, with linear interpolation along the mipmap + levels *) | `TRILINEAR ] (* SerializationError - enumeration *) type serializationerror = [ + (** The format can not be identified *) | `UNSUPPORTED_FORMAT + (** The version of the data is not + understood *) | `UNSUPPORTED_VERSION + (** The given data may not exist in + a proper serialization *) | `INVALID_DATA ] (* TransformCategory - enumeration *) type transformcategory = [ + (** The category of the matrix has not been + determined. *) | `UNKNOWN + (** Analyzing the matrix concluded that it does + not fit in any other category. *) | `ANY + (** The matrix is a 3D matrix. This means that + the w column (the last column) has the values (0, 0, 0, 1). *) | `V3D + (** The matrix is a 2D matrix. This is equivalent + to graphene_matrix_is_2d() returning %TRUE. In particular, this + means that Cairo can deal with the matrix. *) | `V2D + (** The matrix is a combination of 2D scale + and 2D translation operations. In particular, this means that any + rectangle can be transformed exactly using this matrix. *) | `V2D_AFFINE + (** The matrix is a 2D translation. *) | `V2D_TRANSLATE + (** The matrix is the identity matrix. *) | `IDENTITY ] (* PathForeachFlags - bitfield/flags *) type pathforeachflags_flag = [ + (** The default behavior, only allow lines. *) | `ONLY_LINES + (** Allow emission of `GSK_PATH_QUAD` operations *) | `QUAD + (** Allow emission of `GSK_PATH_CUBIC` operations. *) | `CUBIC + (** Allow emission of `GSK_PATH_CONIC` operations. *) | `CONIC ] diff --git a/ocgtk/src/gtk/generated/gtk_decls.h b/ocgtk/src/gtk/generated/gtk_decls.h index 5893ef90d..bccd1201d 100644 --- a/ocgtk/src/gtk/generated/gtk_decls.h +++ b/ocgtk/src/gtk/generated/gtk_decls.h @@ -924,11 +924,6 @@ #define Val_GtkPageSetup(obj) ((value)(ml_gobject_val_of_ext(obj))) #endif /* Val_GtkPageSetup */ -#ifndef Val_GtkPageSetupUnixDialog -#define GtkPageSetupUnixDialog_val(val) ((GtkPageSetupUnixDialog*)ml_gobject_ext_of_val(val)) -#define Val_GtkPageSetupUnixDialog(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GtkPageSetupUnixDialog */ - #ifndef Val_GtkPaned #define GtkPaned_val(val) ((GtkPaned*)ml_gobject_ext_of_val(val)) #define Val_GtkPaned(obj) ((value)(ml_gobject_val_of_ext(obj))) @@ -983,11 +978,6 @@ #endif /* Val_GtkPrintDialog */ #endif -#ifndef Val_GtkPrintJob -#define GtkPrintJob_val(val) ((GtkPrintJob*)ml_gobject_ext_of_val(val)) -#define Val_GtkPrintJob(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GtkPrintJob */ - #ifndef Val_GtkPrintOperation #define GtkPrintOperation_val(val) ((GtkPrintOperation*)ml_gobject_ext_of_val(val)) #define Val_GtkPrintOperation(obj) ((value)(ml_gobject_val_of_ext(obj))) @@ -998,16 +988,6 @@ #define Val_GtkPrintSettings(obj) ((value)(ml_gobject_val_of_ext(obj))) #endif /* Val_GtkPrintSettings */ -#ifndef Val_GtkPrintUnixDialog -#define GtkPrintUnixDialog_val(val) ((GtkPrintUnixDialog*)ml_gobject_ext_of_val(val)) -#define Val_GtkPrintUnixDialog(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GtkPrintUnixDialog */ - -#ifndef Val_GtkPrinter -#define GtkPrinter_val(val) ((GtkPrinter*)ml_gobject_ext_of_val(val)) -#define Val_GtkPrinter(obj) ((value)(ml_gobject_val_of_ext(obj))) -#endif /* Val_GtkPrinter */ - #ifndef Val_GtkProgressBar #define GtkProgressBar_val(val) ((GtkProgressBar*)ml_gobject_ext_of_val(val)) #define Val_GtkProgressBar(obj) ((value)(ml_gobject_val_of_ext(obj))) diff --git a/ocgtk/src/gtk/generated/gtk_enums.mli b/ocgtk/src/gtk/generated/gtk_enums.mli index 97319dcba..ed5f602e9 100644 --- a/ocgtk/src/gtk/generated/gtk_enums.mli +++ b/ocgtk/src/gtk/generated/gtk_enums.mli @@ -10,1032 +10,1918 @@ type accessibleannouncementpriority = [ (* AccessibleAutocomplete - enumeration *) type accessibleautocomplete = [ + (** Automatic suggestions are not displayed. *) | `NONE + (** When a user is providing input, text + suggesting one way to complete the provided input may be dynamically + inserted after the caret. *) | `INLINE + (** When a user is providing input, an element + containing a collection of values that could complete the provided input + may be displayed. *) | `LIST + (** When a user is providing input, an element + containing a collection of values that could complete the provided input + may be displayed. If displayed, one value in the collection is automatically + selected, and the text needed to complete the automatically selected value + appears after the caret in the input. *) | `BOTH ] (* AccessibleInvalidState - enumeration *) type accessibleinvalidstate = [ + (** There are no detected errors in the value *) | `FALSE + (** The value entered by the user has failed validation *) | `TRUE + (** A grammatical error was detected *) | `GRAMMAR + (** A spelling error was detected *) | `SPELLING ] (* AccessiblePlatformState - enumeration *) type accessibleplatformstate = [ + (** whether the accessible can be focused *) | `FOCUSABLE + (** whether the accessible has focus *) | `FOCUSED + (** whether the accessible is active *) | `ACTIVE ] (* AccessibleProperty - enumeration *) type accessibleproperty = [ + (** Indicates whether inputting text + could trigger display of one or more predictions of the user's intended + value for a combobox, searchbox, or textbox and specifies how predictions + would be presented if they were made. Value type: [enum@AccessibleAutocomplete] *) | `AUTOCOMPLETE + (** Defines a string value that describes + or annotates the current element. Value type: string *) | `DESCRIPTION + (** Indicates the availability and type of + interactive popup element, such as menu or dialog, that can be triggered + by an element. *) | `HAS_POPUP + (** Indicates keyboard shortcuts that an + author has implemented to activate or give focus to an element. Value type: + string *) | `KEY_SHORTCUTS + (** Defines a string value that labels the current + element. Value type: string *) | `LABEL + (** Defines the hierarchical level of an element + within a structure. Value type: integer *) | `LEVEL + (** Indicates whether an element is modal when + displayed. Value type: boolean *) | `MODAL + (** Indicates whether a text box accepts + multiple lines of input or only a single line. Value type: boolean *) | `MULTI_LINE + (** Indicates that the user may select + more than one item from the current selectable descendants. Value type: + boolean *) | `MULTI_SELECTABLE + (** Indicates whether the element's + orientation is horizontal, vertical, or unknown/ambiguous. Value type: + [enum@Orientation] *) | `ORIENTATION + (** Defines a short hint (a word or short + phrase) intended to aid the user with data entry when the control has no + value. A hint could be a sample value or a brief description of the expected + format. Value type: string *) | `PLACEHOLDER + (** Indicates that the element is not editable, + but is otherwise operable. Value type: boolean *) | `READ_ONLY + (** Indicates that user input is required on + the element before a form may be submitted. Value type: boolean *) | `REQUIRED + (** Defines a human-readable, + author-localized description for the role of an element. Value type: string *) | `ROLE_DESCRIPTION + (** Indicates if items in a table or grid are + sorted in ascending or descending order. Value type: [enum@AccessibleSort] *) | `SORT + (** Defines the maximum allowed value for a + range widget. Value type: double *) | `VALUE_MAX + (** Defines the minimum allowed value for a + range widget. Value type: double *) | `VALUE_MIN + (** Defines the current value for a range widget. + Value type: double *) | `VALUE_NOW + (** Defines the human readable text alternative + of aria-valuenow for a range widget. Value type: string *) | `VALUE_TEXT ] (* AccessibleRelation - enumeration *) type accessiblerelation = [ + (** Identifies the currently active + element when focus is on a composite widget, combobox, textbox, group, + or application. Value type: reference *) | `ACTIVE_DESCENDANT + (** Defines the total number of columns + in a table, grid, or treegrid. Value type: integer *) | `COL_COUNT + (** Defines an element's column index or + position with respect to the total number of columns within a table, + grid, or treegrid. Value type: integer *) | `COL_INDEX + (** Defines a human readable text + alternative of %GTK_ACCESSIBLE_RELATION_COL_INDEX. Value type: string *) | `COL_INDEX_TEXT + (** Defines the number of columns spanned + by a cell or gridcell within a table, grid, or treegrid. Value type: integer *) | `COL_SPAN + (** Identifies the element (or elements) whose + contents or presence are controlled by the current element. Value type: reference *) | `CONTROLS + (** Identifies the element (or elements) + that describes the object. Value type: reference *) | `DESCRIBED_BY + (** Identifies the element (or elements) that + provide additional information related to the object. Value type: reference *) | `DETAILS + (** Identifies the element that provides + an error message for an object. Value type: reference *) | `ERROR_MESSAGE + (** Identifies the next element (or elements) + in an alternate reading order of content which, at the user's discretion, + allows assistive technology to override the general default of reading in + document source order. Value type: reference *) | `FLOW_TO + (** Identifies the element (or elements) + that labels the current element. Value type: reference *) | `LABELLED_BY + (** Identifies an element (or elements) in order + to define a visual, functional, or contextual parent/child relationship + between elements where the widget hierarchy cannot be used to represent + the relationship. Value type: reference *) | `OWNS + (** Defines an element's number or position + in the current set of listitems or treeitems. Value type: integer *) | `POS_IN_SET + (** Defines the total number of rows in a table, + grid, or treegrid. Value type: integer *) | `ROW_COUNT + (** Defines an element's row index or position + with respect to the total number of rows within a table, grid, or treegrid. + Value type: integer *) | `ROW_INDEX + (** Defines a human readable text + alternative of aria-rowindex. Value type: string *) | `ROW_INDEX_TEXT + (** Defines the number of rows spanned by a + cell or gridcell within a table, grid, or treegrid. Value type: integer *) | `ROW_SPAN + (** Defines the number of items in the current + set of listitems or treeitems. Value type: integer *) | `SET_SIZE ] (* AccessibleRole - enumeration *) type accessiblerole = [ + (** An element with important, and usually + time-sensitive, information *) | `ALERT + (** A type of dialog that contains an + alert message *) | `ALERT_DIALOG + (** Unused *) | `BANNER + (** An input element that allows for + user-triggered actions when clicked or pressed *) | `BUTTON + (** Unused *) | `CAPTION + (** Unused *) | `CELL + (** A checkable input element that has + three possible values: `true`, `false`, or `mixed` *) | `CHECKBOX + (** A header in a columned list. *) | `COLUMN_HEADER + (** An input that controls another element, + such as a list or a grid, that can dynamically pop up to help the user + set the value of the input *) | `COMBO_BOX + (** Abstract role. *) | `COMMAND + (** Abstract role. *) | `COMPOSITE + (** A dialog is a window that is designed to interrupt + the current processing of an application in order to prompt the user to enter + information or require a response. *) | `DIALOG + (** Content that assistive technology users may want to + browse in a reading mode. *) | `DOCUMENT + (** Unused *) | `FEED + (** Unused *) | `FORM + (** A nameless container that has no semantic meaning + of its own. This is the role that GTK uses by default for widgets. *) | `GENERIC + (** A grid of items. *) | `GRID + (** An item in a grid or tree grid. *) | `GRID_CELL + (** An element that groups multiple related widgets. GTK uses + this role for various containers, like [class@Gtk.HeaderBar] or [class@Gtk.Notebook]. *) | `GROUP + (** Unused *) | `HEADING + (** An image. *) | `IMG + (** Abstract role. *) | `INPUT + (** A visible name or caption for a user interface component. *) | `LABEL + (** Abstract role. *) | `LANDMARK + (** Unused *) | `LEGEND + (** A clickable link. *) | `LINK + (** A list of items. *) | `LIST + (** Unused. *) | `LIST_BOX + (** An item in a list. *) | `LIST_ITEM + (** Unused *) | `LOG + (** Unused *) | `MAIN + (** Unused *) | `MARQUEE + (** Unused *) | `MATH + (** An element that represents a value within a known range. *) | `METER + (** A menu. *) | `MENU + (** A menubar. *) | `MENU_BAR + (** An item in a menu. *) | `MENU_ITEM + (** A check item in a menu. *) | `MENU_ITEM_CHECKBOX + (** A radio item in a menu. *) | `MENU_ITEM_RADIO + (** Unused *) | `NAVIGATION + (** An element that is not represented to accessibility technologies. + This role is synonymous to @GTK_ACCESSIBLE_ROLE_PRESENTATION. *) | `NONE + (** Unused *) | `NOTE + (** Unused *) | `OPTION + (** An element that is not represented to accessibility technologies. + This role is synonymous to @GTK_ACCESSIBLE_ROLE_NONE. *) | `PRESENTATION + (** An element that displays the progress + status for tasks that take a long time. *) | `PROGRESS_BAR + (** A checkable input in a group of radio roles, + only one of which can be checked at a time. *) | `RADIO + (** Unused *) | `RADIO_GROUP + (** Abstract role. *) | `RANGE + (** Unused *) | `REGION + (** A row in a columned list. *) | `ROW + (** Unused *) | `ROW_GROUP + (** Unused *) | `ROW_HEADER + (** A graphical object that controls the scrolling + of content within a viewing area, regardless of whether the content is fully + displayed within the viewing area. *) | `SCROLLBAR + (** Unused *) | `SEARCH + (** A type of textbox intended for specifying + search criteria. *) | `SEARCH_BOX + (** Abstract role. *) | `SECTION + (** Abstract role. *) | `SECTION_HEAD + (** Abstract role. *) | `SELECT + (** A divider that separates and distinguishes + sections of content or groups of menuitems. *) | `SEPARATOR + (** A user input where the user selects a value + from within a given range. *) | `SLIDER + (** A form of range that expects the user to + select from among discrete choices. *) | `SPIN_BUTTON + (** Unused *) | `STATUS + (** Abstract role. *) | `STRUCTURE + (** A type of checkbox that represents on/off values, + as opposed to checked/unchecked values. *) | `SWITCH + (** An item in a list of tab used for switching pages. *) | `TAB + (** Unused *) | `TABLE + (** A list of tabs for switching pages. *) | `TAB_LIST + (** A page in a notebook or stack. *) | `TAB_PANEL + (** A type of input that allows free-form text + as its value. *) | `TEXT_BOX + (** Unused *) | `TIME + (** Unused *) | `TIMER + (** Unused *) | `TOOLBAR + (** Unused *) | `TOOLTIP + (** Unused *) | `TREE + (** A treeview-like, columned list. *) | `TREE_GRID + (** Unused *) | `TREE_ITEM + (** Abstract role for interactive components of a + graphical user interface *) | `WIDGET + (** Abstract role for windows. *) | `WINDOW + (** A type of push button which stays pressed until depressed by a second +activation. *) | `TOGGLE_BUTTON + (** A toplevel element of a graphical user interface. + +This is the role that GTK uses by default for windows. *) | `APPLICATION + (** A paragraph of content. *) | `PARAGRAPH + (** A section of content that is quoted from another source. *) | `BLOCK_QUOTE + (** A section of a page that consists of a composition that forms an independent +part of a document, page, or site. *) | `ARTICLE + (** A comment contains content expressing reaction to other content. *) | `COMMENT + (** A virtual terminal. *) | `TERMINAL ] (* AccessibleSort - enumeration *) type accessiblesort = [ + (** There is no defined sort applied to the column. *) | `NONE + (** Items are sorted in ascending order by this column. *) | `ASCENDING + (** Items are sorted in descending order by this column. *) | `DESCENDING + (** A sort algorithm other than ascending or + descending has been applied. *) | `OTHER ] (* AccessibleState - enumeration *) type accessiblestate = [ + (** A “busy” state. This state has boolean values *) | `BUSY + (** A “checked” state; indicates the current + state of a [class@CheckButton]. Value type: [enum@AccessibleTristate] *) | `CHECKED + (** A “disabled” state; corresponds to the + [property@Widget:sensitive] property. It indicates a UI element + that is perceivable, but not editable or operable. Value type: boolean *) | `DISABLED + (** An “expanded” state; corresponds to the + [property@Expander:expanded] property. Value type: boolean + or undefined *) | `EXPANDED + (** A “hidden” state; corresponds to the + [property@Widget:visible] property. You can use this state + explicitly on UI elements that should not be exposed to an assistive + technology. Value type: boolean + See also: %GTK_ACCESSIBLE_STATE_DISABLED *) | `HIDDEN + (** An “invalid” state; set when a widget + is showing an error. Value type: [enum@AccessibleInvalidState] *) | `INVALID + (** A “pressed” state; indicates the current + state of a [class@ToggleButton]. Value type: [enum@AccessibleTristate] + enumeration *) | `PRESSED + (** A “selected” state; set when a widget + is selected. Value type: boolean or undefined *) | `SELECTED + (** Indicates that a widget with the GTK_ACCESSIBLE_ROLE_LINK has been visited. +Value type: boolean. *) | `VISITED ] (* AccessibleTextContentChange - enumeration *) type accessibletextcontentchange = [ + (** contents change as the result of + an insert operation *) | `INSERT + (** contents change as the result of + a remove operation *) | `REMOVE ] (* AccessibleTextGranularity - enumeration *) type accessibletextgranularity = [ + (** Use the boundary between + characters (including non-printing characters) *) | `CHARACTER + (** Use the boundary between words, + starting from the beginning of the current word and ending at the + beginning of the next word *) | `WORD + (** Use the boundary between + sentences, starting from the beginning of the current sentence and + ending at the beginning of the next sentence *) | `SENTENCE + (** Use the boundary between lines, + starting from the beginning of the current line and ending at the + beginning of the next line *) | `LINE + (** Use the boundary between + paragraphs, starting from the beginning of the current paragraph and + ending at the beginning of the next paragraph *) | `PARAGRAPH ] (* AccessibleTristate - enumeration *) type accessibletristate = [ + (** The state is `false` *) | `FALSE + (** The state is `true` *) | `TRUE + (** The state is `mixed` *) | `MIXED ] (* Align - enumeration *) type align = [ + (** stretch to fill all space if possible, center if + no meaningful way to stretch *) | `FILL + (** snap to left or top side, leaving space on right or bottom *) | `START + (** snap to right or bottom side, leaving space on left or top *) | `END + (** center natural width of widget inside the allocation *) | `CENTER + (** a different name for `GTK_ALIGN_BASELINE`. *) | `BASELINE_FILL + (** align the widget according to the baseline. *) | `BASELINE + (** stretch to fill all space, but align the baseline. *) | `BASELINE_CENTER ] (* ArrowType - enumeration *) type arrowtype = [ + (** Represents an upward pointing arrow. *) | `UP + (** Represents a downward pointing arrow. *) | `DOWN + (** Represents a left pointing arrow. *) | `LEFT + (** Represents a right pointing arrow. *) | `RIGHT + (** No arrow. *) | `NONE ] (* AssistantPageType - enumeration *) type assistantpagetype = [ + (** The page has regular contents. Both the + Back and forward buttons will be shown. *) | `CONTENT + (** The page contains an introduction to the + assistant task. Only the Forward button will be shown if there is a + next page. *) | `INTRO + (** The page lets the user confirm or deny the + changes. The Back and Apply buttons will be shown. *) | `CONFIRM + (** The page informs the user of the changes + done. Only the Close button will be shown. *) | `SUMMARY + (** Used for tasks that take a long time to + complete, blocks the assistant until the page is marked as complete. + Only the back button will be shown. *) | `PROGRESS + (** Used for when other page types are not + appropriate. No buttons will be shown, and the application must + add its own buttons through gtk_assistant_add_action_widget(). *) | `CUSTOM ] (* BaselinePosition - enumeration *) type baselineposition = [ + (** Align the baseline at the top *) | `TOP + (** Center the baseline *) | `CENTER + (** Align the baseline at the bottom *) | `BOTTOM ] (* BorderStyle - enumeration *) type borderstyle = [ + (** No visible border *) | `NONE + (** Same as %GTK_BORDER_STYLE_NONE *) | `HIDDEN + (** A single line segment *) | `SOLID + (** Looks as if the content is sunken into the canvas *) | `INSET + (** Looks as if the content is coming out of the canvas *) | `OUTSET + (** A series of round dots *) | `DOTTED + (** A series of square-ended dashes *) | `DASHED + (** Two parallel lines with some space between them *) | `DOUBLE + (** Looks as if it were carved in the canvas *) | `GROOVE + (** Looks as if it were coming out of the canvas *) | `RIDGE ] (* BuilderError - enumeration *) type buildererror = [ + (** A type-func attribute didn’t name + a function that returns a `GType`. *) | `INVALID_TYPE_FUNCTION + (** The input contained a tag that `GtkBuilder` + can’t handle. *) | `UNHANDLED_TAG + (** An attribute that is required by + `GtkBuilder` was missing. *) | `MISSING_ATTRIBUTE + (** `GtkBuilder` found an attribute that + it doesn’t understand. *) | `INVALID_ATTRIBUTE + (** `GtkBuilder` found a tag that + it doesn’t understand. *) | `INVALID_TAG + (** A required property value was + missing. *) | `MISSING_PROPERTY_VALUE + (** `GtkBuilder` couldn’t parse + some attribute value. *) | `INVALID_VALUE + (** The input file requires a newer version + of GTK. *) | `VERSION_MISMATCH + (** An object id occurred twice. *) | `DUPLICATE_ID + (** A specified object type is of the same type or + derived from the type of the composite class being extended with builder XML. *) | `OBJECT_TYPE_REFUSED + (** The wrong type was specified in a composite class’s template XML *) | `TEMPLATE_MISMATCH + (** The specified property is unknown for the object class. *) | `INVALID_PROPERTY + (** The specified signal is unknown for the object class. *) | `INVALID_SIGNAL + (** An object id is unknown. *) | `INVALID_ID + (** A function could not be found. This often happens + when symbols are set to be kept private. Compiling code with -rdynamic or using the + `gmodule-export-2.0` pkgconfig module can fix this problem. *) | `INVALID_FUNCTION ] (* ButtonsType - enumeration *) type buttonstype = [ + (** no buttons at all *) | `NONE + (** an OK button *) | `OK + (** a Close button *) | `CLOSE + (** a Cancel button *) | `CANCEL + (** Yes and No buttons *) | `YES_NO + (** OK and Cancel buttons *) | `OK_CANCEL ] (* CellRendererAccelMode - enumeration *) type cellrendereraccelmode = [ + (** GTK accelerators mode *) | `GTK + (** Other accelerator mode *) | `OTHER ] (* CellRendererMode - enumeration *) type cellrenderermode = [ + (** The cell is just for display + and cannot be interacted with. Note that this doesn’t mean that eg. the + row being drawn can’t be selected -- just that a particular element of + it cannot be individually modified. *) | `INERT + (** The cell can be clicked. *) | `ACTIVATABLE + (** The cell can be edited or otherwise modified. *) | `EDITABLE ] (* Collation - enumeration *) type collation = [ + (** Don't do any collation *) | `NONE + (** Use [func@GLib.utf8_collate_key] *) | `UNICODE + (** Use [func@GLib.utf8_collate_key_for_filename] *) | `FILENAME ] (* ConstraintAttribute - enumeration *) type constraintattribute = [ + (** No attribute, used for constant + relations *) | `NONE + (** The left edge of a widget, regardless of + text direction *) | `LEFT + (** The right edge of a widget, regardless + of text direction *) | `RIGHT + (** The top edge of a widget *) | `TOP + (** The bottom edge of a widget *) | `BOTTOM + (** The leading edge of a widget, depending + on text direction; equivalent to %GTK_CONSTRAINT_ATTRIBUTE_LEFT for LTR + languages, and %GTK_CONSTRAINT_ATTRIBUTE_RIGHT for RTL ones *) | `START + (** The trailing edge of a widget, depending + on text direction; equivalent to %GTK_CONSTRAINT_ATTRIBUTE_RIGHT for LTR + languages, and %GTK_CONSTRAINT_ATTRIBUTE_LEFT for RTL ones *) | `END + (** The width of a widget *) | `WIDTH + (** The height of a widget *) | `HEIGHT + (** The center of a widget, on the + horizontal axis *) | `CENTER_X + (** The center of a widget, on the + vertical axis *) | `CENTER_Y + (** The baseline of a widget *) | `BASELINE ] (* ConstraintRelation - enumeration *) type constraintrelation = [ + (** Less than, or equal *) | `LE + (** Equal *) | `EQ + (** Greater than, or equal *) | `GE ] (* ConstraintStrength - enumeration *) type constraintstrength = [ + (** The constraint is required towards solving the layout *) | `REQUIRED + (** A strong constraint *) | `STRONG + (** A medium constraint *) | `MEDIUM + (** A weak constraint *) | `WEAK ] (* ConstraintVflParserError - enumeration *) type constraintvflparsererror = [ + (** Invalid or unknown symbol *) | `SYMBOL + (** Invalid or unknown attribute *) | `ATTRIBUTE + (** Invalid or unknown view *) | `VIEW + (** Invalid or unknown metric *) | `METRIC + (** Invalid or unknown priority *) | `PRIORITY + (** Invalid or unknown relation *) | `RELATION ] (* ContentFit - enumeration *) type contentfit = [ + (** Make the content fill the entire allocation, + without taking its aspect ratio in consideration. The resulting + content will appear as stretched if its aspect ratio is different + from the allocation aspect ratio. *) | `FILL + (** Scale the content to fit the allocation, + while taking its aspect ratio in consideration. The resulting + content will appear as letterboxed if its aspect ratio is different + from the allocation aspect ratio. *) | `CONTAIN + (** Cover the entire allocation, while taking + the content aspect ratio in consideration. The resulting content + will appear as clipped if its aspect ratio is different from the + allocation aspect ratio. *) | `COVER + (** The content is scaled down to fit the + allocation, if needed, otherwise its original size is used. *) | `SCALE_DOWN ] (* CornerType - enumeration *) type cornertype = [ + (** Place the scrollbars on the right and bottom of the + widget (default behaviour). *) | `TOP_LEFT + (** Place the scrollbars on the top and right of the + widget. *) | `BOTTOM_LEFT + (** Place the scrollbars on the left and bottom of the + widget. *) | `TOP_RIGHT + (** Place the scrollbars on the top and left of the + widget. *) | `BOTTOM_RIGHT ] (* CssParserError - enumeration *) type cssparsererror = [ + (** Unknown failure. *) | `FAILED + (** The given text does not form valid syntax *) | `SYNTAX + (** Failed to import a resource *) | `IMPORT + (** The given name has not been defined *) | `NAME + (** The given value is not correct *) | `UNKNOWN_VALUE ] (* CssParserWarning - enumeration *) type cssparserwarning = [ + (** The given construct is + deprecated and will be removed in a future version *) | `DEPRECATED + (** A syntax construct was used + that should be avoided *) | `SYNTAX + (** A feature is not implemented *) | `UNIMPLEMENTED ] (* DeleteType - enumeration *) type deletetype = [ + (** Delete characters. *) | `CHARS + (** Delete only the portion of the word to the + left/right of cursor if we’re in the middle of a word. *) | `WORD_ENDS + (** Delete words. *) | `WORDS + (** Delete display-lines. Display-lines + refers to the visible lines, with respect to the current line + breaks. As opposed to paragraphs, which are defined by line + breaks in the input. *) | `DISPLAY_LINES + (** Delete only the portion of the + display-line to the left/right of cursor. *) | `DISPLAY_LINE_ENDS + (** Delete to the end of the + paragraph. Like C-k in Emacs (or its reverse). *) | `PARAGRAPH_ENDS + (** Delete entire line. Like C-k in pico. *) | `PARAGRAPHS + (** Delete only whitespace. Like M-\ in Emacs. *) | `WHITESPACE ] (* DialogError - enumeration *) type dialogerror = [ + (** Generic error condition for when + an operation fails and no more specific code is applicable *) | `FAILED + (** The async function call was cancelled + via its `GCancellable` *) | `CANCELLED + (** The operation was cancelled + by the user (via a Cancel or Close button) *) | `DISMISSED ] (* DirectionType - enumeration *) type directiontype = [ + (** Move forward. *) | `TAB_FORWARD + (** Move backward. *) | `TAB_BACKWARD + (** Move up. *) | `UP + (** Move down. *) | `DOWN + (** Move left. *) | `LEFT + (** Move right. *) | `RIGHT ] (* EditableProperties - enumeration *) type editableproperties = [ + (** the property id for [property@Gtk.Editable:text] *) | `PROP_TEXT + (** the property id for [property@Gtk.Editable:cursor-position] *) | `PROP_CURSOR_POSITION + (** the property id for [property@Gtk.Editable:selection-bound] *) | `PROP_SELECTION_BOUND + (** the property id for [property@Gtk.Editable:editable] *) | `PROP_EDITABLE + (** the property id for [property@Gtk.Editable:width-chars] *) | `PROP_WIDTH_CHARS + (** the property id for [property@Gtk.Editable:max-width-chars] *) | `PROP_MAX_WIDTH_CHARS + (** the property id for [property@Gtk.Editable:xalign] *) | `PROP_XALIGN + (** the property id for [property@Gtk.Editable:enable-undo] *) | `PROP_ENABLE_UNDO + (** the number of properties *) | `NUM_PROPERTIES ] (* EntryIconPosition - enumeration *) type entryiconposition = [ + (** At the beginning of the entry (depending on the text direction). *) | `PRIMARY + (** At the end of the entry (depending on the text direction). *) | `SECONDARY ] (* EventSequenceState - enumeration *) type eventsequencestate = [ + (** The sequence is handled, but not grabbed. *) | `NONE + (** The sequence is handled and grabbed. *) | `CLAIMED + (** The sequence is denied. *) | `DENIED ] (* FileChooserAction - enumeration *) type filechooseraction = [ + (** Indicates open mode. The file chooser + will only let the user pick an existing file. *) | `OPEN + (** Indicates save mode. The file chooser + will let the user pick an existing file, or type in a new + filename. *) | `SAVE + (** Indicates an Open mode for + selecting folders. The file chooser will let the user pick an + existing folder. *) | `SELECT_FOLDER ] (* FileChooserError - enumeration *) type filechoosererror = [ + (** Indicates that a file does not exist. *) | `NONEXISTENT + (** Indicates a malformed filename. *) | `BAD_FILENAME + (** Indicates a duplicate path (e.g. when + adding a bookmark). *) | `ALREADY_EXISTS + (** Indicates an incomplete hostname + (e.g. "http://foo" without a slash after that). *) | `INCOMPLETE_HOSTNAME ] (* FilterChange - enumeration *) type filterchange = [ + (** The filter change cannot be + described with any of the other enumeration values. *) | `DIFFERENT + (** The filter is less strict than + it was before: All items that it used to return %TRUE for + still return %TRUE, others now may, too. *) | `LESS_STRICT + (** The filter is more strict than + it was before: All items that it used to return %FALSE for + still return %FALSE, others now may, too. *) | `MORE_STRICT ] (* FilterMatch - enumeration *) type filtermatch = [ + (** The filter matches some items, + gtk_filter_match() may return %TRUE or %FALSE *) | `SOME + (** The filter does not match any item, + gtk_filter_match() will always return %FALSE. *) | `NONE + (** The filter matches all items, + gtk_filter_match() will alays return %TRUE. *) | `ALL ] (* FontLevel - enumeration *) type fontlevel = [ + (** Select a font family *) | `FAMILY + (** Select a font face (i.e. a family and a style) *) | `FACE + (** Select a font (i.e. a face with a size, and possibly font variations) *) | `FONT + (** Select a font and font features *) | `FEATURES ] (* GraphicsOffloadEnabled - enumeration *) type graphicsoffloadenabled = [ + (** Graphics offloading is enabled. *) | `ENABLED + (** Graphics offloading is disabled. *) | `DISABLED ] (* IconSize - enumeration *) type iconsize = [ + (** Keep the size of the parent element *) | `INHERIT + (** Size similar to text size *) | `NORMAL + (** Large size, for example in an icon view *) | `LARGE ] (* IconThemeError - enumeration *) type iconthemeerror = [ + (** The icon specified does not exist in the theme *) | `NOT_FOUND + (** An unspecified error occurred. *) | `FAILED ] (* IconViewDropPosition - enumeration *) type iconviewdropposition = [ + (** no drop possible *) | `NO_DROP + (** dropped item replaces the item *) | `DROP_INTO + (** dropped item is inserted to the left *) | `DROP_LEFT + (** dropped item is inserted to the right *) | `DROP_RIGHT + (** dropped item is inserted above *) | `DROP_ABOVE + (** dropped item is inserted below *) | `DROP_BELOW ] (* ImageType - enumeration *) type imagetype = [ + (** there is no image displayed by the widget *) | `EMPTY + (** the widget contains a named icon *) | `ICON_NAME + (** the widget contains a `GIcon` *) | `GICON + (** the widget contains a `GdkPaintable` *) | `PAINTABLE ] (* InputPurpose - enumeration *) type inputpurpose = [ + (** Allow any character *) | `FREE_FORM + (** Allow only alphabetic characters *) | `ALPHA + (** Allow only digits *) | `DIGITS + (** Edited field expects numbers *) | `NUMBER + (** Edited field expects phone number *) | `PHONE + (** Edited field expects URL *) | `URL + (** Edited field expects email address *) | `EMAIL + (** Edited field expects the name of a person *) | `NAME + (** Like %GTK_INPUT_PURPOSE_FREE_FORM, but characters are hidden *) | `PASSWORD + (** Like %GTK_INPUT_PURPOSE_DIGITS, but characters are hidden *) | `PIN + (** Allow any character, in addition to control codes *) | `TERMINAL ] (* InscriptionOverflow - enumeration *) type inscriptionoverflow = [ + (** Clip the remaining text *) | `CLIP + (** Omit characters at the start of the text *) | `ELLIPSIZE_START + (** Omit characters at the middle of the text *) | `ELLIPSIZE_MIDDLE + (** Omit characters at the end of the text *) | `ELLIPSIZE_END ] (* Justification - enumeration *) type justification = [ + (** The text is placed at the left edge of the label. *) | `LEFT + (** The text is placed at the right edge of the label. *) | `RIGHT + (** The text is placed in the center of the label. *) | `CENTER + (** The text is placed is distributed across the label. *) | `FILL ] (* LevelBarMode - enumeration *) type levelbarmode = [ + (** the bar has a continuous mode *) | `CONTINUOUS + (** the bar has a discrete mode *) | `DISCRETE ] (* ListTabBehavior - enumeration *) type listtabbehavior = [ + (** Cycle through all focusable items of the list *) | `ALL + (** Cycle through a single list element, then move + focus out of the list. Moving focus between items needs to be + done with the arrow keys. *) | `ITEM + (** Cycle only through a single cell, then + move focus out of the list. Moving focus between cells needs to + be done with the arrow keys. This is only relevant for + cell-based widgets like #GtkColumnView, otherwise it behaves + like `GTK_LIST_TAB_ITEM`. *) | `CELL ] (* MessageType - enumeration *) type messagetype = [ + (** Informational message *) | `INFO + (** Non-fatal warning message *) | `WARNING + (** Question requiring a choice *) | `QUESTION + (** Fatal error message *) | `ERROR + (** None of the above *) | `OTHER ] (* MovementStep - enumeration *) type movementstep = [ + (** Move forward or back by graphemes *) | `LOGICAL_POSITIONS + (** Move left or right by graphemes *) | `VISUAL_POSITIONS + (** Move forward or back by words *) | `WORDS + (** Move up or down lines (wrapped lines) *) | `DISPLAY_LINES + (** Move to either end of a line *) | `DISPLAY_LINE_ENDS + (** Move up or down paragraphs (newline-ended lines) *) | `PARAGRAPHS + (** Move to either end of a paragraph *) | `PARAGRAPH_ENDS + (** Move by pages *) | `PAGES + (** Move to ends of the buffer *) | `BUFFER_ENDS + (** Move horizontally by pages *) | `HORIZONTAL_PAGES ] (* NaturalWrapMode - enumeration *) type naturalwrapmode = [ + (** Inherit the minimum size request. + In particular, this should be used with %PANGO_WRAP_CHAR. *) | `INHERIT + (** Try not to wrap the text. This mode is the + closest to GTK3's behavior but can lead to a wide label leaving + lots of empty space below the text. *) | `NONE + (** Attempt to wrap at word boundaries. This + is useful in particular when using %PANGO_WRAP_WORD_CHAR as the + wrap mode. *) | `WORD ] (* NotebookTab - enumeration *) type notebooktab = [ + (** the first tab in the notebook *) | `FIRST + (** the last tab in the notebook *) | `LAST ] (* NumberUpLayout - enumeration *) type numberuplayout = [ + (** ![](layout-lrtb.png) *) | `LRTB + (** ![](layout-lrbt.png) *) | `LRBT + (** ![](layout-rltb.png) *) | `RLTB + (** ![](layout-rlbt.png) *) | `RLBT + (** ![](layout-tblr.png) *) | `TBLR + (** ![](layout-tbrl.png) *) | `TBRL + (** ![](layout-btlr.png) *) | `BTLR + (** ![](layout-btrl.png) *) | `BTRL ] (* Ordering - enumeration *) type ordering = [ + (** the first value is smaller than the second *) | `SMALLER + (** the two values are equal *) | `EQUAL + (** the first value is larger than the second *) | `LARGER ] (* Orientation - enumeration *) type orientation = [ + (** The element is in horizontal orientation. *) | `HORIZONTAL + (** The element is in vertical orientation. *) | `VERTICAL ] (* Overflow - enumeration *) type overflow = [ + (** No change is applied. Content is drawn at the specified + position. *) | `VISIBLE + (** Content is clipped to the bounds of the area. Content + outside the area is not drawn and cannot be interacted with. *) | `HIDDEN ] (* PackType - enumeration *) type packtype = [ + (** The child is packed into the start of the widget *) | `START + (** The child is packed into the end of the widget *) | `END ] (* PadActionType - enumeration *) type padactiontype = [ + (** Action is triggered by a pad button *) | `BUTTON + (** Action is triggered by a pad ring *) | `RING + (** Action is triggered by a pad strip *) | `STRIP ] (* PageOrientation - enumeration *) type pageorientation = [ + (** Portrait mode. *) | `PORTRAIT + (** Landscape mode. *) | `LANDSCAPE + (** Reverse portrait mode. *) | `REVERSE_PORTRAIT + (** Reverse landscape mode. *) | `REVERSE_LANDSCAPE ] (* PageSet - enumeration *) type pageset = [ + (** All pages. *) | `ALL + (** Even pages. *) | `EVEN + (** Odd pages. *) | `ODD ] (* PanDirection - enumeration *) type pandirection = [ + (** panned towards the left *) | `LEFT + (** panned towards the right *) | `RIGHT + (** panned upwards *) | `UP + (** panned downwards *) | `DOWN ] (* PolicyType - enumeration *) type policytype = [ + (** The scrollbar is always visible. The view size is + independent of the content. *) | `ALWAYS + (** The scrollbar will appear and disappear as necessary. + For example, when all of a `GtkTreeView` can not be seen. *) | `AUTOMATIC + (** The scrollbar should never appear. In this mode the + content determines the size. *) | `NEVER + (** Don't show a scrollbar, but don't force the + size to follow the content. This can be used e.g. to make multiple + scrolled windows share a scrollbar. *) | `EXTERNAL ] (* PositionType - enumeration *) type positiontype = [ + (** The feature is at the left edge. *) | `LEFT + (** The feature is at the right edge. *) | `RIGHT + (** The feature is at the top edge. *) | `TOP + (** The feature is at the bottom edge. *) | `BOTTOM ] (* PrintDuplex - enumeration *) type printduplex = [ + (** No duplex. *) | `SIMPLEX + (** Horizontal duplex. *) | `HORIZONTAL + (** Vertical duplex. *) | `VERTICAL ] (* PrintError - enumeration *) type printerror = [ + (** An unspecified error occurred. *) | `GENERAL + (** An internal error occurred. *) | `INTERNAL_ERROR + (** A memory allocation failed. *) | `NOMEM + (** An error occurred while loading a page setup + or paper size from a key file. *) | `INVALID_FILE ] (* PrintOperationAction - enumeration *) type printoperationaction = [ + (** Show the print dialog. *) | `PRINT_DIALOG + (** Start to print without showing + the print dialog, based on the current print settings. *) | `PRINT + (** Show the print preview. *) | `PREVIEW + (** Export to a file. This requires + the export-filename property to be set. *) | `EXPORT ] (* PrintOperationResult - enumeration *) type printoperationresult = [ + (** An error has occurred. *) | `ERROR + (** The print settings should be stored. *) | `APPLY + (** The print operation has been canceled, + the print settings should not be stored. *) | `CANCEL + (** The print operation is not complete + yet. This value will only be returned when running asynchronously. *) | `IN_PROGRESS ] (* PrintPages - enumeration *) type printpages = [ + (** All pages. *) | `ALL + (** Current page. *) | `CURRENT + (** Range of pages. *) | `RANGES + (** Selected pages. *) | `SELECTION ] (* PrintQuality - enumeration *) type printquality = [ + (** Low quality. *) | `LOW + (** Normal quality. *) | `NORMAL + (** High quality. *) | `HIGH + (** Draft quality. *) | `DRAFT ] (* PrintStatus - enumeration *) type printstatus = [ + (** The printing has not started yet; this + status is set initially, and while the print dialog is shown. *) | `INITIAL + (** This status is set while the begin-print + signal is emitted and during pagination. *) | `PREPARING + (** This status is set while the + pages are being rendered. *) | `GENERATING_DATA + (** The print job is being sent off to the + printer. *) | `SENDING_DATA + (** The print job has been sent to the printer, + but is not printed for some reason, e.g. the printer may be stopped. *) | `PENDING + (** Some problem has occurred during + printing, e.g. a paper jam. *) | `PENDING_ISSUE + (** The printer is processing the print job. *) | `PRINTING + (** The printing has been completed successfully. *) | `FINISHED + (** The printing has been aborted. *) | `FINISHED_ABORTED ] (* PropagationLimit - enumeration *) type propagationlimit = [ + (** Events are handled regardless of what their + target is. *) | `NONE + (** Events are only handled if their target + is in the same [iface@Native] as the event controllers widget. Note + that some event types have two targets (origin and destination). *) | `SAME_NATIVE ] (* PropagationPhase - enumeration *) type propagationphase = [ + (** Events are not delivered. *) | `NONE + (** Events are delivered in the capture phase. The + capture phase happens before the bubble phase, runs from the toplevel down + to the event widget. This option should only be used on containers that + might possibly handle events before their children do. *) | `CAPTURE + (** Events are delivered in the bubble phase. The bubble + phase happens after the capture phase, and before the default handlers + are run. This phase runs from the event widget, up to the toplevel. *) | `BUBBLE + (** Events are delivered in the default widget event handlers, + note that widget implementations must chain up on button, motion, touch and + grab broken handlers for controllers in this phase to be run. *) | `TARGET ] (* RecentManagerError - enumeration *) type recentmanagererror = [ + (** the URI specified does not exists in + the recently used resources list. *) | `NOT_FOUND + (** the URI specified is not valid. *) | `INVALID_URI + (** the supplied string is not + UTF-8 encoded. *) | `INVALID_ENCODING + (** no application has registered + the specified item. *) | `NOT_REGISTERED + (** failure while reading the recently used + resources file. *) | `READ + (** failure while writing the recently used + resources file. *) | `WRITE + (** unspecified error. *) | `UNKNOWN ] (* ResponseType - enumeration *) type responsetype = [ + (** Returned if an action widget has no response id, + or if the dialog gets programmatically hidden or destroyed *) | `NONE + (** Generic response id, not used by GTK dialogs *) | `REJECT + (** Generic response id, not used by GTK dialogs *) | `ACCEPT + (** Returned if the dialog is deleted *) | `DELETE_EVENT + (** Returned by OK buttons in GTK dialogs *) | `OK + (** Returned by Cancel buttons in GTK dialogs *) | `CANCEL + (** Returned by Close buttons in GTK dialogs *) | `CLOSE + (** Returned by Yes buttons in GTK dialogs *) | `YES + (** Returned by No buttons in GTK dialogs *) | `NO + (** Returned by Apply buttons in GTK dialogs *) | `APPLY + (** Returned by Help buttons in GTK dialogs *) | `HELP ] (* RevealerTransitionType - enumeration *) type revealertransitiontype = [ + (** No transition *) | `NONE + (** Fade in *) | `CROSSFADE + (** Slide in from the left *) | `SLIDE_RIGHT + (** Slide in from the right *) | `SLIDE_LEFT + (** Slide in from the bottom *) | `SLIDE_UP + (** Slide in from the top *) | `SLIDE_DOWN + (** Floop in from the left *) | `SWING_RIGHT + (** Floop in from the right *) | `SWING_LEFT + (** Floop in from the bottom *) | `SWING_UP + (** Floop in from the top *) | `SWING_DOWN ] (* ScrollStep - enumeration *) type scrollstep = [ + (** Scroll in steps. *) | `STEPS + (** Scroll by pages. *) | `PAGES + (** Scroll to ends. *) | `ENDS + (** Scroll in horizontal steps. *) | `HORIZONTAL_STEPS + (** Scroll by horizontal pages. *) | `HORIZONTAL_PAGES + (** Scroll to the horizontal ends. *) | `HORIZONTAL_ENDS ] (* ScrollType - enumeration *) type scrolltype = [ + (** No scrolling. *) | `NONE + (** Jump to new location. *) | `JUMP + (** Step backward. *) | `STEP_BACKWARD + (** Step forward. *) | `STEP_FORWARD + (** Page backward. *) | `PAGE_BACKWARD + (** Page forward. *) | `PAGE_FORWARD + (** Step up. *) | `STEP_UP + (** Step down. *) | `STEP_DOWN + (** Page up. *) | `PAGE_UP + (** Page down. *) | `PAGE_DOWN + (** Step to the left. *) | `STEP_LEFT + (** Step to the right. *) | `STEP_RIGHT + (** Page to the left. *) | `PAGE_LEFT + (** Page to the right. *) | `PAGE_RIGHT + (** Scroll to start. *) | `START + (** Scroll to end. *) | `END ] (* ScrollablePolicy - enumeration *) type scrollablepolicy = [ + (** Scrollable adjustments are based on the minimum size *) | `MINIMUM + (** Scrollable adjustments are based on the natural size *) | `NATURAL ] (* SelectionMode - enumeration *) type selectionmode = [ + (** No selection is possible. *) | `NONE + (** Zero or one element may be selected. *) | `SINGLE + (** Exactly one element is selected. + In some circumstances, such as initially or during a search + operation, it’s possible for no element to be selected with + %GTK_SELECTION_BROWSE. What is really enforced is that the user + can’t deselect a currently selected element except by selecting + another element. *) | `BROWSE + (** Any number of elements may be selected. + The Ctrl key may be used to enlarge the selection, and Shift + key to select between the focus and the child pointed to. + Some widgets may also allow Click-drag to select a range of elements. *) | `MULTIPLE ] (* SensitivityType - enumeration *) type sensitivitytype = [ + (** The control is made insensitive if no + action can be triggered *) | `AUTO + (** The control is always sensitive *) | `ON + (** The control is always insensitive *) | `OFF ] (* ShortcutScope - enumeration *) type shortcutscope = [ + (** Shortcuts are handled inside + the widget the controller belongs to. *) | `LOCAL + (** Shortcuts are handled by + the first ancestor that is a [iface@ShortcutManager] *) | `MANAGED + (** Shortcuts are handled by + the root widget. *) | `GLOBAL ] (* ShortcutType - enumeration *) type shortcuttype = [ + (** The shortcut is a keyboard accelerator. The GtkShortcutsShortcut:accelerator + property will be used. *) | `ACCELERATOR + (** The shortcut is a pinch gesture. GTK provides an icon and subtitle. *) | `GESTURE_PINCH + (** The shortcut is a stretch gesture. GTK provides an icon and subtitle. *) | `GESTURE_STRETCH + (** The shortcut is a clockwise rotation gesture. GTK provides an icon and subtitle. *) | `GESTURE_ROTATE_CLOCKWISE + (** The shortcut is a counterclockwise rotation gesture. GTK provides an icon and subtitle. *) | `GESTURE_ROTATE_COUNTERCLOCKWISE + (** The shortcut is a two-finger swipe gesture. GTK provides an icon and subtitle. *) | `GESTURE_TWO_FINGER_SWIPE_LEFT + (** The shortcut is a two-finger swipe gesture. GTK provides an icon and subtitle. *) | `GESTURE_TWO_FINGER_SWIPE_RIGHT + (** The shortcut is a gesture. The GtkShortcutsShortcut:icon property will be + used. *) | `GESTURE + (** The shortcut is a swipe gesture. GTK provides an icon and subtitle. *) | `GESTURE_SWIPE_LEFT + (** The shortcut is a swipe gesture. GTK provides an icon and subtitle. *) | `GESTURE_SWIPE_RIGHT ] (* SizeGroupMode - enumeration *) type sizegroupmode = [ + (** group has no effect *) | `NONE + (** group affects horizontal requisition *) | `HORIZONTAL + (** group affects vertical requisition *) | `VERTICAL + (** group affects both horizontal and vertical requisition *) | `BOTH ] (* SizeRequestMode - enumeration *) type sizerequestmode = [ + (** Prefer height-for-width geometry management *) | `HEIGHT_FOR_WIDTH + (** Prefer width-for-height geometry management *) | `WIDTH_FOR_HEIGHT + (** Don’t trade height-for-width or width-for-height *) | `CONSTANT_SIZE ] (* SortType - enumeration *) type sorttype = [ + (** Sorting is in ascending order. *) | `ASCENDING + (** Sorting is in descending order. *) | `DESCENDING ] (* SorterChange - enumeration *) type sorterchange = [ + (** The sorter change cannot be described + by any of the other enumeration values *) | `DIFFERENT + (** The sort order was inverted. Comparisons + that returned %GTK_ORDERING_SMALLER now return %GTK_ORDERING_LARGER + and vice versa. Other comparisons return the same values as before. *) | `INVERTED + (** The sorter is less strict: Comparisons + may now return %GTK_ORDERING_EQUAL that did not do so before. *) | `LESS_STRICT + (** The sorter is more strict: Comparisons + that did return %GTK_ORDERING_EQUAL may not do so anymore. *) | `MORE_STRICT ] (* SorterOrder - enumeration *) type sorterorder = [ + (** A partial order. Any `GtkOrdering` is possible. *) | `PARTIAL + (** No order, all elements are considered equal. + gtk_sorter_compare() will only return %GTK_ORDERING_EQUAL. *) | `NONE + (** A total order. gtk_sorter_compare() will only + return %GTK_ORDERING_EQUAL if an item is compared with itself. Two + different items will never cause this value to be returned. *) | `TOTAL ] (* SpinButtonUpdatePolicy - enumeration *) type spinbuttonupdatepolicy = [ + (** When refreshing your `GtkSpinButton`, the value is + always displayed *) | `ALWAYS + (** When refreshing your `GtkSpinButton`, the value is + only displayed if it is valid within the bounds of the spin button's + adjustment *) | `IF_VALID ] (* SpinType - enumeration *) type spintype = [ + (** Increment by the adjustments step increment. *) | `STEP_FORWARD + (** Decrement by the adjustments step increment. *) | `STEP_BACKWARD + (** Increment by the adjustments page increment. *) | `PAGE_FORWARD + (** Decrement by the adjustments page increment. *) | `PAGE_BACKWARD + (** Go to the adjustments lower bound. *) | `HOME + (** Go to the adjustments upper bound. *) | `END + (** Change by a specified amount. *) | `USER_DEFINED ] (* StackTransitionType - enumeration *) type stacktransitiontype = [ + (** No transition *) | `NONE + (** A cross-fade *) | `CROSSFADE + (** Slide from left to right *) | `SLIDE_RIGHT + (** Slide from right to left *) | `SLIDE_LEFT + (** Slide from bottom up *) | `SLIDE_UP + (** Slide from top down *) | `SLIDE_DOWN + (** Slide from left or right according to the children order *) | `SLIDE_LEFT_RIGHT + (** Slide from top down or bottom up according to the order *) | `SLIDE_UP_DOWN + (** Cover the old page by sliding up *) | `OVER_UP + (** Cover the old page by sliding down *) | `OVER_DOWN + (** Cover the old page by sliding to the left *) | `OVER_LEFT + (** Cover the old page by sliding to the right *) | `OVER_RIGHT + (** Uncover the new page by sliding up *) | `UNDER_UP + (** Uncover the new page by sliding down *) | `UNDER_DOWN + (** Uncover the new page by sliding to the left *) | `UNDER_LEFT + (** Uncover the new page by sliding to the right *) | `UNDER_RIGHT + (** Cover the old page sliding up or uncover the new page sliding down, according to order *) | `OVER_UP_DOWN + (** Cover the old page sliding down or uncover the new page sliding up, according to order *) | `OVER_DOWN_UP + (** Cover the old page sliding left or uncover the new page sliding right, according to order *) | `OVER_LEFT_RIGHT + (** Cover the old page sliding right or uncover the new page sliding left, according to order *) | `OVER_RIGHT_LEFT + (** Pretend the pages are sides of a cube and rotate that cube to the left *) | `ROTATE_LEFT + (** Pretend the pages are sides of a cube and rotate that cube to the right *) | `ROTATE_RIGHT + (** Pretend the pages are sides of a cube and rotate that cube to the left or right according to the children order *) | `ROTATE_LEFT_RIGHT ] (* StringFilterMatchMode - enumeration *) type stringfiltermatchmode = [ + (** The search string and + text must match exactly. *) | `EXACT + (** The search string + must be contained as a substring inside the text. *) | `SUBSTRING + (** The text must begin + with the search string. *) | `PREFIX ] (* SymbolicColor - enumeration *) type symboliccolor = [ + (** The default foreground color *) | `FOREGROUND + (** Indication color for errors *) | `ERROR + (** Indication color for warnings *) | `WARNING + (** Indication color for success *) | `SUCCESS ] (* SystemSetting - enumeration *) type systemsetting = [ + (** the [property@Gtk.Settings:gtk-xft-dpi] setting has changed *) | `DPI + (** The [property@Gtk.Settings:gtk-font-name] setting has changed *) | `FONT_NAME + (** The font configuration has changed in a way that + requires text to be redrawn. This can be any of the + [property@Gtk.Settings:gtk-xft-antialias], + [property@Gtk.Settings:gtk-xft-hinting], + [property@Gtk.Settings:gtk-xft-hintstyle], + [property@Gtk.Settings:gtk-xft-rgba] or + [property@Gtk.Settings:gtk-fontconfig-timestamp] settings *) | `FONT_CONFIG + (** The display has changed *) | `DISPLAY + (** The icon theme has changed in a way that requires + icons to be looked up again *) | `ICON_THEME ] (* TextDirection - enumeration *) type textdirection = [ + (** No direction. *) | `NONE + (** Left to right text direction. *) | `LTR + (** Right to left text direction. *) | `RTL ] (* TextExtendSelection - enumeration *) type textextendselection = [ + (** Selects the current word. It is triggered by + a double-click for example. *) | `WORD + (** Selects the current line. It is triggered by + a triple-click for example. *) | `LINE ] (* TextViewLayer - enumeration *) type textviewlayer = [ + (** The layer rendered below the text (but above the background). *) | `BELOW_TEXT + (** The layer rendered above the text. *) | `ABOVE_TEXT ] (* TextWindowType - enumeration *) type textwindowtype = [ + (** Window that floats over scrolling areas. *) | `WIDGET + (** Scrollable text window. *) | `TEXT + (** Left side border window. *) | `LEFT + (** Right side border window. *) | `RIGHT + (** Top border window. *) | `TOP + (** Bottom border window. *) | `BOTTOM ] (* TreeViewColumnSizing - enumeration *) type treeviewcolumnsizing = [ + (** Columns only get bigger in reaction to changes in the model *) | `GROW_ONLY + (** Columns resize to be the optimal size every time the model changes. *) | `AUTOSIZE + (** Columns are a fixed numbers of pixels wide. *) | `FIXED ] (* TreeViewDropPosition - enumeration *) type treeviewdropposition = [ + (** dropped row is inserted before *) | `BEFORE + (** dropped row is inserted after *) | `AFTER + (** dropped row becomes a child or is inserted before *) | `INTO_OR_BEFORE + (** dropped row becomes a child or is inserted after *) | `INTO_OR_AFTER ] (* TreeViewGridLines - enumeration *) type treeviewgridlines = [ + (** No grid lines. *) | `NONE + (** Horizontal grid lines. *) | `HORIZONTAL + (** Vertical grid lines. *) | `VERTICAL + (** Horizontal and vertical grid lines. *) | `BOTH ] (* Unit - enumeration *) type unit = [ + (** No units. *) | `NONE + (** Dimensions in points. *) | `POINTS + (** Dimensions in inches. *) | `INCH + (** Dimensions in millimeters *) | `MM ] (* WrapMode - enumeration *) type wrapmode = [ + (** do not wrap lines; just make the text area wider *) | `NONE + (** wrap text, breaking lines anywhere the cursor can + appear (between characters, usually - if you want to be technical, + between graphemes, see pango_get_log_attrs()) *) | `CHAR + (** wrap text, breaking lines in between words *) | `WORD + (** wrap text, breaking lines in between words, or if + that is not enough, also between graphemes *) | `WORD_CHAR ] (* ApplicationInhibitFlags - bitfield/flags *) type applicationinhibitflags_flag = [ + (** Inhibit ending the user session + by logging out or by shutting down the computer *) | `LOGOUT + (** Inhibit user switching *) | `SWITCH + (** Inhibit suspending the + session or computer *) | `SUSPEND + (** Inhibit the session being + marked as idle (and possibly locked) *) | `IDLE ] @@ -1043,6 +1929,8 @@ type applicationinhibitflags = applicationinhibitflags_flag list (* BuilderClosureFlags - bitfield/flags *) type builderclosureflags_flag = [ + (** The closure should be created swapped. See + g_cclosure_new_swap() for details. *) | `SWAPPED ] @@ -1050,12 +1938,20 @@ type builderclosureflags = builderclosureflags_flag list (* CellRendererState - bitfield/flags *) type cellrendererstate_flag = [ + (** The cell is currently selected, and + probably has a selection colored background to render to. *) | `SELECTED + (** The mouse is hovering over the cell. *) | `PRELIT + (** The cell is drawn in an insensitive manner *) | `INSENSITIVE + (** The cell is in a sorted row *) | `SORTED + (** The cell is in the focus row. *) | `FOCUSED + (** The cell is in a row that can be expanded *) | `EXPANDABLE + (** The cell is in a row that is expanded *) | `EXPANDED ] @@ -1063,24 +1959,43 @@ type cellrendererstate = cellrendererstate_flag list (* DebugFlags - bitfield/flags *) type debugflags_flag = [ + (** Information about GtkTextView *) | `TEXT + (** Information about GtkTreeView *) | `TREE + (** Information about keyboard shortcuts *) | `KEYBINDINGS + (** Information about modules and extensions *) | `MODULES + (** Information about size allocation *) | `GEOMETRY + (** Information about icon themes *) | `ICONTHEME + (** Information about printing *) | `PRINTING + (** Trace GtkBuilder operation *) | `BUILDER + (** Information about size requests *) | `SIZE_REQUEST + (** Disable the style property cache *) | `NO_CSS_CACHE + (** Open the GTK inspector *) | `INTERACTIVE + (** Information about actions and menu models *) | `ACTIONS + (** Information from layout managers *) | `LAYOUT + (** Include debug render nodes in the generated snapshots *) | `SNAPSHOT + (** Information from the constraints solver *) | `CONSTRAINTS + (** Log unused GtkBuilder objects *) | `BUILDER_OBJECTS + (** Information about accessibility state changes *) | `A11Y + (** Information about icon fallback. *) | `ICONFALLBACK + (** Inverts the default text-direction. *) | `INVERT_TEXT_DIR ] @@ -1088,8 +2003,12 @@ type debugflags = debugflags_flag list (* DialogFlags - bitfield/flags *) type dialogflags_flag = [ + (** Make the constructed dialog modal *) | `MODAL + (** Destroy the dialog when its parent is destroyed *) | `DESTROY_WITH_PARENT + (** Create dialog with actions in header + bar instead of action area *) | `USE_HEADER_BAR ] @@ -1097,11 +2016,17 @@ type dialogflags = dialogflags_flag list (* EventControllerScrollFlags - bitfield/flags *) type eventcontrollerscrollflags_flag = [ + (** Don't emit scroll. *) | `NONE + (** Emit scroll with vertical deltas. *) | `VERTICAL + (** Emit scroll with horizontal deltas. *) | `HORIZONTAL + (** Only emit deltas that are multiples of 1. *) | `DISCRETE + (** Emit ::decelerate after continuous scroll finishes. *) | `KINETIC + (** Emit scroll on both axes. *) | `BOTH_AXES ] @@ -1109,10 +2034,15 @@ type eventcontrollerscrollflags = eventcontrollerscrollflags_flag list (* FontChooserLevel - bitfield/flags *) type fontchooserlevel_flag = [ + (** Allow selecting a font family *) | `FAMILY + (** Allow selecting a specific font face *) | `STYLE + (** Allow selecting a specific font size *) | `SIZE + (** Allow changing OpenType font variation axes *) | `VARIATIONS + (** Allow selecting specific OpenType font features *) | `FEATURES ] @@ -1120,8 +2050,14 @@ type fontchooserlevel = fontchooserlevel_flag list (* IconLookupFlags - bitfield/flags *) type iconlookupflags_flag = [ + (** Try to always load regular icons, even + when symbolic icon names are given *) | `FORCE_REGULAR + (** Try to always load symbolic icons, even + when regular icon names are given *) | `FORCE_SYMBOLIC + (** Starts loading the texture in the background + so it is ready when later needed. *) | `PRELOAD ] @@ -1129,18 +2065,35 @@ type iconlookupflags = iconlookupflags_flag list (* InputHints - bitfield/flags *) type inputhints_flag = [ + (** No special behaviour suggested *) | `NONE + (** Suggest checking for typos *) | `SPELLCHECK + (** Suggest not checking for typos *) | `NO_SPELLCHECK + (** Suggest word completion *) | `WORD_COMPLETION + (** Suggest to convert all text to lowercase *) | `LOWERCASE + (** Suggest to capitalize all text *) | `UPPERCASE_CHARS + (** Suggest to capitalize the first + character of each word *) | `UPPERCASE_WORDS + (** Suggest to capitalize the + first word of each sentence *) | `UPPERCASE_SENTENCES + (** Suggest to not show an onscreen keyboard + (e.g for a calculator that already has all the keys). *) | `INHIBIT_OSK + (** The text is vertical *) | `VERTICAL_WRITING + (** Suggest offering Emoji support *) | `EMOJI + (** Suggest not offering Emoji support *) | `NO_EMOJI + (** Request that the input method should not + update personalized data (like typing history) *) | `PRIVATE ] @@ -1148,8 +2101,12 @@ type inputhints = inputhints_flag list (* ListScrollFlags - bitfield/flags *) type listscrollflags_flag = [ + (** Don't do anything extra *) | `NONE + (** Focus the target item *) | `FOCUS + (** Select the target item and + unselect all other items. *) | `SELECT ] @@ -1157,8 +2114,11 @@ type listscrollflags = listscrollflags_flag list (* PickFlags - bitfield/flags *) type pickflags_flag = [ + (** The default behavior, include widgets that are receiving events *) | `DEFAULT + (** Include widgets that are insensitive *) | `INSENSITIVE + (** Include widgets that are marked as non-targetable. See [property@Widget:can-target] *) | `NON_TARGETABLE ] @@ -1166,7 +2126,10 @@ type pickflags = pickflags_flag list (* PopoverMenuFlags - bitfield/flags *) type popovermenuflags_flag = [ + (** Submenus are presented as sliding submenus that replace the main menu. *) | `SLIDING + (** Submenus are presented as traditional, nested + popovers. *) | `NESTED ] @@ -1174,6 +2137,9 @@ type popovermenuflags = popovermenuflags_flag list (* ShortcutActionFlags - bitfield/flags *) type shortcutactionflags_flag = [ + (** The action is the only + action that can be activated. If this flag is not set, + a future activation may select a different action. *) | `EXCLUSIVE ] @@ -1181,21 +2147,37 @@ type shortcutactionflags = shortcutactionflags_flag list (* StateFlags - bitfield/flags *) type stateflags_flag = [ + (** State during normal operation *) | `NORMAL + (** Widget is active *) | `ACTIVE + (** Widget has a mouse pointer over it *) | `PRELIGHT + (** Widget is selected *) | `SELECTED + (** Widget is insensitive *) | `INSENSITIVE + (** Widget is inconsistent *) | `INCONSISTENT + (** Widget has the keyboard focus *) | `FOCUSED + (** Widget is in a background toplevel window *) | `BACKDROP + (** Widget is in left-to-right text direction *) | `DIR_LTR + (** Widget is in right-to-left text direction *) | `DIR_RTL + (** Widget is a link *) | `LINK + (** The location the widget points to has already been visited *) | `VISITED + (** Widget is checked *) | `CHECKED + (** Widget is highlighted as a drop target for DND *) | `DROP_ACTIVE + (** Widget has the visible focus *) | `FOCUS_VISIBLE + (** Widget contains the keyboard focus *) | `FOCUS_WITHIN ] @@ -1203,9 +2185,16 @@ type stateflags = stateflags_flag list (* StyleContextPrintFlags - bitfield/flags *) type stylecontextprintflags_flag = [ + (** Default value. *) | `NONE + (** Print the entire tree of + CSS nodes starting at the style context's node *) | `RECURSE + (** Show the values of the + CSS properties for each node *) | `SHOW_STYLE + (** Show information about + what changes affect the styles *) | `SHOW_CHANGE ] @@ -1213,8 +2202,14 @@ type stylecontextprintflags = stylecontextprintflags_flag list (* TextSearchFlags - bitfield/flags *) type textsearchflags_flag = [ + (** Search only visible data. A search match may +have invisible text interspersed. *) | `VISIBLE_ONLY + (** Search only text. A match may have paintables or +child widgets mixed inside the matched range. *) | `TEXT_ONLY + (** The text will be matched regardless of +what case it is in. *) | `CASE_INSENSITIVE ] @@ -1222,7 +2217,11 @@ type textsearchflags = textsearchflags_flag list (* TreeModelFlags - bitfield/flags *) type treemodelflags_flag = [ + (** iterators survive all signals + emitted by the tree *) | `ITERS_PERSIST + (** the model is a list only, and never + has children *) | `LIST_ONLY ] diff --git a/ocgtk/src/gtk/generated/ml_gdk_enums_gen.c b/ocgtk/src/gtk/generated/ml_gdk_enums_gen.c index 8809d4cbc..8ef2bf340 100644 --- a/ocgtk/src/gtk/generated/ml_gdk_enums_gen.c +++ b/ocgtk/src/gtk/generated/ml_gdk_enums_gen.c @@ -252,7 +252,10 @@ value Val_GdkEventType(GdkEventType val) { case GDK_PAD_RING: return caml_hash_variant("PAD_RING"); /* `PAD_RING */ case GDK_PAD_STRIP: return caml_hash_variant("PAD_STRIP"); /* `PAD_STRIP */ case GDK_PAD_GROUP_MODE: return caml_hash_variant("PAD_GROUP_MODE"); /* `PAD_GROUP_MODE */ +#if GTK_CHECK_VERSION(4,6,0) case GDK_TOUCHPAD_HOLD: return caml_hash_variant("TOUCHPAD_HOLD"); /* `TOUCHPAD_HOLD */ + +#endif case GDK_EVENT_LAST: return caml_hash_variant("EVENT_LAST"); /* `EVENT_LAST */ default: { char msg[128]; @@ -293,7 +296,12 @@ GdkEventType GdkEventType_val(value val) { else if (val == caml_hash_variant("PAD_RING")) return GDK_PAD_RING; /* `PAD_RING */ else if (val == caml_hash_variant("PAD_STRIP")) return GDK_PAD_STRIP; /* `PAD_STRIP */ else if (val == caml_hash_variant("PAD_GROUP_MODE")) return GDK_PAD_GROUP_MODE; /* `PAD_GROUP_MODE */ +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("TOUCHPAD_HOLD")) return GDK_TOUCHPAD_HOLD; /* `TOUCHPAD_HOLD */ + +#else + else if (val == caml_hash_variant("TOUCHPAD_HOLD")) caml_failwith("GdkEventType.TOUCHPAD_HOLD requires 4.6"); +#endif else if (val == caml_hash_variant("EVENT_LAST")) return GDK_EVENT_LAST; /* `EVENT_LAST */ else { char msg[128]; @@ -479,30 +487,99 @@ value Val_GdkMemoryFormat(GdkMemoryFormat val) { case GDK_MEMORY_A8B8G8R8: return caml_hash_variant("A8B8G8R8"); /* `A8B8G8R8 */ case GDK_MEMORY_R8G8B8: return caml_hash_variant("R8G8B8"); /* `R8G8B8 */ case GDK_MEMORY_B8G8R8: return caml_hash_variant("B8G8R8"); /* `B8G8R8 */ +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16: return caml_hash_variant("R16G16B16"); /* `R16G16B16 */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16_PREMULTIPLIED: return caml_hash_variant("R16G16B16A16_PREMULTIPLIED"); /* `R16G16B16A16_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16: return caml_hash_variant("R16G16B16A16"); /* `R16G16B16A16 */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16_FLOAT: return caml_hash_variant("R16G16B16_FLOAT"); /* `R16G16B16_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED: return caml_hash_variant("R16G16B16A16_FLOAT_PREMULTIPLIED"); /* `R16G16B16A16_FLOAT_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R16G16B16A16_FLOAT: return caml_hash_variant("R16G16B16A16_FLOAT"); /* `R16G16B16A16_FLOAT */ + +#endif case GDK_MEMORY_R32G32B32_FLOAT: return caml_hash_variant("R32G32B32_FLOAT"); /* `R32G32B32_FLOAT */ +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: return caml_hash_variant("R32G32B32A32_FLOAT_PREMULTIPLIED"); /* `R32G32B32A32_FLOAT_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,6,0) case GDK_MEMORY_R32G32B32A32_FLOAT: return caml_hash_variant("R32G32B32A32_FLOAT"); /* `R32G32B32A32_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G8A8_PREMULTIPLIED: return caml_hash_variant("G8A8_PREMULTIPLIED"); /* `G8A8_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G8A8: return caml_hash_variant("G8A8"); /* `G8A8 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G8: return caml_hash_variant("G8"); /* `G8 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G16A16_PREMULTIPLIED: return caml_hash_variant("G16A16_PREMULTIPLIED"); /* `G16A16_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G16A16: return caml_hash_variant("G16A16"); /* `G16A16 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_G16: return caml_hash_variant("G16"); /* `G16 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A8: return caml_hash_variant("A8"); /* `A8 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A16: return caml_hash_variant("A16"); /* `A16 */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A16_FLOAT: return caml_hash_variant("A16_FLOAT"); /* `A16_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GDK_MEMORY_A32_FLOAT: return caml_hash_variant("A32_FLOAT"); /* `A32_FLOAT */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_A8B8G8R8_PREMULTIPLIED: return caml_hash_variant("A8B8G8R8_PREMULTIPLIED"); /* `A8B8G8R8_PREMULTIPLIED */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_B8G8R8X8: return caml_hash_variant("B8G8R8X8"); /* `B8G8R8X8 */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_X8R8G8B8: return caml_hash_variant("X8R8G8B8"); /* `X8R8G8B8 */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_R8G8B8X8: return caml_hash_variant("R8G8B8X8"); /* `R8G8B8X8 */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GDK_MEMORY_X8B8G8R8: return caml_hash_variant("X8B8G8R8"); /* `X8B8G8R8 */ + +#endif case GDK_MEMORY_N_FORMATS: return caml_hash_variant("N_FORMATS"); /* `N_FORMATS */ default: { char msg[128]; @@ -524,30 +601,145 @@ GdkMemoryFormat GdkMemoryFormat_val(value val) { else if (val == caml_hash_variant("A8B8G8R8")) return GDK_MEMORY_A8B8G8R8; /* `A8B8G8R8 */ else if (val == caml_hash_variant("R8G8B8")) return GDK_MEMORY_R8G8B8; /* `R8G8B8 */ else if (val == caml_hash_variant("B8G8R8")) return GDK_MEMORY_B8G8R8; /* `B8G8R8 */ +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16")) return GDK_MEMORY_R16G16B16; /* `R16G16B16 */ + +#else + else if (val == caml_hash_variant("R16G16B16")) caml_failwith("GdkMemoryFormat.R16G16B16 requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16_PREMULTIPLIED")) return GDK_MEMORY_R16G16B16A16_PREMULTIPLIED; /* `R16G16B16A16_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("R16G16B16A16_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.R16G16B16A16_PREMULTIPLIED requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16")) return GDK_MEMORY_R16G16B16A16; /* `R16G16B16A16 */ + +#else + else if (val == caml_hash_variant("R16G16B16A16")) caml_failwith("GdkMemoryFormat.R16G16B16A16 requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16_FLOAT")) return GDK_MEMORY_R16G16B16_FLOAT; /* `R16G16B16_FLOAT */ + +#else + else if (val == caml_hash_variant("R16G16B16_FLOAT")) caml_failwith("GdkMemoryFormat.R16G16B16_FLOAT requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16_FLOAT_PREMULTIPLIED")) return GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED; /* `R16G16B16A16_FLOAT_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("R16G16B16A16_FLOAT_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.R16G16B16A16_FLOAT_PREMULTIPLIED requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R16G16B16A16_FLOAT")) return GDK_MEMORY_R16G16B16A16_FLOAT; /* `R16G16B16A16_FLOAT */ + +#else + else if (val == caml_hash_variant("R16G16B16A16_FLOAT")) caml_failwith("GdkMemoryFormat.R16G16B16A16_FLOAT requires 4.6"); +#endif else if (val == caml_hash_variant("R32G32B32_FLOAT")) return GDK_MEMORY_R32G32B32_FLOAT; /* `R32G32B32_FLOAT */ +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R32G32B32A32_FLOAT_PREMULTIPLIED")) return GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED; /* `R32G32B32A32_FLOAT_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("R32G32B32A32_FLOAT_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.R32G32B32A32_FLOAT_PREMULTIPLIED requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,6,0) else if (val == caml_hash_variant("R32G32B32A32_FLOAT")) return GDK_MEMORY_R32G32B32A32_FLOAT; /* `R32G32B32A32_FLOAT */ + +#else + else if (val == caml_hash_variant("R32G32B32A32_FLOAT")) caml_failwith("GdkMemoryFormat.R32G32B32A32_FLOAT requires 4.6"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G8A8_PREMULTIPLIED")) return GDK_MEMORY_G8A8_PREMULTIPLIED; /* `G8A8_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("G8A8_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.G8A8_PREMULTIPLIED requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G8A8")) return GDK_MEMORY_G8A8; /* `G8A8 */ + +#else + else if (val == caml_hash_variant("G8A8")) caml_failwith("GdkMemoryFormat.G8A8 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G8")) return GDK_MEMORY_G8; /* `G8 */ + +#else + else if (val == caml_hash_variant("G8")) caml_failwith("GdkMemoryFormat.G8 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G16A16_PREMULTIPLIED")) return GDK_MEMORY_G16A16_PREMULTIPLIED; /* `G16A16_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("G16A16_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.G16A16_PREMULTIPLIED requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G16A16")) return GDK_MEMORY_G16A16; /* `G16A16 */ + +#else + else if (val == caml_hash_variant("G16A16")) caml_failwith("GdkMemoryFormat.G16A16 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("G16")) return GDK_MEMORY_G16; /* `G16 */ + +#else + else if (val == caml_hash_variant("G16")) caml_failwith("GdkMemoryFormat.G16 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A8")) return GDK_MEMORY_A8; /* `A8 */ + +#else + else if (val == caml_hash_variant("A8")) caml_failwith("GdkMemoryFormat.A8 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A16")) return GDK_MEMORY_A16; /* `A16 */ + +#else + else if (val == caml_hash_variant("A16")) caml_failwith("GdkMemoryFormat.A16 requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A16_FLOAT")) return GDK_MEMORY_A16_FLOAT; /* `A16_FLOAT */ + +#else + else if (val == caml_hash_variant("A16_FLOAT")) caml_failwith("GdkMemoryFormat.A16_FLOAT requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("A32_FLOAT")) return GDK_MEMORY_A32_FLOAT; /* `A32_FLOAT */ + +#else + else if (val == caml_hash_variant("A32_FLOAT")) caml_failwith("GdkMemoryFormat.A32_FLOAT requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("A8B8G8R8_PREMULTIPLIED")) return GDK_MEMORY_A8B8G8R8_PREMULTIPLIED; /* `A8B8G8R8_PREMULTIPLIED */ + +#else + else if (val == caml_hash_variant("A8B8G8R8_PREMULTIPLIED")) caml_failwith("GdkMemoryFormat.A8B8G8R8_PREMULTIPLIED requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("B8G8R8X8")) return GDK_MEMORY_B8G8R8X8; /* `B8G8R8X8 */ + +#else + else if (val == caml_hash_variant("B8G8R8X8")) caml_failwith("GdkMemoryFormat.B8G8R8X8 requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("X8R8G8B8")) return GDK_MEMORY_X8R8G8B8; /* `X8R8G8B8 */ + +#else + else if (val == caml_hash_variant("X8R8G8B8")) caml_failwith("GdkMemoryFormat.X8R8G8B8 requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("R8G8B8X8")) return GDK_MEMORY_R8G8B8X8; /* `R8G8B8X8 */ + +#else + else if (val == caml_hash_variant("R8G8B8X8")) caml_failwith("GdkMemoryFormat.R8G8B8X8 requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("X8B8G8R8")) return GDK_MEMORY_X8B8G8R8; /* `X8B8G8R8 */ + +#else + else if (val == caml_hash_variant("X8B8G8R8")) caml_failwith("GdkMemoryFormat.X8B8G8R8 requires 4.14"); +#endif else if (val == caml_hash_variant("N_FORMATS")) return GDK_MEMORY_N_FORMATS; /* `N_FORMATS */ else { char msg[128]; @@ -1191,12 +1383,15 @@ value Val_GdkModifierType(GdkModifierType flags) { CAMLlocal2(result, cons); result = Val_emptylist; +#if GTK_CHECK_VERSION(4,14,0) if (flags & GDK_NO_MODIFIER_MASK) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("NO_MODIFIER_MASK"))); /* `NO_MODIFIER_MASK */ Store_field(cons, 1, result); result = cons; } + +#endif if (flags & GDK_SHIFT_MASK) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("SHIFT_MASK"))); /* `SHIFT_MASK */ @@ -1278,7 +1473,12 @@ GdkModifierType GdkModifierType_val(value list) { GdkModifierType result = 0; while (list != Val_emptylist) { int tag = Int_val(Field(list, 0)); +#if GTK_CHECK_VERSION(4,14,0) if (tag == caml_hash_variant("NO_MODIFIER_MASK")) result |= GDK_NO_MODIFIER_MASK; /* `NO_MODIFIER_MASK */ + +#else + if (tag == caml_hash_variant("NO_MODIFIER_MASK")) caml_failwith("GdkModifierType.NO_MODIFIER_MASK requires 4.14"); +#endif else if (tag == caml_hash_variant("SHIFT_MASK")) result |= GDK_SHIFT_MASK; /* `SHIFT_MASK */ else if (tag == caml_hash_variant("LOCK_MASK")) result |= GDK_LOCK_MASK; /* `LOCK_MASK */ else if (tag == caml_hash_variant("CONTROL_MASK")) result |= GDK_CONTROL_MASK; /* `CONTROL_MASK */ diff --git a/ocgtk/src/gtk/generated/ml_gsk_enums_gen.c b/ocgtk/src/gtk/generated/ml_gsk_enums_gen.c index 268a3b3d1..2491986ea 100644 --- a/ocgtk/src/gtk/generated/ml_gsk_enums_gen.c +++ b/ocgtk/src/gtk/generated/ml_gsk_enums_gen.c @@ -353,11 +353,26 @@ value Val_GskRenderNodeType(GskRenderNodeType val) { case GSK_BLUR_NODE: return caml_hash_variant("BLUR_NODE"); /* `BLUR_NODE */ case GSK_DEBUG_NODE: return caml_hash_variant("DEBUG_NODE"); /* `DEBUG_NODE */ case GSK_GL_SHADER_NODE: return caml_hash_variant("GL_SHADER_NODE"); /* `GL_SHADER_NODE */ +#if GTK_CHECK_VERSION(4,10,0) case GSK_TEXTURE_SCALE_NODE: return caml_hash_variant("TEXTURE_SCALE_NODE"); /* `TEXTURE_SCALE_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,10,0) case GSK_MASK_NODE: return caml_hash_variant("MASK_NODE"); /* `MASK_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GSK_FILL_NODE: return caml_hash_variant("FILL_NODE"); /* `FILL_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GSK_STROKE_NODE: return caml_hash_variant("STROKE_NODE"); /* `STROKE_NODE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GSK_SUBSURFACE_NODE: return caml_hash_variant("SUBSURFACE_NODE"); /* `SUBSURFACE_NODE */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GskRenderNodeType value: %d", (int)val); @@ -395,11 +410,36 @@ GskRenderNodeType GskRenderNodeType_val(value val) { else if (val == caml_hash_variant("BLUR_NODE")) return GSK_BLUR_NODE; /* `BLUR_NODE */ else if (val == caml_hash_variant("DEBUG_NODE")) return GSK_DEBUG_NODE; /* `DEBUG_NODE */ else if (val == caml_hash_variant("GL_SHADER_NODE")) return GSK_GL_SHADER_NODE; /* `GL_SHADER_NODE */ +#if GTK_CHECK_VERSION(4,10,0) else if (val == caml_hash_variant("TEXTURE_SCALE_NODE")) return GSK_TEXTURE_SCALE_NODE; /* `TEXTURE_SCALE_NODE */ + +#else + else if (val == caml_hash_variant("TEXTURE_SCALE_NODE")) caml_failwith("GskRenderNodeType.TEXTURE_SCALE_NODE requires 4.10"); +#endif +#if GTK_CHECK_VERSION(4,10,0) else if (val == caml_hash_variant("MASK_NODE")) return GSK_MASK_NODE; /* `MASK_NODE */ + +#else + else if (val == caml_hash_variant("MASK_NODE")) caml_failwith("GskRenderNodeType.MASK_NODE requires 4.10"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("FILL_NODE")) return GSK_FILL_NODE; /* `FILL_NODE */ + +#else + else if (val == caml_hash_variant("FILL_NODE")) caml_failwith("GskRenderNodeType.FILL_NODE requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("STROKE_NODE")) return GSK_STROKE_NODE; /* `STROKE_NODE */ + +#else + else if (val == caml_hash_variant("STROKE_NODE")) caml_failwith("GskRenderNodeType.STROKE_NODE requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("SUBSURFACE_NODE")) return GSK_SUBSURFACE_NODE; /* `SUBSURFACE_NODE */ + +#else + else if (val == caml_hash_variant("SUBSURFACE_NODE")) caml_failwith("GskRenderNodeType.SUBSURFACE_NODE requires 4.14"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GskRenderNodeType tag: %ld", val); diff --git a/ocgtk/src/gtk/generated/ml_gtk_enums_gen.c b/ocgtk/src/gtk/generated/ml_gtk_enums_gen.c index ecbd3d7bb..81d8df4d2 100644 --- a/ocgtk/src/gtk/generated/ml_gtk_enums_gen.c +++ b/ocgtk/src/gtk/generated/ml_gtk_enums_gen.c @@ -329,13 +329,34 @@ value Val_GtkAccessibleRole(GtkAccessibleRole val) { case GTK_ACCESSIBLE_ROLE_TREE_ITEM: return caml_hash_variant("TREE_ITEM"); /* `TREE_ITEM */ case GTK_ACCESSIBLE_ROLE_WIDGET: return caml_hash_variant("WIDGET"); /* `WIDGET */ case GTK_ACCESSIBLE_ROLE_WINDOW: return caml_hash_variant("WINDOW"); /* `WINDOW */ +#if GTK_CHECK_VERSION(4,10,0) case GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON: return caml_hash_variant("TOGGLE_BUTTON"); /* `TOGGLE_BUTTON */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GTK_ACCESSIBLE_ROLE_APPLICATION: return caml_hash_variant("APPLICATION"); /* `APPLICATION */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GTK_ACCESSIBLE_ROLE_PARAGRAPH: return caml_hash_variant("PARAGRAPH"); /* `PARAGRAPH */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE: return caml_hash_variant("BLOCK_QUOTE"); /* `BLOCK_QUOTE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GTK_ACCESSIBLE_ROLE_ARTICLE: return caml_hash_variant("ARTICLE"); /* `ARTICLE */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GTK_ACCESSIBLE_ROLE_COMMENT: return caml_hash_variant("COMMENT"); /* `COMMENT */ + +#endif +#if GTK_CHECK_VERSION(4,14,0) case GTK_ACCESSIBLE_ROLE_TERMINAL: return caml_hash_variant("TERMINAL"); /* `TERMINAL */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GtkAccessibleRole value: %d", (int)val); @@ -425,13 +446,48 @@ GtkAccessibleRole GtkAccessibleRole_val(value val) { else if (val == caml_hash_variant("TREE_ITEM")) return GTK_ACCESSIBLE_ROLE_TREE_ITEM; /* `TREE_ITEM */ else if (val == caml_hash_variant("WIDGET")) return GTK_ACCESSIBLE_ROLE_WIDGET; /* `WIDGET */ else if (val == caml_hash_variant("WINDOW")) return GTK_ACCESSIBLE_ROLE_WINDOW; /* `WINDOW */ +#if GTK_CHECK_VERSION(4,10,0) else if (val == caml_hash_variant("TOGGLE_BUTTON")) return GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON; /* `TOGGLE_BUTTON */ + +#else + else if (val == caml_hash_variant("TOGGLE_BUTTON")) caml_failwith("GtkAccessibleRole.TOGGLE_BUTTON requires 4.10"); +#endif +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("APPLICATION")) return GTK_ACCESSIBLE_ROLE_APPLICATION; /* `APPLICATION */ + +#else + else if (val == caml_hash_variant("APPLICATION")) caml_failwith("GtkAccessibleRole.APPLICATION requires 4.12"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("PARAGRAPH")) return GTK_ACCESSIBLE_ROLE_PARAGRAPH; /* `PARAGRAPH */ + +#else + else if (val == caml_hash_variant("PARAGRAPH")) caml_failwith("GtkAccessibleRole.PARAGRAPH requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("BLOCK_QUOTE")) return GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE; /* `BLOCK_QUOTE */ + +#else + else if (val == caml_hash_variant("BLOCK_QUOTE")) caml_failwith("GtkAccessibleRole.BLOCK_QUOTE requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("ARTICLE")) return GTK_ACCESSIBLE_ROLE_ARTICLE; /* `ARTICLE */ + +#else + else if (val == caml_hash_variant("ARTICLE")) caml_failwith("GtkAccessibleRole.ARTICLE requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("COMMENT")) return GTK_ACCESSIBLE_ROLE_COMMENT; /* `COMMENT */ + +#else + else if (val == caml_hash_variant("COMMENT")) caml_failwith("GtkAccessibleRole.COMMENT requires 4.14"); +#endif +#if GTK_CHECK_VERSION(4,14,0) else if (val == caml_hash_variant("TERMINAL")) return GTK_ACCESSIBLE_ROLE_TERMINAL; /* `TERMINAL */ + +#else + else if (val == caml_hash_variant("TERMINAL")) caml_failwith("GtkAccessibleRole.TERMINAL requires 4.14"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GtkAccessibleRole tag: %ld", val); @@ -481,7 +537,10 @@ value Val_GtkAccessibleState(GtkAccessibleState val) { case GTK_ACCESSIBLE_STATE_INVALID: return caml_hash_variant("INVALID"); /* `INVALID */ case GTK_ACCESSIBLE_STATE_PRESSED: return caml_hash_variant("PRESSED"); /* `PRESSED */ case GTK_ACCESSIBLE_STATE_SELECTED: return caml_hash_variant("SELECTED"); /* `SELECTED */ +#if GTK_CHECK_VERSION(4,12,0) case GTK_ACCESSIBLE_STATE_VISITED: return caml_hash_variant("VISITED"); /* `VISITED */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GtkAccessibleState value: %d", (int)val); @@ -501,7 +560,12 @@ GtkAccessibleState GtkAccessibleState_val(value val) { else if (val == caml_hash_variant("INVALID")) return GTK_ACCESSIBLE_STATE_INVALID; /* `INVALID */ else if (val == caml_hash_variant("PRESSED")) return GTK_ACCESSIBLE_STATE_PRESSED; /* `PRESSED */ else if (val == caml_hash_variant("SELECTED")) return GTK_ACCESSIBLE_STATE_SELECTED; /* `SELECTED */ +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("VISITED")) return GTK_ACCESSIBLE_STATE_VISITED; /* `VISITED */ + +#else + else if (val == caml_hash_variant("VISITED")) caml_failwith("GtkAccessibleState.VISITED requires 4.12"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GtkAccessibleState tag: %ld", val); @@ -609,8 +673,14 @@ value Val_GtkAlign(GtkAlign val) { case GTK_ALIGN_START: return caml_hash_variant("START"); /* `START */ case GTK_ALIGN_END: return caml_hash_variant("END"); /* `END */ case GTK_ALIGN_CENTER: return caml_hash_variant("CENTER"); /* `CENTER */ +#if GTK_CHECK_VERSION(4,12,0) case GTK_ALIGN_BASELINE_FILL: return caml_hash_variant("BASELINE_FILL"); /* `BASELINE_FILL */ + +#endif +#if GTK_CHECK_VERSION(4,12,0) case GTK_ALIGN_BASELINE_CENTER: return caml_hash_variant("BASELINE_CENTER"); /* `BASELINE_CENTER */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GtkAlign value: %d", (int)val); @@ -626,9 +696,19 @@ GtkAlign GtkAlign_val(value val) { else if (val == caml_hash_variant("START")) return GTK_ALIGN_START; /* `START */ else if (val == caml_hash_variant("END")) return GTK_ALIGN_END; /* `END */ else if (val == caml_hash_variant("CENTER")) return GTK_ALIGN_CENTER; /* `CENTER */ +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("BASELINE_FILL")) return GTK_ALIGN_BASELINE_FILL; /* `BASELINE_FILL */ + +#else + else if (val == caml_hash_variant("BASELINE_FILL")) caml_failwith("GtkAlign.BASELINE_FILL requires 4.12"); +#endif else if (val == caml_hash_variant("BASELINE")) return GTK_ALIGN_BASELINE; /* `BASELINE */ +#if GTK_CHECK_VERSION(4,12,0) else if (val == caml_hash_variant("BASELINE_CENTER")) return GTK_ALIGN_BASELINE_CENTER; /* `BASELINE_CENTER */ + +#else + else if (val == caml_hash_variant("BASELINE_CENTER")) caml_failwith("GtkAlign.BASELINE_CENTER requires 4.12"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown GtkAlign tag: %ld", val); @@ -3828,12 +3908,16 @@ value Val_GtkDebugFlags(GtkDebugFlags flags) { Store_field(cons, 1, result); result = cons; } +#if GTK_CHECK_VERSION(4,2,0) if (flags & GTK_DEBUG_ICONFALLBACK) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("ICONFALLBACK"))); /* `ICONFALLBACK */ Store_field(cons, 1, result); result = cons; } + +#endif +#if GTK_CHECK_VERSION(4,8,0) if (flags & GTK_DEBUG_INVERT_TEXT_DIR) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("INVERT_TEXT_DIR"))); /* `INVERT_TEXT_DIR */ @@ -3841,6 +3925,8 @@ value Val_GtkDebugFlags(GtkDebugFlags flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -3866,8 +3952,18 @@ GtkDebugFlags GtkDebugFlags_val(value list) { else if (tag == caml_hash_variant("CONSTRAINTS")) result |= GTK_DEBUG_CONSTRAINTS; /* `CONSTRAINTS */ else if (tag == caml_hash_variant("BUILDER_OBJECTS")) result |= GTK_DEBUG_BUILDER_OBJECTS; /* `BUILDER_OBJECTS */ else if (tag == caml_hash_variant("A11Y")) result |= GTK_DEBUG_A11Y; /* `A11Y */ +#if GTK_CHECK_VERSION(4,2,0) else if (tag == caml_hash_variant("ICONFALLBACK")) result |= GTK_DEBUG_ICONFALLBACK; /* `ICONFALLBACK */ + +#else + else if (tag == caml_hash_variant("ICONFALLBACK")) caml_failwith("GtkDebugFlags.ICONFALLBACK requires 4.2"); +#endif +#if GTK_CHECK_VERSION(4,8,0) else if (tag == caml_hash_variant("INVERT_TEXT_DIR")) result |= GTK_DEBUG_INVERT_TEXT_DIR; /* `INVERT_TEXT_DIR */ + +#else + else if (tag == caml_hash_variant("INVERT_TEXT_DIR")) caml_failwith("GtkDebugFlags.INVERT_TEXT_DIR requires 4.8"); +#endif list = Field(list, 1); } return result; @@ -4274,12 +4370,15 @@ value Val_GtkPopoverMenuFlags(GtkPopoverMenuFlags flags) { CAMLlocal2(result, cons); result = Val_emptylist; +#if GTK_CHECK_VERSION(4,14,0) if (flags & GTK_POPOVER_MENU_SLIDING) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("SLIDING"))); /* `SLIDING */ Store_field(cons, 1, result); result = cons; } + +#endif if (flags & GTK_POPOVER_MENU_NESTED) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("NESTED"))); /* `NESTED */ @@ -4295,7 +4394,12 @@ GtkPopoverMenuFlags GtkPopoverMenuFlags_val(value list) { GtkPopoverMenuFlags result = 0; while (list != Val_emptylist) { int tag = Int_val(Field(list, 0)); +#if GTK_CHECK_VERSION(4,14,0) if (tag == caml_hash_variant("SLIDING")) result |= GTK_POPOVER_MENU_SLIDING; /* `SLIDING */ + +#else + if (tag == caml_hash_variant("SLIDING")) caml_failwith("GtkPopoverMenuFlags.SLIDING requires 4.14"); +#endif else if (tag == caml_hash_variant("NESTED")) result |= GTK_POPOVER_MENU_NESTED; /* `NESTED */ list = Field(list, 1); } diff --git a/ocgtk/src/gtk/generated/ml_page_setup_gen.c b/ocgtk/src/gtk/generated/ml_page_setup_gen.c index 4128e12a3..148dedfd9 100644 --- a/ocgtk/src/gtk/generated/ml_page_setup_gen.c +++ b/ocgtk/src/gtk/generated/ml_page_setup_gen.c @@ -189,3 +189,11 @@ CAMLparam2(self, arg1); double result = gtk_page_setup_get_bottom_margin(GtkPageSetup_val(self), GtkUnit_val(arg1)); CAMLreturn(caml_copy_double(result)); } + +CAMLexport CAMLprim value ml_gtk_page_setup_copy(value self) +{ +CAMLparam1(self); + +GtkPageSetup* result = gtk_page_setup_copy(GtkPageSetup_val(self)); +CAMLreturn(Val_GtkPageSetup(result)); +} diff --git a/ocgtk/src/gtk/generated/ml_print_backend_gen.c b/ocgtk/src/gtk/generated/ml_print_backend_gen.c new file mode 100644 index 000000000..8c4fa8f8f --- /dev/null +++ b/ocgtk/src/gtk/generated/ml_print_backend_gen.c @@ -0,0 +1,33 @@ +/* GENERATED CODE - DO NOT EDIT */ +/* C bindings for PrintBackend */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "wrappers.h" +#include "converters.h" + +#include +/* Include library-specific type conversions and forward declarations */ +#include "gtk_decls.h" + +/* Conversion functions for GtkPrintBackend (opaque record with hidden fields) */ +GtkPrintBackend *GtkPrintBackend_val(value v) { + return *(GtkPrintBackend **)Data_custom_val(v); +} + +value Val_GtkPrintBackend(const GtkPrintBackend *ptr) { + if (ptr == NULL) return Val_none; + return ml_gir_record_val_ptr(ptr); +} + +value Val_GtkPrintBackend_option(const GtkPrintBackend *ptr) { + if (ptr == NULL) return Val_none; + return Val_some(Val_GtkPrintBackend(ptr)); +} + diff --git a/ocgtk/src/gtk/generated/ml_print_context_gen.c b/ocgtk/src/gtk/generated/ml_print_context_gen.c index 87b122482..eea9dbc06 100644 --- a/ocgtk/src/gtk/generated/ml_print_context_gen.c +++ b/ocgtk/src/gtk/generated/ml_print_context_gen.c @@ -42,6 +42,15 @@ if (result) g_object_ref_sink(result); CAMLreturn(Val_PangoFontMap(result)); } +CAMLexport CAMLprim value ml_gtk_print_context_get_page_setup(value self) +{ +CAMLparam1(self); + +GtkPageSetup* result = gtk_print_context_get_page_setup(GtkPrintContext_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_GtkPageSetup(result)); +} + CAMLexport CAMLprim value ml_gtk_print_context_get_height(value self) { CAMLparam1(self); diff --git a/ocgtk/src/gtk/generated/ml_print_dialog_gen.c b/ocgtk/src/gtk/generated/ml_print_dialog_gen.c index c5fdfca0e..d26b7b7a1 100644 --- a/ocgtk/src/gtk/generated/ml_print_dialog_gen.c +++ b/ocgtk/src/gtk/generated/ml_print_dialog_gen.c @@ -45,6 +45,22 @@ gtk_print_dialog_set_title(GtkPrintDialog_val(self), String_val(arg1)); CAMLreturn(Val_unit); } +CAMLexport CAMLprim value ml_gtk_print_dialog_set_print_settings(value self, value arg1) +{ +CAMLparam2(self, arg1); + +gtk_print_dialog_set_print_settings(GtkPrintDialog_val(self), GtkPrintSettings_val(arg1)); +CAMLreturn(Val_unit); +} + +CAMLexport CAMLprim value ml_gtk_print_dialog_set_page_setup(value self, value arg1) +{ +CAMLparam2(self, arg1); + +gtk_print_dialog_set_page_setup(GtkPrintDialog_val(self), GtkPageSetup_val(arg1)); +CAMLreturn(Val_unit); +} + CAMLexport CAMLprim value ml_gtk_print_dialog_set_modal(value self, value arg1) { CAMLparam2(self, arg1); @@ -87,6 +103,24 @@ const char* result = gtk_print_dialog_get_title(GtkPrintDialog_val(self)); CAMLreturn(caml_copy_string(result)); } +CAMLexport CAMLprim value ml_gtk_print_dialog_get_print_settings(value self) +{ +CAMLparam1(self); + +GtkPrintSettings* result = gtk_print_dialog_get_print_settings(GtkPrintDialog_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_GtkPrintSettings(result)); +} + +CAMLexport CAMLprim value ml_gtk_print_dialog_get_page_setup(value self) +{ +CAMLparam1(self); + +GtkPageSetup* result = gtk_print_dialog_get_page_setup(GtkPrintDialog_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_GtkPageSetup(result)); +} + CAMLexport CAMLprim value ml_gtk_print_dialog_get_modal(value self) { CAMLparam1(self); @@ -133,6 +167,24 @@ return Val_unit; } +CAMLexport CAMLprim value ml_gtk_print_dialog_get_page_setup(value self) +{ +CAMLparam1(self); +(void)self; +caml_failwith("PrintDialog requires GTK >= 4.14"); +return Val_unit; +} + + +CAMLexport CAMLprim value ml_gtk_print_dialog_get_print_settings(value self) +{ +CAMLparam1(self); +(void)self; +caml_failwith("PrintDialog requires GTK >= 4.14"); +return Val_unit; +} + + CAMLexport CAMLprim value ml_gtk_print_dialog_get_title(value self) { CAMLparam1(self); @@ -182,6 +234,26 @@ return Val_unit; } +CAMLexport CAMLprim value ml_gtk_print_dialog_set_page_setup(value self, value arg1) +{ +CAMLparam2(self, arg1); +(void)self; +(void)arg1; +caml_failwith("PrintDialog requires GTK >= 4.14"); +return Val_unit; +} + + +CAMLexport CAMLprim value ml_gtk_print_dialog_set_print_settings(value self, value arg1) +{ +CAMLparam2(self, arg1); +(void)self; +(void)arg1; +caml_failwith("PrintDialog requires GTK >= 4.14"); +return Val_unit; +} + + CAMLexport CAMLprim value ml_gtk_print_dialog_set_title(value self, value arg1) { CAMLparam2(self, arg1); diff --git a/ocgtk/src/gtk/generated/ml_print_operation_gen.c b/ocgtk/src/gtk/generated/ml_print_operation_gen.c index c87944e34..6abe202e8 100644 --- a/ocgtk/src/gtk/generated/ml_print_operation_gen.c +++ b/ocgtk/src/gtk/generated/ml_print_operation_gen.c @@ -66,6 +66,14 @@ gtk_print_operation_set_show_progress(GtkPrintOperation_val(self), Bool_val(arg1 CAMLreturn(Val_unit); } +CAMLexport CAMLprim value ml_gtk_print_operation_set_print_settings(value self, value arg1) +{ +CAMLparam2(self, arg1); + +gtk_print_operation_set_print_settings(GtkPrintOperation_val(self), Option_val(arg1, GtkPrintSettings_val, NULL)); +CAMLreturn(Val_unit); +} + CAMLexport CAMLprim value ml_gtk_print_operation_set_n_pages(value self, value arg1) { CAMLparam2(self, arg1); @@ -114,6 +122,14 @@ gtk_print_operation_set_defer_drawing(GtkPrintOperation_val(self)); CAMLreturn(Val_unit); } +CAMLexport CAMLprim value ml_gtk_print_operation_set_default_page_setup(value self, value arg1) +{ +CAMLparam2(self, arg1); + +gtk_print_operation_set_default_page_setup(GtkPrintOperation_val(self), Option_val(arg1, GtkPageSetup_val, NULL)); +CAMLreturn(Val_unit); +} + CAMLexport CAMLprim value ml_gtk_print_operation_set_custom_tab_label(value self, value arg1) { CAMLparam2(self, arg1); @@ -179,6 +195,15 @@ GtkPrintStatus result = gtk_print_operation_get_status(GtkPrintOperation_val(sel CAMLreturn(Val_GtkPrintStatus(result)); } +CAMLexport CAMLprim value ml_gtk_print_operation_get_print_settings(value self) +{ +CAMLparam1(self); + +GtkPrintSettings* result = gtk_print_operation_get_print_settings(GtkPrintOperation_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_option(result, Val_GtkPrintSettings)); +} + CAMLexport CAMLprim value ml_gtk_print_operation_get_n_pages_to_print(value self) { CAMLparam1(self); @@ -212,6 +237,15 @@ gboolean result = gtk_print_operation_get_embed_page_setup(GtkPrintOperation_val CAMLreturn(Val_bool(result)); } +CAMLexport CAMLprim value ml_gtk_print_operation_get_default_page_setup(value self) +{ +CAMLparam1(self); + +GtkPageSetup* result = gtk_print_operation_get_default_page_setup(GtkPrintOperation_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_GtkPageSetup(result)); +} + CAMLexport CAMLprim value ml_gtk_print_operation_draw_page_finish(value self) { CAMLparam1(self); diff --git a/ocgtk/src/gtk/generated/ml_print_settings_gen.c b/ocgtk/src/gtk/generated/ml_print_settings_gen.c index 0037abcb3..bfd1ff929 100644 --- a/ocgtk/src/gtk/generated/ml_print_settings_gen.c +++ b/ocgtk/src/gtk/generated/ml_print_settings_gen.c @@ -591,3 +591,11 @@ CAMLparam2(self, arg1); const char* result = gtk_print_settings_get(GtkPrintSettings_val(self), String_val(arg1)); CAMLreturn(Val_option_string(result)); } + +CAMLexport CAMLprim value ml_gtk_print_settings_copy(value self) +{ +CAMLparam1(self); + +GtkPrintSettings* result = gtk_print_settings_copy(GtkPrintSettings_val(self)); +CAMLreturn(Val_GtkPrintSettings(result)); +} diff --git a/ocgtk/src/gtk/generated/ml_print_setup_gen.c b/ocgtk/src/gtk/generated/ml_print_setup_gen.c index 8b2d5c8e9..7485a12ab 100644 --- a/ocgtk/src/gtk/generated/ml_print_setup_gen.c +++ b/ocgtk/src/gtk/generated/ml_print_setup_gen.c @@ -52,9 +52,45 @@ GtkPrintSetup* result = gtk_print_setup_ref(GtkPrintSetup_val(self)); CAMLreturn(Val_GtkPrintSetup(result)); } +CAMLexport CAMLprim value ml_gtk_print_setup_get_print_settings(value self) +{ +CAMLparam1(self); + +GtkPrintSettings* result = gtk_print_setup_get_print_settings(GtkPrintSetup_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_option(result, Val_GtkPrintSettings)); +} + +CAMLexport CAMLprim value ml_gtk_print_setup_get_page_setup(value self) +{ +CAMLparam1(self); + +GtkPageSetup* result = gtk_print_setup_get_page_setup(GtkPrintSetup_val(self)); +if (result) g_object_ref_sink(result); +CAMLreturn(Val_option(result, Val_GtkPageSetup)); +} + #else +CAMLexport CAMLprim value ml_gtk_print_setup_get_page_setup(value self) +{ +CAMLparam1(self); +(void)self; +caml_failwith("PrintSetup requires GTK >= 4.14"); +return Val_unit; +} + + +CAMLexport CAMLprim value ml_gtk_print_setup_get_print_settings(value self) +{ +CAMLparam1(self); +(void)self; +caml_failwith("PrintSetup requires GTK >= 4.14"); +return Val_unit; +} + + CAMLexport CAMLprim value ml_gtk_print_setup_ref(value self) { CAMLparam1(self); diff --git a/ocgtk/src/gtk/generated/page_setup.ml b/ocgtk/src/gtk/generated/page_setup.ml index 6b2222b8a..49275a801 100644 --- a/ocgtk/src/gtk/generated/page_setup.ml +++ b/ocgtk/src/gtk/generated/page_setup.ml @@ -89,3 +89,6 @@ external get_left_margin : t -> Gtk_enums.unit -> float = "ml_gtk_page_setup_get (** Gets the bottom margin in units of @unit. *) external get_bottom_margin : t -> Gtk_enums.unit -> float = "ml_gtk_page_setup_get_bottom_margin" +(** Copies a `GtkPageSetup`. *) +external copy : t -> t = "ml_gtk_page_setup_copy" + diff --git a/ocgtk/src/gtk/generated/page_setup.mli b/ocgtk/src/gtk/generated/page_setup.mli index 6b2222b8a..49275a801 100644 --- a/ocgtk/src/gtk/generated/page_setup.mli +++ b/ocgtk/src/gtk/generated/page_setup.mli @@ -89,3 +89,6 @@ external get_left_margin : t -> Gtk_enums.unit -> float = "ml_gtk_page_setup_get (** Gets the bottom margin in units of @unit. *) external get_bottom_margin : t -> Gtk_enums.unit -> float = "ml_gtk_page_setup_get_bottom_margin" +(** Copies a `GtkPageSetup`. *) +external copy : t -> t = "ml_gtk_page_setup_copy" + diff --git a/ocgtk/src/gtk/generated/pango_enums.mli b/ocgtk/src/gtk/generated/pango_enums.mli index 571d4396a..2ff80cc89 100644 --- a/ocgtk/src/gtk/generated/pango_enums.mli +++ b/ocgtk/src/gtk/generated/pango_enums.mli @@ -3,373 +3,705 @@ (* Alignment - enumeration *) type alignment = [ + (** Put all available space on the right *) | `LEFT + (** Center the line within the available space *) | `CENTER + (** Put all available space on the left *) | `RIGHT ] (* AttrType - enumeration *) type attrtype = [ + (** does not happen *) | `INVALID + (** language ([struct@Pango.AttrLanguage]) *) | `LANGUAGE + (** font family name list ([struct@Pango.AttrString]) *) | `FAMILY + (** font slant style ([struct@Pango.AttrInt]) *) | `STYLE + (** font weight ([struct@Pango.AttrInt]) *) | `WEIGHT + (** font variant (normal or small caps) ([struct@Pango.AttrInt]) *) | `VARIANT + (** font stretch ([struct@Pango.AttrInt]) *) | `STRETCH + (** font size in points scaled by %PANGO_SCALE ([struct@Pango.AttrInt]) *) | `SIZE + (** font description ([struct@Pango.AttrFontDesc]) *) | `FONT_DESC + (** foreground color ([struct@Pango.AttrColor]) *) | `FOREGROUND + (** background color ([struct@Pango.AttrColor]) *) | `BACKGROUND + (** whether the text has an underline ([struct@Pango.AttrInt]) *) | `UNDERLINE + (** whether the text is struck-through ([struct@Pango.AttrInt]) *) | `STRIKETHROUGH + (** baseline displacement ([struct@Pango.AttrInt]) *) | `RISE + (** shape ([struct@Pango.AttrShape]) *) | `SHAPE + (** font size scale factor ([struct@Pango.AttrFloat]) *) | `SCALE + (** whether fallback is enabled ([struct@Pango.AttrInt]) *) | `FALLBACK + (** letter spacing ([struct@PangoAttrInt]) *) | `LETTER_SPACING + (** underline color ([struct@Pango.AttrColor]) *) | `UNDERLINE_COLOR + (** strikethrough color ([struct@Pango.AttrColor]) *) | `STRIKETHROUGH_COLOR + (** font size in pixels scaled by %PANGO_SCALE ([struct@Pango.AttrInt]) *) | `ABSOLUTE_SIZE + (** base text gravity ([struct@Pango.AttrInt]) *) | `GRAVITY + (** gravity hint ([struct@Pango.AttrInt]) *) | `GRAVITY_HINT + (** OpenType font features ([struct@Pango.AttrFontFeatures]). Since 1.38 *) | `FONT_FEATURES + (** foreground alpha ([struct@Pango.AttrInt]). Since 1.38 *) | `FOREGROUND_ALPHA + (** background alpha ([struct@Pango.AttrInt]). Since 1.38 *) | `BACKGROUND_ALPHA + (** whether breaks are allowed ([struct@Pango.AttrInt]). Since 1.44 *) | `ALLOW_BREAKS + (** how to render invisible characters ([struct@Pango.AttrInt]). Since 1.44 *) | `SHOW + (** whether to insert hyphens at intra-word line breaks ([struct@Pango.AttrInt]). Since 1.44 *) | `INSERT_HYPHENS + (** whether the text has an overline ([struct@Pango.AttrInt]). Since 1.46 *) | `OVERLINE + (** overline color ([struct@Pango.AttrColor]). Since 1.46 *) | `OVERLINE_COLOR + (** line height factor ([struct@Pango.AttrFloat]). Since: 1.50 *) | `LINE_HEIGHT + (** line height ([struct@Pango.AttrInt]). Since: 1.50 *) | `ABSOLUTE_LINE_HEIGHT | `TEXT_TRANSFORM + (** override segmentation to classify the range of the attribute as a single word ([struct@Pango.AttrInt]). Since 1.50 *) | `WORD + (** override segmentation to classify the range of the attribute as a single sentence ([struct@Pango.AttrInt]). Since 1.50 *) | `SENTENCE + (** baseline displacement ([struct@Pango.AttrInt]). Since 1.50 *) | `BASELINE_SHIFT + (** font-relative size change ([struct@Pango.AttrInt]). Since 1.50 *) | `FONT_SCALE ] (* BaselineShift - enumeration *) type baselineshift = [ + (** Leave the baseline unchanged *) | `NONE + (** Shift the baseline to the superscript position, + relative to the previous run *) | `SUPERSCRIPT + (** Shift the baseline to the subscript position, + relative to the previous run *) | `SUBSCRIPT ] (* BidiType - enumeration *) type biditype = [ + (** Left-to-Right *) | `L + (** Left-to-Right Embedding *) | `LRE + (** Left-to-Right Override *) | `LRO + (** Right-to-Left *) | `R + (** Right-to-Left Arabic *) | `AL + (** Right-to-Left Embedding *) | `RLE + (** Right-to-Left Override *) | `RLO + (** Pop Directional Format *) | `PDF + (** European Number *) | `EN + (** European Number Separator *) | `ES + (** European Number Terminator *) | `ET + (** Arabic Number *) | `AN + (** Common Number Separator *) | `CS + (** Nonspacing Mark *) | `NSM + (** Boundary Neutral *) | `BN + (** Paragraph Separator *) | `B + (** Segment Separator *) | `S + (** Whitespace *) | `WS + (** Other Neutrals *) | `ON + (** Left-to-Right isolate. Since 1.48.6 *) | `LRI + (** Right-to-Left isolate. Since 1.48.6 *) | `RLI + (** First strong isolate. Since 1.48.6 *) | `FSI + (** Pop directional isolate. Since 1.48.6 *) | `PDI ] (* CoverageLevel - enumeration *) type coveragelevel = [ + (** The character is not representable with + the font. *) | `NONE + (** The character is represented in a + way that may be comprehensible but is not the correct + graphical form. For instance, a Hangul character represented + as a a sequence of Jamos, or a Latin transliteration of a + Cyrillic word. *) | `FALLBACK + (** The character is represented as + basically the correct graphical form, but with a stylistic + variant inappropriate for the current script. *) | `APPROXIMATE + (** The character is represented as the + correct graphical form. *) | `EXACT ] (* Direction - enumeration *) type direction = [ + (** A strong left-to-right direction *) | `LTR + (** A strong right-to-left direction *) | `RTL + (** Deprecated value; treated the + same as `PANGO_DIRECTION_RTL`. *) | `TTB_LTR + (** Deprecated value; treated the + same as `PANGO_DIRECTION_LTR` *) | `TTB_RTL + (** A weak left-to-right direction *) | `WEAK_LTR + (** A weak right-to-left direction *) | `WEAK_RTL + (** No direction specified *) | `NEUTRAL ] (* EllipsizeMode - enumeration *) type ellipsizemode = [ + (** No ellipsization *) | `NONE + (** Omit characters at the start of the text *) | `START + (** Omit characters in the middle of the text *) | `MIDDLE + (** Omit characters at the end of the text *) | `END ] (* FontScale - enumeration *) type fontscale = [ + (** Leave the font size unchanged *) | `NONE + (** Change the font to a size suitable for superscripts *) | `SUPERSCRIPT + (** Change the font to a size suitable for subscripts *) | `SUBSCRIPT + (** Change the font to a size suitable for Small Caps *) | `SMALL_CAPS ] (* Gravity - enumeration *) type gravity = [ + (** Glyphs stand upright (default) *) | `SOUTH + (** Glyphs are rotated 90 degrees counter-clockwise. *) | `EAST + (** Glyphs are upside-down. *) | `NORTH + (** Glyphs are rotated 90 degrees clockwise. *) | `WEST + (** Gravity is resolved from the context matrix *) | `AUTO ] (* GravityHint - enumeration *) type gravityhint = [ + (** scripts will take their natural gravity based + on the base gravity and the script. This is the default. *) | `NATURAL + (** always use the base gravity set, regardless of + the script. *) | `STRONG + (** for scripts not in their natural direction (eg. + Latin in East gravity), choose per-script gravity such that every script + respects the line progression. This means, Latin and Arabic will take + opposite gravities and both flow top-to-bottom for example. *) | `LINE ] (* LayoutDeserializeError - enumeration *) type layoutdeserializeerror = [ + (** Unspecified error *) | `INVALID + (** A JSon value could not be + interpreted *) | `INVALID_VALUE + (** A required JSon member was + not found *) | `MISSING_VALUE ] (* Overline - enumeration *) type overline = [ + (** no overline should be drawn *) | `NONE + (** Draw a single line above the ink + extents of the text being underlined. *) | `SINGLE ] (* RenderPart - enumeration *) type renderpart = [ + (** the text itself *) | `FOREGROUND + (** the area behind the text *) | `BACKGROUND + (** underlines *) | `UNDERLINE + (** strikethrough lines *) | `STRIKETHROUGH + (** overlines *) | `OVERLINE ] (* Script - enumeration *) type script = [ + (** a value never returned from pango_script_for_unichar() *) | `INVALID_CODE + (** a character used by multiple different scripts *) | `COMMON + (** a mark glyph that takes its script from the +base glyph to which it is attached *) | `INHERITED + (** Arabic *) | `ARABIC + (** Armenian *) | `ARMENIAN + (** Bengali *) | `BENGALI + (** Bopomofo *) | `BOPOMOFO + (** Cherokee *) | `CHEROKEE + (** Coptic *) | `COPTIC + (** Cyrillic *) | `CYRILLIC + (** Deseret *) | `DESERET + (** Devanagari *) | `DEVANAGARI + (** Ethiopic *) | `ETHIOPIC + (** Georgian *) | `GEORGIAN + (** Gothic *) | `GOTHIC + (** Greek *) | `GREEK + (** Gujarati *) | `GUJARATI + (** Gurmukhi *) | `GURMUKHI + (** Han *) | `HAN + (** Hangul *) | `HANGUL + (** Hebrew *) | `HEBREW + (** Hiragana *) | `HIRAGANA + (** Kannada *) | `KANNADA + (** Katakana *) | `KATAKANA + (** Khmer *) | `KHMER + (** Lao *) | `LAO + (** Latin *) | `LATIN + (** Malayalam *) | `MALAYALAM + (** Mongolian *) | `MONGOLIAN + (** Myanmar *) | `MYANMAR + (** Ogham *) | `OGHAM + (** Old Italic *) | `OLD_ITALIC + (** Oriya *) | `ORIYA + (** Runic *) | `RUNIC + (** Sinhala *) | `SINHALA + (** Syriac *) | `SYRIAC + (** Tamil *) | `TAMIL + (** Telugu *) | `TELUGU + (** Thaana *) | `THAANA + (** Thai *) | `THAI + (** Tibetan *) | `TIBETAN + (** Canadian Aboriginal *) | `CANADIAN_ABORIGINAL + (** Yi *) | `YI + (** Tagalog *) | `TAGALOG + (** Hanunoo *) | `HANUNOO + (** Buhid *) | `BUHID + (** Tagbanwa *) | `TAGBANWA + (** Braille *) | `BRAILLE + (** Cypriot *) | `CYPRIOT + (** Limbu *) | `LIMBU + (** Osmanya *) | `OSMANYA + (** Shavian *) | `SHAVIAN + (** Linear B *) | `LINEAR_B + (** Tai Le *) | `TAI_LE + (** Ugaritic *) | `UGARITIC + (** New Tai Lue. Since 1.10 *) | `NEW_TAI_LUE + (** Buginese. Since 1.10 *) | `BUGINESE + (** Glagolitic. Since 1.10 *) | `GLAGOLITIC + (** Tifinagh. Since 1.10 *) | `TIFINAGH + (** Syloti Nagri. Since 1.10 *) | `SYLOTI_NAGRI + (** Old Persian. Since 1.10 *) | `OLD_PERSIAN + (** Kharoshthi. Since 1.10 *) | `KHAROSHTHI + (** an unassigned code point. Since 1.14 *) | `UNKNOWN + (** Balinese. Since 1.14 *) | `BALINESE + (** Cuneiform. Since 1.14 *) | `CUNEIFORM + (** Phoenician. Since 1.14 *) | `PHOENICIAN + (** Phags-pa. Since 1.14 *) | `PHAGS_PA + (** N'Ko. Since 1.14 *) | `NKO + (** Kayah Li. Since 1.20.1 *) | `KAYAH_LI + (** Lepcha. Since 1.20.1 *) | `LEPCHA + (** Rejang. Since 1.20.1 *) | `REJANG + (** Sundanese. Since 1.20.1 *) | `SUNDANESE + (** Saurashtra. Since 1.20.1 *) | `SAURASHTRA + (** Cham. Since 1.20.1 *) | `CHAM + (** Ol Chiki. Since 1.20.1 *) | `OL_CHIKI + (** Vai. Since 1.20.1 *) | `VAI + (** Carian. Since 1.20.1 *) | `CARIAN + (** Lycian. Since 1.20.1 *) | `LYCIAN + (** Lydian. Since 1.20.1 *) | `LYDIAN + (** Batak. Since 1.32 *) | `BATAK + (** Brahmi. Since 1.32 *) | `BRAHMI + (** Mandaic. Since 1.32 *) | `MANDAIC + (** Chakma. Since: 1.32 *) | `CHAKMA + (** Meroitic Cursive. Since: 1.32 *) | `MEROITIC_CURSIVE + (** Meroitic Hieroglyphs. Since: 1.32 *) | `MEROITIC_HIEROGLYPHS + (** Miao. Since: 1.32 *) | `MIAO + (** Sharada. Since: 1.32 *) | `SHARADA + (** Sora Sompeng. Since: 1.32 *) | `SORA_SOMPENG + (** Takri. Since: 1.32 *) | `TAKRI + (** Bassa. Since: 1.40 *) | `BASSA_VAH + (** Caucasian Albanian. Since: 1.40 *) | `CAUCASIAN_ALBANIAN + (** Duployan. Since: 1.40 *) | `DUPLOYAN + (** Elbasan. Since: 1.40 *) | `ELBASAN + (** Grantha. Since: 1.40 *) | `GRANTHA + (** Kjohki. Since: 1.40 *) | `KHOJKI + (** Khudawadi, Sindhi. Since: 1.40 *) | `KHUDAWADI + (** Linear A. Since: 1.40 *) | `LINEAR_A + (** Mahajani. Since: 1.40 *) | `MAHAJANI + (** Manichaean. Since: 1.40 *) | `MANICHAEAN + (** Mende Kikakui. Since: 1.40 *) | `MENDE_KIKAKUI + (** Modi. Since: 1.40 *) | `MODI + (** Mro. Since: 1.40 *) | `MRO + (** Nabataean. Since: 1.40 *) | `NABATAEAN + (** Old North Arabian. Since: 1.40 *) | `OLD_NORTH_ARABIAN + (** Old Permic. Since: 1.40 *) | `OLD_PERMIC + (** Pahawh Hmong. Since: 1.40 *) | `PAHAWH_HMONG + (** Palmyrene. Since: 1.40 *) | `PALMYRENE + (** Pau Cin Hau. Since: 1.40 *) | `PAU_CIN_HAU + (** Psalter Pahlavi. Since: 1.40 *) | `PSALTER_PAHLAVI + (** Siddham. Since: 1.40 *) | `SIDDHAM + (** Tirhuta. Since: 1.40 *) | `TIRHUTA + (** Warang Citi. Since: 1.40 *) | `WARANG_CITI + (** Ahom. Since: 1.40 *) | `AHOM + (** Anatolian Hieroglyphs. Since: 1.40 *) | `ANATOLIAN_HIEROGLYPHS + (** Hatran. Since: 1.40 *) | `HATRAN + (** Multani. Since: 1.40 *) | `MULTANI + (** Old Hungarian. Since: 1.40 *) | `OLD_HUNGARIAN + (** Signwriting. Since: 1.40 *) | `SIGNWRITING ] (* Stretch - enumeration *) type stretch = [ + (** ultra condensed width *) | `ULTRA_CONDENSED + (** extra condensed width *) | `EXTRA_CONDENSED + (** condensed width *) | `CONDENSED + (** semi condensed width *) | `SEMI_CONDENSED + (** the normal width *) | `NORMAL + (** semi expanded width *) | `SEMI_EXPANDED + (** expanded width *) | `EXPANDED + (** extra expanded width *) | `EXTRA_EXPANDED + (** ultra expanded width *) | `ULTRA_EXPANDED ] (* Style - enumeration *) type style = [ + (** the font is upright. *) | `NORMAL + (** the font is slanted, but in a roman style. *) | `OBLIQUE + (** the font is slanted in an italic style. *) | `ITALIC ] (* TabAlign - enumeration *) type tabalign = [ + (** the text appears to the right of the tab stop position *) | `LEFT + (** the text appears to the left of the tab stop position + until the available space is filled. Since: 1.50 *) | `RIGHT + (** the text is centered at the tab stop position + until the available space is filled. Since: 1.50 *) | `CENTER + (** text before the first occurrence of the decimal point + character appears to the left of the tab stop position (until the available + space is filled), the rest to the right. Since: 1.50 *) | `DECIMAL ] (* TextTransform - enumeration *) type texttransform = [ + (** Leave text unchanged *) | `NONE + (** Display letters and numbers as lowercase *) | `LOWERCASE + (** Display letters and numbers as uppercase *) | `UPPERCASE + (** Display the first character of a word + in titlecase *) | `CAPITALIZE ] (* Underline - enumeration *) type underline = [ + (** no underline should be drawn *) | `NONE + (** a single underline should be drawn *) | `SINGLE + (** a double underline should be drawn *) | `DOUBLE + (** a single underline should be drawn at a + position beneath the ink extents of the text being + underlined. This should be used only for underlining + single characters, such as for keyboard accelerators. + %PANGO_UNDERLINE_SINGLE should be used for extended + portions of text. *) | `LOW + (** an underline indicating an error should + be drawn below. The exact style of rendering is up to the + `PangoRenderer` in use, but typical styles include wavy + or dotted lines. + This underline is typically used to indicate an error such + as a possible mispelling; in some cases a contrasting color + may automatically be used. This type of underlining is + available since Pango 1.4. *) | `ERROR + (** Like @PANGO_UNDERLINE_SINGLE, but + drawn continuously across multiple runs. This type + of underlining is available since Pango 1.46. *) | `SINGLE_LINE + (** Like @PANGO_UNDERLINE_DOUBLE, but + drawn continuously across multiple runs. This type + of underlining is available since Pango 1.46. *) | `DOUBLE_LINE + (** Like @PANGO_UNDERLINE_ERROR, but + drawn continuously across multiple runs. This type + of underlining is available since Pango 1.46. *) | `ERROR_LINE ] (* Variant - enumeration *) type variant = [ + (** A normal font. *) | `NORMAL + (** A font with the lower case characters + replaced by smaller variants of the capital characters. *) | `SMALL_CAPS + (** A font with all characters + replaced by smaller variants of the capital characters. Since: 1.50 *) | `ALL_SMALL_CAPS + (** A font with the lower case characters + replaced by smaller variants of the capital characters. + Petite Caps can be even smaller than Small Caps. Since: 1.50 *) | `PETITE_CAPS + (** A font with all characters + replaced by smaller variants of the capital characters. + Petite Caps can be even smaller than Small Caps. Since: 1.50 *) | `ALL_PETITE_CAPS + (** A font with the upper case characters + replaced by smaller variants of the capital letters. Since: 1.50 *) | `UNICASE + (** A font with capital letters that + are more suitable for all-uppercase titles. Since: 1.50 *) | `TITLE_CAPS ] (* Weight - enumeration *) type weight = [ + (** the thin weight (= 100) Since: 1.24 *) | `THIN + (** the ultralight weight (= 200) *) | `ULTRALIGHT + (** the light weight (= 300) *) | `LIGHT + (** the semilight weight (= 350) Since: 1.36.7 *) | `SEMILIGHT + (** the book weight (= 380) Since: 1.24) *) | `BOOK + (** the default weight (= 400) *) | `NORMAL + (** the medium weight (= 500) Since: 1.24 *) | `MEDIUM + (** the semibold weight (= 600) *) | `SEMIBOLD + (** the bold weight (= 700) *) | `BOLD + (** the ultrabold weight (= 800) *) | `ULTRABOLD + (** the heavy weight (= 900) *) | `HEAVY + (** the ultraheavy weight (= 1000) Since: 1.24 *) | `ULTRAHEAVY ] (* WrapMode - enumeration *) type wrapmode = [ + (** wrap lines at word boundaries. *) | `WORD + (** wrap lines at character boundaries. *) | `CHAR + (** wrap lines at word boundaries, but fall back to + character boundaries if there is not enough space for a full word. *) | `WORD_CHAR ] (* FontMask - bitfield/flags *) type fontmask_flag = [ + (** the font family is specified. *) | `FAMILY + (** the font style is specified. *) | `STYLE + (** the font variant is specified. *) | `VARIANT + (** the font weight is specified. *) | `WEIGHT + (** the font stretch is specified. *) | `STRETCH + (** the font size is specified. *) | `SIZE + (** the font gravity is specified (Since: 1.16.) *) | `GRAVITY + (** OpenType font variations are specified (Since: 1.42) *) | `VARIATIONS ] @@ -377,7 +709,10 @@ type fontmask = fontmask_flag list (* LayoutDeserializeFlags - bitfield/flags *) type layoutdeserializeflags_flag = [ + (** Default behavior *) | `DEFAULT + (** Apply context information + from the serialization to the `PangoContext` *) | `CONTEXT ] @@ -385,8 +720,11 @@ type layoutdeserializeflags = layoutdeserializeflags_flag list (* LayoutSerializeFlags - bitfield/flags *) type layoutserializeflags_flag = [ + (** Default behavior *) | `DEFAULT + (** Include context information *) | `CONTEXT + (** Include information about the formatted output *) | `OUTPUT ] @@ -394,7 +732,10 @@ type layoutserializeflags = layoutserializeflags_flag list (* ShapeFlags - bitfield/flags *) type shapeflags_flag = [ + (** Default value *) | `NONE + (** Round glyph positions and widths to whole device units + This option should be set if the target renderer can't do subpixel positioning of glyphs *) | `ROUND_POSITIONS ] @@ -402,9 +743,14 @@ type shapeflags = shapeflags_flag list (* ShowFlags - bitfield/flags *) type showflags_flag = [ + (** No special treatment for invisible characters *) | `NONE + (** Render spaces, tabs and newlines visibly *) | `SPACES + (** Render line breaks visibly *) | `LINE_BREAKS + (** Render default-ignorable Unicode + characters visibly *) | `IGNORABLES ] diff --git a/ocgtk/src/gtk/generated/print_context.ml b/ocgtk/src/gtk/generated/print_context.ml index e8ddb7e1c..b4d18a93c 100644 --- a/ocgtk/src/gtk/generated/print_context.ml +++ b/ocgtk/src/gtk/generated/print_context.ml @@ -19,6 +19,10 @@ external get_width : t -> float = "ml_gtk_print_context_get_width" with the `GtkPrintContext`. *) external get_pango_fontmap : t -> Ocgtk_pango.Pango.Wrappers.Font_map.t = "ml_gtk_print_context_get_pango_fontmap" +(** Obtains the `GtkPageSetup` that determines the page +dimensions of the `GtkPrintContext`. *) +external get_page_setup : t -> Page_setup.t = "ml_gtk_print_context_get_page_setup" + (** Obtains the height of the `GtkPrintContext`, in pixels. *) external get_height : t -> float = "ml_gtk_print_context_get_height" diff --git a/ocgtk/src/gtk/generated/print_context.mli b/ocgtk/src/gtk/generated/print_context.mli index e8ddb7e1c..b4d18a93c 100644 --- a/ocgtk/src/gtk/generated/print_context.mli +++ b/ocgtk/src/gtk/generated/print_context.mli @@ -19,6 +19,10 @@ external get_width : t -> float = "ml_gtk_print_context_get_width" with the `GtkPrintContext`. *) external get_pango_fontmap : t -> Ocgtk_pango.Pango.Wrappers.Font_map.t = "ml_gtk_print_context_get_pango_fontmap" +(** Obtains the `GtkPageSetup` that determines the page +dimensions of the `GtkPrintContext`. *) +external get_page_setup : t -> Page_setup.t = "ml_gtk_print_context_get_page_setup" + (** Obtains the height of the `GtkPrintContext`, in pixels. *) external get_height : t -> float = "ml_gtk_print_context_get_height" diff --git a/ocgtk/src/gtk/generated/print_dialog.ml b/ocgtk/src/gtk/generated/print_dialog.ml index 8cf3bffb8..dabbcc08c 100644 --- a/ocgtk/src/gtk/generated/print_dialog.ml +++ b/ocgtk/src/gtk/generated/print_dialog.ml @@ -17,6 +17,12 @@ external setup_finish : t -> Ocgtk_gio.Gio.Wrappers.Async_result.t -> (Print_set (** Sets the title that will be shown on the print dialog. *) external set_title : t -> string -> unit = "ml_gtk_print_dialog_set_title" +(** Sets the print settings for the print dialog. *) +external set_print_settings : t -> Print_settings.t -> unit = "ml_gtk_print_dialog_set_print_settings" + +(** Set the page setup for the print dialog. *) +external set_page_setup : t -> Page_setup.t -> unit = "ml_gtk_print_dialog_set_page_setup" + (** Sets whether the print dialog blocks interaction with the parent window while it is presented. *) @@ -49,6 +55,12 @@ external print_file_finish : t -> Ocgtk_gio.Gio.Wrappers.Async_result.t -> (bool print dialog. *) external get_title : t -> string = "ml_gtk_print_dialog_get_title" +(** Returns the print settings for the print dialog. *) +external get_print_settings : t -> Print_settings.t = "ml_gtk_print_dialog_get_print_settings" + +(** Returns the page setup. *) +external get_page_setup : t -> Page_setup.t = "ml_gtk_print_dialog_get_page_setup" + (** Returns whether the print dialog blocks interaction with the parent window while it is presented. *) diff --git a/ocgtk/src/gtk/generated/print_dialog.mli b/ocgtk/src/gtk/generated/print_dialog.mli index 8cf3bffb8..dabbcc08c 100644 --- a/ocgtk/src/gtk/generated/print_dialog.mli +++ b/ocgtk/src/gtk/generated/print_dialog.mli @@ -17,6 +17,12 @@ external setup_finish : t -> Ocgtk_gio.Gio.Wrappers.Async_result.t -> (Print_set (** Sets the title that will be shown on the print dialog. *) external set_title : t -> string -> unit = "ml_gtk_print_dialog_set_title" +(** Sets the print settings for the print dialog. *) +external set_print_settings : t -> Print_settings.t -> unit = "ml_gtk_print_dialog_set_print_settings" + +(** Set the page setup for the print dialog. *) +external set_page_setup : t -> Page_setup.t -> unit = "ml_gtk_print_dialog_set_page_setup" + (** Sets whether the print dialog blocks interaction with the parent window while it is presented. *) @@ -49,6 +55,12 @@ external print_file_finish : t -> Ocgtk_gio.Gio.Wrappers.Async_result.t -> (bool print dialog. *) external get_title : t -> string = "ml_gtk_print_dialog_get_title" +(** Returns the print settings for the print dialog. *) +external get_print_settings : t -> Print_settings.t = "ml_gtk_print_dialog_get_print_settings" + +(** Returns the page setup. *) +external get_page_setup : t -> Page_setup.t = "ml_gtk_print_dialog_get_page_setup" + (** Returns whether the print dialog blocks interaction with the parent window while it is presented. *) diff --git a/ocgtk/src/gtk/generated/print_operation.ml b/ocgtk/src/gtk/generated/print_operation.ml index cf351ca17..d883adcd5 100644 --- a/ocgtk/src/gtk/generated/print_operation.ml +++ b/ocgtk/src/gtk/generated/print_operation.ml @@ -38,6 +38,12 @@ external set_support_selection : t -> bool -> unit = "ml_gtk_print_operation_set a progress dialog during the print operation. *) external set_show_progress : t -> bool -> unit = "ml_gtk_print_operation_set_show_progress" +(** Sets the print settings for @op. + +This is typically used to re-establish print settings +from a previous print operation, see [method@Gtk.PrintOperation.run]. *) +external set_print_settings : t -> Print_settings.t option -> unit = "ml_gtk_print_operation_set_print_settings" + (** Sets the number of pages in the document. This must be set to a positive number before the rendering @@ -93,6 +99,13 @@ This function must be called in the callback of the [signal@Gtk.PrintOperation::draw-page] signal. *) external set_defer_drawing : t -> unit = "ml_gtk_print_operation_set_defer_drawing" +(** Makes @default_page_setup the default page setup for @op. + +This page setup will be used by [method@Gtk.PrintOperation.run], +but it can be overridden on a per-page basis by connecting +to the [signal@Gtk.PrintOperation::request-page-setup] signal. *) +external set_default_page_setup : t -> Page_setup.t option -> unit = "ml_gtk_print_operation_set_default_page_setup" + (** Sets the label for the tab holding custom widgets. *) external set_custom_tab_label : t -> string option -> unit = "ml_gtk_print_operation_set_custom_tab_label" @@ -197,6 +210,13 @@ external get_status_string : t -> string = "ml_gtk_print_operation_get_status_st Also see [method@Gtk.PrintOperation.get_status_string]. *) external get_status : t -> Gtk_enums.printstatus = "ml_gtk_print_operation_get_status" +(** Returns the current print settings. + +Note that the return value is %NULL until either +[method@Gtk.PrintOperation.set_print_settings] or +[method@Gtk.PrintOperation.run] have been called. *) +external get_print_settings : t -> Print_settings.t option = "ml_gtk_print_operation_get_print_settings" + (** Returns the number of pages that will be printed. Note that this value is set during print preparation phase @@ -225,6 +245,9 @@ external get_error : t -> (unit, GError.t) result = "ml_gtk_print_operation_get_ (** Gets whether page setup selection combos are embedded *) external get_embed_page_setup : t -> bool = "ml_gtk_print_operation_get_embed_page_setup" +(** Returns the default page setup. *) +external get_default_page_setup : t -> Page_setup.t = "ml_gtk_print_operation_get_default_page_setup" + (** Signal that drawing of particular page is complete. It is called after completion of page drawing (e.g. drawing diff --git a/ocgtk/src/gtk/generated/print_operation.mli b/ocgtk/src/gtk/generated/print_operation.mli index cf351ca17..d883adcd5 100644 --- a/ocgtk/src/gtk/generated/print_operation.mli +++ b/ocgtk/src/gtk/generated/print_operation.mli @@ -38,6 +38,12 @@ external set_support_selection : t -> bool -> unit = "ml_gtk_print_operation_set a progress dialog during the print operation. *) external set_show_progress : t -> bool -> unit = "ml_gtk_print_operation_set_show_progress" +(** Sets the print settings for @op. + +This is typically used to re-establish print settings +from a previous print operation, see [method@Gtk.PrintOperation.run]. *) +external set_print_settings : t -> Print_settings.t option -> unit = "ml_gtk_print_operation_set_print_settings" + (** Sets the number of pages in the document. This must be set to a positive number before the rendering @@ -93,6 +99,13 @@ This function must be called in the callback of the [signal@Gtk.PrintOperation::draw-page] signal. *) external set_defer_drawing : t -> unit = "ml_gtk_print_operation_set_defer_drawing" +(** Makes @default_page_setup the default page setup for @op. + +This page setup will be used by [method@Gtk.PrintOperation.run], +but it can be overridden on a per-page basis by connecting +to the [signal@Gtk.PrintOperation::request-page-setup] signal. *) +external set_default_page_setup : t -> Page_setup.t option -> unit = "ml_gtk_print_operation_set_default_page_setup" + (** Sets the label for the tab holding custom widgets. *) external set_custom_tab_label : t -> string option -> unit = "ml_gtk_print_operation_set_custom_tab_label" @@ -197,6 +210,13 @@ external get_status_string : t -> string = "ml_gtk_print_operation_get_status_st Also see [method@Gtk.PrintOperation.get_status_string]. *) external get_status : t -> Gtk_enums.printstatus = "ml_gtk_print_operation_get_status" +(** Returns the current print settings. + +Note that the return value is %NULL until either +[method@Gtk.PrintOperation.set_print_settings] or +[method@Gtk.PrintOperation.run] have been called. *) +external get_print_settings : t -> Print_settings.t option = "ml_gtk_print_operation_get_print_settings" + (** Returns the number of pages that will be printed. Note that this value is set during print preparation phase @@ -225,6 +245,9 @@ external get_error : t -> (unit, GError.t) result = "ml_gtk_print_operation_get_ (** Gets whether page setup selection combos are embedded *) external get_embed_page_setup : t -> bool = "ml_gtk_print_operation_get_embed_page_setup" +(** Returns the default page setup. *) +external get_default_page_setup : t -> Page_setup.t = "ml_gtk_print_operation_get_default_page_setup" + (** Signal that drawing of particular page is complete. It is called after completion of page drawing (e.g. drawing diff --git a/ocgtk/src/gtk/generated/print_settings.ml b/ocgtk/src/gtk/generated/print_settings.ml index 71932d55d..23838298b 100644 --- a/ocgtk/src/gtk/generated/print_settings.ml +++ b/ocgtk/src/gtk/generated/print_settings.ml @@ -249,3 +249,6 @@ external get_bool : t -> string -> bool = "ml_gtk_print_settings_get_bool" (** Looks up the string value associated with @key. *) external get : t -> string -> string option = "ml_gtk_print_settings_get" +(** Copies a `GtkPrintSettings` object. *) +external copy : t -> t = "ml_gtk_print_settings_copy" + diff --git a/ocgtk/src/gtk/generated/print_settings.mli b/ocgtk/src/gtk/generated/print_settings.mli index 71932d55d..23838298b 100644 --- a/ocgtk/src/gtk/generated/print_settings.mli +++ b/ocgtk/src/gtk/generated/print_settings.mli @@ -249,3 +249,6 @@ external get_bool : t -> string -> bool = "ml_gtk_print_settings_get_bool" (** Looks up the string value associated with @key. *) external get : t -> string -> string option = "ml_gtk_print_settings_get" +(** Copies a `GtkPrintSettings` object. *) +external copy : t -> t = "ml_gtk_print_settings_copy" + diff --git a/ocgtk/src/gtk/generated/print_setup.ml b/ocgtk/src/gtk/generated/print_setup.ml index d8fc2c82d..6b38e6cae 100644 --- a/ocgtk/src/gtk/generated/print_setup.ml +++ b/ocgtk/src/gtk/generated/print_setup.ml @@ -23,3 +23,15 @@ external unref : t -> unit = "ml_gtk_print_setup_unref" (** Increase the reference count of @setup. *) external ref : t -> t = "ml_gtk_print_setup_ref" +(** Returns the print settings of @setup. + +They may be different from the `GtkPrintDialog`'s settings +if the user changed them during the setup process. *) +external get_print_settings : t -> Print_settings.t option = "ml_gtk_print_setup_get_print_settings" + +(** Returns the page setup of @setup. + +It may be different from the `GtkPrintDialog`'s page setup +if the user changed it during the setup process. *) +external get_page_setup : t -> Page_setup.t option = "ml_gtk_print_setup_get_page_setup" + diff --git a/ocgtk/src/gtk/generated/print_setup.mli b/ocgtk/src/gtk/generated/print_setup.mli index d8fc2c82d..6b38e6cae 100644 --- a/ocgtk/src/gtk/generated/print_setup.mli +++ b/ocgtk/src/gtk/generated/print_setup.mli @@ -23,3 +23,15 @@ external unref : t -> unit = "ml_gtk_print_setup_unref" (** Increase the reference count of @setup. *) external ref : t -> t = "ml_gtk_print_setup_ref" +(** Returns the print settings of @setup. + +They may be different from the `GtkPrintDialog`'s settings +if the user changed them during the setup process. *) +external get_print_settings : t -> Print_settings.t option = "ml_gtk_print_setup_get_print_settings" + +(** Returns the page setup of @setup. + +It may be different from the `GtkPrintDialog`'s page setup +if the user changed it during the setup process. *) +external get_page_setup : t -> Page_setup.t option = "ml_gtk_print_setup_get_page_setup" + diff --git a/ocgtk/src/pango/generated/ml_pango_enums_gen.c b/ocgtk/src/pango/generated/ml_pango_enums_gen.c index 77947e150..a5990dd17 100644 --- a/ocgtk/src/pango/generated/ml_pango_enums_gen.c +++ b/ocgtk/src/pango/generated/ml_pango_enums_gen.c @@ -62,21 +62,63 @@ value Val_PangoAttrType(PangoAttrType val) { case PANGO_ATTR_ABSOLUTE_SIZE: return caml_hash_variant("ABSOLUTE_SIZE"); /* `ABSOLUTE_SIZE */ case PANGO_ATTR_GRAVITY: return caml_hash_variant("GRAVITY"); /* `GRAVITY */ case PANGO_ATTR_GRAVITY_HINT: return caml_hash_variant("GRAVITY_HINT"); /* `GRAVITY_HINT */ +#if PANGO_VERSION_CHECK(1,38,0) case PANGO_ATTR_FONT_FEATURES: return caml_hash_variant("FONT_FEATURES"); /* `FONT_FEATURES */ + +#endif +#if PANGO_VERSION_CHECK(1,38,0) case PANGO_ATTR_FOREGROUND_ALPHA: return caml_hash_variant("FOREGROUND_ALPHA"); /* `FOREGROUND_ALPHA */ + +#endif +#if PANGO_VERSION_CHECK(1,38,0) case PANGO_ATTR_BACKGROUND_ALPHA: return caml_hash_variant("BACKGROUND_ALPHA"); /* `BACKGROUND_ALPHA */ + +#endif +#if PANGO_VERSION_CHECK(1,44,0) case PANGO_ATTR_ALLOW_BREAKS: return caml_hash_variant("ALLOW_BREAKS"); /* `ALLOW_BREAKS */ + +#endif +#if PANGO_VERSION_CHECK(1,44,0) case PANGO_ATTR_SHOW: return caml_hash_variant("SHOW"); /* `SHOW */ + +#endif +#if PANGO_VERSION_CHECK(1,44,0) case PANGO_ATTR_INSERT_HYPHENS: return caml_hash_variant("INSERT_HYPHENS"); /* `INSERT_HYPHENS */ + +#endif +#if PANGO_VERSION_CHECK(1,46,0) case PANGO_ATTR_OVERLINE: return caml_hash_variant("OVERLINE"); /* `OVERLINE */ + +#endif +#if PANGO_VERSION_CHECK(1,46,0) case PANGO_ATTR_OVERLINE_COLOR: return caml_hash_variant("OVERLINE_COLOR"); /* `OVERLINE_COLOR */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_ATTR_LINE_HEIGHT: return caml_hash_variant("LINE_HEIGHT"); /* `LINE_HEIGHT */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT: return caml_hash_variant("ABSOLUTE_LINE_HEIGHT"); /* `ABSOLUTE_LINE_HEIGHT */ + +#endif case PANGO_ATTR_TEXT_TRANSFORM: return caml_hash_variant("TEXT_TRANSFORM"); /* `TEXT_TRANSFORM */ +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_ATTR_WORD: return caml_hash_variant("WORD"); /* `WORD */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_ATTR_SENTENCE: return caml_hash_variant("SENTENCE"); /* `SENTENCE */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_ATTR_BASELINE_SHIFT: return caml_hash_variant("BASELINE_SHIFT"); /* `BASELINE_SHIFT */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_ATTR_FONT_SCALE: return caml_hash_variant("FONT_SCALE"); /* `FONT_SCALE */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoAttrType value: %d", (int)val); @@ -111,21 +153,91 @@ PangoAttrType PangoAttrType_val(value val) { else if (val == caml_hash_variant("ABSOLUTE_SIZE")) return PANGO_ATTR_ABSOLUTE_SIZE; /* `ABSOLUTE_SIZE */ else if (val == caml_hash_variant("GRAVITY")) return PANGO_ATTR_GRAVITY; /* `GRAVITY */ else if (val == caml_hash_variant("GRAVITY_HINT")) return PANGO_ATTR_GRAVITY_HINT; /* `GRAVITY_HINT */ +#if PANGO_VERSION_CHECK(1,38,0) else if (val == caml_hash_variant("FONT_FEATURES")) return PANGO_ATTR_FONT_FEATURES; /* `FONT_FEATURES */ + +#else + else if (val == caml_hash_variant("FONT_FEATURES")) caml_failwith("PangoAttrType.FONT_FEATURES requires 1.38"); +#endif +#if PANGO_VERSION_CHECK(1,38,0) else if (val == caml_hash_variant("FOREGROUND_ALPHA")) return PANGO_ATTR_FOREGROUND_ALPHA; /* `FOREGROUND_ALPHA */ + +#else + else if (val == caml_hash_variant("FOREGROUND_ALPHA")) caml_failwith("PangoAttrType.FOREGROUND_ALPHA requires 1.38"); +#endif +#if PANGO_VERSION_CHECK(1,38,0) else if (val == caml_hash_variant("BACKGROUND_ALPHA")) return PANGO_ATTR_BACKGROUND_ALPHA; /* `BACKGROUND_ALPHA */ + +#else + else if (val == caml_hash_variant("BACKGROUND_ALPHA")) caml_failwith("PangoAttrType.BACKGROUND_ALPHA requires 1.38"); +#endif +#if PANGO_VERSION_CHECK(1,44,0) else if (val == caml_hash_variant("ALLOW_BREAKS")) return PANGO_ATTR_ALLOW_BREAKS; /* `ALLOW_BREAKS */ + +#else + else if (val == caml_hash_variant("ALLOW_BREAKS")) caml_failwith("PangoAttrType.ALLOW_BREAKS requires 1.44"); +#endif +#if PANGO_VERSION_CHECK(1,44,0) else if (val == caml_hash_variant("SHOW")) return PANGO_ATTR_SHOW; /* `SHOW */ + +#else + else if (val == caml_hash_variant("SHOW")) caml_failwith("PangoAttrType.SHOW requires 1.44"); +#endif +#if PANGO_VERSION_CHECK(1,44,0) else if (val == caml_hash_variant("INSERT_HYPHENS")) return PANGO_ATTR_INSERT_HYPHENS; /* `INSERT_HYPHENS */ + +#else + else if (val == caml_hash_variant("INSERT_HYPHENS")) caml_failwith("PangoAttrType.INSERT_HYPHENS requires 1.44"); +#endif +#if PANGO_VERSION_CHECK(1,46,0) else if (val == caml_hash_variant("OVERLINE")) return PANGO_ATTR_OVERLINE; /* `OVERLINE */ + +#else + else if (val == caml_hash_variant("OVERLINE")) caml_failwith("PangoAttrType.OVERLINE requires 1.46"); +#endif +#if PANGO_VERSION_CHECK(1,46,0) else if (val == caml_hash_variant("OVERLINE_COLOR")) return PANGO_ATTR_OVERLINE_COLOR; /* `OVERLINE_COLOR */ + +#else + else if (val == caml_hash_variant("OVERLINE_COLOR")) caml_failwith("PangoAttrType.OVERLINE_COLOR requires 1.46"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("LINE_HEIGHT")) return PANGO_ATTR_LINE_HEIGHT; /* `LINE_HEIGHT */ + +#else + else if (val == caml_hash_variant("LINE_HEIGHT")) caml_failwith("PangoAttrType.LINE_HEIGHT requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("ABSOLUTE_LINE_HEIGHT")) return PANGO_ATTR_ABSOLUTE_LINE_HEIGHT; /* `ABSOLUTE_LINE_HEIGHT */ + +#else + else if (val == caml_hash_variant("ABSOLUTE_LINE_HEIGHT")) caml_failwith("PangoAttrType.ABSOLUTE_LINE_HEIGHT requires 1.50"); +#endif else if (val == caml_hash_variant("TEXT_TRANSFORM")) return PANGO_ATTR_TEXT_TRANSFORM; /* `TEXT_TRANSFORM */ +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("WORD")) return PANGO_ATTR_WORD; /* `WORD */ + +#else + else if (val == caml_hash_variant("WORD")) caml_failwith("PangoAttrType.WORD requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("SENTENCE")) return PANGO_ATTR_SENTENCE; /* `SENTENCE */ + +#else + else if (val == caml_hash_variant("SENTENCE")) caml_failwith("PangoAttrType.SENTENCE requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("BASELINE_SHIFT")) return PANGO_ATTR_BASELINE_SHIFT; /* `BASELINE_SHIFT */ + +#else + else if (val == caml_hash_variant("BASELINE_SHIFT")) caml_failwith("PangoAttrType.BASELINE_SHIFT requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("FONT_SCALE")) return PANGO_ATTR_FONT_SCALE; /* `FONT_SCALE */ + +#else + else if (val == caml_hash_variant("FONT_SCALE")) caml_failwith("PangoAttrType.FONT_SCALE requires 1.50"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoAttrType tag: %ld", val); @@ -188,10 +300,22 @@ value Val_PangoBidiType(PangoBidiType val) { case PANGO_BIDI_TYPE_S: return caml_hash_variant("S"); /* `S */ case PANGO_BIDI_TYPE_WS: return caml_hash_variant("WS"); /* `WS */ case PANGO_BIDI_TYPE_ON: return caml_hash_variant("ON"); /* `ON */ +#if PANGO_VERSION_CHECK(1,48,6) case PANGO_BIDI_TYPE_LRI: return caml_hash_variant("LRI"); /* `LRI */ + +#endif +#if PANGO_VERSION_CHECK(1,48,6) case PANGO_BIDI_TYPE_RLI: return caml_hash_variant("RLI"); /* `RLI */ + +#endif +#if PANGO_VERSION_CHECK(1,48,6) case PANGO_BIDI_TYPE_FSI: return caml_hash_variant("FSI"); /* `FSI */ + +#endif +#if PANGO_VERSION_CHECK(1,48,6) case PANGO_BIDI_TYPE_PDI: return caml_hash_variant("PDI"); /* `PDI */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoBidiType value: %d", (int)val); @@ -222,10 +346,30 @@ PangoBidiType PangoBidiType_val(value val) { else if (val == caml_hash_variant("S")) return PANGO_BIDI_TYPE_S; /* `S */ else if (val == caml_hash_variant("WS")) return PANGO_BIDI_TYPE_WS; /* `WS */ else if (val == caml_hash_variant("ON")) return PANGO_BIDI_TYPE_ON; /* `ON */ +#if PANGO_VERSION_CHECK(1,48,6) else if (val == caml_hash_variant("LRI")) return PANGO_BIDI_TYPE_LRI; /* `LRI */ + +#else + else if (val == caml_hash_variant("LRI")) caml_failwith("PangoBidiType.LRI requires 1.48.6"); +#endif +#if PANGO_VERSION_CHECK(1,48,6) else if (val == caml_hash_variant("RLI")) return PANGO_BIDI_TYPE_RLI; /* `RLI */ + +#else + else if (val == caml_hash_variant("RLI")) caml_failwith("PangoBidiType.RLI requires 1.48.6"); +#endif +#if PANGO_VERSION_CHECK(1,48,6) else if (val == caml_hash_variant("FSI")) return PANGO_BIDI_TYPE_FSI; /* `FSI */ + +#else + else if (val == caml_hash_variant("FSI")) caml_failwith("PangoBidiType.FSI requires 1.48.6"); +#endif +#if PANGO_VERSION_CHECK(1,48,6) else if (val == caml_hash_variant("PDI")) return PANGO_BIDI_TYPE_PDI; /* `PDI */ + +#else + else if (val == caml_hash_variant("PDI")) caml_failwith("PangoBidiType.PDI requires 1.48.6"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoBidiType tag: %ld", val); @@ -584,69 +728,258 @@ value Val_PangoScript(PangoScript val) { case PANGO_SCRIPT_LINEAR_B: return caml_hash_variant("LINEAR_B"); /* `LINEAR_B */ case PANGO_SCRIPT_TAI_LE: return caml_hash_variant("TAI_LE"); /* `TAI_LE */ case PANGO_SCRIPT_UGARITIC: return caml_hash_variant("UGARITIC"); /* `UGARITIC */ +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_NEW_TAI_LUE: return caml_hash_variant("NEW_TAI_LUE"); /* `NEW_TAI_LUE */ + +#endif +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_BUGINESE: return caml_hash_variant("BUGINESE"); /* `BUGINESE */ + +#endif +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_GLAGOLITIC: return caml_hash_variant("GLAGOLITIC"); /* `GLAGOLITIC */ + +#endif +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_TIFINAGH: return caml_hash_variant("TIFINAGH"); /* `TIFINAGH */ + +#endif +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_SYLOTI_NAGRI: return caml_hash_variant("SYLOTI_NAGRI"); /* `SYLOTI_NAGRI */ + +#endif +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_OLD_PERSIAN: return caml_hash_variant("OLD_PERSIAN"); /* `OLD_PERSIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,10,0) case PANGO_SCRIPT_KHAROSHTHI: return caml_hash_variant("KHAROSHTHI"); /* `KHAROSHTHI */ + +#endif +#if PANGO_VERSION_CHECK(1,14,0) case PANGO_SCRIPT_UNKNOWN: return caml_hash_variant("UNKNOWN"); /* `UNKNOWN */ + +#endif +#if PANGO_VERSION_CHECK(1,14,0) case PANGO_SCRIPT_BALINESE: return caml_hash_variant("BALINESE"); /* `BALINESE */ + +#endif +#if PANGO_VERSION_CHECK(1,14,0) case PANGO_SCRIPT_CUNEIFORM: return caml_hash_variant("CUNEIFORM"); /* `CUNEIFORM */ + +#endif +#if PANGO_VERSION_CHECK(1,14,0) case PANGO_SCRIPT_PHOENICIAN: return caml_hash_variant("PHOENICIAN"); /* `PHOENICIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,14,0) case PANGO_SCRIPT_PHAGS_PA: return caml_hash_variant("PHAGS_PA"); /* `PHAGS_PA */ + +#endif +#if PANGO_VERSION_CHECK(1,14,0) case PANGO_SCRIPT_NKO: return caml_hash_variant("NKO"); /* `NKO */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_KAYAH_LI: return caml_hash_variant("KAYAH_LI"); /* `KAYAH_LI */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_LEPCHA: return caml_hash_variant("LEPCHA"); /* `LEPCHA */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_REJANG: return caml_hash_variant("REJANG"); /* `REJANG */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_SUNDANESE: return caml_hash_variant("SUNDANESE"); /* `SUNDANESE */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_SAURASHTRA: return caml_hash_variant("SAURASHTRA"); /* `SAURASHTRA */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_CHAM: return caml_hash_variant("CHAM"); /* `CHAM */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_OL_CHIKI: return caml_hash_variant("OL_CHIKI"); /* `OL_CHIKI */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_VAI: return caml_hash_variant("VAI"); /* `VAI */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_CARIAN: return caml_hash_variant("CARIAN"); /* `CARIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_LYCIAN: return caml_hash_variant("LYCIAN"); /* `LYCIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,20,1) case PANGO_SCRIPT_LYDIAN: return caml_hash_variant("LYDIAN"); /* `LYDIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_BATAK: return caml_hash_variant("BATAK"); /* `BATAK */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_BRAHMI: return caml_hash_variant("BRAHMI"); /* `BRAHMI */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_MANDAIC: return caml_hash_variant("MANDAIC"); /* `MANDAIC */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_CHAKMA: return caml_hash_variant("CHAKMA"); /* `CHAKMA */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_MEROITIC_CURSIVE: return caml_hash_variant("MEROITIC_CURSIVE"); /* `MEROITIC_CURSIVE */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_MEROITIC_HIEROGLYPHS: return caml_hash_variant("MEROITIC_HIEROGLYPHS"); /* `MEROITIC_HIEROGLYPHS */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_MIAO: return caml_hash_variant("MIAO"); /* `MIAO */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_SHARADA: return caml_hash_variant("SHARADA"); /* `SHARADA */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_SORA_SOMPENG: return caml_hash_variant("SORA_SOMPENG"); /* `SORA_SOMPENG */ + +#endif +#if PANGO_VERSION_CHECK(1,32,0) case PANGO_SCRIPT_TAKRI: return caml_hash_variant("TAKRI"); /* `TAKRI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_BASSA_VAH: return caml_hash_variant("BASSA_VAH"); /* `BASSA_VAH */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_CAUCASIAN_ALBANIAN: return caml_hash_variant("CAUCASIAN_ALBANIAN"); /* `CAUCASIAN_ALBANIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_DUPLOYAN: return caml_hash_variant("DUPLOYAN"); /* `DUPLOYAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_ELBASAN: return caml_hash_variant("ELBASAN"); /* `ELBASAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_GRANTHA: return caml_hash_variant("GRANTHA"); /* `GRANTHA */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_KHOJKI: return caml_hash_variant("KHOJKI"); /* `KHOJKI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_KHUDAWADI: return caml_hash_variant("KHUDAWADI"); /* `KHUDAWADI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_LINEAR_A: return caml_hash_variant("LINEAR_A"); /* `LINEAR_A */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_MAHAJANI: return caml_hash_variant("MAHAJANI"); /* `MAHAJANI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_MANICHAEAN: return caml_hash_variant("MANICHAEAN"); /* `MANICHAEAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_MENDE_KIKAKUI: return caml_hash_variant("MENDE_KIKAKUI"); /* `MENDE_KIKAKUI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_MODI: return caml_hash_variant("MODI"); /* `MODI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_MRO: return caml_hash_variant("MRO"); /* `MRO */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_NABATAEAN: return caml_hash_variant("NABATAEAN"); /* `NABATAEAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_OLD_NORTH_ARABIAN: return caml_hash_variant("OLD_NORTH_ARABIAN"); /* `OLD_NORTH_ARABIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_OLD_PERMIC: return caml_hash_variant("OLD_PERMIC"); /* `OLD_PERMIC */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_PAHAWH_HMONG: return caml_hash_variant("PAHAWH_HMONG"); /* `PAHAWH_HMONG */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_PALMYRENE: return caml_hash_variant("PALMYRENE"); /* `PALMYRENE */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_PAU_CIN_HAU: return caml_hash_variant("PAU_CIN_HAU"); /* `PAU_CIN_HAU */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_PSALTER_PAHLAVI: return caml_hash_variant("PSALTER_PAHLAVI"); /* `PSALTER_PAHLAVI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_SIDDHAM: return caml_hash_variant("SIDDHAM"); /* `SIDDHAM */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_TIRHUTA: return caml_hash_variant("TIRHUTA"); /* `TIRHUTA */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_WARANG_CITI: return caml_hash_variant("WARANG_CITI"); /* `WARANG_CITI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_AHOM: return caml_hash_variant("AHOM"); /* `AHOM */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_ANATOLIAN_HIEROGLYPHS: return caml_hash_variant("ANATOLIAN_HIEROGLYPHS"); /* `ANATOLIAN_HIEROGLYPHS */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_HATRAN: return caml_hash_variant("HATRAN"); /* `HATRAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_MULTANI: return caml_hash_variant("MULTANI"); /* `MULTANI */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_OLD_HUNGARIAN: return caml_hash_variant("OLD_HUNGARIAN"); /* `OLD_HUNGARIAN */ + +#endif +#if PANGO_VERSION_CHECK(1,40,0) case PANGO_SCRIPT_SIGNWRITING: return caml_hash_variant("SIGNWRITING"); /* `SIGNWRITING */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoScript value: %d", (int)val); @@ -713,69 +1046,384 @@ PangoScript PangoScript_val(value val) { else if (val == caml_hash_variant("LINEAR_B")) return PANGO_SCRIPT_LINEAR_B; /* `LINEAR_B */ else if (val == caml_hash_variant("TAI_LE")) return PANGO_SCRIPT_TAI_LE; /* `TAI_LE */ else if (val == caml_hash_variant("UGARITIC")) return PANGO_SCRIPT_UGARITIC; /* `UGARITIC */ +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("NEW_TAI_LUE")) return PANGO_SCRIPT_NEW_TAI_LUE; /* `NEW_TAI_LUE */ + +#else + else if (val == caml_hash_variant("NEW_TAI_LUE")) caml_failwith("PangoScript.NEW_TAI_LUE requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("BUGINESE")) return PANGO_SCRIPT_BUGINESE; /* `BUGINESE */ + +#else + else if (val == caml_hash_variant("BUGINESE")) caml_failwith("PangoScript.BUGINESE requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("GLAGOLITIC")) return PANGO_SCRIPT_GLAGOLITIC; /* `GLAGOLITIC */ + +#else + else if (val == caml_hash_variant("GLAGOLITIC")) caml_failwith("PangoScript.GLAGOLITIC requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("TIFINAGH")) return PANGO_SCRIPT_TIFINAGH; /* `TIFINAGH */ + +#else + else if (val == caml_hash_variant("TIFINAGH")) caml_failwith("PangoScript.TIFINAGH requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("SYLOTI_NAGRI")) return PANGO_SCRIPT_SYLOTI_NAGRI; /* `SYLOTI_NAGRI */ + +#else + else if (val == caml_hash_variant("SYLOTI_NAGRI")) caml_failwith("PangoScript.SYLOTI_NAGRI requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("OLD_PERSIAN")) return PANGO_SCRIPT_OLD_PERSIAN; /* `OLD_PERSIAN */ + +#else + else if (val == caml_hash_variant("OLD_PERSIAN")) caml_failwith("PangoScript.OLD_PERSIAN requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,10,0) else if (val == caml_hash_variant("KHAROSHTHI")) return PANGO_SCRIPT_KHAROSHTHI; /* `KHAROSHTHI */ + +#else + else if (val == caml_hash_variant("KHAROSHTHI")) caml_failwith("PangoScript.KHAROSHTHI requires 1.10"); +#endif +#if PANGO_VERSION_CHECK(1,14,0) else if (val == caml_hash_variant("UNKNOWN")) return PANGO_SCRIPT_UNKNOWN; /* `UNKNOWN */ + +#else + else if (val == caml_hash_variant("UNKNOWN")) caml_failwith("PangoScript.UNKNOWN requires 1.14"); +#endif +#if PANGO_VERSION_CHECK(1,14,0) else if (val == caml_hash_variant("BALINESE")) return PANGO_SCRIPT_BALINESE; /* `BALINESE */ + +#else + else if (val == caml_hash_variant("BALINESE")) caml_failwith("PangoScript.BALINESE requires 1.14"); +#endif +#if PANGO_VERSION_CHECK(1,14,0) else if (val == caml_hash_variant("CUNEIFORM")) return PANGO_SCRIPT_CUNEIFORM; /* `CUNEIFORM */ + +#else + else if (val == caml_hash_variant("CUNEIFORM")) caml_failwith("PangoScript.CUNEIFORM requires 1.14"); +#endif +#if PANGO_VERSION_CHECK(1,14,0) else if (val == caml_hash_variant("PHOENICIAN")) return PANGO_SCRIPT_PHOENICIAN; /* `PHOENICIAN */ + +#else + else if (val == caml_hash_variant("PHOENICIAN")) caml_failwith("PangoScript.PHOENICIAN requires 1.14"); +#endif +#if PANGO_VERSION_CHECK(1,14,0) else if (val == caml_hash_variant("PHAGS_PA")) return PANGO_SCRIPT_PHAGS_PA; /* `PHAGS_PA */ + +#else + else if (val == caml_hash_variant("PHAGS_PA")) caml_failwith("PangoScript.PHAGS_PA requires 1.14"); +#endif +#if PANGO_VERSION_CHECK(1,14,0) else if (val == caml_hash_variant("NKO")) return PANGO_SCRIPT_NKO; /* `NKO */ + +#else + else if (val == caml_hash_variant("NKO")) caml_failwith("PangoScript.NKO requires 1.14"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("KAYAH_LI")) return PANGO_SCRIPT_KAYAH_LI; /* `KAYAH_LI */ + +#else + else if (val == caml_hash_variant("KAYAH_LI")) caml_failwith("PangoScript.KAYAH_LI requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("LEPCHA")) return PANGO_SCRIPT_LEPCHA; /* `LEPCHA */ + +#else + else if (val == caml_hash_variant("LEPCHA")) caml_failwith("PangoScript.LEPCHA requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("REJANG")) return PANGO_SCRIPT_REJANG; /* `REJANG */ + +#else + else if (val == caml_hash_variant("REJANG")) caml_failwith("PangoScript.REJANG requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("SUNDANESE")) return PANGO_SCRIPT_SUNDANESE; /* `SUNDANESE */ + +#else + else if (val == caml_hash_variant("SUNDANESE")) caml_failwith("PangoScript.SUNDANESE requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("SAURASHTRA")) return PANGO_SCRIPT_SAURASHTRA; /* `SAURASHTRA */ + +#else + else if (val == caml_hash_variant("SAURASHTRA")) caml_failwith("PangoScript.SAURASHTRA requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("CHAM")) return PANGO_SCRIPT_CHAM; /* `CHAM */ + +#else + else if (val == caml_hash_variant("CHAM")) caml_failwith("PangoScript.CHAM requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("OL_CHIKI")) return PANGO_SCRIPT_OL_CHIKI; /* `OL_CHIKI */ + +#else + else if (val == caml_hash_variant("OL_CHIKI")) caml_failwith("PangoScript.OL_CHIKI requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("VAI")) return PANGO_SCRIPT_VAI; /* `VAI */ + +#else + else if (val == caml_hash_variant("VAI")) caml_failwith("PangoScript.VAI requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("CARIAN")) return PANGO_SCRIPT_CARIAN; /* `CARIAN */ + +#else + else if (val == caml_hash_variant("CARIAN")) caml_failwith("PangoScript.CARIAN requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("LYCIAN")) return PANGO_SCRIPT_LYCIAN; /* `LYCIAN */ + +#else + else if (val == caml_hash_variant("LYCIAN")) caml_failwith("PangoScript.LYCIAN requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,20,1) else if (val == caml_hash_variant("LYDIAN")) return PANGO_SCRIPT_LYDIAN; /* `LYDIAN */ + +#else + else if (val == caml_hash_variant("LYDIAN")) caml_failwith("PangoScript.LYDIAN requires 1.20.1"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("BATAK")) return PANGO_SCRIPT_BATAK; /* `BATAK */ + +#else + else if (val == caml_hash_variant("BATAK")) caml_failwith("PangoScript.BATAK requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("BRAHMI")) return PANGO_SCRIPT_BRAHMI; /* `BRAHMI */ + +#else + else if (val == caml_hash_variant("BRAHMI")) caml_failwith("PangoScript.BRAHMI requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("MANDAIC")) return PANGO_SCRIPT_MANDAIC; /* `MANDAIC */ + +#else + else if (val == caml_hash_variant("MANDAIC")) caml_failwith("PangoScript.MANDAIC requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("CHAKMA")) return PANGO_SCRIPT_CHAKMA; /* `CHAKMA */ + +#else + else if (val == caml_hash_variant("CHAKMA")) caml_failwith("PangoScript.CHAKMA requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("MEROITIC_CURSIVE")) return PANGO_SCRIPT_MEROITIC_CURSIVE; /* `MEROITIC_CURSIVE */ + +#else + else if (val == caml_hash_variant("MEROITIC_CURSIVE")) caml_failwith("PangoScript.MEROITIC_CURSIVE requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("MEROITIC_HIEROGLYPHS")) return PANGO_SCRIPT_MEROITIC_HIEROGLYPHS; /* `MEROITIC_HIEROGLYPHS */ + +#else + else if (val == caml_hash_variant("MEROITIC_HIEROGLYPHS")) caml_failwith("PangoScript.MEROITIC_HIEROGLYPHS requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("MIAO")) return PANGO_SCRIPT_MIAO; /* `MIAO */ + +#else + else if (val == caml_hash_variant("MIAO")) caml_failwith("PangoScript.MIAO requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("SHARADA")) return PANGO_SCRIPT_SHARADA; /* `SHARADA */ + +#else + else if (val == caml_hash_variant("SHARADA")) caml_failwith("PangoScript.SHARADA requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("SORA_SOMPENG")) return PANGO_SCRIPT_SORA_SOMPENG; /* `SORA_SOMPENG */ + +#else + else if (val == caml_hash_variant("SORA_SOMPENG")) caml_failwith("PangoScript.SORA_SOMPENG requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,32,0) else if (val == caml_hash_variant("TAKRI")) return PANGO_SCRIPT_TAKRI; /* `TAKRI */ + +#else + else if (val == caml_hash_variant("TAKRI")) caml_failwith("PangoScript.TAKRI requires 1.32"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("BASSA_VAH")) return PANGO_SCRIPT_BASSA_VAH; /* `BASSA_VAH */ + +#else + else if (val == caml_hash_variant("BASSA_VAH")) caml_failwith("PangoScript.BASSA_VAH requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("CAUCASIAN_ALBANIAN")) return PANGO_SCRIPT_CAUCASIAN_ALBANIAN; /* `CAUCASIAN_ALBANIAN */ + +#else + else if (val == caml_hash_variant("CAUCASIAN_ALBANIAN")) caml_failwith("PangoScript.CAUCASIAN_ALBANIAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("DUPLOYAN")) return PANGO_SCRIPT_DUPLOYAN; /* `DUPLOYAN */ + +#else + else if (val == caml_hash_variant("DUPLOYAN")) caml_failwith("PangoScript.DUPLOYAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("ELBASAN")) return PANGO_SCRIPT_ELBASAN; /* `ELBASAN */ + +#else + else if (val == caml_hash_variant("ELBASAN")) caml_failwith("PangoScript.ELBASAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("GRANTHA")) return PANGO_SCRIPT_GRANTHA; /* `GRANTHA */ + +#else + else if (val == caml_hash_variant("GRANTHA")) caml_failwith("PangoScript.GRANTHA requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("KHOJKI")) return PANGO_SCRIPT_KHOJKI; /* `KHOJKI */ + +#else + else if (val == caml_hash_variant("KHOJKI")) caml_failwith("PangoScript.KHOJKI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("KHUDAWADI")) return PANGO_SCRIPT_KHUDAWADI; /* `KHUDAWADI */ + +#else + else if (val == caml_hash_variant("KHUDAWADI")) caml_failwith("PangoScript.KHUDAWADI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("LINEAR_A")) return PANGO_SCRIPT_LINEAR_A; /* `LINEAR_A */ + +#else + else if (val == caml_hash_variant("LINEAR_A")) caml_failwith("PangoScript.LINEAR_A requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("MAHAJANI")) return PANGO_SCRIPT_MAHAJANI; /* `MAHAJANI */ + +#else + else if (val == caml_hash_variant("MAHAJANI")) caml_failwith("PangoScript.MAHAJANI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("MANICHAEAN")) return PANGO_SCRIPT_MANICHAEAN; /* `MANICHAEAN */ + +#else + else if (val == caml_hash_variant("MANICHAEAN")) caml_failwith("PangoScript.MANICHAEAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("MENDE_KIKAKUI")) return PANGO_SCRIPT_MENDE_KIKAKUI; /* `MENDE_KIKAKUI */ + +#else + else if (val == caml_hash_variant("MENDE_KIKAKUI")) caml_failwith("PangoScript.MENDE_KIKAKUI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("MODI")) return PANGO_SCRIPT_MODI; /* `MODI */ + +#else + else if (val == caml_hash_variant("MODI")) caml_failwith("PangoScript.MODI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("MRO")) return PANGO_SCRIPT_MRO; /* `MRO */ + +#else + else if (val == caml_hash_variant("MRO")) caml_failwith("PangoScript.MRO requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("NABATAEAN")) return PANGO_SCRIPT_NABATAEAN; /* `NABATAEAN */ + +#else + else if (val == caml_hash_variant("NABATAEAN")) caml_failwith("PangoScript.NABATAEAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("OLD_NORTH_ARABIAN")) return PANGO_SCRIPT_OLD_NORTH_ARABIAN; /* `OLD_NORTH_ARABIAN */ + +#else + else if (val == caml_hash_variant("OLD_NORTH_ARABIAN")) caml_failwith("PangoScript.OLD_NORTH_ARABIAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("OLD_PERMIC")) return PANGO_SCRIPT_OLD_PERMIC; /* `OLD_PERMIC */ + +#else + else if (val == caml_hash_variant("OLD_PERMIC")) caml_failwith("PangoScript.OLD_PERMIC requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("PAHAWH_HMONG")) return PANGO_SCRIPT_PAHAWH_HMONG; /* `PAHAWH_HMONG */ + +#else + else if (val == caml_hash_variant("PAHAWH_HMONG")) caml_failwith("PangoScript.PAHAWH_HMONG requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("PALMYRENE")) return PANGO_SCRIPT_PALMYRENE; /* `PALMYRENE */ + +#else + else if (val == caml_hash_variant("PALMYRENE")) caml_failwith("PangoScript.PALMYRENE requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("PAU_CIN_HAU")) return PANGO_SCRIPT_PAU_CIN_HAU; /* `PAU_CIN_HAU */ + +#else + else if (val == caml_hash_variant("PAU_CIN_HAU")) caml_failwith("PangoScript.PAU_CIN_HAU requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("PSALTER_PAHLAVI")) return PANGO_SCRIPT_PSALTER_PAHLAVI; /* `PSALTER_PAHLAVI */ + +#else + else if (val == caml_hash_variant("PSALTER_PAHLAVI")) caml_failwith("PangoScript.PSALTER_PAHLAVI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("SIDDHAM")) return PANGO_SCRIPT_SIDDHAM; /* `SIDDHAM */ + +#else + else if (val == caml_hash_variant("SIDDHAM")) caml_failwith("PangoScript.SIDDHAM requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("TIRHUTA")) return PANGO_SCRIPT_TIRHUTA; /* `TIRHUTA */ + +#else + else if (val == caml_hash_variant("TIRHUTA")) caml_failwith("PangoScript.TIRHUTA requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("WARANG_CITI")) return PANGO_SCRIPT_WARANG_CITI; /* `WARANG_CITI */ + +#else + else if (val == caml_hash_variant("WARANG_CITI")) caml_failwith("PangoScript.WARANG_CITI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("AHOM")) return PANGO_SCRIPT_AHOM; /* `AHOM */ + +#else + else if (val == caml_hash_variant("AHOM")) caml_failwith("PangoScript.AHOM requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("ANATOLIAN_HIEROGLYPHS")) return PANGO_SCRIPT_ANATOLIAN_HIEROGLYPHS; /* `ANATOLIAN_HIEROGLYPHS */ + +#else + else if (val == caml_hash_variant("ANATOLIAN_HIEROGLYPHS")) caml_failwith("PangoScript.ANATOLIAN_HIEROGLYPHS requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("HATRAN")) return PANGO_SCRIPT_HATRAN; /* `HATRAN */ + +#else + else if (val == caml_hash_variant("HATRAN")) caml_failwith("PangoScript.HATRAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("MULTANI")) return PANGO_SCRIPT_MULTANI; /* `MULTANI */ + +#else + else if (val == caml_hash_variant("MULTANI")) caml_failwith("PangoScript.MULTANI requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("OLD_HUNGARIAN")) return PANGO_SCRIPT_OLD_HUNGARIAN; /* `OLD_HUNGARIAN */ + +#else + else if (val == caml_hash_variant("OLD_HUNGARIAN")) caml_failwith("PangoScript.OLD_HUNGARIAN requires 1.40"); +#endif +#if PANGO_VERSION_CHECK(1,40,0) else if (val == caml_hash_variant("SIGNWRITING")) return PANGO_SCRIPT_SIGNWRITING; /* `SIGNWRITING */ + +#else + else if (val == caml_hash_variant("SIGNWRITING")) caml_failwith("PangoScript.SIGNWRITING requires 1.40"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoScript tag: %ld", val); @@ -856,9 +1504,18 @@ PangoStyle PangoStyle_val(value val) { value Val_PangoTabAlign(PangoTabAlign val) { switch (val) { case PANGO_TAB_LEFT: return caml_hash_variant("LEFT"); /* `LEFT */ +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_TAB_RIGHT: return caml_hash_variant("RIGHT"); /* `RIGHT */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_TAB_CENTER: return caml_hash_variant("CENTER"); /* `CENTER */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_TAB_DECIMAL: return caml_hash_variant("DECIMAL"); /* `DECIMAL */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoTabAlign value: %d", (int)val); @@ -871,9 +1528,24 @@ value Val_PangoTabAlign(PangoTabAlign val) { /* Convert OCaml value to PangoTabAlign */ PangoTabAlign PangoTabAlign_val(value val) { if (val == caml_hash_variant("LEFT")) return PANGO_TAB_LEFT; /* `LEFT */ +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("RIGHT")) return PANGO_TAB_RIGHT; /* `RIGHT */ + +#else + else if (val == caml_hash_variant("RIGHT")) caml_failwith("PangoTabAlign.RIGHT requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("CENTER")) return PANGO_TAB_CENTER; /* `CENTER */ + +#else + else if (val == caml_hash_variant("CENTER")) caml_failwith("PangoTabAlign.CENTER requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("DECIMAL")) return PANGO_TAB_DECIMAL; /* `DECIMAL */ + +#else + else if (val == caml_hash_variant("DECIMAL")) caml_failwith("PangoTabAlign.DECIMAL requires 1.50"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoTabAlign tag: %ld", val); @@ -958,11 +1630,26 @@ value Val_PangoVariant(PangoVariant val) { switch (val) { case PANGO_VARIANT_NORMAL: return caml_hash_variant("NORMAL"); /* `NORMAL */ case PANGO_VARIANT_SMALL_CAPS: return caml_hash_variant("SMALL_CAPS"); /* `SMALL_CAPS */ +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_VARIANT_ALL_SMALL_CAPS: return caml_hash_variant("ALL_SMALL_CAPS"); /* `ALL_SMALL_CAPS */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_VARIANT_PETITE_CAPS: return caml_hash_variant("PETITE_CAPS"); /* `PETITE_CAPS */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_VARIANT_ALL_PETITE_CAPS: return caml_hash_variant("ALL_PETITE_CAPS"); /* `ALL_PETITE_CAPS */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_VARIANT_UNICASE: return caml_hash_variant("UNICASE"); /* `UNICASE */ + +#endif +#if PANGO_VERSION_CHECK(1,50,0) case PANGO_VARIANT_TITLE_CAPS: return caml_hash_variant("TITLE_CAPS"); /* `TITLE_CAPS */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoVariant value: %d", (int)val); @@ -976,11 +1663,36 @@ value Val_PangoVariant(PangoVariant val) { PangoVariant PangoVariant_val(value val) { if (val == caml_hash_variant("NORMAL")) return PANGO_VARIANT_NORMAL; /* `NORMAL */ else if (val == caml_hash_variant("SMALL_CAPS")) return PANGO_VARIANT_SMALL_CAPS; /* `SMALL_CAPS */ +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("ALL_SMALL_CAPS")) return PANGO_VARIANT_ALL_SMALL_CAPS; /* `ALL_SMALL_CAPS */ + +#else + else if (val == caml_hash_variant("ALL_SMALL_CAPS")) caml_failwith("PangoVariant.ALL_SMALL_CAPS requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("PETITE_CAPS")) return PANGO_VARIANT_PETITE_CAPS; /* `PETITE_CAPS */ + +#else + else if (val == caml_hash_variant("PETITE_CAPS")) caml_failwith("PangoVariant.PETITE_CAPS requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("ALL_PETITE_CAPS")) return PANGO_VARIANT_ALL_PETITE_CAPS; /* `ALL_PETITE_CAPS */ + +#else + else if (val == caml_hash_variant("ALL_PETITE_CAPS")) caml_failwith("PangoVariant.ALL_PETITE_CAPS requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("UNICASE")) return PANGO_VARIANT_UNICASE; /* `UNICASE */ + +#else + else if (val == caml_hash_variant("UNICASE")) caml_failwith("PangoVariant.UNICASE requires 1.50"); +#endif +#if PANGO_VERSION_CHECK(1,50,0) else if (val == caml_hash_variant("TITLE_CAPS")) return PANGO_VARIANT_TITLE_CAPS; /* `TITLE_CAPS */ + +#else + else if (val == caml_hash_variant("TITLE_CAPS")) caml_failwith("PangoVariant.TITLE_CAPS requires 1.50"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoVariant tag: %ld", val); @@ -992,18 +1704,33 @@ PangoVariant PangoVariant_val(value val) { /* Convert PangoWeight to OCaml value */ value Val_PangoWeight(PangoWeight val) { switch (val) { +#if PANGO_VERSION_CHECK(1,24,0) case PANGO_WEIGHT_THIN: return caml_hash_variant("THIN"); /* `THIN */ + +#endif case PANGO_WEIGHT_ULTRALIGHT: return caml_hash_variant("ULTRALIGHT"); /* `ULTRALIGHT */ case PANGO_WEIGHT_LIGHT: return caml_hash_variant("LIGHT"); /* `LIGHT */ +#if PANGO_VERSION_CHECK(1,36,7) case PANGO_WEIGHT_SEMILIGHT: return caml_hash_variant("SEMILIGHT"); /* `SEMILIGHT */ + +#endif +#if PANGO_VERSION_CHECK(1,24,0) case PANGO_WEIGHT_BOOK: return caml_hash_variant("BOOK"); /* `BOOK */ + +#endif case PANGO_WEIGHT_NORMAL: return caml_hash_variant("NORMAL"); /* `NORMAL */ +#if PANGO_VERSION_CHECK(1,24,0) case PANGO_WEIGHT_MEDIUM: return caml_hash_variant("MEDIUM"); /* `MEDIUM */ + +#endif case PANGO_WEIGHT_SEMIBOLD: return caml_hash_variant("SEMIBOLD"); /* `SEMIBOLD */ case PANGO_WEIGHT_BOLD: return caml_hash_variant("BOLD"); /* `BOLD */ case PANGO_WEIGHT_ULTRABOLD: return caml_hash_variant("ULTRABOLD"); /* `ULTRABOLD */ case PANGO_WEIGHT_HEAVY: return caml_hash_variant("HEAVY"); /* `HEAVY */ +#if PANGO_VERSION_CHECK(1,24,0) case PANGO_WEIGHT_ULTRAHEAVY: return caml_hash_variant("ULTRAHEAVY"); /* `ULTRAHEAVY */ + +#endif default: { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoWeight value: %d", (int)val); @@ -1015,18 +1742,43 @@ value Val_PangoWeight(PangoWeight val) { /* Convert OCaml value to PangoWeight */ PangoWeight PangoWeight_val(value val) { +#if PANGO_VERSION_CHECK(1,24,0) if (val == caml_hash_variant("THIN")) return PANGO_WEIGHT_THIN; /* `THIN */ + +#else + if (val == caml_hash_variant("THIN")) caml_failwith("PangoWeight.THIN requires 1.24"); +#endif else if (val == caml_hash_variant("ULTRALIGHT")) return PANGO_WEIGHT_ULTRALIGHT; /* `ULTRALIGHT */ else if (val == caml_hash_variant("LIGHT")) return PANGO_WEIGHT_LIGHT; /* `LIGHT */ +#if PANGO_VERSION_CHECK(1,36,7) else if (val == caml_hash_variant("SEMILIGHT")) return PANGO_WEIGHT_SEMILIGHT; /* `SEMILIGHT */ + +#else + else if (val == caml_hash_variant("SEMILIGHT")) caml_failwith("PangoWeight.SEMILIGHT requires 1.36.7"); +#endif +#if PANGO_VERSION_CHECK(1,24,0) else if (val == caml_hash_variant("BOOK")) return PANGO_WEIGHT_BOOK; /* `BOOK */ + +#else + else if (val == caml_hash_variant("BOOK")) caml_failwith("PangoWeight.BOOK requires 1.24"); +#endif else if (val == caml_hash_variant("NORMAL")) return PANGO_WEIGHT_NORMAL; /* `NORMAL */ +#if PANGO_VERSION_CHECK(1,24,0) else if (val == caml_hash_variant("MEDIUM")) return PANGO_WEIGHT_MEDIUM; /* `MEDIUM */ + +#else + else if (val == caml_hash_variant("MEDIUM")) caml_failwith("PangoWeight.MEDIUM requires 1.24"); +#endif else if (val == caml_hash_variant("SEMIBOLD")) return PANGO_WEIGHT_SEMIBOLD; /* `SEMIBOLD */ else if (val == caml_hash_variant("BOLD")) return PANGO_WEIGHT_BOLD; /* `BOLD */ else if (val == caml_hash_variant("ULTRABOLD")) return PANGO_WEIGHT_ULTRABOLD; /* `ULTRABOLD */ else if (val == caml_hash_variant("HEAVY")) return PANGO_WEIGHT_HEAVY; /* `HEAVY */ +#if PANGO_VERSION_CHECK(1,24,0) else if (val == caml_hash_variant("ULTRAHEAVY")) return PANGO_WEIGHT_ULTRAHEAVY; /* `ULTRAHEAVY */ + +#else + else if (val == caml_hash_variant("ULTRAHEAVY")) caml_failwith("PangoWeight.ULTRAHEAVY requires 1.24"); +#endif else { char msg[128]; g_snprintf(msg, sizeof(msg), "Unknown PangoWeight tag: %ld", val); @@ -1105,12 +1857,16 @@ value Val_PangoFontMask(PangoFontMask flags) { Store_field(cons, 1, result); result = cons; } +#if PANGO_VERSION_CHECK(1,16,0) if (flags & PANGO_FONT_MASK_GRAVITY) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("GRAVITY"))); /* `GRAVITY */ Store_field(cons, 1, result); result = cons; } + +#endif +#if PANGO_VERSION_CHECK(1,42,0) if (flags & PANGO_FONT_MASK_VARIATIONS) { cons = caml_alloc(2, 0); Store_field(cons, 0, Val_int(caml_hash_variant("VARIATIONS"))); /* `VARIATIONS */ @@ -1118,6 +1874,8 @@ value Val_PangoFontMask(PangoFontMask flags) { result = cons; } +#endif + CAMLreturn(result); } @@ -1132,8 +1890,18 @@ PangoFontMask PangoFontMask_val(value list) { else if (tag == caml_hash_variant("WEIGHT")) result |= PANGO_FONT_MASK_WEIGHT; /* `WEIGHT */ else if (tag == caml_hash_variant("STRETCH")) result |= PANGO_FONT_MASK_STRETCH; /* `STRETCH */ else if (tag == caml_hash_variant("SIZE")) result |= PANGO_FONT_MASK_SIZE; /* `SIZE */ +#if PANGO_VERSION_CHECK(1,16,0) else if (tag == caml_hash_variant("GRAVITY")) result |= PANGO_FONT_MASK_GRAVITY; /* `GRAVITY */ + +#else + else if (tag == caml_hash_variant("GRAVITY")) caml_failwith("PangoFontMask.GRAVITY requires 1.16"); +#endif +#if PANGO_VERSION_CHECK(1,42,0) else if (tag == caml_hash_variant("VARIATIONS")) result |= PANGO_FONT_MASK_VARIATIONS; /* `VARIATIONS */ + +#else + else if (tag == caml_hash_variant("VARIATIONS")) caml_failwith("PangoFontMask.VARIATIONS requires 1.42"); +#endif list = Field(list, 1); } return result; diff --git a/ocgtk/src/pango/generated/pango_enums.mli b/ocgtk/src/pango/generated/pango_enums.mli index 571d4396a..2ff80cc89 100644 --- a/ocgtk/src/pango/generated/pango_enums.mli +++ b/ocgtk/src/pango/generated/pango_enums.mli @@ -3,373 +3,705 @@ (* Alignment - enumeration *) type alignment = [ + (** Put all available space on the right *) | `LEFT + (** Center the line within the available space *) | `CENTER + (** Put all available space on the left *) | `RIGHT ] (* AttrType - enumeration *) type attrtype = [ + (** does not happen *) | `INVALID + (** language ([struct@Pango.AttrLanguage]) *) | `LANGUAGE + (** font family name list ([struct@Pango.AttrString]) *) | `FAMILY + (** font slant style ([struct@Pango.AttrInt]) *) | `STYLE + (** font weight ([struct@Pango.AttrInt]) *) | `WEIGHT + (** font variant (normal or small caps) ([struct@Pango.AttrInt]) *) | `VARIANT + (** font stretch ([struct@Pango.AttrInt]) *) | `STRETCH + (** font size in points scaled by %PANGO_SCALE ([struct@Pango.AttrInt]) *) | `SIZE + (** font description ([struct@Pango.AttrFontDesc]) *) | `FONT_DESC + (** foreground color ([struct@Pango.AttrColor]) *) | `FOREGROUND + (** background color ([struct@Pango.AttrColor]) *) | `BACKGROUND + (** whether the text has an underline ([struct@Pango.AttrInt]) *) | `UNDERLINE + (** whether the text is struck-through ([struct@Pango.AttrInt]) *) | `STRIKETHROUGH + (** baseline displacement ([struct@Pango.AttrInt]) *) | `RISE + (** shape ([struct@Pango.AttrShape]) *) | `SHAPE + (** font size scale factor ([struct@Pango.AttrFloat]) *) | `SCALE + (** whether fallback is enabled ([struct@Pango.AttrInt]) *) | `FALLBACK + (** letter spacing ([struct@PangoAttrInt]) *) | `LETTER_SPACING + (** underline color ([struct@Pango.AttrColor]) *) | `UNDERLINE_COLOR + (** strikethrough color ([struct@Pango.AttrColor]) *) | `STRIKETHROUGH_COLOR + (** font size in pixels scaled by %PANGO_SCALE ([struct@Pango.AttrInt]) *) | `ABSOLUTE_SIZE + (** base text gravity ([struct@Pango.AttrInt]) *) | `GRAVITY + (** gravity hint ([struct@Pango.AttrInt]) *) | `GRAVITY_HINT + (** OpenType font features ([struct@Pango.AttrFontFeatures]). Since 1.38 *) | `FONT_FEATURES + (** foreground alpha ([struct@Pango.AttrInt]). Since 1.38 *) | `FOREGROUND_ALPHA + (** background alpha ([struct@Pango.AttrInt]). Since 1.38 *) | `BACKGROUND_ALPHA + (** whether breaks are allowed ([struct@Pango.AttrInt]). Since 1.44 *) | `ALLOW_BREAKS + (** how to render invisible characters ([struct@Pango.AttrInt]). Since 1.44 *) | `SHOW + (** whether to insert hyphens at intra-word line breaks ([struct@Pango.AttrInt]). Since 1.44 *) | `INSERT_HYPHENS + (** whether the text has an overline ([struct@Pango.AttrInt]). Since 1.46 *) | `OVERLINE + (** overline color ([struct@Pango.AttrColor]). Since 1.46 *) | `OVERLINE_COLOR + (** line height factor ([struct@Pango.AttrFloat]). Since: 1.50 *) | `LINE_HEIGHT + (** line height ([struct@Pango.AttrInt]). Since: 1.50 *) | `ABSOLUTE_LINE_HEIGHT | `TEXT_TRANSFORM + (** override segmentation to classify the range of the attribute as a single word ([struct@Pango.AttrInt]). Since 1.50 *) | `WORD + (** override segmentation to classify the range of the attribute as a single sentence ([struct@Pango.AttrInt]). Since 1.50 *) | `SENTENCE + (** baseline displacement ([struct@Pango.AttrInt]). Since 1.50 *) | `BASELINE_SHIFT + (** font-relative size change ([struct@Pango.AttrInt]). Since 1.50 *) | `FONT_SCALE ] (* BaselineShift - enumeration *) type baselineshift = [ + (** Leave the baseline unchanged *) | `NONE + (** Shift the baseline to the superscript position, + relative to the previous run *) | `SUPERSCRIPT + (** Shift the baseline to the subscript position, + relative to the previous run *) | `SUBSCRIPT ] (* BidiType - enumeration *) type biditype = [ + (** Left-to-Right *) | `L + (** Left-to-Right Embedding *) | `LRE + (** Left-to-Right Override *) | `LRO + (** Right-to-Left *) | `R + (** Right-to-Left Arabic *) | `AL + (** Right-to-Left Embedding *) | `RLE + (** Right-to-Left Override *) | `RLO + (** Pop Directional Format *) | `PDF + (** European Number *) | `EN + (** European Number Separator *) | `ES + (** European Number Terminator *) | `ET + (** Arabic Number *) | `AN + (** Common Number Separator *) | `CS + (** Nonspacing Mark *) | `NSM + (** Boundary Neutral *) | `BN + (** Paragraph Separator *) | `B + (** Segment Separator *) | `S + (** Whitespace *) | `WS + (** Other Neutrals *) | `ON + (** Left-to-Right isolate. Since 1.48.6 *) | `LRI + (** Right-to-Left isolate. Since 1.48.6 *) | `RLI + (** First strong isolate. Since 1.48.6 *) | `FSI + (** Pop directional isolate. Since 1.48.6 *) | `PDI ] (* CoverageLevel - enumeration *) type coveragelevel = [ + (** The character is not representable with + the font. *) | `NONE + (** The character is represented in a + way that may be comprehensible but is not the correct + graphical form. For instance, a Hangul character represented + as a a sequence of Jamos, or a Latin transliteration of a + Cyrillic word. *) | `FALLBACK + (** The character is represented as + basically the correct graphical form, but with a stylistic + variant inappropriate for the current script. *) | `APPROXIMATE + (** The character is represented as the + correct graphical form. *) | `EXACT ] (* Direction - enumeration *) type direction = [ + (** A strong left-to-right direction *) | `LTR + (** A strong right-to-left direction *) | `RTL + (** Deprecated value; treated the + same as `PANGO_DIRECTION_RTL`. *) | `TTB_LTR + (** Deprecated value; treated the + same as `PANGO_DIRECTION_LTR` *) | `TTB_RTL + (** A weak left-to-right direction *) | `WEAK_LTR + (** A weak right-to-left direction *) | `WEAK_RTL + (** No direction specified *) | `NEUTRAL ] (* EllipsizeMode - enumeration *) type ellipsizemode = [ + (** No ellipsization *) | `NONE + (** Omit characters at the start of the text *) | `START + (** Omit characters in the middle of the text *) | `MIDDLE + (** Omit characters at the end of the text *) | `END ] (* FontScale - enumeration *) type fontscale = [ + (** Leave the font size unchanged *) | `NONE + (** Change the font to a size suitable for superscripts *) | `SUPERSCRIPT + (** Change the font to a size suitable for subscripts *) | `SUBSCRIPT + (** Change the font to a size suitable for Small Caps *) | `SMALL_CAPS ] (* Gravity - enumeration *) type gravity = [ + (** Glyphs stand upright (default) *) | `SOUTH + (** Glyphs are rotated 90 degrees counter-clockwise. *) | `EAST + (** Glyphs are upside-down. *) | `NORTH + (** Glyphs are rotated 90 degrees clockwise. *) | `WEST + (** Gravity is resolved from the context matrix *) | `AUTO ] (* GravityHint - enumeration *) type gravityhint = [ + (** scripts will take their natural gravity based + on the base gravity and the script. This is the default. *) | `NATURAL + (** always use the base gravity set, regardless of + the script. *) | `STRONG + (** for scripts not in their natural direction (eg. + Latin in East gravity), choose per-script gravity such that every script + respects the line progression. This means, Latin and Arabic will take + opposite gravities and both flow top-to-bottom for example. *) | `LINE ] (* LayoutDeserializeError - enumeration *) type layoutdeserializeerror = [ + (** Unspecified error *) | `INVALID + (** A JSon value could not be + interpreted *) | `INVALID_VALUE + (** A required JSon member was + not found *) | `MISSING_VALUE ] (* Overline - enumeration *) type overline = [ + (** no overline should be drawn *) | `NONE + (** Draw a single line above the ink + extents of the text being underlined. *) | `SINGLE ] (* RenderPart - enumeration *) type renderpart = [ + (** the text itself *) | `FOREGROUND + (** the area behind the text *) | `BACKGROUND + (** underlines *) | `UNDERLINE + (** strikethrough lines *) | `STRIKETHROUGH + (** overlines *) | `OVERLINE ] (* Script - enumeration *) type script = [ + (** a value never returned from pango_script_for_unichar() *) | `INVALID_CODE + (** a character used by multiple different scripts *) | `COMMON + (** a mark glyph that takes its script from the +base glyph to which it is attached *) | `INHERITED + (** Arabic *) | `ARABIC + (** Armenian *) | `ARMENIAN + (** Bengali *) | `BENGALI + (** Bopomofo *) | `BOPOMOFO + (** Cherokee *) | `CHEROKEE + (** Coptic *) | `COPTIC + (** Cyrillic *) | `CYRILLIC + (** Deseret *) | `DESERET + (** Devanagari *) | `DEVANAGARI + (** Ethiopic *) | `ETHIOPIC + (** Georgian *) | `GEORGIAN + (** Gothic *) | `GOTHIC + (** Greek *) | `GREEK + (** Gujarati *) | `GUJARATI + (** Gurmukhi *) | `GURMUKHI + (** Han *) | `HAN + (** Hangul *) | `HANGUL + (** Hebrew *) | `HEBREW + (** Hiragana *) | `HIRAGANA + (** Kannada *) | `KANNADA + (** Katakana *) | `KATAKANA + (** Khmer *) | `KHMER + (** Lao *) | `LAO + (** Latin *) | `LATIN + (** Malayalam *) | `MALAYALAM + (** Mongolian *) | `MONGOLIAN + (** Myanmar *) | `MYANMAR + (** Ogham *) | `OGHAM + (** Old Italic *) | `OLD_ITALIC + (** Oriya *) | `ORIYA + (** Runic *) | `RUNIC + (** Sinhala *) | `SINHALA + (** Syriac *) | `SYRIAC + (** Tamil *) | `TAMIL + (** Telugu *) | `TELUGU + (** Thaana *) | `THAANA + (** Thai *) | `THAI + (** Tibetan *) | `TIBETAN + (** Canadian Aboriginal *) | `CANADIAN_ABORIGINAL + (** Yi *) | `YI + (** Tagalog *) | `TAGALOG + (** Hanunoo *) | `HANUNOO + (** Buhid *) | `BUHID + (** Tagbanwa *) | `TAGBANWA + (** Braille *) | `BRAILLE + (** Cypriot *) | `CYPRIOT + (** Limbu *) | `LIMBU + (** Osmanya *) | `OSMANYA + (** Shavian *) | `SHAVIAN + (** Linear B *) | `LINEAR_B + (** Tai Le *) | `TAI_LE + (** Ugaritic *) | `UGARITIC + (** New Tai Lue. Since 1.10 *) | `NEW_TAI_LUE + (** Buginese. Since 1.10 *) | `BUGINESE + (** Glagolitic. Since 1.10 *) | `GLAGOLITIC + (** Tifinagh. Since 1.10 *) | `TIFINAGH + (** Syloti Nagri. Since 1.10 *) | `SYLOTI_NAGRI + (** Old Persian. Since 1.10 *) | `OLD_PERSIAN + (** Kharoshthi. Since 1.10 *) | `KHAROSHTHI + (** an unassigned code point. Since 1.14 *) | `UNKNOWN + (** Balinese. Since 1.14 *) | `BALINESE + (** Cuneiform. Since 1.14 *) | `CUNEIFORM + (** Phoenician. Since 1.14 *) | `PHOENICIAN + (** Phags-pa. Since 1.14 *) | `PHAGS_PA + (** N'Ko. Since 1.14 *) | `NKO + (** Kayah Li. Since 1.20.1 *) | `KAYAH_LI + (** Lepcha. Since 1.20.1 *) | `LEPCHA + (** Rejang. Since 1.20.1 *) | `REJANG + (** Sundanese. Since 1.20.1 *) | `SUNDANESE + (** Saurashtra. Since 1.20.1 *) | `SAURASHTRA + (** Cham. Since 1.20.1 *) | `CHAM + (** Ol Chiki. Since 1.20.1 *) | `OL_CHIKI + (** Vai. Since 1.20.1 *) | `VAI + (** Carian. Since 1.20.1 *) | `CARIAN + (** Lycian. Since 1.20.1 *) | `LYCIAN + (** Lydian. Since 1.20.1 *) | `LYDIAN + (** Batak. Since 1.32 *) | `BATAK + (** Brahmi. Since 1.32 *) | `BRAHMI + (** Mandaic. Since 1.32 *) | `MANDAIC + (** Chakma. Since: 1.32 *) | `CHAKMA + (** Meroitic Cursive. Since: 1.32 *) | `MEROITIC_CURSIVE + (** Meroitic Hieroglyphs. Since: 1.32 *) | `MEROITIC_HIEROGLYPHS + (** Miao. Since: 1.32 *) | `MIAO + (** Sharada. Since: 1.32 *) | `SHARADA + (** Sora Sompeng. Since: 1.32 *) | `SORA_SOMPENG + (** Takri. Since: 1.32 *) | `TAKRI + (** Bassa. Since: 1.40 *) | `BASSA_VAH + (** Caucasian Albanian. Since: 1.40 *) | `CAUCASIAN_ALBANIAN + (** Duployan. Since: 1.40 *) | `DUPLOYAN + (** Elbasan. Since: 1.40 *) | `ELBASAN + (** Grantha. Since: 1.40 *) | `GRANTHA + (** Kjohki. Since: 1.40 *) | `KHOJKI + (** Khudawadi, Sindhi. Since: 1.40 *) | `KHUDAWADI + (** Linear A. Since: 1.40 *) | `LINEAR_A + (** Mahajani. Since: 1.40 *) | `MAHAJANI + (** Manichaean. Since: 1.40 *) | `MANICHAEAN + (** Mende Kikakui. Since: 1.40 *) | `MENDE_KIKAKUI + (** Modi. Since: 1.40 *) | `MODI + (** Mro. Since: 1.40 *) | `MRO + (** Nabataean. Since: 1.40 *) | `NABATAEAN + (** Old North Arabian. Since: 1.40 *) | `OLD_NORTH_ARABIAN + (** Old Permic. Since: 1.40 *) | `OLD_PERMIC + (** Pahawh Hmong. Since: 1.40 *) | `PAHAWH_HMONG + (** Palmyrene. Since: 1.40 *) | `PALMYRENE + (** Pau Cin Hau. Since: 1.40 *) | `PAU_CIN_HAU + (** Psalter Pahlavi. Since: 1.40 *) | `PSALTER_PAHLAVI + (** Siddham. Since: 1.40 *) | `SIDDHAM + (** Tirhuta. Since: 1.40 *) | `TIRHUTA + (** Warang Citi. Since: 1.40 *) | `WARANG_CITI + (** Ahom. Since: 1.40 *) | `AHOM + (** Anatolian Hieroglyphs. Since: 1.40 *) | `ANATOLIAN_HIEROGLYPHS + (** Hatran. Since: 1.40 *) | `HATRAN + (** Multani. Since: 1.40 *) | `MULTANI + (** Old Hungarian. Since: 1.40 *) | `OLD_HUNGARIAN + (** Signwriting. Since: 1.40 *) | `SIGNWRITING ] (* Stretch - enumeration *) type stretch = [ + (** ultra condensed width *) | `ULTRA_CONDENSED + (** extra condensed width *) | `EXTRA_CONDENSED + (** condensed width *) | `CONDENSED + (** semi condensed width *) | `SEMI_CONDENSED + (** the normal width *) | `NORMAL + (** semi expanded width *) | `SEMI_EXPANDED + (** expanded width *) | `EXPANDED + (** extra expanded width *) | `EXTRA_EXPANDED + (** ultra expanded width *) | `ULTRA_EXPANDED ] (* Style - enumeration *) type style = [ + (** the font is upright. *) | `NORMAL + (** the font is slanted, but in a roman style. *) | `OBLIQUE + (** the font is slanted in an italic style. *) | `ITALIC ] (* TabAlign - enumeration *) type tabalign = [ + (** the text appears to the right of the tab stop position *) | `LEFT + (** the text appears to the left of the tab stop position + until the available space is filled. Since: 1.50 *) | `RIGHT + (** the text is centered at the tab stop position + until the available space is filled. Since: 1.50 *) | `CENTER + (** text before the first occurrence of the decimal point + character appears to the left of the tab stop position (until the available + space is filled), the rest to the right. Since: 1.50 *) | `DECIMAL ] (* TextTransform - enumeration *) type texttransform = [ + (** Leave text unchanged *) | `NONE + (** Display letters and numbers as lowercase *) | `LOWERCASE + (** Display letters and numbers as uppercase *) | `UPPERCASE + (** Display the first character of a word + in titlecase *) | `CAPITALIZE ] (* Underline - enumeration *) type underline = [ + (** no underline should be drawn *) | `NONE + (** a single underline should be drawn *) | `SINGLE + (** a double underline should be drawn *) | `DOUBLE + (** a single underline should be drawn at a + position beneath the ink extents of the text being + underlined. This should be used only for underlining + single characters, such as for keyboard accelerators. + %PANGO_UNDERLINE_SINGLE should be used for extended + portions of text. *) | `LOW + (** an underline indicating an error should + be drawn below. The exact style of rendering is up to the + `PangoRenderer` in use, but typical styles include wavy + or dotted lines. + This underline is typically used to indicate an error such + as a possible mispelling; in some cases a contrasting color + may automatically be used. This type of underlining is + available since Pango 1.4. *) | `ERROR + (** Like @PANGO_UNDERLINE_SINGLE, but + drawn continuously across multiple runs. This type + of underlining is available since Pango 1.46. *) | `SINGLE_LINE + (** Like @PANGO_UNDERLINE_DOUBLE, but + drawn continuously across multiple runs. This type + of underlining is available since Pango 1.46. *) | `DOUBLE_LINE + (** Like @PANGO_UNDERLINE_ERROR, but + drawn continuously across multiple runs. This type + of underlining is available since Pango 1.46. *) | `ERROR_LINE ] (* Variant - enumeration *) type variant = [ + (** A normal font. *) | `NORMAL + (** A font with the lower case characters + replaced by smaller variants of the capital characters. *) | `SMALL_CAPS + (** A font with all characters + replaced by smaller variants of the capital characters. Since: 1.50 *) | `ALL_SMALL_CAPS + (** A font with the lower case characters + replaced by smaller variants of the capital characters. + Petite Caps can be even smaller than Small Caps. Since: 1.50 *) | `PETITE_CAPS + (** A font with all characters + replaced by smaller variants of the capital characters. + Petite Caps can be even smaller than Small Caps. Since: 1.50 *) | `ALL_PETITE_CAPS + (** A font with the upper case characters + replaced by smaller variants of the capital letters. Since: 1.50 *) | `UNICASE + (** A font with capital letters that + are more suitable for all-uppercase titles. Since: 1.50 *) | `TITLE_CAPS ] (* Weight - enumeration *) type weight = [ + (** the thin weight (= 100) Since: 1.24 *) | `THIN + (** the ultralight weight (= 200) *) | `ULTRALIGHT + (** the light weight (= 300) *) | `LIGHT + (** the semilight weight (= 350) Since: 1.36.7 *) | `SEMILIGHT + (** the book weight (= 380) Since: 1.24) *) | `BOOK + (** the default weight (= 400) *) | `NORMAL + (** the medium weight (= 500) Since: 1.24 *) | `MEDIUM + (** the semibold weight (= 600) *) | `SEMIBOLD + (** the bold weight (= 700) *) | `BOLD + (** the ultrabold weight (= 800) *) | `ULTRABOLD + (** the heavy weight (= 900) *) | `HEAVY + (** the ultraheavy weight (= 1000) Since: 1.24 *) | `ULTRAHEAVY ] (* WrapMode - enumeration *) type wrapmode = [ + (** wrap lines at word boundaries. *) | `WORD + (** wrap lines at character boundaries. *) | `CHAR + (** wrap lines at word boundaries, but fall back to + character boundaries if there is not enough space for a full word. *) | `WORD_CHAR ] (* FontMask - bitfield/flags *) type fontmask_flag = [ + (** the font family is specified. *) | `FAMILY + (** the font style is specified. *) | `STYLE + (** the font variant is specified. *) | `VARIANT + (** the font weight is specified. *) | `WEIGHT + (** the font stretch is specified. *) | `STRETCH + (** the font size is specified. *) | `SIZE + (** the font gravity is specified (Since: 1.16.) *) | `GRAVITY + (** OpenType font variations are specified (Since: 1.42) *) | `VARIATIONS ] @@ -377,7 +709,10 @@ type fontmask = fontmask_flag list (* LayoutDeserializeFlags - bitfield/flags *) type layoutdeserializeflags_flag = [ + (** Default behavior *) | `DEFAULT + (** Apply context information + from the serialization to the `PangoContext` *) | `CONTEXT ] @@ -385,8 +720,11 @@ type layoutdeserializeflags = layoutdeserializeflags_flag list (* LayoutSerializeFlags - bitfield/flags *) type layoutserializeflags_flag = [ + (** Default behavior *) | `DEFAULT + (** Include context information *) | `CONTEXT + (** Include information about the formatted output *) | `OUTPUT ] @@ -394,7 +732,10 @@ type layoutserializeflags = layoutserializeflags_flag list (* ShapeFlags - bitfield/flags *) type shapeflags_flag = [ + (** Default value *) | `NONE + (** Round glyph positions and widths to whole device units + This option should be set if the target renderer can't do subpixel positioning of glyphs *) | `ROUND_POSITIONS ] @@ -402,9 +743,14 @@ type shapeflags = shapeflags_flag list (* ShowFlags - bitfield/flags *) type showflags_flag = [ + (** No special treatment for invisible characters *) | `NONE + (** Render spaces, tabs and newlines visibly *) | `SPACES + (** Render line breaks visibly *) | `LINE_BREAKS + (** Render default-ignorable Unicode + characters visibly *) | `IGNORABLES ] diff --git a/ocgtk/src/tools/README_GIR_GEN.md b/ocgtk/src/tools/README_GIR_GEN.md index 2dec9b9da..348fd6f40 100644 --- a/ocgtk/src/tools/README_GIR_GEN.md +++ b/ocgtk/src/tools/README_GIR_GEN.md @@ -63,10 +63,11 @@ The executable is built to `_build/default/src/tools/gir_gen/gir_gen.exe` ### Commands -gir_gen has two main commands: +gir_gen has three commands: - **`generate`** - Generate C FFI bindings and OCaml modules from GIR files - **`references`** - Generate cross-namespace reference list for type validation +- **`overrides`** - Extract `Since` version annotations from a GIR file into an override sexp file ### From the `ocgtk` directory @@ -88,10 +89,27 @@ dune exec src/tools/gir_gen/gir_gen.exe -- generate /usr/share/gir-1.0/Gtk-4.0.g ### Generate Command Options -- `GIR_FILE`: Path to GTK GIR file (usually `/usr/share/gir-1.0/Gtk-4.0.gir`) +- `GIR_FILE`: Path to GIR file (e.g. `/usr/share/gir-1.0/Gtk-4.0.gir`) - `OUTPUT_DIR`: Where to write generated files - `-f, --filter FILE`: Optional filter file specifying which classes to generate - `-r, --reference FILE`: Optional reference file(s) for cross-namespace type validation (can be specified multiple times) +- `-o, --overrides FILE`: Optional override sexp file controlling which entities are ignored and their version guards (see [Override System](#override-system)) + +### References Command Options + +- `GIR_FILE`: Path to GIR file +- `OUTPUT_FILE`: Where to write the reference sexp +- `-o, --overrides FILE`: Optional override sexp file; ignored entities are excluded from the reference output + +### Overrides Command + +Extracts `Since` version annotations from GIR documentation into a starter override file. The output should be committed to `overrides/.sexp` and then augmented with manually-authored `(ignore)` entries. + +```bash +# Extract version annotations for GTK into the overrides directory +dune exec src/tools/gir_gen/gir_gen.exe -- overrides \ + /usr/share/gir-1.0/Gtk-4.0.gir overrides/gtk.sexp +``` ### ⚠️ IMPORTANT: Output Directory Convention @@ -157,6 +175,16 @@ dune exec src/tools/gir_gen/gir_gen.exe -- generate \ /usr/share/gir-1.0/Gtk-4.0.gir src/gtk ``` +### Generate with Override File + +```bash +# Apply overrides while generating +dune exec src/tools/gir_gen/gir_gen.exe -- generate \ + -o overrides/gtk.sexp \ + -r gdk_refs.txt \ + /usr/share/gir-1.0/Gtk-4.0.gir src/gtk +``` + ## Output Files Generated files are written to `src//generated/` (e.g., `src/gtk/generated/`): @@ -170,6 +198,76 @@ Generated files are written to `src//generated/` (e.g., `src/gtk/generated/` - **Declaration header**: `_decls.h` - C type converter declarations, includes dependency headers - **Combined cyclic modules**: `_and___and__.ml/.mli` - Single module combining mutually-recursive classes (see dependency resolution below) +## Override System + +Override files (`overrides/.sexp`) allow per-library customisation of what gets +generated without modifying the generator source. They replace the former hardcoded +exclusion lists in `exclude_list.ml`, `filtering.ml`, and `library_module.ml`. + +Override files live in `ocgtk/overrides/` and are committed to the repository. One file +exists per namespace (e.g. `overrides/gtk.sexp`, `overrides/gio.sexp`). + +### Format + +```sexp +(overrides + (library "Gtk") + + ;; Ignore an entire class (no bindings generated) + (class PrintJob (ignore)) + + ;; Ignore a single method on a class + (class TextBuffer + (method insert_with_tags (ignore)) + ) + + ;; Ignore a property + (class IconPaintable + (property is-symbolic (ignore)) + ) + + ;; Set a version guard on an enum member (emits #if GTK_CHECK_VERSION(...)) + (enumeration FileChooserAction + (save (version "4.10")) + ) + + ;; Ignore a bitfield or record + (bitfield PrintCapabilities (ignore)) + (record PrintBackend (ignore)) +) +``` + +Supported entity kinds: `class`, `interface`, `enumeration`, `bitfield`, `record`. +Supported sub-component directives: `method`, `constructor`, `property`, `signal`, +`member` (enum member), `flag` (bitfield flag). + +Available actions: +- `(ignore)` — skip generation of this entity or sub-component entirely +- `(version "X.Y")` — emit a `#if NS_CHECK_VERSION(X, Y, 0)` guard around the C code + +### Workflow: updating override files + +Override files are generated once with `gir_gen overrides` and then hand-edited. When +the GIR file changes (e.g. a GTK upgrade), re-run `gir_gen overrides` and merge the +diff to pick up new `Since` annotations. + +The recommended workflow is to use `generate-bindings.sh` (from the repository root), +which handles all 9 namespaces end-to-end: + +```bash +bash scripts/generate-bindings.sh +``` + +To regenerate just the version-annotation portion for one namespace: + +```bash +cd ocgtk +dune exec src/tools/gir_gen/gir_gen.exe -- overrides \ + /usr/share/gir-1.0/Gtk-4.0.gir overrides/gtk.sexp +``` + +Then review the diff, keep any manual `(ignore)` entries you added, and commit. + ## Constructor Wrapper Generation Each G* module (Layer 2 high-level wrapper) generated by `class_gen.ml` exports diff --git a/ocgtk/src/tools/gir_gen/exclude_list.ml b/ocgtk/src/tools/gir_gen/exclude_list.ml index 6ae987689..99ebfc9d2 100644 --- a/ocgtk/src/tools/gir_gen/exclude_list.ml +++ b/ocgtk/src/tools/gir_gen/exclude_list.ml @@ -6,65 +6,6 @@ open Types module Log = (val Logs.src_log (Logs.Src.create "gir_gen.exclude_list" ~doc:"Exclusion lists and filtering logic for GIR Code Generator")) -let variadic_function_exclude_list = - [ - "gtk_text_buffer_insert_with_tags"; - "gtk_text_buffer_insert_with_tags_by_name"; - "gtk_text_buffer_create_tag"; - ] - -let is_variadic_function c_identifier = - List.mem c_identifier ~set:variadic_function_exclude_list - -let platform_specific_type_exclude_list = - [ - "PrintCapabilities"; - "PageSetup"; - "PageSetupUnixDialog"; - "PrintSettings"; - "PrintContext"; - "PrintOperation"; - "PrintOperationPreview"; - "PrintUnixDialog"; - "License"; - ] - -let is_platform_specific_type type_name = - List.mem type_name ~set:platform_specific_type_exclude_list - -(* Normalized type names (namespace and Gtk prefix stripped) that should be skipped wherever they appear *) -let type_name_exclude_list = - List.map ~f:String.lowercase_ascii platform_specific_type_exclude_list - -let is_excluded_type_name name = - let normalized = Utils.normalize_class_name name |> String.lowercase_ascii in - List.mem normalized ~set:type_name_exclude_list - -(* Specific functions that should not be generated *) -let function_exclude_list = [ "gtk_tree_model_filter_get_virtual_root" ] -let is_excluded_function name = List.mem name ~set:function_exclude_list - -let should_skip_class class_name = - (* Removed skip list to allow wholesale regeneration of all classes *) - let skip_list = - [ - (* Print-related classes are platform-specific *) - "PrintJob"; - "PrintUnixDialog"; - "PageSetupUnixDialog"; - "Printer"; - (* Internal/platform-specific classes not in public headers *) - "PixbufNonAnim"; - "BroadwayRenderer"; - "NglRenderer"; - (* GSettingsBackend requires #define G_SETTINGS_ENABLE_BACKEND before - including gsettingsbackend.h, and is only useful for implementing - custom settings backends (which requires GObject subclassing support - we don't have). Skip the entire class. *) - "SettingsBackend"; - ] - in - List.mem class_name ~set:skip_list let should_skip_method ~find_type_mapping ~enums:_ ~bitfields:_ (meth : Types.gir_method) = diff --git a/ocgtk/src/tools/gir_gen/generate/enum_code.ml b/ocgtk/src/tools/gir_gen/generate/enum_code.ml index 78af25013..7a99af1d4 100644 --- a/ocgtk/src/tools/gir_gen/generate/enum_code.ml +++ b/ocgtk/src/tools/gir_gen/generate/enum_code.ml @@ -4,6 +4,30 @@ open StdLabels open Printf open Types +(** Emit a single converter branch, optionally wrapped in a per-member version guard. + [~class_version]: the enum/bitfield entity-level version (outer guard, if any) + [~member_version]: this specific member's version override + [~fallback_line]: if [Some s], emit [#else s] between guard and [#endif]; + if [None], emit only [#if branch #endif] (C->OCaml direction, + where the [default:] case handles unknown values) + [~branch]: the C source line(s) to guard (no trailing newline required) *) +let emit_member_branch ~namespace ~class_version ~member_version ~fallback_line ~branch buf = + match Version_guard.resolve_guard ~class_version ~member_version with + | Error _ | Ok (Version_guard.No_guard | Version_guard.Class_guard _) -> + Buffer.add_string buf branch + | Ok (Version_guard.Member_guard v) -> + match Version_guard.emit_c_guard namespace v ~is_opening:true with + | Error _ -> Buffer.add_string buf branch + | Ok guard_if -> + bprintf buf "%s\n%s\n" guard_if branch; + (match fallback_line with + | None -> () + | Some fb -> + bprintf buf "%s\n%s\n" Version_guard.c_guard_else fb); + (match Version_guard.emit_c_guard namespace v ~is_opening:false with + | Ok guard_endif -> Buffer.add_string buf (guard_endif ^ "\n") + | Error _ -> Buffer.add_string buf "#endif\n") + (* Generate OCaml enum type definition *) let generate_ocaml_enum enum = let buf = Buffer.create 512 in @@ -74,7 +98,7 @@ let generate_ocaml_bitfield bitfield = Buffer.contents buf (* Generate C conversion functions for enum *) -let generate_c_enum_converters ~namespace enum = +let generate_c_enum_converters ~namespace ~class_version enum = (* Skip enums with no members *) if List.length enum.members = 0 then "" else begin @@ -99,8 +123,11 @@ let generate_c_enum_converters ~namespace enum = else variant_name in - bprintf buf " case %s: return caml_hash_variant(\"%s\"); /* `%s */\n" - enum_member.c_identifier variant_name variant_name; + let case_line = sprintf " case %s: return caml_hash_variant(\"%s\"); /* `%s */\n" + enum_member.c_identifier variant_name variant_name in + emit_member_branch ~namespace ~class_version + ~member_version:enum_member.member_version + ~fallback_line:None ~branch:case_line buf end ) enum.members; @@ -126,8 +153,20 @@ let generate_c_enum_converters ~namespace enum = else variant_name in - bprintf buf " %sif (val == caml_hash_variant(\"%s\")) return %s; /* `%s */\n" - (if i = 0 then "" else "else ") variant_name enum_member.c_identifier variant_name; + let fallback_line = + match enum_member.member_version with + | None -> None + | Some v_str -> + let msg = sprintf " %sif (val == caml_hash_variant(\"%s\")) caml_failwith(\"%s.%s requires %s\");" + (if i = 0 then "" else "else ") + variant_name enum.enum_c_type variant_name v_str in + Some msg + in + let branch_line = sprintf " %sif (val == caml_hash_variant(\"%s\")) return %s; /* `%s */\n" + (if i = 0 then "" else "else ") variant_name enum_member.c_identifier variant_name in + emit_member_branch ~namespace ~class_version + ~member_version:enum_member.member_version + ~fallback_line ~branch:branch_line buf ) enum.members; bprintf buf " else {\n"; @@ -142,7 +181,7 @@ let generate_c_enum_converters ~namespace enum = end (* Generate C conversion functions for bitfield *) -let generate_c_bitfield_converters ~namespace bitfield = +let generate_c_bitfield_converters ~namespace ~class_version bitfield = (* Skip bitfields with no flags *) if List.length bitfield.flags = 0 then "" else begin @@ -179,12 +218,11 @@ let generate_c_bitfield_converters ~namespace bitfield = else variant_name in - bprintf buf " if (flags & %s) {\n" flag.flag_c_identifier; - bprintf buf " cons = caml_alloc(2, 0);\n"; - bprintf buf " Store_field(cons, 0, Val_int(caml_hash_variant(\"%s\"))); /* `%s */\n" variant_name variant_name; - bprintf buf " Store_field(cons, 1, result);\n"; - bprintf buf " result = cons;\n"; - bprintf buf " }\n"; + let branch = sprintf " if (flags & %s) {\n cons = caml_alloc(2, 0);\n Store_field(cons, 0, Val_int(caml_hash_variant(\"%s\"))); /* `%s */\n Store_field(cons, 1, result);\n result = cons;\n }\n" + flag.flag_c_identifier variant_name variant_name in + emit_member_branch ~namespace ~class_version + ~member_version:flag.flag_version + ~fallback_line:None ~branch buf ) bitfield.flags; bprintf buf "\n CAMLreturn(result);\n"; @@ -206,8 +244,20 @@ let generate_c_bitfield_converters ~namespace bitfield = else variant_name in - bprintf buf " %sif (tag == caml_hash_variant(\"%s\")) result |= %s; /* `%s */\n" - (if i = 0 then "" else "else ") variant_name flag.flag_c_identifier variant_name; + let fallback_line = + match flag.flag_version with + | None -> None + | Some v_str -> + let msg = sprintf " %sif (tag == caml_hash_variant(\"%s\")) caml_failwith(\"%s.%s requires %s\");" + (if i = 0 then "" else "else ") + variant_name bitfield.bitfield_c_type variant_name v_str in + Some msg + in + let branch_line = sprintf " %sif (tag == caml_hash_variant(\"%s\")) result |= %s; /* `%s */\n" + (if i = 0 then "" else "else ") variant_name flag.flag_c_identifier variant_name in + emit_member_branch ~namespace ~class_version + ~member_version:flag.flag_version + ~fallback_line ~branch:branch_line buf ) bitfield.flags; bprintf buf " list = Field(list, 1);\n"; diff --git a/ocgtk/src/tools/gir_gen/generate/filtering.ml b/ocgtk/src/tools/gir_gen/generate/filtering.ml index 0c8b049b5..e16906da9 100644 --- a/ocgtk/src/tools/gir_gen/generate/filtering.ml +++ b/ocgtk/src/tools/gir_gen/generate/filtering.ml @@ -10,9 +10,6 @@ module Log = ~doc:"Shared filtering helpers for GIR generators")) let has_simple_type ~ctx (gir_type : gir_type) = - let is_excluded = Exclude_list.is_excluded_type_name gir_type.name in - (not is_excluded) - && match Type_mappings.find_type_mapping_for_gir_type ~ctx gir_type with | Some _ -> Logs.debug (fun m -> m "has_simple_type: %s -> true\n" gir_type.name); @@ -22,17 +19,7 @@ let has_simple_type ~ctx (gir_type : gir_type) = (* Check if a type is an array type - arrays require inline code generation and can't be handled by simple type mapping macros *) let is_array_type (gir_type : gir_type) = Option.is_some gir_type.array -let property_exclude_list = [ ("IconPaintable", "is-symbolic") ] - -let should_generate_property ~ctx ~class_name ~methods (prop : gir_property) = - if - List.exists - ~f:(fun (test_class_name, test_property_name) -> - String.equal prop.prop_name test_property_name - && String.equal class_name test_class_name) - property_exclude_list - then false - else +let should_generate_property ~ctx ~class_name:_ ~methods (prop : gir_property) = (* Check if property type is an interface - we can't handle these yet *) let is_interface_type = let check_interface_by_name name = @@ -218,11 +205,6 @@ let method_has_unsupported_arrays ~ctx (meth : gir_method) = in return_array_unsupported || param_array_unsupported -let method_has_excluded_type (meth : gir_method) = - Exclude_list.is_excluded_type_name meth.return_type.name - || List.exists meth.parameters ~f:(fun p -> - Exclude_list.is_excluded_type_name p.param_type.name) - (** Check if a method has out-parameter arrays that cannot be safely converted. This covers two cases: 1. Arrays with zero_terminated=false and no length or fixed_size info 2. Double-pointer out-params not marked as arrays in GIR *) @@ -244,19 +226,12 @@ let method_has_unsupported_out_arrays (meth : gir_method) = | In -> false) let should_skip_method_binding ~ctx (meth : gir_method) = - let is_excluded_function = - Exclude_list.is_excluded_function meth.c_identifier - in let has_unknown_type = Exclude_list.should_skip_method ~find_type_mapping:(Type_mappings.find_type_mapping_for_gir_type ~ctx) ~enums:ctx.enums ~bitfields:ctx.bitfields meth in - let has_excluded_type = method_has_excluded_type meth in - let is_variadic = - List.exists meth.parameters ~f:(fun p -> p.varargs) - || Exclude_list.is_variadic_function meth.c_identifier - in + let is_variadic = List.exists meth.parameters ~f:(fun p -> p.varargs) in (* Check if method is marked as non-introspectable *) let is_not_introspectable = not meth.introspectable in (* Check for out-param arrays that can't be safely converted *) @@ -271,14 +246,14 @@ let should_skip_method_binding ~ctx (meth : gir_method) = in Logs.debug (fun m -> - m "should_skip_method_name: %s -> %b %b %b %b %b %b %b\n" - meth.c_identifier is_variadic has_excluded_type has_unknown_type - is_excluded_function is_not_introspectable has_unsupported_out_arrays - has_unsupported_arrays); + m "should_skip_method_name: %s -> %b %b %b %b %b %b\n" + meth.c_identifier is_variadic has_unknown_type + is_not_introspectable has_unsupported_out_arrays + has_unsupported_arrays has_list_with_interface_element); - is_variadic || has_excluded_type || has_unknown_type || is_excluded_function - || is_not_introspectable || has_unsupported_out_arrays - || has_unsupported_arrays || has_list_with_interface_element + is_variadic || has_unknown_type || is_not_introspectable + || has_unsupported_out_arrays || has_unsupported_arrays + || has_list_with_interface_element let constructor_has_varargs (ctor : gir_constructor) = List.exists ctor.ctor_parameters ~f:(fun p -> p.varargs) @@ -304,15 +279,12 @@ let should_generate_constructor ~ctx (ctor : gir_constructor) = && (not has_unknown_type) && not has_list_with_interface_element -let banned_records = [ "PrintBackend"; "PixbufModule"; "PixbufModulePattern" ] - (* Check if a record name ends with "Private" - these are typically internal GObject private data structures that don't appear in public headers *) let should_skip_private_record (record : gir_record) = let name = record.record_name in let len = String.length name in - List.exists banned_records ~f:(fun banned -> String.equal banned name) - || (len > 7 && String.equal (String.sub name ~pos:(len - 7) ~len:7) "Private") + len > 7 && String.equal (String.sub name ~pos:(len - 7) ~len:7) "Private" (* Check if a record should be generated *) let should_generate_record (record : gir_record) = @@ -340,11 +312,9 @@ let method_has_interface_param ~ctx (meth : gir_method) = check_interface_by_name p.param_type.name || check_interface_by_c_type p.param_type.c_type) -let should_generate_class (cls : gir_class) = - cls.introspectable && not (Exclude_list.should_skip_class cls.class_name) +let should_generate_class (cls : gir_class) = cls.introspectable -let should_generate_interface (intf : gir_interface) = - not (Exclude_list.should_skip_class intf.interface_name) +let should_generate_interface (_intf : gir_interface) = true (* Check if a standalone function should be generated *) let should_generate_function (func : gir_function) = func.introspectable diff --git a/ocgtk/src/tools/gir_gen/generate/filtering.mli b/ocgtk/src/tools/gir_gen/generate/filtering.mli index 3b9ba29de..87ffc4de2 100644 --- a/ocgtk/src/tools/gir_gen/generate/filtering.mli +++ b/ocgtk/src/tools/gir_gen/generate/filtering.mli @@ -11,7 +11,7 @@ val is_array_type : gir_type -> bool (* Check if a property should be generated *) val should_generate_property : ctx:generation_context -> - class_name:string -> + class_name:'a -> methods:gir_method list -> gir_property -> bool @@ -32,9 +32,6 @@ val property_base_names : gir_property list -> string list -(* Check if a method has excluded type *) -val method_has_excluded_type : gir_method -> bool - (* Check if a method should be skipped *) val should_skip_method_binding : ctx:generation_context -> gir_method -> bool diff --git a/ocgtk/src/tools/gir_gen/generate/layer1/layer1_property.ml b/ocgtk/src/tools/gir_gen/generate/layer1/layer1_property.ml index 5413abd1f..f53ce4013 100644 --- a/ocgtk/src/tools/gir_gen/generate/layer1/layer1_property.ml +++ b/ocgtk/src/tools/gir_gen/generate/layer1/layer1_property.ml @@ -6,9 +6,8 @@ open Types (** Check if the type mapping exists for this property *) let has_property_type_mapping ~ctx (prop : gir_property) = - (not (Exclude_list.is_excluded_type_name prop.prop_type.name)) - && Option.is_some - (Type_mappings.find_type_mapping_for_gir_type ~ctx prop.prop_type) + Option.is_some + (Type_mappings.find_type_mapping_for_gir_type ~ctx prop.prop_type) (** Check if a property getter should be generated *) let should_generate_property_getter (prop : gir_property) = prop.readable diff --git a/ocgtk/src/tools/gir_gen/generate/library_module.ml b/ocgtk/src/tools/gir_gen/generate/library_module.ml index 319972e5b..26501772d 100644 --- a/ocgtk/src/tools/gir_gen/generate/library_module.ml +++ b/ocgtk/src/tools/gir_gen/generate/library_module.ml @@ -146,10 +146,6 @@ let generate_library_implementation ~ctx = @ List.map (fun (i : gir_interface) -> i.interface_name) ctx.interfaces @ List.map (fun (r : gir_record) -> r.record_name) ctx.records in - let all_entities = - ListLabels.filter all_entities ~f:(fun name -> - not (Exclude_list.should_skip_class name)) - in let sorted_entities = List.sort String.compare all_entities in (* Generate Wrappers submodule BEFORE module aliases to avoid shadowing *) diff --git a/ocgtk/src/tools/gir_gen/gir_gen.ml b/ocgtk/src/tools/gir_gen/gir_gen.ml index 082be4ccc..c3ab72374 100644 --- a/ocgtk/src/tools/gir_gen/gir_gen.ml +++ b/ocgtk/src/tools/gir_gen/gir_gen.ml @@ -678,7 +678,7 @@ let generate_enum_files ~output_dir ~generated_stubs ~generated_modules ~f:(fun (enum : gir_enum) -> let converters = Gir_gen_lib.Generate.Enum_code.generate_c_enum_converters - ~namespace:namespace.name enum + ~namespace:namespace.name ~class_version:enum.enum_version enum in match enum.enum_version with | None -> converters @@ -698,7 +698,7 @@ let generate_enum_files ~output_dir ~generated_stubs ~generated_modules ~f:(fun (bitfield : gir_bitfield) -> let converters = Gir_gen_lib.Generate.Enum_code.generate_c_bitfield_converters - ~namespace:namespace.name bitfield + ~namespace:namespace.name ~class_version:bitfield.bitfield_version bitfield in match bitfield.bitfield_version with | None -> converters @@ -743,7 +743,8 @@ let load_reference_files reference_files = StringMap.add cr_namespace.cr_namespace_name ncr_namespace acc) (* Main generation function *) -let generate_bindings filter_file gir_file output_dir reference_files = +let generate_bindings filter_file gir_file output_dir reference_files + overrides_file = printf "Current directory: %s\n" (Sys.getcwd ()); printf "Parsing %s ...\n" gir_file; @@ -793,6 +794,37 @@ let generate_bindings filter_file gir_file output_dir reference_files = printf "Found %d Gtk bitfields\n" (List.length gtk_bitfields); printf "Found %d records\n" (List.length gtk_records); + (* ==== OVERRIDE APPLICATION STAGE ==== *) + + (* Apply overrides before building type-mapping context. Ignored entities + must be absent from ctx so that find_type_mapping_for_gir_type returns + None for their types. *) + let classes, interfaces, gtk_enums, gtk_bitfields, gtk_records = + match overrides_file with + | None -> classes, interfaces, gtk_enums, gtk_bitfields, gtk_records + | Some file -> + printf "Loading overrides from %s\n" file; + match Gir_gen_lib.Override_parser.parse_overrides file with + | Error e -> + eprintf "Error: override parse failed: %s\n" + (Gir_gen_lib.Override_parser.format_error e); + exit 1 + | Ok ov -> + let result = + (* parse_gir_file does not extract top-level namespace functions, + so ~functions:[] is correct — there is nothing to filter. *) + Gir_gen_lib.Override_apply.apply_overrides ~overrides:ov + ~classes ~interfaces ~enums:gtk_enums ~bitfields:gtk_bitfields + ~records:gtk_records ~functions:[] in + List.iter result.warnings ~f:(fun w -> eprintf "Warning: %s\n" w); + if result.ignored_entities <> [] then + printf "Ignored %d entity(ies): %s\n" + (List.length result.ignored_entities) + (String.concat ~sep:", " result.ignored_entities); + result.classes, result.interfaces, result.enums, + result.bitfields, result.records + in + (* ==== PREPROCESSING STAGE ==== *) (* Load cross-references early so parent chain can use them *) @@ -1297,7 +1329,7 @@ let generate_bindings filter_file gir_file output_dir reference_files = `Ok () (* References generation function *) -let generate_references gir_file output_file = +let generate_references gir_file output_file overrides_file = printf "Parsing %s for references...\n" gir_file; let filter_classes = [] in @@ -1305,6 +1337,29 @@ let generate_references gir_file output_file = let repository, namespace, classes, interfaces, enums, bitfields, records = Gir_gen_lib.Parse.Gir_parser.parse_gir_file gir_file filter_classes in + + (* Apply overrides to filter ignored entities from references *) + let classes, interfaces, enums, bitfields, records = + match overrides_file with + | None -> classes, interfaces, enums, bitfields, records + | Some file -> + printf "Loading overrides from %s\n" file; + match Gir_gen_lib.Override_parser.parse_overrides file with + | Error e -> + eprintf "Error: override parse failed: %s\n" + (Gir_gen_lib.Override_parser.format_error e); + exit 1 + | Ok ov -> + let result = + (* parse_gir_file does not extract top-level namespace functions, + so ~functions:[] is correct — there is nothing to filter. *) + Gir_gen_lib.Override_apply.apply_overrides ~overrides:ov + ~classes ~interfaces ~enums ~bitfields ~records ~functions:[] in + List.iter result.warnings ~f:(fun w -> eprintf "Warning: %s\n" w); + result.classes, result.interfaces, result.enums, + result.bitfields, result.records + in + printf "References will be written to: %s\n" output_file; let entities = (classes @@ -1365,6 +1420,225 @@ let generate_references gir_file output_file = Sexplib.Sexp.(save_hum output_file (converter crns)); `Ok () +let extract_since_version = Gir_gen_lib.Override_extractor.extract_since_version + +let render_version_component ~kind (name : string) (version : string) = + sprintf " (%s %s (version \"%s\"))" kind name version + +(* Render a single component override back to human-friendly sexp. *) +let render_component ~kind (c : Gir_gen_lib.Override_types.component_override) = + match c.action with + | Gir_gen_lib.Override_types.Ignore -> + sprintf " (%s %s (ignore))" kind c.component_name + | Gir_gen_lib.Override_types.Set_version v -> + sprintf " (%s %s (version \"%s\"))" kind c.component_name v + +(* Render an enum override entry, merging existing ignores with fresh version data. + [ignore_components]: component-level ignores to preserve from the existing file. + [version_data]: fresh (name, version) pairs from GIR. + [entity_action]: entity-level ignore to preserve, if any. *) +let render_enum_entry entity_kind component_kind entity_name entity_action + ignore_components version_data = + let buf = Buffer.create 128 in + bprintf buf "\n (%s %s\n" entity_kind entity_name; + (match entity_action with + | Some Gir_gen_lib.Override_types.Ignore -> bprintf buf " (ignore)\n" + | Some (Gir_gen_lib.Override_types.Set_version v) -> + bprintf buf " (version \"%s\")\n" v + | None -> ()); + List.iter + ~f:(fun c -> bprintf buf "%s\n" (render_component ~kind:component_kind c)) + ignore_components; + List.iter + ~f:(fun (name, version) -> + bprintf buf "%s\n" (render_version_component ~kind:component_kind name version)) + version_data; + bprintf buf " )"; + Buffer.contents buf + +(* Merge GIR-extracted version data into an existing override file's entity list. + Preserves all (ignore) directives; replaces version annotations with fresh GIR data. + [existing]: parsed existing override entities (may be empty if file is new). + [gir_versions]: map from entity_name -> [(component_name, version_str)]. + [get_name / get_action / get_components]: accessors for the entity type. + [component_kind]: "member" or "field" for rendering. + [entity_kind]: "enumeration", "bitfield", or "record" for rendering. *) +let merge_version_entities ~entity_kind ~component_kind ~existing ~gir_versions + ~get_name ~get_entity_action ~get_components = + let buf = Buffer.create 512 in + (* Track which existing entities we've processed *) + let processed = Hashtbl.create 16 in + (* Emit entities that appear in GIR version data *) + List.iter + ~f:(fun (entity_name, version_data) -> + Hashtbl.replace processed entity_name true; + let existing_ov = + List.find_opt + ~f:(fun e -> String.equal (get_name e) entity_name) + existing + in + let entity_action, ignore_components = + match existing_ov with + | None -> (None, []) + | Some ov -> + let ignores = + List.filter + ~f:(fun (c : Gir_gen_lib.Override_types.component_override) -> + match c.action with + | Gir_gen_lib.Override_types.Ignore -> true + | Gir_gen_lib.Override_types.Set_version _ -> false) + (get_components ov) + in + (get_entity_action ov, ignores) + in + bprintf buf "%s\n" + (render_enum_entry entity_kind component_kind entity_name entity_action + ignore_components version_data)) + gir_versions; + (* Emit existing entities that had no GIR version data (preserve as-is) *) + List.iter + ~f:(fun e -> + let name = get_name e in + if not (Hashtbl.mem processed name) then begin + let entity_action = get_entity_action e in + let all_components = get_components e in + bprintf buf "%s\n" + (render_enum_entry entity_kind component_kind name entity_action + all_components []) + end) + existing; + Buffer.contents buf + +(* Collect version overrides from Since annotations in member doc text. + The parser handles version XML attributes natively; this only extracts + unstructured "Since X.Y" text that is not captured by the parser. *) +let member_versions_from_docs members get_name get_doc = + List.filter_map + ~f:(fun m -> + match get_doc m with + | None -> None + | Some doc -> ( + match extract_since_version doc with + | None -> None + | Some v -> Some (get_name m, v))) + members + +(* Generate overrides sexp file from parsed GIR data, merging with any existing file. + Existing (ignore) entries are always preserved. Version annotations are replaced + with fresh data extracted from GIR text. *) +let generate_overrides gir_file output_file = + printf "Parsing %s for Since version annotations...\n" gir_file; + + let _repository, namespace, _classes, _interfaces, enums, bitfields, records = + Gir_gen_lib.Parse.Gir_parser.parse_gir_file gir_file [] + in + let lib_name = namespace.namespace_name in + + (* Load existing overrides if the file already exists *) + let existing = + if Sys.file_exists output_file then begin + printf "Merging with existing %s...\n" output_file; + match Gir_gen_lib.Override_parser.parse_overrides output_file with + | Ok ov -> ov + | Error e -> + eprintf "Warning: could not parse existing override file (%s); starting fresh\n" + (Gir_gen_lib.Override_parser.format_error e); + { Gir_gen_lib.Override_types.library_name = lib_name; + classes = []; interfaces = []; records = []; + enums = []; bitfields = []; functions = [] } + end else + { Gir_gen_lib.Override_types.library_name = lib_name; + classes = []; interfaces = []; records = []; + enums = []; bitfields = []; functions = [] } + in + + let buf = Buffer.create 4096 in + Buffer.add_string buf (sprintf "(overrides\n (library \"%s\")\n" lib_name); + + (* Emit class/interface/function overrides from existing file unchanged *) + List.iter + ~f:(fun (o : Gir_gen_lib.Override_types.class_override) -> + let buf2 = Buffer.create 64 in + bprintf buf2 "\n (class %s\n" o.class_name; + (match o.class_action with + | Some Gir_gen_lib.Override_types.Ignore -> bprintf buf2 " (ignore)\n" + | Some (Gir_gen_lib.Override_types.Set_version v) -> + bprintf buf2 " (version \"%s\")\n" v + | None -> ()); + List.iter ~f:(fun c -> bprintf buf2 "%s\n" (render_component ~kind:"constructor" c)) + o.constructors; + List.iter ~f:(fun c -> bprintf buf2 "%s\n" (render_component ~kind:"method" c)) + o.methods; + List.iter ~f:(fun c -> bprintf buf2 "%s\n" (render_component ~kind:"property" c)) + o.properties; + List.iter ~f:(fun c -> bprintf buf2 "%s\n" (render_component ~kind:"signal" c)) + o.signals; + bprintf buf2 " )"; + bprintf buf "%s\n" (Buffer.contents buf2)) + existing.classes; + + (* Merge enum version data with existing enum ignores *) + let enum_versions = + List.filter_map + ~f:(fun (enm : gir_enum) -> + let vs = member_versions_from_docs enm.members + (fun m -> m.member_name) (fun m -> m.member_doc) in + if vs <> [] then Some (enm.enum_name, vs) else None) + enums + in + Buffer.add_string buf + (merge_version_entities ~entity_kind:"enumeration" ~component_kind:"member" + ~existing:existing.enums ~gir_versions:enum_versions + ~get_name:(fun (o : Gir_gen_lib.Override_types.enum_override) -> o.enum_name) + ~get_entity_action:(fun o -> o.enum_action) + ~get_components:(fun o -> o.members)); + + (* Merge bitfield version data with existing bitfield ignores *) + let bitfield_versions = + List.filter_map + ~f:(fun (bf : gir_bitfield) -> + let vs = member_versions_from_docs bf.flags + (fun f -> f.flag_name) (fun f -> f.flag_doc) in + if vs <> [] then Some (bf.bitfield_name, vs) else None) + bitfields + in + Buffer.add_string buf + (merge_version_entities ~entity_kind:"bitfield" ~component_kind:"member" + ~existing:existing.bitfields ~gir_versions:bitfield_versions + ~get_name:(fun (o : Gir_gen_lib.Override_types.bitfield_override) -> o.bitfield_name) + ~get_entity_action:(fun o -> o.bitfield_action) + ~get_components:(fun o -> o.flags)); + + (* Merge record field version data with existing record ignores *) + let record_versions = + List.filter_map + ~f:(fun (rec_ : gir_record) -> + let vs = member_versions_from_docs rec_.fields + (fun f -> f.field_name) (fun f -> f.field_doc) in + if vs <> [] then Some (rec_.record_name, vs) else None) + records + in + Buffer.add_string buf + (merge_version_entities ~entity_kind:"record" ~component_kind:"field" + ~existing:existing.records ~gir_versions:record_versions + ~get_name:(fun (o : Gir_gen_lib.Override_types.record_override) -> o.record_name) + ~get_entity_action:(fun o -> o.record_action) + ~get_components:(fun o -> + (* Only carry forward ignore-action field components; version ones are replaced *) + List.filter + ~f:(fun (c : Gir_gen_lib.Override_types.component_override) -> + match c.action with + | Gir_gen_lib.Override_types.Ignore -> true + | Gir_gen_lib.Override_types.Set_version _ -> false) + o.fields)); + + Buffer.add_string buf ")\n"; + + let content = Buffer.contents buf in + write_file ~path:output_file ~content; + printf "✓ Overrides written to %s\n" output_file; + `Ok () + (* Cmdliner argument definitions *) let filter_arg = let doc = "Filter file specifying which classes to generate" in @@ -1385,6 +1659,10 @@ let reference_files_arg = in Arg.(value & opt_all file [] & info [ "r"; "reference" ] ~docv:"FILE" ~doc) +let overrides_arg = + let doc = "Override file (s-expression) for GIR generation configuration" in + Arg.(value & opt (some file) None & info [ "o"; "overrides" ] ~docv:"FILE" ~doc) + (* Arguments for references command *) let gir_file_arg_refs = let doc = "Path to GIR file to parse for references" in @@ -1394,6 +1672,10 @@ let output_file_arg_refs = let doc = "Output file path for generated references" in Arg.(required & pos 1 (some string) None & info [] ~docv:"OUTPUT_FILE" ~doc) +let overrides_arg_refs = + let doc = "Override file for filtering references" in + Arg.(value & opt (some file) None & info [ "o"; "overrides" ] ~docv:"FILE" ~doc) + (* Command definitions *) (* Generate subcommand *) @@ -1413,6 +1695,10 @@ let generate_cmd = `Pre " gir_gen generate -r gtk_refs.txt -r gdk_refs.txt \ /usr/share/gir-1.0/Gtk-4.0.gir ./output"; + `P "Generate with override file:"; + `Pre + " gir_gen generate -o overrides/gtk.sexp \ + /usr/share/gir-1.0/Gtk-4.0.gir ./output"; ] in let info = Cmd.info "generate" ~doc ~man in @@ -1420,7 +1706,38 @@ let generate_cmd = Term.( ret (const generate_bindings $ filter_arg $ gir_file_arg $ output_dir_arg - $ reference_files_arg)) + $ reference_files_arg $ overrides_arg)) + +(* Arguments for overrides command *) +let gir_file_arg_overrides = + let doc = "Path to GIR file to parse for Since version annotations" in + Arg.(required & pos 0 (some file) None & info [] ~docv:"GIR_FILE" ~doc) + +let output_file_arg_overrides = + let doc = "Output file path for generated override sexp" in + Arg.(required & pos 1 (some string) None & info [] ~docv:"OUTPUT_FILE" ~doc) + +(* Overrides subcommand *) +let overrides_cmd = + let doc = "Extract Since version annotations from a GIR file into an override sexp" in + let man = + [ + `S Manpage.s_description; + `P + "The overrides command parses a GIR file and generates a partial \ + override file containing version entries extracted from Since \ + comments in member/field doc strings. The output can be combined \ + with manually-authored ignore entries to form a complete override \ + file."; + `S Manpage.s_examples; + `P "Extract version overrides from GTK GIR:"; + `Pre " gir_gen overrides /usr/share/gir-1.0/Gtk-4.0.gir overrides/gtk.sexp"; + ] + in + let info = Cmd.info "overrides" ~doc ~man in + Cmd.v info + Term.( + ret (const generate_overrides $ gir_file_arg_overrides $ output_file_arg_overrides)) (* References subcommand *) let references_cmd = @@ -1435,12 +1752,16 @@ let references_cmd = `S Manpage.s_examples; `P "Generate reference list:"; `Pre " gir_gen references /usr/share/gir-1.0/Gtk-4.0.gir gtk_refs.txt"; + `P "Generate reference list with overrides:"; + `Pre " gir_gen references -o overrides/gtk.sexp \ + /usr/share/gir-1.0/Gtk-4.0.gir gtk_refs.txt"; ] in let info = Cmd.info "references" ~doc ~man in Cmd.v info Term.( - ret (const generate_references $ gir_file_arg_refs $ output_file_arg_refs)) + ret (const generate_references $ gir_file_arg_refs $ output_file_arg_refs + $ overrides_arg_refs)) (* Main command *) let gir_gen_cmd = @@ -1456,13 +1777,14 @@ let gir_gen_cmd = `P "Available commands:"; `I ("generate", "Generate C FFI bindings and OCaml modules"); `I ("references", "Generate cross-namespace reference list"); + `I ("overrides", "Extract Since version annotations into override sexp"); `S Manpage.s_bugs; `P "Report bugs to https://github.com/chris-armstrong/ocgtk/issues"; ] in let info = Cmd.info "gir_gen" ~version:"5.0.0" ~doc ~man in let default = Term.(ret (const (`Help (`Pager, None)))) in - Cmd.group info ~default [ generate_cmd; references_cmd ] + Cmd.group info ~default [ generate_cmd; references_cmd; overrides_cmd ] (* Main entry point *) let () = exit (Cmd.eval gir_gen_cmd) diff --git a/ocgtk/src/tools/gir_gen/override_apply.ml b/ocgtk/src/tools/gir_gen/override_apply.ml new file mode 100644 index 000000000..93e923a58 --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_apply.ml @@ -0,0 +1,418 @@ +(* Apply parsed overrides to GIR data structures. *) + +open Types +open Override_types + +type apply_result = { + classes : Types.gir_class list; + interfaces : Types.gir_interface list; + enums : Types.gir_enum list; + bitfields : Types.gir_bitfield list; + records : Types.gir_record list; + functions : Types.gir_function list; + ignored_entities : string list; + warnings : string list; +} + +(* Helper to find a component override by name. *) +let find_component_override name overrides = + List.find_opt + (fun (c : component_override) -> String.equal c.component_name name) + overrides + +(* Warn if component overrides reference names not in the component list. *) +let warn_unknown_components ~entity_name ~entity_kind ~component_kind + ~(get_name : 'a -> string) ~(components : 'a list) + ~(overrides : component_override list) ~(warnings : string list ref) = + List.iter + (fun (c : component_override) -> + if + not + (List.exists + (fun x -> String.equal (get_name x) c.component_name) + components) + then + warnings := + Printf.sprintf "unknown %s '%s' in %s '%s'" component_kind + c.component_name entity_kind entity_name + :: !warnings) + overrides + +(* Generic: warn about entity-level override names not found in parsed data. + Always checks original data (not filtered) — catches typos on ignored entities. *) +let check_unknown_entity_names ~entity_kind ~get_override_name ~get_entity_name + overrides entities = + List.filter_map + (fun ov -> + if List.exists (fun e -> String.equal (get_entity_name e) (get_override_name ov)) entities + then None + else + Some + (Printf.sprintf "unknown %s '%s' in override" entity_kind + (get_override_name ov))) + overrides + +(* Apply component-level overrides to a single component list. + Returns the filtered-and-versioned list. *) +let apply_components_by_name + ~(get_name : 'a -> string) + ~(set_version : string -> 'a -> 'a) + ~(overrides : component_override list) + (components : 'a list) : 'a list = + List.filter_map + (fun item -> + match find_component_override (get_name item) overrides with + | Some { action = Ignore; _ } -> None + | Some { action = Set_version v; _ } -> Some (set_version v item) + | None -> Some item) + components + +(* Per-entity helpers: apply component overrides to a surviving entity. *) + +let apply_class_components (ov : class_override) (cls : gir_class) : gir_class = + let constructors = + apply_components_by_name + ~get_name:(fun (c : gir_constructor) -> c.ctor_name) + ~set_version:(fun v (c : gir_constructor) -> { c with version = Some v }) + ~overrides:ov.constructors cls.constructors + in + let methods = + apply_components_by_name + ~get_name:(fun (m : gir_method) -> m.method_name) + ~set_version:(fun v (m : gir_method) -> { m with version = Some v }) + ~overrides:ov.methods cls.methods + in + let properties = + apply_components_by_name + ~get_name:(fun (p : gir_property) -> p.prop_name) + ~set_version:(fun v (p : gir_property) -> { p with version = Some v }) + ~overrides:ov.properties cls.properties + in + let signals = + apply_components_by_name + ~get_name:(fun (s : gir_signal) -> s.signal_name) + ~set_version:(fun v (s : gir_signal) -> { s with version = Some v }) + ~overrides:ov.signals cls.signals + in + { cls with constructors; methods; properties; signals } + +let apply_interface_components (ov : interface_override) (intf : gir_interface) + : gir_interface = + let methods = + apply_components_by_name + ~get_name:(fun (m : gir_method) -> m.method_name) + ~set_version:(fun v (m : gir_method) -> { m with version = Some v }) + ~overrides:ov.methods intf.methods + in + let properties = + apply_components_by_name + ~get_name:(fun (p : gir_property) -> p.prop_name) + ~set_version:(fun v (p : gir_property) -> { p with version = Some v }) + ~overrides:ov.properties intf.properties + in + let signals = + apply_components_by_name + ~get_name:(fun (s : gir_signal) -> s.signal_name) + ~set_version:(fun v (s : gir_signal) -> { s with version = Some v }) + ~overrides:ov.signals intf.signals + in + { intf with methods; properties; signals } + +let apply_record_components (ov : record_override) (rec_ : gir_record) + : gir_record = + let fields = + apply_components_by_name + ~get_name:(fun (f : gir_record_field) -> f.field_name) + ~set_version:(fun v (f : gir_record_field) -> { f with field_version = Some v }) + ~overrides:ov.fields rec_.fields + in + let constructors = + apply_components_by_name + ~get_name:(fun (c : gir_constructor) -> c.ctor_name) + ~set_version:(fun v (c : gir_constructor) -> { c with version = Some v }) + ~overrides:ov.constructors rec_.constructors + in + let methods = + apply_components_by_name + ~get_name:(fun (m : gir_method) -> m.method_name) + ~set_version:(fun v (m : gir_method) -> { m with version = Some v }) + ~overrides:ov.methods rec_.methods + in + let functions = + apply_components_by_name + ~get_name:(fun (f : gir_function) -> f.function_name) + ~set_version:(fun v (f : gir_function) -> { f with version = Some v }) + ~overrides:ov.functions rec_.functions + in + { rec_ with fields; constructors; methods; functions } + +let apply_enum_components (ov : enum_override) (enm : gir_enum) : gir_enum = + let members = + apply_components_by_name + ~get_name:(fun (m : gir_enum_member) -> m.member_name) + ~set_version:(fun v (m : gir_enum_member) -> { m with member_version = Some v }) + ~overrides:ov.members enm.members + in + let functions = + apply_components_by_name + ~get_name:(fun (f : gir_function) -> f.function_name) + ~set_version:(fun v (f : gir_function) -> { f with version = Some v }) + ~overrides:ov.functions enm.functions + in + { enm with members; functions } + +let apply_bitfield_components (ov : bitfield_override) (bf : gir_bitfield) + : gir_bitfield = + let flags = + apply_components_by_name + ~get_name:(fun (f : gir_bitfield_member) -> f.flag_name) + ~set_version:(fun v (f : gir_bitfield_member) -> { f with flag_version = Some v }) + ~overrides:ov.flags bf.flags + in + { bf with flags } + +(* Generic: entity-level ignore/version and component overrides. + ~get_entity_name / ~get_override_name: name accessors for entity and override types + ~get_action: extracts the entity-level action from an override record + ~set_version: applies a version string to the entity record + ~apply_components: applies all component-level overrides to a surviving entity + ~check_components: emits component-level unknown-name warnings for one entity *) +let apply_entity_overrides ~get_entity_name ~get_override_name + ~get_action ~set_version ~apply_components ~check_components all_entities + overrides = + let ignored = ref [] in + let warnings = ref [] in + let process entity = + match + List.find_opt + (fun ov -> String.equal (get_override_name ov) (get_entity_name entity)) + overrides + with + | None -> Some entity + | Some ov -> ( + match get_action ov with + | Some Ignore -> + ignored := get_entity_name entity :: !ignored; + None + | Some (Set_version v) -> + Some (apply_components ov (set_version v entity)) + | None -> Some (apply_components ov entity)) + in + let processed = List.filter_map process all_entities in + (* Warn using the ORIGINAL entity list so that successfully-ignored components + do not produce false "unknown" warnings. *) + List.iter + (fun ov -> + match get_action ov with + | Some Ignore -> () + | Some _ | None -> + Option.iter + (fun entity -> + check_components ~entity_name:(get_override_name ov) entity ov + ~warnings) + (List.find_opt + (fun e -> String.equal (get_entity_name e) (get_override_name ov)) + all_entities)) + overrides; + (processed, !ignored, !warnings) + +let apply_class_overrides ~class_overrides all_classes = + apply_entity_overrides ~get_entity_name:(fun (c : gir_class) -> c.class_name) + ~get_override_name:(fun (o : class_override) -> o.class_name) + ~get_action:(fun (o : class_override) -> o.class_action) + ~set_version:(fun v (c : gir_class) -> { c with version = Some v }) + ~apply_components:apply_class_components + ~check_components:(fun ~entity_name cls ov ~warnings -> + warn_unknown_components ~entity_name ~entity_kind:"class" + ~component_kind:"constructor" + ~get_name:(fun (c : gir_constructor) -> c.ctor_name) + ~components:cls.constructors ~overrides:ov.constructors ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"class" + ~component_kind:"method" + ~get_name:(fun (m : gir_method) -> m.method_name) + ~components:cls.methods ~overrides:ov.methods ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"class" + ~component_kind:"property" + ~get_name:(fun (p : gir_property) -> p.prop_name) + ~components:cls.properties ~overrides:ov.properties ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"class" + ~component_kind:"signal" + ~get_name:(fun (s : gir_signal) -> s.signal_name) + ~components:cls.signals ~overrides:ov.signals ~warnings) + all_classes class_overrides + +let apply_interface_overrides ~interface_overrides all_interfaces = + apply_entity_overrides ~get_entity_name:(fun (i : gir_interface) -> i.interface_name) + ~get_override_name:(fun (o : interface_override) -> o.interface_name) + ~get_action:(fun (o : interface_override) -> o.interface_action) + ~set_version:(fun v (i : gir_interface) -> { i with version = Some v }) + ~apply_components:apply_interface_components + ~check_components:(fun ~entity_name intf ov ~warnings -> + warn_unknown_components ~entity_name ~entity_kind:"interface" + ~component_kind:"method" + ~get_name:(fun (m : gir_method) -> m.method_name) + ~components:intf.methods ~overrides:ov.methods ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"interface" + ~component_kind:"property" + ~get_name:(fun (p : gir_property) -> p.prop_name) + ~components:intf.properties ~overrides:ov.properties ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"interface" + ~component_kind:"signal" + ~get_name:(fun (s : gir_signal) -> s.signal_name) + ~components:intf.signals ~overrides:ov.signals ~warnings) + all_interfaces interface_overrides + +let apply_record_overrides ~record_overrides all_records = + apply_entity_overrides ~get_entity_name:(fun (r : gir_record) -> r.record_name) + ~get_override_name:(fun (o : record_override) -> o.record_name) + ~get_action:(fun (o : record_override) -> o.record_action) + ~set_version:(fun v (r : gir_record) -> { r with version = Some v }) + ~apply_components:apply_record_components + ~check_components:(fun ~entity_name rec_ ov ~warnings -> + warn_unknown_components ~entity_name ~entity_kind:"record" + ~component_kind:"field" + ~get_name:(fun (f : gir_record_field) -> f.field_name) + ~components:rec_.fields ~overrides:ov.fields ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"record" + ~component_kind:"constructor" + ~get_name:(fun (c : gir_constructor) -> c.ctor_name) + ~components:rec_.constructors ~overrides:ov.constructors ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"record" + ~component_kind:"method" + ~get_name:(fun (m : gir_method) -> m.method_name) + ~components:rec_.methods ~overrides:ov.methods ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"record" + ~component_kind:"function" + ~get_name:(fun (f : gir_function) -> f.function_name) + ~components:rec_.functions ~overrides:ov.functions ~warnings) + all_records record_overrides + +let apply_enum_overrides ~enum_overrides all_enums = + apply_entity_overrides ~get_entity_name:(fun (e : gir_enum) -> e.enum_name) + ~get_override_name:(fun (o : enum_override) -> o.enum_name) + ~get_action:(fun (o : enum_override) -> o.enum_action) + ~set_version:(fun v (e : gir_enum) -> { e with enum_version = Some v }) + ~apply_components:apply_enum_components + ~check_components:(fun ~entity_name enm ov ~warnings -> + warn_unknown_components ~entity_name ~entity_kind:"enumeration" + ~component_kind:"member" + ~get_name:(fun (m : gir_enum_member) -> m.member_name) + ~components:enm.members ~overrides:ov.members ~warnings; + warn_unknown_components ~entity_name ~entity_kind:"enumeration" + ~component_kind:"function" + ~get_name:(fun (f : gir_function) -> f.function_name) + ~components:enm.functions ~overrides:ov.functions ~warnings) + all_enums enum_overrides + +let apply_bitfield_overrides ~bitfield_overrides all_bitfields = + apply_entity_overrides ~get_entity_name:(fun (b : gir_bitfield) -> b.bitfield_name) + ~get_override_name:(fun (o : bitfield_override) -> o.bitfield_name) + ~get_action:(fun (o : bitfield_override) -> o.bitfield_action) + ~set_version:(fun v (b : gir_bitfield) -> { b with bitfield_version = Some v }) + ~apply_components:apply_bitfield_components + ~check_components:(fun ~entity_name bf ov ~warnings -> + warn_unknown_components ~entity_name ~entity_kind:"bitfield" + ~component_kind:"member" + ~get_name:(fun (f : gir_bitfield_member) -> f.flag_name) + ~components:bf.flags ~overrides:ov.flags ~warnings) + all_bitfields bitfield_overrides + +(* Process standalone functions: ignore or version override. *) +let apply_function_overrides ~(function_overrides : component_override list) + (functions : gir_function list) = + let ignored = ref [] in + let warnings = ref [] in + let processed = + List.filter_map + (fun (fn : gir_function) -> + match find_component_override fn.function_name function_overrides with + | Some { action = Ignore; _ } -> + ignored := fn.function_name :: !ignored; + None + | Some { action = Set_version v; _ } -> + Some { fn with version = Some v } + | None -> Some fn) + functions + in + List.iter + (fun (c : component_override) -> + if + not + (List.exists + (fun (fn : gir_function) -> + String.equal fn.function_name c.component_name) + functions) + then + warnings := + Printf.sprintf "unknown standalone function '%s'" c.component_name + :: !warnings) + function_overrides; + (processed, !ignored, !warnings) + +let apply_overrides ~(overrides : library_overrides) ~classes:original_classes + ~interfaces:original_interfaces ~enums:original_enums + ~bitfields:original_bitfields ~records:original_records + ~functions:original_functions = + let classes, class_ignored, class_warnings = + apply_class_overrides ~class_overrides:overrides.classes original_classes + in + let interfaces, interface_ignored, interface_warnings = + apply_interface_overrides ~interface_overrides:overrides.interfaces + original_interfaces + in + let records, record_ignored, record_warnings = + apply_record_overrides ~record_overrides:overrides.records original_records + in + let enums, enum_ignored, enum_warnings = + apply_enum_overrides ~enum_overrides:overrides.enums original_enums + in + let bitfields, bitfield_ignored, bitfield_warnings = + apply_bitfield_overrides ~bitfield_overrides:overrides.bitfields + original_bitfields + in + let functions, function_ignored, function_warnings = + apply_function_overrides ~function_overrides:overrides.functions + original_functions + in + (* Check for unknown entity names using original (unfiltered) data so that + ignored entities don't produce false positives. *) + let entity_warnings = + check_unknown_entity_names ~entity_kind:"class" + ~get_override_name:(fun (ov : class_override) -> ov.class_name) + ~get_entity_name:(fun (cls : gir_class) -> cls.class_name) + overrides.classes original_classes + @ check_unknown_entity_names ~entity_kind:"interface" + ~get_override_name:(fun (ov : interface_override) -> ov.interface_name) + ~get_entity_name:(fun (intf : gir_interface) -> intf.interface_name) + overrides.interfaces original_interfaces + @ check_unknown_entity_names ~entity_kind:"record" + ~get_override_name:(fun (ov : record_override) -> ov.record_name) + ~get_entity_name:(fun (rec_ : gir_record) -> rec_.record_name) + overrides.records original_records + @ check_unknown_entity_names ~entity_kind:"enumeration" + ~get_override_name:(fun (ov : enum_override) -> ov.enum_name) + ~get_entity_name:(fun (enm : gir_enum) -> enm.enum_name) + overrides.enums original_enums + @ check_unknown_entity_names ~entity_kind:"bitfield" + ~get_override_name:(fun (ov : bitfield_override) -> ov.bitfield_name) + ~get_entity_name:(fun (bf : gir_bitfield) -> bf.bitfield_name) + overrides.bitfields original_bitfields + in + let ignored_entities = + class_ignored @ interface_ignored @ record_ignored @ enum_ignored + @ bitfield_ignored @ function_ignored + in + let warnings = + class_warnings @ interface_warnings @ record_warnings @ enum_warnings + @ bitfield_warnings @ function_warnings @ entity_warnings + in + { + classes; + interfaces; + enums; + bitfields; + records; + functions; + ignored_entities; + warnings; + } diff --git a/ocgtk/src/tools/gir_gen/override_apply.mli b/ocgtk/src/tools/gir_gen/override_apply.mli new file mode 100644 index 000000000..c9ad45e9c --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_apply.mli @@ -0,0 +1,38 @@ +(** Apply parsed overrides to GIR data structures. + + Filters out ignored entities and components, and applies version overrides. + This must be called before building the type-mapping context ([ctx]) so that + ignored entities are absent from the context — this causes methods that + reference ignored types to be skipped by existing unknown-type checks. *) + +(** Result of applying overrides. *) +type apply_result = { + classes : Types.gir_class list; + interfaces : Types.gir_interface list; + enums : Types.gir_enum list; + bitfields : Types.gir_bitfield list; + records : Types.gir_record list; + functions : Types.gir_function list; + (** Standalone namespace-level functions. *) + ignored_entities : string list; + (** Names of ignored entities, for logging. *) + warnings : string list; + (** Warnings for unknown entity/component names (typos). *) +} + +val apply_overrides : + overrides:Override_types.library_overrides -> + classes:Types.gir_class list -> + interfaces:Types.gir_interface list -> + enums:Types.gir_enum list -> + bitfields:Types.gir_bitfield list -> + records:Types.gir_record list -> + functions:Types.gir_function list -> + apply_result +(** Apply overrides to parsed GIR data. Filters out ignored entities and + applies version overrides to remaining ones. + + ORDERING: This must be called before building the type-mapping context (ctx). + Ignored entities must be absent from ctx so that [find_type_mapping_for_gir_type] + returns [None] for their types, causing methods that reference them to be skipped + by the existing unknown-type checks in filtering.ml. *) diff --git a/ocgtk/src/tools/gir_gen/override_extractor.ml b/ocgtk/src/tools/gir_gen/override_extractor.ml new file mode 100644 index 000000000..c7776cac6 --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_extractor.ml @@ -0,0 +1,35 @@ +(* Override Extractor: Version extraction from GIR doc strings *) + +(** Extract a "Since X.Y[.Z]" version string from a doc comment. + Matches patterns where the literal word "Since" (capital S) is followed + by an optional colon and a version number: + "Since 2.26" + "Since: 2.74" + "(Since: 1.16)." + Does NOT match lowercase "since" or "available since". Returns None if + no matching pattern is found. *) +let extract_since_version doc_text = + let re = + Re.( + compile + (seq + [ + str "Since"; + rep (set " \t"); + opt (char ':'); + rep (set " \t"); + group + (seq + [ + rep1 digit; + char '.'; + rep1 digit; + opt (seq [ char '.'; rep1 digit ]); + ]); + ])) + in + match Re.exec_opt re doc_text with + | None -> None + | Some groups -> ( + try Some (Re.Group.get groups 1) + with Not_found -> None) diff --git a/ocgtk/src/tools/gir_gen/override_parser.ml b/ocgtk/src/tools/gir_gen/override_parser.ml new file mode 100644 index 000000000..f7203cbe8 --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_parser.ml @@ -0,0 +1,320 @@ +(* S-expression parser for GIR override files. *) + +open Override_types + +type parse_error = + | Invalid_format of { location : string; message : string } + | Unknown_entity_kind of string + | Unknown_component_kind of { entity_name : string; kind : string; valid_kinds : string list } + | Duplicate_entity of { kind : string; name : string } + | Duplicate_component of { entity : string; component_kind : string; name : string } + | Invalid_version of { name : string; version : string; reason : string } + +let format_error = function + | Invalid_format { location; message } -> + Printf.sprintf "%s: %s" location message + | Unknown_entity_kind kind -> + Printf.sprintf "Unknown entity kind: %s" kind + | Unknown_component_kind { entity_name; kind; valid_kinds } -> + Printf.sprintf "%s: Unknown component kind '%s' (expected one of: %s)" + entity_name kind (String.concat ", " valid_kinds) + | Duplicate_entity { kind; name } -> + Printf.sprintf "Duplicate %s '%s'" kind name + | Duplicate_component { entity; component_kind; name } -> + Printf.sprintf "Duplicate %s '%s' in %s" component_kind name entity + | Invalid_version { name; version; reason } -> + Printf.sprintf "Invalid version '%s' for '%s': %s" version name reason + +module Sexp = Sexplib.Sexp + +let ( let* ) = Result.bind + +let validate_version name version_str = + match Version_guard.parse_version version_str with + | Ok _ -> Ok () + | Error reason -> Error (Invalid_version { name; version = version_str; reason }) + +let parse_component ~entity_name sexp = + match sexp with + | Sexp.List [ Sexp.Atom _comp_kind; Sexp.Atom comp_name; Sexp.Atom "ignore" ] + | Sexp.List [ Sexp.Atom _comp_kind; Sexp.Atom comp_name; Sexp.List [ Sexp.Atom "ignore" ] ] + -> + Ok { component_name = comp_name; action = Ignore } + | Sexp.List + [ Sexp.Atom _comp_kind; Sexp.Atom comp_name; Sexp.List [ Sexp.Atom "version"; Sexp.Atom v ] ] + -> ( + match validate_version comp_name v with + | Error e -> Error e + | Ok () -> Ok { component_name = comp_name; action = Set_version v }) + | Sexp.List (Sexp.Atom _comp_kind :: Sexp.Atom comp_name :: _) -> + Error + (Invalid_format + { + location = Printf.sprintf "%s %s" entity_name comp_name; + message = "Expected (ignore) or (version \"...\")"; + }) + | _ -> + Error + (Invalid_format + { location = entity_name; message = "Malformed component override" }) + +let parse_components_of_kind ~entity_name ~kind sexps = + let rec parse acc = function + | [] -> Ok (List.rev acc) + | sexp :: rest -> ( + match sexp with + | Sexp.List (Sexp.Atom k :: _) when String.equal k kind -> ( + match parse_component ~entity_name sexp with + | Ok comp -> parse (comp :: acc) rest + | Error e -> Error e) + | _ -> parse acc rest) + in + parse [] sexps + +let has_ignore_marker body = + List.exists + (function + | Sexp.Atom "ignore" -> true + | Sexp.List [ Sexp.Atom "ignore" ] -> true + | _ -> false) + body + +(** Validate that every list-form element in an entity body starts with one of + [valid_kinds] (or is an action marker like [ignore] / [version]). + Returns [Error (Unknown_component_kind ...)] on the first unrecognised kind. *) +let validate_body_elements ~entity_name ~valid_kinds body = + let rec check = function + | [] -> Ok () + | sexp :: rest -> ( + match sexp with + | Sexp.Atom _ -> check rest (* bare atoms: ignore / other – handled elsewhere *) + | Sexp.List [] -> check rest + | Sexp.List (Sexp.Atom k :: _) -> + if List.mem k valid_kinds || String.equal k "ignore" || String.equal k "version" + then check rest + else Error (Unknown_component_kind { entity_name; kind = k; valid_kinds }) + | Sexp.List _ -> check rest) + in + check body + +let parse_class_override sexp = + match sexp with + | Sexp.List (Sexp.Atom "class" :: Sexp.Atom name :: body) -> + let class_action = if has_ignore_marker body then Some Ignore else None in + let* () = validate_body_elements ~entity_name:name + ~valid_kinds:["constructor"; "method"; "property"; "signal"] body in + let* constructors = parse_components_of_kind ~entity_name:name ~kind:"constructor" body in + let* methods = parse_components_of_kind ~entity_name:name ~kind:"method" body in + let* properties = parse_components_of_kind ~entity_name:name ~kind:"property" body in + let* signals = parse_components_of_kind ~entity_name:name ~kind:"signal" body in + Ok + { + class_name = name; + class_action; + constructors; + methods; + properties; + signals; + } + | _ -> + Error (Invalid_format { location = "class"; message = "Expected (class Name ...)" }) + +let parse_interface_override sexp = + match sexp with + | Sexp.List (Sexp.Atom "interface" :: Sexp.Atom name :: body) -> + let interface_action = if has_ignore_marker body then Some Ignore else None in + let* () = validate_body_elements ~entity_name:name + ~valid_kinds:["method"; "property"; "signal"] body in + let* methods = parse_components_of_kind ~entity_name:name ~kind:"method" body in + let* properties = parse_components_of_kind ~entity_name:name ~kind:"property" body in + let* signals = parse_components_of_kind ~entity_name:name ~kind:"signal" body in + Ok + { + interface_name = name; + interface_action; + methods; + properties; + signals; + } + | _ -> + Error + (Invalid_format { location = "interface"; message = "Expected (interface Name ...)" }) + +let parse_record_override sexp = + match sexp with + | Sexp.List (Sexp.Atom "record" :: Sexp.Atom name :: body) -> + let record_action = if has_ignore_marker body then Some Ignore else None in + let* () = validate_body_elements ~entity_name:name + ~valid_kinds:["field"; "constructor"; "method"; "function"] body in + let* fields = parse_components_of_kind ~entity_name:name ~kind:"field" body in + let* constructors = parse_components_of_kind ~entity_name:name ~kind:"constructor" body in + let* methods = parse_components_of_kind ~entity_name:name ~kind:"method" body in + let* functions = parse_components_of_kind ~entity_name:name ~kind:"function" body in + Ok + { + record_name = name; + record_action; + fields; + constructors; + methods; + functions; + } + | _ -> + Error + (Invalid_format { location = "record"; message = "Expected (record Name ...)" }) + +let parse_enum_override sexp = + match sexp with + | Sexp.List (Sexp.Atom "enumeration" :: Sexp.Atom name :: body) -> + let enum_action = if has_ignore_marker body then Some Ignore else None in + let* () = validate_body_elements ~entity_name:name + ~valid_kinds:["member"; "function"] body in + let* members = parse_components_of_kind ~entity_name:name ~kind:"member" body in + let* functions = parse_components_of_kind ~entity_name:name ~kind:"function" body in + Ok { enum_name = name; enum_action; members; functions } + | _ -> + Error + (Invalid_format + { location = "enumeration"; message = "Expected (enumeration Name ...)" }) + +let parse_bitfield_override sexp = + match sexp with + | Sexp.List (Sexp.Atom "bitfield" :: Sexp.Atom name :: body) -> + let bitfield_action = if has_ignore_marker body then Some Ignore else None in + let* () = validate_body_elements ~entity_name:name ~valid_kinds:["member"] body in + let* flags = parse_components_of_kind ~entity_name:name ~kind:"member" body in + Ok { bitfield_name = name; bitfield_action; flags } + | _ -> + Error + (Invalid_format + { location = "bitfield"; message = "Expected (bitfield Name ...)" }) + + +let extract_library_name body = + List.find_map + (function + | Sexp.List [ Sexp.Atom "library"; Sexp.Atom name ] -> Some name + | _ -> None) + body + |> Option.value ~default:"" + +(** Process one element of the overrides body. + For standalone functions: parses directly (no duplicate check). + For entities: validates kind, checks for duplicates, type-specific parse + accumulate. + For library declarations: skipped. *) +let process_element ~seen ~errors ~classes ~interfaces ~records ~enums ~bitfields + ~functions sexp = + match sexp with + | Sexp.List [ Sexp.Atom "library"; _ ] -> () + | Sexp.List (Sexp.Atom "function" :: Sexp.Atom name :: _) -> + let key = ("function", name) in + if Hashtbl.mem seen key then + errors := Duplicate_entity { kind = "function"; name } :: !errors + else begin + Hashtbl.add seen key true; + match parse_component ~entity_name:"top-level" sexp with + | Ok f -> functions := f :: !functions + | Error e -> errors := e :: !errors + end + | Sexp.List (Sexp.Atom ("class" | "interface" | "record" | "enumeration" + | "bitfield" as kind) :: Sexp.Atom name :: _) -> + let key = (kind, name) in + if Hashtbl.mem seen key then + errors := Duplicate_entity { kind; name } :: !errors + else begin + Hashtbl.add seen key true; + match kind with + | "class" -> ( + match parse_class_override sexp with + | Ok v -> classes := v :: !classes + | Error e -> errors := e :: !errors) + | "interface" -> ( + match parse_interface_override sexp with + | Ok v -> interfaces := v :: !interfaces + | Error e -> errors := e :: !errors) + | "record" -> ( + match parse_record_override sexp with + | Ok v -> records := v :: !records + | Error e -> errors := e :: !errors) + | "enumeration" -> ( + match parse_enum_override sexp with + | Ok v -> enums := v :: !enums + | Error e -> errors := e :: !errors) + | "bitfield" -> ( + match parse_bitfield_override sexp with + | Ok v -> bitfields := v :: !bitfields + | Error e -> errors := e :: !errors) + | _ -> assert false + end + | Sexp.List (Sexp.Atom kind :: _) -> + errors := Unknown_entity_kind kind :: !errors + | _ -> + errors := + Invalid_format + { location = "top level"; message = "Malformed entity override" } + :: !errors + +(** Walk all elements in the overrides body, stopping at the first error. *) +let collect_overrides ~seen ~errors ~classes ~interfaces ~records ~enums + ~bitfields ~functions body = + List.iter + (fun sexp -> + if List.length !errors > 0 then () + else + process_element ~seen ~errors ~classes ~interfaces ~records ~enums + ~bitfields ~functions sexp) + body + +let parse_overrides_sexp sexp = + match sexp with + | Sexp.List (Sexp.Atom "overrides" :: body) -> + let library_name = extract_library_name body in + let classes = ref [] in + let interfaces = ref [] in + let records = ref [] in + let enums = ref [] in + let bitfields = ref [] in + let functions = ref [] in + let errors = ref [] in + let seen = Hashtbl.create 16 in + collect_overrides ~seen ~errors ~classes ~interfaces ~records ~enums + ~bitfields ~functions body; + (match !errors with + | e :: _ -> Error e + | [] -> + Ok + { + library_name; + classes = List.rev !classes; + interfaces = List.rev !interfaces; + records = List.rev !records; + enums = List.rev !enums; + bitfields = List.rev !bitfields; + functions = List.rev !functions; + }) + | _ -> + Error + (Invalid_format + { location = "root"; message = "Expected (overrides ...)" }) + +let parse_overrides filename = + try + let sexp = Sexp.load_sexp filename in + parse_overrides_sexp sexp + with + | Sexplib.Sexp.Parse_error e -> + Error + (Invalid_format + { + location = filename; + message = e.err_msg; + }) + | Failure msg -> Error (Invalid_format { location = filename; message = msg }) + | Sys_error msg -> Error (Invalid_format { location = filename; message = msg }) + +let parse_overrides_from_string content = + try parse_overrides_sexp (Sexp.of_string content) + with + | Sexplib.Sexp.Parse_error e -> + Error (Invalid_format { location = ""; message = e.err_msg }) + | Failure msg -> Error (Invalid_format { location = ""; message = msg }) diff --git a/ocgtk/src/tools/gir_gen/override_parser.mli b/ocgtk/src/tools/gir_gen/override_parser.mli new file mode 100644 index 000000000..963685895 --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_parser.mli @@ -0,0 +1,26 @@ +(** S-expression parser for GIR override files. + + Reads override files in the custom sexp format and produces + {!Override_types.library_overrides} values. *) + +(** Parse errors with context. *) +type parse_error = + | Invalid_format of { location : string; message : string } + | Unknown_entity_kind of string + | Unknown_component_kind of { entity_name : string; kind : string; valid_kinds : string list } + | Duplicate_entity of { kind : string; name : string } + | Duplicate_component of { entity : string; component_kind : string; name : string } + | Invalid_version of { name : string; version : string; reason : string } + +val format_error : parse_error -> string +(** Format a parse error as a human-readable message. *) + +val parse_overrides : + string -> (Override_types.library_overrides, parse_error) result +(** [parse_overrides filename] reads and parses the override file. + Returns [Error] with context on any parse failure. *) + +val parse_overrides_from_string : + string -> (Override_types.library_overrides, parse_error) result +(** [parse_overrides_from_string content] parses overrides from a string. + Useful for testing. *) diff --git a/ocgtk/src/tools/gir_gen/override_types.ml b/ocgtk/src/tools/gir_gen/override_types.ml new file mode 100644 index 000000000..6d5a1940d --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_types.ml @@ -0,0 +1,69 @@ +(* Types for GIR generation overrides. *) + +open Sexplib.Std + +type override_action = + | Ignore + | Set_version of string +[@@deriving sexp, eq] + +type component_override = { + component_name : string; + action : override_action; +} +[@@deriving sexp, eq] + +type class_override = { + class_name : string; + class_action : override_action option; + constructors : component_override list; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +[@@deriving sexp, eq] + +type interface_override = { + interface_name : string; + interface_action : override_action option; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +[@@deriving sexp, eq] + +type record_override = { + record_name : string; + record_action : override_action option; + fields : component_override list; + constructors : component_override list; + methods : component_override list; + functions : component_override list; +} +[@@deriving sexp, eq] + +type enum_override = { + enum_name : string; + enum_action : override_action option; + members : component_override list; + functions : component_override list; +} +[@@deriving sexp, eq] + +type bitfield_override = { + bitfield_name : string; + bitfield_action : override_action option; + flags : component_override list; +} +[@@deriving sexp, eq] + +type library_overrides = { + library_name : string; + classes : class_override list; + interfaces : interface_override list; + records : record_override list; + enums : enum_override list; + bitfields : bitfield_override list; + functions : component_override list; +} +[@@deriving sexp, eq] diff --git a/ocgtk/src/tools/gir_gen/override_types.mli b/ocgtk/src/tools/gir_gen/override_types.mli new file mode 100644 index 000000000..e8fcd4b34 --- /dev/null +++ b/ocgtk/src/tools/gir_gen/override_types.mli @@ -0,0 +1,88 @@ +(** Types for GIR generation overrides. + + Overrides are s-expression-based configuration entries that control + generation behaviour per-entity (ignore, version override). They are + parsed by {!Override_parser} and applied by {!Override_apply} before + the generation pipeline builds its type-mapping context. *) + +(** What to do for a specific entity or sub-component. *) +type override_action = + | Ignore + | Set_version of string +[@@deriving sexp, eq] + +(** Override for a sub-component of an entity (method, property, etc.). *) +type component_override = { + component_name : string; + action : override_action; +} +[@@deriving sexp, eq] + +(** Override for a class. *) +type class_override = { + class_name : string; + class_action : override_action option; + constructors : component_override list; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +[@@deriving sexp, eq] + +(** Override for an interface. *) +type interface_override = { + interface_name : string; + interface_action : override_action option; + methods : component_override list; + properties : component_override list; + signals : component_override list; +} +[@@deriving sexp, eq] + +(** Override for a record. *) +type record_override = { + record_name : string; + record_action : override_action option; + fields : component_override list; + constructors : component_override list; + methods : component_override list; + functions : component_override list; + (** Record-level functions. Parsed from [(function ...)] inside a [(record ...)] block. + Distinct from top-level [library_overrides.functions] (namespace-level). *) +} +[@@deriving sexp, eq] + +(** Override for an enumeration. *) +type enum_override = { + enum_name : string; + enum_action : override_action option; + members : component_override list; + functions : component_override list; +} +[@@deriving sexp, eq] + +(** Override for a bitfield. + + The sexp format uses [(member NAME ...)] for bitfield members, matching + the enum keyword. The parser maps this to the [flags] field. *) +type bitfield_override = { + bitfield_name : string; + bitfield_action : override_action option; + flags : component_override list; + (** Populated from [(member ...)] in the sexp (same keyword as enum members). *) +} +[@@deriving sexp, eq] + +(** Top-level overrides container. *) +type library_overrides = { + library_name : string; + classes : class_override list; + interfaces : interface_override list; + records : record_override list; + enums : enum_override list; + bitfields : bitfield_override list; + functions : component_override list; + (** Standalone namespace-level functions. Parsed from [(function ...)] at the + top level of the [(overrides ...)] form, not nested inside any entity. *) +} +[@@deriving sexp, eq] diff --git a/ocgtk/src/tools/gir_gen/parse/gir_parser.ml b/ocgtk/src/tools/gir_gen/parse/gir_parser.ml index 163ca6b1c..0fd331d3d 100644 --- a/ocgtk/src/tools/gir_gen/parse/gir_parser.ml +++ b/ocgtk/src/tools/gir_gen/parse/gir_parser.ml @@ -58,15 +58,23 @@ let rec element_data input ?(str = None) () = | `El_end -> str | `El_start _ | `Dtd _ -> failwith "unwanted element inside data element" +(* Common helper: extract text content from a element, skipping nested + XML elements (e.g. , ) rather than failing on them. This is + more robust than element_data for doc strings, which can contain markup. *) +let rec parse_doc_text input ?(text = "") () = + match Xmlm.input input with + | `Data s -> parse_doc_text input ~text:(text ^ s) () + | `El_end -> if text = "" then None else Some text + | `El_start _ -> + skip_element input 1; + parse_doc_text input ~text () + | `Dtd _ -> parse_doc_text input ~text () + (* Shared: Parse enumeration element *) let parse_enumeration input ?parse_functions attrs = match (get_attr "name" attrs, get_attr "c:type" attrs) with | Some name, Some c_type -> - if Exclude_list.is_platform_specific_type name then begin - skip_element input 1; - None - end - else begin + begin let members = ref [] in let functions = ref [] in @@ -81,15 +89,28 @@ let parse_enumeration input ?parse_functions attrs = with | Some member_name, Some value_str, Some c_id -> let value = try int_of_string value_str with _ -> 0 in + let member_doc = ref None in + let rec parse_member_contents () = + match Xmlm.input input with + | `El_start ((_, tag), _) when local_name tag = "doc" -> + member_doc := parse_doc_text input (); + parse_member_contents () + | `El_start _ -> + skip_element input 1; + parse_member_contents () + | `El_end -> () + | `Data _ | `Dtd _ -> parse_member_contents () + in + parse_member_contents (); members := { member_name; member_value = value; c_identifier = c_id; - member_doc = None; + member_doc = !member_doc; + member_version = get_attr "version" member_attrs; } :: !members; - skip_element input 1; parse_enum_contents () | _ -> skip_element input 1; @@ -141,11 +162,7 @@ let merge_methods concrete virtuals = let parse_bitfield input attrs = match (get_attr "name" attrs, get_attr "c:type" attrs) with | Some name, Some c_type -> - if Exclude_list.is_platform_specific_type name then begin - skip_element input 1; - None - end - else begin + begin let flags = ref [] in let rec parse_bitfield_contents () = @@ -158,15 +175,28 @@ let parse_bitfield input attrs = with | Some flag_name, Some value_str, Some c_id -> let value = try int_of_string value_str with _ -> 0 in + let flag_doc = ref None in + let rec parse_flag_contents () = + match Xmlm.input input with + | `El_start ((_, tag), _) when local_name tag = "doc" -> + flag_doc := parse_doc_text input (); + parse_flag_contents () + | `El_start _ -> + skip_element input 1; + parse_flag_contents () + | `El_end -> () + | `Data _ | `Dtd _ -> parse_flag_contents () + in + parse_flag_contents (); flags := { flag_name; flag_value = value; flag_c_identifier = c_id; - flag_doc = None; + flag_doc = !flag_doc; + flag_version = get_attr "version" member_attrs; } :: !flags; - skip_element input 1; parse_bitfield_contents () | _ -> skip_element input 1; @@ -1089,6 +1119,7 @@ let parse_gir_file filename filter_classes = get_attr "writable" field_attrs |> Utils.parse_bool in let field_type = ref None in + let field_doc = ref None in let rec parse_field_contents () = match Xmlm.input input with @@ -1126,6 +1157,9 @@ let parse_gir_file filename filter_classes = array = array_info; }; parse_field_contents () + | `El_start ((_, tag), _) when local_name tag = "doc" -> + field_doc := parse_doc_text input (); + parse_field_contents () | `El_start _ -> skip_element input 1; parse_field_contents () @@ -1142,7 +1176,8 @@ let parse_gir_file filename filter_classes = field_type = !field_type; readable; writable; - field_doc = None; + field_doc = !field_doc; + field_version = get_attr "version" field_attrs; } :: !fields | None -> ()); diff --git a/ocgtk/src/tools/gir_gen/types.ml b/ocgtk/src/tools/gir_gen/types.ml index 42feb4f13..ea26dcec7 100644 --- a/ocgtk/src/tools/gir_gen/types.ml +++ b/ocgtk/src/tools/gir_gen/types.ml @@ -96,6 +96,7 @@ type gir_record_field = { readable : bool; writable : bool; field_doc : string option; + field_version : string option; } type gir_record = { @@ -122,6 +123,7 @@ type gir_enum_member = { member_value : int; c_identifier : string; member_doc : string option; + member_version : string option; } type gir_enum = { @@ -138,6 +140,7 @@ type gir_bitfield_member = { flag_value : int; flag_c_identifier : string; flag_doc : string option; + flag_version : string option; } type gir_bitfield = { diff --git a/ocgtk/src/tools/test_gir_gen/c_stubs/cross_namespace_tests.ml b/ocgtk/src/tools/test_gir_gen/c_stubs/cross_namespace_tests.ml index 298e99ffc..c4bd234bf 100644 --- a/ocgtk/src/tools/test_gir_gen/c_stubs/cross_namespace_tests.ml +++ b/ocgtk/src/tools/test_gir_gen/c_stubs/cross_namespace_tests.ml @@ -336,6 +336,7 @@ let test_record_copy_parses_successfully () = readable = true; writable = true; field_doc = None; + field_version = None; }; ]; constructors = []; @@ -512,6 +513,7 @@ let test_enum_array_element_conversion () = member_value = 0; c_identifier = "PANGO_SCRIPT_INVALID"; member_doc = None; + member_version = None; }; ]; functions = []; @@ -664,6 +666,7 @@ let test_bitfield_array_element_conversion () = flag_value = 1; flag_c_identifier = "GTK_APPLICATION_INHIBIT_LOGOUT"; flag_doc = None; + flag_version = None; }; ]; bitfield_doc = None; @@ -818,6 +821,7 @@ let test_inout_record_param_pointer_type () = readable = true; writable = true; field_doc = None; + field_version = None; }; ]; constructors = []; @@ -1554,12 +1558,14 @@ let test_gdkpixbuf_format_flags_guarded () = flag_value = 1; flag_c_identifier = "GDK_PIXBUF_FORMAT_WRITABLE"; flag_doc = None; + flag_version = None; }; { flag_name = "SCALABLE"; flag_value = 2; flag_c_identifier = "GDK_PIXBUF_FORMAT_SCALABLE"; flag_doc = None; + flag_version = None; }; ]; bitfield_doc = None; @@ -1625,6 +1631,7 @@ let test_normal_bitfield_no_guard () = flag_value = 1; flag_c_identifier = "GTK_APPLICATION_INHIBIT_LOGOUT"; flag_doc = None; + flag_version = None; }; ]; bitfield_doc = None; diff --git a/ocgtk/src/tools/test_gir_gen/c_stubs/header_generation_tests.ml b/ocgtk/src/tools/test_gir_gen/c_stubs/header_generation_tests.ml index 59befdca2..70e96e09f 100644 --- a/ocgtk/src/tools/test_gir_gen/c_stubs/header_generation_tests.ml +++ b/ocgtk/src/tools/test_gir_gen/c_stubs/header_generation_tests.ml @@ -40,12 +40,14 @@ let create_context_with_mixed_enums () = member_value = 0; c_identifier = "GTK_WRAP_NONE"; member_doc = None; + member_version = None; }; { member_name = "WORD"; member_value = 1; c_identifier = "GTK_WRAP_WORD"; member_doc = None; + member_version = None; }; ]; functions = []; @@ -98,12 +100,14 @@ let create_context_with_mixed_bitfields () = flag_value = 0; flag_c_identifier = "GTK_STATE_FLAG_NORMAL"; flag_doc = None; + flag_version = None; }; { flag_name = "ACTIVE"; flag_value = 1; flag_c_identifier = "GTK_STATE_FLAG_ACTIVE"; flag_doc = None; + flag_version = None; }; ]; bitfield_doc = None; diff --git a/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_bitfield_decls_tests.ml b/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_bitfield_decls_tests.ml index 54b286a0e..8bb8e558c 100644 --- a/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_bitfield_decls_tests.ml +++ b/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_bitfield_decls_tests.ml @@ -34,12 +34,14 @@ let create_context_with_external_bitfield () = flag_value = 0; flag_c_identifier = "GTK_STATE_FLAG_NORMAL"; flag_doc = None; + flag_version = None; }; { flag_name = "ACTIVE"; flag_value = 1; flag_c_identifier = "GTK_STATE_FLAG_ACTIVE"; flag_doc = None; + flag_version = None; }; ]; bitfield_doc = None; diff --git a/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_enum_decls_tests.ml b/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_enum_decls_tests.ml index b138ff7a6..f9ad18041 100644 --- a/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_enum_decls_tests.ml +++ b/ocgtk/src/tools/test_gir_gen/cross_namespace/no_external_enum_decls_tests.ml @@ -34,12 +34,14 @@ let create_context_with_external_enum () = member_value = 0; c_identifier = "GTK_WRAP_NONE"; member_doc = None; + member_version = None; }; { member_name = "WORD"; member_value = 1; c_identifier = "GTK_WRAP_WORD"; member_doc = None; + member_version = None; }; ]; functions = []; diff --git a/ocgtk/src/tools/test_gir_gen/dune b/ocgtk/src/tools/test_gir_gen/dune index 6b439d242..f6eb3c5b2 100644 --- a/ocgtk/src/tools/test_gir_gen/dune +++ b/ocgtk/src/tools/test_gir_gen/dune @@ -40,9 +40,15 @@ classify_type_tests integration_tests compilation_tests - version_guard_tests - c_stub_version_guard_tests - test_gir_gen - type_factory) + version_guard_tests + c_stub_version_guard_tests + test_override_types + test_override_parser + test_override_apply + test_override_extractor + test_override_e2e + test_enum_member_version + test_gir_gen + type_factory) (deps %{exe:../gir_gen/gir_gen.exe}) - (libraries str unix gir_gen_lib alcotest ppxlib)) + (libraries str unix gir_gen_lib alcotest ppxlib sexplib)) diff --git a/ocgtk/src/tools/test_gir_gen/test_enum_member_version.ml b/ocgtk/src/tools/test_gir_gen/test_enum_member_version.ml new file mode 100644 index 000000000..feeeaa4c3 --- /dev/null +++ b/ocgtk/src/tools/test_gir_gen/test_enum_member_version.ml @@ -0,0 +1,214 @@ +(* Tests for per-member version guards in enum and bitfield C converters. + Validates that generate_c_enum_converters and generate_c_bitfield_converters + emit correct #if/#else/#endif guards when member_version / flag_version is set. *) + +open Gir_gen_lib.Types +open Gir_gen_lib.Generate.Enum_code + +(* ========================================================================= *) +(* Helpers *) +(* ========================================================================= *) + +(** Check that [sub] appears as a substring of [s]. *) +let contains s sub = + let n = String.length sub in + let m = String.length s in + if n = 0 then true + else + let rec loop i = + if i + n > m then false + else if String.sub s i n = sub then true + else loop (i + 1) + in + loop 0 + +let assert_contains ~label ~expected actual = + if not (contains actual expected) then + Alcotest.failf "%s: expected substring %S in:\n%s" label expected actual + +let assert_not_contains ~label ~unexpected actual = + if contains actual unexpected then + Alcotest.failf "%s: unexpected substring %S found in:\n%s" label unexpected actual + +(* ========================================================================= *) +(* Enum member builders *) +(* ========================================================================= *) + +let make_member ~name ~c_identifier ~value ?member_version () = + { member_name = name; member_value = value; c_identifier; + member_doc = None; member_version } + +let make_enum ~name ~c_type members = + { enum_name = name; enum_c_type = c_type; members; + functions = []; enum_doc = None; enum_version = None } + +(* ========================================================================= *) +(* Bitfield member builders *) +(* ========================================================================= *) + +let make_flag ~name ~c_identifier ~value ?flag_version () = + { flag_name = name; flag_value = value; flag_c_identifier = c_identifier; + flag_doc = None; flag_version } + +let make_bitfield ~name ~c_type flags = + { bitfield_name = name; bitfield_c_type = c_type; flags; + bitfield_doc = None; bitfield_version = None } + +(* ========================================================================= *) +(* Enum test 1: no versions at all → no guards *) +(* ========================================================================= *) + +let test_enum_no_version () = + let member = make_member ~name:"none" ~c_identifier:"GTK_WRAP_NONE" ~value:0 () in + let enum = make_enum ~name:"WrapMode" ~c_type:"GtkWrapMode" [member] in + let output = generate_c_enum_converters ~namespace:"Gtk" ~class_version:None enum in + assert_not_contains ~label:"no #if guard" ~unexpected:"#if" output; + assert_not_contains ~label:"no caml_failwith guard" ~unexpected:"#else" output; + assert_contains ~label:"case line present" ~expected:"GTK_WRAP_NONE" output + +(* ========================================================================= *) +(* Enum test 2: member_version set, class_version = None → Member_guard *) +(* ========================================================================= *) + +let test_enum_member_version_no_class () = + let member = make_member ~name:"stretch" + ~c_identifier:"GTK_WRAP_STRETCH" ~value:4 + ~member_version:"4.14" () in + let enum = make_enum ~name:"WrapMode" ~c_type:"GtkWrapMode" [member] in + let output = generate_c_enum_converters ~namespace:"Gtk" ~class_version:None enum in + (* C->OCaml: case line wrapped in #if / #endif, no #else *) + assert_contains ~label:"c_to_ocaml: opening #if" ~expected:"#if GTK_CHECK_VERSION(4,14,0)" output; + assert_contains ~label:"c_to_ocaml: case line" ~expected:"GTK_WRAP_STRETCH" output; + assert_contains ~label:"c_to_ocaml: closing #endif" ~expected:"#endif" output; + (* OCaml->C: if-branch wrapped in #if / #else caml_failwith / #endif *) + assert_contains ~label:"ocaml_to_c: #else present" ~expected:"#else" output; + assert_contains ~label:"ocaml_to_c: caml_failwith in #else" ~expected:"caml_failwith" output + +(* ========================================================================= *) +(* Enum test 3: member_version == class_version → Class_guard, no inner guard *) +(* ========================================================================= *) + +let test_enum_member_version_equals_class () = + let member = make_member ~name:"stretch" + ~c_identifier:"GTK_WRAP_STRETCH" ~value:4 + ~member_version:"4.10" () in + let enum = make_enum ~name:"WrapMode" ~c_type:"GtkWrapMode" [member] in + let output = generate_c_enum_converters ~namespace:"Gtk" ~class_version:(Some "4.10") enum in + (* resolve_guard returns Class_guard → no inner #if *) + assert_not_contains ~label:"no inner #if" ~unexpected:"#if" output; + assert_contains ~label:"case line present" ~expected:"GTK_WRAP_STRETCH" output + +(* ========================================================================= *) +(* Enum test 4: member_version older than class_version → Class_guard, no inner guard *) +(* ========================================================================= *) + +let test_enum_member_version_older_than_class () = + let member = make_member ~name:"stretch" + ~c_identifier:"GTK_WRAP_STRETCH" ~value:4 + ~member_version:"4.8" () in + let enum = make_enum ~name:"WrapMode" ~c_type:"GtkWrapMode" [member] in + let output = generate_c_enum_converters ~namespace:"Gtk" ~class_version:(Some "4.14") enum in + (* resolve_guard returns Class_guard → no inner #if *) + assert_not_contains ~label:"no inner #if" ~unexpected:"#if" output; + assert_contains ~label:"case line present" ~expected:"GTK_WRAP_STRETCH" output + +(* ========================================================================= *) +(* Enum test 5: member_version newer than class_version → Member_guard *) +(* ========================================================================= *) + +let test_enum_member_version_newer_than_class () = + let member = make_member ~name:"stretch" + ~c_identifier:"GTK_WRAP_STRETCH" ~value:4 + ~member_version:"4.16" () in + let enum = make_enum ~name:"WrapMode" ~c_type:"GtkWrapMode" [member] in + let output = generate_c_enum_converters ~namespace:"Gtk" ~class_version:(Some "4.14") enum in + assert_contains ~label:"inner #if for 4.16" ~expected:"#if GTK_CHECK_VERSION(4,16,0)" output; + assert_contains ~label:"case line present" ~expected:"GTK_WRAP_STRETCH" output; + assert_contains ~label:"#else present" ~expected:"#else" output; + assert_contains ~label:"#endif present" ~expected:"#endif" output + +(* ========================================================================= *) +(* Enum test 6: mixed members — unversioned and versioned in same enum *) +(* ========================================================================= *) + +let test_enum_mixed_members () = + let m1 = make_member ~name:"none" ~c_identifier:"GTK_WRAP_NONE" ~value:0 () in + let m2 = make_member ~name:"stretch" + ~c_identifier:"GTK_WRAP_STRETCH" ~value:4 + ~member_version:"4.14" () in + let enum = make_enum ~name:"WrapMode" ~c_type:"GtkWrapMode" [m1; m2] in + let output = generate_c_enum_converters ~namespace:"Gtk" ~class_version:None enum in + (* First member has no guard *) + assert_contains ~label:"unguarded member present" ~expected:"GTK_WRAP_NONE" output; + (* Second member is guarded *) + assert_contains ~label:"guard for versioned member" ~expected:"#if GTK_CHECK_VERSION(4,14,0)" output; + assert_contains ~label:"versioned member present" ~expected:"GTK_WRAP_STRETCH" output; + assert_contains ~label:"#else for versioned member" ~expected:"#else" output + +(* ========================================================================= *) +(* Bitfield test 7: no versions → no guards *) +(* ========================================================================= *) + +let test_bitfield_no_version () = + let flag = make_flag ~name:"normal" ~c_identifier:"GTK_STATE_FLAG_NORMAL" ~value:0 () in + let bitfield = make_bitfield ~name:"StateFlags" ~c_type:"GtkStateFlags" [flag] in + let output = generate_c_bitfield_converters ~namespace:"Gtk" ~class_version:None bitfield in + assert_not_contains ~label:"no #if guard" ~unexpected:"#if" output; + assert_not_contains ~label:"no #else guard" ~unexpected:"#else" output; + assert_contains ~label:"flag present" ~expected:"GTK_STATE_FLAG_NORMAL" output + +(* ========================================================================= *) +(* Bitfield test 8: flag_version set, class_version = None → Member_guard *) +(* ========================================================================= *) + +let test_bitfield_flag_version () = + let flag = make_flag ~name:"focus_within" + ~c_identifier:"GTK_STATE_FLAG_FOCUS_WITHIN" ~value:512 + ~flag_version:"4.14" () in + let bitfield = make_bitfield ~name:"StateFlags" ~c_type:"GtkStateFlags" [flag] in + let output = generate_c_bitfield_converters ~namespace:"Gtk" ~class_version:None bitfield in + (* C->OCaml: if-block wrapped in #if / #endif, no #else *) + assert_contains ~label:"c_to_ocaml: opening #if" ~expected:"#if GTK_CHECK_VERSION(4,14,0)" output; + assert_contains ~label:"c_to_ocaml: flag check present" ~expected:"GTK_STATE_FLAG_FOCUS_WITHIN" output; + assert_contains ~label:"c_to_ocaml: closing #endif" ~expected:"#endif" output; + (* OCaml->C: tag-match wrapped in #if / #else caml_failwith / #endif *) + assert_contains ~label:"ocaml_to_c: #else present" ~expected:"#else" output; + assert_contains ~label:"ocaml_to_c: caml_failwith in #else" ~expected:"caml_failwith" output + +(* ========================================================================= *) +(* Bitfield test 9: flag_version <= class_version → Class_guard, no inner guard *) +(* ========================================================================= *) + +let test_bitfield_flag_covered_by_class () = + let flag = make_flag ~name:"focus_within" + ~c_identifier:"GTK_STATE_FLAG_FOCUS_WITHIN" ~value:512 + ~flag_version:"4.10" () in + let bitfield = make_bitfield ~name:"StateFlags" ~c_type:"GtkStateFlags" [flag] in + let output = generate_c_bitfield_converters ~namespace:"Gtk" ~class_version:(Some "4.14") bitfield in + (* resolve_guard returns Class_guard → no inner #if *) + assert_not_contains ~label:"no inner #if" ~unexpected:"#if" output; + assert_contains ~label:"flag present" ~expected:"GTK_STATE_FLAG_FOCUS_WITHIN" output + +(* ========================================================================= *) +(* Test suite *) +(* ========================================================================= *) + +let test_suite = + [ + Alcotest.test_case "enum no version" `Quick test_enum_no_version; + Alcotest.test_case "enum member_version, no class_version" `Quick + test_enum_member_version_no_class; + Alcotest.test_case "enum member_version equals class_version" `Quick + test_enum_member_version_equals_class; + Alcotest.test_case "enum member_version older than class_version" `Quick + test_enum_member_version_older_than_class; + Alcotest.test_case "enum member_version newer than class_version" `Quick + test_enum_member_version_newer_than_class; + Alcotest.test_case "enum mixed members (unversioned + versioned)" `Quick + test_enum_mixed_members; + Alcotest.test_case "bitfield no version" `Quick test_bitfield_no_version; + Alcotest.test_case "bitfield flag_version, no class_version" `Quick + test_bitfield_flag_version; + Alcotest.test_case "bitfield flag covered by class_version" `Quick + test_bitfield_flag_covered_by_class; + ] diff --git a/ocgtk/src/tools/test_gir_gen/test_gir_gen.ml b/ocgtk/src/tools/test_gir_gen/test_gir_gen.ml index bf088ed0c..bf47adc98 100644 --- a/ocgtk/src/tools/test_gir_gen/test_gir_gen.ml +++ b/ocgtk/src/tools/test_gir_gen/test_gir_gen.ml @@ -40,4 +40,11 @@ let () = ("classify_type + Array Resolution (Phase 6)", Classify_type_tests.tests); ("Version Guard", Version_guard_tests.test_suite); ("C Stub Version Guards", C_stub_version_guard_tests.test_suite); + ("Override Types", Test_override_types.test_suite); + ("Override Parser", Test_override_parser.test_suite); + ("Override Parser Roundtrip", Test_override_parser.test_suite_roundtrip); + ("Override Apply", Test_override_apply.test_suite); + ("Override Extractor", Test_override_extractor.test_suite); + ("Override E2E", Test_override_e2e.test_suite); + ("Enum Member Version Guards", Test_enum_member_version.test_suite); ] diff --git a/ocgtk/src/tools/test_gir_gen/test_override_apply.ml b/ocgtk/src/tools/test_gir_gen/test_override_apply.ml new file mode 100644 index 000000000..47aa4c75b --- /dev/null +++ b/ocgtk/src/tools/test_gir_gen/test_override_apply.ml @@ -0,0 +1,594 @@ +(* Tests for Gir_gen_lib.Override_apply. *) + +open Gir_gen_lib.Types +open Gir_gen_lib.Override_types + +(* Helpers *) + +let hd_exn msg = function + | [] -> Alcotest.fail msg + | x :: _ -> x + +let find_exn msg pred list = + match List.find_opt pred list with + | None -> Alcotest.fail msg + | Some x -> x + +(* Minimal GIR data constructors for testing *) + +let make_method ~name ~version = + { + method_name = name; + c_identifier = "gtk_test_" ^ name; + return_type = + { name = "void"; c_type = None; nullable = false; + transfer_ownership = TransferNone; array = None }; + parameters = []; + doc = None; + throws = false; + get_property = None; + set_property = None; + introspectable = true; + version; + } + +let make_constructor ~name ~version = + { + ctor_name = name; + c_identifier = "gtk_test_" ^ name; + ctor_parameters = []; + ctor_doc = None; + throws = false; + ctor_introspectable = true; + version; + } + +let make_property ~name ~version = + { + prop_name = name; + prop_type = + { name = "gboolean"; c_type = Some "gboolean"; nullable = false; + transfer_ownership = TransferNone; array = None }; + readable = true; + writable = true; + construct_only = false; + prop_doc = None; + version; + } + +let make_signal ~name ~version = + { + signal_name = name; + return_type = + { name = "void"; c_type = None; nullable = false; + transfer_ownership = TransferNone; array = None }; + sig_parameters = []; + doc = None; + version; + } + +let make_class ~name ~version ~methods ~constructors ~properties ~signals = + { + class_name = name; + c_type = "Gtk" ^ name; + parent = None; + implements = []; + introspectable = true; + constructors; + methods; + properties; + signals; + class_doc = None; + version; + } + +let make_interface ~name ~version ~methods ~properties ~signals = + { + interface_name = name; + c_type = "Gtk" ^ name; + c_symbol_prefix = String.lowercase_ascii name; + methods; + properties; + signals; + interface_doc = None; + version; + } + +let make_record_field ~name ~version = + { + field_name = name; + field_type = None; + readable = true; + writable = true; + field_doc = None; + field_version = version; + } + +let make_record ~name ~version ~fields ~constructors ~methods ~functions = + { + record_name = name; + c_type = "Gtk" ^ name; + glib_type_name = None; + glib_get_type = None; + opaque = false; + disguised = false; + introspectable = true; + c_symbol_prefix = None; + is_gtype_struct_for = None; + fields; + constructors; + methods; + functions; + record_doc = None; + version; + } + +let make_enum_member ~name ~version = + { + member_name = name; + member_value = 0; + c_identifier = "GTK_TEST_" ^ name; + member_doc = None; + member_version = version; + } + +let make_enum ~name ~version ~members ~functions = + { + enum_name = name; + enum_c_type = "Gtk" ^ name; + members; + functions; + enum_doc = None; + enum_version = version; + } + +let make_bitfield_member ~name ~version = + { + flag_name = name; + flag_value = 1; + flag_c_identifier = "GTK_TEST_" ^ name; + flag_doc = None; + flag_version = version; + } + +let make_bitfield ~name ~version ~flags = + { + bitfield_name = name; + bitfield_c_type = "Gtk" ^ name; + flags; + bitfield_doc = None; + bitfield_version = version; + } + +let make_function ~name ~version = + { + function_name = name; + c_identifier = "gtk_test_" ^ name; + return_type = + { name = "void"; c_type = None; nullable = false; + transfer_ownership = TransferNone; array = None }; + parameters = []; + doc = None; + throws = false; + introspectable = true; + version; + } + +let make_empty_overrides library_name = + { + library_name; + classes = []; + interfaces = []; + records = []; + enums = []; + bitfields = []; + functions = []; + } + +(* Tests: Class overrides *) + +let test_class_ignore () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[] ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = Some Ignore; + constructors = []; methods = []; properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "classes filtered" 0 (List.length result.classes); + Alcotest.(check int) "ignored" 1 (List.length result.ignored_entities); + let ignored = hd_exn "Expected ignored entity" result.ignored_entities in + Alcotest.(check string) "ignored name" "Widget" ignored + +let test_class_ignore_preserves_surviving () = + let cls1 = make_class ~name:"Widget" ~version:None + ~methods:[] ~constructors:[] ~properties:[] ~signals:[] in + let cls2 = make_class ~name:"Button" ~version:None + ~methods:[] ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = Some Ignore; + constructors = []; methods = []; properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls1; cls2] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "one surviving" 1 (List.length result.classes); + let surviving = hd_exn "Expected surviving class" result.classes in + Alcotest.(check string) "surviving name" "Button" surviving.class_name + +let test_method_ignore () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[make_method ~name:"show" ~version:None; + make_method ~name:"hide" ~version:None] + ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = []; + methods = [{ component_name = "show"; action = Ignore }]; + properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving_cls = hd_exn "Expected one class" result.classes in + Alcotest.(check int) "one method remaining" 1 (List.length surviving_cls.methods); + let remaining = hd_exn "Expected one method" surviving_cls.methods in + Alcotest.(check string) "remaining method" "hide" remaining.method_name + +let test_method_version_override () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[make_method ~name:"show" ~version:None] + ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = []; + methods = [{ component_name = "show"; action = Set_version "4.10" }]; + properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving_cls = hd_exn "Expected one class" result.classes in + let m = hd_exn "Expected one method" surviving_cls.methods in + Alcotest.(check bool) "version set" true (m.version = Some "4.10") + +let test_method_version_replaces_existing () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[make_method ~name:"show" ~version:(Some "4.8")] + ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = []; + methods = [{ component_name = "show"; action = Set_version "4.12" }]; + properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving_cls = hd_exn "Expected one class" result.classes in + let m = hd_exn "Expected one method" surviving_cls.methods in + Alcotest.(check bool) "version replaced" true (m.version = Some "4.12") + +let test_constructor_ignore () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[] + ~constructors:[make_constructor ~name:"new" ~version:None] + ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = [{ component_name = "new"; action = Ignore }]; + methods = []; properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving_cls = hd_exn "Expected one class" result.classes in + Alcotest.(check int) "no constructors" 0 (List.length surviving_cls.constructors) + +let test_property_version_override () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[] ~constructors:[] + ~properties:[make_property ~name:"sensitive" ~version:None] + ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = []; methods = []; + properties = [{ component_name = "sensitive"; action = Set_version "4.10" }]; + signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving_cls = hd_exn "Expected one class" result.classes in + let p = hd_exn "Expected one property" surviving_cls.properties in + Alcotest.(check bool) "prop version" true (p.version = Some "4.10") + +let test_signal_ignore () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[] ~constructors:[] + ~properties:[] + ~signals:[make_signal ~name:"destroy" ~version:None] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = []; methods = []; properties = []; + signals = [{ component_name = "destroy"; action = Ignore }] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving_cls = hd_exn "Expected one class" result.classes in + Alcotest.(check int) "no signals" 0 (List.length surviving_cls.signals) + +(* Tests: Interface overrides *) + +let test_interface_method_ignore () = + let intf = make_interface ~name:"Actionable" ~version:None + ~methods:[make_method ~name:"get_action_name" ~version:None; + make_method ~name:"set_action_name" ~version:None] + ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + interfaces = [{ interface_name = "Actionable"; interface_action = None; + methods = [{ component_name = "get_action_name"; action = Ignore }]; + properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[intf] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + let surviving = hd_exn "Expected one interface" result.interfaces in + Alcotest.(check int) "one method" 1 (List.length surviving.methods); + let m = hd_exn "Expected one method" surviving.methods in + Alcotest.(check string) "remaining method" "set_action_name" m.method_name + +let test_interface_ignore () = + let intf = make_interface ~name:"Actionable" ~version:None + ~methods:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + interfaces = [{ interface_name = "Actionable"; interface_action = Some Ignore; + methods = []; properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[intf] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "no interfaces" 0 (List.length result.interfaces) + +(* Tests: Record overrides *) + +let test_record_field_ignore () = + let rec_ = make_record ~name:"TextIter" ~version:None + ~fields:[make_record_field ~name:"user_data" ~version:None; + make_record_field ~name:"start" ~version:None] + ~constructors:[] ~methods:[] ~functions:[] in + let overrides = { (make_empty_overrides "Gtk") with + records = [{ record_name = "TextIter"; record_action = None; + fields = [{ component_name = "user_data"; action = Ignore }]; + constructors = []; methods = []; functions = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[rec_] ~functions:[] in + let surviving = hd_exn "Expected one record" result.records in + Alcotest.(check int) "one field" 1 (List.length surviving.fields); + let f = hd_exn "Expected one field" surviving.fields in + Alcotest.(check string) "remaining field" "start" f.field_name + +let test_record_field_version_override () = + let rec_ = make_record ~name:"TextIter" ~version:None + ~fields:[make_record_field ~name:"start" ~version:None] + ~constructors:[] ~methods:[] ~functions:[] in + let overrides = { (make_empty_overrides "Gtk") with + records = [{ record_name = "TextIter"; record_action = None; + fields = [{ component_name = "start"; action = Set_version "4.14" }]; + constructors = []; methods = []; functions = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[rec_] ~functions:[] in + let surviving = hd_exn "Expected one record" result.records in + let f = hd_exn "Expected one field" surviving.fields in + Alcotest.(check bool) "field version" true (f.field_version = Some "4.14") + +let test_record_ignore () = + let rec_ = make_record ~name:"PrintBackend" ~version:None + ~fields:[] ~constructors:[] ~methods:[] ~functions:[] in + let overrides = { (make_empty_overrides "Gtk") with + records = [{ record_name = "PrintBackend"; record_action = Some Ignore; + fields = []; constructors = []; methods = []; functions = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[rec_] ~functions:[] in + Alcotest.(check int) "no records" 0 (List.length result.records) + +(* Tests: Enum overrides *) + +let test_enum_member_ignore () = + let enm = make_enum ~name:"RGBA" ~version:None + ~members:[make_enum_member ~name:"RED" ~version:None; + make_enum_member ~name:"GREEN" ~version:None] + ~functions:[] in + let overrides = { (make_empty_overrides "Gtk") with + enums = [{ enum_name = "RGBA"; enum_action = None; + members = [{ component_name = "RED"; action = Ignore }]; + functions = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[enm] ~bitfields:[] ~records:[] ~functions:[] in + let surviving = hd_exn "Expected one enum" result.enums in + Alcotest.(check int) "one member" 1 (List.length surviving.members); + let m = hd_exn "Expected one member" surviving.members in + Alcotest.(check string) "remaining member" "GREEN" m.member_name + +let test_enum_member_version_override () = + let enm = make_enum ~name:"RGBA" ~version:None + ~members:[make_enum_member ~name:"RED" ~version:None] + ~functions:[] in + let overrides = { (make_empty_overrides "Gtk") with + enums = [{ enum_name = "RGBA"; enum_action = None; + members = [{ component_name = "RED"; action = Set_version "4.14" }]; + functions = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[enm] ~bitfields:[] ~records:[] ~functions:[] in + let surviving = hd_exn "Expected one enum" result.enums in + let m = hd_exn "Expected one member" surviving.members in + Alcotest.(check bool) "member version" true (m.member_version = Some "4.14") + +let test_enum_ignore () = + let enm = make_enum ~name:"License" ~version:None + ~members:[] ~functions:[] in + let overrides = { (make_empty_overrides "Gtk") with + enums = [{ enum_name = "License"; enum_action = Some Ignore; + members = []; functions = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[enm] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "no enums" 0 (List.length result.enums) + +(* Tests: Bitfield overrides *) + +let test_bitfield_member_ignore () = + let bf = make_bitfield ~name:"StateFlags" ~version:None + ~flags:[make_bitfield_member ~name:"ACTIVE" ~version:None; + make_bitfield_member ~name:"NORMAL" ~version:None] in + let overrides = { (make_empty_overrides "Gtk") with + bitfields = [{ bitfield_name = "StateFlags"; bitfield_action = None; + flags = [{ component_name = "ACTIVE"; action = Ignore }] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[bf] ~records:[] ~functions:[] in + let surviving = hd_exn "Expected one bitfield" result.bitfields in + Alcotest.(check int) "one flag" 1 (List.length surviving.flags); + let f = hd_exn "Expected one flag" surviving.flags in + Alcotest.(check string) "remaining flag" "NORMAL" f.flag_name + +let test_bitfield_member_version_override () = + let bf = make_bitfield ~name:"StateFlags" ~version:None + ~flags:[make_bitfield_member ~name:"ACTIVE" ~version:None] in + let overrides = { (make_empty_overrides "Gtk") with + bitfields = [{ bitfield_name = "StateFlags"; bitfield_action = None; + flags = [{ component_name = "ACTIVE"; action = Set_version "4.14" }] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[bf] ~records:[] ~functions:[] in + let surviving = hd_exn "Expected one bitfield" result.bitfields in + let f = hd_exn "Expected one flag" surviving.flags in + Alcotest.(check bool) "flag version" true (f.flag_version = Some "4.14") + +(* Tests: Standalone function overrides *) + +let test_function_ignore () = + let fn = make_function ~name:"gtk_show_uri" ~version:None in + let overrides = { (make_empty_overrides "Gtk") with + functions = [{ component_name = "gtk_show_uri"; action = Ignore }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[fn] in + Alcotest.(check int) "no functions" 0 (List.length result.functions) + +(* Tests: Empty overrides *) + +let test_empty_overrides_no_changes () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[make_method ~name:"show" ~version:None] + ~constructors:[] ~properties:[] ~signals:[] in + let intf = make_interface ~name:"Actionable" ~version:None + ~methods:[] ~properties:[] ~signals:[] in + let overrides = make_empty_overrides "Gtk" in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[intf] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "classes unchanged" 1 (List.length result.classes); + Alcotest.(check int) "interfaces unchanged" 1 (List.length result.interfaces); + Alcotest.(check int) "no ignored" 0 (List.length result.ignored_entities); + Alcotest.(check int) "no warnings" 0 (List.length result.warnings) + +(* Tests: Warnings for unknown names *) + +let test_unknown_class_warning () = + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "NonExistent"; class_action = Some Ignore; + constructors = []; methods = []; properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "no classes" 0 (List.length result.classes); + Alcotest.(check bool) "has warning" true (List.length result.warnings > 0); + let w = hd_exn "Expected warning" result.warnings in + Alcotest.(check bool) "mentions unknown class" true + (String.length w > 0 && String.contains w 'c') + +let test_unknown_component_warning () = + let cls = make_class ~name:"Widget" ~version:None + ~methods:[make_method ~name:"show" ~version:None] + ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = None; + constructors = []; + methods = [{ component_name = "nonexistent_method"; action = Ignore }]; + properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "class kept" 1 (List.length result.classes); + Alcotest.(check bool) "has warning" true (List.length result.warnings > 0) + +let test_class_ignore_no_component_warnings () = + (* When a class is ignored, component overrides under it should be silently + skipped — no warnings for unknown components on an ignored class. *) + let cls = make_class ~name:"Widget" ~version:None + ~methods:[] ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [{ class_name = "Widget"; class_action = Some Ignore; + constructors = []; + methods = [{ component_name = "nonexistent"; action = Ignore }]; + properties = []; signals = [] }]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "no classes" 0 (List.length result.classes); + Alcotest.(check int) "no warnings" 0 (List.length result.warnings) + +(* Tests: Combined overrides *) + +let test_combined_class_and_component () = + let cls1 = make_class ~name:"Widget" ~version:None + ~methods:[make_method ~name:"show" ~version:None] + ~constructors:[] ~properties:[] ~signals:[] in + let cls2 = make_class ~name:"Button" ~version:None + ~methods:[make_method ~name:"clicked" ~version:None; + make_method ~name:"activate" ~version:None] + ~constructors:[] ~properties:[] ~signals:[] in + let overrides = { (make_empty_overrides "Gtk") with + classes = [ + { class_name = "Widget"; class_action = Some Ignore; + constructors = []; methods = []; properties = []; signals = [] }; + { class_name = "Button"; class_action = None; + constructors = []; + methods = [{ component_name = "activate"; action = Ignore }]; + properties = []; signals = [] }; + ]; + } in + let result = Gir_gen_lib.Override_apply.apply_overrides ~overrides + ~classes:[cls1; cls2] ~interfaces:[] ~enums:[] ~bitfields:[] ~records:[] ~functions:[] in + Alcotest.(check int) "one class" 1 (List.length result.classes); + let surviving = hd_exn "Expected Button" result.classes in + Alcotest.(check string) "surviving class" "Button" surviving.class_name; + Alcotest.(check int) "one method" 1 (List.length surviving.methods); + let m = hd_exn "Expected one method" surviving.methods in + Alcotest.(check string) "remaining method" "clicked" m.method_name + +let test_suite = + [ + ("class ignore", `Quick, test_class_ignore); + ("class ignore preserves surviving", `Quick, test_class_ignore_preserves_surviving); + ("method ignore", `Quick, test_method_ignore); + ("method version override", `Quick, test_method_version_override); + ("method version replaces existing", `Quick, test_method_version_replaces_existing); + ("constructor ignore", `Quick, test_constructor_ignore); + ("property version override", `Quick, test_property_version_override); + ("signal ignore", `Quick, test_signal_ignore); + ("interface method ignore", `Quick, test_interface_method_ignore); + ("interface ignore", `Quick, test_interface_ignore); + ("record field ignore", `Quick, test_record_field_ignore); + ("record field version override", `Quick, test_record_field_version_override); + ("record ignore", `Quick, test_record_ignore); + ("enum member ignore", `Quick, test_enum_member_ignore); + ("enum member version override", `Quick, test_enum_member_version_override); + ("enum ignore", `Quick, test_enum_ignore); + ("bitfield member ignore", `Quick, test_bitfield_member_ignore); + ("bitfield member version override", `Quick, test_bitfield_member_version_override); + ("standalone function ignore", `Quick, test_function_ignore); + ("empty overrides no changes", `Quick, test_empty_overrides_no_changes); + ("unknown class warning", `Quick, test_unknown_class_warning); + ("unknown component warning", `Quick, test_unknown_component_warning); + ("class ignore no component warnings", `Quick, test_class_ignore_no_component_warnings); + ("combined class and component", `Quick, test_combined_class_and_component); + ] diff --git a/ocgtk/src/tools/test_gir_gen/test_override_e2e.ml b/ocgtk/src/tools/test_gir_gen/test_override_e2e.ml new file mode 100644 index 000000000..d597d6e53 --- /dev/null +++ b/ocgtk/src/tools/test_gir_gen/test_override_e2e.ml @@ -0,0 +1,161 @@ +(* End-to-end smoke test for the override pipeline. + * + * Parses a synthetic GIR XML string, applies programmatic overrides + * (ignore Button class, ignore Widget.create method), and asserts on + * the apply_overrides result. + *) + +open Gir_gen_lib.Override_types + +(* Minimal synthetic GIR XML with two classes and a few methods. *) +let synthetic_gir_xml = + {| + + + + + + + + + + + + + + + + + + + + + + + + + + + +|} + +(* Write [content] to a fresh temporary file and return its path. *) +let write_temp_file content = + let tmp = Filename.temp_file "test_override_e2e" ".gir" in + let oc = open_out tmp in + output_string oc content; + close_out oc; + tmp + +(* Programmatic overrides: ignore Button, ignore Widget.create *) +let test_overrides = + { + library_name = "Gtk"; + classes = + [ + { + class_name = "Button"; + class_action = Some Ignore; + constructors = []; + methods = []; + properties = []; + signals = []; + }; + { + class_name = "Widget"; + class_action = None; + constructors = []; + methods = [ { component_name = "create"; action = Ignore } ]; + properties = []; + signals = []; + }; + ]; + interfaces = []; + records = []; + enums = []; + bitfields = []; + functions = []; + } + +(* E2E test: parse synthetic GIR, apply overrides, check results. *) +let test_e2e_ignore_class_and_method () = + let tmp = write_temp_file synthetic_gir_xml in + Fun.protect + ~finally:(fun () -> Sys.remove tmp) + (fun () -> + let _repository, _namespace, classes, interfaces, enums, bitfields, records = + Gir_gen_lib.Parse.Gir_parser.parse_gir_file tmp [] + in + let result = + Gir_gen_lib.Override_apply.apply_overrides ~overrides:test_overrides + ~classes ~interfaces ~enums ~bitfields ~records ~functions:[] + in + + (* Button should be absent from classes *) + let button_present = + List.exists + (fun (c : Gir_gen_lib.Types.gir_class) -> + String.equal c.class_name "Button") + result.classes + in + Alcotest.(check bool) "Button absent from classes" false button_present; + + (* Button should appear in ignored_entities *) + let button_ignored = + List.exists (fun s -> String.equal s "Button") result.ignored_entities + in + Alcotest.(check bool) "Button in ignored_entities" true button_ignored; + + (* Widget should still be present *) + let widget_opt = + List.find_opt + (fun (c : Gir_gen_lib.Types.gir_class) -> + String.equal c.class_name "Widget") + result.classes + in + Alcotest.(check bool) "Widget present in classes" true + (Option.is_some widget_opt); + + (* Widget.create should be absent from Widget's methods *) + let widget = Option.get widget_opt in + let create_present = + List.exists + (fun (m : Gir_gen_lib.Types.gir_method) -> + String.equal m.method_name "create") + widget.methods + in + Alcotest.(check bool) "Widget.create absent from methods" false + create_present; + + (* Widget.show should still be present *) + let show_present = + List.exists + (fun (m : Gir_gen_lib.Types.gir_method) -> + String.equal m.method_name "show") + widget.methods + in + Alcotest.(check bool) "Widget.show present in methods" true show_present; + + (* No warnings — all override names exist in the parsed GIR *) + Alcotest.(check int) "no warnings" 0 (List.length result.warnings)) + +let test_suite = + [ + ( "e2e: ignore class and method via parsed GIR", + `Quick, + test_e2e_ignore_class_and_method ); + ] diff --git a/ocgtk/src/tools/test_gir_gen/test_override_extractor.ml b/ocgtk/src/tools/test_gir_gen/test_override_extractor.ml new file mode 100644 index 000000000..ed0d24515 --- /dev/null +++ b/ocgtk/src/tools/test_gir_gen/test_override_extractor.ml @@ -0,0 +1,242 @@ +(* Tests for Override_extractor and parse_doc_text integration *) + +(* --- extract_since_version tests --- *) + +let test_since_plain () = + match Gir_gen_lib.Override_extractor.extract_since_version "Since 2.26" with + | Some "2.26" -> () + | other -> Alcotest.fail (Printf.sprintf "Expected Some \"2.26\", got %s" + (match other with Some s -> "Some \"" ^ s ^ "\"" | None -> "None")) + +let test_since_colon () = + match Gir_gen_lib.Override_extractor.extract_since_version "Since: 2.74" with + | Some "2.74" -> () + | other -> Alcotest.fail (Printf.sprintf "Expected Some \"2.74\", got %s" + (match other with Some s -> "Some \"" ^ s ^ "\"" | None -> "None")) + +let test_since_in_parens () = + match Gir_gen_lib.Override_extractor.extract_since_version "Some text (Since: 1.16)." with + | Some "1.16" -> () + | other -> Alcotest.fail (Printf.sprintf "Expected Some \"1.16\", got %s" + (match other with Some s -> "Some \"" ^ s ^ "\"" | None -> "None")) + +let test_since_three_part () = + match Gir_gen_lib.Override_extractor.extract_since_version "Since 4.14.0" with + | Some "4.14.0" -> () + | other -> Alcotest.fail (Printf.sprintf "Expected Some \"4.14.0\", got %s" + (match other with Some s -> "Some \"" ^ s ^ "\"" | None -> "None")) + +let test_since_end_of_multiline () = + let doc = "A long description.\n\nSome more text.\nSince 1.50" in + match Gir_gen_lib.Override_extractor.extract_since_version doc with + | Some "1.50" -> () + | other -> Alcotest.fail (Printf.sprintf "Expected Some \"1.50\", got %s" + (match other with Some s -> "Some \"" ^ s ^ "\"" | None -> "None")) + +let test_since_none () = + match Gir_gen_lib.Override_extractor.extract_since_version "No version info here." with + | None -> () + | Some s -> Alcotest.fail (Printf.sprintf "Expected None, got Some \"%s\"" s) + +let test_since_empty () = + match Gir_gen_lib.Override_extractor.extract_since_version "" with + | None -> () + | Some s -> Alcotest.fail (Printf.sprintf "Expected None, got Some \"%s\"" s) + +(* --- parse_doc_text integration tests via GIR parser --- + We test parse_doc_text indirectly by checking that parsing a minimal + GIR XML with ... populates member_doc. *) + +let ns_attrs = {|name="Test" version="1.0" shared-library="libtest.so" c:identifier-prefixes="Test" c:symbol-prefixes="test"|} + +let minimal_gir_with_enum_doc = + Printf.sprintf + {| + + + + + The first value. Since 4.10 + + + No version here. + + + + + +|} + ns_attrs + +let minimal_gir_with_doc_nested_elements = + Printf.sprintf + {| + + + + + See the docs. Since: 2.30 + + + +|} + ns_attrs + +let minimal_gir_with_record_field_doc = + Printf.sprintf + {| + + + + + The x coordinate. Since 1.20 + + + + + + + +|} + ns_attrs + +let minimal_gir_with_bitfield_doc = + Printf.sprintf + {| + + + + + Flag A. Since 3.12 + + + + + +|} + ns_attrs + +let write_temp_gir content = + let tmp = Filename.temp_file "test_gir_doc" ".gir" in + let oc = open_out tmp in + output_string oc content; + close_out oc; + tmp + +let parse_gir content = + let tmp = write_temp_gir content in + let result = Gir_gen_lib.Parse.Gir_parser.parse_gir_file tmp [] in + Sys.remove tmp; + result + +let test_enum_member_doc_plain () = + let _repo, _ns, _classes, _ifaces, enums, _bitfields, _records = + parse_gir minimal_gir_with_enum_doc + in + match enums with + | [ enm ] -> + let members = enm.Gir_gen_lib.Types.members in + (* Members come out in reverse order *) + let find name = + match List.find_opt (fun m -> m.Gir_gen_lib.Types.member_name = name) members with + | None -> Alcotest.fail (Printf.sprintf "Member %s not found" name) + | Some m -> m + in + let a = find "value_a" in + let b = find "value_b" in + let c = find "value_c" in + Alcotest.(check (option string)) "value_a doc" + (Some "The first value. Since 4.10") a.member_doc; + Alcotest.(check (option string)) "value_b doc" + (Some "No version here.") b.member_doc; + Alcotest.(check (option string)) "value_c doc" None c.member_doc + | other -> Alcotest.fail (Printf.sprintf "Expected 1 enum, got %d" (List.length other)) + +let test_enum_member_doc_with_nested_elements () = + (* parse_doc_text should skip nested XML elements (like ) and + collect only the surrounding text *) + let _repo, _ns, _classes, _ifaces, enums, _bitfields, _records = + parse_gir minimal_gir_with_doc_nested_elements + in + match enums with + | [ enm ] -> + let members = enm.Gir_gen_lib.Types.members in + let a = match List.find_opt (fun m -> m.Gir_gen_lib.Types.member_name = "value_a") members with + | None -> Alcotest.fail "Member value_a not found" + | Some m -> m + in + (* The doc text should contain "See " and ". Since: 2.30" but not the link content *) + (match a.Gir_gen_lib.Types.member_doc with + | None -> Alcotest.fail "Expected Some doc, got None" + | Some doc -> + (* Should contain Since version *) + (match Gir_gen_lib.Override_extractor.extract_since_version doc with + | Some "2.30" -> () + | other -> Alcotest.fail (Printf.sprintf "Expected Since 2.30 from doc, got %s" + (match other with Some s -> "Some \"" ^ s ^ "\"" | None -> "None")))) + | other -> Alcotest.fail (Printf.sprintf "Expected 1 enum, got %d" (List.length other)) + +let test_bitfield_flag_doc () = + let _repo, _ns, _classes, _ifaces, _enums, bitfields, _records = + parse_gir minimal_gir_with_bitfield_doc + in + match bitfields with + | [ bf ] -> + let flags = bf.Gir_gen_lib.Types.flags in + let find name = + match List.find_opt (fun f -> f.Gir_gen_lib.Types.flag_name = name) flags with + | None -> Alcotest.fail (Printf.sprintf "Flag %s not found" name) + | Some f -> f + in + let a = find "flag_a" in + let b = find "flag_b" in + Alcotest.(check (option string)) "flag_a doc" + (Some "Flag A. Since 3.12") a.flag_doc; + Alcotest.(check (option string)) "flag_b doc" None b.flag_doc + | other -> Alcotest.fail (Printf.sprintf "Expected 1 bitfield, got %d" (List.length other)) + +let test_record_field_doc () = + let _repo, _ns, _classes, _ifaces, _enums, _bitfields, records = + parse_gir minimal_gir_with_record_field_doc + in + match records with + | [ rec_ ] -> + let fields = rec_.Gir_gen_lib.Types.fields in + let find name = + match List.find_opt (fun f -> f.Gir_gen_lib.Types.field_name = name) fields with + | None -> Alcotest.fail (Printf.sprintf "Field %s not found" name) + | Some f -> f + in + let x = find "x" in + let y = find "y" in + Alcotest.(check (option string)) "x field doc" + (Some "The x coordinate. Since 1.20") x.field_doc; + Alcotest.(check (option string)) "y field doc" None y.field_doc + | other -> Alcotest.fail (Printf.sprintf "Expected 1 record, got %d" (List.length other)) + +let test_suite = + [ + ("since_plain", `Quick, test_since_plain); + ("since_colon", `Quick, test_since_colon); + ("since_in_parens", `Quick, test_since_in_parens); + ("since_three_part", `Quick, test_since_three_part); + ("since_end_of_multiline", `Quick, test_since_end_of_multiline); + ("since_none", `Quick, test_since_none); + ("since_empty", `Quick, test_since_empty); + ("enum_member_doc_plain", `Quick, test_enum_member_doc_plain); + ("enum_member_doc_with_nested_elements", `Quick, test_enum_member_doc_with_nested_elements); + ("bitfield_flag_doc", `Quick, test_bitfield_flag_doc); + ("record_field_doc", `Quick, test_record_field_doc); + ] diff --git a/ocgtk/src/tools/test_gir_gen/test_override_parser.ml b/ocgtk/src/tools/test_gir_gen/test_override_parser.ml new file mode 100644 index 000000000..46aa0641a --- /dev/null +++ b/ocgtk/src/tools/test_gir_gen/test_override_parser.ml @@ -0,0 +1,526 @@ +(* Tests for Gir_gen_lib.Override_parser. *) + +open Gir_gen_lib.Override_types + +let parse_ok content = + match Gir_gen_lib.Override_parser.parse_overrides_from_string content with + | Ok ov -> ov + | Error e -> + Alcotest.fail (Printf.sprintf "Parse failed: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let parse_err content = + match Gir_gen_lib.Override_parser.parse_overrides_from_string content with + | Ok _ -> Alcotest.fail "Expected parse error but got Ok" + | Error e -> e + +let hd_exn msg = function + | [] -> Alcotest.fail msg + | x :: _ -> x + +let find_exn msg pred list = + match List.find_opt pred list with + | None -> Alcotest.fail msg + | Some x -> x + +let test_minimal () = + let ov = parse_ok "(overrides (library \"Gtk\"))" in + Alcotest.(check string) "library" "Gtk" ov.library_name; + Alcotest.(check int) "classes" 0 (List.length ov.classes); + Alcotest.(check int) "functions" 0 (List.length ov.functions) + +let test_no_library () = + let ov = parse_ok "(overrides)" in + Alcotest.(check string) "library" "" ov.library_name + +let test_class_ignore () = + let ov = parse_ok "(overrides (library \"Gtk\") (class Widget (ignore)))" in + Alcotest.(check int) "classes" 1 (List.length ov.classes); + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check string) "name" "Widget" c.class_name; + Alcotest.(check bool) "action" true (Option.is_some c.class_action); + match c.class_action with + | Some Ignore -> () + | _ -> Alcotest.fail "Expected Some Ignore" + +let test_class_with_method_overrides () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget \ + (method create (ignore)) \ + (method notify_destroy (version \"4.53\"))))" + in + Alcotest.(check int) "classes" 1 (List.length ov.classes); + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check int) "methods" 2 (List.length c.methods); + let m1 = find_exn "Expected method 'create'" (fun m -> String.equal m.component_name "create") c.methods in + let m2 = find_exn "Expected method 'notify_destroy'" (fun m -> String.equal m.component_name "notify_destroy") c.methods in + Alcotest.(check bool) "create ignored" true (equal_override_action m1.action Ignore); + Alcotest.(check bool) "notify_destroy version" true + (equal_override_action m2.action (Set_version "4.53")) + +let test_class_with_constructor_and_property () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (class Button \ + (constructor new (ignore)) \ + (property sensitive (version \"4.10\"))))" + in + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check int) "constructors" 1 (List.length c.constructors); + Alcotest.(check int) "properties" 1 (List.length c.properties); + let ctor = hd_exn "Expected one constructor" c.constructors in + let prop = hd_exn "Expected one property" c.properties in + Alcotest.(check string) "ctor name" "new" ctor.component_name; + Alcotest.(check string) "prop name" "sensitive" prop.component_name + +let test_class_with_signal () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget (signal destroy (ignore))))" + in + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check int) "signals" 1 (List.length c.signals) + +let test_interface_override () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (interface Actionable \ + (method get_action_name (ignore)) \ + (property action_name (version \"4.12\"))))" + in + Alcotest.(check int) "interfaces" 1 (List.length ov.interfaces); + let i = hd_exn "Expected one interface" ov.interfaces in + Alcotest.(check string) "name" "Actionable" i.interface_name; + Alcotest.(check int) "methods" 1 (List.length i.methods); + Alcotest.(check int) "properties" 1 (List.length i.properties) + +let test_record_override () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (record TextIter \ + (field user_data (ignore)) \ + (field start (version \"4.14\")) \ + (constructor new (ignore)) \ + (method get_text (version \"4.14\")) \ + (function get_slice (ignore))))" + in + Alcotest.(check int) "records" 1 (List.length ov.records); + let r = hd_exn "Expected one record" ov.records in + Alcotest.(check string) "name" "TextIter" r.record_name; + Alcotest.(check int) "fields" 2 (List.length r.fields); + Alcotest.(check int) "constructors" 1 (List.length r.constructors); + Alcotest.(check int) "methods" 1 (List.length r.methods); + Alcotest.(check int) "functions" 1 (List.length r.functions) + +let test_enum_override () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (enumeration RGBA \ + (member RED (ignore)) \ + (member GREEN (version \"4.14\")) \ + (function parse (ignore))))" + in + Alcotest.(check int) "enums" 1 (List.length ov.enums); + let e = hd_exn "Expected one enum" ov.enums in + Alcotest.(check string) "name" "RGBA" e.enum_name; + Alcotest.(check int) "members" 2 (List.length e.members); + Alcotest.(check int) "functions" 1 (List.length e.functions) + +let test_bitfield_override () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (bitfield StateFlags \ + (member ACTIVE (ignore)) \ + (member BACKDROP (version \"4.14\"))))" + in + Alcotest.(check int) "bitfields" 1 (List.length ov.bitfields); + let b = hd_exn "Expected one bitfield" ov.bitfields in + Alcotest.(check string) "name" "StateFlags" b.bitfield_name; + Alcotest.(check int) "flags" 2 (List.length b.flags) + +let test_standalone_function () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (function gtk_show_uri (ignore)))" + in + Alcotest.(check int) "functions" 1 (List.length ov.functions); + let f = hd_exn "Expected one function" ov.functions in + Alcotest.(check string) "name" "gtk_show_uri" f.component_name + +let test_multiple_entities () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget (ignore)) \ + (class Button (ignore)) \ + (interface Actionable (ignore)))" + in + Alcotest.(check int) "classes" 2 (List.length ov.classes); + Alcotest.(check int) "interfaces" 1 (List.length ov.interfaces) + +let test_class_ignore_precedence () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget (ignore) (method foo (ignore))))" + in + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check bool) "class ignored" true (Option.is_some c.class_action); + Alcotest.(check int) "methods still parsed" 1 (List.length c.methods) + +let test_duplicate_class () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (class Widget (ignore)) \ + (class Widget (ignore)))" + in + match err with + | Duplicate_entity { kind; name } -> + Alcotest.(check string) "kind" "class" kind; + Alcotest.(check string) "name" "Widget" name + | e -> + Alcotest.fail (Printf.sprintf "Expected Duplicate_entity, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_duplicate_interface () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (interface Actionable (ignore)) \ + (interface Actionable (ignore)))" + in + match err with + | Duplicate_entity { kind; name } -> + Alcotest.(check string) "kind" "interface" kind; + Alcotest.(check string) "name" "Actionable" name + | e -> + Alcotest.fail (Printf.sprintf "Expected Duplicate_entity, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_duplicate_function () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (function gtk_show_uri (ignore)) \ + (function gtk_show_uri (ignore)))" + in + match err with + | Duplicate_entity { kind; name } -> + Alcotest.(check string) "kind" "function" kind; + Alcotest.(check string) "name" "gtk_show_uri" name + | e -> + Alcotest.fail (Printf.sprintf "Expected Duplicate_entity, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_unknown_entity () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (widget Foo (ignore)))" + in + match err with + | Unknown_entity_kind kind -> + Alcotest.(check string) "kind" "widget" kind + | e -> + Alcotest.fail (Printf.sprintf "Expected Unknown_entity_kind, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_bare_name_member_in_enum () = + (* (foo (version "X.Y")) is missing the "member" keyword — should error *) + let err = + parse_err + "(overrides (library \"Gtk\") \ + (enumeration StateFlags \ + (foo (version \"4.14\"))))" + in + match err with + | Unknown_component_kind { entity_name; kind; _ } -> + Alcotest.(check string) "entity" "StateFlags" entity_name; + Alcotest.(check string) "kind" "foo" kind + | e -> + Alcotest.fail + (Printf.sprintf "Expected Unknown_component_kind, got: %s" + (Gir_gen_lib.Override_parser.format_error e)) + +let test_bare_name_member_in_bitfield () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (bitfield StateFlags \ + (focused (version \"4.16\"))))" + in + match err with + | Unknown_component_kind { entity_name; kind; _ } -> + Alcotest.(check string) "entity" "StateFlags" entity_name; + Alcotest.(check string) "kind" "focused" kind + | e -> + Alcotest.fail + (Printf.sprintf "Expected Unknown_component_kind, got: %s" + (Gir_gen_lib.Override_parser.format_error e)) + +let test_wrong_kind_in_class () = + (* "field" is not valid inside a class body *) + let err = + parse_err + "(overrides (library \"Gtk\") \ + (class Widget \ + (field foo (ignore))))" + in + match err with + | Unknown_component_kind { entity_name; kind; _ } -> + Alcotest.(check string) "entity" "Widget" entity_name; + Alcotest.(check string) "kind" "field" kind + | e -> + Alcotest.fail + (Printf.sprintf "Expected Unknown_component_kind, got: %s" + (Gir_gen_lib.Override_parser.format_error e)) + +let test_wrong_kind_in_record () = + (* "signal" is not valid inside a record body *) + let err = + parse_err + "(overrides (library \"Gtk\") \ + (record TextIter \ + (signal changed (ignore))))" + in + match err with + | Unknown_component_kind { entity_name; kind; _ } -> + Alcotest.(check string) "entity" "TextIter" entity_name; + Alcotest.(check string) "kind" "signal" kind + | e -> + Alcotest.fail + (Printf.sprintf "Expected Unknown_component_kind, got: %s" + (Gir_gen_lib.Override_parser.format_error e)) + +let test_invalid_version () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (class Widget (method foo (version \"bad\"))))" + in + match err with + | Invalid_version { name; version; _ } -> + Alcotest.(check string) "name" "foo" name; + Alcotest.(check string) "version" "bad" version + | e -> + Alcotest.fail (Printf.sprintf "Expected Invalid_version, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_malformed_sexp () = + let err = parse_err "(((" in + match err with + | Invalid_format _ -> () + | e -> + Alcotest.fail (Printf.sprintf "Expected Invalid_format, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_not_overrides_form () = + let err = parse_err "(class Widget (ignore))" in + match err with + | Invalid_format { message; _ } -> + Alcotest.(check bool) "mentions overrides" true + (String.length message > 0) + | e -> + Alcotest.fail (Printf.sprintf "Expected Invalid_format, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_bad_component_action () = + let err = + parse_err + "(overrides (library \"Gtk\") \ + (class Widget (method foo (rename bar))))" + in + match err with + | Invalid_format _ -> () + | e -> + Alcotest.fail (Printf.sprintf "Expected Invalid_format, got: %s" (Gir_gen_lib.Override_parser.format_error e)) + +let test_empty_class () = + let ov = parse_ok "(overrides (library \"Gtk\") (class Widget))" in + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check string) "name" "Widget" c.class_name; + Alcotest.(check bool) "no action" true (Option.is_none c.class_action) + +let test_many_components () = + let ov = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget \ + (constructor new (ignore)) \ + (constructor new_with_label (version \"4.10\")) \ + (method foo (ignore)) \ + (method bar (version \"4.12\")) \ + (property visible (ignore)) \ + (property sensitive (version \"4.10\")) \ + (signal destroy (ignore)) \ + (signal show (version \"4.8\"))))" + in + let c = hd_exn "Expected one class" ov.classes in + Alcotest.(check int) "constructors" 2 (List.length c.constructors); + Alcotest.(check int) "methods" 2 (List.length c.methods); + Alcotest.(check int) "properties" 2 (List.length c.properties); + Alcotest.(check int) "signals" 2 (List.length c.signals) + +let roundtrip original = + let sexp = sexp_of_library_overrides original in + let sexp_str = Sexplib.Sexp.to_string sexp in + let roundtripped = library_overrides_of_sexp (Sexplib.Sexp.of_string sexp_str) in + Alcotest.(check bool) + "roundtrip equality" true + (equal_library_overrides original roundtripped) + +let test_roundtrip_minimal () = + let original = parse_ok "(overrides (library \"Gtk\"))" in + roundtrip original + +let test_roundtrip_class_ignore () = + let original = parse_ok "(overrides (library \"Gtk\") (class Widget (ignore)))" in + roundtrip original + +let test_roundtrip_class_components () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget \ + (constructor new (ignore)) \ + (constructor new_with_label (version \"4.10\")) \ + (method foo (ignore)) \ + (method bar (version \"4.12\")) \ + (property visible (ignore)) \ + (property sensitive (version \"4.10\")) \ + (signal destroy (ignore)) \ + (signal show (version \"4.8\"))))" + in + roundtrip original + +let test_roundtrip_interface () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (interface Actionable \ + (method get_action_name (ignore)) \ + (property action_name (version \"4.12\")) \ + (signal activated (ignore))))" + in + roundtrip original + +let test_roundtrip_record () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (record TextIter \ + (field user_data (ignore)) \ + (field start (version \"4.14\")) \ + (constructor new (ignore)) \ + (method get_text (version \"4.14\")) \ + (function get_slice (ignore))))" + in + roundtrip original + +let test_roundtrip_enum () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (enumeration RGBA \ + (member RED (ignore)) \ + (member GREEN (version \"4.14\")) \ + (function parse (ignore))))" + in + roundtrip original + +let test_roundtrip_bitfield () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (bitfield StateFlags \ + (member ACTIVE (ignore)) \ + (member BACKDROP (version \"4.14\"))))" + in + roundtrip original + +let test_roundtrip_standalone_function () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (function gtk_show_uri (ignore)))" + in + roundtrip original + +let test_roundtrip_complex () = + let original = + parse_ok + "(overrides (library \"Gtk\") \ + (class Widget \ + (ignore) \ + (constructor new (ignore)) \ + (method show (version \"4.8\")) \ + (property visible (ignore)) \ + (signal destroy (ignore))) \ + (class Button \ + (method clicked (version \"4.10\")) \ + (property label (ignore))) \ + (interface Actionable \ + (method get_action_name (version \"4.12\")) \ + (property action_name (ignore))) \ + (record TextIter \ + (field user_data (ignore)) \ + (constructor new (ignore)) \ + (method get_text (version \"4.14\")) \ + (function slice (ignore))) \ + (enumeration Align \ + (member START (ignore)) \ + (member END (version \"4.0\")) \ + (function from_string (ignore))) \ + (bitfield StateFlags \ + (member ACTIVE (ignore)) \ + (member FOCUSED (version \"4.2\"))) \ + (function gtk_init (ignore)) \ + (function gtk_main (version \"4.0\")))" + in + roundtrip original + +let test_suite_roundtrip = + [ + ("minimal", `Quick, test_roundtrip_minimal); + ("class_ignore", `Quick, test_roundtrip_class_ignore); + ("class_components", `Quick, test_roundtrip_class_components); + ("interface", `Quick, test_roundtrip_interface); + ("record", `Quick, test_roundtrip_record); + ("enum", `Quick, test_roundtrip_enum); + ("bitfield", `Quick, test_roundtrip_bitfield); + ("standalone_function", `Quick, test_roundtrip_standalone_function); + ("complex", `Quick, test_roundtrip_complex); + ] + +let test_suite = + [ + ("minimal", `Quick, test_minimal); + ("no_library", `Quick, test_no_library); + ("class_ignore", `Quick, test_class_ignore); + ("class_with_method_overrides", `Quick, test_class_with_method_overrides); + ("class_with_constructor_and_property", `Quick, test_class_with_constructor_and_property); + ("class_with_signal", `Quick, test_class_with_signal); + ("interface_override", `Quick, test_interface_override); + ("record_override", `Quick, test_record_override); + ("enum_override", `Quick, test_enum_override); + ("bitfield_override", `Quick, test_bitfield_override); + ("standalone_function", `Quick, test_standalone_function); + ("multiple_entities", `Quick, test_multiple_entities); + ("class_ignore_precedence", `Quick, test_class_ignore_precedence); + ("duplicate_class", `Quick, test_duplicate_class); + ("duplicate_interface", `Quick, test_duplicate_interface); + ("duplicate_function", `Quick, test_duplicate_function); + ("unknown_entity", `Quick, test_unknown_entity); + ("bare_name_member_in_enum", `Quick, test_bare_name_member_in_enum); + ("bare_name_member_in_bitfield", `Quick, test_bare_name_member_in_bitfield); + ("wrong_kind_in_class", `Quick, test_wrong_kind_in_class); + ("wrong_kind_in_record", `Quick, test_wrong_kind_in_record); + ("invalid_version", `Quick, test_invalid_version); + ("malformed_sexp", `Quick, test_malformed_sexp); + ("not_overrides_form", `Quick, test_not_overrides_form); + ("bad_component_action", `Quick, test_bad_component_action); + ("empty_class", `Quick, test_empty_class); + ("many_components", `Quick, test_many_components); + ] diff --git a/ocgtk/src/tools/test_gir_gen/test_override_types.ml b/ocgtk/src/tools/test_gir_gen/test_override_types.ml new file mode 100644 index 000000000..81f5bf046 --- /dev/null +++ b/ocgtk/src/tools/test_gir_gen/test_override_types.ml @@ -0,0 +1,150 @@ +(* Tests for Override_types construction and equality. *) + +open Gir_gen_lib.Override_types + +let test_override_action_ignore () = + let a = Ignore in + match a with Ignore -> () | Set_version _ -> Alcotest.fail "Expected Ignore" + +let test_override_action_version () = + let a = Set_version "4.10" in + match a with + | Set_version v -> Alcotest.(check string) "version" "4.10" v + | Ignore -> Alcotest.fail "Expected Set_version" + +let test_override_action_eq () = + Alcotest.(check bool) "ignore eq" true (equal_override_action Ignore Ignore); + Alcotest.(check bool) "version eq" true + (equal_override_action (Set_version "4.10") (Set_version "4.10")); + Alcotest.(check bool) "version neq" false + (equal_override_action (Set_version "4.10") (Set_version "4.12")); + Alcotest.(check bool) "ignore neq version" false + (equal_override_action Ignore (Set_version "4.10")) + +let test_component_override_construction () = + let c = { component_name = "foo"; action = Ignore } in + Alcotest.(check string) "name" "foo" c.component_name; + Alcotest.(check bool) "action" true (equal_override_action c.action Ignore) + +let test_component_override_eq () = + let c1 = { component_name = "foo"; action = Ignore } in + let c2 = { component_name = "foo"; action = Ignore } in + let c3 = { component_name = "bar"; action = Ignore } in + Alcotest.(check bool) "eq" true (equal_component_override c1 c2); + Alcotest.(check bool) "neq" false (equal_component_override c1 c3) + +let test_class_override_construction () = + let c = + { + class_name = "Widget"; + class_action = Some Ignore; + constructors = []; + methods = [ { component_name = "foo"; action = Ignore } ]; + properties = []; + signals = []; + } + in + Alcotest.(check string) "name" "Widget" c.class_name; + Alcotest.(check int) "methods" 1 (List.length c.methods); + Alcotest.(check bool) "action" true (Option.is_some c.class_action) + +let test_interface_override_construction () = + let i = + { + interface_name = "Actionable"; + interface_action = None; + methods = []; + properties = [ { component_name = "action_name"; action = Set_version "4.12" } ]; + signals = []; + } + in + Alcotest.(check string) "name" "Actionable" i.interface_name; + Alcotest.(check int) "properties" 1 (List.length i.properties) + +let test_record_override_construction () = + let r = + { + record_name = "TextIter"; + record_action = None; + fields = [ { component_name = "user_data"; action = Ignore } ]; + constructors = []; + methods = []; + functions = []; + } + in + Alcotest.(check string) "name" "TextIter" r.record_name; + Alcotest.(check int) "fields" 1 (List.length r.fields) + +let test_enum_override_construction () = + let e = + { + enum_name = "RGBA"; + enum_action = None; + members = [ { component_name = "RED"; action = Ignore } ]; + functions = []; + } + in + Alcotest.(check string) "name" "RGBA" e.enum_name; + Alcotest.(check int) "members" 1 (List.length e.members) + +let test_bitfield_override_construction () = + let b = + { + bitfield_name = "StateFlags"; + bitfield_action = Some (Set_version "4.10"); + flags = [ { component_name = "ACTIVE"; action = Ignore } ]; + } + in + Alcotest.(check string) "name" "StateFlags" b.bitfield_name; + Alcotest.(check int) "flags" 1 (List.length b.flags) + +let test_library_overrides_construction () = + let ov = + { + library_name = "Gtk"; + classes = []; + interfaces = []; + records = []; + enums = []; + bitfields = []; + functions = [ { component_name = "gtk_show_uri"; action = Ignore } ]; + } + in + Alcotest.(check string) "library" "Gtk" ov.library_name; + Alcotest.(check int) "functions" 1 (List.length ov.functions) + +let test_library_overrides_eq () = + let ov1 = + { + library_name = "Gtk"; + classes = [ { class_name = "Widget"; class_action = Some Ignore; + constructors = []; methods = []; properties = []; signals = [] } ]; + interfaces = []; + records = []; + enums = []; + bitfields = []; + functions = []; + } + in + let ov2 = ov1 in + let ov3 = + { ov1 with library_name = "Gdk" } + in + Alcotest.(check bool) "eq" true (equal_library_overrides ov1 ov2); + Alcotest.(check bool) "neq" false (equal_library_overrides ov1 ov3) + +let test_suite = + [ + ("override_action_ignore", `Quick, test_override_action_ignore); + ("override_action_version", `Quick, test_override_action_version); + ("override_action_eq", `Quick, test_override_action_eq); + ("component_override_construction", `Quick, test_component_override_construction); + ("component_override_eq", `Quick, test_component_override_eq); + ("class_override_construction", `Quick, test_class_override_construction); + ("interface_override_construction", `Quick, test_interface_override_construction); + ("record_override_construction", `Quick, test_record_override_construction); + ("enum_override_construction", `Quick, test_enum_override_construction); + ("bitfield_override_construction", `Quick, test_bitfield_override_construction); + ("library_overrides_construction", `Quick, test_library_overrides_construction); + ("library_overrides_eq", `Quick, test_library_overrides_eq); + ] diff --git a/ocgtk/src/tools/test_gir_gen/util/type_factory.ml b/ocgtk/src/tools/test_gir_gen/util/type_factory.ml index 427ef0f72..778685200 100644 --- a/ocgtk/src/tools/test_gir_gen/util/type_factory.ml +++ b/ocgtk/src/tools/test_gir_gen/util/type_factory.ml @@ -93,7 +93,7 @@ let make_gir_property ~prop_name ~prop_type ?(readable = true) let make_gir_record_field ~field_name ?field_type ?(readable = true) ?(writable = false) ?field_doc () = - { field_name; field_type; readable; writable; field_doc } + { field_name; field_type; readable; writable; field_doc; field_version = None } let make_gir_record ?(record_name = "TestRecord") ?(c_type = "TestRecord") ?glib_type_name ?glib_get_type ?(opaque = false) ?(disguised = false) @@ -120,7 +120,7 @@ let make_gir_record ?(record_name = "TestRecord") ?(c_type = "TestRecord") let make_gir_enum_member ?(member_name = "NONE") ?(member_value = 0) ?(c_identifier = "TEST_NONE") ?member_doc () = - { member_name; member_value; c_identifier; member_doc } + { member_name; member_value; c_identifier; member_doc; member_version = None } let make_gir_enum ?(enum_name = "TestEnum") ?(enum_c_type = "TestEnum") ?(members = []) ?(functions = []) ?enum_doc ?enum_version () = @@ -128,7 +128,7 @@ let make_gir_enum ?(enum_name = "TestEnum") ?(enum_c_type = "TestEnum") let make_gir_bitfield_member ?(flag_name = "NONE") ?(flag_value = 0) ?(flag_c_identifier = "TEST_NONE") ?flag_doc () = - { flag_name; flag_value; flag_c_identifier; flag_doc } + { flag_name; flag_value; flag_c_identifier; flag_doc; flag_version = None } let make_gir_bitfield ?(bitfield_name = "TestFlags") ?(bitfield_c_type = "TestFlags") ?(flags = []) ?bitfield_doc diff --git a/scripts/README.md b/scripts/README.md index 5001cadac..8967e890a 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -2,7 +2,8 @@ ## generate-bindings.sh -Generates OCaml bindings for GIO, GDK, and GTK from their GIR (GObject Introspection) files. +Generates OCaml bindings for all 9 GObject namespaces (Cairo, GIO, GDK, Graphene, +GdkPixbuf, Pango, PangoCairo, GSK, GTK) from GIR (GObject Introspection) files. ### Usage @@ -19,25 +20,34 @@ GIR_PATH=/custom/path/to/gir-1.0 ./scripts/generate-bindings.sh ### What it does -1. **Generates reference files** for cross-namespace type validation: - - `_build/references/gio-references.sexp` - - `_build/references/gdk-references.sexp` - - `_build/references/gtk-references.sexp` +**Step 0** — Builds the `gir_gen` code generator tool via `dune build`. -2. **Generates OCaml bindings** in the source tree: - - `src/gio/generated/` - GIO bindings - - `src/gdk/generated/` - GDK bindings (using GIO references) - - `src/gtk/generated/` - GTK bindings (using GIO and GDK references) +**Step 1** — Generates cross-namespace reference files (`_build/references/-references.sexp`) +for all 9 namespaces. Each reference call also passes `-o overrides/.sexp` so that +ignored entities are excluded from reference output. -3. After generation, run `dune build` to compile the updated bindings. +**Step 2** — Generates OCaml bindings for all 9 namespaces into `src//generated/`. +Each `generate` call passes: +- `-o overrides/.sexp` — applies override rules (entity ignores, version guards) +- `-r -references.sexp` — one flag per transitive dependency namespace + +After generation, run `dune build` to compile the updated bindings. + +### Override files + +Per-namespace override files live in `ocgtk/overrides/` and are committed to the +repository. They control which entities are skipped during generation and set GTK +version guards on enum/bitfield members. See +[README_GIR_GEN.md — Override System](../ocgtk/src/tools/README_GIR_GEN.md#override-system) +for the file format and editing workflow. ### Requirements -- The `gir_gen` tool must be built and available in your PATH +- The `gir_gen` tool must be built (the script builds it automatically via `dune build`) - GIR files must be present (usually installed via system packages like `libgtk-4-dev`) ### Notes - Code generation is **not** part of the normal dune build flow - Generated files are committed to the repository -- Only run this script when you need to regenerate bindings (e.g., after updating GIR files or gir_gen) +- Only run this script when you need to regenerate bindings (e.g., after updating GIR files, gir_gen, or override files) diff --git a/scripts/generate-bindings.sh b/scripts/generate-bindings.sh index 975a6c834..f448403e0 100755 --- a/scripts/generate-bindings.sh +++ b/scripts/generate-bindings.sh @@ -15,6 +15,7 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" WORKSPACE_ROOT="$REPO_ROOT/ocgtk" BUILD_DIR="$WORKSPACE_ROOT/_build/references" GIR_GEN="$WORKSPACE_ROOT/_build/default/src/tools/gir_gen/gir_gen.exe" +OVERRIDES_DIR="$WORKSPACE_ROOT/overrides" echo "===================================" echo "OCaml GTK Bindings Generator" @@ -48,46 +49,47 @@ echo "Step 1: Generating cross-namespace reference files..." echo "-----------------------------------" echo " [1/9] Generating Cairo references..." -"$GIR_GEN" references "$GIR_PATH/cairo-1.0.gir" "$BUILD_DIR/cairo-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/cairo.sexp" "$GIR_PATH/cairo-1.0.gir" "$BUILD_DIR/cairo-references.sexp" echo " [2/9] Generating GIO references..." -"$GIR_GEN" references "$GIR_PATH/Gio-2.0.gir" "$BUILD_DIR/gio-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/gio.sexp" "$GIR_PATH/Gio-2.0.gir" "$BUILD_DIR/gio-references.sexp" echo " [3/9] Generating GDK references..." -"$GIR_GEN" references "$GIR_PATH/Gdk-4.0.gir" "$BUILD_DIR/gdk-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/gdk.sexp" "$GIR_PATH/Gdk-4.0.gir" "$BUILD_DIR/gdk-references.sexp" echo " [4/9] Generating Graphene references..." -"$GIR_GEN" references "$GIR_PATH/Graphene-1.0.gir" "$BUILD_DIR/graphene-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/graphene.sexp" "$GIR_PATH/Graphene-1.0.gir" "$BUILD_DIR/graphene-references.sexp" echo " [5/9] Generating GdkPixbuf references..." -"$GIR_GEN" references "$GIR_PATH/GdkPixbuf-2.0.gir" "$BUILD_DIR/gdkpixbuf-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/gdkpixbuf.sexp" "$GIR_PATH/GdkPixbuf-2.0.gir" "$BUILD_DIR/gdkpixbuf-references.sexp" echo " [6/9] Generating Pango references..." -"$GIR_GEN" references "$GIR_PATH/Pango-1.0.gir" "$BUILD_DIR/pango-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/pango.sexp" "$GIR_PATH/Pango-1.0.gir" "$BUILD_DIR/pango-references.sexp" echo " [7/9] Generating GSK references..." -"$GIR_GEN" references "$GIR_PATH/Gsk-4.0.gir" "$BUILD_DIR/gsk-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/gsk.sexp" "$GIR_PATH/Gsk-4.0.gir" "$BUILD_DIR/gsk-references.sexp" echo " [8/9] Generating PangoCairo references..." -"$GIR_GEN" references "$GIR_PATH/PangoCairo-1.0.gir" "$BUILD_DIR/pangocairo-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/pangocairo.sexp" "$GIR_PATH/PangoCairo-1.0.gir" "$BUILD_DIR/pangocairo-references.sexp" echo " [9/9] Generating GTK references..." -"$GIR_GEN" references "$GIR_PATH/Gtk-4.0.gir" "$BUILD_DIR/gtk-references.sexp" +"$GIR_GEN" references -o "$OVERRIDES_DIR/gtk.sexp" "$GIR_PATH/Gtk-4.0.gir" "$BUILD_DIR/gtk-references.sexp" echo "" echo "Step 2: Generating OCaml bindings..." echo "-----------------------------------" echo " [1/9] Generating Cairo bindings..." -"$GIR_GEN" generate "$GIR_PATH/cairo-1.0.gir" src/cairo +"$GIR_GEN" generate -o "$OVERRIDES_DIR/cairo.sexp" "$GIR_PATH/cairo-1.0.gir" src/cairo echo "" echo " [2/9] Generating GIO bindings..." -"$GIR_GEN" generate "$GIR_PATH/Gio-2.0.gir" src/gio +"$GIR_GEN" generate -o "$OVERRIDES_DIR/gio.sexp" "$GIR_PATH/Gio-2.0.gir" src/gio echo "" echo " [3/9] Generating GDK bindings (with Cairo, GIO references)..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/gdk.sexp" \ -r "$BUILD_DIR/cairo-references.sexp" \ -r "$BUILD_DIR/pango-references.sexp" \ -r "$BUILD_DIR/pangocairo-references.sexp" \ @@ -99,12 +101,14 @@ echo " [3/9] Generating GDK bindings (with Cairo, GIO references)..." echo "" echo " [4/9] Generating Graphene bindings..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/graphene.sexp" \ "$GIR_PATH/Graphene-1.0.gir" \ src/graphene echo "" echo " [5/9] Generating GdkPixbuf bindings (with GIO references)..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/gdkpixbuf.sexp" \ -r "$BUILD_DIR/gio-references.sexp" \ "$GIR_PATH/GdkPixbuf-2.0.gir" \ src/gdkpixbuf @@ -112,6 +116,7 @@ echo " [5/9] Generating GdkPixbuf bindings (with GIO references)..." echo "" echo " [6/9] Generating Pango bindings (with Cairo, GIO references)..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/pango.sexp" \ -r "$BUILD_DIR/cairo-references.sexp" \ -r "$BUILD_DIR/gio-references.sexp" \ "$GIR_PATH/Pango-1.0.gir" \ @@ -120,6 +125,7 @@ echo " [6/9] Generating Pango bindings (with Cairo, GIO references)..." echo "" echo " [7/9] Generating PangoCairo bindings (with Cairo, Pango, GIO references)..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/pangocairo.sexp" \ -r "$BUILD_DIR/cairo-references.sexp" \ -r "$BUILD_DIR/pango-references.sexp" \ -r "$BUILD_DIR/gio-references.sexp" \ @@ -129,6 +135,7 @@ echo " [7/9] Generating PangoCairo bindings (with Cairo, Pango, GIO references) echo "" echo " [8/9] Generating GSK bindings (with Cairo, GIO, GDK, Graphene references)..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/gsk.sexp" \ -r "$BUILD_DIR/cairo-references.sexp" \ -r "$BUILD_DIR/gio-references.sexp" \ -r "$BUILD_DIR/gdk-references.sexp" \ @@ -142,6 +149,7 @@ echo " [8/9] Generating GSK bindings (with Cairo, GIO, GDK, Graphene references echo "" echo " [9/9] Generating GTK bindings (with all references)..." "$GIR_GEN" generate \ + -o "$OVERRIDES_DIR/gtk.sexp" \ -r "$BUILD_DIR/cairo-references.sexp" \ -r "$BUILD_DIR/gio-references.sexp" \ -r "$BUILD_DIR/gdk-references.sexp" \