Fixed the C++ backends so that it continues to declare timer variables, even though the C backend doesn't any more

This commit is contained in:
Neil Brown 2008-03-09 12:48:26 +00:00
parent ba75f5b06c
commit c733ac2cff
2 changed files with 11 additions and 2 deletions

View File

@ -17,7 +17,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
-} -}
-- | Generate C code from the mangled AST. -- | Generate C code from the mangled AST.
module GenerateC (cgenOps, cgenType, cintroduceSpec, cPreReq, genComma, genCPasses, generate, generateC, genLeftB, genMeta, genName, genRightB, indexOfFreeDimensions, seqComma, withIf ) where module GenerateC (cgenOps, cgenDeclaration, cgenType, cintroduceSpec, cPreReq, genComma, genCPasses, generate, generateC, genLeftB, genMeta, genName, genRightB, indexOfFreeDimensions, seqComma, withIf ) where
import Data.Char import Data.Char
import Data.Generics import Data.Generics

View File

@ -39,7 +39,7 @@ import System.IO
import qualified AST as A import qualified AST as A
import CompState import CompState
import GenerateC (cgenOps, cintroduceSpec, cgenType, generate, genComma, genLeftB, genMeta, genName, genRightB, indexOfFreeDimensions, seqComma, withIf) import GenerateC (cgenDeclaration, cgenOps, cintroduceSpec, cgenType, generate, genComma, genLeftB, genMeta, genName, genRightB, indexOfFreeDimensions, seqComma, withIf)
import GenerateCBased import GenerateCBased
import Metadata import Metadata
import Pass import Pass
@ -60,6 +60,7 @@ cppgenOps = cgenOps {
genAllocMobile = cppgenAllocMobile, genAllocMobile = cppgenAllocMobile,
genAlt = cppgenAlt, genAlt = cppgenAlt,
genClearMobile = cppgenClearMobile, genClearMobile = cppgenClearMobile,
genDeclaration = cppgenDeclaration,
genDirectedVariable = cppgenDirectedVariable, genDirectedVariable = cppgenDirectedVariable,
genForwardDeclaration = cppgenForwardDeclaration, genForwardDeclaration = cppgenForwardDeclaration,
genGetTime = cppgenGetTime, genGetTime = cppgenGetTime,
@ -472,6 +473,14 @@ cppgenProcCall n as
call genActuals as call genActuals as
tell [");"] tell [");"]
cppgenDeclaration :: A.Type -> A.Name -> Bool -> CGen ()
cppgenDeclaration A.Timer n _
= do call genType A.Timer
tell [" "]
genName n
tell [";"]
cppgenDeclaration t n b = cgenDeclaration t n b
-- | Changed because we initialise channels and arrays differently in C++ -- | Changed because we initialise channels and arrays differently in C++
cppdeclareInit :: Meta -> A.Type -> A.Variable -> Maybe (CGen ()) cppdeclareInit :: Meta -> A.Type -> A.Variable -> Maybe (CGen ())
cppdeclareInit m t@(A.Array ds t') var cppdeclareInit m t@(A.Array ds t') var