public void cvterror(GenericScriptItem i, string v) { error("smps2asm.smpss:" + (i != null ? i.line + "" : "null") + ": " + v); }
public void Add(GenericScriptItem i) { Items.Add(i); }
// combine multiple script items to one array public GenericScriptItem[] Combine(GenericScriptItem[][] luts) { if (luts.Length == 0) { return(null); } GenericScriptItem[] rout = new GenericScriptItem[0x100]; foreach (GenericScriptItem[] lut in luts) { // entry ID int eid = 0; foreach (GenericScriptItem entry in lut) { if (entry != null) { switch (entry.type) { case ScriptItemType.NULL: cvterror(entry, "Type of item is NULL! This is most likely a programming error in SMPS2ASM!"); break; case ScriptItemType.Equate: if (rout[eid] == null) { rout[eid] = entry; } break; case ScriptItemType.Macro: if (rout[eid] == null) { rout[eid] = entry; } else if (rout[eid].type == ScriptItemType.ArrayItem) { (rout[eid] as ScriptArrayItem).Combine(entry as ScriptMacro, 1); } // if equate or macro, it is assumed they take up the entirity of byte, no extra bytes. If this happens despite having extra bytes, whoops =/ break; case ScriptItemType.ArrayItem: if (rout[eid] == null) { rout[eid] = entry; } break; case ScriptItemType.Import: if (rout[eid] == null) { rout[eid] = entry; } break; default: cvterror(entry, "Somehow optimized look-up-table contains unoptimizable elements! Report to developer."); break; } } eid++; } } return(rout); }