#include "libguile/throw.h"
#include "libguile/root.h"
#include "libguile/smob.h"
-#include "libguile/gc.h"
#include "libguile/validate.h"
#include "libguile/async.h"
int scm_asyncs_pending_p = 0;
#endif
-static long tc16_async;
+static scm_bits_t tc16_async;
\f
/* cmm: this has SCM_ prefix because SCM_MAKE_VALIDATE expects it.
this is ugly. */
-#define SCM_ASYNCP(X) (SCM_NIMP(X) && (tc16_async == SCM_GCTYP16 (X)))
-
-#define VALIDATE_ASYNC(pos,a) SCM_MAKE_VALIDATE(pos, a, ASYNCP)
+#define SCM_ASYNCP(X) SCM_TYP16_PREDICATE (tc16_async, X)
+#define VALIDATE_ASYNC(pos,a) SCM_MAKE_VALIDATE(pos, a, ASYNCP)
#define ASYNC_GOT_IT(X) (SCM_CELL_WORD_0 (X) >> 16)
-#define SET_ASYNC_GOT_IT(X, V) (SCM_SET_CELL_WORD_0 (X, (SCM_CELL_WORD_0 (X) & ((1 << 16) - 1)) | ((V) << 16)))
+#define SET_ASYNC_GOT_IT(X, V) (SCM_SET_CELL_WORD_0 ((X), SCM_TYP16 (X) | ((V) << 16)))
#define ASYNC_THUNK(X) SCM_CELL_OBJECT_1 (X)
\f
return 0;
}
-#if 0
-static SCM
-scm_sys_tick_async_thunk (void)
-{
- scm_deliver_signal (SCM_TICK_SIGNAL);
- return SCM_BOOL_F;
-}
-#endif
void
scm_async_click ()
}
}
- /*
- if (owe_tick)
- scm_async_mark (system_signal_asyncs[SCM_SIG_ORD(SCM_TICK_SIGNAL)]); */
-
SCM_DEFER_INTS;
if (scm_tick_rate && scm_switch_rate)
{
\f
static SCM
-mark_async (SCM obj)
+async_mark (SCM obj)
{
return ASYNC_THUNK (obj);
}
"")
#define FUNC_NAME s_scm_noop
{
+ SCM_VALIDATE_REST_ARGUMENT (args);
return (SCM_NULLP (args) ? SCM_BOOL_F : SCM_CAR (args));
}
#undef FUNC_NAME
#undef FUNC_NAME
#endif
-\f
-
-/* points to the GC system-async, so that scm_gc_end can find it. */
-SCM scm_gc_async;
-
-/* the vcell for gc-thunk. */
-static SCM scm_gc_vcell;
-
-/* the thunk installed in the GC system-async, which is marked at the
- end of garbage collection. */
-static SCM
-scm_sys_gc_async_thunk (void)
-{
- scm_c_run_hook (scm_after_gc_hook, SCM_EOL);
- /* The following code will be removed in Guile 1.5. */
- if (SCM_NFALSEP (scm_gc_vcell))
- {
- SCM proc = SCM_CDR (scm_gc_vcell);
-
- if (SCM_NFALSEP (proc) && !SCM_UNBNDP (proc))
- scm_apply (proc, SCM_EOL, SCM_EOL);
- }
- return SCM_UNSPECIFIED;
-}
\f
void
scm_init_async ()
{
- SCM a_thunk;
- tc16_async = scm_make_smob_type_mfpe ("async", 0,
- mark_async, NULL, NULL, NULL);
- scm_gc_vcell = scm_sysintern ("gc-thunk", SCM_BOOL_F);
- a_thunk = scm_make_gsubr ("%gc-thunk", 0, 0, 0, scm_sys_gc_async_thunk);
- scm_gc_async = scm_system_async (a_thunk);
+ scm_asyncs = SCM_EOL;
+ tc16_async = scm_make_smob_type ("async", 0);
+ scm_set_smob_mark (tc16_async, async_mark);
+#ifndef SCM_MAGIC_SNARFER
#include "libguile/async.x"
+#endif
}
/*