예제 #1
0
            public BoolOps CombineUnary(OpCode unary_op)
            {
                if (unary_op != OpCode.Not)
                {
                    throw new InvalidOperationException();
                }

                BoolOps res = new BoolOps();

                res.targets = targets;

                res.commands = new int[commands.Length + 1];
                commands.CopyTo(res.commands, 0);
                res.commands[commands.Length] = (int)unary_op;

                return(res);
            }
예제 #2
0
            public BoolOps CombineBinary(OpCode op, BoolOps right)
            {
                if (op == OpCode.Not)
                {
                    throw new InvalidOperationException();
                }

                Hashtable targmap = new Hashtable();
                ArrayList targlist = new ArrayList();
                int       targindex = 0;
                int       lclen = commands.Length, rclen = right.commands.Length;
                BoolOps   res = new BoolOps();

                int idx = 0;

                res.commands = new int[lclen + rclen + 1];

                for (int i = 0; i < lclen; i++)
                {
                    if (commands[i] < 0)
                    {
                        res.commands[idx++] = commands[i];
                        continue;
                    }

                    string targ = targets[commands[i]];

                    if (targmap.Contains(targ))
                    {
                        res.commands[idx++] = (int)targmap[targ];
                    }
                    else
                    {
                        targmap[targ] = targindex;
                        targlist.Add(targ);
                        res.commands[idx++] = targindex++;
                    }
                }

                for (int i = 0; i < rclen; i++)
                {
                    if (right.commands[i] < 0)
                    {
                        res.commands[idx++] = right.commands[i];
                        continue;
                    }

                    string targ = right.targets[right.commands[i]];

                    if (targmap.Contains(targ))
                    {
                        res.commands[idx++] = (int)targmap[targ];
                    }
                    else
                    {
                        targmap[targ] = targindex;
                        targlist.Add(targ);
                        res.commands[idx++] = targindex++;
                    }
                }

                res.commands[idx] = (int)op;

                res.targets = new string[targlist.Count];
                targlist.CopyTo(res.targets);

                return(res);
            }
예제 #3
0
 void DecodeBoolOps(BoolOps ops)
 {
     ops.DecodeInto(cur_constructed.tb, log);
 }
예제 #4
0
	    public BoolOps CombineBinary (OpCode op, BoolOps right)
	    {
		if (op == OpCode.Not)
		    throw new InvalidOperationException ();

		Hashtable targmap = new Hashtable ();
		ArrayList targlist = new ArrayList ();
		int targindex = 0;
		int lclen = commands.Length, rclen = right.commands.Length;
		BoolOps res = new BoolOps ();

		int idx = 0;
		res.commands = new int[lclen + rclen + 1];

		for (int i = 0; i < lclen; i++) {
		    if (commands[i] < 0) {
			res.commands[idx++] = commands[i];
			continue;
		    }

		    string targ = targets[commands[i]];

		    if (targmap.Contains (targ))
			res.commands[idx++] = (int) targmap[targ];
		    else {
			targmap[targ] = targindex;
			targlist.Add (targ);
			res.commands[idx++] = targindex++;
		    }
		}
		
		for (int i = 0; i < rclen; i++) {
		    if (right.commands[i] < 0) {
			res.commands[idx++] = right.commands[i];
			continue;
		    }
		    
		    string targ = right.targets[right.commands[i]];
		    
		    if (targmap.Contains (targ))
			res.commands[idx++] = (int) targmap[targ];
		    else {
			targmap[targ] = targindex;
			targlist.Add (targ);
			res.commands[idx++] = targindex++;
		    }
		}
		
		res.commands[idx] = (int) op;
		
		res.targets = new string[targlist.Count];
		targlist.CopyTo (res.targets);
		
		return res;
	    }
예제 #5
0
	    public BoolOps CombineUnary (OpCode unary_op)
	    {
		if (unary_op != OpCode.Not)
		    throw new InvalidOperationException ();

		BoolOps res = new BoolOps ();
		res.targets = targets;

		res.commands = new int[commands.Length + 1];
		commands.CopyTo (res.commands, 0);
		res.commands[commands.Length] = (int) unary_op;

		return res;
	    }
예제 #6
0
	void DecodeBoolOps (BoolOps ops)
	{
	    ops.DecodeInto (cur_constructed.tb, log);
	}