diff options
Diffstat (limited to 'ppc.fun')
-rw-r--r-- | ppc.fun | 34 |
1 files changed, 16 insertions, 18 deletions
@@ -42,7 +42,7 @@ struct val PlayersU = fn z => let fun PlayersU (out, ((macroName, pos) :: layers)) = - Printf out `"\tfrom " `macroName `" at " T.S.Ppos pos `"\n" + Printf out F `"\tfrom " `macroName `" at " T.S.Ppos pos `"\n" A1 PlayersU layers % | PlayersU (_, []) = () in @@ -50,7 +50,7 @@ struct end z fun warningLow (TkPos (pos, layers)) msg f g = - printf `"\n" T.S.Ppos pos `":" `msg `": " + printf F T.S.Ppos pos `":" `msg `": " (fn (a, _) => g (a, fn (_, out) => (Printf out `"\n" PlayersU layers %; f ()))) @@ -77,7 +77,7 @@ struct | Pcls (out, cl :: cls) = Printf out A1 Pcl cl `", " A1 Pcls cls % in - printf `"\n" T.S.Ppos pos `":error: expected " A1 Pcls cls `"\n" + printf F T.S.Ppos pos `":error: expected " A1 Pcls cls `"\n" PlayersU layers; exit 1 end @@ -165,7 +165,7 @@ struct end in if layers <> layers' orelse fname' <> fname orelse line' <> line then - Printf out `"\n" R off A0 Ppos % + Printf out F R off A0 Ppos % else (); Printf out I col' `":" T.Ptk tk `" "; @@ -178,7 +178,7 @@ struct let fun Players (out, x, y) = ignore $ PlayersCompact (out, x, y) in - Printf out `"\nexpanding (" A2 Players NONE (rev mLayers) + Printf out F `"expanding (" A2 Players NONE (rev mLayers) `") macro " `id % end in @@ -350,7 +350,7 @@ struct else printf Ign - val PDP = fn z => bind A0 (fn out => out "\n!!! ") z + val PDP = fn z => bind A0 (fn out => Printf out F `"!!! " %) z fun handleInclude (T.PpcInclude (dir, arg), pos) ppc = let @@ -386,7 +386,7 @@ struct else ( Printf out `" {"; Printf out PtokenL 1 body; - Printf out `"}" % + Printf out `"}\n" % ) fun parseDefineObjMacro ppc = @@ -514,7 +514,7 @@ struct SOME (_, pos', macro') => if not $ eqMacro (macro, macro') then ( warning (pos2tkPos pos) `macroName `" macro redefinition" %; - printf `"See " T.S.Ppos pos' % + printf F `"See " T.S.Ppos pos' % ) else () | NONE => (); @@ -543,7 +543,7 @@ struct val Pbody = fn z => let fun printBody (out, msg, body) = ( - Printf out `"\n" `msg `" {"; + Printf out F `msg `" {"; Printf out PtokenL 1 body; Printf out `"}\n" % ) @@ -662,7 +662,7 @@ struct print tail ) in - Printf out `"\n" `msg `" {\n"; + Printf out F `msg `" {\n"; print params; Printf out `"}\n" % end @@ -832,7 +832,6 @@ struct and handleIf (tk, ifPos) ppc = let - val dprintf = dprintf ppc `"\n" val (eval, getRevBody) = case tk of T.PpcIfdef => (ifdefEval true, getIfdefRevBody T.PpcIfdef) @@ -843,7 +842,7 @@ struct val (cond, ppc) = eval ifPos ppc val (revBody, ppc) = getRevBody ifPos cond ppc in - dprintf `" {" PtokenL 1 (rev revBody) `"}\n"; + dprintf ppc `" {" PtokenL 1 (rev revBody) `"}\n"; insertRevBody revBody ppc end @@ -854,7 +853,7 @@ struct val (_, _, ppc) = getClassNoexpand ppc [Ctk T.NewLine] val (prevVal, macros) = Tree.delete macroCompare (#macros ppc) id in - dprintf ppc `"\n#undef " `id %; + dprintf ppc PDP `"#undef " `id %; case prevVal of NONE => warning pos `"#undef: no macro with provided name was defined" % @@ -942,23 +941,22 @@ struct updatePpc P u#buffer (updateH head) % end - fun debugPrint' cache ppc = + fun debugPrint' (out, cache, ppc) = let val (tk, pos, ppc) = getToken ppc - val cache = printTokenCompact cache (output TextIO.stdOut) (tk, pos) + val cache = printTokenCompact cache out (tk, pos) in if tk = T.EOS then () else - debugPrint' cache ppc + Printf out A2 debugPrint' cache ppc % end fun debugPrint fname incDirs = let val ppc = create { fname, incDirs, debugMode = true } in - debugPrint' startCache ppc; - printf `"\n" % + printf A2 debugPrint' startCache ppc F % end fun getClass ppc clList = |