Skip to content

Commit

Permalink
Recovering and editing old New Jersey ML bootstrapping files and adju…
Browse files Browse the repository at this point in the history
…sting them to work under Standard ML of New Jersey v110.75 as far as the MLWorks structure, which is out-of-date with respect to the MLWORKS signature.
  • Loading branch information
rptb1 authored and dram committed Sep 6, 2022
1 parent 135285d commit 1b7712d
Show file tree
Hide file tree
Showing 10 changed files with 3,288 additions and 11 deletions.
1,841 changes: 1,841 additions & 0 deletions src/make/change_nj.sml

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions src/make/nj_env.sml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ local
(* A handful of environment functions that we need *)
(* We only need the functions that actually get called by the compiler here *)

val environment = NewJersey.System.environ
val setwd = System.Directory.cd
val getwd = NewJersey.System.Directory.getWD
fun realpath (s: string) :string =
NewJersey.System.Unsafe.CInterface.c_function
"realpath"
(NewJersey.System.Unsafe.CInterface.c_string s)
handle NewJersey.System.Unsafe.CInterface.SysError _ =>
raise Io ("realpath: " ^ s)
(* http://www.standardml.org/Basis/os-process.html#SIG:OS_PROCESS.getEnv:VAL *)
val environment = OS.Process.getEnv

(* http://www.standardml.org/Basis/os-file-sys.html#SIG:OS_FILE_SYS.chDir:VAL *)
val setwd = OS.FileSys.chDir

(* http://www.standardml.org/Basis/os-file-sys.html#SIG:OS_FILE_SYS.getDir:VAL *)
val getwd = OS.FileSys.getDir

(* http://www.standardml.org/Basis/os-file-sys.html#SIG:OS_FILE_SYS.realPath:VAL *)
val realpath = OS.FileSys.realPath

(* http://www.smlnj.org/doc/SMLofNJ/pages/unsafe.html#SIG:UNSAFE.cast:VAL *)
type T = int ref
val tcast : 'a -> T = NewJersey.System.Unsafe.cast
val tcast : 'a -> T = Unsafe.cast

val env_refs = ref [] : (string * T) list ref

Expand All @@ -41,7 +44,7 @@ local

exception UnimplementedEnv of string
fun unimplemented name =
(output (std_out, "unimplemented env function: " ^ name ^ "\n");
(TextIO.output (TextIO.stdOut, "unimplemented env function: " ^ name ^ "\n");
raise UnimplementedEnv name)

in
Expand Down
86 changes: 86 additions & 0 deletions src/pervasive/array.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
(*
* The arrays module.
*
* Copyright (c) 1992 Harlequin Ltd.
*
* $Log: array.sml,v $
* Revision 1.6 1996/05/21 11:48:15 matthew
* Removing Copy exception, (replacing with Subscript)
*
* Revision 1.5 1993/02/25 18:13:17 matthew
* Removed Array.T from signature
*
* Revision 1.4 1992/12/21 12:41:04 daveb
* Added the agreed 'Array' structure. Renamed the existing Array structure
* to ExtendedArray.
*
* Revision 1.3 1992/08/25 13:51:36 richard
* Strengthened the types of all values for which it was possible.
* Added tabulate.
*
* Revision 1.2 1992/08/20 12:24:43 richard
* Enriched the ARRAY signature.
*
* Revision 1.1 1992/08/07 10:17:13 davidt
* Initial revision
*
*
*)

signature ARRAY =
sig
eqtype 'a array
(*
eqtype 'a T
sharing type T = array
*)
exception Size
exception Subscript
val array: int * '_a -> '_a array
val arrayoflist: '_a list -> '_a array
val tabulate: int * (int -> '_a) -> '_a array
val sub: 'a array * int -> 'a
val update: 'a array * int * 'a -> unit
val length: 'a array -> int
end

signature EXTENDED_ARRAY =
sig
(* include "ARRAY" -- omitted to keep SML/NJ happy. *)
eqtype 'a array
(*
eqtype 'a T
sharing type T = array
*)
exception Size
exception Subscript
exception Find

val array : int * '_a -> '_a array
val length : 'a array -> int
val update : 'a array * int * 'a -> unit
val sub : 'a array * int -> 'a
val arrayoflist : '_a list -> '_a array
val tabulate : int * (int -> '_a) -> '_a array

val from_list : '_a list -> '_a array
val to_list : 'a array -> 'a list
val fill : 'a array * 'a -> unit
val map : ('a -> '_b) -> 'a array -> '_b array
val map_index : (int * 'a -> '_b) -> 'a array -> '_b array
val iterate : ('a -> unit) -> 'a array -> unit
val iterate_index : (int * 'a -> unit) -> 'a array -> unit
val rev : '_a array -> '_a array
val duplicate : '_a array -> '_a array
val subarray : '_a array * int * int -> '_a array
val append : '_a array * '_a array -> '_a array
val reducel : ('a * 'b -> 'a) -> ('a * 'b array) -> 'a
val reducer : ('a * 'b -> 'b) -> ('a array * 'b) -> 'b
val reducel_index : (int * 'a * 'b -> 'a) -> ('a * 'b array) -> 'a
val reducer_index : (int * 'a * 'b -> 'b) -> ('a array * 'b) -> 'b
val copy : 'a array * int * int * 'a array * int -> unit
val fill_range : 'a array * int * int * 'a -> unit
val find : ('a -> bool) -> 'a array -> int
val find_default : (('a -> bool) * int) -> 'a array -> int
val maxLen : int
end;
22 changes: 22 additions & 0 deletions src/pervasive/bits.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(* ==== PERVASIVE BITS SIGNATURE ====
*
* Copyright (C) 1992 Harlequin Ltd.
*
* Revision Log
* ------------
* $Log: bits.sml,v $
* Revision 1.1 1992/08/25 08:09:51 richard
* Initial revision
*
*)

signature BITS =
sig
val andb : int * int -> int
val orb : int * int -> int
val xorb : int * int -> int
val lshift : int * int -> int
val rshift : int * int -> int
val arshift : int * int -> int
val notb : int -> int
end;
67 changes: 67 additions & 0 deletions src/pervasive/bytearray.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
(* ==== PERVASIVE BYTEARRAY STRUCTURE ====
*
* Copyright (C) 1992 Harlequin Ltd.
*
* Description
* -----------
* Byte arrays are mutable objects which resemble arrays by may only
* contain integers in the range [0, 255].
*
* Revision Log
* ------------
* $Log: bytearray.sml,v $
* Revision 1.4 1996/05/21 11:47:55 matthew
* Removing Copy exception, (replacing with Subscript)
*
* Revision 1.3 1993/03/24 17:28:49 jont
* Added Find to list of visible exceptions
*
* Revision 1.2 1993/02/25 18:17:01 matthew
* Remove ByteArray.T from signature
*
* Revision 1.1 1992/08/24 10:29:04 richard
* Initial revision
*
*)

signature BYTEARRAY =
sig
eqtype bytearray

exception Range of int
exception Size
exception Subscript
exception Substring
exception Find

val array : int * int -> bytearray
val length : bytearray -> int
val update : bytearray * int * int -> unit
val sub : bytearray * int -> int
val arrayoflist : int list -> bytearray

val tabulate : int * (int -> int) -> bytearray
val from_list : int list -> bytearray
val to_list : bytearray -> int list
val from_string : string -> bytearray
val to_string : bytearray -> string
val fill : bytearray * int -> unit
val map : (int -> int) -> bytearray -> bytearray
val map_index : (int * int -> int) -> bytearray -> bytearray
val iterate : (int -> unit) -> bytearray -> unit
val iterate_index : (int * int -> unit) -> bytearray -> unit
val rev : bytearray -> bytearray
val duplicate : bytearray -> bytearray
val subarray : bytearray * int * int -> bytearray
val substring : bytearray * int * int -> string
val append : bytearray * bytearray -> bytearray
val reducel : ('a * int -> 'a) -> ('a * bytearray) -> 'a
val reducer : (int * 'a -> 'a) -> (bytearray * 'a) -> 'a
val reducel_index : (int * 'a * int -> 'a) -> ('a * bytearray) -> 'a
val reducer_index : (int * int * 'a -> 'a) -> (bytearray * 'a) -> 'a
val copy : bytearray * int * int * bytearray * int -> unit
val fill_range : bytearray * int * int * int -> unit
val find : (int -> bool) -> bytearray -> int
val find_default : ((int -> bool) * int) -> bytearray -> int
val maxLen : int
end;
59 changes: 59 additions & 0 deletions src/pervasive/floatarray.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
(* ==== PERVASIVE FLOATARRAY STRUCTURE ====
*
* Copyright (C) 1996 Harlequin Ltd.
*
* Description
* -----------
* Float arrays are mutable objects which differ from arrays of floats
* in that the entries are not individually boxed.
*
*
* Revision Log
* ------------
* $Log: floatarray.sml,v $
* Revision 1.1 1997/01/07 12:44:38 andreww
* new unit
* [Bug #1818]
* Signature for the new pervasive FloatArray structure
*
*
*)

signature FLOATARRAY =
sig
eqtype floatarray

exception Range of int
exception Size
exception Subscript
exception Find

val array : int * real -> floatarray
val length : floatarray -> int
val update : floatarray * int * real -> unit
val sub : floatarray * int -> real
val arrayoflist : real list -> floatarray

val tabulate : int * (int -> real) -> floatarray
val from_list : real list -> floatarray
val to_list : floatarray -> real list
val fill : floatarray * real -> unit
val map : (real -> real) -> floatarray -> floatarray
val map_index : (int * real -> real) -> floatarray -> floatarray
val iterate : (real -> unit) -> floatarray -> unit
val iterate_index : (int * real -> unit) -> floatarray -> unit
val rev : floatarray -> floatarray
val duplicate : floatarray -> floatarray
val subarray : floatarray * int * int -> floatarray
val append : floatarray * floatarray -> floatarray
val reducel : ('a * real -> 'a) -> ('a * floatarray) -> 'a
val reducer : (real * 'a -> 'a) -> (floatarray * 'a) -> 'a
val reducel_index : (int * 'a * real -> 'a) -> ('a * floatarray) -> 'a
val reducer_index : (int * real * 'a -> 'a) -> (floatarray * 'a) -> 'a
val copy : floatarray * int * int * floatarray * int -> unit
val fill_range : floatarray * int * int * real -> unit
val find : (real -> bool) -> floatarray -> int
val find_default : ((real -> bool) * int) -> floatarray -> int
val maxLen : int
end;

84 changes: 84 additions & 0 deletions src/pervasive/general.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
(* ==== INITIAL BASIS : GENERAL ====
*
* Copyright (C) 1995 Harlequin Ltd.
*
* Description
* -----------
* This is part of the extended Initial Basis.
*
* Revision Log
* ------------
* $Log: general.sml,v $
* Revision 1.4 1997/08/04 12:43:59 brucem
* [Bug #30084]
* Remove items which have been moved to Option.
* And delete the stub structure which previously declared datatype option.
*
* Revision 1.3 1997/05/01 11:48:58 jont
* [Bug #30088]
* Get rid of MLWorks.Option
*
* Revision 1.2 1996/07/11 10:22:43 andreww
* Adding exception Empty.
*
* Revision 1.1 1996/06/25 09:56:42 andreww
* new unit
* Addition to the pervasive library.
*
* Revision 1.3 1996/05/08 14:53:41 jont
* Update to latest revision
*
* Revision 1.2 1996/04/23 13:05:43 matthew
* Updating
*
* Revision 1.1 1996/04/18 11:42:57 jont
* new unit
*
* Revision 1.4 1996/03/28 12:29:02 matthew
* Fixing rigid type sharing problem
*
* Revision 1.3 1995/03/31 13:44:07 brianm
* Adding options operators to General ...
*
* Revision 1.2 1995/03/12 18:49:24 brianm
* Commented out troublesome datatypes and equality definitions.
*
* Revision 1.1 1995/03/08 16:23:04 brianm
* new unit
*
*)

signature GENERAL =
sig
eqtype unit
type exn

exception Bind
exception Match
exception Subscript
exception Size
exception Overflow
exception Domain
exception Div
exception Chr
exception Fail of string
exception Empty

val exnName : exn -> string
val exnMessage : exn -> string

datatype order = LESS | EQUAL | GREATER

val <> : (''a * ''a) -> bool

val ! : 'a ref -> 'a

val := : ('a ref * 'a) -> unit

val o : (('b -> 'c) * ('a -> 'b)) -> 'a -> 'c

val before : ('a * unit) -> 'a

val ignore : 'a -> unit

end
Loading

0 comments on commit 1b7712d

Please sign in to comment.