Package sldocument
SLDocument #sleela 2.5 (lib/sldocument/SLDocument.sleela)
SLDocument class
Defines SLDocument, an ordered .sldocument whose annotated method steps run top-down and are compiled against and with standard SLeeLa source. An .sldocument is a document, not a free script: its order is already established, so running it is a matter of flow and architecture rather than control plumbing. These documents suit tasks more sophisticated than bash scripting, and clear "national program" work where the sequence A..Z is settled in advance. Running the document: 1. steps are arranged by effective order (explicit @order, else top-down); 2. each step is invoked in that order and its single binary veritable value is recorded; 3. by default the document stops at the first unsound step (fail-closed), because an ordered program should not proceed past a broken step; this may be relaxed with permitContinue() to record every step. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MAX_STEPS | static final int MAX_STEPS = 65536 | No description in source. |
title | String title | No description in source. |
version | String version | the declared #sldocument version, e.g. "1.0" |
steps | SLDocumentStep[] steps | No description in source. |
count | int count | No description in source. |
frame | int frame | VM frame the steps execute against |
continueOnUnsound | boolean continueOnUnsound | false = stop at first unsound step |
result | SLDocumentResult result | No description in source. |
state | int state | No description in source. |
lastError | String lastError | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
init | void init(String docTitle, String docVersion, int vmFrame) | No description in source. |
permitContinue | void permitContinue() | No description in source. |
addStep | boolean addStep(SLDocumentAnnotation annotation) | Add a step in textual (top-down) order. The textual position becomes the step's order unless the annotation carries an explicit @order. |
valid | boolean valid() | No description in source. |
enable | void enable() | No description in source. |
disable | void disable() | No description in source. |
active | boolean active() | No description in source. |
size | int size() | No description in source. |
arrange | void arrange() | Arrange steps by effective order so the run is strictly top-down/ascending. |
run | SLDocumentResult run() | Run the document top-down. Returns the result collection. |
outcome | SLVeritable outcome() | The whole document's single binary item: sound and final-bit together. |
results | SLDocumentResult results() | No description in source. |
SLDocumentAnnotation #sleela 2.5 (lib/sldocument/SLDocumentAnnotation.sleela)
SLDocumentAnnotation class
Defines SLDocumentAnnotation, the annotation vocabulary that marks how an .sldocument step is named and ordered. A step's method may be annotated to indicate its order, its function, or it may simply be named as the method itself. The three annotation kinds: ORDER — @order(n): an explicit 1-based position in the top-down run. FUNCTION — @function("name"): the step's declared role/purpose, independent of its identifier. METHOD — no annotation: the method name itself is the step's name, and its order is its textual position in the document (top-down). When ORDER is present it governs; otherwise textual order governs. A FUNCTION annotation never changes order, only the step's declared purpose. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
METHOD | static final int METHOD = 0 | bare method name; order = textual position |
ORDER | static final int ORDER = 1 | @order(n) |
FUNCTION | static final int FUNCTION = 2 | @function("name") |
kind | int kind | No description in source. |
order | int order | meaningful when kind == ORDER |
role | String role | meaningful when kind == FUNCTION |
methodName | String methodName | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
asMethod | void asMethod(String name) | No description in source. |
asOrder | void asOrder(String name, int n) | No description in source. |
asFunction | void asFunction(String name, String functionRole) | No description in source. |
kindOf | int kindOf() | No description in source. |
orderValue | int orderValue() | No description in source. |
role_ | String role_() | No description in source. |
method | String method() | No description in source. |
hasExplicitOrder | boolean hasExplicitOrder() | No description in source. |
SLDocumentCompiler #sleela 2.5 (lib/sldocument/SLDocumentCompiler.sleela)
SLDocumentCompiler class
Defines SLDocumentCompiler, which compiles an .sldocument against and with standard SLeeLa source so the document's ordered steps resolve to compiled methods on the same VM. An .sldocument is not interpreted in isolation: its step methods are ordinary SLeeLa, compiled through the normal SLeeLa Compiler path alongside the accompanying .sleela source units. This class is the document-aware front end to that path. It: 1. registers the companion .sleela source so symbols the steps call resolve; 2. lowers each annotated step to a method entry the VM can invoke; 3. validates that the resolved order has no gaps or duplicate @order values; 4. yields a frame handle the SLDocument runs against. The authoritative compilation remains the SLeeLa Compiler (lib/compiler / impl/frontend); this class drives it with document semantics. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
companionSources | String[] companionSources | .sleela source units compiled alongside |
companionCount | int companionCount | No description in source. |
state | int state | No description in source. |
lastError | String lastError | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
init | void init() | No description in source. |
withSource | boolean withSource(String sleelaSourcePath) | Register a companion .sleela source unit the document compiles with. |
enable | void enable() | No description in source. |
active | boolean active() | No description in source. |
validateOrder | boolean validateOrder(SLDocument doc) | Validate that the document's resolved order is a clean 1..N with no gaps and no duplicate explicit @order values — a national/ordered program must have a settled sequence. |
compile | int compile(SLDocument doc) | Compile the document together with its companion sources through the SLeeLa Compiler path. Returns a VM frame handle (>= 0) on success, or -1 on failure. |
compileAndRun | SLDocumentResult compileAndRun(SLDocument doc) | Compile and run in one call, binding the compiled frame into the document. |
SLDocumentConverter #sleela 2.5 (lib/sldocument/SLDocumentConverter.sleela)
SLDocumentConverter class
Defines SLDocumentConverter, which converts an ordered .sldocument
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
naming | SLDocumentNaming naming | No description in source. |
comparison | SLSourceNameComparison comparison | No description in source. |
className | String className | the .sleela class the document becomes |
state | int state | No description in source. |
lastError | String lastError | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
configure | void configure(String targetClassName) | No description in source. |
active | boolean active() | No description in source. |
plan | boolean plan(SLDocument doc) | Build the naming comparison for a whole document (does not emit yet). |
synthesizedCount | int synthesizedCount() | No description in source. |
toSleela | String toSleela(SLDocument doc) | Emit the .sleela class text. Each step becomes a named method; run() calls them in order. Returns the emitted .sleela source, or "" on failure. |
convertToFile | boolean convertToFile(SLDocument doc, String sleelaPath) | Convert and write the .sleela to a path for safekeeping. Returns true on success. The path should carry the .sleela extension. |
names | SLSourceNameComparison names() | No description in source. |
error | String error() | No description in source. |
SLDocumentNaming #sleela 2.5 (lib/sldocument/SLDocumentNaming.sleela)
SLDocumentNaming class
Defines SLDocumentNaming, the naming convention that compares a
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
prefix | String prefix | prefix for synthesized names (default "step") |
state | int state | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
configure | void configure() | No description in source. |
withPrefix | void withPrefix(String p) | No description in source. |
active | boolean active() | No description in source. |
isNamed | boolean isNamed(SLDocumentAnnotation ann) | Does the step already carry an explicit method name (vs. being anonymous)? |
nameFor | String nameFor(SLDocumentAnnotation ann, int textualPosition) | Produce the stable .sleela method name for a step, per the convention. `textualPosition` is the step's 1-based top-down position used when a name must be synthesized. |
isSynthesized | boolean isSynthesized(SLDocumentAnnotation ann) | Was this name synthesized (vs. authored by the engineer)? |
sanitize | String sanitize(String raw) | Make an arbitrary string a legal SLeeLa identifier. |
camelFromRole | String camelFromRole(String role) | Turn a human role ("reconcile accounts") into camelCase ("reconcileAccounts"). |
SLDocumentResult #sleela 2.5 (lib/sldocument/SLDocumentResult.sleela)
SLDocumentResult class
Defines SLDocumentResult, the ordered collection of per-step veritable-and-kind values produced by running an .sldocument top-down. The document's overall outcome is the composition of its steps: it is sound only when every step that ran was itself sound (veritable AND kind). The result also records where the first unsound step occurred so a national program with established order can see exactly where flow broke. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MAX_STEPS | static final int MAX_STEPS = 65536 | No description in source. |
values | SLVeritable[] values | one per step, in run order |
names | String[] names | the step name for each value |
count | int count | No description in source. |
firstUnsound | int firstUnsound | index of the first unsound step, or -1 |
state | int state | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
init | void init() | No description in source. |
record | void record(String stepName, SLVeritable v) | No description in source. |
size | int size() | No description in source. |
active | boolean active() | No description in source. |
sound | boolean sound() | The document is sound when every recorded step was sound. |
firstFault | int firstFault() | No description in source. |
at | SLVeritable at(int index) | No description in source. |
finalBit | int finalBit() | The final binary item of the whole document: the last step's bit, which in an ordered program is the established "final result" of the flow. |
SLDocumentStep #sleela 2.5 (lib/sldocument/SLDocumentStep.sleela)
SLDocumentStep class
Defines SLDocumentStep, one ordered step of an .sldocument — an annotated method that runs in top-down order and usually returns a single binary veritable-and-kind value. A step pairs an annotation (how it is named/ordered) with the method it invokes on the VM. When the document runs, each step is executed in order and its SLVeritable result is captured. The method body is ordinary compiled SLeeLa; the step is the document-level wrapper that records order and result. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
annotation | SLDocumentAnnotation annotation | how the step is named/ordered |
effectiveOrder | int effectiveOrder | resolved 1-based position in the run |
frame | int frame | VM frame the method is invoked against |
result | SLVeritable result | the single binary value the step returned |
ran | boolean ran | No description in source. |
state | int state | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
configure | void configure(SLDocumentAnnotation ann, int textualPosition, int vmFrame) | No description in source. |
enable | void enable() | No description in source. |
disable | void disable() | No description in source. |
active | boolean active() | No description in source. |
order | int order() | No description in source. |
name | String name() | No description in source. |
invoke | SLVeritable invoke() | Invoke the step's method on the VM and capture its single binary result. The native side evaluates the compiled method and reports a 1 (veritable) or 0 (not), together with a kindness flag for well-formedness. |
hasRun | boolean hasRun() | No description in source. |
value | SLVeritable value() | No description in source. |
SLSourceNameComparison #sleela 2.5 (lib/sldocument/SLSourceNameComparison.sleela)
SLSourceNameComparison class
Defines SLSourceNameComparison, which compares the naming of a .sleela program against a .sldocument so an engineer can see how the two forms line up before or after a conversion. The two forms name things differently: - .sleela names every method explicitly (it is class/method shaped); - .sldocument may leave steps anonymous (ordered position or role only). This comparison pairs each document step with the .sleela method name it would have (via SLDocumentNaming) and reports, per step, whether the names match, whether a name had to be synthesized, and whether any collision arose. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
MAX_ROWS | static final int MAX_ROWS = 65536 | No description in source. |
naming | SLDocumentNaming naming | No description in source. |
documentName | String[] documentName | the step's name in the document (may be "") |
sleelaName | String[] sleelaName | the method name it would have in .sleela |
synthesized | boolean[] synthesized | true when the .sleela name had to be synthesized |
collided | boolean[] collided | true when this name duplicates an earlier one |
rows | int rows | No description in source. |
state | int state | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
init | void init(SLDocumentNaming conv) | No description in source. |
active | boolean active() | No description in source. |
size | int size() | No description in source. |
compareStep | void compareStep(SLDocumentAnnotation ann, int textualPosition) | Compare one document step. `textualPosition` is its 1-based top-down index. |
synthesizedCount | int synthesizedCount() | How many steps had to be given a synthesized .sleela name? |
hasCollision | boolean hasCollision() | Did any two steps resolve to the same .sleela method name? |
convertible | boolean convertible() | True when the comparison is clean enough to convert safely: no collisions. |
documentNameAt | String documentNameAt(int i) | No description in source. |
sleelaNameAt | String sleelaNameAt(int i) | No description in source. |
SLVeritable #sleela 2.5 (lib/sldocument/SLVeritable.sleela)
SLVeritable class
Defines SLVeritable, the single binary value an .sldocument step usually returns — a verified truth that is "veritable and kind". An .sldocument runs top-down, and each ordered step generally returns one binary item. That item is modeled here as a two-fold judgement: - veritable: the step's result is true / holds (the binary truth), AND - kind: the result is well-formed and benign — the right *kind* of value, not a malformed or hostile one. Both must hold for the value to be "sound". A step that produces a true but ill-formed result is veritable-but-not-kind, and the document does not treat it as a clean pass. Family: sldocument. Native VM/OS work crosses an explicit bridge.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
veritable | boolean veritable | the binary truth: did the step hold? |
kind | boolean kind | is the result well-formed and benign? |
label | String label | the symbol this value answers for |
state | int state | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
affirm | void affirm(String forSymbol) | The two canonical constructions. |
deny | void deny(String forSymbol) | No description in source. |
configure | void configure(boolean isVeritable, boolean isKind, String forSymbol) | General construction from an explicit pair. |
active | boolean active() | No description in source. |
isVeritable | boolean isVeritable() | No description in source. |
isKind | boolean isKind() | No description in source. |
symbol | String symbol() | No description in source. |
sound | boolean sound() | Sound == veritable AND kind: a true result of the right kind. |
bit | int bit() | The binary item itself, as a single bit (1 = veritable, 0 = not), which is what the step hands back by default. |
and | SLVeritable and(SLVeritable other) | Logical composition, preserving kindness: an unkind operand makes the result unkind, so faults propagate rather than hide. |
or | SLVeritable or(SLVeritable other) | No description in source. |