diff options
author | Jacek Sieka <arnetheduck@gmail.com> | 2016-06-05 20:16:26 +0800 |
---|---|---|
committer | Jacek Sieka <arnetheduck@gmail.com> | 2016-06-05 20:16:26 +0800 |
commit | fe2b39f0074e732b24d6993dd6a0b0947bd511e2 (patch) | |
tree | e73eb450d9530f692516c63aac7d7c1d596c6287 /lib/system | |
parent | 64b0485207f428ce3941061b1c165ec8004b2c96 (diff) | |
download | Nim-fe2b39f0074e732b24d6993dd6a0b0947bd511e2.tar.gz |
remove system/ansi_c include from os
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/ansi_c.nim | 26 | ||||
-rw-r--r-- | lib/system/debugger.nim | 4 | ||||
-rw-r--r-- | lib/system/excpt.nim | 2 | ||||
-rw-r--r-- | lib/system/sysstr.nim | 2 |
4 files changed, 4 insertions, 30 deletions
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim index 089563f22..ff4d32713 100644 --- a/lib/system/ansi_c.nim +++ b/lib/system/ansi_c.nim @@ -25,8 +25,6 @@ proc c_memset(p: pointer, value: cint, size: csize): pointer {. importc: "memset", header: "<string.h>", discardable.} proc c_strcmp(a, b: cstring): cint {. importc: "strcmp", header: "<string.h>", noSideEffect.} -proc c_strlen(a: cstring): cint {. - importc: "strlen", header: "<string.h>", noSideEffect.} type C_JmpBuf {.importc: "jmp_buf", header: "<setjmp.h>".} = object @@ -112,28 +110,4 @@ proc c_free(p: pointer) {. proc c_realloc(p: pointer, newsize: csize): pointer {. importc: "realloc", header: "<stdlib.h>".} -when hostOS != "standalone": - when not declared(errno): - when defined(NimrodVM): - var vmErrnoWrapper {.importc.}: ptr cint - template errno: expr = - bind vmErrnoWrapper - vmErrnoWrapper[] - else: - var errno {.importc, header: "<errno.h>".}: cint ## error variable -proc c_strerror(errnum: cint): cstring {. - importc: "strerror", header: "<string.h>".} - -proc c_remove(filename: cstring): cint {. - importc: "remove", header: "<stdio.h>".} -proc c_rename(oldname, newname: cstring): cint {. - importc: "rename", header: "<stdio.h>".} - -proc c_system(cmd: cstring): cint {. - importc: "system", header: "<stdlib.h>".} -proc c_getenv(env: cstring): cstring {. - importc: "getenv", header: "<stdlib.h>".} -proc c_putenv(env: cstring): cint {. - importc: "putenv", header: "<stdlib.h>".} - {.pop} diff --git a/lib/system/debugger.nim b/lib/system/debugger.nim index b18c61755..55f14e982 100644 --- a/lib/system/debugger.nim +++ b/lib/system/debugger.nim @@ -108,8 +108,8 @@ proc fileMatches(c, bp: cstring): bool = # and the character for the suffix does not exist or # is one of: \ / : # depending on the OS case does not matter! - var blen: int = c_strlen(bp) - var clen: int = c_strlen(c) + var blen: int = bp.len + var clen: int = c.len if blen > clen: return false # check for \ / : if clen-blen-1 >= 0 and c[clen-blen-1] notin {'\\', '/', ':'}: diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 948f87410..526e27c83 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -255,7 +255,7 @@ proc raiseExceptionAux(e: ref Exception) = add(buf, "Error: unhandled exception: ") if not isNil(e.msg): add(buf, e.msg) add(buf, " [") - xadd(buf, e.name, c_strlen(e.name)) + xadd(buf, e.name, e.name.len) add(buf, "]\n") showErrorMessage(buf) quitOrDebug() diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim index e67a3e56a..569470aa2 100644 --- a/lib/system/sysstr.nim +++ b/lib/system/sysstr.nim @@ -85,7 +85,7 @@ proc toNimStr(str: cstring, len: int): NimString {.compilerProc.} = copyMem(addr(result.data), str, len + 1) proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} = - result = toNimStr(str, c_strlen(str)) + result = toNimStr(str, str.len) proc copyString(src: NimString): NimString {.compilerRtl.} = if src != nil: |