summary refs log tree commit diff stats
path: root/lib/system/embedded.nim
blob: fb89e7f0f3ea1b4eda31cbf22ed2115c48a492ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
#
#            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() {.inline.} =
  quit(1)

proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} =
  sysFatal(ReraiseError, "exception handling is not available")

proc reraiseException() {.compilerRtl.} =
  sysFatal(ReraiseError, "no exception to reraise")

proc writeStackTrace() = discard

proc unsetControlCHook() = discard
proc setControlCHook(hook: proc () {.noconv.}) = discard

proc closureIterSetupExc(e: ref Exception) {.compilerproc, inline.} =
  sysFatal(ReraiseError, "exception handling is not available")