Procedures

ProcedureLocationProcedure TypeDescription
action_error cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

action_ok cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

append_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

arg_int_n cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

arg_is_char cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

arg_is_int cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

arg_is_real cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

arg_is_rest cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

arg_real_n cmdgraph Interface

Add a concrete state (has a prompt) or abstract state (mix-in, no prompt). Add a command edge to state. Build an integer arg_spec_t. Build a real arg_spec_t. Build a character arg_spec_t. Build a rest arg_spec_t (verbatim remainder of the line; must be last). Return n copies of an integer spec (fixed-size tuple, e.g. a 2D point). Return n copies of a real spec. Successful result, optionally carrying a DoGoto context string. Error result, optionally with a message written to the error channel. Merge all commands from abstract state included into state. The state's own commands override included ones with the same spec. Register a hook called after every successful transition into state. Validate the graph and set the initial state. Sets stat non-zero if a cycle is detected in goto/do_goto edges or if any state reference is unresolved. Run an interactive loop reading from the configured input stream. Execute commands from path, stopping at the first error. Returns .true. if the file ran to completion (or ended with quit). Rewind to the initial state without rebuilding the graph. Clears the stack, contexts, last_message, and last_error. Redirect I/O channels. Pass QUIET_UNIT to suppress a channel. Default: stdin / stdout / stderr. Dispatch one line of input. Performs prefix matching, arg validation, and edge traversal. Name of the active state. Context of the active state. Returns .false. after Quit or stack exhausted. Commands visible in the current state (own + included, help/? excluded). Result depends only on the state name; safe to cache keyed by state name. State names on the stack, bottom-first.

assign_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

bt_bulk_load b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_close b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_first b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_insert b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_journal_adapter sqr Interface

Open (or create) a database directory.

Read more…
bt_next b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_open b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_reload b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_remove b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_seek b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_set_journal_hook b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
bt_sync b_tree Interface

Open an existing tree (create=.false.) or create a fresh empty one (create=.true., file truncated). writable=.false. opens read-only. On a non-create open key_len must match the value stored in the file or BT_CORRUPT is returned. Flush the meta page (read-write opens) and close the unit. Safe to call on an already-closed handle. Re-read the mutable meta fields (root, free_head, npages, first_leaf, nentries) from the on-disk meta page into the open handle, discarding the cached in-memory copies. This re-syncs a tree whose file was changed underneath it — specifically after a journal rollback restores the meta page, the cached fields are stale and must be reloaded before the tree is touched again. The unit stays open; page_size/key_len are immutable and a mismatch (or a failed geometry self-check) is reported as BT_CORRUPT. Push a writable tree's buffered page writes out to the operating system so a subsequent fsync of the file makes them durable. Every mutator already writes the meta page last, so the on-disk image is coherent; this only drains the open unit's buffer and performs no fsync itself (the journal layer owns durability, by path). A no-op on a closed or read-only handle. Insert (key, payload). Duplicate keys are allowed; the pair is ordered by key then payload so the entry is uniquely addressable for bt_remove. Remove the entry matching (key, payload) exactly. found is .false. (with stat == BT_OK) if no such entry exists. Lazy: an emptied leaf is left in place, not merged. Rebuild the whole tree from keys/payloads: sort (key,payload) then write perfectly-packed leaves and the internal levels bottom-up. O(N log N) — the proper replacement for per-row reinsertion. keys is a rank-1 array of key_len byte strings, payloads(i) the payload for keys(i).

Read more…
c_fsync_dir clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_fsync_path clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_isatty_stdin clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_lock_release clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_lock_share clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_lock_try clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_mkdir clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_path_exists clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_remove clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_rename clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_rmtree clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

c_truncate clib_wrap Interface

Atomically rename/replace oldpath to newpath (same filesystem). Returns 0 on success, nonzero on failure. Unlink a file or remove an empty directory. Returns 0 on success, nonzero on failure. Create one directory (mode 0777 & umask on POSIX). Returns 0 on success, nonzero on failure (including "already exists"). Test whether path exists (access(F_OK) / _access). Depth-first removal of path and everything under it. Returns 0 if the tree was removed or the path did not exist; nonzero if a remove failed partway. Flush a file's data to stable storage (fsync / _commit). flush the owning Fortran unit first so the runtime buffer has reached the OS before this call drives the OS cache to disk. Returns 0 on success, nonzero on failure. Flush a directory's entries to stable storage, making a file creation/deletion within it durable. A no-op on Windows (NTFS journals directory metadata). Returns 0 on success. Set a file's length to length bytes, shrinking or growing it (truncate / _chsize_s). Returns 0 on success, nonzero on failure. Try (non-blocking) to take an advisory lock on path, which is created if absent. exclusive selects a write lock; otherwise a shared (read) lock that coexists with other shared holders. On success ierr is 0 and tok holds the lock (an opaque token — a POSIX fd or a Win32 HANDLE — pass it to c_lock_release). On contention ierr is 1 and tok is -1; on a genuine open/create failure ierr is 2. The lock lives only as long as tok is held, and is dropped automatically if the process dies. Release a lock taken by c_lock_try and close its descriptor or handle. A no-op for an unheld (-1) token; resets tok to -1. Downgrade an exclusive lock to shared so other read-only connections may attach. Returns 0 on success, nonzero on failure. .true. when standard input (fd 0) is a terminal, so an interactive prompt is appropriate. Wraps POSIX isatty / CRT _isatty.

char_node dlist Interface
clear_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

db_add_column sqr Interface

Open (or create) a database directory.

Read more…
db_begin sqr Interface

Open (or create) a database directory.

Read more…
db_close sqr Interface

Open (or create) a database directory.

Read more…
db_commit sqr Interface

Open (or create) a database directory.

Read more…
db_compact sqr Interface

Open (or create) a database directory.

Read more…
db_create_index sqr Interface
db_create_table sqr Interface

Open (or create) a database directory.

Read more…
db_cursor_next sqr Interface

Open (or create) a database directory.

Read more…
db_delete sqr Interface

Open (or create) a database directory.

Read more…
db_delete_by_key sqr Interface

Open (or create) a database directory.

Read more…
db_drop_column sqr Interface

Open (or create) a database directory.

Read more…
db_drop_index sqr Interface
db_drop_table sqr Interface

Open (or create) a database directory.

Read more…
db_find_by_char sqr Interface

Open (or create) a database directory.

Read more…
db_find_by_int sqr Interface

Open (or create) a database directory.

Read more…
db_find_by_real sqr Interface

Open (or create) a database directory.

Read more…
db_find_range sqr Interface
db_get sqr Interface

Open (or create) a database directory.

Read more…
db_get_by_key sqr Interface

Open (or create) a database directory.

Read more…
db_get_text sqr Interface

Open (or create) a database directory.

Read more…
db_insert sqr Interface

Open (or create) a database directory.

Read more…
db_insert_many sqr Interface

Open (or create) a database directory.

Read more…
db_list_tables sqr Interface

Open (or create) a database directory.

Read more…
db_open sqr Interface

Open (or create) a database directory.

Read more…
db_open_cursor sqr Interface

Open (or create) a database directory.

Read more…
db_rollback sqr Interface

Open (or create) a database directory.

Read more…
db_scan sqr Interface

Open (or create) a database directory.

Read more…
db_set_readonly sqr Interface

Open (or create) a database directory.

Read more…
db_set_text sqr Interface

Open (or create) a database directory.

Read more…
db_table_index sqr Interface

Open (or create) a database directory.

Read more…
db_update sqr Interface

Open (or create) a database directory.

Read more…
db_update_by_key sqr Interface

Open (or create) a database directory.

Read more…
db_verify sqr Interface

Open (or create) a database directory.

Read more…
fault_arm sqr_fault Interface

Post-I/O hook. Counts one I/O event. In the on build, if the armed ordinal has been reached and ios is still zero, sets ios to a synthetic non-zero error; it never clears a real error and never alters ios in the off build. Not pure: the on body advances saved state — the seam is inherently stateful, so the interface cannot promise purity. Arm injection: the n-th io_check call counted from now forces a synthetic failure. n <= 0 disarms. The call ordinal is reset to zero. No-op in the off build. Disarm injection and reset the global call ordinal. No-op in the off build. Number of io_check calls since the last fault_arm / fault_disarm. Always 0 in the off build — a test can use this both to size an injection sweep and to detect that injection is unavailable (production library linked).

fault_count sqr_fault Interface

Post-I/O hook. Counts one I/O event. In the on build, if the armed ordinal has been reached and ios is still zero, sets ios to a synthetic non-zero error; it never clears a real error and never alters ios in the off build. Not pure: the on body advances saved state — the seam is inherently stateful, so the interface cannot promise purity. Arm injection: the n-th io_check call counted from now forces a synthetic failure. n <= 0 disarms. The call ordinal is reset to zero. No-op in the off build. Disarm injection and reset the global call ordinal. No-op in the off build. Number of io_check calls since the last fault_arm / fault_disarm. Always 0 in the off build — a test can use this both to size an injection sweep and to detect that injection is unavailable (production library linked).

fault_disarm sqr_fault Interface

Post-I/O hook. Counts one I/O event. In the on build, if the armed ordinal has been reached and ios is still zero, sets ios to a synthetic non-zero error; it never clears a real error and never alters ios in the off build. Not pure: the on body advances saved state — the seam is inherently stateful, so the interface cannot promise purity. Arm injection: the n-th io_check call counted from now forces a synthetic failure. n <= 0 disarms. The call ordinal is reset to zero. No-op in the off build. Disarm injection and reset the global call ordinal. No-op in the off build. Number of io_check calls since the last fault_arm / fault_disarm. Always 0 in the off build — a test can use this both to size an injection sweep and to detect that injection is unavailable (production library linked).

finalize_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

get_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

idx_live sqr Interface

Open (or create) a database directory.

Read more…
insert_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

int_node dlist Interface
io_check sqr_fault Interface

Post-I/O hook. Counts one I/O event. In the on build, if the armed ordinal has been reached and ios is still zero, sets ios to a synthetic non-zero error; it never clears a real error and never alters ios in the off build. Not pure: the on body advances saved state — the seam is inherently stateful, so the interface cannot promise purity. Arm injection: the n-th io_check call counted from now forces a synthetic failure. n <= 0 disarms. The call ordinal is reset to zero. No-op in the off build. Disarm injection and reset the global call ordinal. No-op in the off build. Number of io_check calls since the last fault_arm / fault_disarm. Always 0 in the off build — a test can use this both to size an injection sweep and to detect that injection is unavailable (production library linked).

iterate_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

jrnl_hot sqr Interface

Open (or create) a database directory.

Read more…
jrnl_log_extend sqr Interface

Open (or create) a database directory.

Read more…
jrnl_log_region sqr Interface

Open (or create) a database directory.

Read more…
jrnl_recover sqr Interface

Open (or create) a database directory.

Read more…
make_char_node dlist Interface
make_int_node dlist Interface
make_node dlist Interface
make_real_a_node dlist Interface
make_real_m_node dlist Interface
make_real_node dlist Interface
print_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

real_a_node dlist Interface
real_m_node dlist Interface
real_node dlist Interface
remove_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

reverse_iterate_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

row_alloc sqr Interface

Open (or create) a database directory.

Read more…
row_clear sqr Interface

Open (or create) a database directory.

Read more…
row_clear_null sqr Interface

Open (or create) a database directory.

Read more…
row_get_char sqr Interface

Open (or create) a database directory.

Read more…
row_get_int sqr Interface

Open (or create) a database directory.

Read more…
row_get_real sqr Interface

Open (or create) a database directory.

Read more…
row_is_null sqr Interface

Open (or create) a database directory.

Read more…
row_set_char sqr Interface

Open (or create) a database directory.

Read more…
row_set_int sqr Interface

Open (or create) a database directory.

Read more…
row_set_null sqr Interface

Open (or create) a database directory.

Read more…
row_set_real sqr Interface

Open (or create) a database directory.

Read more…
row_set_status sqr Interface

Open (or create) a database directory.

Read more…
row_status sqr Interface

Open (or create) a database directory.

Read more…
size_ll dlist Interface

Apply f to each element in forward order. Returns .true. if all elements were visited (i.e. f never set ok=.false.). Insert data at 1-based idx, shifting later elements right. Out-of-range low values prepend; out-of-range high values append. Remove the element at 1-based idx. Silently does nothing if idx is out-of-range. Apply f to each element in reverse order. Print list contents to unit (default output_unit). Renders the built-in node kinds; extensions print as <user-defined>. Append data to the tail of the list. Number of elements in the list. Remove all elements. Index-based accessor (1-based). Returns an allocatable polymorphic copy of the node data. Unallocated if idx is out of range — check allocated(node) before select type.

sql_exec sql Interface

Tokenise one source line. Always succeeds for well-formed tokens; reports SQR_INVALID with errmsg (carrying the offending column) for an unterminated string or a stray character. toks(1:ntok) are the tokens; a trailing TK_EOF is not appended (callers use ntok). Parse one statement. Recursive descent into sql_stmt_t. A trailing ; is permitted. Reports SQR_INVALID with a column-anchored errmsg on a syntax error. Execute one parsed statement against an open database, choosing an index-driven or scan-driven plan as appropriate, and fill res. Engine errors propagate through stat/errmsg. db is target because the transaction façade the executor calls needs it. Convenience: lex + parse + execute one source line. Equivalent to sql_parse then sql_exec. Render a result to a formatted unit: an aligned table for a SELECT, a "N row(s)" line for DML, or the message for DDL. Used by the REPL; tests inspect sql_result_t directly instead.

sql_lex sql Interface

Tokenise one source line. Always succeeds for well-formed tokens; reports SQR_INVALID with errmsg (carrying the offending column) for an unterminated string or a stray character. toks(1:ntok) are the tokens; a trailing TK_EOF is not appended (callers use ntok). Parse one statement. Recursive descent into sql_stmt_t. A trailing ; is permitted. Reports SQR_INVALID with a column-anchored errmsg on a syntax error. Execute one parsed statement against an open database, choosing an index-driven or scan-driven plan as appropriate, and fill res. Engine errors propagate through stat/errmsg. db is target because the transaction façade the executor calls needs it. Convenience: lex + parse + execute one source line. Equivalent to sql_parse then sql_exec. Render a result to a formatted unit: an aligned table for a SELECT, a "N row(s)" line for DML, or the message for DDL. Used by the REPL; tests inspect sql_result_t directly instead.

sql_parse sql Interface

Tokenise one source line. Always succeeds for well-formed tokens; reports SQR_INVALID with errmsg (carrying the offending column) for an unterminated string or a stray character. toks(1:ntok) are the tokens; a trailing TK_EOF is not appended (callers use ntok). Parse one statement. Recursive descent into sql_stmt_t. A trailing ; is permitted. Reports SQR_INVALID with a column-anchored errmsg on a syntax error. Execute one parsed statement against an open database, choosing an index-driven or scan-driven plan as appropriate, and fill res. Engine errors propagate through stat/errmsg. db is target because the transaction façade the executor calls needs it. Convenience: lex + parse + execute one source line. Equivalent to sql_parse then sql_exec. Render a result to a formatted unit: an aligned table for a SELECT, a "N row(s)" line for DML, or the message for DDL. Used by the REPL; tests inspect sql_result_t directly instead.

sql_render sql Interface

Tokenise one source line. Always succeeds for well-formed tokens; reports SQR_INVALID with errmsg (carrying the offending column) for an unterminated string or a stray character. toks(1:ntok) are the tokens; a trailing TK_EOF is not appended (callers use ntok). Parse one statement. Recursive descent into sql_stmt_t. A trailing ; is permitted. Reports SQR_INVALID with a column-anchored errmsg on a syntax error. Execute one parsed statement against an open database, choosing an index-driven or scan-driven plan as appropriate, and fill res. Engine errors propagate through stat/errmsg. db is target because the transaction façade the executor calls needs it. Convenience: lex + parse + execute one source line. Equivalent to sql_parse then sql_exec. Render a result to a formatted unit: an aligned table for a SELECT, a "N row(s)" line for DML, or the message for DDL. Used by the REPL; tests inspect sql_result_t directly instead.

sql_run sql Interface

Tokenise one source line. Always succeeds for well-formed tokens; reports SQR_INVALID with errmsg (carrying the offending column) for an unterminated string or a stray character. toks(1:ntok) are the tokens; a trailing TK_EOF is not appended (callers use ntok). Parse one statement. Recursive descent into sql_stmt_t. A trailing ; is permitted. Reports SQR_INVALID with a column-anchored errmsg on a syntax error. Execute one parsed statement against an open database, choosing an index-driven or scan-driven plan as appropriate, and fill res. Engine errors propagate through stat/errmsg. db is target because the transaction façade the executor calls needs it. Convenience: lex + parse + execute one source line. Equivalent to sql_parse then sql_exec. Render a result to a formatted unit: an aligned table for a SELECT, a "N row(s)" line for DML, or the message for DDL. Used by the REPL; tests inspect sql_result_t directly instead.

txn_arm sqr Interface

Open (or create) a database directory.

Read more…
txn_begin sqr Interface

Open (or create) a database directory.

Read more…
txn_commit sqr Interface

Open (or create) a database directory.

Read more…
txn_rollback sqr Interface

Open (or create) a database directory.

Read more…