From a95c0608b9694d14654eeea449ae28c1340eab60 Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 1 Sep 2013 17:29:29 +0200 Subject: [PATCH] some fixes for Haiku --- config/nimrod.cfg | 3 +- lib/posix/posix.nim | 92 +++++++++++++++++++++++---------------------- 2 files changed, 50 insertions(+), 45 deletions(-) diff --git a/config/nimrod.cfg b/config/nimrod.cfg index c50051086b..77cc742b22 100644 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -67,7 +67,8 @@ hint[LineTooLong]=off gpp.options.linker = "-ldl" clang.options.linker = "-ldl" tcc.options.linker = "-ldl" - @else: + @end + @if bsd or haiku: # BSD got posix_spawn only recently, so we deactivate it for osproc: define:useFork # at least NetBSD has problems with thread local storage: diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index 57b683c3a4..cf260e9b70 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -30,7 +30,7 @@ from times import TTime const - hasSpawnH = true # should exist for every Posix system really nowadays + hasSpawnH = not defined(haiku) # should exist for every Posix system nowadays hasAioH = defined(linux) when false: @@ -842,48 +842,51 @@ var FE_UPWARD* {.importc, header: "".}: cint FE_DFL_ENV* {.importc, header: "".}: cint - MM_HARD* {.importc, header: "".}: cint - ## Source of the condition is hardware. - MM_SOFT* {.importc, header: "".}: cint - ## Source of the condition is software. - MM_FIRM* {.importc, header: "".}: cint - ## Source of the condition is firmware. - MM_APPL* {.importc, header: "".}: cint - ## Condition detected by application. - MM_UTIL* {.importc, header: "".}: cint - ## Condition detected by utility. - MM_OPSYS* {.importc, header: "".}: cint - ## Condition detected by operating system. - MM_RECOVER* {.importc, header: "".}: cint - ## Recoverable error. - MM_NRECOV* {.importc, header: "".}: cint - ## Non-recoverable error. - MM_HALT* {.importc, header: "".}: cint - ## Error causing application to halt. - MM_ERROR* {.importc, header: "".}: cint - ## Application has encountered a non-fatal fault. - MM_WARNING* {.importc, header: "".}: cint - ## Application has detected unusual non-error condition. - MM_INFO* {.importc, header: "".}: cint - ## Informative message. - MM_NOSEV* {.importc, header: "".}: cint - ## No severity level provided for the message. - MM_PRINT* {.importc, header: "".}: cint - ## Display message on standard error. - MM_CONSOLE* {.importc, header: "".}: cint - ## Display message on system console. +when not defined(haiku): + var + MM_HARD* {.importc, header: "".}: cint + ## Source of the condition is hardware. + MM_SOFT* {.importc, header: "".}: cint + ## Source of the condition is software. + MM_FIRM* {.importc, header: "".}: cint + ## Source of the condition is firmware. + MM_APPL* {.importc, header: "".}: cint + ## Condition detected by application. + MM_UTIL* {.importc, header: "".}: cint + ## Condition detected by utility. + MM_OPSYS* {.importc, header: "".}: cint + ## Condition detected by operating system. + MM_RECOVER* {.importc, header: "".}: cint + ## Recoverable error. + MM_NRECOV* {.importc, header: "".}: cint + ## Non-recoverable error. + MM_HALT* {.importc, header: "".}: cint + ## Error causing application to halt. + MM_ERROR* {.importc, header: "".}: cint + ## Application has encountered a non-fatal fault. + MM_WARNING* {.importc, header: "".}: cint + ## Application has detected unusual non-error condition. + MM_INFO* {.importc, header: "".}: cint + ## Informative message. + MM_NOSEV* {.importc, header: "".}: cint + ## No severity level provided for the message. + MM_PRINT* {.importc, header: "".}: cint + ## Display message on standard error. + MM_CONSOLE* {.importc, header: "".}: cint + ## Display message on system console. - MM_OK* {.importc, header: "".}: cint - ## The function succeeded. - MM_NOTOK* {.importc, header: "".}: cint - ## The function failed completely. - MM_NOMSG* {.importc, header: "".}: cint - ## The function was unable to generate a message on standard error, - ## but otherwise succeeded. - MM_NOCON* {.importc, header: "".}: cint - ## The function was unable to generate a console message, but - ## otherwise succeeded. - + MM_OK* {.importc, header: "".}: cint + ## The function succeeded. + MM_NOTOK* {.importc, header: "".}: cint + ## The function failed completely. + MM_NOMSG* {.importc, header: "".}: cint + ## The function was unable to generate a message on standard error, + ## but otherwise succeeded. + MM_NOCON* {.importc, header: "".}: cint + ## The function was unable to generate a console message, but + ## otherwise succeeded. + +var FNM_NOMATCH* {.importc, header: "".}: cint ## The string does not match the specified pattern. FNM_PATHNAME* {.importc, header: "".}: cint @@ -1809,8 +1812,9 @@ proc feholdexcept*(a1: ptr Tfenv): cint {.importc, header: "".} proc fesetenv*(a1: ptr Tfenv): cint {.importc, header: "".} proc feupdateenv*(a1: ptr TFenv): cint {.importc, header: "".} -proc fmtmsg*(a1: int, a2: cstring, a3: cint, - a4, a5, a6: cstring): cint {.importc, header: "".} +when not defined(haiku): + proc fmtmsg*(a1: int, a2: cstring, a3: cint, + a4, a5, a6: cstring): cint {.importc, header: "".} proc fnmatch*(a1, a2: cstring, a3: cint): cint {.importc, header: "".} proc ftw*(a1: cstring,