tools/pas2c.hs
changeset 6399 a904c735979c
parent 6391 bd5851ab3157
child 6417 eae5900fd8a4
--- a/tools/pas2c.hs	Sat Nov 19 19:30:20 2011 +0300
+++ b/tools/pas2c.hs	Sat Nov 19 22:38:31 2011 +0300
@@ -34,10 +34,14 @@
 tvar2C :: TypeVarDeclaration -> Doc
 tvar2C (FunctionDeclaration (Identifier name) returnType Nothing) = 
     type2C returnType <+> text (name ++ "();")
-tvar2C (FunctionDeclaration (Identifier name) returnType (Just phrase)) = 
+tvar2C (FunctionDeclaration (Identifier name) returnType (Just (tvars, phrase))) = 
     type2C returnType <+> text (name ++ "()") 
     $$
+    text "{" $+$ (nest 4 $ typesAndVars2C tvars)
+    $+$
     phrase2C phrase
+    $+$ 
+    text "}"
 tvar2C (TypeDeclaration (Identifier i) t) = text "type" <+> text i <+> type2C t <> text ";"
 tvar2C (VarDeclaration isConst (ids, t) mInitExpr) = 
     if isConst then text "const" else empty
@@ -66,7 +70,7 @@
 
 type2C :: TypeDecl -> Doc
 type2C UnknownType = text "void"
-type2C String = text "string"
+type2C (String l) = text $ "string" ++ show l
 type2C (SimpleType (Identifier i)) = text i
 type2C (PointerTo t) = type2C t <> text "*"
 type2C (RecordType tvs) = text "{" $+$ (nest 4 . vcat . map tvar2C $ tvs) $+$ text "}"