Exemplo n.º 1
0
    public IDPacket LOGICAL_NOT(IDPacket OP1)
    {
        bool op1;

        TryGetBoolean(OP1, out op1);
        Debug("Operation OR, op1: " + op1);
        IDPacket RES = IDPacket.CreateSystemPacket("NOTOP", IdentityType.Boolean);

        PutBoolean(RES, !op1);
        return(RES);
    }
Exemplo n.º 2
0
    //string
    public IDPacket STR_CONCAT(IDPacket OP1, IDPacket OP2)
    {
        string op1, op2;

        TryGetText(OP1, out op1);
        TryGetText(OP2, out op2);
        Debug("Operation +, op1: " + op1 + ", " + op2);
        IDPacket RES = IDPacket.CreateSystemPacket("CONCATOP", IdentityType.Text);

        PutText(RES, op1 + op2);
        return(RES);
    }
Exemplo n.º 3
0
    IDPacket MATH_MOD(IDPacket OP1, IDPacket OP2)
    {
        double op1, op2;

        TryGetNumber(OP1, out op1);
        TryGetNumber(OP2, out op2);
        Debug("Operation %, op1: " + op1 + ", " + op2);
        IDPacket RES = IDPacket.CreateSystemPacket("%OP", IdentityType.Number);

        PutNumber(RES, op1 % op2);
        return(RES);
    }
Exemplo n.º 4
0
    IDPacket COMP_LT(IDPacket OP1, IDPacket OP2)
    {
        double op1, op2;

        TryGetNumber(OP1, out op1);
        TryGetNumber(OP2, out op2);
        Debug("Operation <, op1: " + op1 + ", " + op2);
        IDPacket RES = IDPacket.CreateSystemPacket("<OP", IdentityType.Boolean);

        PutBoolean(RES, op1 < op2);
        return(RES);
    }
Exemplo n.º 5
0
    IDPacket LOGICAL_OR(IDPacket OP1, IDPacket OP2)
    {
        bool op1, op2;

        TryGetBoolean(OP1, out op1);
        TryGetBoolean(OP2, out op2);
        Debug("Operation OR, op1: " + op1 + ", " + op2);
        IDPacket RES = IDPacket.CreateSystemPacket("OROP", IdentityType.Boolean);

        PutBoolean(RES, op1 || op2);
        return(RES);
    }
Exemplo n.º 6
0
    public IDPacket COMP_EQ(IDPacket OP1, IDPacket OP2)
    {
        IDPacket RES = null;
        bool     VAL = false;

        if (OP1.Type == IdentityType.Number)
        {
            double op1, op2;
            TryGetNumber(OP1, out op1);
            TryGetNumber(OP2, out op2);
            Debug("Operation(Number) ==, op1: " + op1 + ", " + op2);
            RES = IDPacket.CreateSystemPacket("==OP", IdentityType.Boolean);
            VAL = op1 == op2;
        }
        else if (OP1.Type == IdentityType.Boolean)
        {
            double op1, op2;
            TryGetNumber(OP1, out op1);
            TryGetNumber(OP2, out op2);
            Debug("Operation(Boolean) ==, op1: " + op1 + ", " + op2);
            RES = IDPacket.CreateSystemPacket("==OP", IdentityType.Boolean);
            VAL = op1 == op2;
        }
        else if (OP1.Type == IdentityType.Text)
        {
            string op1, op2;
            TryGetText(OP1, out op1);
            TryGetText(OP2, out op2);
            Debug("Operation(Text) ==, op1: " + op1 + ", " + op2);
            RES = IDPacket.CreateSystemPacket("==OP", IdentityType.Boolean);
            VAL = op1 == op2;
        }
        else
        {
            Error("Comparing incompatible types");
            return(null);
        }
        PutBoolean(RES, VAL);
        return(RES);
    }