[MLton-commit] r6980

Ville Laurikari ville at mlton.org
Thu Nov 6 11:23:13 PST 2008


Improved automatic libname inference to convert characters not allowed
in C identifiers or macro names to underscores.  The fairly common
case where the output name has dashes now gets a working export
header, without having to explicitly give a libname.

----------------------------------------------------------------------

U   mlton/trunk/mlton/main/main.fun

----------------------------------------------------------------------

Modified: mlton/trunk/mlton/main/main.fun
===================================================================
--- mlton/trunk/mlton/main/main.fun	2008-11-06 18:50:29 UTC (rev 6979)
+++ mlton/trunk/mlton/main/main.fun	2008-11-06 19:23:13 UTC (rev 6980)
@@ -1167,9 +1167,10 @@
                         if String.hasPrefix (defLibname, {prefix = "lib"})
                         then String.extract (defLibname, 3, NONE)
                         else defLibname
+                     fun toAlNum c = if Char.isAlphaNum c then c else #"_"
                      val () =
                         if !libname <> "" then () else
-                        libname := defLibname
+                        libname := CharVector.map toAlNum defLibname
                      (* Library output includes a header by default *)
                      val () =
                         case (!format, !exportHeader) of




More information about the MLton-commit mailing list