tools/pas2c.hs
changeset 7002 5d817ba976f7
parent 6980 07a710e22846
child 7019 333afe233886
equal deleted inserted replaced
7001:89488f5b99ca 7002:5d817ba976f7
   374     lt <- gets lastType
   374     lt <- gets lastType
   375     case (isConst, lt, ids, mInitExpr) of
   375     case (isConst, lt, ids, mInitExpr) of
   376          (True, BTInt, [i], Just _) -> do
   376          (True, BTInt, [i], Just _) -> do
   377              i' <- id2CTyped t i
   377              i' <- id2CTyped t i
   378              return [text "enum" <> braces (i' <+> ie)]
   378              return [text "enum" <> braces (i' <+> ie)]
       
   379          (True, BTFloat, [i], Just e) -> do
       
   380              i' <- id2CTyped t i
       
   381              ie <- initExpr2C e
       
   382              return [text "#define" <+> i' <+> parens ie <> text "\n"]
   379          _ -> liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids
   383          _ -> liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids
   380     where
   384     where
   381     initExpr Nothing = return $ empty
   385     initExpr Nothing = return $ empty
   382     initExpr (Just e) = liftM (text "=" <+>) (initExpr2C e)
   386     initExpr (Just e) = liftM (text "=" <+>) (initExpr2C e)
   383     
   387