summaryrefslogtreecommitdiff
path: root/Language/C
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2021-10-09 10:19:46 +0200
committerTom Smeding <tom@tomsmeding.com>2021-10-09 10:19:46 +0200
commit961b6fc01f9c2f0220070849d22b2a30ca031324 (patch)
tree4aad269afbe41c28684f2c028fb59d64a5935760 /Language/C
parentab75ec49d7248d5c908090f9ed7b234a0ff333d9 (diff)
Static C functions; clean up
Diffstat (limited to 'Language/C')
-rw-r--r--Language/C/Print.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Language/C/Print.hs b/Language/C/Print.hs
index cc511b2..5852601 100644
--- a/Language/C/Print.hs
+++ b/Language/C/Print.hs
@@ -14,15 +14,17 @@ printProgram :: Program -> PrintS
printProgram (Program defs) = intercalates "\n" (map printFunDef defs)
printFunDef :: FunDef -> PrintS
-printFunDef (FunDef rt n as (StExpr ss rete)) =
- printType rt % printString " " % printName n
+printFunDef (FunDef attrs rt n as (StExpr ss rete)) =
+ printString (if faStatic attrs then "static " else "")
+ % printType rt % printString " " % printName n
% printString "("
% intercalates ", " [printType t % printString " " % printName an | (t, an) <- as]
% printString ") {\n "
% addIndent 2 (intercalates "\n" (map printStmt ss))
% printString "\n return (" % printExpr rete % printString ");\n}\n"
-printFunDef (ProcDef n as ss) =
- printString "void " % printName n
+printFunDef (ProcDef attrs n as ss) =
+ printString (if faStatic attrs then "static " else "")
+ % printString "void " % printName n
% printString "("
% intercalates ", " [printType t % printString " " % printName an | (t, an) <- as]
% printString ") " % printBlock ss % printString "\n"