static object InflateEnum(string name, int[] loc) { List <string[]> names = new List <string[]>(); int rpos2 = loc[6]; while (rpos2 < loc[7]) { string rname = AsciiZ(ref rpos2); string[] keys; if (!val_aliases.TryGetValue(Prod.C(name, rname), out keys)) { keys = new string[] { rname } } ; names.Add(keys); } int rpos0 = loc[2]; int rpos1 = loc[4]; int[] data = new int[(loc[5] - loc[4]) * 2]; int lix = 0; for (int i = 0; i < data.Length / 2; i++) { lix += (int)BER(ref rpos0); data[2 * i] = lix; data[2 * i + 1] = bits[rpos1++]; //if (Trace) Console.WriteLine("inflate: {0} = {1}", data[2*i], names[data[2*i+1]][0]); } return(new LimitedProperty(data, names.ToArray())); }
static void InflateAliases() { int[] loc = directory["!PropertyAlias"]; aliases = new Dictionary <string, string>(); val_aliases = new Dictionary <Prod <string, string>, string[]>(); proxy_aliases = new Dictionary <string, string>(); int rpos = loc[2]; while (rpos < loc[3]) { string main = AsciiZ(ref rpos); string alias; aliases[StringProperty.Loosen(main)] = main; while ((alias = AsciiZ(ref rpos)).Length != 0) { aliases[StringProperty.Loosen(alias)] = main; //if (Trace) Console.WriteLine("Alias {0} -> {1}", alias, main); } } aliases["SCRIPTEXTENSIONS"] = aliases["SCX"] = "scx"; loc = directory["!pva"]; rpos = loc[2]; List <string> aset = new List <string>(); while (rpos < loc[3]) { string tbl = AsciiZ(ref rpos); string canon = AsciiZ(ref rpos); if (canon == "n/a") { canon = AsciiZ(ref rpos); } string alias; aset.Add(canon); while ((alias = AsciiZ(ref rpos)).Length != 0) { aset.Add(alias); } //if (Trace) Console.WriteLine("Alias {0},{1} -> {2}", tbl, canon, Kernel.JoinS(", ", aset)); val_aliases[Prod.C(tbl, canon)] = aset.ToArray(); if (tbl == "sc" || tbl == "gc" || tbl == "blk") { foreach (string a in aset) { aliases[(tbl == "blk" ? "IN" : "") + StringProperty.Loosen(a)] = tbl + "+" + canon; } proxy_aliases[tbl + "+" + canon] = tbl == "sc" ? "Script" : tbl; } aset.Clear(); } }
static object InflateBinary(string name, int[] loc) { List <int> vec = new List <int>(); int rpos = loc[2]; int last = 0; int ntyp = 1; while (rpos < loc[3]) { last += (int)BER(ref rpos); vec.Add(last); vec.Add(ntyp); ntyp = 1 - ntyp; } return(new LimitedProperty(vec.ToArray(), new string[][] { val_aliases[Prod.C(name, "N")], val_aliases[Prod.C(name, "Y")] })); }