Skip to content

Commit

Permalink
flexible support for source unit names based on mlb-file hashing - is…
Browse files Browse the repository at this point in the history
…sue #97
  • Loading branch information
melsman committed Jan 17, 2022
1 parent 6e46bfd commit 42978e7
Show file tree
Hide file tree
Showing 8 changed files with 332 additions and 376 deletions.
13 changes: 12 additions & 1 deletion src/Manager/IntModules.sml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ functor IntModules(structure ManagerObjects : MANAGER_OBJECTS0
type ElabEnv = ManagerObjects.ElabEnv
type ElabBasis = ManagerObjects.ElabBasis

infix |>
fun x |> f = f x

fun die s = Crash.impossible ("IntModules." ^ s)
fun print_error_report report = Report.print' report (!Flags.log)
fun log (s:string) : unit = TextIO.output (!Flags.log, s)
Expand Down Expand Up @@ -458,8 +461,16 @@ functor IntModules(structure ManagerObjects : MANAGER_OBJECTS0
fun reuse_msg s = (print("[cannot reuse instance code for functor `"
^ FunId.pr_FunId funid ^ "' -- " ^ s ^ "]\n"); NONE)

(* remove prefix hash value from the absprjid string *)
val src_name =
ModuleEnvironments.absprjid_to_string absprjid
|> Substring.full
|> Substring.splitl (fn c => c = #"-")
|> #2
|> Substring.string

val _ = print("[compiling body of functor " ^ FunId.pr_FunId funid ^
" (from project " ^ ModuleEnvironments.absprjid_to_string absprjid ^ ") begin]\n")
" (from source " ^ src_name ^ ") begin]\n")
(* val _ = out_functor_application (FunId.pr_FunId funid) (* for statistics *) *)

val _ = chat "[recreating functor body begin...]"
Expand Down
15 changes: 7 additions & 8 deletions src/Manager/manager.mlb
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,29 @@ in
MODCODE_MINI.sml
end

local open Basics
in INT_MODULES.sml
local open Basics
in INT_MODULES.sml
MANAGER.sig
end

local open Pickle CompilerObjects
in local open Tools
in ../Compiler/COMPILE_BASIS.sml
in local open Tools
in ../Compiler/COMPILE_BASIS.sml
end
local open SyntaxObjects Basics
in EXECUTION.sml
end
end

../Common/MD5.sml
../Common/md5.mlb

local open Pickle Tools Basics CompilerObjects
in local open SyntaxObjects Environment
in local open SyntaxObjects Environment
in ManagerObjects0.sml
ManagerObjects.sml
local open Edlib in IntModules.sml end
end
end
Scriptlet.sml
local open Edlib SyntaxObjects MlbMake in Manager.sml end
end
end

1 change: 0 additions & 1 deletion src/Tools/MlbMake/MLB_PLUGIN.sml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ signature MLB_PLUGIN =
-> {mlbfile: string,
target: string,
lnkFiles: string list,
lnkFilesScripts: string list,
flags: string}
-> unit

Expand Down
45 changes: 21 additions & 24 deletions src/Tools/MlbMake/MLB_PROJECT.sml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
signature MLB_PROJECT =
sig
structure MS :
structure MS :
sig
structure Bid :
sig
structure Bid :
sig
eqtype bid and longbid
val bid : string -> bid
val longbid : bid list -> longbid
Expand All @@ -12,37 +12,36 @@ sig
val pp_longbid : longbid -> string
end

type atbdec = string (* path.{sml,sig} *)
type atbdec = string (* path.{sml,sig} *)

datatype bexp = BASbexp of bdec
| LETbexp of bdec * bexp
| LONGBIDbexp of Bid.longbid

and bdec = SEQbdec of bdec * bdec
| EMPTYbdec
| EMPTYbdec
| LOCALbdec of bdec * bdec
| BASISbdec of Bid.bid * bexp
| OPENbdec of Bid.longbid list
| ATBDECbdec of atbdec
| MLBFILEbdec of string * string option (* path.mlb <scriptpath p> *)
| SCRIPTSbdec of atbdec list
| MLBFILEbdec of string
| ANNbdec of string * bdec
end

(* scriptpath p is optional in MLBFILEbdec; only useful in the context of
* SMLserver as SCRIPTSbdec. *)
val parse : string -> MS.bdec
(* [parse mlbfile] parses a basis file mlbfile. Prints an

val parse : string -> MS.bdec * string
(* [parse mlbfile] parses a basis file mlbfile. Also returns a hash. Prints an
* error message and raises Fail on error. *)

val depDir : string ref
(* The directory in which dependency files are stored; the
* default is "PM" *)
val depDir : string ref
(* The directory in which dependency files are stored; the
* default is "MLB" *)

val dep : string -> unit
(* [dep mlbfile] parses mlbfile (and the mlb-files it mentions,
* recursively) and writes dependency information to disk in
val dep : string -> unit
(* [dep mlbfile] parses mlbfile (and the mlb-files it mentions,
* recursively) and writes dependency information to disk in
* .d-files. *)

type BG
Expand All @@ -54,19 +53,17 @@ sig
val compare : (atom * atom) -> order
end
type File
datatype SmlFile = Script of Atom.atom
| NonScript of Atom.atom
type SmlFile = Atom.atom
val project : File -> SmlFile
val fold : ((SmlFile * string * string list * 'a) -> 'a) -> 'a -> BG -> 'a
val done : File * BG -> (File * string * string list) list * BG
val initial : BG -> (File * string * string list) list
val fold : ((SmlFile * (string*string) * string list * 'a) -> 'a) -> 'a -> BG -> 'a
val done : File * BG -> (File * (string*string) * string list) list * BG
val initial : BG -> (File * (string*string) * string list) list
(* The second components of the pairs being the hosting mlbfiles (the third
* components contains annotations, that is, flags that the compiler should
* apply during compilation of the source file). *)

(* val pp_bg : BG -> string *)
val sources : string -> BG
val sources : string -> BG
(* [sources mlbfile] returns the dependency graph of sources (.sml- and
* .sig-files) mentioned in mlbfile *)
end

Loading

0 comments on commit 42978e7

Please sign in to comment.