SCM Repository
View of /trunk/src/driver/main.sml
Parent Directory
|
Revision Log
Revision 33 -
(download)
(annotate)
Thu Feb 11 00:37:51 2010 UTC (10 years, 11 months ago) by jhr
File size: 1281 byte(s)
Thu Feb 11 00:37:51 2010 UTC (10 years, 11 months ago) by jhr
File size: 1281 byte(s)
New directory
(* main.sml * * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu) * All rights reserved. *) structure Main : sig val main : (string * string list) -> OS.Process.status end = struct fun err s = TextIO.output (TextIO.stdErr, s) fun err1 c = TextIO.output1 (TextIO.stdErr, c) fun errnl s = (err s; err1 #"\n") fun quit true = OS.Process.exit OS.Process.success | quit false = OS.Process.exit OS.Process.failure (* check for errors and report them if there are any *) fun checkForErrors errStrm = ( Error.report (TextIO.stdErr, errStrm); if Error.anyErrors errStrm then quit false else ()) fun doFile filename = let val errStrm = Error.mkErrStream filename val inS = TextIO.openIn filename in case Parser.parseFile (errStrm, inS) of NONE => quit false | SOME pt => checkForErrors errStrm (* end case *); TextIO.closeIn inS end fun main (name: string, args: string list) = (List.app doFile args; quit true) handle exn => ( err (concat [ "uncaught exception ", General.exnName exn, " [", General.exnMessage exn, "]\n"]); List.app (fn s => err (concat [" raised at ", s, "\n"])) (SMLofNJ.exnHistory exn); quit false) end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |