From 30f8568570462f158e6928c3de8d41ea42cb39fd Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 30 Jun 2013 22:10:04 +0200 Subject: [PATCH] fixes --os:standalone --- lib/system.nim | 8 +++++--- lib/system/ansi_c.nim | 11 ++++++----- tests/manyloc/standalone/barebone.nim | 4 +++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/system.nim b/lib/system.nim index dabe6d9ced..b60ccc306f 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1889,9 +1889,11 @@ when not defined(JS): #and not defined(NimrodVM): # text file handling: var - stdin* {.importc: "stdin", noDecl.}: TFile ## The standard input stream. - stdout* {.importc: "stdout", noDecl.}: TFile ## The standard output stream. - stderr* {.importc: "stderr", noDecl.}: TFile + stdin* {.importc: "stdin", header: "".}: TFile + ## The standard input stream. + stdout* {.importc: "stdout", header: "".}: TFile + ## The standard output stream. + stderr* {.importc: "stderr", header: "".}: TFile ## The standard error stream. ## ## Note: In my opinion, this should not be used -- the concept of a diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 8c187ab74c..a22c2b0692 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -34,9 +34,9 @@ type C_JmpBuf {.importc: "jmp_buf", header: "".} = array[0..31, int] var - c_stdin {.importc: "stdin", header: "".}: C_TextFileStar - c_stdout {.importc: "stdout", header: "".}: C_TextFileStar - c_stderr {.importc: "stderr", header: "".}: C_TextFileStar + c_stdin {.importc: "stdin", nodecl.}: C_TextFileStar + c_stdout {.importc: "stdout", nodecl.}: C_TextFileStar + c_stderr {.importc: "stderr", nodecl.}: C_TextFileStar # constants faked as variables: when not defined(SIGINT): @@ -109,8 +109,9 @@ proc c_free(p: pointer) {.importc: "free", header: "".} proc c_realloc(p: pointer, newsize: int): pointer {. importc: "realloc", header: "".} -when not defined(errno): - var errno {.importc, header: "".}: cint ## error variable +when hostOS != "standalone": + when not defined(errno): + var errno {.importc, header: "".}: cint ## error variable proc strerror(errnum: cint): cstring {.importc, header: "".} proc c_remove(filename: CString): cint {. diff --git a/tests/manyloc/standalone/barebone.nim b/tests/manyloc/standalone/barebone.nim index 118328d82e..6b452ead04 100644 --- a/tests/manyloc/standalone/barebone.nim +++ b/tests/manyloc/standalone/barebone.nim @@ -1,4 +1,6 @@ proc printf(frmt: cstring) {.varargs, header: "", cdecl.} -printf("hi %ld\n", 4777) +var x = 0 +inc x +printf("hi %ld\n", x+4777)