コード例 #1
0
ファイル: IoMessage.cs プロジェクト: 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);
        }
コード例 #2
0
ファイル: IoMessage.cs プロジェクト: stangelandcl/io-clr
        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 IoObjectArrayList();
            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;
        }