tools/pas2c/Pas2C.hs
branchwebgl
changeset 9954 bf51bc7e2808
parent 8446 c18ba8726f5a
child 9964 12b0ed9910cd
equal deleted inserted replaced
9952:32f5982604f4 9954:bf51bc7e2808
   654 initExpr2C' (InitChar a) = return $ quotes $ text "\\x" <> text (showHex (read a) "")
   654 initExpr2C' (InitChar a) = return $ quotes $ text "\\x" <> text (showHex (read a) "")
   655 initExpr2C' (InitReference i) = id2C IOLookup i
   655 initExpr2C' (InitReference i) = id2C IOLookup i
   656 initExpr2C' (InitRecord fields) = do
   656 initExpr2C' (InitRecord fields) = do
   657     (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields
   657     (fs :: [Doc]) <- mapM (\(Identifier a _, b) -> liftM (text "." <> text a <+> equals <+>) $ initExpr2C b) fields
   658     return $ lbrace $+$ (nest 4 . vcat . punctuate comma $ fs) $+$ rbrace
   658     return $ lbrace $+$ (nest 4 . vcat . punctuate comma $ fs) $+$ rbrace
   659 initExpr2C' (InitArray [value]) = initExpr2C value
   659 --initExpr2C' (InitArray [InitRecord fields]) = do
       
   660 --    e <- initExpr2C $ InitRecord fields
       
   661 --    return $ braces $ e
   660 initExpr2C' r@(InitRange (Range i@(Identifier i' _))) = do
   662 initExpr2C' r@(InitRange (Range i@(Identifier i' _))) = do
   661     id2C IOLookup i
   663     id2C IOLookup i
   662     t <- gets lastType
   664     t <- gets lastType
   663     case t of
   665     case t of
   664          BTEnum s -> return . int $ length s
   666          BTEnum s -> return . int $ length s