| 1 |
= SMLofNJStructure |
| 2 |
|
| 3 |
[source,sml] |
| 4 |
---- |
| 5 |
signature SML_OF_NJ = |
| 6 |
sig |
| 7 |
structure Cont: |
| 8 |
sig |
| 9 |
type 'a cont |
| 10 |
val callcc: ('a cont -> 'a) -> 'a |
| 11 |
val isolate: ('a -> unit) -> 'a cont |
| 12 |
val throw: 'a cont -> 'a -> 'b |
| 13 |
end |
| 14 |
structure SysInfo: |
| 15 |
sig |
| 16 |
exception UNKNOWN |
| 17 |
datatype os_kind = BEOS | MACOS | OS2 | UNIX | WIN32 |
| 18 |
|
| 19 |
val getHostArch: unit -> string |
| 20 |
val getOSKind: unit -> os_kind |
| 21 |
val getOSName: unit -> string |
| 22 |
end |
| 23 |
|
| 24 |
val exnHistory: exn -> string list |
| 25 |
val exportFn: string * (string * string list -> OS.Process.status) -> unit |
| 26 |
val exportML: string -> bool |
| 27 |
val getAllArgs: unit -> string list |
| 28 |
val getArgs: unit -> string list |
| 29 |
val getCmdName: unit -> string |
| 30 |
end |
| 31 |
---- |
| 32 |
|
| 33 |
`SMLofNJ` implements a subset of the structure of the same name |
| 34 |
provided in <<SMLNJ#,Standard ML of New Jersey>>. It is included to |
| 35 |
make it easier to port programs between the two systems. The |
| 36 |
semantics of these functions may be different than in SML/NJ. |
| 37 |
|
| 38 |
* `structure Cont` |
| 39 |
+ |
| 40 |
implements continuations. |
| 41 |
|
| 42 |
* `SysInfo.getHostArch ()` |
| 43 |
+ |
| 44 |
returns the string for the architecture. |
| 45 |
|
| 46 |
* `SysInfo.getOSKind` |
| 47 |
+ |
| 48 |
returns the OS kind. |
| 49 |
|
| 50 |
* `SysInfo.getOSName ()` |
| 51 |
+ |
| 52 |
returns the string for the host. |
| 53 |
|
| 54 |
* `exnHistory` |
| 55 |
+ |
| 56 |
the same as `MLton.Exn.history`. |
| 57 |
|
| 58 |
* `getCmdName ()` |
| 59 |
+ |
| 60 |
the same as `CommandLine.name ()`. |
| 61 |
|
| 62 |
* `getArgs ()` |
| 63 |
+ |
| 64 |
the same as `CommandLine.arguments ()`. |
| 65 |
|
| 66 |
* `getAllArgs ()` |
| 67 |
+ |
| 68 |
the same as `getCmdName()::getArgs()`. |
| 69 |
|
| 70 |
* `exportFn f` |
| 71 |
+ |
| 72 |
saves the state of the computation to a file that will apply `f` to |
| 73 |
the command-line arguments upon restart. |
| 74 |
|
| 75 |
* `exportML f` |
| 76 |
+ |
| 77 |
saves the state of the computation to file `f` and continue. Returns |
| 78 |
`true` in the restarted computation and `false` in the continuing |
| 79 |
computation. |