diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-01-28 10:30:59 -0800 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2020-01-28 23:36:24 +0000 |
commit | 2e20f5648be180bd75670330db147df4e0d82688 (patch) | |
tree | c598bddbea54ef7e52f11642b21bfaa758202d24 /lib | |
parent | 9657a836983feba31c8fe22d8dead78d8f94cfa1 (diff) | |
download | Nim-2e20f5648be180bd75670330db147df4e0d82688.tar.gz |
fix stdout(etc) for emscripten
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/ansi_c.nim | 7 | ||||
-rw-r--r-- | lib/system/io.nim | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 6649e9517..cb2303b61 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -117,9 +117,10 @@ type CFilePtr* = ptr CFile ## The type representing a file handle. # duplicated between io and ansi_c -const stderrName = when defined(osx): "__stderrp" else: "stderr" -const stdoutName = when defined(osx): "__stdoutp" else: "stdout" -const stdinName = when defined(osx): "__stdinp" else: "stdin" +const stdioUsesMacros = defined(osx) and not defined(emscripten) +const stderrName = when stdioUsesMacros: "__stderrp" else: "stderr" +const stdoutName = when stdioUsesMacros: "__stdoutp" else: "stdout" +const stdinName = when stdioUsesMacros: "__stdinp" else: "stdin" var cstderr* {.importc: stderrName, header: "<stdio.h>".}: CFilePtr diff --git a/lib/system/io.nim b/lib/system/io.nim index 41716f9af..8e3acd0b9 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -36,9 +36,10 @@ type # text file handling: when not defined(nimscript) and not defined(js): # duplicated between io and ansi_c - const stderrName = when defined(osx): "__stderrp" else: "stderr" - const stdoutName = when defined(osx): "__stdoutp" else: "stdout" - const stdinName = when defined(osx): "__stdinp" else: "stdin" + const stdioUsesMacros = defined(osx) and not defined(emscripten) + const stderrName = when stdioUsesMacros: "__stderrp" else: "stderr" + const stdoutName = when stdioUsesMacros: "__stdoutp" else: "stdout" + const stdinName = when stdioUsesMacros: "__stdinp" else: "stdin" var stdin* {.importc: stdinName, header: "<stdio.h>".}: File |