[MLton-commit] r6994

Ville Laurikari ville at mlton.org
Thu Nov 27 05:20:46 PST 2008


Added support in mlton.bat for setting runtime arguments.

Replaced the "-cc-opt O1" hack with a "-pause" option.  It is handled
entirely by mlton.bat.

Fixed mlton.bat to return the exit status from the mlton-compile
invocation.

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

U   mlton/trunk/package/mingw/mlton.bat
U   mlton/trunk/package/mingw/mlton.wxs

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

Modified: mlton/trunk/package/mingw/mlton.bat
===================================================================
--- mlton/trunk/package/mingw/mlton.bat	2008-11-25 11:10:37 UTC (rev 6993)
+++ mlton/trunk/package/mingw/mlton.bat	2008-11-27 13:20:45 UTC (rev 6994)
@@ -15,7 +15,7 @@
 if not exist "%bin%" (
   echo MLton directory "%bin%" does not exist
   goto :eof
-) 
+)
 
 if not exist "%lib%" (
   echo MLton library directory "%lib%" does not exist
@@ -31,6 +31,36 @@
 rem gcc needs to be pathed to find as, ld, etc
 set PATH=%bin%;%PATH%
 
+rem Check if invoked with special option (via explorer).
+set pause=
+if "%1" == "-pause" (
+  set pause=yes
+  shift
+)
+
+rem Put runtime arguments to %rargs% and the rest to %args%.
+set args=
+set rargs=
+if not "%1" == "@MLton" goto args_loop
+:rargs_loop
+shift
+if "%~1" == "" (
+  echo @MLton missing --
+  goto :eof
+)
+if "%1" == "--" (
+  shift
+  goto :args_loop
+)
+set rargs=%rargs% %1
+goto :rargs_loop
+:args_loop
+if "%~1" == "" goto args_done
+set args=%args% %1
+shift
+goto args_loop
+:args_done
+
 set world=%lib%\world.mlton
 set mlton=%lib%\mlton-compile.exe
 
@@ -39,11 +69,8 @@
 set ccopts=%ccopts% -malign-functions=5 -malign-jumps=2 -malign-loops=2
 set linkopts=-lm -lgmp -lws2_32 -lkernel32 -lpsapi -lnetapi32 -lwinmm -Wl,--enable-stdcall-fixup
 
-"%mlton%" @MLton load-world "%world%" ram-slop 0.5 -- "%lib%" -cc "%cc%" -ar-script "%bin%\static-library.bat" -cc-opt-quote "-I%lib%\include" -cc-opt "%ccopts%" -mlb-path-map "%lib%\mlb-path-map" -link-opt "%linkopts%" %*
+"%mlton%" @MLton load-world "%world%" ram-slop 0.5 %rargs% -- "%lib%" -cc "%cc%" -ar-script "%bin%\static-library.bat" -cc-opt-quote "-I%lib%\include" -cc-opt "%ccopts%" -mlb-path-map "%lib%\mlb-path-map" -link-opt "%linkopts%" %args%
+set retval=%errorlevel%
 
-rem If invoked with special useless option, pause output (done via explorer)
-if "%1" == "-cc-opt" (
-  if "%2" == "-O1" (
-    pause
-  )
-)
+if "%pause%" == "yes" pause
+exit /b %_retval%

Modified: mlton/trunk/package/mingw/mlton.wxs
===================================================================
--- mlton/trunk/package/mingw/mlton.wxs	2008-11-25 11:10:37 UTC (rev 6993)
+++ mlton/trunk/package/mingw/mlton.wxs	2008-11-27 13:20:45 UTC (rev 6994)
@@ -52,12 +52,12 @@
         <File Id='file.bin_mlb.ico' Name='mlb.ico' Source='mlb.ico' DiskId='1' Vital='yes' />
         <ProgId Id='MLton.mlbFile' Description='Standard ML basis file' Icon='file.bin_mlb.ico'>
           <Extension Id='mlb' ContentType='application/mlb'>
-            <Verb Id='buildMLB' Command='Compile' TargetFile='file.bin_mlton.bat' Argument='-cc-opt -O1 -verbose 1 "%1"' />
+            <Verb Id='buildMLB' Command='Compile' TargetFile='file.bin_mlton.bat' Argument='-pause -verbose 1 "%1"' />
           </Extension>
         </ProgId>
         <ProgId Id='MLton.smlFile' Description='Standard ML source file' Icon='file.bin_sml.ico'>
           <Extension Id='sml' ContentType='application/sml'>
-            <Verb Id='buildSML' Command='Compile' TargetFile='file.bin_mlton.bat' Argument='-cc-opt -O1 -verbose 1 "%1"' />
+            <Verb Id='buildSML' Command='Compile' TargetFile='file.bin_mlton.bat' Argument='-pause -verbose 1 "%1"' />
           </Extension>
         </ProgId>
       </Component>
@@ -71,7 +71,7 @@
         </Shortcut>
       </Component>
     </DirectoryRef>
-   
+
     <Feature Id='MLton' Title='MLton' Description='A whole-program optimizing Standard ML compiler.' Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR' AllowAdvertise='no'>
       <ComponentGroupRef Id='component.MLton' />
       <ComponentRef Id='component.bin_mlton.bat' />
@@ -114,9 +114,9 @@
     </Feature>
 
     <UIRef Id="WixUI_Mondo" />
-    <WixVariable Id="WixUIBannerBmp" Value="Bitmaps/bannrbmp.bmp" />  
-    <WixVariable Id="WixUIDialogBmp" Value="Bitmaps/dlgbmp.bmp" />  
-    <WixVariable Id="WixUILicenseRtf" Value="License.rtf" /> 
-    <Property Id='WIXUI_INSTALLDIR' Value='INSTALLDIR' /> 
+    <WixVariable Id="WixUIBannerBmp" Value="Bitmaps/bannrbmp.bmp" />
+    <WixVariable Id="WixUIDialogBmp" Value="Bitmaps/dlgbmp.bmp" />
+    <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
+    <Property Id='WIXUI_INSTALLDIR' Value='INSTALLDIR' />
   </Product>
 </Wix>




More information about the MLton-commit mailing list