Example #1
0
        public virtual void DeclareVariable(string varname, bool isread)
        {
            CodeContainer rep;

            if (!m_localSymbolTable.Contains(varname))
            {
                if (isread)
                {
                    m_file.DeclareGlobalVariable(varname);
                }
                else
                {
                    rep = new CodeContainer(CodeBlockType.CB_CODEREPOSITORY, this);
                    m_localSymbolTable.Add(varname);

                    rep.AddCode("float " + varname + ";\n", CodeContextType.CC_NA);
                    CEmmitableCodeContainer compoundst = GetChild(CodeContextType.CC_FUNCTIONDEFINITION_BODY);
                    compoundst.AddCode(rep, CodeContextType.CC_COMPOUNDSTATEMENT_DECLARATIONS);
                }
            }
        }
Example #2
0
        public override void DeclareVariable(string varname, bool isread)
        {
            CCFile file = M_Parent as CCFile;

            file.DeclareGlobalVariable(varname);
        }