Inheritance: IoObject
Ejemplo n.º 1
0
Archivo: IoSeq.cs Proyecto: devaspot/io
 public static IoSeq createObject(IoSeq symbol)
 {
     IoSeq seq = new IoSeq();
     seq = seq.clone(symbol.state) as IoSeq;
     seq.value = symbol.value;
     return seq;
 }
Ejemplo n.º 2
0
Archivo: IoSeq.cs Proyecto: devaspot/io
 public static IoSeq createObject(IoState state, string symbol)
 {
     IoSeq seq = new IoSeq();
     seq = seq.clone(state) as IoSeq;
     seq.value = symbol;
     return seq;
 }
Ejemplo n.º 3
0
        public static IoSeq createObject(IoSeq symbol)
        {
            IoSeq seq = new IoSeq();

            seq       = seq.clone(symbol.state) as IoSeq;
            seq.value = symbol.value;
            return(seq);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
Archivo: IoMessage.cs Proyecto: ypyf/io
        void parseName(IoState state, IoLexer lexer)
        {
            IoToken token = lexer.pop();

            messageName = IoSeq.createSymbolInMachine(state, token.name);
            ifPossibleCacheToken(token);
            //rawSetLineNumber(token.lineNumber);
            //rawSetCharNumber(token.charNumber);
        }
Ejemplo n.º 6
0
Archivo: IoMessage.cs Proyecto: ypyf/io
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public static IoObject slotAt(IoObject target, IoObject locals, IoObject message)
        {
            IoMessage m   = message as IoMessage;
            IoSeq     o   = target as IoSeq;
            IoSeq     res = IoSeq.createObject(target.state);
            IoNumber  arg = m.localsNumberArgAt(locals, 0);

            res.value += o.value.Substring(arg.asInt(), 1);
            return(res);
        }
Ejemplo n.º 9
0
        public IoObject slotsBySymbol(IoSeq symbol)
        {
            IoSeq s = this.state.symbols[symbol.value] as IoSeq;

            if (s == null)
            {
                return(null);
            }
            return(slots[s] as IoObject);
        }
Ejemplo n.º 10
0
        public static IoObject slotReverse(IoObject target, IoObject locals, IoObject message)
        {
            IoMessage m   = message as IoMessage;
            IoSeq     o   = target as IoSeq;
            IoSeq     res = IoSeq.createObject(target.state);

            char[] A = o.asCharArray;
            Array.Reverse(A);
            res.value = new string(A);
            return(res);
        }
Ejemplo n.º 11
0
        public override IoObject clone(IoState state)
        {
            IoSeq proto  = state.protoWithInitFunc(name) as IoSeq;
            IoSeq result = new IoSeq();

            result.state = state;
            result.value = proto.value;
            result.createProtos();
            result.createSlots();
            result.protos.Add(proto);
            return(result);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
Archivo: IoMessage.cs Proyecto: ypyf/io
        IoMessage newFromTextLabelSymbol(IoState state, string code, IoSeq labelSymbol)
        {
            IoLexer   lexer = new IoLexer();
            IoMessage msg   = new IoMessage();

            msg     = msg.clone(state) as IoMessage;
            lexer.s = code;
            lexer.lex();
            msg = this.newParse(state, lexer);
            msg.opShuffle();
            msg.label = labelSymbol;
            return(msg);
        }
Ejemplo n.º 16
0
        public static IoSeq rawAsUnquotedSymbol(IoSeq s)
        {
            string str = "";

            if (s.value.StartsWith("\""))
            {
                str = s.value.Substring(1, s.value.Length - 1);
            }
            if (s.value.EndsWith("\""))
            {
                str = str.Substring(0, s.value.Length - 2);
            }
            return(IoSeq.createObject(s.state, str));
        }
Ejemplo n.º 17
0
        public IoObject slotsBySymbol(IoSeq symbol)
        {
            if (!state.symbols.ContainsKey(symbol.value))
            {
                return(null);
            }
            IoSeq s = state.symbols[symbol.value];

            if (!slots.ContainsKey(s))
            {
                return(null);
            }
            return(slots[s]);
        }
Ejemplo n.º 18
0
        // Call Public Raw Methods

        public override IoObject activate(IoObject sender, IoObject target, IoObject locals, IoMessage m, IoObject slotContext)
        {
            IoState state = sender.state;
            IoBlock self  = sender as IoBlock;

            IoObjectArrayList argNames = self.argNames;
            IoObject          scope    = self.scope;

            IoObject blockLocals = state.localsProto.clone(state);
            IoObject result      = null;
            IoObject callObject  = null;

            blockLocals.isLocals = true;

            if (scope == null)
            {
                scope = target;
            }

            blockLocals.createSlots();

            callObject = IoCall.with(state, locals, target, m, slotContext, self, null /*state.currentCoroutine*/);

            IoSeqObjectHashtable bslots = blockLocals.slots;

            bslots["call"]       = callObject;
            bslots["self"]       = scope;
            bslots["updateSlot"] = state.localsUpdateSlotCFunc;

            if (argNames != null)
            {
                for (int i = 0; i < argNames.Count; i++)
                {
                    IoSeq    name = argNames[i] as IoSeq;
                    IoObject arg  = m.localsValueArgAt(locals, i);
                    blockLocals.slots[name] = arg;
                }
            }

            if (self.containedMessage != null)
            {
                result = self.containedMessage.localsPerformOn(blockLocals, blockLocals);
            }

            if (self.passStops == IoCallStatus.MESSAGE_STOP_STATUS_NORMAL)
            {
            }

            return(result);
        }
Ejemplo n.º 19
0
 public void setupSymbols()
 {
     activateSymbol        = IOSYMBOL("activate");
     callSymbol            = IOSYMBOL("call");
     forwardSymbol         = IOSYMBOL("forward");
     noShufflingSymbol     = IOSYMBOL("__noShuffling__");
     opShuffleSymbol       = IOSYMBOL("opShuffle");
     semicolonSymbol       = IOSYMBOL(";");
     selfSymbol            = IOSYMBOL("self");
     setSlotSymbol         = IOSYMBOL("setSlot");
     setSlotWithTypeSymbol = IOSYMBOL("setSlotWithType");
     stackSizeSymbol       = IOSYMBOL("stackSize");
     typeSymbol            = IOSYMBOL("type");
     updateSlotSymbol      = IOSYMBOL("updateSlot");
 }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        public static IoSeq rawAsUnescapedSymbol(IoSeq s)
        {
            string str = "";
            int    i   = 0;

            while (i < s.value.Length)
            {
                char c = s.value[i];
                if (c != '\\')
                {
                    str += c;
                }
                else
                {
                    c = s.value[i];
                    switch (c)
                    {
                    case 'a': c = '\a'; break;

                    case 'b': c = '\b'; break;

                    case 'f': c = '\f'; break;

                    case 'n': c = '\n'; break;

                    case 'r': c = '\r'; break;

                    case 't': c = '\t'; break;

                    case 'v': c = '\v'; break;

                    case '\0': c = '\\'; break;

                    default:
                        if (c > '0' && c < '9')
                        {
                            c -= '0';
                        }
                        break;
                    }
                    str += c;
                }

                i++;
            }
            return(IoSeq.createObject(s.state, str));
        }
Ejemplo n.º 22
0
Archivo: IoMessage.cs Proyecto: ypyf/io
        void ifPossibleCacheToken(IoToken token)
        {
            IoSeq    method = this.messageName;
            IoObject r      = null;

            switch (token.type)
            {
            case IoTokenType.TRIQUOTE_TOKEN:
                break;

            case IoTokenType.MONOQUOTE_TOKEN:
                r = IoSeq.createSymbolInMachine(
                    method.state,
                    IoSeq.rawAsUnescapedSymbol(
                        IoSeq.rawAsUnquotedSymbol(
                            IoSeq.createObject(method.state, method.value)
                            )
                        ).value
                    );
                break;

            case IoTokenType.NUMBER_TOKEN:
                r = IoNumber.newWithDouble(this.state, Convert.ToDouble(method.value, CultureInfo.InvariantCulture));
                break;

            default:
                if (method.value.Equals("nil"))
                {
                    r = state.ioNil;
                }
                else if (method.value.Equals("true"))
                {
                    r = state.ioTrue;
                }
                else if (method.value.Equals("false"))
                {
                    r = state.ioFalse;
                }
                break;
            }
            this.cachedResult = r;
        }
Ejemplo n.º 23
0
        // Published Slots

        public new static IoObject slotMethod(IoObject target, IoObject locals, IoObject message)
        {
            IoState   state            = target.state;
            IoBlock   self             = IoBlock.createObject(state);
            IoMessage m                = message as IoMessage;
            int       nargs            = m.args.Count;
            IoMessage lastArgAsMessage = (nargs > 0) ? m.rawArgAt(nargs - 1) : state.nilMessage;
            int       i;

            self.containedMessage = lastArgAsMessage;
            self.isActivatable    = true;

            for (i = 0; i < nargs - 1; i++)
            {
                IoMessage argMessage = m.rawArgAt(i);
                IoSeq     name       = argMessage.messageName;
                self.argNames.Add(name);
            }

            return(self);
        }
Ejemplo n.º 24
0
        public override IoObject proto(IoState state)
        {
            IoSeq pro = new IoSeq();

            pro.state = state;
            //	pro.tag.cloneFunc = new IoTagCloneFunc(this.clone);
            //    pro.tag.compareFunc = new IoTagCompareFunc(this.compare);
            pro.createSlots();
            pro.createProtos();
            state.registerProtoWithFunc(name, new IoStateProto(name, pro, new IoStateProtoFunc(this.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("appendSeq", new IoMethodFunc(IoSeq.slotAppendSeq)),
                new IoCFunction("at", new IoMethodFunc(IoSeq.slotAt)),
                new IoCFunction("reverse", new IoMethodFunc(IoSeq.slotReverse)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
Ejemplo n.º 25
0
        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);
        }
Ejemplo n.º 26
0
Archivo: IoSeq.cs Proyecto: devaspot/io
        public static IoSeq rawAsUnescapedSymbol(IoSeq s)
        {
            string str = "";
            int i = 0;
            while (i < s.value.Length)
            {
                char c = s.value[i];
                if (c != '\\')
                {
                    str += c;
                }
                else
                {
                    c = s.value[i];
                    switch (c)
                    {
                        case 'a': c = '\a'; break;
                        case 'b': c = '\b'; break;
                        case 'f': c = '\f'; break;
                        case 'n': c = '\n'; break;
                        case 'r': c = '\r'; break;
                        case 't': c = '\t'; break;
                        case 'v': c = '\v'; break;
                        case '\0': c = '\\'; break;
                        default:
                            if (c > '0' && c < '9')
                            {
                                c -= '0';
                            }
                            break;
                    }
                    str += c;
                }

                i++;
            }
            return IoSeq.createObject(s.state, str);
        }
Ejemplo n.º 27
0
Archivo: IoMessage.cs Proyecto: ypyf/io
        IoMessage newParse(IoState state, IoLexer lexer)
        {
            if (lexer.errorToken != null)
            {
            }

            if (lexer.topType() == IoTokenType.TERMINATOR_TOKEN)
            {
                lexer.pop();
            }

            if (lexer.top() != null && lexer.top().isValidMessageName())
            {
                IoMessage self = newParseNextMessageChain(state, lexer);
                if (lexer.topType() != IoTokenType.NO_TOKEN)
                {
                    state.error(self, "compile error: %s", "unused tokens");
                }
                return(self);
            }

            return(newWithNameReturnsValue(state, IoSeq.createSymbolInMachine(state, "nil"), state.ioNil));
        }
Ejemplo n.º 28
0
        public IoObject rawGetSlotContext(IoSeq slot, out IoObject context)
        {
            if (slot == null)
            {
                context = null;
                return(null);
            }
            IoObject v = null;

            context = null;
            if (slotsBySymbol(slot) != null)
            {
                v = slotsBySymbol(slot) as IoObject;
                if (v != null)
                {
                    context = this;
                    return(v);
                }
            }
            hasDoneLookup = true;
            foreach (IoObject proto in protos)
            {
                if (proto.hasDoneLookup)
                {
                    continue;
                }
                v = proto.rawGetSlotContext(slot, out context);
                if (v != null)
                {
                    break;
                }
            }
            hasDoneLookup = false;

            return(v);
        }
Ejemplo n.º 29
0
Archivo: IoMessage.cs Proyecto: ypyf/io
        public override IoObject proto(IoState state)
        {
            IoMessage pro = new IoMessage();

            pro.state = state;
            //  pro.tag.cloneFunc = new IoTagCloneFunc(this.clone);
            //pro.tag.activateFunc = new IoTagActivateFunc(this.activate);
            pro.createSlots();
            pro.createProtos();
            pro.uniqueId    = 0;
            pro.messageName = IoSeq.createSymbolInMachine(state, "anonymous");
            pro.label       = IoSeq.createSymbolInMachine(state, "unlabeled");
            pro.args        = new List <IoMessage>();
            state.registerProtoWithFunc(name, new IoStateProto(name, pro, new IoStateProtoFunc(this.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("name", new IoMethodFunc(IoMessage.slotName)),
                new IoCFunction("setName", new IoMethodFunc(IoMessage.slotSetName)),
                new IoCFunction("next", new IoMethodFunc(IoMessage.slotNext)),
                new IoCFunction("setNext", new IoMethodFunc(IoMessage.slotSetNext)),
                new IoCFunction("code", new IoMethodFunc(IoMessage.slotCode)),
                new IoCFunction("arguments", new IoMethodFunc(IoMessage.slotArguments)),
                new IoCFunction("appendArg", new IoMethodFunc(IoMessage.slotAppendArg)),
                new IoCFunction("argAt", new IoMethodFunc(IoMessage.slotArgAt)),
                new IoCFunction("argCount", new IoMethodFunc(IoMessage.slotArgCount)),
                new IoCFunction("asString", new IoMethodFunc(IoMessage.slotCode)),
                new IoCFunction("cachedResult", new IoMethodFunc(IoMessage.slotCachedResult)),
                new IoCFunction("setCachedResult", new IoMethodFunc(IoMessage.slotSetCachedResult)),
                new IoCFunction("removeCachedResult", new IoMethodFunc(IoMessage.slotRemoveCachedResult)),
                new IoCFunction("hasCachedResult", new IoMethodFunc(IoMessage.slotHasCachedResult)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
Ejemplo n.º 30
0
        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);
        }
Ejemplo n.º 31
0
Archivo: IoSeq.cs Proyecto: devaspot/io
 public static new IoSeq createProto(IoState state)
 {
     IoSeq s = new IoSeq();
     return s.proto(state) as IoSeq;
 }
Ejemplo n.º 32
0
 public static IoObject slotType(IoObject target, IoObject locals, IoObject message)
 {
     return(IoSeq.createObject(target.state, target.name));
 }
Ejemplo n.º 33
0
Archivo: IoSeq.cs Proyecto: devaspot/io
 public override IoObject clone(IoState state)
 {
     IoSeq proto = state.protoWithInitFunc(name) as IoSeq;
     IoSeq result = new IoSeq();
     result.state = state;
     result.value = proto.value;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
Ejemplo n.º 34
0
        public IoObject rawGetSlotContext(IoSeq slot, out IoObject context)
        {
            if (slot == null)
            {
                context = null;
                return null;
            }
            IoObject v = null;
            context = null;
            if (slotsBySymbol(slot) != null)
            {
                v = slotsBySymbol(slot) as IoObject;
                if (v != null)
                {
                    context = this;
                    return v;
                }
            }
            hasDoneLookup = true;
            foreach (IoObject proto in protos)
            {
                if (proto.hasDoneLookup)
                    continue;
                v = proto.rawGetSlotContext(slot, out context);
                if (v != null) break;
            }
            hasDoneLookup = false;

            return v;
        }
Ejemplo n.º 35
0
 public IoObject slotsBySymbol(IoSeq symbol)
 {
     IoSeq s = this.state.symbols[symbol.value] as IoSeq;
     if (s == null) return null;
     return slots[s] as IoObject;
 }
Ejemplo n.º 36
0
 public IoObject rawGetSlot(IoSeq slot)
 {
     IoObject context = null;
     IoObject v = rawGetSlotContext(slot, out context);
     return v;
 }
Ejemplo n.º 37
0
 public IoSeq IOSYMBOL(string name)
 {
     return(IoSeq.createSymbolInMachine(this, name));
 }
Ejemplo n.º 38
0
Archivo: IoSeq.cs Proyecto: devaspot/io
        public override IoObject proto(IoState state)
        {
            IoSeq pro = new IoSeq();
            pro.state = state;
            //	pro.tag.cloneFunc = new IoTagCloneFunc(this.clone);
            //    pro.tag.compareFunc = new IoTagCompareFunc(this.compare);
            pro.createSlots();
            pro.createProtos();
            state.registerProtoWithFunc(name, new IoStateProto(name, pro, new IoStateProtoFunc(this.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("appendSeq", new IoMethodFunc(IoSeq.slotAppendSeq)),
                new IoCFunction("at", new IoMethodFunc(IoSeq.slotAt)),
                new IoCFunction("reverse", new IoMethodFunc(IoSeq.slotReverse)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
Ejemplo n.º 39
0
 // Message Public Raw Methods
 public static IoMessage newWithName(IoState state, IoSeq ioSymbol)
 {
     IoMessage msg = IoMessage.createObject(state);
     msg.messageName = ioSymbol;
     return msg;
 }
Ejemplo n.º 40
0
 void parseName(IoState state, IoLexer lexer)
 {
     IoToken token = lexer.pop();
     messageName = IoSeq.createSymbolInMachine(state, token.name);
     ifPossibleCacheToken(token);
     //rawSetLineNumber(token.lineNumber);
     //rawSetCharNumber(token.charNumber);
 }
Ejemplo n.º 41
0
        public IoState()
        {
            objectProto = IoObject.createProto(this);
            core        = objectProto.clone(this);
            lobby       = objectProto.clone(this);

            IoSeq seqProto = IoSeq.createProto(this);

            setupSingletons();
            setupSymbols();

            objectProto.protoFinish(this);

            IoMessage messageProto = IoMessage.createProto(this);

            nilMessage = IoMessage.createObject(this) as IoMessage;
            nilMessage.cachedResult = ioNil;
            nilMessage.messageName  = IOSYMBOL("nil");

            IoMap       mapProto   = IoMap.createProto(this);
            IoNumber    numProto   = IoNumber.createProto(this);
            IoCFunction cfProto    = IoCFunction.createProto(this);
            IoBlock     blockProto = IoBlock.createProto(this);
            //IoCoroutine coroProto = IoCoroutine.createProto(this);
            //mainCoroutine = coroProto;
            //currentCoroutine = coroProto;
            IoCall callProto = IoCall.createProto(this);
            IoList listProto = IoList.createProto(this);

            clrProto = IoCLR.createProto(this);
            IoCLRAssembly asmProto    = IoCLRAssembly.createProto(this);
            IoCLRObject   clrObjProto = IoCLRObject.createProto(this);

            IoObject protos = objectProto.clone(this);

            protos.slots["Core"]   = core;
            protos.slots["Addons"] = null;

            lobby.slots["Lobby"]  = lobby;
            lobby.slots["Protos"] = protos;

            core.slots["Object"] = objectProto;
            core.slots["Map"]    = mapProto;
            // core.slots["Coroutine"] = coroProto;
            core.slots["Message"]     = messageProto;
            core.slots["CFunction"]   = cfProto;
            core.slots["Number"]      = numProto;
            core.slots["Block"]       = blockProto;
            core.slots["Call"]        = callProto;
            core.slots["Locals"]      = localsProto = objectProto.localsProto(this);
            core.slots["List"]        = listProto;
            core.slots["Sequence"]    = seqProto;
            core.slots["CLR"]         = clrProto;
            core.slots["CLRAssembly"] = asmProto;
            core.slots["CLRObject"]   = clrObjProto;

            objectProto.protos.Add(lobby);
            lobby.protos.Add(protos);
            protos.protos.Add(core);

            localsUpdateSlotCFunc = new IoCFunction(this, "localsUpdate", IoObject.localsUpdateSlot);

            initMessage      = IoMessage.newWithName(this, IOSYMBOL("init"));
            forwardMessage   = IoMessage.newWithName(this, IOSYMBOL("forward"));
            activateMessage  = IoMessage.newWithName(this, IOSYMBOL("activate"));
            selfMessage      = IoMessage.newWithName(this, IOSYMBOL("self"));
            opShuffleMessage = IoMessage.newWithName(this, IOSYMBOL("opShuffle"));
            mainMessage      = IoMessage.newWithName(this, IOSYMBOL("main"));
            typeMessage      = IoMessage.newWithName(this, IOSYMBOL("type"));
        }
Ejemplo n.º 42
0
Archivo: IoSeq.cs Proyecto: devaspot/io
 public static IoSeq rawAsUnquotedSymbol(IoSeq s)
 {
     string str = "";
     if (s.value.StartsWith("\"")) str = s.value.Substring(1, s.value.Length - 1);
     if (s.value.EndsWith("\"")) str = str.Substring(0,s.value.Length-2);
     return IoSeq.createObject(s.state, str);
 }
Ejemplo n.º 43
0
 public void setupSymbols()
 {
     activateSymbol = IOSYMBOL("activate");
     callSymbol = IOSYMBOL("call");
     forwardSymbol = IOSYMBOL("forward");
     noShufflingSymbol = IOSYMBOL("__noShuffling__");
     opShuffleSymbol = IOSYMBOL("opShuffle");
     semicolonSymbol = IOSYMBOL(";");
     selfSymbol = IOSYMBOL("self");
     setSlotSymbol = IOSYMBOL("setSlot");
     setSlotWithTypeSymbol = IOSYMBOL("setSlotWithType");
     stackSizeSymbol = IOSYMBOL("stackSize");
     typeSymbol = IOSYMBOL("type");
     updateSlotSymbol = IOSYMBOL("updateSlot");
 }
Ejemplo n.º 44
0
 IoMessage newFromTextLabelSymbol(IoState state, string code, IoSeq labelSymbol)
 {
     IoLexer lexer = new IoLexer();
     IoMessage msg = new IoMessage();
     msg = msg.clone(state) as IoMessage;
     lexer.s = code;
     lexer.lex();
     msg = this.newParse(state, lexer);
     msg.opShuffle();
     msg.label = labelSymbol;
     return msg;
 }
Ejemplo n.º 45
0
 IoMessage newWithNameReturnsValue(IoState state, IoSeq symbol, IoObject v)
 {
     IoMessage self = clone(state) as IoMessage;
     self.messageName = symbol;
     self.cachedResult = v;
     return self;
 }
Ejemplo n.º 46
0
Archivo: IoSeq.cs Proyecto: devaspot/io
 public static new IoSeq createObject(IoState state)
 {
     IoSeq s = new IoSeq();
     return s.clone(state) as IoSeq;
 }