diff options
author | Stefan Walter <stefan@FreeBSD.org> | 2008-12-10 08:44:24 +0000 |
---|---|---|
committer | Stefan Walter <stefan@FreeBSD.org> | 2008-12-10 08:44:24 +0000 |
commit | 776ae1fb28c071b452a0a87d4fd8229fd6fe52bc (patch) | |
tree | bcb21365b15a551c8fb42468af4e2435f06bc618 /lang/mlton/files/upgrade-basis.sml | |
parent | 2866bad5d8f309ae06232bf90db08d4419624a0c (diff) | |
download | ports-776ae1fb28c071b452a0a87d4fd8229fd6fe52bc.tar.gz ports-776ae1fb28c071b452a0a87d4fd8229fd6fe52bc.zip |
Notes
Diffstat (limited to 'lang/mlton/files/upgrade-basis.sml')
-rw-r--r-- | lang/mlton/files/upgrade-basis.sml | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/lang/mlton/files/upgrade-basis.sml b/lang/mlton/files/upgrade-basis.sml new file mode 100644 index 000000000000..7235efc7d47b --- /dev/null +++ b/lang/mlton/files/upgrade-basis.sml @@ -0,0 +1,68 @@ +structure MLton = + struct + open MLton + + structure Platform = + struct + fun peek (l, f) = List.find f l + fun omap (opt, f) = Option.map f opt + val toLower = String.translate (str o Char.toLower) + + structure Arch = + struct + datatype t = Alpha | AMD64 | ARM | HPPA | IA64 | m68k | + MIPS | PowerPC | S390 | Sparc | X86 + + val all = [(Alpha, "Alpha"), + (AMD64, "AMD64"), + (ARM, "ARM"), + (HPPA, "HPPA"), + (IA64, "IA64"), + (m68k, "m68k"), + (MIPS, "MIPS"), + (PowerPC, "PowerPC"), + (S390, "S390"), + (Sparc, "Sparc"), + (X86, "X86")] + + fun fromString s = + let + val s = toLower s + in + omap (peek (all, fn (_, s') => s = toLower s'), #1) + end + + val host = X86 + + fun toString a = #2 (valOf (peek (all, fn (a', _) => a = a'))) + end + + structure OS = + struct + datatype t = AIX | Cygwin | Darwin | FreeBSD | HPUX | Linux + | MinGW | NetBSD | OpenBSD | Solaris + + val all = [(AIX, "AIX"), + (Cygwin, "Cygwin"), + (Darwin, "Darwin"), + (FreeBSD, "FreeBSD"), + (HPUX, "HPUX"), + (Linux, "Linux"), + (MinGW, "MinGW"), + (NetBSD, "NetBSD"), + (OpenBSD, "OpenBSD"), + (Solaris, "Solaris")] + + fun fromString s = + let + val s = toLower s + in + omap (peek (all, fn (_, s') => s = toLower s'), #1) + end + + val host = FreeBSD + + fun toString a = #2 (valOf (peek (all, fn (a', _) => a = a'))) + end + end + end |