Esempio n. 1
0
        bool assignGlobalAddress(Variable var)
        {
            int tempAddress = 0;

            if (var.isConstant())
            {
                switch (var.getType())
                {
                case Parser._CTE_F:
                    tempAddress = addressManager.getConstFloatAddress();
                    break;

                case Parser._CTE_I:
                    tempAddress = addressManager.getConstIntAddress();
                    break;

                case Parser._CTE_S:
                    tempAddress = addressManager.getConstStringAddress();
                    break;

                default:
                    var.setAddress(OperationTypes.TYPE_UNDEFINED);
                    return(false);
                }
            }
            else
            {
                switch (var.getType())
                {
                case Parser._CTE_I:
                    tempAddress = addressManager.getGlobalIntVarAddress();
                    break;

                case Parser._CTE_F:
                    tempAddress = addressManager.getGlobalFloatVarAddress();
                    break;

                case Parser._CTE_S:
                    tempAddress = addressManager.getGlobalStringVarAddress();
                    break;

                case Parser._Int:
                    tempAddress = addressManager.getGlobalIntVarAddress();
                    break;

                case Parser._Float:
                    tempAddress = addressManager.getGlobalFloatVarAddress();
                    break;

                case Parser._Bool:
                    tempAddress = addressManager.getGlobalBoolVarAddress();
                    break;

                case Parser._String:
                    tempAddress = addressManager.getGlobalStringVarAddress();
                    break;

                default:
                    return(false);
                }
            }



            var.setAddress(tempAddress);
            return(true);
        }
Esempio n. 2
0
        public bool assignlocalAddress(Variable var)
        {
            int tempAddress = 0;

            if (var.isParsed())
            {
                switch (var.getType())
                {
                case OperationTypes.TYPE_BOOL:
                    tempAddress = addressManager.getBoolAddress();
                    break;

                case OperationTypes.TYPE_FLOAT:
                    tempAddress = addressManager.getFloatAddress();
                    break;

                case OperationTypes.TYPE_INT:
                    tempAddress = addressManager.getIntAddress();
                    break;

                case OperationTypes.TYPE_STRING:
                    tempAddress = addressManager.getStringAddress();
                    break;

                default:

                    var.setAddress(OperationTypes.TYPE_UNDEFINED);
                    return(false);
                }
            }
            else
            {
                switch (var.getType())
                {
                case Parser._CTE_I:
                    tempAddress = addressManager.getConstIntAddress();
                    break;

                case Parser._CTE_F:
                    tempAddress = addressManager.getConstFloatAddress();
                    break;

                case Parser._CTE_S:
                    tempAddress = addressManager.getConstStringAddress();
                    break;

                case Parser._Int:
                    tempAddress = addressManager.getIntAddress();
                    break;

                case Parser._Float:
                    tempAddress = addressManager.getFloatAddress();
                    break;

                case Parser._Bool:
                    tempAddress = addressManager.getBoolAddress();
                    break;

                case Parser._String:
                    tempAddress = addressManager.getStringAddress();
                    break;

                default:
                    var.setAddress(OperationTypes.TYPE_UNDEFINED);
                    return(false);
                }
            }


            var.setAddress(tempAddress);

            return(true);
        }