SLGovSymbolMap.sleela
lib/opcodes/governance/SLGovSymbolMap.sleela · 114 line(s) · sleela
<< lib/opcodes/governance/SLGovSymbolMap.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLGovSymbolMap, the registry of known symbol maps "that
just work" — safe, pre-vetted corrections the EventObserver may apply to
patch a fault mid-program instead of rejecting it.
A mapping is a trusted substitution: when a given opcode code appears in a
context the EventObserver judges faulty, the map supplies the replacement
opcode code that is known to make the sequence sound. Only substitutions in
this registry may be applied; an unknown fault is never silently "fixed".
Family: opcodes.governance. Native VM/OS work crosses an explicit bridge. >>
#sleela 2.5
material;
< Unified SLeeLa standard-library front-end object. >
class SLGovSymbolMap {
< ---- 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 = 10077;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | 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; }
static final int MAX_MAPS = 512;
< the opcode code observed as faulty >
int[] faultCode;
< the known-good replacement opcode code >
int[] patchCode;
< why the substitution is safe >
String[] rationale;
int count;
int state;
void init() {
faultCode = new int[MAX_MAPS];
patchCode = new int[MAX_MAPS];
rationale = new String[MAX_MAPS];
count = 0;
state = 1;
}
< Register a trusted substitution. Fail-closed on bound. >
boolean define(int fault, int patch, String why) {
if (count >= MAX_MAPS) { return false; }
if (fault < 0 || patch < 0) { return false; }
faultCode[count] = fault;
patchCode[count] = patch;
rationale[count] = why;
count = count + 1;
return true;
}
< Does a trusted patch exist for this faulty opcode code? >
boolean known(int fault) {
for (int i = 0; i < count; i = i + 1) {
if (faultCode[i] == fault) { return true; }
}
return false;
}
< Return the known-good replacement, or -1 if none is registered. >
int patchFor(int fault) {
for (int i = 0; i < count; i = i + 1) {
if (faultCode[i] == fault) { return patchCode[i]; }
}
return -1;
}
String rationaleFor(int fault) {
for (int i = 0; i < count; i = i + 1) {
if (faultCode[i] == fault) { return rationale[i]; }
}
return "";
}
int size() { return count; }
boolean active() { return state == 1; }
}