1val _ = PolyML.Compiler.prompt1:="";
2val _ = PolyML.Compiler.prompt2:="";
3val _ = PolyML.print_depth 0;
4val origdir = OS.FileSys.getDir();
5OS.FileSys.chDir "../../../tools-poly";
6val _ = use "poly/poly-init.ML";
7OS.FileSys.chDir origdir;
8
9structure BasicIO = SML90;
10exception Interrupt = SML90.Interrupt
11
12fun useC f = (use ("../" ^ f ^ ".sig"); use ("../" ^ f ^ ".sml"))
13
14fun useS f = use ("../" ^ f ^ ".sml")
15
16val _ = use "../Systeml.sig"
17val _ = use "../../../tools-poly/Holmake/Systeml.sml";
18
19val _ = use "../hmcore.ML";
20
21val _ = useC "tailbuffer";
22val _ = useC "GetOpt";
23val _ = useS "FunctionalRecordUpdate";
24val _ = useC "HM_Core_Cline";
25val _ = useC "HM_DepGraph";
26val _ = useC "HM_GraphBuildJ1";
27val _ = useC "poly/HM_Cline";
28val _ = useC "poly/HM_BaseEnv";
29val _ = use  "../BuildCommand.sig";
30val _ = useC "poly/ProcessMultiplexor";
31val _ = useC "poly/MB_Monitor";
32val _ = useS "poly/multibuild";
33val _ = useS "poly/BuildCommand";
34val _ = useS "Holmake";
35
36val die_with = Holmake.die_with
37
38fun printPosn (l,pos) = Int.toString l ^ ":" ^ Int.toString pos
39
40fun main() =
41  Holmake.main()
42  handle SML90.Interrupt => die_with "Holmake interrupted"
43       | e =>
44         let
45           val msgpfx = "Holmake failed with exception: "^ exnMessage e
46         in
47           case PolyML.Exception.exceptionLocation e of
48               SOME {file,startLine,startPosition,endLine,endPosition} =>
49               let
50               in
51                 die_with (msgpfx ^ "\nRaised from: "^
52                           file ^ ": " ^ printPosn(startLine, startPosition) ^
53                           " - " ^ printPosn(endLine, endPosition))
54               end
55             | NONE => die_with (msgpfx ^ "\nRaised from unknown location")
56         end
57