mlb path map variable TARGET_OS_FLAVOR
Christopher Cramer <[email protected]> Mon, 30 Jan 2012 00:07:03 -0500
| Newsgroups | gmane.comp.lang.ml.mlton.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi
We have this MLB path map variable TARGET_OS which can be used for
conditional compilation. However, most of the time the differences
between different Unixes are not even visible from SML, so it would be
nice to just select between Windows and Unix.
This is a patch which adds a new variable, TARGET_OS_FLAVOR, which can
be either "unix" or "windows". Cygwin sort of straddles both categories,
but I decided that it's better to choose the most efficient implementation
(e.g. spawn versus fork - fork works on Cygwin but it's much slower),
so I went with "windows" for Cygwin.
Index: mlton/control/control-flags.sml
===================================================================
--- mlton/control/control-flags.sml (revision 7558)
+++ mlton/control/control-flags.sml (working copy)
@@ -1036,6 +1036,23 @@
{var = "TARGET_OS",
path = String.toLower (MLton.Platform.OS.toString
(!Target.os))},
+ {var = "TARGET_OS_FLAVOR",
+ path =
+ let
+ datatype z = datatype MLton.Platform.OS.t
+ in
+ case !Target.os of
+ AIX => "unix"
+ | Cygwin => "windows"
+ | Darwin => "unix"
+ | FreeBSD => "unix"
+ | HPUX => "unix"
+ | Linux => "unix"
+ | MinGW => "windows"
+ | NetBSD => "unix"
+ | OpenBSD => "unix"
+ | Solaris => "unix"
+ end},
{var = "OBJPTR_REP",
path = (case Bits.toInt (Target.Size.objptr ()) of
32 => "rep32"
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2