tools/pas2c/Pas2C.hs
changeset 14228 b01770d42517
parent 13887 5988e73080a3
child 14234 27ae2d3d04b6
equal deleted inserted replaced
14227:1d678dee55d1 14228:b01770d42517
   772         is <- mapM (id2C IOInsert . setBaseType bt) ids
   772         is <- mapM (id2C IOInsert . setBaseType bt) ids
   773         return (text "enum" <+> (braces . vcat . punctuate comma . map (\(a, b) -> a <+> equals <+> text "0x" <> text (showHex b "")) $ zip is [0..]) <+>)
   773         return (text "enum" <+> (braces . vcat . punctuate comma . map (\(a, b) -> a <+> equals <+> text "0x" <> text (showHex b "")) $ zip is [0..]) <+>)
   774         where
   774         where
   775             bt = BTEnum $ map (\(Identifier i _) -> map toLower i) ids
   775             bt = BTEnum $ map (\(Identifier i _) -> map toLower i) ids
   776     type2C' (ArrayDecl Nothing t) = type2C (PointerTo t)
   776     type2C' (ArrayDecl Nothing t) = type2C (PointerTo t)
       
   777     type2C' (ArrayDecl (Just r1) (ArrayDecl (Just r2) t)) = do
       
   778         t' <- type2C t
       
   779         lt <- gets lastType
       
   780         r1' <- initExpr2C (InitRange r1)
       
   781         r2' <- initExpr2C (InitRange r2)
       
   782         return $ \i -> t' i <> brackets r1' <> brackets r2'
   777     type2C' (ArrayDecl (Just r) t) = do
   783     type2C' (ArrayDecl (Just r) t) = do
   778         t' <- type2C t
   784         t' <- type2C t
   779         lt <- gets lastType
   785         lt <- gets lastType
   780         ft <- case lt of
   786         ft <- case lt of
   781                 -- BTFunction {} -> type2C (PointerTo t)
   787                 -- BTFunction {} -> type2C (PointerTo t)