Skip to main content

Module render

Module render 

Source
Expand description

Solution rendering: the readable text form (term_to_string) plus the raw term word the bson encoder walks. (No JSON rendering — the engine speaks text + bson; JSON, if a host wants it, is derived from bson at the host boundary.)

Structs§

Binding
One query-variable binding, materialized at solution time. text is the readable form; buf is a relocatable snapshot of the (already dereferenced) value term — a raw heap word would alias later solutions’ cells once backtracking rewinds and reuses the arena.
RenderedSolution
One captured solution: bindings sorted by variable name, rendered AND snapshotted immediately — heap terms are undone by backtracking afterwards, so anything cell-backed must be copied out before the next solution is pursued (#58).

Functions§

capture_solution
Capture the current solution from the machine’s query variables.
format_term
format_term rendering: plain functional notation (no infix), atoms unquoted, vars _<idx>, lists [a, b|T]. This is the byte contract for error messages (“Runtime error: error(…)”).
term_to_string
term_to_string_quoted
writeq/1 rendering: like term_to_string but atoms that wouldn’t read back unquoted are single-quoted (issue #33). Used only by writeq/1.