64 |
str "(*"; pp(false, ty, optVar); str ")") |
str "(*"; pp(false, ty, optVar); str ")") |
65 |
| _ => (str "*"; pp(false, ty, optVar)) |
| _ => (str "*"; pp(false, ty, optVar)) |
66 |
(* end case *)) |
(* end case *)) |
67 |
| pp (isFirst, CL.T_Array(ty, n), optVar) = ( |
| pp (isFirst, CL.T_Array(ty, optN), optVar) = ( |
68 |
pp (isFirst, ty, optVar); |
pp (isFirst, ty, optVar); |
69 |
str "["; str(Int.toString n); str "]") |
case optN |
70 |
|
of NONE => str "[]" |
71 |
|
| SOME n => (str "["; str(Int.toString n); str "]") |
72 |
|
(* end case *)) |
73 |
| pp (isFirst, _, SOME x) = ( |
| pp (isFirst, _, SOME x) = ( |
74 |
if isFirst then sp() else (); |
if isFirst then sp() else (); |
75 |
str x) |
str x) |
82 |
of CL.D_Comment l => List.app ppComLn l |
of CL.D_Comment l => List.app ppComLn l |
83 |
| CL.D_Verbatim l => |
| CL.D_Verbatim l => |
84 |
List.app (fn s => (str s; PP.newline strm)) l |
List.app (fn s => (str s; PP.newline strm)) l |
85 |
| CL.D_Var(attrs, ty, x) => ( |
| CL.D_Var(attrs, ty, x, optInit) => ( |
86 |
inHBox (fn () => ( |
inHBox (fn () => ( |
87 |
ppList {pp=str, sep=sp, l = attrs}; |
ppList {pp=str, sep=sp, l = attrs}; |
88 |
if List.null attrs then () else sp(); |
if List.null attrs then () else sp(); |
89 |
ppTy (ty, SOME x); |
ppTy (ty, SOME x); |
90 |
|
case optInit |
91 |
|
of SOME init => (sp(); str "="; sp(); ppInit init) |
92 |
|
| NONE => () |
93 |
|
(* end case *); |
94 |
str ";")); |
str ";")); |
95 |
PP.newline strm) |
PP.newline strm) |
96 |
| CL.D_Func(attrs, ty, f, params, body) => ( |
| CL.D_Func(attrs, ty, f, params, body) => ( |
119 |
ppList {pp=str, sep=sp, l = attrs}; |
ppList {pp=str, sep=sp, l = attrs}; |
120 |
if List.null attrs then () else sp(); |
if List.null attrs then () else sp(); |
121 |
ppTy(ty, SOME(CL.varToString x))) |
ppTy(ty, SOME(CL.varToString x))) |
122 |
|
and ppInit init = (case init |
123 |
|
of CL.I_Exp e => ppExp e |
124 |
|
| CL.I_Struct fields => ( |
125 |
|
str "{"; |
126 |
|
PP.openHVBox strm indent; |
127 |
|
List.app (fn (lab, init) => ( |
128 |
|
PP.break strm; |
129 |
|
inHBox (fn () => ( |
130 |
|
str("." ^ lab); sp(); str "="; sp(); ppInit init; str ",")))) |
131 |
|
fields; |
132 |
|
PP.closeBox strm; |
133 |
|
str "}") |
134 |
|
| CL.I_Array elems => ( |
135 |
|
str "{"; |
136 |
|
PP.openHVBox strm indent; |
137 |
|
List.app (fn (i, init) => ( |
138 |
|
PP.break strm; |
139 |
|
inHBox (fn () => ( |
140 |
|
str(concat["[", Int.toString i, "]"]); sp(); str "="; sp(); |
141 |
|
ppInit init; str ",")))) |
142 |
|
elems; |
143 |
|
PP.closeBox strm; |
144 |
|
str "}") |
145 |
|
(* end case *)) |
146 |
and ppBlock stms = ( |
and ppBlock stms = ( |
147 |
str "{"; |
str "{"; |
148 |
PP.openVBox strm indent; |
PP.openVBox strm indent; |
219 |
end |
end |
220 |
| CL.E_Bool b => str(Bool.toString b) |
| CL.E_Bool b => str(Bool.toString b) |
221 |
| CL.E_Str s => str(concat["\"", String.toCString s, "\""]) |
| CL.E_Str s => str(concat["\"", String.toCString s, "\""]) |
222 |
|
| CL.E_Sizeof ty => (str "sizeof("; ppTy(ty, NONE); str ")") |
223 |
(* end case *)) |
(* end case *)) |
224 |
and ppArgs args = ( |
and ppArgs args = ( |
225 |
str "("; |
str "("; |