1local open Fnlib in
2
3(* version string *)
4val version = "2.00 (June 2000)";
5
6(* Integer ranges *)
7
8val maxint_byte = 255
9and minint_byte = 0
10and maxint_short = 32767
11and minint_short = ~32768
12and maxint_int31 = 1073741823
13and minint_int31 = ~1073741824
14;
15
16(* The default name for executable bytecode files. *)
17
18#ifdef unix
19val default_exec_name = "a.out";
20#endif
21#ifdef macintosh
22val default_exec_name = "Mosml.out";
23#endif
24#if defined(msdos) || defined(win32)
25val default_exec_name = "mosmlout.exe";
26#endif
27
28(* Prompts *)
29
30val toplevel_input_prompt = "- ";
31val toplevel_output_prompt = "> ";
32val toplevel_output_cont_prompt = "  ";
33val toplevel_error_prompt = "! ";
34val batch_output_prompt = "> ";
35val batch_output_cont_prompt = "  ";
36val batch_error_prompt = "! ";
37
38(* Run-time values: MUST AGREE with runtime/mlvalues.h *)
39
40val realTag     = 254;
41val stringTag   = 253;
42val refTag      = 250;
43val closureTag  = 249 ;
44val maxBlockTag = closureTag-1;
45
46(* Unit sets *)
47
48(* The empty "none" set is defined in Mainc.sml, Mainl.sml, and Maint.sml *)
49
50val reservedUnitNames = ["General", "Top", "Meta"];
51val pervasiveOpenedUnits = ["General"];
52
53val fulllib = ["Option", "List", "ListPair", "Strbase", "Char", "String",
54	       "StringCvt", "TextIO", "BasicIO", "Vector",
55	       "Array", "VectorSlice", "ArraySlice", "Misc", "Substring",
56	       "Bool", "Int", "Real", "Math",
57	       "Word", "Word8", "Word8Vector", "Word8Array",
58	       "Word8VectorSlice", "Word8ArraySlice", "Byte",
59	       "BinIO", "CharVector", "CharArray",
60	       "CharVectorSlice", "CharArraySlice",
61	       "Time", "Timer", "Date", "Path",
62	       "FileSys", "Process", "OS",
63	       "Mosml", "PP", "CommandLine"]
64
65val preloadedUnitSets = [
66  ("default",  ["Option", "List", "Strbase", "Char", "String",
67		"StringCvt", "TextIO", "BasicIO", "Vector",
68		"Array", "Misc"]),
69  ("full",     fulllib),
70  ("sml90",    ["Option", "List", "Strbase", "Char", "String",
71                "StringCvt", "TextIO", "BasicIO", "Vector",
72		"Array", "Misc", "SML90"]),
73  ("nj93",     ["Option", "List", "Strbase", "Char", "String",
74		"StringCvt", "TextIO", "BasicIO", "NJ93", "Vector",
75		"Array", "Misc"])
76];
77
78val preopenedPreloadedUnitSets = [
79  ("default",  ["Misc"]),
80  ("full",     ["Misc"]),
81  ("sml90",    ["Misc", "SML90"]),
82  ("nj93",     ["Misc", "NJ93"])
83];
84
85#ifdef msdos
86
87val kosherUnitNames = [
88  ("Arraysli", "ArraySlice"),
89  ("Basicio",  "BasicIO"),
90  ("Binio",    "BinIO"),
91  ("Chararra", "CharArray"),
92  ("Charvect", "CharVector"),
93  ("Commandl", "CommandLine"),
94  ("Filesys",  "FileSys"),
95  ("Listpair", "ListPair"),
96  ("Nj93",     "NJ93"),
97  ("Os",       "OS"),
98  ("Pp",       "PP"),
99  ("Sml90",    "SML90"),
100  ("Stringcv", "StringCvt"),
101  ("Substrin", "Substring"),
102  ("Textio",   "TextIO"),
103  ("Vectorsl", "VectorSlice"),
104  ("Word8arr", "Word8Array"),
105  ("Word8vec", "Word8Vector")
106];
107#endif
108
109#ifdef win32
110val kosherUnitNames = [
111  ("Arrayslice",       "ArraySlice"),
112  ("Basicio",          "BasicIO"),
113  ("Binio",            "BinIO"),
114  ("Chararray",        "CharArray"),
115  ("Chararrayslice",   "CharArraySlice"),
116  ("Charvector",       "CharVector"),
117  ("Charvectorslice",  "CharVectorSlice")
118  ("Commandline",      "CommandLine"),
119  ("Filesys",          "FileSys"),
120  ("Listpair",         "ListPair"),
121  ("Nj93",             "NJ93"),
122  ("Os",               "OS"),
123  ("Pp",               "PP"),
124  ("Sml90",            "SML90"),
125  ("Stringcvt",        "StringCvt"),
126  ("Substring",        "Substring"),
127  ("Textio",           "TextIO"),
128  ("Vectorslice",      "VectorSlice"),
129  ("Word8array",       "Word8Array"),
130  ("Word8arrayslice",  "Word8ArraySlice"),
131  ("Word8vector",      "Word8Vector"),
132  ("Word8vectorslice", "Word8VectorSlice")
133];
134#endif
135
136#if defined(msdos) || defined(win32)
137local open CharVector; infix 9 sub; in
138
139  fun normalizedFileName s = Fnlib.stringToLower s;
140
141  fun normalizedUnitName s =
142    let val len = size s
143        val () = if len = 0 then raise SysErr("Empty unit name", NONE)
144		 else ()
145#ifdef msdos
146        val len0 = if len>8 then 8 else len
147#else
148        val len0 = len
149#endif
150        val s0 = tabulate(len0, fn i =>
151          (case i of 0 => Char.toUpper
152                   | _ => Char.toLower) (s sub i))
153    in
154      lookup s0 kosherUnitNames
155        handle Subscript => s0
156    end;
157
158end;
159
160#else
161fun normalizedFileName s = s;
162fun normalizedUnitName s = s;
163#endif
164
165(* To translate escape sequences *)
166
167val char_for_backslash = fn
168#ifdef macintosh
169(* *)    #"n" => #"\013"
170(* *)  | #"r" => #"\010"
171#else
172(* *)    #"n" => #"\010"
173(* *)  | #"r" => #"\013"
174#endif
175(* *)  | #"a" => #"\007"
176(* *)  | #"b" => #"\008"
177(* *)  | #"t" => #"\009"
178(* *)  | #"v" => #"\011"
179(* *)  | #"f" => #"\012"
180(* *)  | c => c
181;
182
183end;
184