Example #1
0
    public static Variable temporize(Variable v, Frame fr, int mode)
    {
        int type = (mode & 1) != 0 ? LeaveHook.UNDO : LeaveHook.UNDO + LeaveHook.KEEP;
        if ((mode & 2) != 0) {
            fr.PushLeave(type, v.Fetch());
        }
        else if (v.islist) {
            fr.PushLeave(type, Kernel.RunInferior(v.Fetch().InvokeMethod(
                    Kernel.GetInferiorRoot(), "TEMP",
                    new Variable[] { v }, null)).Fetch());
        }
        else {
            Frame o = new Frame();
            o.lex0 = v;
            o.lex1 = v.Fetch();
            fr.PushLeave(type, Kernel.MakeSub(Kernel.TEMP_SI, o));
        }

        return v;
    }
Example #2
0
    public static Variable temporize(Constants c, Variable v, Frame fr, int mode)
    {
        int type = (mode & 1) != 0 ? LeaveHook.UNDO : LeaveHook.UNDO + LeaveHook.KEEP;
        if ((mode & 2) != 0) {
            fr.PushLeave(type, v.Fetch());
        }
        else if (v.List) {
            fr.PushLeave(type, InvokeMethod("TEMP", v).Fetch());
        }
        else {
            // this is quite dubious really, Frame and LexPad should be separated
            Frame o = new Frame(null, null, c.setting.TEMP_SI, null);
            o.lex0 = v;
            o.lex1 = v.Fetch();
            fr.PushLeave(type, Kernel.MakeSub(c.setting.TEMP_SI, o));
        }

        return v;
    }