diff options
author | Joey <jyapayne@gmail.com> | 2018-06-27 19:35:09 +0900 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-06-27 12:35:09 +0200 |
commit | 559a7615ad8e2e169aa9684f034c156881d88d4d (patch) | |
tree | e93f1f2ff0a85a556a5d867c7f541cf3e995502b /lib/posix/posix.nim | |
parent | b74b16ffde64262eeea57f36816a1a4b2d0cedfd (diff) | |
download | Nim-559a7615ad8e2e169aa9684f034c156881d88d4d.tar.gz |
Nintendo switch support (#8069)
* Add config section for Nintendo Switch * Add compiler configuration for Nintendo Switch and it's CPU * Add specific lib code for Nintendo Switch * Add GC support for Nintendo Switch * Update changelog for Nintendo Switch * Update changelog with more info about fixed paths * Cleaned up GC memory management a bit * Relocate docs for Switch * Rename aarch64NoneElfGcc to nintendoSwitchGCC * Remove armv8a57 * Fix installer.ini * Reuse code in linux and amd64 * Add posix defs for nintendo switch * Add more defined sections for nintendo switch * Remove old comment * Add what's not supported for Nintendo Switch docs * Make nintendoswitch == posix * Remove DEVKITPRO references from nim.cfg * Make PR extccomp changes * Remove Result type alias * Add separate switch consts file * Update docs for nintendo switch * Fix travis errors with undefined consts and add correct wait.h procs
Diffstat (limited to 'lib/posix/posix.nim')
-rw-r--r-- | lib/posix/posix.nim | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index db5f575af..97b4124ec 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -94,6 +94,8 @@ const StatHasNanoseconds* = defined(linux) or defined(freebsd) or when defined(linux) and defined(amd64): include posix_linux_amd64 +elif defined(nintendoswitch): + include posix_nintendoswitch else: include posix_other @@ -185,7 +187,7 @@ proc fnmatch*(a1, a2: cstring, a3: cint): cint {.importc, header: "<fnmatch.h>". proc ftw*(a1: cstring, a2: proc (x1: cstring, x2: ptr Stat, x3: cint): cint {.noconv.}, a3: cint): cint {.importc, header: "<ftw.h>".} -when not (defined(linux) and defined(amd64)): +when not (defined(linux) and defined(amd64)) and not defined(nintendoswitch): proc nftw*(a1: cstring, a2: proc (x1: cstring, x2: ptr Stat, x3: cint, x4: ptr FTW): cint {.noconv.}, @@ -226,25 +228,26 @@ proc setlocale*(a1: cint, a2: cstring): cstring {. proc strfmon*(a1: cstring, a2: int, a3: cstring): int {.varargs, importc, header: "<monetary.h>".} -proc mq_close*(a1: Mqd): cint {.importc, header: "<mqueue.h>".} -proc mq_getattr*(a1: Mqd, a2: ptr MqAttr): cint {. - importc, header: "<mqueue.h>".} -proc mq_notify*(a1: Mqd, a2: ptr SigEvent): cint {. - importc, header: "<mqueue.h>".} -proc mq_open*(a1: cstring, a2: cint): Mqd {. - varargs, importc, header: "<mqueue.h>".} -proc mq_receive*(a1: Mqd, a2: cstring, a3: int, a4: var int): int {. - importc, header: "<mqueue.h>".} -proc mq_send*(a1: Mqd, a2: cstring, a3: int, a4: int): cint {. - importc, header: "<mqueue.h>".} -proc mq_setattr*(a1: Mqd, a2, a3: ptr MqAttr): cint {. - importc, header: "<mqueue.h>".} - -proc mq_timedreceive*(a1: Mqd, a2: cstring, a3: int, a4: int, - a5: ptr Timespec): int {.importc, header: "<mqueue.h>".} -proc mq_timedsend*(a1: Mqd, a2: cstring, a3: int, a4: int, - a5: ptr Timespec): cint {.importc, header: "<mqueue.h>".} -proc mq_unlink*(a1: cstring): cint {.importc, header: "<mqueue.h>".} +when not defined(nintendoswitch): + proc mq_close*(a1: Mqd): cint {.importc, header: "<mqueue.h>".} + proc mq_getattr*(a1: Mqd, a2: ptr MqAttr): cint {. + importc, header: "<mqueue.h>".} + proc mq_notify*(a1: Mqd, a2: ptr SigEvent): cint {. + importc, header: "<mqueue.h>".} + proc mq_open*(a1: cstring, a2: cint): Mqd {. + varargs, importc, header: "<mqueue.h>".} + proc mq_receive*(a1: Mqd, a2: cstring, a3: int, a4: var int): int {. + importc, header: "<mqueue.h>".} + proc mq_send*(a1: Mqd, a2: cstring, a3: int, a4: int): cint {. + importc, header: "<mqueue.h>".} + proc mq_setattr*(a1: Mqd, a2, a3: ptr MqAttr): cint {. + importc, header: "<mqueue.h>".} + + proc mq_timedreceive*(a1: Mqd, a2: cstring, a3: int, a4: int, + a5: ptr Timespec): int {.importc, header: "<mqueue.h>".} + proc mq_timedsend*(a1: Mqd, a2: cstring, a3: int, a4: int, + a5: ptr Timespec): cint {.importc, header: "<mqueue.h>".} + proc mq_unlink*(a1: cstring): cint {.importc, header: "<mqueue.h>".} proc getpwnam*(a1: cstring): ptr Passwd {.importc, header: "<pwd.h>".} @@ -603,7 +606,7 @@ proc posix_madvise*(a1: pointer, a2: int, a3: cint): cint {. importc, header: "<sys/mman.h>".} proc posix_mem_offset*(a1: pointer, a2: int, a3: var Off, a4: var int, a5: var cint): cint {.importc, header: "<sys/mman.h>".} -when not (defined(linux) and defined(amd64)): +when not (defined(linux) and defined(amd64)) and not defined(nintendoswitch): proc posix_typed_mem_get_info*(a1: cint, a2: var Posix_typed_mem_info): cint {.importc, header: "<sys/mman.h>".} proc posix_typed_mem_open*(a1: cstring, a2, a3: cint): cint {. @@ -713,12 +716,12 @@ proc sigwait*(a1: var Sigset, a2: var cint): cint {. proc sigwaitinfo*(a1: var Sigset, a2: var SigInfo): cint {. importc, header: "<signal.h>".} - -proc catclose*(a1: Nl_catd): cint {.importc, header: "<nl_types.h>".} -proc catgets*(a1: Nl_catd, a2, a3: cint, a4: cstring): cstring {. - importc, header: "<nl_types.h>".} -proc catopen*(a1: cstring, a2: cint): Nl_catd {. - importc, header: "<nl_types.h>".} +when not defined(nintendoswitch): + proc catclose*(a1: Nl_catd): cint {.importc, header: "<nl_types.h>".} + proc catgets*(a1: Nl_catd, a2, a3: cint, a4: cstring): cstring {. + importc, header: "<nl_types.h>".} + proc catopen*(a1: cstring, a2: cint): Nl_catd {. + importc, header: "<nl_types.h>".} proc sched_get_priority_max*(a1: cint): cint {.importc, header: "<sched.h>".} proc sched_get_priority_min*(a1: cint): cint {.importc, header: "<sched.h>".} @@ -800,11 +803,12 @@ when hasSpawnH: a4: var Tposix_spawnattr, a5, a6: cstringArray): cint {.importc, header: "<spawn.h>".} -proc getcontext*(a1: var Ucontext): cint {.importc, header: "<ucontext.h>".} -proc makecontext*(a1: var Ucontext, a4: proc (){.noconv.}, a3: cint) {. - varargs, importc, header: "<ucontext.h>".} -proc setcontext*(a1: var Ucontext): cint {.importc, header: "<ucontext.h>".} -proc swapcontext*(a1, a2: var Ucontext): cint {.importc, header: "<ucontext.h>".} +when not defined(nintendoswitch): + proc getcontext*(a1: var Ucontext): cint {.importc, header: "<ucontext.h>".} + proc makecontext*(a1: var Ucontext, a4: proc (){.noconv.}, a3: cint) {. + varargs, importc, header: "<ucontext.h>".} + proc setcontext*(a1: var Ucontext): cint {.importc, header: "<ucontext.h>".} + proc swapcontext*(a1, a2: var Ucontext): cint {.importc, header: "<ucontext.h>".} proc readv*(a1: cint, a2: ptr IOVec, a3: cint): int {. importc, header: "<sys/uio.h>".} |