make it work with latest system.nim

This commit is contained in:
Andreas Rumpf 2019-02-08 17:41:34 +01:00
commit ec68d89e42

View file

@ -3001,6 +3001,9 @@ template newException*(exceptn: typedesc, message: string;
when hostOS == "standalone": when hostOS == "standalone":
include "$projectpath/panicoverride" include "$projectpath/panicoverride"
when not defined(js) and not defined(nimscript):
include "system/ansi_c"
when not declared(sysFatal): when not declared(sysFatal):
{.push profiler: off.} {.push profiler: off.}
when hostOS == "standalone": when hostOS == "standalone":
@ -3010,17 +3013,8 @@ when not declared(sysFatal):
proc sysFatal(exceptn: typedesc, message, arg: string) {.inline.} = proc sysFatal(exceptn: typedesc, message, arg: string) {.inline.} =
rawoutput(message) rawoutput(message)
panic(arg) panic(arg)
elif defined(nimQuirky): elif defined(nimQuirky) and not defined(nimscript):
proc name(t: typedesc): string {.magic: "TypeTrait".} proc name(t: typedesc): string {.magic: "TypeTrait".}
proc sysFatal(exceptn: typedesc, message: string) {.inline, noReturn.} =
var buf = newStringOfCap(200)
add(buf, "Error: unhandled exception: ")
add(buf, message)
add(buf, " [")
add(buf, name exceptn)
add(buf, "]")
echo buf
quit 1
proc sysFatal(exceptn: typedesc, message, arg: string) {.inline, noReturn.} = proc sysFatal(exceptn: typedesc, message, arg: string) {.inline, noReturn.} =
var buf = newStringOfCap(200) var buf = newStringOfCap(200)
@ -3030,8 +3024,11 @@ when not declared(sysFatal):
add(buf, " [") add(buf, " [")
add(buf, name exceptn) add(buf, name exceptn)
add(buf, "]") add(buf, "]")
echo buf cstderr.rawWrite buf
quit 1 quit 1
proc sysFatal(exceptn: typedesc, message: string) {.inline, noReturn.} =
sysFatal(exceptn, message, "")
else: else:
proc sysFatal(exceptn: typedesc, message: string) {.inline, noReturn.} = proc sysFatal(exceptn: typedesc, message: string) {.inline, noReturn.} =
var e: ref exceptn var e: ref exceptn
@ -3178,7 +3175,6 @@ when not defined(JS): #and not defined(nimscript):
{.pop.} {.pop.}
when not defined(nimscript): when not defined(nimscript):
include "system/ansi_c"
include "system/memory" include "system/memory"
proc zeroMem(p: pointer, size: Natural) = proc zeroMem(p: pointer, size: Natural) =