public localsSymbolArgAt ( |
||
locals | ||
i | int | |
return |
public static IoObject localsUpdateSlot(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq slotName = m.localsSymbolArgAt(locals, 0); if (slotName == null) { return(target); } IoObject obj = target.rawGetSlot(slotName); if (obj != null) { IoObject slotValue = m.localsValueArgAt(locals, 1); target.slots[slotName.ToString()] = slotValue; return(slotValue); } else { IoObject theSelf = target.rawGetSlot(target.state.selfMessage.messageName); if (theSelf != null) { return(theSelf.perform(theSelf, locals, m)); } } return(target.state.ioNil); }
// Published Slots public static IoObject slotUsing(IoObject target, IoObject locals, IoObject message) { IoCLR self = target as IoCLR; IoMessage m = message as IoMessage; IoSeq nameSpace = m.localsSymbolArgAt(locals, 0); bool validNamespace = false; IoCLRAssembly foundInAssembly = null; foreach (IoCLRAssembly asm in self.loadedAssemblies.Values) { if (asm.assemblyNamespaces[nameSpace.value] != null) { validNamespace = true; foundInAssembly = asm; break; } } if (!validNamespace) { Console.WriteLine("Namespace '{0}' is not valid.", nameSpace.value); return(self); } if (self.usingNamespaces[nameSpace.value] == null) { self.usingNamespaces[nameSpace.value] = foundInAssembly; } return(self); }
public static IoObject slotGetSlot(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq slotName = m.localsSymbolArgAt(locals, 0); IoObject slot = target.rawGetSlot(slotName); return(slot == null ? target.state.ioNil : slot); }
public static IoObject slotGetType(IoObject target, IoObject locals, IoObject message) { IoCLR self = target as IoCLR; IoMessage m = message as IoMessage; IoSeq typeName = m.localsSymbolArgAt(locals, 0); IoObject obj = self.getType(target.state, typeName.value); return(obj == null ? target.state.ioNil : obj); }
public static IoObject slotRemoveAt(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoObject key = m.localsSymbolArgAt(locals, 0); IoMap dict = target as IoMap; dict.map[key.ToString()] = null; return(target); }
public static IoObject slotAppendSeq(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq o = target as IoSeq; IoSeq arg = m.localsSymbolArgAt(locals, 0); o.value += arg.value.Replace(@"\""", "\""); return(o); }
public static IoObject slotSetName(IoObject target, IoObject locals, IoObject message) { IoMessage self = target as IoMessage; IoMessage msg = message as IoMessage; IoSeq s = msg.localsSymbolArgAt(locals, 0); self.messageName = s; return(self); }
public static IoObject slotSetSlotWithType(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq slotName = m.localsSymbolArgAt(locals, 0); IoObject slotValue = m.localsValueArgAt(locals, 1); target.slots[slotName.ToString()] = slotValue; if (!slotValue.slots.ContainsKey(target.state.typeSymbol)) { slotValue.slots[target.state.typeSymbol.ToString()] = slotName; } return(slotValue); }
public static IoObject slotSetSlot(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq slotName = m.localsSymbolArgAt(locals, 0); IoObject slotValue = m.localsValueArgAt(locals, 1); if (slotName == null) { return(target); } target.slots[slotName.ToString()] = slotValue; return(slotValue); }
public static IoObject slotSetSlotWithType(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq slotName = m.localsSymbolArgAt(locals, 0); IoObject slotValue = m.localsValueArgAt(locals, 1); target.slots[slotName] = slotValue; if (slotValue.slots[target.state.typeSymbol] == null) { slotValue.slots[target.state.typeSymbol] = slotName; } return(slotValue); }
public static IoObject slotLoadAssembly(IoObject target, IoObject locals, IoObject message) { IoCLR self = target as IoCLR; IoMessage m = message as IoMessage; IoSeq assemblyName = m.localsSymbolArgAt(locals, 0); IoCLRAssembly asm = self.loadedAssemblies[assemblyName.value] as IoCLRAssembly; if (asm != null) { return(asm); } asm = IoCLRAssembly.createObject(target.state); asm.assembly = Assembly.LoadWithPartialName(assemblyName.value); if (asm.assembly == null) { return(self); } self.loadedAssemblies[assemblyName.value] = asm; asm.assemblyTypes = asm.assembly.GetTypes(); asm.assemblyNamespaces = new Hashtable(); foreach (Type t in asm.assemblyTypes) { string theNameSpace = t.FullName.LastIndexOf(".") == -1 ? "-" : t.FullName.Substring(0, t.FullName.LastIndexOf(".")); string theClass = t.FullName.LastIndexOf(".") == -1 ? t.FullName : t.FullName.Substring(t.FullName.LastIndexOf(".") + 1); if (theClass.Equals("Form")) { int i = 0; } if (asm.assemblyNamespaces.ContainsKey(theNameSpace)) { Hashtable a = asm.assemblyNamespaces[theNameSpace] as Hashtable; a[theClass] = t; } else { Hashtable classes = new Hashtable(); classes[theClass] = t; asm.assemblyNamespaces[theNameSpace] = classes; } } return(asm); }
public static IoObject slotUpdateSlot(IoObject target, IoObject locals, IoObject message) { IoMessage m = message as IoMessage; IoSeq slotName = m.localsSymbolArgAt(locals, 0); IoObject slotValue = m.localsValueArgAt(locals, 1); if (slotName == null) { return(target); } if (target.rawGetSlot(slotName) != null) { target.slots[slotName.ToString()] = slotValue; } else { Console.WriteLine("Slot {0} not found. Must define slot using := operator before updating.", slotName.value); } return(slotValue); }
public static IoObject slotLoadAssembly(IoObject target, IoObject locals, IoObject message) { IoCLR self = target as IoCLR; IoMessage m = message as IoMessage; IoSeq assemblyName = m.localsSymbolArgAt(locals, 0); IoCLRAssembly asm = null; if (self.loadedAssemblies.ContainsKey(assemblyName.value)) { asm = self.loadedAssemblies[assemblyName.value]; if (asm != null) { return(asm); } } asm = IoCLRAssembly.createObject(target.state); var name = new AssemblyName(assemblyName.value); try { asm.assembly = Assembly.Load(name); Console.WriteLine("载入{0} ....成功!", name.Name); } catch (FileNotFoundException ex) { Console.WriteLine("载入{0} ....失败!", name.Name); } if (asm.assembly == null) { return(self); } self.loadedAssemblies[assemblyName.value] = asm; asm.assemblyTypes = asm.assembly.GetTypes(); asm.assemblyNamespaces = new Dictionary <string, Dictionary <string, Type> >(); foreach (Type t in asm.assemblyTypes) { string theNameSpace = t.FullName.LastIndexOf(".") == -1 ? "-" : t.FullName.Substring(0, t.FullName.LastIndexOf(".")); string theClass = t.FullName.LastIndexOf(".") == -1 ? t.FullName : t.FullName.Substring(t.FullName.LastIndexOf(".") + 1); if (theClass.Equals("Form")) { //~//int i = 0; } if (asm.assemblyNamespaces.ContainsKey(theNameSpace)) { Dictionary <string, Type> a = asm.assemblyNamespaces[theNameSpace]; a[theClass] = t; } else { Dictionary <string, Type> classes = new Dictionary <string, Type>(); classes[theClass] = t; asm.assemblyNamespaces[theNameSpace] = classes; } } return(asm); }