protoWithInitFunc() public method

public protoWithInitFunc ( string name ) : IoObject
name string
return IoObject
示例#1
0
文件: IoNumber.cs 项目: devaspot/io
        public static IoNumber newWithDouble(IoState state, double n)
        {
            IoNumber fab = new IoNumber();
            IoNumber num = state.protoWithInitFunc(fab.name) as IoNumber;
            num = num.clone(state) as IoNumber;
            num.isInteger = false;
            num.doubleValue = n;

            if (Double.Equals(n, 0) ||
                (!Double.IsInfinity(n) && !Double.IsNaN(n) &&
                !n.ToString(CultureInfo.InvariantCulture).Contains(".") &&
                !n.ToString(CultureInfo.InvariantCulture).Contains("E") &&
                !n.ToString(CultureInfo.InvariantCulture).Contains("e")
                )
            )
            {
                try
                {
                    num.longValue = Convert.ToInt32(n);
                    num.isInteger = true;
                }
                catch (OverflowException oe)
                {

                }
            }
            return num;
        }
示例#2
0
        public override IoObject proto(IoState state)
        {
            IoNumber pro = new IoNumber();

            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            pro.doubleValue = 0;
            pro.longValue   = 0;
            pro.isInteger   = true;
            state.registerProtoWithFunc(name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("asNumber", new IoMethodFunc(IoNumber.slotAsNumber)),
                new IoCFunction("+", new IoMethodFunc(IoNumber.slotAdd)),
                new IoCFunction("-", new IoMethodFunc(IoNumber.slotSubstract)),
                new IoCFunction("*", new IoMethodFunc(IoNumber.slotMultiply)),
                new IoCFunction("/", new IoMethodFunc(IoNumber.slotDivide)),
                new IoCFunction("log10", new IoMethodFunc(IoNumber.slotLog10)),
                new IoCFunction("log2", new IoMethodFunc(IoNumber.slotLog2)),
                new IoCFunction("log", new IoMethodFunc(IoNumber.slotLog)),
                new IoCFunction("pow", new IoMethodFunc(IoNumber.slotPow)),
                new IoCFunction("pi", new IoMethodFunc(IoNumber.slotPi)),
                new IoCFunction("e", new IoMethodFunc(IoNumber.slotE)),
                new IoCFunction("minPositive", new IoMethodFunc(IoNumber.slotMinPositive)),
                new IoCFunction("exp", new IoMethodFunc(IoNumber.slotExp)),
                new IoCFunction("round", new IoMethodFunc(IoNumber.slotRound)),
//                new IoCFunction("asString", new IoMethodFunc(this.asString))
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
示例#3
0
文件: IoBDB.cs 项目: MilkTool/io-clr
        public override IoObject proto(IoState state)
        {
            IoMap pro = new IoMap();

            pro.tag.state        = state;
            pro.tag.cloneFunc    = new IoTagCloneFunc(pro.clone);
            pro.tag.activateFunc = new IoTagActivateFunc(pro.activate);
            pro.createSlots();
            pro.createProtos();
            pro.map = new Hashtable();
            state.registerProtoWithFunc(pro.name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("at", new IoMethodFunc(IoMap.slotAt)),
                new IoCFunction("atPut", new IoMethodFunc(IoMap.slotAtPut)),
                new IoCFunction("atIfAbsentPut", new IoMethodFunc(IoMap.slotAtIfAbsentPut)),
                new IoCFunction("empty", new IoMethodFunc(IoMap.slotEmpty)),
                new IoCFunction("size", new IoMethodFunc(IoMap.slotSize)),
                new IoCFunction("removeAt", new IoMethodFunc(IoMap.slotRemoveAt)),
                new IoCFunction("hasKey", new IoMethodFunc(IoMap.slotHasKey)),
                new IoCFunction("hasValue", new IoMethodFunc(IoMap.slotHasValue)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
示例#4
0
文件: IoList.cs 项目: ypyf/io
        public override IoObject proto(IoState state)
        {
            IoList pro = new IoList();

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

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("indexOf", new IoMethodFunc(IoList.slotIndexOf)),
                new IoCFunction("capacity", new IoMethodFunc(IoList.slotSize)),
                new IoCFunction("size", new IoMethodFunc(IoList.slotSize)),
                new IoCFunction("removeAll", new IoMethodFunc(IoList.slotRemoveAll)),
                new IoCFunction("append", new IoMethodFunc(IoList.slotAppend)),
                new IoCFunction("appendSeq", new IoMethodFunc(IoList.slotAppendSeq)),
                new IoCFunction("with", new IoMethodFunc(IoList.slotWith)),
                new IoCFunction("prepend", new IoMethodFunc(IoList.slotPrepend)),
                new IoCFunction("push", new IoMethodFunc(IoList.slotAppend)),
                new IoCFunction("at", new IoMethodFunc(IoList.slotAt)),
                new IoCFunction("last", new IoMethodFunc(IoList.slotLast)),
                new IoCFunction("pop", new IoMethodFunc(IoList.slotPop)),
                new IoCFunction("removeAt", new IoMethodFunc(IoList.slotRemoveAt)),
                new IoCFunction("reverseForeach", new IoMethodFunc(IoList.slotReverseForeach)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
示例#5
0
        public static IoNumber newWithDouble(IoState state, double n)
        {
            IoNumber fab = new IoNumber();
            IoNumber num = state.protoWithInitFunc(fab.name) as IoNumber;

            num             = num.clone(state) as IoNumber;
            num.isInteger   = false;
            num.doubleValue = n;

            if (Double.Equals(n, 0) ||
                (!Double.IsInfinity(n) && !Double.IsNaN(n) &&
                 !n.ToString(CultureInfo.InvariantCulture).Contains(".") &&
                 !n.ToString(CultureInfo.InvariantCulture).Contains("E") &&
                 !n.ToString(CultureInfo.InvariantCulture).Contains("e")
                )
                )
            {
                try
                {
                    num.longValue = Convert.ToInt32(n);
                    num.isInteger = true;
                }
                catch (OverflowException oe)
                {
                }
            }
            return(num);
        }
示例#6
0
        public override IoObject proto(IoState state)
        {
            IoCoroutine pro = new IoCoroutine();

            //~//pro.tag.state = state;
            pro.state = state;
            //  pro.tag.cloneFunc = new IoTagCloneFunc(this.clone);
            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("run", new IoMethodFunc(IoCoroutine.slotRun)),
                new IoCFunction("main", new IoMethodFunc(IoCoroutine.slotMain)),
                new IoCFunction("resume", new IoMethodFunc(IoCoroutine.slotResume)),
                new IoCFunction("isCurrent", new IoMethodFunc(IoCoroutine.slotIsCurrent)),
                new IoCFunction("currentCoroutine", new IoMethodFunc(IoCoroutine.slotCurrentCoroutine)),
                new IoCFunction("implementation", new IoMethodFunc(IoCoroutine.slotImplementation)),
                new IoCFunction("setMessageDebugging", new IoMethodFunc(IoCoroutine.slotSetMessageDebugging)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
示例#7
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);
        }
示例#8
0
文件: IoCLRObject.cs 项目: ypyf/io
 public override IoObject clone(IoState state)
 {
     IoCLRObject proto = state.protoWithInitFunc(name) as IoCLRObject;
     IoCLRObject result = new IoCLRObject();
     result.isActivatable = true;
     uniqueIdCounter++;
     result.uniqueId = uniqueIdCounter;
     result.state = state;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
示例#9
0
        public override IoObject clone(IoState state)
        {
            IoCoroutine proto  = state.protoWithInitFunc(name) as IoCoroutine;
            IoCoroutine result = new IoCoroutine();

            uniqueIdCounter++;
            result.uniqueId = uniqueIdCounter;
            result.tag      = proto.tag;
            result.createProtos();
            result.createSlots();
            result.protos.Add(proto);
            return(result);
        }
示例#10
0
 public override IoObject clone(IoState state)
 {
     IoCLRObject proto = state.protoWithInitFunc(name) as IoCLRObject;
     IoCLRObject result = new IoCLRObject();
     result.isActivatable = true;
     uniqueIdCounter++;
     result.uniqueId = uniqueIdCounter;
     result.state = state;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
示例#11
0
文件: IoBDB.cs 项目: MilkTool/io-clr
        public override IoObject clone(IoState state)
        {
            IoObject proto  = state.protoWithInitFunc(name);
            IoMap    result = new IoMap();

            uniqueIdCounter++;
            result.uniqueId = uniqueIdCounter;
            result.map      = new Hashtable();
            result.tag      = proto.tag;
            result.createProtos();
            result.createSlots();
            result.protos.Add(proto);
            return(result);
        }
示例#12
0
文件: IoList.cs 项目: ypyf/io
        public override IoObject clone(IoState state)
        {
            IoObject proto  = state.protoWithInitFunc(name);
            IoList   result = new IoList();

            uniqueIdCounter++;
            result.uniqueId = uniqueIdCounter;
            result.list     = new IoObjectArrayList();
            result.state    = state;
            result.createProtos();
            result.createSlots();
            result.protos.Add(proto);
            return(result);
        }
示例#13
0
        public virtual IoObject clone(IoState state)
        {
            IoObject proto = state.protoWithInitFunc(name);
            IoObject o     = Activator.CreateInstance(this.GetType()) as IoObject;

            uniqueIdCounter++;
            o.uniqueId = uniqueIdCounter;
            o.state    = proto.state;
            o.createSlots();
            o.createProtos();
            o.protos.Add(proto);
            cloneSpecific(this, o);
            return(o);
        }
示例#14
0
        // proto finish must be called only before first Sequence proto created

        public IoObject protoFinish(IoState state)
        {
            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("compare", new IoMethodFunc(IoObject.slotCompare)),
                new IoCFunction("==", new IoMethodFunc(IoObject.slotEquals)),
                new IoCFunction("!=", new IoMethodFunc(IoObject.slotNotEquals)),
                new IoCFunction(">=", new IoMethodFunc(IoObject.slotGreaterThanOrEqual)),
                new IoCFunction("<=", new IoMethodFunc(IoObject.slotLessThanOrEqual)),
                new IoCFunction(">", new IoMethodFunc(IoObject.slotGreaterThan)),
                new IoCFunction("<", new IoMethodFunc(IoObject.slotLessThan)),
                new IoCFunction("-", new IoMethodFunc(IoObject.slotSubstract)),
                new IoCFunction("", new IoMethodFunc(IoObject.slotEevalArg)),
                new IoCFunction("self", new IoMethodFunc(IoObject.slotSelf)),
                new IoCFunction("clone", new IoMethodFunc(IoObject.slotClone)),
                new IoCFunction("return", new IoMethodFunc(IoObject.slotReturn)),
                new IoCFunction("cloneWithoutInit", new IoMethodFunc(IoObject.slotCloneWithoutInit)),
                new IoCFunction("doMessage", new IoMethodFunc(IoObject.slotDoMessage)),
                new IoCFunction("print", new IoMethodFunc(IoObject.slotPrint)),
                new IoCFunction("println", new IoMethodFunc(IoObject.slotPrintln)),
                new IoCFunction("slotNames", new IoMethodFunc(IoObject.slotSlotNames)),
                new IoCFunction("type", new IoMethodFunc(IoObject.slotType)),
                new IoCFunction("evalArg", new IoMethodFunc(IoObject.slotEevalArg)),
                new IoCFunction("evalArgAndReturnSelf", new IoMethodFunc(IoObject.slotEevalArgAndReturnSelf)),
                new IoCFunction("do", new IoMethodFunc(IoObject.slotDo)),
                new IoCFunction("getSlot", new IoMethodFunc(IoObject.slotGetSlot)),
                new IoCFunction("updateSlot", new IoMethodFunc(IoObject.slotUpdateSlot)),
                new IoCFunction("setSlot", new IoMethodFunc(IoObject.slotSetSlot)),
                new IoCFunction("setSlotWithType", new IoMethodFunc(IoObject.slotSetSlotWithType)),
                new IoCFunction("message", new IoMethodFunc(IoObject.slotMessage)),
                new IoCFunction("method", new IoMethodFunc(IoObject.slotMethod)),
                new IoCFunction("block", new IoMethodFunc(IoObject.slotBlock)),
                new IoCFunction("init", new IoMethodFunc(IoObject.slotSelf)),
                new IoCFunction("thisContext", new IoMethodFunc(IoObject.slotSelf)),
                new IoCFunction("thisMessage", new IoMethodFunc(IoObject.slotThisMessage)),
                new IoCFunction("thisLocals", new IoMethodFunc(IoObject.slotThisLocals)),
                new IoCFunction("init", new IoMethodFunc(IoObject.slotSelf)),
                new IoCFunction("if", new IoMethodFunc(IoObject.slotIf)),
                new IoCFunction("yield", new IoMethodFunc(IoObject.slotYield)),
                new IoCFunction("@@", new IoMethodFunc(IoObject.slotAsyncCall)),
                new IoCFunction("yieldingCoros", new IoMethodFunc(IoObject.slotYieldingCoros)),
                new IoCFunction("while", new IoMethodFunc(IoObject.slotWhile))
            };
            IoObject o = state.protoWithInitFunc(name);

            o.addTaglessMethodTable(state, methodTable);
            return(o);
        }
示例#15
0
文件: IoCLRObject.cs 项目: ypyf/io
        public override IoObject proto(IoState state)
        {
            IoCLRObject pro = new IoCLRObject();
            pro.state = state;
            pro.uniqueId = 0;
            pro.createSlots();
            pro.createProtos();
            pro.isActivatable = true;
            state.registerProtoWithFunc(pro.name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
			pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
				new IoCFunction("type", new IoMethodFunc(IoObject.slotType))
			};

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#16
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);
        }
示例#17
0
        public override IoObject proto(IoState state)
        {
            IoBlock pro = new IoBlock();

            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            pro.containedMessage = state.nilMessage;
            pro.argNames         = 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("call", new IoMethodFunc(IoBlock.slotCall)),
                new IoCFunction("code", new IoMethodFunc(IoBlock.slotCode)),
                new IoCFunction("block", new IoMethodFunc(IoBlock.slotBlock)),
                new IoCFunction("method", new IoMethodFunc(IoBlock.slotMethod)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return(pro);
        }
示例#18
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);
        }
示例#19
0
 public override IoObject clone(IoState state)
 {
     IoObject proto = state.protoWithInitFunc(name);
     IoMap result = new IoMap();
     uniqueIdCounter++;
     result.uniqueId = uniqueIdCounter;
     result.map = new Hashtable();
     result.tag = proto.tag;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
示例#20
0
        public override IoObject proto(IoState state)
        {
            IoNumber pro = new IoNumber();
            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            pro.doubleValue = 0;
            pro.longValue = 0;
            pro.isInteger = true;
            state.registerProtoWithFunc(name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("asNumber", new IoMethodFunc(IoNumber.slotAsNumber)),
                new IoCFunction("+", new IoMethodFunc(IoNumber.slotAdd)),
                new IoCFunction("-", new IoMethodFunc(IoNumber.slotSubstract)),
                new IoCFunction("*", new IoMethodFunc(IoNumber.slotMultiply)),
                new IoCFunction("/", new IoMethodFunc(IoNumber.slotDivide)),
                new IoCFunction("log10", new IoMethodFunc(IoNumber.slotLog10)),
                new IoCFunction("log2", new IoMethodFunc(IoNumber.slotLog2)),
                new IoCFunction("log", new IoMethodFunc(IoNumber.slotLog)),
                new IoCFunction("pow", new IoMethodFunc(IoNumber.slotPow)),
                new IoCFunction("pi", new IoMethodFunc(IoNumber.slotPi)),
                new IoCFunction("e", new IoMethodFunc(IoNumber.slotE)),
                new IoCFunction("minPositive", new IoMethodFunc(IoNumber.slotMinPositive)),
                new IoCFunction("exp", new IoMethodFunc(IoNumber.slotExp)),
                new IoCFunction("round", new IoMethodFunc(IoNumber.slotRound)),
            //                new IoCFunction("asString", new IoMethodFunc(this.asString))
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#21
0
        public override IoObject proto(IoState state)
        {
            IoMap pro = new IoMap();
            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            pro.map = new Hashtable();
            state.registerProtoWithFunc(pro.name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("at", new IoMethodFunc(IoMap.slotAt)),
                new IoCFunction("atPut", new IoMethodFunc(IoMap.slotAtPut)),
                new IoCFunction("atIfAbsentPut", new IoMethodFunc(IoMap.slotAtIfAbsentPut)),
                new IoCFunction("empty", new IoMethodFunc(IoMap.slotEmpty)),
                new IoCFunction("size", new IoMethodFunc(IoMap.slotSize)),
                new IoCFunction("removeAt", new IoMethodFunc(IoMap.slotRemoveAt)),
                new IoCFunction("hasKey", new IoMethodFunc(IoMap.slotHasKey)),
                new IoCFunction("hasValue", new IoMethodFunc(IoMap.slotHasValue)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#22
0
 public override IoObject clone(IoState state)
 {
     IoCoroutine proto = state.protoWithInitFunc(name) as IoCoroutine;
     IoCoroutine result = new IoCoroutine();
     uniqueIdCounter++;
     result.uniqueId = uniqueIdCounter;
     result.tag = proto.tag;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
示例#23
0
        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;
        }
示例#24
0
        public override IoObject proto(IoState state)
        {
            IoCoroutine pro = new IoCoroutine();
            pro.tag.state = state;
              //  pro.tag.cloneFunc = new IoTagCloneFunc(this.clone);
            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("run", new IoMethodFunc(IoCoroutine.slotRun)),
                new IoCFunction("main", new IoMethodFunc(IoCoroutine.slotMain)),
                new IoCFunction("resume", new IoMethodFunc(IoCoroutine.slotResume)),
                new IoCFunction("isCurrent", new IoMethodFunc(IoCoroutine.slotIsCurrent)),
                new IoCFunction("currentCoroutine", new IoMethodFunc(IoCoroutine.slotCurrentCoroutine)),
                new IoCFunction("implementation", new IoMethodFunc(IoCoroutine.slotImplementation)),
                new IoCFunction("setMessageDebugging", new IoMethodFunc(IoCoroutine.slotSetMessageDebugging)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#25
0
 public override IoObject clone(IoState state)
 {
     IoObject proto = state.protoWithInitFunc(name);
     IoList result = new IoList();
     uniqueIdCounter++;
     result.uniqueId = uniqueIdCounter;
     result.list = new IoObjectList();
     result.state = state;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
示例#26
0
        public override IoObject proto(IoState state)
        {
            IoString pro = new IoString();
            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("appendStr", new IoMethodFunc(IoString.slotAppendStr)),
                new IoCFunction("at", new IoMethodFunc(IoString.slotAt)),
                new IoCFunction("reverse", new IoMethodFunc(IoString.slotReverse)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#27
0
        public override IoObject proto(IoState state)
        {
            IoCLRObject pro = new IoCLRObject();
            pro.state = state;
            pro.uniqueId = 0;
            pro.createSlots();
            pro.createProtos();
            pro.isActivatable = true;
            state.registerProtoWithFunc(pro.name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("type", new IoMethodFunc(IoObject.slotType))
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#28
0
 public override IoObject clone(IoState state)
 {
     IoString proto = state.protoWithInitFunc(name) as IoString;
     IoString result = new IoString();
     result.state = state;
     result.value = proto.value;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }
示例#29
0
        public override IoObject proto(IoState state)
        {
            IoBlock pro = new IoBlock();
            pro.state = state;
            pro.createSlots();
            pro.createProtos();
            pro.containedMessage = state.nilMessage;
            pro.argNames = 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("call", new IoMethodFunc(IoBlock.slotCall)),
                new IoCFunction("code", new IoMethodFunc(IoBlock.slotCode)),
                new IoCFunction("block", new IoMethodFunc(IoBlock.slotBlock)),
                new IoCFunction("method", new IoMethodFunc(IoBlock.slotMethod)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#30
0
        public override IoObject proto(IoState state)
        {
            IoList pro = new IoList();
            pro.state = state;
             //   pro.tag.cloneFunc = new IoTagCloneFunc(pro.clone);
            pro.createSlots();
            pro.createProtos();
            pro.list = new IoObjectList();
            state.registerProtoWithFunc(pro.name, new IoStateProto(pro.name, pro, new IoStateProtoFunc(pro.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("indexOf", new IoMethodFunc(IoList.slotIndexOf)),
                new IoCFunction("capacity", new IoMethodFunc(IoList.slotSize)),
                new IoCFunction("size", new IoMethodFunc(IoList.slotSize)),
                new IoCFunction("removeAll", new IoMethodFunc(IoList.slotRemoveAll)),
                new IoCFunction("append", new IoMethodFunc(IoList.slotAppend)),
                new IoCFunction("appendStr", new IoMethodFunc(IoList.slotAppendStr)),
                new IoCFunction("with", new IoMethodFunc(IoList.slotWith)),
                new IoCFunction("prepend", new IoMethodFunc(IoList.slotPrepend)),
                new IoCFunction("push", new IoMethodFunc(IoList.slotAppend)),
                new IoCFunction("at", new IoMethodFunc(IoList.slotAt)),
                new IoCFunction("last", new IoMethodFunc(IoList.slotLast)),
                new IoCFunction("pop", new IoMethodFunc(IoList.slotPop)),
                new IoCFunction("removeAt", new IoMethodFunc(IoList.slotRemoveAt)),
                new IoCFunction("reverseForeach", new IoMethodFunc(IoList.slotReverseForeach)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
示例#31
0
文件: IoObject.cs 项目: devaspot/io
 public virtual IoObject clone(IoState state)
 {
     IoObject proto = state.protoWithInitFunc(name);
     IoObject o = Activator.CreateInstance(this.GetType()) as IoObject;//typeof(this)new IoObject();
     uniqueIdCounter++;
     o.uniqueId = uniqueIdCounter;
     o.state = proto.state;
     o.createSlots();
     o.createProtos();
     o.protos.Add(proto);
     cloneSpecific(this, o);
     return o;
 }
示例#32
0
文件: IoObject.cs 项目: devaspot/io
 // proto finish must be called only before first Sequence proto created
 public IoObject protoFinish(IoState state)
 {
     IoCFunction[] methodTable = new IoCFunction[] {
         new IoCFunction("compare", new IoMethodFunc(IoObject.slotCompare)),
         new IoCFunction("==", new IoMethodFunc(IoObject.slotEquals)),
         new IoCFunction("!=", new IoMethodFunc(IoObject.slotNotEquals)),
         new IoCFunction(">=", new IoMethodFunc(IoObject.slotGreaterThanOrEqual)),
         new IoCFunction("<=", new IoMethodFunc(IoObject.slotLessThanOrEqual)),
         new IoCFunction(">", new IoMethodFunc(IoObject.slotGreaterThan)),
         new IoCFunction("<", new IoMethodFunc(IoObject.slotLessThan)),
         new IoCFunction("-", new IoMethodFunc(IoObject.slotSubstract)),
         new IoCFunction("", new IoMethodFunc(IoObject.slotEevalArg)),
         new IoCFunction("self", new IoMethodFunc(IoObject.slotSelf)),
         new IoCFunction("clone", new IoMethodFunc(IoObject.slotClone)),
         new IoCFunction("return", new IoMethodFunc(IoObject.slotReturn)),
         new IoCFunction("cloneWithoutInit", new IoMethodFunc(IoObject.slotCloneWithoutInit)),
         new IoCFunction("doMessage", new IoMethodFunc(IoObject.slotDoMessage)),
         new IoCFunction("print", new IoMethodFunc(IoObject.slotPrint)),
         new IoCFunction("println", new IoMethodFunc(IoObject.slotPrintln)),
         new IoCFunction("slotNames", new IoMethodFunc(IoObject.slotSlotNames)),
         new IoCFunction("type", new IoMethodFunc(IoObject.slotType)),
         new IoCFunction("evalArg", new IoMethodFunc(IoObject.slotEevalArg)),
         new IoCFunction("evalArgAndReturnSelf", new IoMethodFunc(IoObject.slotEevalArgAndReturnSelf)),
         new IoCFunction("do", new IoMethodFunc(IoObject.slotDo)),
         new IoCFunction("getSlot", new IoMethodFunc(IoObject.slotGetSlot)),
         new IoCFunction("updateSlot", new IoMethodFunc(IoObject.slotUpdateSlot)),
         new IoCFunction("setSlot", new IoMethodFunc(IoObject.slotSetSlot)),
         new IoCFunction("setSlotWithType", new IoMethodFunc(IoObject.slotSetSlotWithType)),
         new IoCFunction("message", new IoMethodFunc(IoObject.slotMessage)),
         new IoCFunction("method", new IoMethodFunc(IoObject.slotMethod)),
         new IoCFunction("block", new IoMethodFunc(IoObject.slotBlock)),
         new IoCFunction("init", new IoMethodFunc(IoObject.slotSelf)),
         new IoCFunction("thisContext", new IoMethodFunc(IoObject.slotSelf)),
         new IoCFunction("thisMessage", new IoMethodFunc(IoObject.slotThisMessage)),
         new IoCFunction("thisLocals", new IoMethodFunc(IoObject.slotThisLocals)),
         new IoCFunction("init", new IoMethodFunc(IoObject.slotSelf)),
         new IoCFunction("if", new IoMethodFunc(IoObject.slotIf)),
         new IoCFunction("yield", new IoMethodFunc(IoObject.slotYield)),
         new IoCFunction("@@", new IoMethodFunc(IoObject.slotAsyncCall)),
         new IoCFunction("yieldingCoros", new IoMethodFunc(IoObject.slotYieldingCoros)),
         new IoCFunction("while", new IoMethodFunc(IoObject.slotWhile))
     };
     IoObject o = state.protoWithInitFunc(name);
     o.addTaglessMethodTable(state, methodTable);
     return o;
 }