mirror of
https://github.com/janet-lang/janet
synced 2025-04-28 21:53:19 +00:00
Add alias JANET_SIGNAL_EVENT.
This commit is contained in:
parent
596111c988
commit
4ac382e553
@ -540,7 +540,7 @@ int main(int argc, const char **argv) {
|
|||||||
fiber->env = temptab;
|
fiber->env = temptab;
|
||||||
Janet out;
|
Janet out;
|
||||||
JanetSignal result = janet_continue(fiber, janet_wrap_nil(), &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_stacktrace(fiber, out);
|
||||||
janet_deinit();
|
janet_deinit();
|
||||||
return result;
|
return result;
|
||||||
|
@ -1948,7 +1948,7 @@
|
|||||||
(default on-parse-error bad-parse)
|
(default on-parse-error bad-parse)
|
||||||
(default evaluator (fn evaluate [x &] (x)))
|
(default evaluator (fn evaluate [x &] (x)))
|
||||||
(default where "<anonymous>")
|
(default where "<anonymous>")
|
||||||
(default guard :yed)
|
(default guard :ydt)
|
||||||
|
|
||||||
# Are we done yet?
|
# Are we done yet?
|
||||||
(var going true)
|
(var going true)
|
||||||
|
@ -245,7 +245,7 @@ static size_t janet_loop_event(size_t index) {
|
|||||||
JanetFiber *fiberp = NULL;
|
JanetFiber *fiberp = NULL;
|
||||||
/* Launch connection fiber */
|
/* Launch connection fiber */
|
||||||
JanetSignal sig = janet_pcall(handler, 1, &streamv, &out, &fiberp);
|
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);
|
janet_stacktrace(fiberp, out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ static size_t janet_loop_event(size_t index) {
|
|||||||
/* Resume the fiber */
|
/* Resume the fiber */
|
||||||
Janet out;
|
Janet out;
|
||||||
JanetSignal sig = janet_continue(jlfd->fiber, resumeval, &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);
|
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.buf = buf;
|
||||||
lfd.data.read_chunk.bytes_left = nbytes;
|
lfd.data.read_chunk.bytes_left = nbytes;
|
||||||
janet_loop_schedule(lfd);
|
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) {
|
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.buf = buf;
|
||||||
lfd.data.write_from_buffer.start = 0;
|
lfd.data.write_from_buffer.start = 0;
|
||||||
janet_loop_schedule(lfd);
|
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) {
|
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.str = str;
|
||||||
lfd.data.write_from_stringlike.start = 0;
|
lfd.data.write_from_stringlike.start = 0;
|
||||||
janet_loop_schedule(lfd);
|
janet_loop_schedule(lfd);
|
||||||
janet_signalv(JANET_SIGNAL_USER9, janet_wrap_nil());
|
janet_signalv(JANET_SIGNAL_EVENT, janet_wrap_nil());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Needs argc >= offset + 2 */
|
/* Needs argc >= offset + 2 */
|
||||||
|
@ -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);
|
JanetFiber *fiber = janet_fiber(f, 64, 0, NULL);
|
||||||
fiber->env = env;
|
fiber->env = env;
|
||||||
JanetSignal status = janet_continue(fiber, janet_wrap_nil(), &ret);
|
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);
|
janet_stacktrace(fiber, ret);
|
||||||
errflags |= 0x01;
|
errflags |= 0x01;
|
||||||
done = 1;
|
done = 1;
|
||||||
|
@ -294,6 +294,8 @@ typedef enum {
|
|||||||
JANET_SIGNAL_USER9
|
JANET_SIGNAL_USER9
|
||||||
} JanetSignal;
|
} JanetSignal;
|
||||||
|
|
||||||
|
#define JANET_SIGNAL_EVENT JANET_SIGNAL_USER9
|
||||||
|
|
||||||
/* Fiber statuses - mostly corresponds to signals. */
|
/* Fiber statuses - mostly corresponds to signals. */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
JANET_STATUS_DEAD,
|
JANET_STATUS_DEAD,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user