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.62/format.sml
ViewVC logotype

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

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

sml/trunk/src/cm/pgraph/format.sml revision 975, Wed Oct 31 20:22:44 2001 UTC pgraph/trunk/format.sml revision 2175, Fri Nov 3 16:47:39 2006 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 tons P.SGN = "sgn"
31            | rhs (P.SYMS syms) = cfc ("SYMS", [varlist syms])            | tons P.STR = "str"
32            | rhs (P.IMPORT { lib, syms }) = cfc ("IMPORT", [lib, syms])            | tons P.FCT = "fct"
33            | rhs (P.COMPILE { src, env, syms, native }) =  
34              cfc (if native then "NCOMPILE" else "COMPILE",          fun rhs (P.SYM (ns, n)) = cfc (tons ns, [tos n])
35              | rhs (P.SYMS syms) = cfc ("syms", [varlist syms])
36              | rhs (P.IMPORT { lib, syms }) = cfc ("import", [lib, syms])
37              | rhs (P.COMPILE { src = (src, native), env, syms }) =
38                cfc (if native then "ncompile" else "compile",
39                   [tos src, env, syms])                   [tos src, env, syms])
40            | rhs (P.FILTER { env, syms }) = cfc ("FILTER", [env, syms])            | rhs (P.FILTER { env, syms }) = cfc ("filter", [env, syms])
41            | rhs (P.MERGE l) = cfc ("MERGE", [varlist l])            | rhs (P.MERGE l) = cfc ("merge", [varlist l])
42    
43          fun dodef (P.DEF d) =          fun dodef (P.DEF d) =
44              (out ["       val (C, ", #lhs d, ") = "]; rhs (#rhs d); out ["\n"])              (out ["       val (", context, ", ", #lhs d, ") = "];
45                 rhs (#rhs d);
46                 out ["\n"])
47      in      in
48          out ["val thelibrary = fn ", context, " => (\n"];          out ["val thelibrary = fn ", context, " => (\n"];
49          out ["fn ", varlist imports, " => let\n"];          out ["fn ", varlist imports, " => let open PGOps\n"];
50          app dodef defs;          app dodef defs;
51          out ["   in\n       EXPORT ", context, " ", export,          out ["   in\n       export ", context, " ", export,
52               "\n   end\n\               "\n   end\n\
53               \ | _ => raise Fail \"wrong number of input libraries\")\n"]               \ | _ => raise Fail \"wrong number of input libraries\")\n"]
54      end      end

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

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