tools/pas2c/Pas2C.hs
changeset 14235 3a9e4f35aa68
parent 14234 27ae2d3d04b6
child 14236 0f8b647ea317
equal deleted inserted replaced
14234:27ae2d3d04b6 14235:3a9e4f35aa68
   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 r2' <> brackets r1'
       
   783     type2C' (ArrayDecl (Just r) t) = do
   777     type2C' (ArrayDecl (Just r) t) = do
   784         t' <- type2C t
   778         t' <- type2C t
   785         lt <- gets lastType
   779         lt <- gets lastType
   786         ft <- case lt of
   780         ft <- case lt of
   787                 -- BTFunction {} -> type2C (PointerTo t)
   781                 -- BTFunction {} -> type2C (PointerTo t)