segfaults

This modules registers a signal handler that turns access violations / segfaults into a NilAccessError exception. To be able to catch a NilAccessError all you have to do is to import this module.

Tested on these OSes: Linux, Windows, OSX

Types

C_JmpBuf {...}{.importc: "jmp_buf", header: "<setjmp.h>".} = object
  Source Edit
CFilePtr = ptr CFile
The type representing a file handle.   Source Edit

Consts

SIGABRT = 22'i32
  Source Edit
SIGFPE = 8'i32
  Source Edit
SIGILL = 4'i32
  Source Edit
SIGINT = 2'i32
  Source Edit
SIGSEGV = 11'i32
  Source Edit

Procs

proc c_memchr(s: pointer; c: cint; n: csize): pointer {...}{.importc: "memchr",
    header: "<string.h>".}
  Source Edit
proc c_memcmp(a, b: pointer; size: csize): cint {...}{.importc: "memcmp",
    header: "<string.h>", noSideEffect.}
  Source Edit
proc c_memcpy(a, b: pointer; size: csize): pointer {...}{.importc: "memcpy",
    header: "<string.h>", discardable.}
  Source Edit
proc c_memmove(a, b: pointer; size: csize): pointer {...}{.importc: "memmove",
    header: "<string.h>", discardable.}
  Source Edit
proc c_memset(p: pointer; value: cint; size: csize): pointer {...}{.importc: "memset",
    header: "<string.h>", discardable.}
  Source Edit
proc c_strcmp(a, b: cstring): cint {...}{.importc: "strcmp", header: "<string.h>",
                                noSideEffect.}
  Source Edit
proc c_strlen(a: cstring): csize {...}{.importc: "strlen", header: "<string.h>", noSideEffect.}
  Source Edit
proc c_abort() {...}{.importc: "abort", header: "<stdlib.h>", noSideEffect, noreturn.}
  Source Edit
proc c_longjmp(jmpb: C_JmpBuf; retval: cint) {...}{.header: "<setjmp.h>", importc: "longjmp".}
  Source Edit
proc c_setjmp(jmpb: C_JmpBuf): cint {...}{.header: "<setjmp.h>", importc: "setjmp".}
  Source Edit
proc c_signal(sign: cint; handler: proc (a: cint) {...}{.noconv.}): CSighandlerT {...}{.
    importc: "signal", header: "<signal.h>", discardable.}
  Source Edit
proc c_fprintf(f: CFilePtr; frmt: cstring): cint {...}{.importc: "fprintf",
    header: "<stdio.h>", varargs, discardable.}
  Source Edit
proc c_printf(frmt: cstring): cint {...}{.importc: "printf", header: "<stdio.h>", varargs,
                                 discardable.}
  Source Edit
proc c_fputs(c: cstring; f: CFilePtr): cint {...}{.importc: "fputs", header: "<stdio.h>",
                                        discardable.}
  Source Edit
proc c_sprintf(buf, frmt: cstring): cint {...}{.importc: "sprintf", header: "<stdio.h>",
                                      varargs, noSideEffect.}
  Source Edit
proc c_malloc(size: csize): pointer {...}{.importc: "malloc", header: "<stdlib.h>".}
  Source Edit
proc c_free(p: pointer) {...}{.importc: "free", header: "<stdlib.h>".}
  Source Edit
proc c_realloc(p: pointer; newsize: csize): pointer {...}{.importc: "realloc",
    header: "<stdlib.h>".}
  Source Edit
proc c_fwrite(buf: pointer; size, n: csize; f: CFilePtr): cint {...}{.importc: "fwrite",
    header: "<stdio.h>".}
  Source Edit
proc rawWrite(f: CFilePtr; s: cstring) {...}{.compilerproc, nonReloadable, inline,
                                    raises: [], tags: [].}
  Source Edit