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

CommandEffect
lmdraw --versionPrints lmdraw and the version number.
lmdraw --lmcode-schema --jsonPrints the exact embedded schema JSON (dsl.schema 2, name lmdraw, functions, types, context). This is the compiler input.
lmdraw --lmcode-schemaPrints 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-signaturesPrints 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

CodeMeaningObserved result codes
0Success.
2Invalid command line.CLI_USAGE (phase cli)
3Program file load or verification failed, or a host call failed while running.LOAD_BAD_BYTECODE, LOAD_UNBOUND, RUN_HOST (phases load and run)
4Another application failure.

Used from lmscript

FormMeaning
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.lmsCompiles every block against the host schema without running; exits 2 on an error.
lmscript install github:lmctl-ai/lmdraw@latestDownloads the release binary into the tool cache and prints its tag, path and SHA-256.

Context and host types

NameKindRole
sceneContext object of type SceneThe one entry point of a block. All constructors and render calls are methods on it.
SceneHost typeThe retained scene: canvas, constructors, loaders, measurement and rendering.
NodeHost typeHandle to one primitive: rect, circle, ellipse, line, arrow, polyline, path, text, image or an imported SVG element.
ShapeHost typeHandle to a labeled diagram shape (box, diamond, cylinder, note, cluster) or a grid cell, with named anchors.
GridHost typeAn invisible rows-by-columns array of cell shapes.
GroupHost typeA container of nodes and groups; also returned by connectors, axes, legends and sequence notation.
GradientHost typeA 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

SignatureReturnsDescription
canvas(int width, int height, string background)SceneStarts 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)NodeParses 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)voidRegisters a TrueType font from assets/fonts/ under a family name, as the regular or bold face.
measure_text(string content, float size, bool bold)floatWidth 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)voidWrites 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

SignatureReturnsDescription
rect(float x, float y, float width, float height, string fill)NodeRectangle.
circle(float cx, float cy, float radius, string fill)NodeCircle.
ellipse(float cx, float cy, float rx, float ry, string fill)NodeEllipse.
line(float x1, float y1, float x2, float y2, string stroke, float stroke_width)NodeStraight line.
arrow(float x1, float y1, float x2, float y2, string stroke, float stroke_width)NodeLine with an arrow marker at its endpoint.
polyline(string points, string stroke, float stroke_width)NodeOpen polyline from numeric point pairs.
path(string d, string fill, string stroke, float stroke_width)NodePath from SVG path data.
text(float x, float baseline_y, float size, string content, string fill)NodeText 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)NodeText 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)NodeEmbedded PNG from a data URI, at most 1.5 MiB, 4096 pixels per side and 8,000,000 pixels.
group()GroupEmpty group.
linear_gradient(string id, float x1, float y1, float x2, float y2)GradientLinear gradient; coordinates are fractions 0 to 1 of the painted object bounds.

Diagram shapes and connectors

SignatureReturnsDescription
box(float cx, float cy, float width, float height, string label, string fill, string stroke, float corner_radius, float label_size)ShapeRounded 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)ShapeThe 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)ShapeLabeled decision diamond.
cylinder(float cx, float cy, float width, float height, string label, string fill, string stroke, float label_size)ShapeLabeled 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)ShapeFolded-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)ShapeLabeled 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)GridInvisible 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)GroupEdge 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)GroupEdge 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)GroupEdge 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)GroupEdge from a shape anchor to a point.

Sequence notation

SignatureReturnsDescription
lifeline(float x, float y0, float y1, string color)GroupDashed vertical lifeline.
message(float x1, float y1, float x2, float y2, string label, bool dashed, string color)GroupArrowed solid or dashed message with a centered label.
activation(float x, float y0, float y1, string fill, string stroke)GroupActivation bar on a lifeline.
self_message(float x, float y, string label, string color)GroupA 60 pixel self-loop with a label.

Axes and legends

SignatureReturnsDescription
axes(float x, float y, float width, float height, float xmin, float xmax, float ymin, float ymax, int intervals, string color)GroupHorizontal 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)GroupLogarithmic 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)GroupSelects a logarithmic or linear scale for each axis independently.
legend(float x, float y, string labels_newline, string colors_csv, string text_color)GroupRounded 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)GroupThe same legend with a background color, or none.

Node, Shape, Grid, Group and Gradient methods

SignatureReturnsDescription
Node.set_attr(string name, string value)NodeSets an SVG-style attribute on the node and returns it, so calls can follow a constructor.
Shape.set_attr(string name, string value)ShapeStyles the shape body (everything but the label text).
Shape.cx()floatCenter x of the shape.
Shape.cy()floatCenter y of the shape.
Grid.cell(int col, int row)ShapeThe cell shape at a column and row. Cells render nothing until given a fill or stroke.
Group.add(Node child)GroupAttaches a node. A node has at most one parent.
Group.add(Group child)GroupAttaches a group. Cycles are refused.
Group.set_attr(string name, string value)GroupSets a presentation attribute on the group.
Gradient.stop(float offset, string color)GradientAdds 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.

ParameterAccepted values
Shape anchor (anchor, anchor_a, anchor_b)n, s, e, w, ne, nw, se, sw, c
connector routingstraight, elbow, curve
connector start_marker and end_markernone, arrow, dot, diamond
connector dashnone, or a dash list such as 6 5
connector label_positionA float from 0 to 1 along the drawn path; label_dx and label_dy add a pixel offset.
legend backgroundA color, or none
Attributes marker-start, marker-mid, marker-endarrow, dot, diamond, none
Attribute text-anchorstart, middle, end

Attributes for set_attr

FamilyNamesValues
Paintfill, strokeNamed colors, #RGB, #RGBA, #RRGGBB, #RRGGBBAA, none, or a same-scene gradient reference such as url(#warm).
Opacityopacity, fill-opacity, stroke-opacityNumber from 0 to 1.
Strokestroke-widthPositive pixel value.
Stroke patternstroke-dasharray, stroke-dashoffsetComma or space separated positive pixel lengths (at most 32), or none; the offset is a finite signed pixel length.
Markersmarker-start, marker-mid, marker-endarrow, dot, diamond or none, on constructed line, path and polyline nodes. Size follows stroke-width and fill follows the stroke.
Geometryx, y, width, height, cx, cy, r, rx, ry, x1, y1, x2, y2Finite pixels; width, height and r must be positive; rx and ry may be zero.
Pathsd, pointsBounded SVG path data or numeric point pairs.
Textfont-family, font-size, font-weight, text-anchorFamily name, positive pixel size, numeric or string weight, and start, middle or end.
TransformtransformSVG transform syntax supported by the renderer.
Stroke stylestroke-linecap, stroke-linejoinSVG cap and join values.
ImagehrefEmbedded data:image URI only.

SVG input

SVG elementScene meaning
svgCanvas dimensions and viewBox
gRetained group with child order
rect, circle, ellipse, lineMatching geometry node
polyline, polygon, pathPath geometry; polygon closes its outline
text, tspanText and ordered text runs
defs, linearGradient, radialGradient, stopDefinitions referenced by local fragment URLs
clipPath, maskStatic clipping definitions
useSame-document reference by fragment id
title, descDocument 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

ItemLimit
CoordinatesFinite, within plus or minus 1,000,000 pixels
Canvas1 to 4096 pixels per side; at most 8,000,000 pixels
Render scaleInteger 1 to 4; scaled output at most 8,000,000 pixels
Scene nodes10,000 per host run
Gradients1,024, with at most 128 stops each
SVG inputDirect child of assets/, at most 2 MiB
Font inputTrueType, direct child of assets/fonts/, at most 8 MiB
Image nodeEmbedded PNG data URI, at most 1.5 MiB, 4096 pixels per side, 8,000,000 pixels
Wrapped text256 lines
Dash array32 entries
Legend1 to 16 labels
Program file16 MiB per file
PNG outputA .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.

MessageCause
call scene.canvas or scene.load_svg before drawingA constructor ran before a scene existed.
canvas must fit 1..4096 pixels per side and 8000000 pixels totalCanvas size out of range.
render scale must be 1..4 and keep total output at or below 8000000 pixelsScale 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 pathSVG path outside assets/.
unsupported node attribute 'NAME'; use SVG geometry, fill, stroke, opacity, transform, or text attributesset_attr with a name the host does not accept.
bytecode input must be a readable file no larger than 16 MiBThe --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 hostThe 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)

SignatureDescription
lmcode_return_null() -> voidSet the invocation return value to JSON null.
lmcode_return_put(string, FloatList) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, FloatMap) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, IntList) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, IntMap) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, Json) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, StrList) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, StrMap) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, bool) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, float) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, int) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put(string, string) -> voidStore a deep owned copy at a top-level return field. A null root is promoted to an object.
lmcode_return_put_null(string) -> voidSet a top-level return field to JSON null. A null root is promoted to an object.
lmcode_return_set(FloatList) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(FloatMap) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(IntList) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(IntMap) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(Json) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(StrList) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(StrMap) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(bool) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(float) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(int) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.
lmcode_return_set(string) -> voidReplace the invocation return value with a deep owned copy; writing again replaces it.

String functions (20)

SignatureDescription
str_base64_decode(string) -> stringDecode canonical padded RFC 4648 Base64; reject whitespace, URL-safe symbols, invalid padding and nonzero pad bits. Empty input is legal.
str_base64_encode(string) -> stringEncode bytes as canonical padded RFC 4648 Base64 without line breaks. Empty input is legal.
str_contains(string, string) -> boolByte substring search; an empty needle matches.
str_ends_with(string, string) -> boolByte suffix comparison; an empty suffix matches.
str_find(string, string) -> intReturn the first byte offset or -1; an empty needle returns 0.
str_hex_decode(string) -> stringDecode 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) -> stringEncode bytes as lowercase ASCII hex. Empty input is legal.
str_is_float(string) -> boolAccept 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) -> boolReport whether the complete signed decimal token fits int64.
str_len(string) -> intReturn the raw byte length, including NUL and invalid UTF-8 bytes.
str_lower(string) -> stringLowercase ASCII A-Z bytes; preserve every other byte.
str_match(string, string) -> boolMatch a whole byte string with *, ?, classes, ranges, negation, and backslash escapes.
str_repeat(string, int) -> stringRepeat raw bytes; reject negative counts and platform-unrepresentable result sizes.
str_replace(string, string, string) -> stringReplace nonoverlapping byte matches left to right; an empty search leaves bytes unchanged. No implicit result-size budget.
str_starts_with(string, string) -> boolByte prefix comparison; an empty prefix matches.
str_substr(string, int, int) -> stringReturn a byte slice; clamp negative starts and overlong counts, with nonpositive counts empty.
str_to_float(string) -> floatParse 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) -> intParse a complete signed decimal int64 token; return zero on failure.
str_trim(string) -> stringRemove ASCII space and bytes 0x09 through 0x0d from both ends.
str_upper(string) -> stringUppercase ASCII a-z bytes; preserve every other byte.

Math functions (16)

SignatureDescription
math_abs(float) -> floatAbsolute value; integer arithmetic wraps, and float signed zero is cleared.
math_abs(int) -> intAbsolute value; integer arithmetic wraps, and float signed zero is cleared.
math_ceil(float) -> floatIdentity for int; ceiling for binary64 while preserving signed zero.
math_ceil(int) -> intIdentity for int; ceiling for binary64 while preserving signed zero.
math_floor(float) -> floatIdentity for int; floor for binary64 while preserving signed zero.
math_floor(int) -> intIdentity for int; floor for binary64 while preserving signed zero.
math_max(float, float) -> floatMaximum; integer comparison, or NaN propagation with first-operand ties for floats.
math_max(int, int) -> intMaximum; integer comparison, or NaN propagation with first-operand ties for floats.
math_min(float, float) -> floatMinimum; integer comparison, or NaN propagation with first-operand ties for floats.
math_min(int, int) -> intMinimum; integer comparison, or NaN propagation with first-operand ties for floats.
math_pow(float, float) -> floatFloat power follows IEEE/libm special cases.
math_pow(int, int) -> intInteger exponentiation wraps modulo 2^64; the exponent must be nonnegative.
math_round(float) -> floatIdentity for int; binary64 nearest integer with halfway cases away from zero.
math_round(int) -> intIdentity for int; binary64 nearest integer with halfway cases away from zero.
math_sqrt(float) -> floatBinary64 square root for float.
math_sqrt(int) -> intExact floor integer square root; the argument must be nonnegative.

File functions (5)

SignatureDescription
file_append(string, string) -> voidCreate or append all raw bytes to a regular file.
file_exists(string) -> boolReturn true only when metadata identifies a regular file; missing and nonregular paths return false.
file_lines(string) -> StrListRead 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) -> stringRead a complete regular file as raw bytes.
file_write(string, string) -> voidCreate or truncate a regular file and write all raw bytes.

Json and templates (13)

SignatureDescription
json_parse(string) -> JsonParse strict UTF-8 JSON eagerly; int64 integers, finite binary64 decimals, depth <=256, duplicate decoded keys rejected.
template_render(string, Json) -> stringRender 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() -> boolRead a boolean.
Json.as_float() -> floatRead binary64; integer conversion may round.
Json.as_int() -> intRead a signed int64 integer.
Json.as_string() -> stringRead decoded UTF-8 bytes including escaped NUL.
Json.at(int) -> JsonBorrow an array child.
Json.get(string) -> JsonBorrow an object member.
Json.has(string) -> boolTest a decoded object key.
Json.keys() -> StrListSnapshot keys in insertion order.
Json.kind() -> stringReturn null/bool/int/float/string/array/object.
Json.len() -> intCount array items or object keys.
Json.to_json() -> stringEmit compact tokens preserving number/string spellings and object order.

Collection constructors (16)

SignatureDescription
float_list() -> FloatListConstruct an empty FloatList in the active collection arena.
float_map() -> FloatMapCreate an insertion-ordered byte-key map.
float_pq() -> FloatPQCreate an empty FloatPQ in the run arena.
float_queue() -> FloatQueueCreate an empty FloatQueue in the run arena.
float_stack() -> FloatStackCreate an empty FloatStack in the run arena.
int_list() -> IntListConstruct an empty IntList in the active collection arena.
int_map() -> IntMapCreate an insertion-ordered byte-key map.
int_pq() -> IntPQCreate an empty IntPQ in the run arena.
int_queue() -> IntQueueCreate an empty IntQueue in the run arena.
int_stack() -> IntStackCreate an empty IntStack in the run arena.
str_list() -> StrListConstruct an empty StrList in the active collection arena.
str_map() -> StrMapConstruct an empty insertion-ordered StrMap in the active collection arena.
str_pq() -> StrPQCreate an empty StrPQ in the run arena.
str_queue() -> StrQueueCreate an empty StrQueue in the run arena.
str_split(string, string) -> StrListSplit raw bytes on every nonoverlapping nonempty separator into a StrList.
str_stack() -> StrStackCreate an empty StrStack in the run arena.

Lists (22)

SignatureDescription
FloatList.add(float) -> FloatListAppend a float and return the receiver.
FloatList.at(int) -> floatReturn the element at a zero-based index.
FloatList.clear() -> FloatListRemove elements and return the receiver.
FloatList.contains(float) -> boolTest float == equality; NaN never matches.
FloatList.index_of(float) -> intReturn the first float == index or -1; NaN never matches.
FloatList.len() -> intReturn element count.
FloatList.set(int, float) -> FloatListReplace an indexed float and return the receiver.
IntList.add(int) -> IntListAppend an int and return the receiver.
IntList.at(int) -> intReturn the element at a zero-based index.
IntList.clear() -> IntListRemove elements and return the receiver.
IntList.contains(int) -> boolTest integer equality of elements.
IntList.index_of(int) -> intReturn the first equal index or -1.
IntList.len() -> intReturn element count.
IntList.set(int, int) -> IntListReplace an indexed int and return the receiver.
StrList.add(string) -> StrListAppend a byte string and return the receiver.
StrList.at(int) -> stringReturn the element at a zero-based index.
StrList.clear() -> StrListRemove elements and return the receiver.
StrList.contains(string) -> boolTest byte equality of elements.
StrList.index_of(string) -> intReturn the first byte-equal index or -1.
StrList.join(string) -> stringJoin byte strings with a byte separator.
StrList.len() -> intReturn element count.
StrList.set(int, string) -> StrListReplace an indexed byte string and return the receiver.

Maps (30)

SignatureDescription
FloatMap.clear() -> FloatMapRemove all keys; return self.
FloatMap.get(string) -> floatRead a value.
FloatMap.get_or(string, float) -> floatRead a value or the supplied fallback.
FloatMap.has(string) -> boolTest a byte-exact key.
FloatMap.key_at(int) -> stringRead a live key in insertion order.
FloatMap.keys() -> StrListAllocate 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() -> intCount live keys.
FloatMap.remove(string) -> boolRemove a key; reinsertion goes last.
FloatMap.set(string, float) -> FloatMapInsert/update; overwrites retain original position; return self.
FloatMap.values() -> FloatListAllocate 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() -> IntMapRemove all keys; return self.
IntMap.get(string) -> intRead a value.
IntMap.get_or(string, int) -> intRead a value or the supplied fallback.
IntMap.has(string) -> boolTest a byte-exact key.
IntMap.key_at(int) -> stringRead a live key in insertion order.
IntMap.keys() -> StrListAllocate 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() -> intCount live keys.
IntMap.remove(string) -> boolRemove a key; reinsertion goes last.
IntMap.set(string, int) -> IntMapInsert/update; overwrites retain original position; return self.
IntMap.values() -> IntListAllocate 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() -> StrMapRemove entries and return the receiver.
StrMap.get(string) -> stringReturn a byte-key value.
StrMap.get_or(string, string) -> stringReturn a byte-key value or the fallback.
StrMap.has(string) -> boolTest byte-key presence.
StrMap.key_at(int) -> stringReturn the insertion-order key at a zero-based index.
StrMap.keys() -> StrListAllocate 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() -> intReturn insertion-order entry count.
StrMap.remove(string) -> boolRemove a key and report whether it existed.
StrMap.set(string, string) -> StrMapInsert or replace a value while preserving an existing key position; removal tombstones compact on key_at.
StrMap.values() -> StrListAllocate 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)

SignatureDescription
FloatQueue.at(int) -> floatRead in pop order without consuming; index zero is next to pop.
FloatQueue.clear() -> FloatQueueRemove all items; return self; reset PQ insertion sequence.
FloatQueue.empty() -> boolReturn whether there are no items.
FloatQueue.len() -> intReturn the number of items.
FloatQueue.peek() -> floatRead without removing the next item in pop order.
FloatQueue.pop() -> floatRemove and return the next item in pop order.
FloatQueue.push(float) -> FloatQueueAppend an item; return the same container.
FloatStack.at(int) -> floatRead in pop order without consuming; index zero is next to pop.
FloatStack.clear() -> FloatStackRemove all items; return self; reset PQ insertion sequence.
FloatStack.empty() -> boolReturn whether there are no items.
FloatStack.len() -> intReturn the number of items.
FloatStack.peek() -> floatRead without removing the next item in pop order.
FloatStack.pop() -> floatRemove and return the next item in pop order.
FloatStack.push(float) -> FloatStackAppend an item; return the same container.
IntQueue.at(int) -> intRead in pop order without consuming; index zero is next to pop.
IntQueue.clear() -> IntQueueRemove all items; return self; reset PQ insertion sequence.
IntQueue.empty() -> boolReturn whether there are no items.
IntQueue.len() -> intReturn the number of items.
IntQueue.peek() -> intRead without removing the next item in pop order.
IntQueue.pop() -> intRemove and return the next item in pop order.
IntQueue.push(int) -> IntQueueAppend an item; return the same container.
IntStack.at(int) -> intRead in pop order without consuming; index zero is next to pop.
IntStack.clear() -> IntStackRemove all items; return self; reset PQ insertion sequence.
IntStack.empty() -> boolReturn whether there are no items.
IntStack.len() -> intReturn the number of items.
IntStack.peek() -> intRead without removing the next item in pop order.
IntStack.pop() -> intRemove and return the next item in pop order.
IntStack.push(int) -> IntStackAppend an item; return the same container.
StrQueue.at(int) -> stringRead in pop order without consuming; index zero is next to pop.
StrQueue.clear() -> StrQueueRemove all items; return self; reset PQ insertion sequence.
StrQueue.empty() -> boolReturn whether there are no items.
StrQueue.len() -> intReturn the number of items.
StrQueue.peek() -> stringRead without removing the next item in pop order.
StrQueue.pop() -> stringRemove and return the next item in pop order.
StrQueue.push(string) -> StrQueueAppend an item; return the same container.
StrStack.at(int) -> stringRead in pop order without consuming; index zero is next to pop.
StrStack.clear() -> StrStackRemove all items; return self; reset PQ insertion sequence.
StrStack.empty() -> boolReturn whether there are no items.
StrStack.len() -> intReturn the number of items.
StrStack.peek() -> stringRead without removing the next item in pop order.
StrStack.pop() -> stringRemove and return the next item in pop order.
StrStack.push(string) -> StrStackAppend an item; return the same container.

Priority queues (18)

SignatureDescription
FloatPQ.clear() -> FloatPQRemove all items; return self; reset PQ insertion sequence.
FloatPQ.empty() -> boolReturn whether there are no items.
FloatPQ.len() -> intReturn the number of items.
FloatPQ.peek() -> floatRead without removing the next item in pop order.
FloatPQ.pop() -> floatRemove and return the next item in pop order.
FloatPQ.push(float, float) -> FloatPQPush with finite min-first priority; stable insertion-order ties including signed zero.
IntPQ.clear() -> IntPQRemove all items; return self; reset PQ insertion sequence.
IntPQ.empty() -> boolReturn whether there are no items.
IntPQ.len() -> intReturn the number of items.
IntPQ.peek() -> intRead without removing the next item in pop order.
IntPQ.pop() -> intRemove and return the next item in pop order.
IntPQ.push(int, float) -> IntPQPush with finite min-first priority; stable insertion-order ties including signed zero.
StrPQ.clear() -> StrPQRemove all items; return self; reset PQ insertion sequence.
StrPQ.empty() -> boolReturn whether there are no items.
StrPQ.len() -> intReturn the number of items.
StrPQ.peek() -> stringRead without removing the next item in pop order.
StrPQ.pop() -> stringRemove and return the next item in pop order.
StrPQ.push(string, float) -> StrPQPush 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)

InterfaceHandler shapeRole
RestGet(exchange: RestExchange) -> voidHandler for GET routes.
RestPost(exchange: RestExchange) -> voidHandler for POST routes.
RestPut(exchange: RestExchange) -> voidHandler for PUT routes.
RestDelete(exchange: RestExchange) -> voidHandler for DELETE routes.
RestPatch(exchange: RestExchange) -> voidHandler for PATCH routes.
RestHead(exchange: RestExchange) -> voidHandler for HEAD routes.
RestOptions(exchange: RestExchange) -> voidHandler for OPTIONS routes.
RestHandler(exchange: RestExchange) -> voidGeneric handler bound to a route with rest_route.
CliCommand(exchange: RestExchange) -> voidHandler for a command dispatched by rest_cli.
CliOption(exchange: RestExchange) -> voidHandler for an option dispatched by rest_cli.

Functions and RestExchange methods (not in lmdraw 0.2.7)

SignatureDescription
rest_cli(StrList) -> stringAuto-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) -> voidSet a configuration or initial session store entry on the global single-session REST controller before serving.
rest_route(string, string, string) -> voidRegister a route pattern for an HTTP method and bind it to a @tag RestHandler entry.
rest_serve() -> voidAuto-register annotated REST routes, validate route bindings, and arm the global single-session stdio server loop.
rest_stop() -> voidStop the active REST stdio server loop after the current exchange finishes.
RestExchange.body() -> stringReturn the raw request body bytes.
RestExchange.get(string) -> stringRead a string value from the global single-session store, or empty string when absent.
RestExchange.has_header(string) -> boolReturn whether the request contains a case-insensitive header name.
RestExchange.has_query(string) -> boolReturn whether the request URL contains the query key.
RestExchange.header(string) -> stringRead a case-insensitive request header value, or empty string when absent.
RestExchange.increment(string) -> intIncrement a decimal integer counter in the global single-session store and return the new value.
RestExchange.json(string) -> voidValidate strict UTF-8 JSON, set default content-type to application/json, and replace the response body.
RestExchange.method() -> stringReturn the canonical uppercase HTTP method of the request.
RestExchange.param(string) -> stringRead a matched path parameter by name.
RestExchange.path() -> stringReturn the decoded request path without query string.
RestExchange.query(string) -> stringRead the last decoded query value for a key, or empty string when absent.
RestExchange.send(string) -> voidSet default content-type to text/plain; charset=utf-8 if unset and replace the response body.
RestExchange.set(string, string) -> voidStore a key-value pair in the global single-session store.
RestExchange.set_header(string, string) -> voidSet or replace a case-insensitive response header.
RestExchange.status(int) -> voidSet 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.