// performs bounds checking when reading from a word array ("-->" operator) private uint RT__ChLDW(Engine e, uint array, uint offset) { uint address = array + 4 * offset; if (address >= e.image.EndMem) { return(e.NestedCall(rt_err_fn, 25)); } return(e.image.ReadInt32(address)); }
// performs bounds checking when reading from a byte array ("->" operator) private uint RT__ChLDB(Engine e, uint array, uint offset) { uint address = array + offset; if (address >= e.image.EndMem) { return(e.NestedCall(rt_err_fn, 24)); } return(e.image.ReadByte(address)); }
// performs bounds checking when writing to a word array ("-->" operator) private uint RT__ChSTW(Engine e, uint array, uint offset, uint val) { uint address = array + 4 * offset; if (address >= e.image.EndMem || address < e.image.RamStart) { return(e.NestedCall(rt_err_fn, 27)); } else { e.image.WriteInt32(address, val); return(0); } }
// reads the value of an object's property ("." operator) private uint RV__Pr(Engine e, uint obj, uint id) { uint addr = RA__Pr(e, obj, id); if (addr == 0) { if (id > 0 && id < indiv_prop_start) { return(e.image.ReadInt32(cpv_start + 4 * id)); } e.NestedCall(rt_err_fn, readprop_err, obj, id); return(0); } return(e.image.ReadInt32(addr)); }
// finds an object's common property table private uint CP__Tab(Engine e, uint obj, uint id) { if (Z__Region(e, obj) != 1) { e.NestedCall(rt_err_fn, 23, obj); return(0); } uint otab = e.image.ReadInt32(obj + 16); if (otab == 0) { return(0); } uint max = e.image.ReadInt32(otab); otab += 4; return(e.PerformBinarySearch(id, 2, otab, 10, max, 0, SearchOptions.None)); }
// determines whether an object is a member of a given class ("ofclass" operator) private uint OC__Cl(Engine e, uint obj, uint cla) { switch (Z__Region(e, obj)) { case 3: return((uint)(cla == string_mc ? 1 : 0)); case 2: return((uint)(cla == routine_mc ? 1 : 0)); case 1: if (cla == class_mc) { if (Parent(e, obj) == class_mc) { return(1); } if (obj == class_mc || obj == string_mc || obj == routine_mc || obj == object_mc) { return(1); } return(0); } if (cla == object_mc) { if (Parent(e, obj) == class_mc) { return(0); } if (obj == class_mc || obj == string_mc || obj == routine_mc || obj == object_mc) { return(0); } return(1); } if (cla == string_mc || cla == routine_mc) { return(0); } if (Parent(e, cla) != class_mc) { e.NestedCall(rt_err_fn, ofclass_err, cla, 0xFFFFFFFF); return(0); } uint inlist = RA__Pr(e, obj, 2); if (inlist == 0) { return(0); } uint inlistlen = RL__Pr(e, obj, 2) / 4; for (uint jx = 0; jx < inlistlen; jx++) { if (e.image.ReadInt32(inlist + jx * 4) == cla) { return(1); } } return(0); default: return(0); } }
// reads the value of an object's property ("." operator) private uint RV__Pr(Engine e, uint obj, uint id) { uint addr = RA__Pr(e, obj, id); if (addr == 0) { if (id > 0 && id < indiv_prop_start) return e.image.ReadInt32(cpv_start + 4 * id); e.NestedCall(rt_err_fn, readprop_err, obj, id); return 0; } return e.image.ReadInt32(addr); }
// performs bounds checking when writing to a word array ("-->" operator) private uint RT__ChSTW(Engine e, uint array, uint offset, uint val) { uint address = array + 4 * offset; if (address >= e.image.EndMem || address < e.image.RamStart) { return e.NestedCall(rt_err_fn, 27); } else { e.image.WriteInt32(address, val); return 0; } }
// performs bounds checking when reading from a word array ("-->" operator) private uint RT__ChLDW(Engine e, uint array, uint offset) { uint address = array + 4 * offset; if (address >= e.image.EndMem) { return e.NestedCall(rt_err_fn, 25); } return e.image.ReadInt32(address); }
// performs bounds checking when reading from a byte array ("->" operator) private uint RT__ChLDB(Engine e, uint array, uint offset) { uint address = array + offset; if (address >= e.image.EndMem) return e.NestedCall(rt_err_fn, 24); return e.image.ReadByte(address); }
// determines whether an object is a member of a given class ("ofclass" operator) private uint OC__Cl(Engine e, uint obj, uint cla) { switch (Z__Region(e, obj)) { case 3: return (uint)(cla == string_mc ? 1 : 0); case 2: return (uint)(cla == routine_mc ? 1 : 0); case 1: if (cla == class_mc) { if (Parent(e, obj) == class_mc) return 1; if (obj == class_mc || obj == string_mc || obj == routine_mc || obj == object_mc) return 1; return 0; } if (cla == object_mc) { if (Parent(e, obj) == class_mc) return 0; if (obj == class_mc || obj == string_mc || obj == routine_mc || obj == object_mc) return 0; return 1; } if (cla == string_mc || cla == routine_mc) return 0; if (Parent(e, cla) != class_mc) { e.NestedCall(rt_err_fn, ofclass_err, cla, 0xFFFFFFFF); return 0; } uint inlist = RA__Pr(e, obj, 2); if (inlist == 0) return 0; uint inlistlen = RL__Pr(e, obj, 2) / 4; for (uint jx = 0; jx < inlistlen; jx++) if (e.image.ReadInt32(inlist + jx * 4) == cla) return 1; return 0; default: return 0; } }
// finds an object's common property table private uint CP__Tab(Engine e, uint obj, uint id) { if (Z__Region(e, obj) != 1) { e.NestedCall(rt_err_fn, 23, obj); return 0; } uint otab = e.image.ReadInt32(obj + 16); if (otab == 0) return 0; uint max = e.image.ReadInt32(otab); otab += 4; return e.PerformBinarySearch(id, 2, otab, 10, max, 0, SearchOptions.None); }