////////////////////////////////////////////////////////////////////////// public void AddVar(IWmeValue Var, int Line) { if (!Vars.ContainsKey(Var)) { Vars.Add(Var, new Variable(Var, Line)); } }
////////////////////////////////////////////////////////////////////////// public void AddScopeVar(IWmeValue Var, int ScopeID) { if (!Scopes.ContainsKey(ScopeID)) { Scopes.Add(ScopeID, new ScriptScope()); } Scopes[ScopeID].AddVar(Var, this.Line); }
////////////////////////////////////////////////////////////////////////// public bool ScopeVariableInit(IWmeValue Variable, IntPtr ScriptID, int ScopeID) { if (!Scripts.ContainsKey(ScriptID)) { return(false); } Scripts[ScriptID].AddScopeVar(Variable, ScopeID); return(true); }
////////////////////////////////////////////////////////////////////////// public bool ScriptVariableInit(IWmeValue Variable, IntPtr ScriptID) { if (!Scripts.ContainsKey(ScriptID)) { return(false); } Scripts[ScriptID].AddGlobalVar(Variable); return(true); }
////////////////////////////////////////////////////////////////////////// public bool VariableChangeValue(IWmeValue Variable, IWmeValue Value) { ScriptScope Scope; Script Script; GetVarScope(Variable, out Script, out Scope); if (Scope == GlobalScope || (Script != null && Script == DebugWindow.SelectedScript)) { RefreshVars = true; } return(true); }
////////////////////////////////////////////////////////////////////////// public ScriptScope GetVarScope(IWmeValue Variable) { if (GlobalScope.Vars.ContainsKey(Variable)) { return(GlobalScope); } foreach (KeyValuePair <int, ScriptScope> kvp in Scopes) { if (kvp.Value.Vars.ContainsKey(Variable)) { return(kvp.Value); } } return(null); }
////////////////////////////////////////////////////////////////////////// private void GetVarScope(IWmeValue Variable, out Script Script, out ScriptScope Scope) { if (GlobalScope.Vars.ContainsKey(Variable)) { Scope = GlobalScope; Script = null; return; } else { foreach (KeyValuePair <IntPtr, Script> kvp in Scripts) { ScriptScope ScrScope = kvp.Value.GetVarScope(Variable); if (ScrScope != null) { Scope = ScrScope; Script = kvp.Value; return; } } Script = null; Scope = null; } }
////////////////////////////////////////////////////////////////////////// public bool VariableChangeValue(IWmeValue Variable, IWmeValue Value) { ScriptScope Scope; Script Script; GetVarScope(Variable, out Script, out Scope); if (Scope == GlobalScope || (Script != null && Script == DebugWindow.SelectedScript)) { RefreshVars = true; } return true; }
////////////////////////////////////////////////////////////////////////// public Variable(IWmeValue NativeValue, int Line) { this.NativeValue = NativeValue; this._Line = Line; }
////////////////////////////////////////////////////////////////////////// public void AddVar(IWmeValue Var) { AddVar(Var, -1); }
////////////////////////////////////////////////////////////////////////// public void AddVar(IWmeValue Var, int Line) { if (!Vars.ContainsKey(Var)) Vars.Add(Var, new Variable(Var, Line)); }
////////////////////////////////////////////////////////////////////////// public bool GlobalVariableInit(IWmeValue Variable) { GlobalScope.AddVar(Variable); return true; }
////////////////////////////////////////////////////////////////////////// public void AddGlobalVar(IWmeValue Var) { GlobalScope.AddVar(Var, this.Line); }
////////////////////////////////////////////////////////////////////////// public bool ScriptVariableInit(IWmeValue Variable, IntPtr ScriptID) { if (!Scripts.ContainsKey(ScriptID)) return false; Scripts[ScriptID].AddGlobalVar(Variable); return true; }
////////////////////////////////////////////////////////////////////////// public bool ScopeVariableInit(IWmeValue Variable, IntPtr ScriptID, int ScopeID) { if (!Scripts.ContainsKey(ScriptID)) return false; Scripts[ScriptID].AddScopeVar(Variable, ScopeID); return true; }
////////////////////////////////////////////////////////////////////////// private void GetVarScope(IWmeValue Variable, out Script Script, out ScriptScope Scope) { if (GlobalScope.Vars.ContainsKey(Variable)) { Scope = GlobalScope; Script = null; return; } else { foreach (KeyValuePair<IntPtr, Script> kvp in Scripts) { ScriptScope ScrScope = kvp.Value.GetVarScope(Variable); if (ScrScope != null) { Scope = ScrScope; Script = kvp.Value; return; } } Script = null; Scope = null; } }
////////////////////////////////////////////////////////////////////////// public bool GlobalVariableInit(IWmeValue Variable) { GlobalScope.AddVar(Variable); return(true); }