further steps for closure support; added 'system.rawProc', 'system.rawEnv'

This commit is contained in:
Araq 2012-02-08 22:56:31 +01:00
commit f3f3fc01aa
4 changed files with 68 additions and 13 deletions

View file

@ -1954,6 +1954,20 @@ when not defined(EcmaScript) and not defined(NimrodVM):
proc unlikely*(val: bool): bool {.importc: "unlikely", nodecl, nosideeffect.}
## can be used to mark a condition to be unlikely. This is a hint for the
## optimizer.
proc rawProc*[T: proc](x: T): pointer {.noSideEffect, inline.} =
## retrieves the raw proc pointer of the closure `x`. This is
## useful for interfacing closures with C.
{.emit: """
`result` = `x`.ClPrc;
""".}
proc rawEnv*[T: proc](x: T): pointer {.noSideEffect, inline.} =
## retrieves the raw environment pointer of the closure `x`. This is
## useful for interfacing closures with C.
{.emit: """
`result` = `x`.ClEnv;
""".}
elif defined(ecmaScript) or defined(NimrodVM):
# Stubs: