return $ Just (ty_id, Just $ Left ty_def)
(EnumType tycon dcs) -> do
let ty_id = mkVHDLExtId tycon
- let range = AST.SubTypeRange (AST.PrimLit "0") (AST.PrimLit $ show (length dcs))
+ let range = AST.SubTypeRange (AST.PrimLit "0") (AST.PrimLit $ show ((length dcs) - 1))
let ty_def = AST.TDI $ AST.IntegerTypeDef range
let enumShow = mkEnumShow dcs ty_id
MonadState.modify tsTypeFuns $ Map.insert (htype, showIdString) (showId, enumShow)
[AST.CaseSmAlt [AST.ChoiceE $ AST.PrimLit $ show x]
[AST.ReturnSm (Just $ ((genExprFCall showId) . (selectedName adtPar) $ mkVHDLBasicId conLbl) AST.:&: showFields x)] | x <- [0..(length conIds) -1]]
showFields i = if (null (elemIdss!!i)) then
- AST.PrimLit "''"
+ AST.PrimLit "nul"
else
foldr1 (\e1 e2 -> e1 AST.:&: e2) $
map ((AST.PrimLit "' '" AST.:&:) . (genExprFCall showId) . (selectedName adtPar))