[MLton-commit] r6161
Vesa Karvonen
vesak at mlton.org
Mon Nov 12 12:49:01 PST 2007
Added foldDir and listDir to OS.FileSys for convenience.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/unsealed.cm
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/os/
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/os/os.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
U mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os-file-sys.sig
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/sigs.cm 2007-11-12 20:49:00 UTC (rev 6161)
@@ -65,6 +65,8 @@
../../../public/numeric/integer.sig
../../../public/numeric/real.sig
../../../public/numeric/word.sig
+ ../../../public/os/os-file-sys.sig
+ ../../../public/os/os.sig
../../../public/sequence/array-slice.sig
../../../public/sequence/array.sig
../../../public/sequence/buffer.sig
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/unsealed.cm
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/unsealed.cm 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/unsealed.cm 2007-11-12 20:49:00 UTC (rev 6161)
@@ -61,6 +61,7 @@
../../../detail/numeric/mk-integer-ext.fun
../../../detail/numeric/mk-real-ext.fun
../../../detail/numeric/mk-word-ext.fun
+ ../../../detail/os/os.sml
../../../detail/sequence/array-slice.sml
../../../detail/sequence/array.sml
../../../detail/sequence/buffer.sml
Added: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/os/os.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/os/os.sml 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/os/os.sml 2007-11-12 20:49:00 UTC (rev 6161)
@@ -0,0 +1,28 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+structure OS = struct
+ open BasisOS
+
+ structure FileSys = struct
+ open FileSys
+
+ fun foldDir f s path =
+ case openDir path
+ of ds =>
+ Exn.after (fn () => let
+ fun lp s =
+ case readDir ds
+ of NONE => s
+ | SOME n => lp (f (n, s))
+ in
+ lp s
+ end,
+ fn () => closeDir ds)
+
+ val listDir = foldDir op :: []
+ end
+end
Property changes on: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/os/os.sml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb 2007-11-12 20:49:00 UTC (rev 6161)
@@ -299,6 +299,11 @@
public/io/text-io.sig
detail/io/text-io.sml
+ (* OS *)
+ public/os/os-file-sys.sig
+ public/os/os.sig
+ detail/os/os.sml
+
(* MkWordFlags *)
detail/concept/mk-word-flags.fun
in
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use 2007-11-12 20:49:00 UTC (rev 6161)
@@ -157,6 +157,9 @@
"public/fn/shift-op.sig",
"public/io/text-io.sig",
"detail/io/text-io.sml",
+ "public/os/os-file-sys.sig",
+ "public/os/os.sig",
+ "detail/os/os.sml",
"detail/concept/mk-word-flags.fun",
"detail/ml/${SML_COMPILER}/forget.use",
"public/export/${SML_COMPILER}.sml",
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/export/common.sml 2007-11-12 20:49:00 UTC (rev 6161)
@@ -83,6 +83,8 @@
signature MONO_VECTOR_SLICE = MONO_VECTOR_SLICE
signature OPTION = OPTION
signature ORDER = ORDER
+signature OS = OS
+signature OS_FILE_SYS = OS_FILE_SYS
signature PAIR = PAIR
signature PHANTOM = PHANTOM
signature PRODUCT = PRODUCT
@@ -160,6 +162,7 @@
structure LargeWord : WORD = LargeWord
structure Lazy : LAZY = Lazy
structure List : LIST = List
+structure OS : OS = OS
structure Option : OPTION = Option
structure Order : ORDER = Order
structure Pair : PAIR = Pair
Added: mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os-file-sys.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os-file-sys.sig 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os-file-sys.sig 2007-11-12 20:49:00 UTC (rev 6161)
@@ -0,0 +1,21 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+(**
+ * Extended {OS_FILE_SYS} signature.
+ *)
+signature OS_FILE_SYS = sig
+ include BASIS_OS_FILE_SYS
+
+ val foldDir : (String.t * 'a -> 'a) -> 'a -> String.t -> 'a
+ (** Fold the list of filenames from the specified directory. *)
+
+ val listDir : String.t -> String.t List.t
+ (**
+ * {listDir} is equivalent to {foldDir op :: []}. Note that the order
+ * in which filenames appear in the returned list is unspecified.
+ *)
+end
Property changes on: mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os-file-sys.sig
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os.sig 2007-11-12 20:44:28 UTC (rev 6160)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os.sig 2007-11-12 20:49:00 UTC (rev 6161)
@@ -0,0 +1,26 @@
+(* Copyright (C) 2007 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+(**
+ * Extended {OS} signature.
+ *
+ * This signature is just a restatement of the {OS} signature using the
+ * extended substructure signatures.
+ *)
+signature OS = sig
+ structure FileSys : OS_FILE_SYS
+ structure IO : BASIS_OS_IO
+ structure Path : BASIS_OS_PATH
+ structure Process : BASIS_OS_PROCESS
+
+ eqtype syserror
+
+ exception SysErr of string * syserror option
+
+ val errorMsg : syserror -> string
+ val errorName : syserror -> string
+ val syserror : string -> syserror option
+end
Property changes on: mltonlib/trunk/com/ssh/extended-basis/unstable/public/os/os.sig
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the MLton-commit
mailing list