Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /pgraph/releases/release-110.66/format.sml
ViewVC logotype

Diff of /pgraph/releases/release-110.66/format.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 975, Wed Oct 31 20:22:44 2001 UTC revision 977, Wed Nov 14 16:53:16 2001 UTC
# Line 13  Line 13 
13      structure P = PortableGraph      structure P = PortableGraph
14    
15      fun output (P.GRAPH { imports, defs, export }, outs) = let      fun output (P.GRAPH { imports, defs, export }, outs) = let
16          val context = "C"          val context = "c"
17          fun out l = app (fn x => TextIO.output (outs, x)) l          fun out l = app (fn x => TextIO.output (outs, x)) l
18    
19          fun varlist [] = "[]"          fun varlist [] = "[]"
# Line 27  Line 27 
27    
28          fun tos s = concat ["\"", String.toString s, "\""]          fun tos s = concat ["\"", String.toString s, "\""]
29    
30          fun rhs (P.SYM (ns, n)) = cfc ("SYM", [tos ns, tos n])          fun rhs (P.SYM (ns, n)) = cfc ("sym", [tos ns, tos n])
31            | rhs (P.SYMS syms) = cfc ("SYMS", [varlist syms])            | rhs (P.SYMS syms) = cfc ("syms", [varlist syms])
32            | rhs (P.IMPORT { lib, syms }) = cfc ("IMPORT", [lib, syms])            | rhs (P.IMPORT { lib, syms }) = cfc ("import", [lib, syms])
33            | rhs (P.COMPILE { src, env, syms, native }) =            | rhs (P.COMPILE { src = (src, native), env, syms }) =
34              cfc (if native then "NCOMPILE" else "COMPILE",              cfc (if native then "ncompile" else "compile",
35                   [tos src, env, syms])                   [tos src, env, syms])
36            | rhs (P.FILTER { env, syms }) = cfc ("FILTER", [env, syms])            | rhs (P.FILTER { env, syms }) = cfc ("filter", [env, syms])
37            | rhs (P.MERGE l) = cfc ("MERGE", [varlist l])            | rhs (P.MERGE l) = cfc ("merge", [varlist l])
38    
39          fun dodef (P.DEF d) =          fun dodef (P.DEF d) =
40              (out ["       val (C, ", #lhs d, ") = "]; rhs (#rhs d); out ["\n"])              (out ["       val (", context, ", ", #lhs d, ") = "];
41                 rhs (#rhs d);
42                 out ["\n"])
43      in      in
44          out ["val thelibrary = fn ", context, " => (\n"];          out ["val thelibrary = fn ", context, " => (\n"];
45          out ["fn ", varlist imports, " => let\n"];          out ["fn ", varlist imports, " => let\n"];
46          app dodef defs;          app dodef defs;
47          out ["   in\n       EXPORT ", context, " ", export,          out ["   in\n       export ", context, " ", export,
48               "\n   end\n\               "\n   end\n\
49               \ | _ => raise Fail \"wrong number of input libraries\")\n"]               \ | _ => raise Fail \"wrong number of input libraries\")\n"]
50      end      end

Legend:
Removed from v.975  
changed lines
  Added in v.977

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0