lmdraw reference
Every command-line flag, exit code, host type, method, attribute, limit and standard-library signature of lmdraw 0.2.7, taken from the release binary (lmdraw --lmcode-schema, lmdraw --lmcode-signatures) and the repository script guide. Types in signatures are int, float, string, bool and the host or standard types named here.
Command line
| Command | Effect |
| lmdraw --version | Prints lmdraw and the version number. |
| lmdraw --lmcode-schema --json | Prints the exact embedded schema JSON (dsl.schema 2, name lmdraw, functions, types, context). This is the compiler input. |
| lmdraw --lmcode-schema | Prints the compact summary: the context line, then each host type with its method signatures. |
| lmdraw --schema [--json] | Earlier spelling of --lmcode-schema; prints identical output. |
| lmdraw --lmcode-signatures | Prints every registered signature, host and standard, one per line and sorted: 253 lines in 0.2.7 (1 context, 46 host methods, 83 standard functions, 123 standard methods). |
| lmdraw --lmcode FILE [FILE ...] | Verifies every compiled program file against the embedded schema, then runs them in order in one process sharing one scene. Each file is at most 16 MiB. |
With no arguments or an unknown flag the host prints its usage line and exits 2. Failures also print a JSON result between the lines LMCODE_RETURN_BEGIN and LMCODE_RETURN_END, which run_lmcode parses into its return value.
Exit codes
| Code | Meaning | Observed result codes |
| 0 | Success. | |
| 2 | Invalid command line. | CLI_USAGE (phase cli) |
| 3 | Program file load or verification failed, or a host call failed while running. | LOAD_BAD_BYTECODE, LOAD_UNBOUND, RUN_HOST (phases load and run) |
| 4 | Another application failure. | |
Used from lmscript
| Form | Meaning |
| p = _lmcode_ cli="lmdraw" install="github:lmctl-ai/lmdraw@latest"; ... end _lmcode_ | Declares a block compiled against the lmdraw schema. install lets lmscript download the release binary when it is not in the tool cache. |
| r = run_lmcode(p) | Runs the block on the host and returns a map: ok true with result, or ok false with phase, code, message and, for run errors, line and column. |
| ${expr} | Inserts an outer lmscript value into the block as a literal. Integral numbers arrive as int; lists cannot cross. |
| b = lmcode_build(["lmdraw", "--lmcode"]); b.add(p, ["$DSLFILE"]); r = run_lmcode(b) | Runs several blocks in one host process, in order, sharing one scene. The lmdraw executable must be on PATH for this form. Two blocks that return nothing give ok true, result [null,null] and parts 2. |
| lmscript --check FILE.lms | Compiles every block against the host schema without running; exits 2 on an error. |
| lmscript install github:lmctl-ai/lmdraw@latest | Downloads the release binary into the tool cache and prints its tag, path and SHA-256. |
Context and host types
| Name | Kind | Role |
| scene | Context object of type Scene | The one entry point of a block. All constructors and render calls are methods on it. |
| Scene | Host type | The retained scene: canvas, constructors, loaders, measurement and rendering. |
| Node | Host type | Handle to one primitive: rect, circle, ellipse, line, arrow, polyline, path, text, image or an imported SVG element. |
| Shape | Host type | Handle to a labeled diagram shape (box, diamond, cylinder, note, cluster) or a grid cell, with named anchors. |
| Grid | Host type | An invisible rows-by-columns array of cell shapes. |
| Group | Host type | A container of nodes and groups; also returned by connectors, axes, legends and sequence notation. |
| Gradient | Host type | A linear gradient definition referenced as url(#id). |
The schema declares no host free functions and no enum types. Options that behave like enums are strings; their accepted values are listed under String options.
Scene methods
Scene setup and output
| Signature | Returns | Description |
| canvas(int width, int height, string background) | Scene | Starts a new scene with the given size and background color. 1 to 4096 pixels per side and at most 8,000,000 pixels. |
| load_svg(string relative_path, string id) | Node | Parses an SVG that is a direct child of assets/ and returns the retained node with that id. The same path can be loaded again for another id; a different path starts a new scene. |
| load_font(string family, string relative_ttf_path, bool bold) | void | Registers a TrueType font from assets/fonts/ under a family name, as the regular or bold face. |
| measure_text(string content, float size, bool bold) | float | Width in pixels of UTF-8 text at the given size in the embedded fonts, including fallback math glyphs. |
| render_png(string path, int width, int height, int scale) | void | Writes a PNG of width × scale by height × scale pixels. Path is a .png directly under images/ or build/rendered/; scale is 1 to 4. |
Primitives
| Signature | Returns | Description |
| rect(float x, float y, float width, float height, string fill) | Node | Rectangle. |
| circle(float cx, float cy, float radius, string fill) | Node | Circle. |
| ellipse(float cx, float cy, float rx, float ry, string fill) | Node | Ellipse. |
| line(float x1, float y1, float x2, float y2, string stroke, float stroke_width) | Node | Straight line. |
| arrow(float x1, float y1, float x2, float y2, string stroke, float stroke_width) | Node | Line with an arrow marker at its endpoint. |
| polyline(string points, string stroke, float stroke_width) | Node | Open polyline from numeric point pairs. |
| path(string d, string fill, string stroke, float stroke_width) | Node | Path from SVG path data. |
| text(float x, float baseline_y, float size, string content, string fill) | Node | Text in Noto Sans at a pixel size; newlines start new lines with a 1.2 em step. |
| text(float x, float baseline_y, float size, string content, string fill, float wrap_width) | Node | Text wrapped at word boundaries to a positive pixel width; at most 256 lines. |
| image(string png_data_uri, float x, float y, float width, float height) | Node | Embedded PNG from a data URI, at most 1.5 MiB, 4096 pixels per side and 8,000,000 pixels. |
| group() | Group | Empty group. |
| linear_gradient(string id, float x1, float y1, float x2, float y2) | Gradient | Linear gradient; coordinates are fractions 0 to 1 of the painted object bounds. |
Diagram shapes and connectors
| Signature | Returns | Description |
| box(float cx, float cy, float width, float height, string label, string fill, string stroke, float corner_radius, float label_size) | Shape | Rounded rectangle centered at a point, with a centered, measured, wrapped label. An empty label draws none. |
| box(Shape at, string anchor, float width, float height, string label, string fill, string stroke, float corner_radius, float label_size) | Shape | The same box centered on a named anchor of another shape, such as a grid cell. |
| diamond(float cx, float cy, float width, float height, string label, string fill, string stroke, float label_size) | Shape | Labeled decision diamond. |
| cylinder(float cx, float cy, float width, float height, string label, string fill, string stroke, float label_size) | Shape | Labeled datastore cylinder; height must exceed 20 pixels. |
| note(float x, float y, float width, float height, string label, string fill, string stroke, float label_size) | Shape | Folded-corner annotation with a top-left label. |
| cluster(float x, float y, float width, float height, string label, string fill, string stroke, float corner_radius, float label_size) | Shape | Labeled group box drawn behind its children; the label is a bold header in the stroke color. |
| grid(float x, float y, float width, float height, int rows, int cols, float gap_x, float gap_y) | Grid | Invisible array of cell shapes over an extent, separated by gaps. |
| connector(float x1, float y1, float x2, float y2, string routing, string start_marker, string end_marker, string dash, string color, float width, string label, float label_position, float label_dx, float label_dy) | Group | Edge between two points. |
| connector(Shape a, string anchor_a, Shape b, string anchor_b, string routing, string start_marker, string end_marker, string dash, string color, float width, string label, float label_position, float label_dx, float label_dy) | Group | Edge between named anchors of two shapes. |
| connector(float x1, float y1, Shape b, string anchor_b, string routing, string start_marker, string end_marker, string dash, string color, float width, string label, float label_position, float label_dx, float label_dy) | Group | Edge from a point to a shape anchor. |
| connector(Shape a, string anchor_a, float x2, float y2, string routing, string start_marker, string end_marker, string dash, string color, float width, string label, float label_position, float label_dx, float label_dy) | Group | Edge from a shape anchor to a point. |
Sequence notation
| Signature | Returns | Description |
| lifeline(float x, float y0, float y1, string color) | Group | Dashed vertical lifeline. |
| message(float x1, float y1, float x2, float y2, string label, bool dashed, string color) | Group | Arrowed solid or dashed message with a centered label. |
| activation(float x, float y0, float y1, string fill, string stroke) | Group | Activation bar on a lifeline. |
| self_message(float x, float y, string label, string color) | Group | A 60 pixel self-loop with a label. |
Axes and legends
| Signature | Returns | Description |
| axes(float x, float y, float width, float height, float xmin, float xmax, float ymin, float ymax, int intervals, string color) | Group | Horizontal and vertical axes with evenly spaced ticks and numeric labels. Each axis prints all labels with one decimal count, the fewest that show the tick step. |
| log_axes(float x, float y, float width, float height, float xmin, float xmax, float ymin, float ymax, int y_intervals, string color) | Group | Logarithmic x axis with decade and minor ticks and a linear y axis. |
| log_axes(float x, float y, float width, float height, float xmin, float xmax, float ymin, float ymax, bool log_x, bool log_y, int linear_intervals, string color) | Group | Selects a logarithmic or linear scale for each axis independently. |
| legend(float x, float y, string labels_newline, string colors_csv, string text_color) | Group | Rounded legend box with 24 pixel line swatches and 13 pixel labels: 1 to 16 newline-separated labels and matching comma or space separated colors. |
| legend(float x, float y, string labels_newline, string colors_csv, string text_color, string background) | Group | The same legend with a background color, or none. |
Node, Shape, Grid, Group and Gradient methods
| Signature | Returns | Description |
| Node.set_attr(string name, string value) | Node | Sets an SVG-style attribute on the node and returns it, so calls can follow a constructor. |
| Shape.set_attr(string name, string value) | Shape | Styles the shape body (everything but the label text). |
| Shape.cx() | float | Center x of the shape. |
| Shape.cy() | float | Center y of the shape. |
| Grid.cell(int col, int row) | Shape | The cell shape at a column and row. Cells render nothing until given a fill or stroke. |
| Group.add(Node child) | Group | Attaches a node. A node has at most one parent. |
| Group.add(Group child) | Group | Attaches a group. Cycles are refused. |
| Group.set_attr(string name, string value) | Group | Sets a presentation attribute on the group. |
| Gradient.stop(float offset, string color) | Gradient | Adds a color stop at an offset from 0 to 1. A usable gradient needs at least two stops. |
String options
These string parameters accept a fixed set of values.
| Parameter | Accepted values |
| Shape anchor (anchor, anchor_a, anchor_b) | n, s, e, w, ne, nw, se, sw, c |
| connector routing | straight, elbow, curve |
| connector start_marker and end_marker | none, arrow, dot, diamond |
| connector dash | none, or a dash list such as 6 5 |
| connector label_position | A float from 0 to 1 along the drawn path; label_dx and label_dy add a pixel offset. |
| legend background | A color, or none |
| Attributes marker-start, marker-mid, marker-end | arrow, dot, diamond, none |
| Attribute text-anchor | start, middle, end |
Attributes for set_attr
| Family | Names | Values |
| Paint | fill, stroke | Named colors, #RGB, #RGBA, #RRGGBB, #RRGGBBAA, none, or a same-scene gradient reference such as url(#warm). |
| Opacity | opacity, fill-opacity, stroke-opacity | Number from 0 to 1. |
| Stroke | stroke-width | Positive pixel value. |
| Stroke pattern | stroke-dasharray, stroke-dashoffset | Comma or space separated positive pixel lengths (at most 32), or none; the offset is a finite signed pixel length. |
| Markers | marker-start, marker-mid, marker-end | arrow, dot, diamond or none, on constructed line, path and polyline nodes. Size follows stroke-width and fill follows the stroke. |
| Geometry | x, y, width, height, cx, cy, r, rx, ry, x1, y1, x2, y2 | Finite pixels; width, height and r must be positive; rx and ry may be zero. |
| Paths | d, points | Bounded SVG path data or numeric point pairs. |
| Text | font-family, font-size, font-weight, text-anchor | Family name, positive pixel size, numeric or string weight, and start, middle or end. |
| Transform | transform | SVG transform syntax supported by the renderer. |
| Stroke style | stroke-linecap, stroke-linejoin | SVG cap and join values. |
| Image | href | Embedded data:image URI only. |
SVG input
| SVG element | Scene meaning |
| svg | Canvas dimensions and viewBox |
| g | Retained group with child order |
| rect, circle, ellipse, line | Matching geometry node |
| polyline, polygon, path | Path geometry; polygon closes its outline |
| text, tspan | Text and ordered text runs |
| defs, linearGradient, radialGradient, stop | Definitions referenced by local fragment URLs |
| clipPath, mask | Static clipping definitions |
| use | Same-document reference by fragment id |
| title, desc | Document metadata, not painted |
Supported SVG attributes are xmlns, xmlns:xlink, width, height, viewBox, preserveAspectRatio, role, aria-labelledby, aria-label, id, x, y, rx, ry, cx, cy, r, x1, y1, x2, y2, points, d, fill, fill-opacity, stroke, stroke-width, stroke-linecap, stroke-linejoin, stroke-opacity, opacity, transform, font-family, font-size, font-weight, text-anchor, href, xlink:href, gradientUnits, gradientTransform, offset, stop-color, stop-opacity, clip-path and mask. Refused: CSS class and style attributes and stylesheets, script and event handlers, DTDs and entities, SMIL animation, foreignObject, filters, external URLs or files, and embedded data images.
Limits
| Item | Limit |
| Coordinates | Finite, within plus or minus 1,000,000 pixels |
| Canvas | 1 to 4096 pixels per side; at most 8,000,000 pixels |
| Render scale | Integer 1 to 4; scaled output at most 8,000,000 pixels |
| Scene nodes | 10,000 per host run |
| Gradients | 1,024, with at most 128 stops each |
| SVG input | Direct child of assets/, at most 2 MiB |
| Font input | TrueType, direct child of assets/fonts/, at most 8 MiB |
| Image node | Embedded PNG data URI, at most 1.5 MiB, 4096 pixels per side, 8,000,000 pixels |
| Wrapped text | 256 lines |
| Dash array | 32 entries |
| Legend | 1 to 16 labels |
| Program file | 16 MiB per file |
| PNG output | A .png directly under images/ or build/rendered/; no subdirectories, traversal or symbolic links |
Host error messages
These messages were produced by lmdraw 0.2.7. Run errors carry the prefix dsl line L:C and the code RUN_HOST.
| Message | Cause |
| call scene.canvas or scene.load_svg before drawing | A constructor ran before a scene existed. |
| canvas must fit 1..4096 pixels per side and 8000000 pixels total | Canvas size out of range. |
| render scale must be 1..4 and keep total output at or below 8000000 pixels | Scale or scaled output out of range. |
| PNG output must be a .png file directly under build/rendered/ or images/ | Output path outside the allowed folders. |
| load_svg accepts only an assets/*.svg relative path | SVG path outside assets/. |
| unsupported node attribute 'NAME'; use SVG geometry, fill, stroke, opacity, transform, or text attributes | set_attr with a name the host does not accept. |
| bytecode input must be a readable file no larger than 16 MiB | The --lmcode file is missing, unreadable or too large (phase load, exit 3). |
| not a DSL bytecode file: bad magic (expected 'DSLB') | The --lmcode file is not a compiled program (code LOAD_BAD_BYTECODE, exit 3). |
| import 'fn NAME(...) -> T' is not provided by the host | The block calls a function the installed host does not register (code LOAD_UNBOUND). |
| expected --lmcode FILE [FILE ...] | Invalid command line (code CLI_USAGE, exit 2). |
Standard library in lmdraw 0.2.7
lmdraw 0.2.7 registers 206 standard lmcode_std_v3 signatures in addition to its 46 host methods. They are available in every block without a declaration. Strings are raw bytes with byte-based lengths and offsets. Collection and Json handles are valid only during the run that created them. The file functions use the process working directory without a sandbox. The current lmcode_std_v3 catalog has 226 signatures; the 20 that 0.2.7 does not ship are listed under REST and CLI interfaces.
Return values (24)
| Signature | Description |
| lmcode_return_null() -> void | Set the invocation return value to JSON null. |
| lmcode_return_put(string, FloatList) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, FloatMap) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, IntList) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, IntMap) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, Json) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, StrList) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, StrMap) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, bool) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, float) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, int) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put(string, string) -> void | Store a deep owned copy at a top-level return field. A null root is promoted to an object. |
| lmcode_return_put_null(string) -> void | Set a top-level return field to JSON null. A null root is promoted to an object. |
| lmcode_return_set(FloatList) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(FloatMap) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(IntList) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(IntMap) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(Json) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(StrList) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(StrMap) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(bool) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(float) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(int) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
| lmcode_return_set(string) -> void | Replace the invocation return value with a deep owned copy; writing again replaces it. |
String functions (20)
| Signature | Description |
| str_base64_decode(string) -> string | Decode canonical padded RFC 4648 Base64; reject whitespace, URL-safe symbols, invalid padding and nonzero pad bits. Empty input is legal. |
| str_base64_encode(string) -> string | Encode bytes as canonical padded RFC 4648 Base64 without line breaks. Empty input is legal. |
| str_contains(string, string) -> bool | Byte substring search; an empty needle matches. |
| str_ends_with(string, string) -> bool | Byte suffix comparison; an empty suffix matches. |
| str_find(string, string) -> int | Return the first byte offset or -1; an empty needle returns 0. |
| str_hex_decode(string) -> string | Decode an even number of ASCII 0-9/a-f/A-F digits; reject separators, prefixes and whitespace. Empty input is legal. |
| str_hex_encode(string) -> string | Encode bytes as lowercase ASCII hex. Empty input is legal. |
| str_is_float(string) -> bool | Accept a complete signed decimal with optional decimal point and exponent, including representable subnormals. Reject whitespace, hex, NaN/infinity, overflow and underflow to zero. |
| str_is_int(string) -> bool | Report whether the complete signed decimal token fits int64. |
| str_len(string) -> int | Return the raw byte length, including NUL and invalid UTF-8 bytes. |
| str_lower(string) -> string | Lowercase ASCII A-Z bytes; preserve every other byte. |
| str_match(string, string) -> bool | Match a whole byte string with *, ?, classes, ranges, negation, and backslash escapes. |
| str_repeat(string, int) -> string | Repeat raw bytes; reject negative counts and platform-unrepresentable result sizes. |
| str_replace(string, string, string) -> string | Replace nonoverlapping byte matches left to right; an empty search leaves bytes unchanged. No implicit result-size budget. |
| str_starts_with(string, string) -> bool | Byte prefix comparison; an empty prefix matches. |
| str_substr(string, int, int) -> string | Return a byte slice; clamp negative starts and overlong counts, with nonpositive counts empty. |
| str_to_float(string) -> float | Parse the same complete decimal grammar as str_is_float; return 0.0 on invalid input, overflow or underflow to zero. Preserve valid signed zero. |
| str_to_int(string) -> int | Parse a complete signed decimal int64 token; return zero on failure. |
| str_trim(string) -> string | Remove ASCII space and bytes 0x09 through 0x0d from both ends. |
| str_upper(string) -> string | Uppercase ASCII a-z bytes; preserve every other byte. |
Math functions (16)
| Signature | Description |
| math_abs(float) -> float | Absolute value; integer arithmetic wraps, and float signed zero is cleared. |
| math_abs(int) -> int | Absolute value; integer arithmetic wraps, and float signed zero is cleared. |
| math_ceil(float) -> float | Identity for int; ceiling for binary64 while preserving signed zero. |
| math_ceil(int) -> int | Identity for int; ceiling for binary64 while preserving signed zero. |
| math_floor(float) -> float | Identity for int; floor for binary64 while preserving signed zero. |
| math_floor(int) -> int | Identity for int; floor for binary64 while preserving signed zero. |
| math_max(float, float) -> float | Maximum; integer comparison, or NaN propagation with first-operand ties for floats. |
| math_max(int, int) -> int | Maximum; integer comparison, or NaN propagation with first-operand ties for floats. |
| math_min(float, float) -> float | Minimum; integer comparison, or NaN propagation with first-operand ties for floats. |
| math_min(int, int) -> int | Minimum; integer comparison, or NaN propagation with first-operand ties for floats. |
| math_pow(float, float) -> float | Float power follows IEEE/libm special cases. |
| math_pow(int, int) -> int | Integer exponentiation wraps modulo 2^64; the exponent must be nonnegative. |
| math_round(float) -> float | Identity for int; binary64 nearest integer with halfway cases away from zero. |
| math_round(int) -> int | Identity for int; binary64 nearest integer with halfway cases away from zero. |
| math_sqrt(float) -> float | Binary64 square root for float. |
| math_sqrt(int) -> int | Exact floor integer square root; the argument must be nonnegative. |
File functions (5)
| Signature | Description |
| file_append(string, string) -> void | Create or append all raw bytes to a regular file. |
| file_exists(string) -> bool | Return true only when metadata identifies a regular file; missing and nonregular paths return false. |
| file_lines(string) -> StrList | Read raw bytes and split on every LF, preserving CR and empty fields: empty file gives [""], and "a\n" gives ["a", ""]. Return an arena-owned StrList. |
| file_read(string) -> string | Read a complete regular file as raw bytes. |
| file_write(string, string) -> void | Create or truncate a regular file and write all raw bytes. |
Json and templates (13)
| Signature | Description |
| json_parse(string) -> Json | Parse strict UTF-8 JSON eagerly; int64 integers, finite binary64 decimals, depth <=256, duplicate decoded keys rejected. |
| template_render(string, Json) -> string | Render arbitrary text with <path>, <items[0]>, <items:{item|body}; separator=", "> and <if(flag)>yes<else>no<endif>. Loop index is zero-based. << emits <. Inserted values remain literal. |
| Json.as_bool() -> bool | Read a boolean. |
| Json.as_float() -> float | Read binary64; integer conversion may round. |
| Json.as_int() -> int | Read a signed int64 integer. |
| Json.as_string() -> string | Read decoded UTF-8 bytes including escaped NUL. |
| Json.at(int) -> Json | Borrow an array child. |
| Json.get(string) -> Json | Borrow an object member. |
| Json.has(string) -> bool | Test a decoded object key. |
| Json.keys() -> StrList | Snapshot keys in insertion order. |
| Json.kind() -> string | Return null/bool/int/float/string/array/object. |
| Json.len() -> int | Count array items or object keys. |
| Json.to_json() -> string | Emit compact tokens preserving number/string spellings and object order. |
Collection constructors (16)
| Signature | Description |
| float_list() -> FloatList | Construct an empty FloatList in the active collection arena. |
| float_map() -> FloatMap | Create an insertion-ordered byte-key map. |
| float_pq() -> FloatPQ | Create an empty FloatPQ in the run arena. |
| float_queue() -> FloatQueue | Create an empty FloatQueue in the run arena. |
| float_stack() -> FloatStack | Create an empty FloatStack in the run arena. |
| int_list() -> IntList | Construct an empty IntList in the active collection arena. |
| int_map() -> IntMap | Create an insertion-ordered byte-key map. |
| int_pq() -> IntPQ | Create an empty IntPQ in the run arena. |
| int_queue() -> IntQueue | Create an empty IntQueue in the run arena. |
| int_stack() -> IntStack | Create an empty IntStack in the run arena. |
| str_list() -> StrList | Construct an empty StrList in the active collection arena. |
| str_map() -> StrMap | Construct an empty insertion-ordered StrMap in the active collection arena. |
| str_pq() -> StrPQ | Create an empty StrPQ in the run arena. |
| str_queue() -> StrQueue | Create an empty StrQueue in the run arena. |
| str_split(string, string) -> StrList | Split raw bytes on every nonoverlapping nonempty separator into a StrList. |
| str_stack() -> StrStack | Create an empty StrStack in the run arena. |
Lists (22)
| Signature | Description |
| FloatList.add(float) -> FloatList | Append a float and return the receiver. |
| FloatList.at(int) -> float | Return the element at a zero-based index. |
| FloatList.clear() -> FloatList | Remove elements and return the receiver. |
| FloatList.contains(float) -> bool | Test float == equality; NaN never matches. |
| FloatList.index_of(float) -> int | Return the first float == index or -1; NaN never matches. |
| FloatList.len() -> int | Return element count. |
| FloatList.set(int, float) -> FloatList | Replace an indexed float and return the receiver. |
| IntList.add(int) -> IntList | Append an int and return the receiver. |
| IntList.at(int) -> int | Return the element at a zero-based index. |
| IntList.clear() -> IntList | Remove elements and return the receiver. |
| IntList.contains(int) -> bool | Test integer equality of elements. |
| IntList.index_of(int) -> int | Return the first equal index or -1. |
| IntList.len() -> int | Return element count. |
| IntList.set(int, int) -> IntList | Replace an indexed int and return the receiver. |
| StrList.add(string) -> StrList | Append a byte string and return the receiver. |
| StrList.at(int) -> string | Return the element at a zero-based index. |
| StrList.clear() -> StrList | Remove elements and return the receiver. |
| StrList.contains(string) -> bool | Test byte equality of elements. |
| StrList.index_of(string) -> int | Return the first byte-equal index or -1. |
| StrList.join(string) -> string | Join byte strings with a byte separator. |
| StrList.len() -> int | Return element count. |
| StrList.set(int, string) -> StrList | Replace an indexed byte string and return the receiver. |
Maps (30)
| Signature | Description |
| FloatMap.clear() -> FloatMap | Remove all keys; return self. |
| FloatMap.get(string) -> float | Read a value. |
| FloatMap.get_or(string, float) -> float | Read a value or the supplied fallback. |
| FloatMap.has(string) -> bool | Test a byte-exact key. |
| FloatMap.key_at(int) -> string | Read a live key in insertion order. |
| FloatMap.keys() -> StrList | Allocate an independent StrList snapshot of keys in insertion order; later map/list mutations do not alias. Preserve raw bytes and float payload bits. |
| FloatMap.len() -> int | Count live keys. |
| FloatMap.remove(string) -> bool | Remove a key; reinsertion goes last. |
| FloatMap.set(string, float) -> FloatMap | Insert/update; overwrites retain original position; return self. |
| FloatMap.values() -> FloatList | Allocate an independent FloatList snapshot of values in insertion order; later map/list mutations do not alias. Preserve raw bytes and float payload bits. |
| IntMap.clear() -> IntMap | Remove all keys; return self. |
| IntMap.get(string) -> int | Read a value. |
| IntMap.get_or(string, int) -> int | Read a value or the supplied fallback. |
| IntMap.has(string) -> bool | Test a byte-exact key. |
| IntMap.key_at(int) -> string | Read a live key in insertion order. |
| IntMap.keys() -> StrList | Allocate an independent StrList snapshot of keys in insertion order; later map/list mutations do not alias. Preserve raw bytes and float payload bits. |
| IntMap.len() -> int | Count live keys. |
| IntMap.remove(string) -> bool | Remove a key; reinsertion goes last. |
| IntMap.set(string, int) -> IntMap | Insert/update; overwrites retain original position; return self. |
| IntMap.values() -> IntList | Allocate an independent IntList snapshot of values in insertion order; later map/list mutations do not alias. Preserve raw bytes and float payload bits. |
| StrMap.clear() -> StrMap | Remove entries and return the receiver. |
| StrMap.get(string) -> string | Return a byte-key value. |
| StrMap.get_or(string, string) -> string | Return a byte-key value or the fallback. |
| StrMap.has(string) -> bool | Test byte-key presence. |
| StrMap.key_at(int) -> string | Return the insertion-order key at a zero-based index. |
| StrMap.keys() -> StrList | Allocate an independent StrList snapshot of keys in insertion order; later map/list mutations do not alias. Preserve raw bytes and float payload bits. |
| StrMap.len() -> int | Return insertion-order entry count. |
| StrMap.remove(string) -> bool | Remove a key and report whether it existed. |
| StrMap.set(string, string) -> StrMap | Insert or replace a value while preserving an existing key position; removal tombstones compact on key_at. |
| StrMap.values() -> StrList | Allocate an independent StrList snapshot of values in insertion order; later map/list mutations do not alias. Preserve raw bytes and float payload bits. |
Queues and stacks (42)
| Signature | Description |
| FloatQueue.at(int) -> float | Read in pop order without consuming; index zero is next to pop. |
| FloatQueue.clear() -> FloatQueue | Remove all items; return self; reset PQ insertion sequence. |
| FloatQueue.empty() -> bool | Return whether there are no items. |
| FloatQueue.len() -> int | Return the number of items. |
| FloatQueue.peek() -> float | Read without removing the next item in pop order. |
| FloatQueue.pop() -> float | Remove and return the next item in pop order. |
| FloatQueue.push(float) -> FloatQueue | Append an item; return the same container. |
| FloatStack.at(int) -> float | Read in pop order without consuming; index zero is next to pop. |
| FloatStack.clear() -> FloatStack | Remove all items; return self; reset PQ insertion sequence. |
| FloatStack.empty() -> bool | Return whether there are no items. |
| FloatStack.len() -> int | Return the number of items. |
| FloatStack.peek() -> float | Read without removing the next item in pop order. |
| FloatStack.pop() -> float | Remove and return the next item in pop order. |
| FloatStack.push(float) -> FloatStack | Append an item; return the same container. |
| IntQueue.at(int) -> int | Read in pop order without consuming; index zero is next to pop. |
| IntQueue.clear() -> IntQueue | Remove all items; return self; reset PQ insertion sequence. |
| IntQueue.empty() -> bool | Return whether there are no items. |
| IntQueue.len() -> int | Return the number of items. |
| IntQueue.peek() -> int | Read without removing the next item in pop order. |
| IntQueue.pop() -> int | Remove and return the next item in pop order. |
| IntQueue.push(int) -> IntQueue | Append an item; return the same container. |
| IntStack.at(int) -> int | Read in pop order without consuming; index zero is next to pop. |
| IntStack.clear() -> IntStack | Remove all items; return self; reset PQ insertion sequence. |
| IntStack.empty() -> bool | Return whether there are no items. |
| IntStack.len() -> int | Return the number of items. |
| IntStack.peek() -> int | Read without removing the next item in pop order. |
| IntStack.pop() -> int | Remove and return the next item in pop order. |
| IntStack.push(int) -> IntStack | Append an item; return the same container. |
| StrQueue.at(int) -> string | Read in pop order without consuming; index zero is next to pop. |
| StrQueue.clear() -> StrQueue | Remove all items; return self; reset PQ insertion sequence. |
| StrQueue.empty() -> bool | Return whether there are no items. |
| StrQueue.len() -> int | Return the number of items. |
| StrQueue.peek() -> string | Read without removing the next item in pop order. |
| StrQueue.pop() -> string | Remove and return the next item in pop order. |
| StrQueue.push(string) -> StrQueue | Append an item; return the same container. |
| StrStack.at(int) -> string | Read in pop order without consuming; index zero is next to pop. |
| StrStack.clear() -> StrStack | Remove all items; return self; reset PQ insertion sequence. |
| StrStack.empty() -> bool | Return whether there are no items. |
| StrStack.len() -> int | Return the number of items. |
| StrStack.peek() -> string | Read without removing the next item in pop order. |
| StrStack.pop() -> string | Remove and return the next item in pop order. |
| StrStack.push(string) -> StrStack | Append an item; return the same container. |
Priority queues (18)
| Signature | Description |
| FloatPQ.clear() -> FloatPQ | Remove all items; return self; reset PQ insertion sequence. |
| FloatPQ.empty() -> bool | Return whether there are no items. |
| FloatPQ.len() -> int | Return the number of items. |
| FloatPQ.peek() -> float | Read without removing the next item in pop order. |
| FloatPQ.pop() -> float | Remove and return the next item in pop order. |
| FloatPQ.push(float, float) -> FloatPQ | Push with finite min-first priority; stable insertion-order ties including signed zero. |
| IntPQ.clear() -> IntPQ | Remove all items; return self; reset PQ insertion sequence. |
| IntPQ.empty() -> bool | Return whether there are no items. |
| IntPQ.len() -> int | Return the number of items. |
| IntPQ.peek() -> int | Read without removing the next item in pop order. |
| IntPQ.pop() -> int | Remove and return the next item in pop order. |
| IntPQ.push(int, float) -> IntPQ | Push with finite min-first priority; stable insertion-order ties including signed zero. |
| StrPQ.clear() -> StrPQ | Remove all items; return self; reset PQ insertion sequence. |
| StrPQ.empty() -> bool | Return whether there are no items. |
| StrPQ.len() -> int | Return the number of items. |
| StrPQ.peek() -> string | Read without removing the next item in pop order. |
| StrPQ.pop() -> string | Remove and return the next item in pop order. |
| StrPQ.push(string, float) -> StrPQ | Push with finite min-first priority; stable insertion-order ties including signed zero. |
REST and CLI interfaces
The current lmcode_std_v3 catalog adds the former lmcode_std_rest_v1 module: 10 standard interfaces, 5 functions and 15 RestExchange methods, for 226 signatures in total. lmdraw 0.2.7 does not register them. The lmscript 0.2.482 compiler accepts a call such as rest_stop() in an lmdraw block, but the 0.2.7 host then refuses the program at load time with code LOAD_UNBOUND and the message that the import is not provided by the host. They become usable in lmdraw blocks when a release synced to the 226-signature catalog is published; the tables below describe the catalog, not lmdraw 0.2.7.
Standard interfaces (not in lmdraw 0.2.7)
| Interface | Handler shape | Role |
| RestGet | (exchange: RestExchange) -> void | Handler for GET routes. |
| RestPost | (exchange: RestExchange) -> void | Handler for POST routes. |
| RestPut | (exchange: RestExchange) -> void | Handler for PUT routes. |
| RestDelete | (exchange: RestExchange) -> void | Handler for DELETE routes. |
| RestPatch | (exchange: RestExchange) -> void | Handler for PATCH routes. |
| RestHead | (exchange: RestExchange) -> void | Handler for HEAD routes. |
| RestOptions | (exchange: RestExchange) -> void | Handler for OPTIONS routes. |
| RestHandler | (exchange: RestExchange) -> void | Generic handler bound to a route with rest_route. |
| CliCommand | (exchange: RestExchange) -> void | Handler for a command dispatched by rest_cli. |
| CliOption | (exchange: RestExchange) -> void | Handler for an option dispatched by rest_cli. |
Functions and RestExchange methods (not in lmdraw 0.2.7)
| Signature | Description |
| rest_cli(StrList) -> string | Auto-register annotated REST and CLI routes, dispatch a single stateless CLI argv request through CliOption and CliCommand/REST handlers, and return the response body. |
| rest_config(string, string) -> void | Set a configuration or initial session store entry on the global single-session REST controller before serving. |
| rest_route(string, string, string) -> void | Register a route pattern for an HTTP method and bind it to a @tag RestHandler entry. |
| rest_serve() -> void | Auto-register annotated REST routes, validate route bindings, and arm the global single-session stdio server loop. |
| rest_stop() -> void | Stop the active REST stdio server loop after the current exchange finishes. |
| RestExchange.body() -> string | Return the raw request body bytes. |
| RestExchange.get(string) -> string | Read a string value from the global single-session store, or empty string when absent. |
| RestExchange.has_header(string) -> bool | Return whether the request contains a case-insensitive header name. |
| RestExchange.has_query(string) -> bool | Return whether the request URL contains the query key. |
| RestExchange.header(string) -> string | Read a case-insensitive request header value, or empty string when absent. |
| RestExchange.increment(string) -> int | Increment a decimal integer counter in the global single-session store and return the new value. |
| RestExchange.json(string) -> void | Validate strict UTF-8 JSON, set default content-type to application/json, and replace the response body. |
| RestExchange.method() -> string | Return the canonical uppercase HTTP method of the request. |
| RestExchange.param(string) -> string | Read a matched path parameter by name. |
| RestExchange.path() -> string | Return the decoded request path without query string. |
| RestExchange.query(string) -> string | Read the last decoded query value for a key, or empty string when absent. |
| RestExchange.send(string) -> void | Set default content-type to text/plain; charset=utf-8 if unset and replace the response body. |
| RestExchange.set(string, string) -> void | Store a key-value pair in the global single-session store. |
| RestExchange.set_header(string, string) -> void | Set or replace a case-insensitive response header. |
| RestExchange.status(int) -> void | Set the HTTP response status code (100..599). |
Route templates accept {param} and {rest...} as well as :param and :rest... placeholders. rest_cli(argv) is a stateless mode that dispatches options, commands and REST routes for a single argv request and returns the response body.