diff options
author | Araq <rumpf_a@web.de> | 2012-01-08 20:18:24 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-01-08 20:18:24 +0100 |
commit | d34345586ff276e25778a94fb268ceccde1daf26 (patch) | |
tree | a7f4d95515290ec404b4d21207aa359830997c82 /lib/system.nim | |
parent | 202972dea0c4abc87a1733212039d4656f2d2258 (diff) | |
download | Nim-d34345586ff276e25778a94fb268ceccde1daf26.tar.gz |
unsuccessful phantom bug hunting
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-x | lib/system.nim | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/lib/system.nim b/lib/system.nim index 274b8d94e..ff0839b69 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -808,9 +808,34 @@ when hasThreadSupport: else: {.pragma: rtlThreadVar.} +const + QuitSuccess* = 0 + ## is the value that should be passed to ``quit`` to indicate + ## success. + + QuitFailure* = 1 + ## is the value that should be passed to ``quit`` to indicate + ## failure. + +var program_result* {.exportc: "nim_$1".} = QuitSuccess + ## modify this varialbe to specify the exit code of the program + ## under normal circumstances. when the program is terminated + ## prematurelly using ``quit``, this value is ignored. + +proc quit*(errorcode: int = QuitSuccess) {. + magic: "Exit", importc: "exit", noDecl, noReturn.} + ## stops the program immediately; before stopping the program the + ## "quit procedures" are called in the opposite order they were added + ## with ``addQuitProc``. ``quit`` never returns and ignores any + ## exception that may have been raised by the quit procedures. + ## It does *not* call the garbage collector to free all the memory, + ## unless a quit procedure calls ``GC_collect``. + template sysAssert(cond, msg: expr) = # change this to activate system asserts - #if not cond: echo "[SYSASSERT] ", msg + #if not cond: + # echo "[SYSASSERT] ", msg + # quit 1 nil include "system/inclrtl" @@ -1530,29 +1555,6 @@ template newException*(exceptn, message: expr): expr = e.msg = message e -const - QuitSuccess* = 0 - ## is the value that should be passed to ``quit`` to indicate - ## success. - - QuitFailure* = 1 - ## is the value that should be passed to ``quit`` to indicate - ## failure. - -var program_result* {.exportc: "nim_$1".} = QuitSuccess - ## modify this varialbe to specify the exit code of the program - ## under normal circumstances. when the program is terminated - ## prematurelly using ``quit``, this value is ignored. - -proc quit*(errorcode: int = QuitSuccess) {. - magic: "Exit", importc: "exit", noDecl, noReturn.} - ## stops the program immediately; before stopping the program the - ## "quit procedures" are called in the opposite order they were added - ## with ``addQuitProc``. ``quit`` never returns and ignores any - ## exception that may have been raised by the quit procedures. - ## It does *not* call the garbage collector to free all the memory, - ## unless a quit procedure calls ``GC_collect``. - when not defined(EcmaScript) and not defined(NimrodVM): {.push stack_trace: off.} |