public static void Local(LogoContext context, ICollection variables) { foreach (string variable in variables) { context.Dict[variable] = LogoContext.NullVariable; } }
// IMessageTarget public object SendMessage (LogoContext context, string message, ICollection arguments) { object[] args_array = new object[arguments.Count]; int i = 0; foreach (object o in arguments) { if (o is CTSMessageTarget) { args_array[i] = ((CTSMessageTarget) o).TargetObject; } else { args_array[i] = o; } i++; } binder.Context = context; object target_obj = obj; object raw_result = obj_type.InvokeMember (message, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.InvokeMethod, binder, target_obj, args_array); if (!wrap_obj || raw_result == null || raw_result is IMessageTarget || raw_result.GetType ().IsPrimitive) { return raw_result; } else { return new CTSMessageTarget (raw_result); } }
// IMessageTarget public object SendMessage(LogoContext context, string message, ICollection arguments) { object[] args_array = new object[arguments.Count]; int i = 0; foreach (object o in arguments) { if (o is CTSMessageTarget) { args_array[i] = ((CTSMessageTarget)o).TargetObject; } else { args_array[i] = o; } i++; } binder.Context = context; object target_obj = obj; object raw_result = obj_type.InvokeMember(message, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.InvokeMethod, binder, target_obj, args_array); if (!wrap_obj || raw_result == null || raw_result is IMessageTarget || raw_result.GetType().IsPrimitive) { return(raw_result); } else { return(new CTSMessageTarget(raw_result)); } }
public void Invoke (LogoContext context, ICollection arguments, ref object result) { // Debug (arguments); LogoContext cc = new LogoContext (context); Hashtable dict = cc.Dict; object[] arguments_list = new object[arguments.Count]; arguments.CopyTo (arguments_list, 0); int i = 0; foreach (ArgumentInfo info in args) { if (i < arguments_list.Length) dict[info.name] = arguments_list[i]; else if (info.val != null) dict[info.name] = info.val; i++; } // Collect remaining arguments if (args.Length > 0 && args[args.Length - 1].collect) { int col_len = arguments_list.Length - args.Length; if (col_len < 0) col_len = 0; object[] collector = new object[col_len]; if (col_len > 0) Array.Copy (arguments_list, args.Length, collector, 0, col_len); dict[args[args.Length - 1].name] = collector; } Interpreter interp = new Interpreter ((Interpreter) context.CallingEngine, cc); result = interp.Execute (tree); }
// IMessageTarget public object SendMessage(LogoContext context, string message, ICollection arguments) { message = message.ToLower(); IMessageTarget target = (IMessageTarget)messages[message]; if (target == null) { foreach (IMessageStore store in List) { IMessageTarget store_target = store as IMessageTarget; if (store_target != null && store.SupportsMessage(message)) { target = store_target; messages[message] = target; break; } } } if (target == null) { throw new MessageNotSupportedException(message); } return(target.SendMessage(context, message, arguments)); }
public static void Make(LogoContext context, string variable, object value) { if (!context.Dict.Contains(variable)) { context = context.RootContext; } context.Dict[variable] = value; }
// IMessageTarget public object SendMessage (LogoContext context, string message, ICollection arguments) { object result = null; Function func = funcs[message] as Function; if (func == null) throw new MessageNotSupportedException (message); func.Invoke (context, arguments, ref result); return result; }
// IMessageTarget public object SendMessage(LogoContext context, string message, ICollection arguments) { object result = null; Function func = funcs[message] as Function; if (func == null) { throw new MessageNotSupportedException(message); } func.Invoke(context, arguments, ref result); return(result); }
// IMessageTarget public object SendMessage (LogoContext context, string message, ICollection arguments) { message = message.ToLower (); IMessageTarget target = (IMessageTarget) messages[message]; if (target == null) { foreach (IMessageStore store in List) { IMessageTarget store_target = store as IMessageTarget; if (store_target != null && store.SupportsMessage (message)) { target = store_target; messages[message] = target; break; } } } if (target == null) throw new MessageNotSupportedException (message); return target.SendMessage (context, message, arguments); }
public static void LocalMake (LogoContext context, string variable, object value) { context.Dict[variable] = value; }
public static void Make (LogoContext context, string variable, object value) { if (!context.Dict.Contains (variable)) { context = context.RootContext; } context.Dict[variable] = value; }
public Interpreter (Interpreter interp, LogoContext context) { this.stores = interp.stores; this.context = context; }
public static object Execute (LogoContext context, ICollection runlist, params object[] template_args) { string[] runlist_strs = new string[runlist.Count]; int i = 0; foreach (object o in runlist) { if (o is ICollection) runlist_strs[i] = Funcs.ListToString ((ICollection) o, 0, true); else runlist_strs[i] = o.ToString (); i++; } Interpreter interp = new Interpreter ((Interpreter) context.CallingEngine, context); interp.template_args = template_args; Parser parser = new Parser (interp.stores, null); parser.AllowQuestionMark = true; InstructionList tree = parser.Parse (runlist_strs); return interp.Execute (tree); }
public LogoBinder(LogoContext context) { this.context = context; }
public static object Run (LogoContext context, ICollection runlist) { return Interpreter.Execute (context, runlist); }
public static object Thing (LogoContext context, string variable) { return context.Dict[variable]; }
public static object Run(LogoContext context, ICollection runlist) { return(Interpreter.Execute(context, runlist)); }
public LogoContext (LogoContext parent) { this.parent = parent; }
public static object Thing(LogoContext context, string variable) { return(context.Dict[variable]); }
public static void Local(LogoContext context, string variable) { context.Dict[variable] = LogoContext.NullVariable; }
public static void LocalMake(LogoContext context, string variable, object value) { context.Dict[variable] = value; }
public static void Local (LogoContext context, string variable) { context.Dict[variable] = LogoContext.NullVariable; }
public LogoBinder (LogoContext context) { this.context = context; }
public static void Local (LogoContext context, ICollection variables) { foreach (string variable in variables) { context.Dict[variable] = LogoContext.NullVariable; } }
protected Compiler (IMessageStoreCollection stores) { this.stores = stores; context = new LogoContext (null); }
public static void Output (LogoContext context, object val) { context.Output (val); }
public Interpreter (IMessageStoreCollection stores) { this.stores = stores; context = new LogoContext (null); }
public static void Output(LogoContext context, object val) { context.Output(val); }
public LogoContext(LogoContext parent) { this.parent = parent; }