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 /ml-burg/releases/release-110.67/main.sml
ViewVC logotype

Annotation of /ml-burg/releases/release-110.67/main.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2866 - (view) (download)

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

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