示例#1
0
        public Variable(Kind kind, Purpose purpose, Common.MemoryRegionSize memory_region_size = Common.MemoryRegionSize.Integer, int?min_value = null, int?max_value = null)
        {
            _ID = new IDManager();
            switch (purpose)
            {
            case Purpose.Original:
                name = string.Concat("v_", ID);
                break;

            case Purpose.Temporary:
                name = string.Concat("t_", ID);
                break;

            case Purpose.Fake:
                name = string.Concat("f_", ID);
                break;

            case Purpose.ConstRecalculation:
                name = string.Concat("c_", ID);
                break;

            case Purpose.Parameter:
                name = string.Concat("p_", ID);
                break;

            default:
                throw new ObjectException("Unsupported Variable.Purpose value.");
            }
            memoryRegionSize = Convert.ToInt32(memory_region_size);
            pointer          = false;
            fake             = true;
            fixedMin         = min_value;
            fixedMax         = max_value;
            this.kind        = kind;
        }
示例#2
0
        /// <summary>
        /// Creates a new fake local variable and adds it to the function
        /// </summary>
        /// <param name="purpose">Purpose of creation (choose from enumeration)</param>
        /// <param name="MemoryRegionSize">Memory region size; 4 bytes for integer</param>
        /// <returns>The created variable</returns>
        public Variable NewLocalVariable(Variable.Purpose purpose, Common.MemoryRegionSize size)
        {
            Variable var = new Variable(Variable.Kind.Local, purpose, size);

            LocalVariables.Add(var);
            return(var);
        }