Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Better regularity between mlton and smlnj makefile process

  • Loading branch information...
commit 581ce232059ee0d182054068fb445670ba858b2c 1 parent 00de36c
@robsimmons robsimmons authored
View
1  smack-nonposix.cm
@@ -7,5 +7,4 @@ Group is
src/posix-symlink.sml
src/smackage-path.sml
src/smacklib.sml
- src/configure.sml
src/main.sml
View
1  smack.cm
@@ -7,5 +7,4 @@ Group is
src/posix-symlink.sml
src/smackage-path.sml
src/smacklib.sml
- src/configure.sml
src/main.sml
View
16 sources.cm
@@ -2,20 +2,20 @@ Group is
$/basis.cm
util/sources.cm
+ (* Smackage data types *)
src/protocol.sml
src/semver.sml
+ src/spec.sml
+
+ (* Managing local data *)
+ src/fsutil.sml
src/version-index.sml
+ src/configure.sml
src/install.sml
+ (* Obtaining and manipulating code and packages *)
+ src/get-git.sml
src/conductor.sig
src/conductor.sml
- src/get-git.sml
- src/get-http.sml
-(* src/smackage-path.sml *)
- src/spec.sml
src/http-downloader.sig
src/curl-lib.sml
-(* src/smacklib.sml *)
-
-(* src/posix-symlink.sml *)
-(* src/bullshit-symlink.sml*)
View
36 sources.mlb
@@ -1,15 +1,21 @@
-$(SML_LIB)/basis/basis.mlb
-(*src/posix-symlink.sml*)
-(*src/bullshit-symlink.sml*)
-
-src/semver.sml
-src/protocol.sml
-src/spec.sml
-src/install.sml
-src/version-index.sml
-src/get-git.sml
-src/get-http.sml
-src/conductor.sig
-src/conductor.sml
-(*src/smackage-path.sml*)
-(*src/smacklib.sml*)
+
+ $(SML_LIB)/basis/basis.mlb
+ util/sources.mlb
+
+ (* Smackage data types *)
+ src/protocol.sml
+ src/semver.sml
+ src/spec.sml
+
+ (* Managing local data *)
+ src/fsutil.sml
+ src/version-index.sml
+ src/configure.sml
+ src/install.sml
+
+ (* Obtaining and manipulating code and packages *)
+ src/get-git.sml
+ src/conductor.sig
+ src/conductor.sml
+ src/http-downloader.sig
+ src/curl-lib.sml
View
67 src/fsutil.sml
@@ -0,0 +1,67 @@
+
+structure FSUtil:>
+sig
+ (* Run a system command, get the output, clean up. *)
+ val systemStr: string -> string
+
+ (* Get all the lines from a file.
+ * Trims leading whitespace, trailing newlines, and #linecomments. *)
+ val getLines: string -> string list
+
+ (* Write lines to a file; adds newlines. *)
+ val putLines: string list -> string -> unit
+end =
+struct
+ fun systemStr cmd =
+ let
+ val tmpName = OS.FileSys.tmpName ()
+ val _ = OS.Process.system (cmd ^ " > " ^ tmpName)
+ val tmp = TextIO.openIn tmpName
+ val cleanup = fn () => OS.FileSys.remove tmpName
+ in
+ (TextIO.inputAll tmp before (TextIO.closeIn tmp; cleanup ()))
+ handle exn =>
+ ( (TextIO.closeIn tmp; cleanup ()) handle _ => ()
+ ; raise exn)
+ end
+
+ fun trim s =
+ let
+ fun trimStart (#" "::t) = trimStart t
+ | trimStart (#"\t"::t) = trimStart t
+ | trimStart l = l
+
+ fun trimEnd (#"#"::t) = []
+ | trimEnd (#"\n"::t) = []
+ | trimEnd (h::t) = h :: trimEnd t
+ | trimEnd [] = []
+ in
+ String.implode (trimEnd (trimStart (String.explode s)))
+ end
+
+ fun getLines' file accum =
+ case TextIO.inputLine file of
+ NONE => rev accum before TextIO.closeIn file
+ | SOME s => getLines' file (trim s :: accum)
+
+ fun getLines fileName =
+ let val file = TextIO.openIn fileName
+ in
+ getLines' file []
+ handle exn => (TextIO.closeIn file handle _ => (); raise exn)
+ end
+
+ fun putLines' file lines =
+ case lines of
+ [] => TextIO.closeOut file
+ | line :: lines =>
+ (TextIO.output (file, line ^ "\n"); putLines' file lines)
+
+ fun putLines lines fileName =
+ let val file = TextIO.openOut fileName
+ in
+ putLines' file []
+ handle exn => (TextIO.closeOut file handle _ => (); raise exn)
+ end
+
+end
View
5 src/get-http.sml
@@ -1,5 +0,0 @@
-structure GetHttp =
-struct
-
-end
-
View
6 util/sources.mlb
@@ -0,0 +1,6 @@
+
+ $(SML_LIB)/basis/basis.mlb
+ sort.sml
+ dict.sig
+ dict-list.sml
+
Please sign in to comment.
Something went wrong with that request. Please try again.