internal void CALL(string name) { if (name.Contains('.')) { try { if (globalvars.ContainsKey(name.Split('.')[0])) { if (globalvars[name.Split('.')[0]] is Instance) { (globalvars[name.Split('.')[0]] as Instance).Call(name.Substring(name.IndexOf('.') + 1)); } else { parent.Error("Var not found!", "Could not find variable: " + name + " in globalvars of thread: " + this.Name); } } else if (ContainsClass(name.Split('.')[0])) { GetClass(name.Split('.')[0]).Call(name.Substring(name.IndexOf('.') + 1), this); } } catch { } } else { if (globalvars.ContainsKey(name)) { if (globalvars[name] is FuncPtr) { int adrs = (globalvars[name] as FuncPtr).address; vCall c = new vCall(); c.startaddress = adrs; c.retaddress = instructionIndex; c.referance = new vMethod("Temp", adrs); callstack.Push(c); c.Run(this); } } else { vMethod m = GetMethod(name); if (m != null) { vCall c = new vCall(); c.startaddress = m.GetAddress(); c.retaddress = instructionIndex; c.referance = m; callstack.Push(c); c.Run(this); } else { parent.Error("Method not found!", "Could not find method: " + name + " in global method list."); } } } }
private void LoadClasses(string ClassXML) { StringReader r = new StringReader(ClassXML); XmlReader xr = XmlReader.Create(r); xr.Read(); if (xr.Name == "meta") { while (xr.Read() && xr.NodeType != XmlNodeType.EndElement) { if (xr.Name == "class") { LoadClass(xr, xr.GetAttribute("name")); } else if (xr.Name == "function") { vMethod m = new vMethod(xr.GetAttribute("name"), Convert.ToInt32(xr.GetAttribute("address"))); methods.Add(m); } } } xr.Close(); r.Close(); }
internal void Call(string p, vThread from) { vMethod m = getMethod(p); if (m != null) { vCall c = new vCall(); c.referance = m; c.retaddress = from.instructionIndex; c.startaddress = m.GetAddress(); from.callstack.Push(c); from.callstack.Peek().Run(from); } }
internal void Call(string name) { if (name.Contains('.')) { try { if (fields.ContainsKey(name.Split('.')[0])) { if (fields[name.Split('.')[0]] is Instance) { (fields[name.Split('.')[0]] as Instance).Call(name.Substring(name.IndexOf('.') + 1)); } else { parent.parent.Error("Var not found!", "Could not find var: " + name.Split('.')[0] + " in class: " + type.getName()); } } } catch { } } else { vMethod m = GetMethod(name); if (m != null) { vCall c = new vCall(); c.startaddress = m.GetAddress(); c.retaddress = parent.instructionIndex; c.referance = m; parent.callstack.Push(c); parent.SaveGlobalVars(); parent.SetGlobalVars(fields); c.Run(parent); } else { parent.parent.Error("Method not found!", "Could not find method: " + name + " in class: " + type.getName()); } } }
private void LoadClass(XmlReader xr, string name) { vClass c = new vClass(name); while (xr.Read() && xr.NodeType != XmlNodeType.EndElement) { if (xr.Name == "field") { Field f = new Field(); f.name = xr.GetAttribute("name"); f.access = (xr.GetAttribute("access") == "pub" ? true : false); c.fields.Add(f); } else if (xr.Name == "function") { vMethod m = new vMethod(xr.GetAttribute("name"), Convert.ToInt32(xr.GetAttribute("address"))); c.methods.Add(m); } } classes.Add(c); }
internal void CALLSTATIC(string name) { if (name.Contains('.')) { try { string[] cn = name.Split('.'); vClass c = GetClass(cn[0]); vMethod m = c.getMethod(name.Substring(name.IndexOf('.') + 1)); vCall ca = new vCall(); ca.referance = m; ca.retaddress = instructionIndex; ca.startaddress = m.GetAddress(); callstack.Push(ca); ca.Run(this); } catch { } } else { vMethod m = GetMethod(name); if (m != null) { vCall c = new vCall(); c.startaddress = m.GetAddress(); c.retaddress = instructionIndex; c.referance = m; callstack.Push(c); c.Run(this); } else { parent.Error("Method not found!", "Could not find method: " + name + " in global method list."); } } }
private void LoadClasses(string ClassXML) { StringReader r = new StringReader(ClassXML); XmlReader xr = XmlReader.Create(r); xr.Read(); if (xr.Name == "meta") { while (xr.Read() && xr.NodeType != XmlNodeType.EndElement) { if (xr.Name == "class") { LoadClass(xr, xr.GetAttribute("name")); } else if (xr.Name == "function") { vMethod m = new vMethod(xr.GetAttribute("name"), Convert.ToInt32(xr.GetAttribute("address"))); methods.Add(m); } } } xr.Close(); r.Close(); }
private void LoadClass(XmlReader xr,string name) { vClass c = new vClass(name); while (xr.Read() && xr.NodeType != XmlNodeType.EndElement) { if (xr.Name == "field") { Field f = new Field(); f.name = xr.GetAttribute("name"); f.access = (xr.GetAttribute("access") == "pub" ? true : false); c.fields.Add(f); } else if (xr.Name == "function") { vMethod m = new vMethod(xr.GetAttribute("name"), Convert.ToInt32(xr.GetAttribute("address"))); c.methods.Add(m); } } classes.Add(c); }