static SchemeSource * scheme_source = NULL;
static gboolean tracing_gtk_select = 0;
+static void trace (const char *format, ...);
static GSList * gtk_registry (select_registry_t registry);
static int slice_counter = 0;
static void close_slice_window (void);
static gchar * gpollfds_string (GSList * gpollfds);
+void
+trace (const char * format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ if (tracing_gtk_select)
+ {
+ voutf_console (format, args);
+ outf_flush_console ();
+ }
+ va_end (args);
+}
+
static gboolean
scheme_source_prepare (GSource * source, gint * timeout)
{
|| pending_interrupts_p ()
|| OS_process_any_status_change ())
{
- if (tracing_gtk_select)
- {
- if (timeo > 0)
- {
- outf_console (";scheme_source_prepare: %s\n",
- src->runnable ? "thread"
- : pending_interrupts_p () ? "interrupt"
- : "subprocess");
- }
- else
- {
- outf_console
- (";scheme_source_prepare: timeout at %.1f (in %dmsec)\n",
- dtime, timeo);
- }
- outf_flush_console ();
- }
+ trace (";scheme_source_prepare: ready (%s)\n",
+ timeo <= 0 ? "timeout"
+ : src->runnable ? "thread"
+ : pending_interrupts_p () ? "interrupt"
+ : "subprocess");
return (TRUE); /* Ready for immediate dispatch. */
}
- if (tracing_gtk_select)
- {
- outf_console (";scheme_source_prepare: polling for %dmsec\n", timeo);
- outf_flush_console ();
- }
+ trace (";scheme_source_prepare: polling for %dmsec\n", timeo);
*timeout = timeo;
return (FALSE); /* Poll/check before dispatching. */
}
|| OS_process_any_status_change ()
|| pending_io (src))
{
- if (tracing_gtk_select)
- {
- outf_console (";scheme_source_check: %s\n",
- src->runnable ? "thread"
- : pending_interrupts_p () ? "interrupt"
- : OS_process_any_status_change () ? "subprocess"
- : "i/o ready");
- outf_flush_console ();
- }
+ trace (";scheme_source_check: %s\n",
+ src->runnable ? "thread"
+ : pending_interrupts_p () ? "interrupt"
+ : OS_process_any_status_change () ? "subprocess"
+ : "i/o ready");
return (TRUE); /* Ready for immediate dispatch. */
}
return (FALSE); /* No I/O ready; no timeout. */
gtk_label_set_text (GTK_LABEL (status_label), text);
g_free (text);
}
- if (tracing_gtk_select)
- {
- outf_console (";scheme_source_dispatch: running time slice %d\n",
- slice_counter);
- outf_flush_console ();
- }
+ trace (";scheme_source_dispatch: running time slice %d\n", slice_counter);
Interpret (1);
alienate_float_environment ();
- if (tracing_gtk_select)
- {
- outf_console (";scheme_source_dispatch: finished time slice %d\n",
- slice_counter);
- outf_flush_console ();
- }
+ trace (";scheme_source_dispatch: finished time slice %d\n", slice_counter);
return (TRUE); /* Not a once-only. */
}
yield_gtk (void)
{
scheme_source->runnable = TRUE;
+ trace (";yield_gtk: runnable at %.1f\n", OS_real_time_clock ());
}
\f