equal
deleted
inserted
replaced
1 (* ========================================================================= *) |
1 (* ========================================================================= *) |
2 (* MOSCOW ML SPECIFIC FUNCTIONS *) |
2 (* MOSCOW ML SPECIFIC FUNCTIONS *) |
3 (* Copyright (c) 2002-2004 Joe Hurd, distributed under the BSD License *) |
3 (* Copyright (c) 2002 Joe Hurd, distributed under the BSD License *) |
4 (* ========================================================================= *) |
4 (* ========================================================================= *) |
5 |
5 |
6 structure Portable :> Portable = |
6 structure Portable :> Portable = |
7 struct |
7 struct |
8 |
8 |
25 (* ------------------------------------------------------------------------- *) |
25 (* ------------------------------------------------------------------------- *) |
26 (* Timing function applications. *) |
26 (* Timing function applications. *) |
27 (* ------------------------------------------------------------------------- *) |
27 (* ------------------------------------------------------------------------- *) |
28 |
28 |
29 val time = Mosml.time; |
29 val time = Mosml.time; |
30 |
|
31 (* ------------------------------------------------------------------------- *) |
|
32 (* Critical section markup (multiprocessing) *) |
|
33 (* ------------------------------------------------------------------------- *) |
|
34 |
|
35 fun CRITICAL e = e (); (*dummy*) |
|
36 |
30 |
37 (* ------------------------------------------------------------------------- *) |
31 (* ------------------------------------------------------------------------- *) |
38 (* Generating random values. *) |
32 (* Generating random values. *) |
39 (* ------------------------------------------------------------------------- *) |
33 (* ------------------------------------------------------------------------- *) |
40 |
34 |
96 open Array |
90 open Array |
97 in |
91 in |
98 modifyi f (a,0,NONE) |
92 modifyi f (a,0,NONE) |
99 end; |
93 end; |
100 |
94 |
|
95 fun OS_Process_isSuccess s = s = OS.Process.success; |
|
96 |
|
97 fun String_isSuffix p s = |
|
98 let |
|
99 val sizeP = size p |
|
100 and sizeS = size s |
|
101 in |
|
102 sizeP <= sizeS andalso |
|
103 String.extract (s, sizeS - sizeP, NONE) = p |
|
104 end; |
|
105 |
|
106 fun Substring_full s = |
|
107 let |
|
108 open Substring |
|
109 in |
|
110 all s |
|
111 end; |
|
112 |
101 fun TextIO_inputLine h = |
113 fun TextIO_inputLine h = |
102 let |
114 let |
103 open TextIO |
115 open TextIO |
104 in |
116 in |
105 case inputLine h of "" => NONE | s => SOME s |
117 case inputLine h of "" => NONE | s => SOME s |