From cfd39fd16e9246fcffe4a107f7a15fcb3dcee3e4 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Mon, 14 Aug 2017 14:14:02 -0700 Subject: [PATCH] glib: Use new re_enter_scheme instead of Interpret. --- src/glib/glibio.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/glib/glibio.c b/src/glib/glibio.c index 9ae154903..cdbf5ebe3 100644 --- a/src/glib/glibio.c +++ b/src/glib/glibio.c @@ -39,10 +39,9 @@ extern int OS_select_registry_length (unsigned long registry); extern void OS_select_registry_entry (unsigned long registry, int i, int *fd, unsigned int *mode); extern void OS_syserr_names (unsigned long *, const char ***); -extern void Interpret (int pop_return_p); -extern void alienate_float_environment (void); extern void foreach_async_signal (void(*func)(int signo)); extern void abort_to_c (void); +extern void re_enter_scheme (void); extern int interrupts_p (void); static void init_signal_handling (void); @@ -215,19 +214,6 @@ pending_io (SchemeSource * src) return (FALSE); } -static gboolean -do_scheme (GSource *source) -{ - slice_counter += 1; - trace (";scheme_source_dispatch: running time slice %d\n", slice_counter); - - Interpret (1); - alienate_float_environment (); - - trace (";scheme_source_dispatch: finished time slice %d\n", slice_counter); - return (TRUE); /* Not a once-only. */ -} - static gboolean scheme_source_dispatch (GSource * source, GSourceFunc callback, gpointer user_data) @@ -236,12 +222,16 @@ scheme_source_dispatch (GSource * source, arguments. Must return TRUE to stay on the list of event sources. */ - gboolean ret = FALSE; + if (g_source_is_destroyed (source)) + return (FALSE); + + slice_counter += 1; + trace (";scheme_source_dispatch: running time slice %d\n", slice_counter); - if (!g_source_is_destroyed (source)) - ret = do_scheme (source); + re_enter_scheme (); - return ret; + trace (";scheme_source_dispatch: finished time slice %d\n", slice_counter); + return (TRUE); /* Not a once-only. */ } GSourceFuncs scheme_source_funcs = @@ -336,25 +326,21 @@ start_glib (void) { /* Runs g_main_loop_run with scheme_source attached. Returns TRUE when successful. Returns FALSE when main loop is already running. */ + CalloutTrampIn tramp = &Scm_continue_start_glib; + gboolean retval = TRUE; if (scheme_source != NULL) return (FALSE); slice_hook = NULL; init_signal_handling (); - CalloutTrampIn tramp = &Scm_continue_start_glib; - gboolean retval = TRUE; + install_scheme_source (); - /* Prep the machine for re-entry via scheme_source->dispatch(), - which should continue with the seemingly aborted application of - C-CALL-CONTINUE, which should call Scm_continue_start_glib(). - That function expects one gboolean in the top CSTACK frame. */ callout_unseal (tramp); CSTACK_PUSH (gboolean, retval); CSTACK_PUSH (int, cstack_depth); CSTACK_PUSH (CalloutTrampIn, tramp); - install_scheme_source (); loop = g_main_loop_new (NULL, TRUE); g_main_loop_run (loop); g_main_loop_unref (loop); @@ -398,8 +384,6 @@ run_glib (unsigned long registry, double time) if (slice_hook != NULL) (*slice_hook)(); - /* The c-call primitive has arranged for c-call-continue to run (and - thus Scm_run_glib_continue) when Scheme continues. */ abort_to_c (); /*NOTREACHED*/ } -- 2.25.1