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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/ml-burg/main.sml
ViewVC logotype

Annotation of /sml/trunk/src/ml-burg/main.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 249 (* main.sml
2 :     *
3 :     * COPYRIGHT (c) 1994 AT&T Bell Laboratories.
4 :     *
5 :     * $Log$
6 : monnier 651 * Revision 1.3 2000/06/01 18:33:42 monnier
7 :     * bring revisions from the vendor branch to the trunk
8 :     *
9 : blume 568 * Revision 1.2 2000/03/07 03:59:09 blume
10 :     * build script now uses new mechanism for building stanalone programs
11 :     *
12 :     * Revision 1.1.1.8.4.1 2000/02/20 14:44:33 blume
13 :     * CMB.deliver merged with CMB.make; runtime boot code made more flexible
14 :     *
15 : monnier 249 * Revision 1.1.1.8 1999/04/17 18:56:04 monnier
16 :     * version 110.16
17 :     *
18 :     * Revision 1.1.1.1 1997/01/14 01:37:59 george
19 :     * Version 109.24
20 :     *
21 :     * Revision 1.1.1.2 1997/01/11 18:52:31 george
22 :     * ml-burg Version 109.24
23 :     *
24 :     * Revision 1.3 1996/02/26 16:55:12 jhr
25 :     * Moved exportFn/exportML to SMLofNJ structure.
26 :     *
27 :     * Revision 1.2 1996/02/26 15:02:06 george
28 :     * print no longer overloaded.
29 :     * use of makestring has been removed and replaced with Int.toString ..
30 :     * use of IO replaced with TextIO
31 :     *
32 :     * Revision 1.1.1.1 1996/01/31 16:01:25 george
33 :     * Version 109
34 :     *
35 :     *)
36 : blume 568 structure Main = struct
37 : monnier 249
38 :     fun main (cmdName, argv) = let
39 :     fun help () = (
40 :     TextIO.output (TextIO.stdErr, "usage: mlburg [<filename>.burg]\n");
41 :     OS.Process.failure)
42 :     in
43 :     case argv
44 :     of [] => (
45 :     BurgEmit.emit (TextIO.stdIn, (fn () => TextIO.stdOut));
46 :     OS.Process.success)
47 :     | ("-h"::_) => help ()
48 :     | ("-help"::_) => help ()
49 :     | files => let
50 :     fun findname file = let
51 :     val {base, ext} = OS.Path.splitBaseExt file
52 :     in
53 :     case ext
54 :     of (SOME("brg" | "burg")) =>
55 :     OS.Path.joinBaseExt{base=base, ext=SOME "sml"}
56 :     | _ => file ^ ".sml"
57 :     (* end case *)
58 :     end
59 :     val names = map (fn n => (n,findname n)) files
60 :     fun emit (inname, outname) = (let
61 :     val s_in = TextIO.openIn inname
62 :     in
63 :     BurgEmit.emit (s_in, (fn () => (TextIO.openOut outname)))
64 :     end)
65 :     handle err => (TextIO.output (TextIO.stdErr, exnMessage err^"\n");
66 :     raise err)
67 :     in
68 :     app emit names;
69 :     OS.Process.success
70 :     end
71 :     end
72 :    
73 :     (*
74 :     * This is the function to call in an interactive session.
75 :     * Takes a filename (something.burg) as argument, and produces something.sml
76 :     *)
77 :     fun doit s = main ("", [s])
78 : blume 568 end

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