[MLton] Re: Windows ports and paths

Wesley W. Terpstra wesley@terpstra.ca
Sun, 1 May 2005 05:39:01 +0200


--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, May 01, 2005 at 03:31:07AM +0200, Wesley W. Terpstra wrote:
> So, I guess the fix is trivial; just quote the filename in the internal mlb.

A patch to fix this bug is attached.
However, it turned up another bug!

lib/mlton/basic/string0.sml defines toString as the identity.
That is wrong, and it means that while files with spaces and colons now
work, files with " marks in their names do not. Nevertheless, this is 
probably enough to get mingw to compile. I'll try again tomorrow-ish.

PS. Why does the MLton compiler reimplement tons of SML basis methods?

-- 
Wesley W. Terpstra

--BOKacYhQ+x31HxR3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="escape-files.patch"

Index: compile.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/compile.fun,v
retrieving revision 1.56
diff -u -r1.56 compile.fun
--- compile.fun	22 Dec 2004 05:11:25 -0000	1.56
+++ compile.fun	1 May 2005 03:34:19 -0000
@@ -319,7 +319,9 @@
    end
 
 fun sourceFilesMLB {input} =
-   Ast.Basdec.sourceFiles (lexAndParseMLB input)
+   Ast.Basdec.sourceFiles 
+      (lexAndParseMLB 
+         ("\"" ^ String.toString input ^ "\""))
 
 val elaborateMLB = Elaborate.elaborateMLB
 
@@ -614,7 +616,7 @@
    end handle Done => ()
 
 fun compileMLB {input: File.t, outputC, outputS}: unit =
-   compile {input = input,
+   compile {input = "\"" ^ String.toString input ^ "\"",
 	    outputC = outputC,
 	    outputS = outputS}
 
@@ -636,8 +638,12 @@
 	  | _ => 
 	       String.concat ["local\n",
 			      basis,
-			      "in\n",
-			      String.concat (List.separate (input, "\n")), "\n",
+			      "in\n\"",
+			      String.concat 
+			         (List.separate 
+			            (List.map (input, String.toString), 
+			             "\"\n\"")),
+			      "\"\n",
 			      "end\n"]
       end
 in

--BOKacYhQ+x31HxR3--