embedded.nim 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2012 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. # Bare-bones implementation of some things for embedded targets.
  10. proc chckIndx(i, a, b: int): int {.inline, compilerproc.}
  11. proc chckRange(i, a, b: int): int {.inline, compilerproc.}
  12. proc chckRangeF(x, a, b: float): float {.inline, compilerproc.}
  13. proc chckNil(p: pointer) {.inline, compilerproc.}
  14. proc nimFrame(s: PFrame) {.compilerRtl, inl, exportc: "nimFrame".} = discard
  15. proc popFrame {.compilerRtl, inl.} = discard
  16. proc setFrame(s: PFrame) {.compilerRtl, inl.} = discard
  17. proc pushSafePoint(s: PSafePoint) {.compilerRtl, inl.} = discard
  18. proc popSafePoint {.compilerRtl, inl.} = discard
  19. proc pushCurrentException(e: ref Exception) {.compilerRtl, inl.} = discard
  20. proc popCurrentException {.compilerRtl, inl.} = discard
  21. # some platforms have native support for stack traces:
  22. const
  23. nativeStackTraceSupported = false
  24. hasSomeStackTrace = false
  25. proc quitOrDebug() {.noreturn, importc: "abort", header: "<stdlib.h>", nodecl.}
  26. proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} =
  27. sysFatal(ReraiseError, "exception handling is not available")
  28. proc reraiseException() {.compilerRtl.} =
  29. sysFatal(ReraiseError, "no exception to reraise")
  30. proc writeStackTrace() = discard
  31. proc unsetControlCHook() = discard
  32. proc setControlCHook(hook: proc () {.noconv.}) = discard
  33. proc closureIterSetupExc(e: ref Exception) {.compilerproc, inline.} =
  34. sysFatal(ReraiseError, "exception handling is not available")