From 2e20f5648be180bd75670330db147df4e0d82688 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 28 Jan 2020 10:30:59 -0800 Subject: fix stdout(etc) for emscripten --- lib/system/ansi_c.nim | 7 ++++--- lib/system/io.nim | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') 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: "".}: 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: "".}: File -- cgit 1.4.1-2-gfad0