tools/pas2c/Pas2C.hs
changeset 14236 0f8b647ea317
parent 14235 3a9e4f35aa68
child 14237 81fba21495a5
equal deleted inserted replaced
14235:3a9e4f35aa68 14236:0f8b647ea317
   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'
   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)