scm_wta_* procedures replace SCM_WTA_* macros
[bpt/guile.git] / libguile / __scm.h
index 2592e45..c437d60 100644 (file)
@@ -390,150 +390,14 @@ typedef long SCM_STACKITEM;
 #define SCM_STACK_PTR(ptr) ((SCM_STACKITEM *) (void *) (ptr))
 \f
 
-SCM_API void scm_async_tick (void);
-
 #ifdef BUILDING_LIBGUILE
-
-/* FIXME: should change names */
-# define SCM_ASYNC_TICK                                                 \
-    do                                                                  \
-      {                                                                 \
-       if (SCM_UNLIKELY (SCM_I_CURRENT_THREAD->pending_asyncs))        \
-         scm_async_click ();                                           \
-      }                                                                 \
-    while (0)
-
-/* SCM_ASYNC_TICK_WITH_CODE is only available to Guile itself */
-# define SCM_ASYNC_TICK_WITH_CODE(thr, stmt)                            \
-    do                                                                  \
-      {                                                                 \
-       if (SCM_UNLIKELY (thr->pending_asyncs))                         \
-         {                                                             \
-            stmt;                                                       \
-            scm_async_click ();                                         \
-          }                                                             \
-      }                                                                 \
-    while (0)
-
-#else /* !BUILDING_LIBGUILE */
-
-# define SCM_ASYNC_TICK  (scm_async_tick ())
-
-#endif /* !BUILDING_LIBGUILE */
-
-
-/* Anthony Green writes:
-   When the compiler sees...
-          DEFER_INTS;
-          [critical code here]
-          ALLOW_INTS;
-   ...it doesn't actually promise to keep the critical code within the
-   boundries of the DEFER/ALLOW_INTS instructions. It may very well
-   schedule it outside of the magic defined in those macros.
-
-   However, GCC's volatile asm feature forms a barrier over which code is
-   never moved. So if you add...
-          asm ("");
-   ...to each of the DEFER_INTS and ALLOW_INTS macros, the critical
-   code will always remain in place.  asm's without inputs or outputs
-   are implicitly volatile. */
-#ifdef __GNUC__
-#define SCM_FENCE asm /* volatile */ ("")
-#elif defined (__INTEL_COMPILER) && defined (__ia64)
-#define SCM_FENCE __memory_barrier()
+#define SCM_TICK SCM_ASYNC_TICK
 #else
-#define SCM_FENCE
+#define SCM_TICK scm_async_tick ()
 #endif
 
-#define SCM_TICK \
-do { \
-  SCM_ASYNC_TICK; \
-} while (0)
-
 \f
 
-/** SCM_ASSERT
- **
- **/
-
-
-#ifdef SCM_RECKLESS
-#define SCM_ASSERT(_cond, _arg, _pos, _subr)
-#define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg)
-#define SCM_ASRTGO(_cond, _label)
-#else
-#define SCM_ASSERT(_cond, _arg, _pos, _subr)                   \
-        do { if (SCM_UNLIKELY (!(_cond)))                      \
-          scm_wrong_type_arg (_subr, _pos, _arg); } while (0)
-#define SCM_ASSERT_TYPE(_cond, _arg, _pos, _subr, _msg)                        \
-        do { if (SCM_UNLIKELY (!(_cond)))                              \
-          scm_wrong_type_arg_msg(_subr, _pos, _arg, _msg);  } while (0)
-#define SCM_ASRTGO(_cond, _label)              \
-        do {  if (SCM_UNLIKELY (!(_cond)))     \
-          goto _label; } while (0)
-#endif
-
-/*
- * SCM_WTA_DISPATCH
- */
-
-/* Dirk:FIXME:: In all of the SCM_WTA_DISPATCH_* macros it is assumed that
- * 'gf' is zero if uninitialized.  It would be cleaner if some valid SCM value
- * like SCM_BOOL_F or SCM_UNDEFINED was chosen.
- */
-
-SCM_API SCM scm_call_generic_0 (SCM gf);
-
-#define SCM_WTA_DISPATCH_0(gf, subr)                           \
-  return (SCM_UNPACK (gf)                                      \
-         ? scm_call_generic_0 ((gf))                           \
-         : (scm_error_num_args_subr ((subr)), SCM_UNSPECIFIED))
-#define SCM_GASSERT0(cond, gf, subr)           \
-  if (SCM_UNLIKELY(!(cond)))           \
-    SCM_WTA_DISPATCH_0((gf), (subr))
-
-SCM_API SCM scm_call_generic_1 (SCM gf, SCM a1);
-
-#define SCM_WTA_DISPATCH_1(gf, a1, pos, subr)                  \
-  return (SCM_UNPACK (gf)                                      \
-         ? scm_call_generic_1 ((gf), (a1))                     \
-         : (scm_wrong_type_arg ((subr), (pos), (a1)), SCM_UNSPECIFIED))
-
-/* This form is for dispatching a subroutine.  */
-#define SCM_WTA_DISPATCH_1_SUBR(subr, a1, pos)                         \
-  return (SCM_UNPACK ((*SCM_SUBR_GENERIC (subr)))                      \
-         ? scm_call_generic_1 ((*SCM_SUBR_GENERIC (subr)), (a1))       \
-         : (scm_i_wrong_type_arg_symbol (SCM_SUBR_NAME (subr), (pos), (a1)), SCM_UNSPECIFIED))
-
-#define SCM_GASSERT1(cond, gf, a1, pos, subr)          \
-  if (SCM_UNLIKELY (!(cond)))                  \
-    SCM_WTA_DISPATCH_1((gf), (a1), (pos), (subr))
-
-SCM_API SCM scm_call_generic_2 (SCM gf, SCM a1, SCM a2);
-
-#define SCM_WTA_DISPATCH_2(gf, a1, a2, pos, subr)                      \
-  return (SCM_UNPACK (gf)                                              \
-         ? scm_call_generic_2 ((gf), (a1), (a2))                       \
-         : (scm_wrong_type_arg ((subr), (pos),                         \
-                                (pos) == SCM_ARG1 ? (a1) : (a2)),      \
-            SCM_UNSPECIFIED))
-#define SCM_GASSERT2(cond, gf, a1, a2, pos, subr)      \
-  if (SCM_UNLIKELY (!(cond)))                  \
-    SCM_WTA_DISPATCH_2((gf), (a1), (a2), (pos), (subr))
-
-SCM_API SCM scm_apply_generic (SCM gf, SCM args);
-
-#define SCM_WTA_DISPATCH_n(gf, args, pos, subr)                                  \
-  return (SCM_UNPACK (gf)                                                \
-         ? scm_apply_generic ((gf), (args))                              \
-         : (scm_wrong_type_arg ((subr), (pos),                           \
-                                scm_list_ref ((args),                    \
-                                              scm_from_int ((pos) - 1))), \
-            SCM_UNSPECIFIED))
-#define SCM_GASSERTn(cond, gf, args, pos, subr)                \
-  if (SCM_UNLIKELY (!(cond)))                  \
-    SCM_WTA_DISPATCH_n((gf), (args), (pos), (subr))
-
 #ifndef SCM_MAGIC_SNARFER
 /* Let these macros pass through if
    we are snarfing;  thus we can tell the