1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-16 08:17:41 +00:00

Add ability to Janet signal from C functions.

While C functions are not re-entrant, signaling from a C function
can be used to implement async returns. When resuming a fiber that
signalled from within a C function, the fiber is started after the
instruction that emitted the signal. The resume argument is used
as the return result from the c function.
This commit is contained in:
Calvin Rose
2020-01-10 17:25:10 -06:00
parent ed5027db5d
commit 3d40c95e80
8 changed files with 90 additions and 60 deletions

View File

@@ -203,12 +203,12 @@
(defn check-match
[pat text should-match]
(def result (peg/match pat text))
(assert (= (not should-match) (not result)) text))
(assert (= (not should-match) (not result)) (string "check-match " text)))
(defn check-deep
[pat text what]
(def result (peg/match pat text))
(assert (deep= result what) text))
(assert (deep= result what) (string "check-deep " text)))
# Just numbers