<< lib/opcodes/SLOpcodeStream.sleela SLeeLa Standard Library Definition. Definition: Defines SLOpcodeStream, the ordered sequence of single-opcode objects that is handed to the VM verbatim, in program order. Role: a compiled SLeeLa program is a verbatim, ordered list of opcodes. The /lib/opcodes family represents each opcode as its own single-opcode class; SLOpcodeStream is the ordered container that drives them. run() walks the stream and, for each opcode object, performs the family contract — call the VM to the next instruction, then execute that one opcode — so control flows 1,2,3,...,N exactly as emitted. The VM owns the instruction pointer; the stream only hands it the next single opcode to run. Family: opcodes. Native VM/OS work crosses an explicit bridge. >> #sleela 2.5 material; < Unified SLeeLa standard-library front-end object. > class SLOpcodeStream { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 10192; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-05"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } < bounded program length > static final int MAX_OPS = 65536; < the verbatim, ordered opcode objects > SLOpcodeBase[] ops; int count; < the VM frame handle this stream executes against > int frame; int state; String lastError; void init(int vmFrame) { ops = new SLOpcodeBase[MAX_OPS]; count = 0; frame = vmFrame; state = 0; lastError = ""; } < Append the next opcode in program order. Fail-closed on bound / inactive op. > boolean append(SLOpcodeBase op) { if (op == null || !op.armed()) { lastError = "unarmed opcode"; return false; } if (count >= MAX_OPS) { lastError = "opcode stream full"; return false; } ops[count] = op; count = count + 1; return true; } boolean valid() { if (count < 1) { lastError = "empty opcode stream"; return false; } return true; } void enable() { if (valid()) { state = 1; } } void disable() { state = 0; } boolean active() { return state == 1 && valid(); } int size() { return count; } < Execute the stream verbatim. For each opcode object, the family contract is > < honoured: advance the VM to the next instruction, then execute exactly that > < one opcode. A non-negative return from step() is the next instruction > < pointer; a negative return halts the stream (e.g. after OP_HALT or an error). > int run() { if (!active()) { return -1; } int ip = 0; for (int i = 0; i < count; i = i + 1) { ip = ops[i].step(frame); < VM halted or rejected the opcode > if (ip < 0) { return ip; } } return ip; } }