예제 #1
0
        public object ObjRef()
        {
            var tag = (SerializationCode)Byte();

            if (Config.SerTrace)
            {
                Console.WriteLine("Reading {0} from {1}...", tag, rpointer - 1);
            }
            int i, j;

            switch (tag)
            {
            case SerializationCode.Null:
                return(null);

            case SerializationCode.ForeignRef:
                i = Int();
                j = Int();
                return(unit_map[i].bynum[j]);

            case SerializationCode.SelfRef:
                i = Int();
                return(unit.bynum[i]);

            case SerializationCode.NewUnitRef:
                return(LoadNewUnit());

            case SerializationCode.RuntimeUnit:
                return(RuntimeUnit.Thaw(this));

            case SerializationCode.SubInfo:
                return(SubInfo.Thaw(this));

            case SerializationCode.STable:
                return(STable.Thaw(this));

            case SerializationCode.StashEnt:
                return(StashEnt.Thaw(this));

            case SerializationCode.Rat:
                return(Rat.Thaw(this));

            case SerializationCode.FatRat:
                return(FatRat.Thaw(this));

            case SerializationCode.Complex:
                return(Complex.Thaw(this));

            case SerializationCode.BigInteger:
                return(BigInteger.Thaw(this));

            case SerializationCode.VarDeque:
                return(VarDeque.Thaw(this));

            case SerializationCode.VarHash:
                return(VarHash.Thaw(this));

            case SerializationCode.DispatchEnt:
                return(DispatchEnt.Thaw(this));

            //case SerializationCode.RxFrame:
            //    return RxFrame.Thaw(this);
            case SerializationCode.P6how:
                return(P6how.Thaw(this));

            case SerializationCode.CC:
                return(CC.Thaw(this));

            case SerializationCode.AltInfo:
                return(AltInfo.Thaw(this));

            case SerializationCode.Signature:
                return(Signature.Thaw(this));

            case SerializationCode.Parameter:
                return(Parameter.Thaw(this));

            case SerializationCode.ReflectObj:
                return(ReflectObj.Thaw(this));

            case SerializationCode.P6opaque:
                return(P6opaque.Thaw(this));

            case SerializationCode.Frame:
                return(Frame.Thaw(this));

            //Cursor,

            case SerializationCode.String:
                return(Register(String()));

            case SerializationCode.ArrP6any:
                return(RefsARegister <P6any>());

            case SerializationCode.ArrVariable:
                return(RefsARegister <Variable>());

            case SerializationCode.ArrString:
                return(RefsARegister <string>());

            case SerializationCode.ArrCC:
                return(RefsARegister <CC>());

            case SerializationCode.Boolean:
                return(Register(Byte() != 0));

            case SerializationCode.Int:
                return(Register(Int()));

            case SerializationCode.Double:
                return(Register(Double()));

            case SerializationCode.Type:
                return(Register(Type.GetType(String(), true)));

            case SerializationCode.SimpleVariable:
            case SerializationCode.SimpleVariable_1:
            case SerializationCode.SimpleVariable_2:
            case SerializationCode.SimpleVariable_3:
                return(SimpleVariable.Thaw(this,
                                           (int)tag - (int)SerializationCode.SimpleVariable));

            case SerializationCode.SubstrLValue:
                return(SubstrLValue.Thaw(this));

            case SerializationCode.TiedVariable:
                return(TiedVariable.Thaw(this));

            case SerializationCode.SubViviHook:
                return(SubViviHook.Thaw(this));

            case SerializationCode.ArrayViviHook:
                return(ArrayViviHook.Thaw(this));

            case SerializationCode.NewArrayViviHook:
                return(NewArrayViviHook.Thaw(this));

            case SerializationCode.HashViviHook:
                return(HashViviHook.Thaw(this));

            case SerializationCode.NewHashViviHook:
                return(NewHashViviHook.Thaw(this));

            case SerializationCode.LADNone:
                return(Register(new LADNone()));

            case SerializationCode.LADNull:
                return(Register(new LADNull()));

            case SerializationCode.LADDot:
                return(Register(new LADDot()));

            case SerializationCode.LADDispatcher:
                return(Register(new LADDispatcher()));

            case SerializationCode.LADImp:
                return(Register(new LADImp()));

            case SerializationCode.LADStr:
                return(LADStr.Thaw(this));

            case SerializationCode.LADStrNoCase:
                return(LADStrNoCase.Thaw(this));

            case SerializationCode.LADMethod:
                return(LADMethod.Thaw(this));

            case SerializationCode.LADParam:
                return(LADParam.Thaw(this));

            case SerializationCode.LADQuant:
                return(LADQuant.Thaw(this));

            case SerializationCode.LADSequence:
                return(LADSequence.Thaw(this));

            case SerializationCode.LADAny:
                return(LADAny.Thaw(this));

            case SerializationCode.LADCC:
                return(LADCC.Thaw(this));

            default:
                throw new ThawException("unexpected object tag " + tag);
            }
        }
예제 #2
0
파일: Cursor.cs 프로젝트: nbrown/niecza
 internal static LADMethod Thaw(ThawBuffer tb)
 {
     LADMethod n = new LADMethod();
     tb.Register(n);
     n.name = tb.String();
     return n;
 }