Files
Nim/lib/system/embedded.nim
Jacek Sieka 7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00

47 lines
1.6 KiB
Nim

#
#
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# Bare-bones implementation of some things for embedded targets.
proc chckIndx(i, a, b: int): int {.inline, compilerproc.}
proc chckRange(i, a, b: int): int {.inline, compilerproc.}
proc chckRangeF(x, a, b: float): float {.inline, compilerproc.}
proc chckNil(p: pointer) {.inline, compilerproc.}
proc nimFrame(s: PFrame) {.compilerRtl, inl, exportc: "nimFrame".} = discard
proc popFrame {.compilerRtl, inl.} = discard
proc setFrame(s: PFrame) {.compilerRtl, inl.} = discard
proc pushSafePoint(s: PSafePoint) {.compilerRtl, inl.} = discard
proc popSafePoint {.compilerRtl, inl.} = discard
proc pushCurrentException(e: ref Exception) {.compilerRtl, inl.} = discard
proc popCurrentException {.compilerRtl, inl.} = discard
# some platforms have native support for stack traces:
const
nativeStackTraceSupported = false
hasSomeStackTrace = false
proc quitOrDebug() {.noreturn, importc: "abort", header: "<stdlib.h>", nodecl.}
proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} =
sysFatal(ReraiseDefect, "exception handling is not available")
proc reraiseException() {.compilerRtl.} =
sysFatal(ReraiseDefect, "no exception to reraise")
proc writeStackTrace() = discard
proc unsetControlCHook() = discard
proc setControlCHook(hook: proc () {.noconv.}) = discard
proc closureIterSetupExc(e: ref Exception) {.compilerproc, inline.} =
sysFatal(ReraiseDefect, "exception handling is not available")