Skip to content

Commit

Permalink
Add Wasm32 and WASI to Arch and OS structures
Browse files Browse the repository at this point in the history
  • Loading branch information
agoode committed May 16, 2024
1 parent 008a6d5 commit 94e4af4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions basis-library/mlton/platform.sig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ signature MLTON_PLATFORM =
structure Arch:
sig
datatype t = Alpha | AMD64 | ARM | ARM64 | HPPA | IA64 | LoongArch64 | m68k |
MIPS | PowerPC | PowerPC64 | RISCV | S390 | Sparc | X86
MIPS | PowerPC | PowerPC64 | RISCV | S390 | Sparc | Wasm32 | X86

val fromString: string -> t option
val host: t
Expand All @@ -29,7 +29,7 @@ signature MLTON_PLATFORM =
structure OS:
sig
datatype t = AIX | Cygwin | Darwin | FreeBSD | Hurd | HPUX
| Linux | MinGW | NetBSD | OpenBSD | Solaris
| Linux | MinGW | NetBSD | OpenBSD | Solaris | WASI

val fromString: string -> t option
val host: t
Expand Down
6 changes: 6 additions & 0 deletions basis-library/mlton/platform.sml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ structure MLtonPlatform: MLTON_PLATFORM =
| RISCV
| S390
| Sparc
| Wasm32
| X86

val all =
Expand All @@ -61,6 +62,7 @@ structure MLtonPlatform: MLTON_PLATFORM =
(RISCV, "RISCV")::
(S390, "S390")::
(Sparc, "Sparc")::
(Wasm32, "Wasm32")::
(X86, "X86")::
nil

Expand All @@ -83,6 +85,7 @@ structure MLtonPlatform: MLTON_PLATFORM =
| "riscv" => RISCV
| "s390" => S390
| "sparc" => Sparc
| "wasm32" => Wasm32
| "x86" => X86
| _ => raise Fail "strange MLton_Platform_Arch_host"
end
Expand Down Expand Up @@ -128,6 +131,7 @@ structure MLtonPlatform: MLTON_PLATFORM =
| NetBSD
| OpenBSD
| Solaris
| WASI

val all =
(AIX, "AIX")::
Expand All @@ -141,6 +145,7 @@ structure MLtonPlatform: MLTON_PLATFORM =
(NetBSD, "NetBSD")::
(OpenBSD, "OpenBSD")::
(Solaris, "Solaris")::
(WASI, "WASI")::
nil

val (fromString, toString) = fromString_toString all
Expand All @@ -159,6 +164,7 @@ structure MLtonPlatform: MLTON_PLATFORM =
| "netbsd" => NetBSD
| "openbsd" => OpenBSD
| "solaris" => Solaris
| "wasi" => WASI
| _ => raise Fail "strange MLton_Platform_OS_host"
end
end
1 change: 1 addition & 0 deletions basis-library/sml-nj/sml-nj.sml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ structure SMLofNJ: SML_OF_NJ =
| NetBSD => UNIX
| OpenBSD => UNIX
| Solaris => UNIX
| WASI => UNIX
end

fun getOSName () = MLton.Platform.OS.toString MLton.Platform.OS.host
Expand Down
3 changes: 2 additions & 1 deletion mlton/main/main.fun
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,8 @@ fun commandLine (_: string, args: string list): unit =
| MinGW => true
| NetBSD => true
| OpenBSD => true
| Solaris => true)
| Solaris => true
| WASI => false)
then ()
else usage (concat ["can't use -profile time on ",
MLton.Platform.OS.toString targetOS])
Expand Down

0 comments on commit 94e4af4

Please sign in to comment.