fix stdout(etc) for emscripten

This commit is contained in:
Timothee Cour
2020-01-28 10:30:59 -08:00
committed by Dominik Picheta
parent 9657a83698
commit 2e20f5648b
2 changed files with 8 additions and 6 deletions

View File

@@ -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

View File

@@ -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