Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 1999-2006, 2008 Henry Cejtin, Matthew Fluet, Suresh |
2 | * Jagannathan, and Stephen Weeks. | |
3 | * Copyright (C) 1997-2000 NEC Research Institute. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | *) | |
8 | ||
9 | structure SMLofNJ: SML_OF_NJ = | |
10 | struct | |
11 | structure Cont = | |
12 | struct | |
13 | structure C = MLton.Cont | |
14 | ||
15 | type 'a cont = 'a C.t | |
16 | val callcc = C.callcc | |
17 | val isolate = C.isolate | |
18 | fun throw k v = C.throw (k, v) | |
19 | end | |
20 | ||
21 | structure SysInfo = | |
22 | struct | |
23 | exception UNKNOWN | |
24 | datatype os_kind = BEOS | MACOS | OS2 | UNIX | WIN32 | |
25 | ||
26 | fun getHostArch () = | |
27 | MLton.Platform.Arch.toString MLton.Platform.Arch.host | |
28 | ||
29 | fun getOSKind () = | |
30 | let | |
31 | open MLton.Platform.OS | |
32 | in | |
33 | case host of | |
34 | AIX => UNIX | |
35 | | Cygwin => UNIX | |
36 | | Darwin => MACOS | |
37 | | FreeBSD => UNIX | |
38 | | Hurd => UNIX | |
39 | | HPUX => UNIX | |
40 | | Linux => UNIX | |
41 | | MinGW => WIN32 | |
42 | | NetBSD => UNIX | |
43 | | OpenBSD => UNIX | |
44 | | Solaris => UNIX | |
45 | end | |
46 | ||
47 | fun getOSName () = MLton.Platform.OS.toString MLton.Platform.OS.host | |
48 | end | |
49 | ||
50 | val getCmdName = CommandLine.name | |
51 | val getArgs = CommandLine.arguments | |
52 | ||
53 | fun getAllArgs () = getCmdName () :: getArgs () | |
54 | ||
55 | val exnHistory = MLton.Exn.history | |
56 | ||
57 | fun exportFn (file: string, f) = | |
58 | let | |
59 | open MLton.World OS.Process | |
60 | in | |
61 | case save (file ^ ".mlton") of | |
62 | Original => exit success | |
63 | | Clone => exit (f (getCmdName (), getArgs ()) handle _ => failure) | |
64 | end | |
65 | ||
66 | fun exportML (f: string): bool = | |
67 | let | |
68 | open MLton.World | |
69 | in | |
70 | case save (f ^ ".mlton") of | |
71 | Clone => true | |
72 | | Original => false | |
73 | end | |
74 | end |