Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type JumpBuffer {.importc: "jmp_buf", header: "<setjmp.h>".} = object
- proc setJump(env: JumpBuffer): cint
- {.importc: "setjmp", header: "<setjmp.h>".}
- proc longJump(env: JumpBuffer, value: cint)
- {.importc: "longjmp", header: "<setjmp.h>".}
- var
- buf: JumpBuffer
- a: cint = 0
- b: cint = 1
- echo setJump(buf)
- b = a+b
- a = b-a
- if a < 500: longJump(buf, a)
- echo "done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement