173 lines · 4.1 KB · Text
RawDownload
local open Fnlib in (* version string *)val version = "2.00 (June 2000)"; (* Integer ranges *) val maxint_byte = 255and minint_byte = 0and maxint_short = 32767and minint_short = ~32768and maxint_int31 = 1073741823and minint_int31 = ~1073741824; (* The default name for executable bytecode files. *) #ifdef unixval default_exec_name = "a.out";#endif#ifdef macintoshval default_exec_name = "Mosml.out";#endif#if defined(msdos) || defined(win32)val default_exec_name = "mosmlout.exe";#endif (* Prompts *) val toplevel_input_prompt = "- ";val toplevel_output_prompt = "> ";val toplevel_output_cont_prompt = "  ";val toplevel_error_prompt = "! ";val batch_output_prompt = "> ";val batch_output_cont_prompt = "  ";val batch_error_prompt = "! "; (* Run-time values: MUST AGREE with runtime/mlvalues.h *) val realTag     = 254;	val stringTag   = 253;	val refTag      = 250;	val closureTag  = 249 ;val maxBlockTag = closureTag-1; (* Unit sets *) (* The empty "none" set is defined in Mainc.sml, Mainl.sml, and Maint.sml *) val reservedUnitNames = ["General", "Top", "Meta"];val pervasiveOpenedUnits = ["General"]; val fulllib = ["Option", "List", "ListPair", "Strbase", "Char", "String",	       "StringCvt", "TextIO", "BasicIO", "Vector",	       "Array", "Misc", "Substring",	       "Bool", "Int", "Real", "Math",	       "Word", "Word8", "Word8Vector", "Word8Array", "Byte",	       "BinIO", "CharVector", "CharArray",	       "Time", "Timer", "Date", "Path",	       "FileSys", "Process", "OS", 	       "Mosml", "PP", "CommandLine"] val preloadedUnitSets = [  ("default",  ["Option", "List", "Strbase", "Char", "String",		"StringCvt", "TextIO", "BasicIO", "Vector",		"Array", "Misc"]),  ("full",     fulllib),  ("sml90",    ["Option", "List", "Strbase", "Char", "String",                "StringCvt", "TextIO", "BasicIO", "Vector",		"Array", "Misc", "SML90"]),  ("nj93",     ["Option", "List", "Strbase", "Char", "String",		"StringCvt", "TextIO", "BasicIO", "NJ93", "Vector",		"Array", "Misc"])]; val preopenedPreloadedUnitSets = [  ("default",  ["Misc"]),  ("full",     ["Misc"]),  ("sml90",    ["Misc", "SML90"]),  ("nj93",     ["Misc", "NJ93"])]; #ifdef msdos val kosherUnitNames = [  ("Basicio",  "BasicIO"),  ("Binio",    "BinIO"),  ("Chararra", "CharArray"),  ("Charvect", "CharVector"),  ("Commandl", "CommandLine"),  ("Filesys",  "FileSys"),  ("Listpair", "ListPair"),  ("Nj93",     "NJ93"),  ("Os",       "OS"),  ("Pp",       "PP"),  ("Sml90",    "SML90"),  ("Stringcv", "StringCvt"),  ("Substrin", "Substring"),  ("Textio",   "TextIO"),  ("Word8arr", "Word8Array"),  ("Word8vec", "Word8Vector")];#endif #ifdef win32val kosherUnitNames = [  ("Basicio",      "BasicIO"),  ("Binio",        "BinIO"),  ("Chararray",    "CharArray"),  ("Charvector",   "CharVector"),  ("Commandline",  "CommandLine"),  ("Filesys",      "FileSys"),  ("Listpair",     "ListPair"),  ("Nj93",         "NJ93"),  ("Os",           "OS"),  ("Pp",           "PP"),  ("Sml90",        "SML90"),  ("Stringcvt",    "StringCvt"),  ("Substring",    "Substring"),  ("Textio",       "TextIO"),  ("Word8array",   "Word8Array"),  ("Word8vector",  "Word8Vector")];#endif #if defined(msdos) || defined(win32)local open CharVector; infix 9 sub; in   fun normalizedFileName s = Fnlib.stringToLower s;   fun normalizedUnitName s =    let val len = size s        val () = if len = 0 then raise SysErr("Empty unit name", NONE)		 else ()#ifdef msdos        val len0 = if len>8 then 8 else len#else        val len0 = len#endif        val s0 = tabulate(len0, fn i =>          (case i of 0 => Char.toUpper                   | _ => Char.toLower) (s sub i))    in      lookup s0 kosherUnitNames        handle Subscript => s0    end; end; #elsefun normalizedFileName s = s;fun normalizedUnitName s = s;#endif (* To translate escape sequences *) val char_for_backslash = fn#ifdef macintosh(* *)    #"n" => #"\013"(* *)  | #"r" => #"\010"#else(* *)    #"n" => #"\010"(* *)  | #"r" => #"\013"#endif(* *)  | #"a" => #"\007"(* *)  | #"b" => #"\008"(* *)  | #"t" => #"\009"(* *)  | #"v" => #"\011"(* *)  | #"f" => #"\012"(* *)  | c => c; end;