From 4ac382e553be24b683c20179fd12cd8e0b9d5cfa Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Fri, 17 Apr 2020 16:27:02 -0500 Subject: [PATCH] Add alias JANET_SIGNAL_EVENT. --- auxbin/jpm | 2 +- src/boot/boot.janet | 2 +- src/core/net.c | 10 +++++----- src/core/run.c | 2 +- src/include/janet.h | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/auxbin/jpm b/auxbin/jpm index 8ed0a099..ba7e404e 100755 --- a/auxbin/jpm +++ b/auxbin/jpm @@ -540,7 +540,7 @@ int main(int argc, const char **argv) { fiber->env = temptab; Janet out; JanetSignal result = janet_continue(fiber, janet_wrap_nil(), &out); - if (result != JANET_SIGNAL_OK && result < JANET_SIGNAL_USER0) { + if (result != JANET_SIGNAL_OK && result != JANET_SIGNAL_EVENT) { janet_stacktrace(fiber, out); janet_deinit(); return result; diff --git a/src/boot/boot.janet b/src/boot/boot.janet index c60b1794..9401f0e8 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -1948,7 +1948,7 @@ (default on-parse-error bad-parse) (default evaluator (fn evaluate [x &] (x))) (default where "") - (default guard :yed) + (default guard :ydt) # Are we done yet? (var going true) diff --git a/src/core/net.c b/src/core/net.c index 76b435cd..34395734 100644 --- a/src/core/net.c +++ b/src/core/net.c @@ -245,7 +245,7 @@ static size_t janet_loop_event(size_t index) { JanetFiber *fiberp = NULL; /* Launch connection fiber */ JanetSignal sig = janet_pcall(handler, 1, &streamv, &out, &fiberp); - if (sig != JANET_SIGNAL_OK && sig != JANET_SIGNAL_USER9) { + if (sig != JANET_SIGNAL_OK && sig != JANET_SIGNAL_EVENT) { janet_stacktrace(fiberp, out); } } @@ -309,7 +309,7 @@ static size_t janet_loop_event(size_t index) { /* Resume the fiber */ Janet out; JanetSignal sig = janet_continue(jlfd->fiber, resumeval, &out); - if (sig != JANET_SIGNAL_OK && sig != JANET_SIGNAL_USER9) { + if (sig != JANET_SIGNAL_OK && sig != JANET_SIGNAL_EVENT) { janet_stacktrace(jlfd->fiber, out); } } @@ -374,7 +374,7 @@ JANET_NO_RETURN static void janet_sched_read(JanetStream *stream, JanetBuffer *b lfd.data.read_chunk.buf = buf; lfd.data.read_chunk.bytes_left = nbytes; janet_loop_schedule(lfd); - janet_signalv(JANET_SIGNAL_USER9, janet_wrap_nil()); + janet_signalv(JANET_SIGNAL_EVENT, janet_wrap_nil()); } JANET_NO_RETURN static void janet_sched_write_buffer(JanetStream *stream, JanetBuffer *buf) { @@ -385,7 +385,7 @@ JANET_NO_RETURN static void janet_sched_write_buffer(JanetStream *stream, JanetB lfd.data.write_from_buffer.buf = buf; lfd.data.write_from_buffer.start = 0; janet_loop_schedule(lfd); - janet_signalv(JANET_SIGNAL_USER9, janet_wrap_nil()); + janet_signalv(JANET_SIGNAL_EVENT, janet_wrap_nil()); } JANET_NO_RETURN static void janet_sched_write_stringlike(JanetStream *stream, const uint8_t *str) { @@ -396,7 +396,7 @@ JANET_NO_RETURN static void janet_sched_write_stringlike(JanetStream *stream, co lfd.data.write_from_stringlike.str = str; lfd.data.write_from_stringlike.start = 0; janet_loop_schedule(lfd); - janet_signalv(JANET_SIGNAL_USER9, janet_wrap_nil()); + janet_signalv(JANET_SIGNAL_EVENT, janet_wrap_nil()); } /* Needs argc >= offset + 2 */ diff --git a/src/core/run.c b/src/core/run.c index 6f6019c0..039d1144 100644 --- a/src/core/run.c +++ b/src/core/run.c @@ -50,7 +50,7 @@ int janet_dobytes(JanetTable *env, const uint8_t *bytes, int32_t len, const char JanetFiber *fiber = janet_fiber(f, 64, 0, NULL); fiber->env = env; JanetSignal status = janet_continue(fiber, janet_wrap_nil(), &ret); - if (status != JANET_SIGNAL_OK && status < JANET_SIGNAL_USER0) { + if (status != JANET_SIGNAL_OK && status != JANET_SIGNAL_EVENT) { janet_stacktrace(fiber, ret); errflags |= 0x01; done = 1; diff --git a/src/include/janet.h b/src/include/janet.h index 8b6fd860..fc5552d9 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -294,6 +294,8 @@ typedef enum { JANET_SIGNAL_USER9 } JanetSignal; +#define JANET_SIGNAL_EVENT JANET_SIGNAL_USER9 + /* Fiber statuses - mostly corresponds to signals. */ typedef enum { JANET_STATUS_DEAD,