Пример #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);
        }