Home › Packages › sldocument

Package sldocument

This package contains 9 source unit(s) defining 9 class(es) / struct(s). Each unit below lists its fields (the values it stores) and methods (the actions it performs), with a plain explanation of each.

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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
MAX_STEPSstatic final int MAX_STEPS = 65536No description in source.
titleString titleNo description in source.
versionString versionthe declared #sldocument version, e.g. "1.0"
stepsSLDocumentStep[] stepsNo description in source.
countint countNo description in source.
frameint frameVM frame the steps execute against
continueOnUnsoundboolean continueOnUnsoundfalse = stop at first unsound step
resultSLDocumentResult resultNo description in source.
stateint stateNo description in source.
lastErrorString lastErrorNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
initvoid init(String docTitle, String docVersion, int vmFrame)No description in source.
permitContinuevoid permitContinue()No description in source.
addStepboolean 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.
validboolean valid()No description in source.
enablevoid enable()No description in source.
disablevoid disable()No description in source.
activeboolean active()No description in source.
sizeint size()No description in source.
arrangevoid arrange()Arrange steps by effective order so the run is strictly top-down/ascending.
runSLDocumentResult run()Run the document top-down. Returns the result collection.
outcomeSLVeritable outcome()The whole document's single binary item: sound and final-bit together.
resultsSLDocumentResult 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
METHODstatic final int METHOD = 0bare method name; order = textual position
ORDERstatic final int ORDER = 1@order(n)
FUNCTIONstatic final int FUNCTION = 2@function("name")
kindint kindNo description in source.
orderint ordermeaningful when kind == ORDER
roleString rolemeaningful when kind == FUNCTION
methodNameString methodNameNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
asMethodvoid asMethod(String name)No description in source.
asOrdervoid asOrder(String name, int n)No description in source.
asFunctionvoid asFunction(String name, String functionRole)No description in source.
kindOfint kindOf()No description in source.
orderValueint orderValue()No description in source.
role_String role_()No description in source.
methodString method()No description in source.
hasExplicitOrderboolean 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
companionSourcesString[] companionSources.sleela source units compiled alongside
companionCountint companionCountNo description in source.
stateint stateNo description in source.
lastErrorString lastErrorNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
initvoid init()No description in source.
withSourceboolean withSource(String sleelaSourcePath)Register a companion .sleela source unit the document compiles with.
enablevoid enable()No description in source.
activeboolean active()No description in source.
validateOrderboolean 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.
compileint 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.
compileAndRunSLDocumentResult 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

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
namingSLDocumentNaming namingNo description in source.
comparisonSLSourceNameComparison comparisonNo description in source.
classNameString classNamethe .sleela class the document becomes
stateint stateNo description in source.
lastErrorString lastErrorNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure(String targetClassName)No description in source.
activeboolean active()No description in source.
planboolean plan(SLDocument doc)Build the naming comparison for a whole document (does not emit yet).
synthesizedCountint synthesizedCount()No description in source.
toSleelaString 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.
convertToFileboolean 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.
namesSLSourceNameComparison names()No description in source.
errorString error()No description in source.

SLDocumentNaming #sleela 2.5 (lib/sldocument/SLDocumentNaming.sleela)

SLDocumentNaming class

Defines SLDocumentNaming, the naming convention that compares a

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
prefixString prefixprefix for synthesized names (default "step")
stateint stateNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure()No description in source.
withPrefixvoid withPrefix(String p)No description in source.
activeboolean active()No description in source.
isNamedboolean isNamed(SLDocumentAnnotation ann)Does the step already carry an explicit method name (vs. being anonymous)?
nameForString 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.
isSynthesizedboolean isSynthesized(SLDocumentAnnotation ann)Was this name synthesized (vs. authored by the engineer)?
sanitizeString sanitize(String raw)Make an arbitrary string a legal SLeeLa identifier.
camelFromRoleString 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
MAX_STEPSstatic final int MAX_STEPS = 65536No description in source.
valuesSLVeritable[] valuesone per step, in run order
namesString[] namesthe step name for each value
countint countNo description in source.
firstUnsoundint firstUnsoundindex of the first unsound step, or -1
stateint stateNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
initvoid init()No description in source.
recordvoid record(String stepName, SLVeritable v)No description in source.
sizeint size()No description in source.
activeboolean active()No description in source.
soundboolean sound()The document is sound when every recorded step was sound.
firstFaultint firstFault()No description in source.
atSLVeritable at(int index)No description in source.
finalBitint 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
annotationSLDocumentAnnotation annotationhow the step is named/ordered
effectiveOrderint effectiveOrderresolved 1-based position in the run
frameint frameVM frame the method is invoked against
resultSLVeritable resultthe single binary value the step returned
ranboolean ranNo description in source.
stateint stateNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure(SLDocumentAnnotation ann, int textualPosition, int vmFrame)No description in source.
enablevoid enable()No description in source.
disablevoid disable()No description in source.
activeboolean active()No description in source.
orderint order()No description in source.
nameString name()No description in source.
invokeSLVeritable 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.
hasRunboolean hasRun()No description in source.
valueSLVeritable 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
MAX_ROWSstatic final int MAX_ROWS = 65536No description in source.
namingSLDocumentNaming namingNo description in source.
documentNameString[] documentNamethe step's name in the document (may be "")
sleelaNameString[] sleelaNamethe method name it would have in .sleela
synthesizedboolean[] synthesizedtrue when the .sleela name had to be synthesized
collidedboolean[] collidedtrue when this name duplicates an earlier one
rowsint rowsNo description in source.
stateint stateNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
initvoid init(SLDocumentNaming conv)No description in source.
activeboolean active()No description in source.
sizeint size()No description in source.
compareStepvoid compareStep(SLDocumentAnnotation ann, int textualPosition)Compare one document step. `textualPosition` is its 1-based top-down index.
synthesizedCountint synthesizedCount()How many steps had to be given a synthesized .sleela name?
hasCollisionboolean hasCollision()Did any two steps resolve to the same .sleela method name?
convertibleboolean convertible()True when the comparison is clean enough to convert safely: no collisions.
documentNameAtString documentNameAt(int i)No description in source.
sleelaNameAtString 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
veritableboolean veritablethe binary truth: did the step hold?
kindboolean kindis the result well-formed and benign?
labelString labelthe symbol this value answers for
stateint stateNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
affirmvoid affirm(String forSymbol)The two canonical constructions.
denyvoid deny(String forSymbol)No description in source.
configurevoid configure(boolean isVeritable, boolean isKind, String forSymbol)General construction from an explicit pair.
activeboolean active()No description in source.
isVeritableboolean isVeritable()No description in source.
isKindboolean isKind()No description in source.
symbolString symbol()No description in source.
soundboolean sound()Sound == veritable AND kind: a true result of the right kind.
bitint bit()The binary item itself, as a single bit (1 = veritable, 0 = not), which is what the step hands back by default.
andSLVeritable and(SLVeritable other)Logical composition, preserving kindness: an unkind operand makes the result unkind, so faults propagate rather than hide.
orSLVeritable or(SLVeritable other)No description in source.