* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
-#define SCM_ASYNCP(X) (scm_tc16_async == SCM_GCTYP16 (X))
+#define SCM_ASYNCP(X) (SCM_NIMP(X) && (scm_tc16_async == SCM_GCTYP16 (X)))
#define SCM_ASYNC(X) ((struct scm_async *)SCM_CDR (X))
struct scm_async
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
# ifdef TIME_WITH_SYS_TIME
#if 0
#define SCM_THREAD_SWITCHING_CODE \
-{ \
+do { \
if (scm_thread_count > 1) \
coop_yield(); \
-} \
+} while (0)
#else
#define SCM_THREAD_SWITCHING_CODE \
-{ \
+do { \
if (scm_thread_count > 1) \
{ \
scm_switch_counter--; \
coop_yield(); \
} \
} \
-} \
+} while (0)
#endif
*
* The author can be reached at djurfeldt@nada.kth.se
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
#define CHECK_EXIT scm_check_exit_p
#define SCM_RESET_DEBUG_MODE \
-{\
+do {\
CHECK_ENTRY = SCM_ENTER_FRAME_P || SCM_BREAKPOINTS_P;\
CHECK_APPLY = SCM_APPLY_FRAME_P || SCM_TRACE_P;\
CHECK_EXIT = SCM_EXIT_FRAME_P || SCM_TRACE_P;\
scm_debug_mode = SCM_DEVAL_P || CHECK_ENTRY || CHECK_APPLY || CHECK_EXIT;\
scm_ceval_ptr = scm_debug_mode ? scm_deval : scm_ceval;\
-}
+} while (0)
/* {Evaluator}
extern long scm_tc16_debugobj;
-#define SCM_DEBUGOBJP(x) (scm_tc16_debugobj == SCM_TYP16 (x))
+#define SCM_DEBUGOBJP(x) (SCM_NIMP(x) && (scm_tc16_debugobj == SCM_TYP16 (x)))
#define SCM_DEBUGOBJ_FRAME(x) SCM_CDR (x)
#define SCM_SET_DEBUGOBJ_FRAME(x, f) SCM_SETCDR (x, f)
extern long scm_tc16_memoized;
-#define SCM_MEMOIZEDP(x) (scm_tc16_memoized == SCM_TYP16 (x))
+#define SCM_MEMOIZEDP(x) (SCM_NIMP(x) && (scm_tc16_memoized == SCM_TYP16 (x)))
#define SCM_MEMOIZED_EXP(x) SCM_CAR (SCM_CDR (x))
#define SCM_MEMOIZED_ENV(x) SCM_CDR (SCM_CDR (x))
#define SCM_BEFORE_GUARD(obj) (SCM_GUARDSMEM (obj)->before)
#define SCM_AFTER_GUARD(obj) (SCM_GUARDSMEM (obj)->after)
#define SCM_GUARD_DATA(obj) (SCM_GUARDSMEM (obj)->data)
-#define SCM_GUARDSP(obj) (SCM_CAR (obj) == tc16_guards)
+#define SCM_GUARDSP(obj) (SCM_NIMP(obj) && (SCM_CAR (obj) == tc16_guards))
static long tc16_guards;
{ ++debug.info; debug.info->a.proc = p; debug.info->a.args = l; }
#undef ENTER_APPLY
#define ENTER_APPLY \
-{\
+do { \
SCM_SET_ARGSREADY (debug);\
if (CHECK_APPLY && SCM_TRAPS_P)\
if (SCM_APPLY_FRAME_P || (SCM_TRACE_P && PROCTRACEP (proc)))\
scm_ithrow (scm_sym_apply_frame, scm_cons2 (tmp, tail, SCM_EOL), 0);\
}\
}\
-}
+} while (0)
#undef RETURN
#define RETURN(e) {proc = (e); goto exit;}
#ifdef STACK_CHECKING
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
-#define SCM_HOOKP(x) (SCM_TYP16 (x) == scm_tc16_hook)
+#define SCM_HOOKP(x) (SCM_NIMP(x) && (SCM_TYP16 (x) == scm_tc16_hook))
#define SCM_HOOK_ARITY(hook) (SCM_CAR (hook) >> 16)
#define SCM_HOOK_NAME(hook) SCM_CADR (hook)
#define SCM_HOOK_PROCEDURES(hook) SCM_CDDR (hook)
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include <stdio.h>
\f
extern long scm_tc16_dir;
-#define SCM_DIRP(x) (SCM_TYP16(x)==(scm_tc16_dir))
-#define SCM_OPDIRP(x) (SCM_CAR(x)==(scm_tc16_dir | SCM_OPN))
+#define SCM_DIRP(x) (SCM_NIMP(x) && (SCM_TYP16(x)==(scm_tc16_dir)))
+#define SCM_OPDIRP(x) (SCM_NIMP(x) && (SCM_CAR(x)==(scm_tc16_dir | SCM_OPN)))
\f
extern SCM scm_chown SCM_P ((SCM object, SCM owner, SCM group));
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
+
#include "libguile/__scm.h"
#include "libguile/root.h"
#include "libguile/vectors.h"
extern long scm_tc16_fluid;
-#define SCM_FLUIDP(x) (SCM_CAR(x) == scm_tc16_fluid)
+#define SCM_FLUIDP(x) (SCM_NIMP(x) && (SCM_CAR(x) == scm_tc16_fluid))
#define SCM_FLUID_NUM(x) SCM_CDR(x)
/* The fastest way to acces/modify the value of a fluid. These macros
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
#define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x))
#define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes)
-#define SCM_FPORTP(x) (SCM_TYP16S(x)==scm_tc7_port)
-#define SCM_OPFPORTP(x) (((0xfeff | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN))
-#define SCM_OPINFPORTP(x) (((0xfeff | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG))
-#define SCM_OPOUTFPORTP(x) (((0xfeff | SCM_OPN | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG))
+#define SCM_FPORTP(x) (SCM_NIMP(x) && (SCM_TYP16S(x)==scm_tc7_port))
+#define SCM_OPFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN)))
+#define SCM_OPINFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG)))
+#define SCM_OPOUTFPORTP(x) (SCM_NIMP(x) && (((0xfeff | SCM_OPN | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG)))
/* test whether fdes supports random access. */
#define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1)
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#ifndef SCM_FSU_PTHREADS_H
#define SCM_NO_CRITICAL_SECTION_OWNER 0
#define SCM_DEFER_INTS \
-{ \
+do { \
SCM_IASSERT(scm_critical_section_owner != pthread_self()); \
pthread_mutex_lock(&scm_critical_section_mutex); \
scm_critical_section_owner = pthread_self(); \
scm_ints_disabled = 1; \
-}
+} while (0)
#define SCM_ALLOW_INTS \
-{ \
+do { \
SCM_IASSERT(scm_critical_section_owner == pthread_self()); \
scm_ints_disabled = 0; \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock(&scm_critical_section_mutex); \
SCM_CHECK_INTS; \
-}
+} while (0)
#define SCM_REDEFER_INTS \
-{ \
+do { \
if ((scm_critical_section_owner != pthread_self()) || \
(scm_critical_section_owner == SCM_NO_CRITICAL_SECTION_OWNER)) \
{ \
scm_critical_section_owner = pthread_self(); \
} \
++scm_ints_disabled; \
-}
+} while (0)
#define SCM_REALLOW_INTS \
-{ \
+do { \
SCM_IASSERT(scm_critical_section_owner == pthread_self()); \
--scm_ints_disabled; \
if (!scm_ints_disabled) \
pthread_mutex_unlock(&scm_critical_section_mutex); \
SCM_CHECK_INTS; \
} \
-}
+} while (0)
*fixme*
#define scm_root ((scm_root_state *) pthread_self()->prots)
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
-#define SCM_FREEP(x) (SCM_CAR(x)==scm_tc_free_cell)
+#define SCM_FREEP(x) (SCM_NIMP(x) && SCM_CAR(x)==scm_tc_free_cell)
#define SCM_NFREEP(x) (!SCM_FREEP(x))
/* 1. This shouldn't be used on immediates.
* debugger.
*/
#define SCM_BEGIN_FOREIGN_BLOCK \
-{ \
+do { \
old_ints = scm_ints_disabled; scm_ints_disabled = 1; \
old_gc = scm_block_gc; scm_block_gc = 1; \
scm_print_carefully_p = 1; \
-} \
+} while (0)
#define SCM_END_FOREIGN_BLOCK \
-{ \
+do { \
scm_print_carefully_p = 0; \
scm_block_gc = old_gc; \
scm_ints_disabled = old_ints; \
-} \
+} while (0)
#define RESET_STRING { gdb_output_length = 0; }
#define SEND_STRING(str) \
-{ \
+do { \
gdb_output = str; \
gdb_output_length = strlen (str); \
-} \
+} while (0)
/* {Gdb interface}
so that no synchronization between these needs to take place.
*/
#define TCONC_IN(tc, obj, pair) \
-{ \
+do { \
SCM_SETCAR ((tc).tail, obj); \
SCM_SETCAR (pair, SCM_BOOL_F); \
SCM_SETCDR (pair, SCM_BOOL_F); \
SCM_SETCDR ((tc).tail, pair); \
(tc).tail = pair; \
-} \
+} while (0)
#define TCONC_OUT(tc, res) \
-{ \
+do { \
(res) = SCM_CAR ((tc).head); \
(tc).head = SCM_CDR ((tc).head); \
-} \
+} while (0)
#define TCONC_EMPTYP(tc) ((tc).head == (tc).tail)
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
extern int scm_tc16_keyword;
-#define SCM_KEYWORDP(X) (SCM_CAR(X) == scm_tc16_keyword)
+#define SCM_KEYWORDP(X) (SCM_NIMP(X) && (SCM_CAR(X) == scm_tc16_keyword))
#define SCM_KEYWORDSYM(X) (SCM_CDR(X))
\f
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
#define SCM_THREAD_REDEFER pthread_kernel_lock++
#define SCM_THREAD_REALLOW_1 pthread_kernel_lock--
#define SCM_THREAD_REALLOW_2 \
-{ \
+do { \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock(&scm_critical_section_mutex); \
-}
+} while (0)
#else
#define SCM_NO_CRITICAL_SECTION_OWNER 0
#define SCM_THREAD_DEFER \
-{ \
+do { \
pthread_mutex_lock (&scm_critical_section_mutex); \
scm_critical_section_owner = pthread_self(); \
-}
+} while (0)
#define SCM_THREAD_ALLOW \
-{ \
+do { \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock (&scm_critical_section_mutex); \
-}
+} while (0)
#define SCM_THREAD_REDEFER \
-{ \
+do { \
if ((scm_critical_section_owner != pthread_self()) || \
(scm_critical_section_owner == SCM_NO_CRITICAL_SECTION_OWNER)) \
{ \
pthread_mutex_lock(&scm_critical_section_mutex); \
scm_critical_section_owner = pthread_self(); \
} \
-}
+} while (0)
#define SCM_THREAD_REALLOW_1
#define SCM_THREAD_REALLOW_2 \
-{ \
+do { \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock (&scm_critical_section_mutex); \
-}
+} while (0)
#endif
#define SCM_THREAD_LOCAL_DATA (pthread_self () -> attr.arg_attr)
#define SCM_SET_THREAD_LOCAL_DATA(new_root) \
-{ \
+do { \
pthread_t t = pthread_self (); \
void *r = (new_root); \
pthread_attr_setcleanup (&t -> attr, NULL, r); \
pthreads_find_info (t) -> root = r; \
-}
+} while (0)
\f
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
/* Numbers
*/
-#define SCM_INEXP(x) (SCM_TYP16(x)==scm_tc16_flo)
-#define SCM_CPLXP(x) (SCM_CAR(x)==scm_tc_dblc)
+#define SCM_INEXP(x) (SCM_NIMP(x) && (SCM_TYP16(x)==scm_tc16_flo))
+#define SCM_CPLXP(x) (SCM_NIMP(x) && (SCM_CAR(x)==scm_tc_dblc))
#define SCM_REAL(x) (*(((scm_dbl *) (SCM2PTR(x)))->real))
#define SCM_IMAG(x) (*((double *)(SCM_CHARS(x)+sizeof(double))))
/* ((&SCM_REAL(x))[1]) */
#ifdef SCM_SINGLES
-#define SCM_REALP(x) ((~SCM_REAL_PART & SCM_CAR(x))==scm_tc_flo)
-#define SCM_SINGP(x) (SCM_CAR(x)==scm_tc_flo)
+#define SCM_REALP(x) (SCM_NIMP(x) && ((~SCM_REAL_PART & SCM_CAR(x))==scm_tc_flo))
+#define SCM_SINGP(x) (SCM_NIMP(x) && (SCM_CAR(x)==scm_tc_flo))
#define SCM_FLO(x) (((scm_flo *)(SCM2PTR(x)))->num)
#define SCM_REALPART(x) (SCM_SINGP(x)?0.0+SCM_FLO(x):SCM_REAL(x))
#else /* SCM_SINGLES */
-#define SCM_REALP(x) (SCM_CAR(x)==scm_tc_dblr)
+#define SCM_REALP(x) (SCM_NIMP(x) && (SCM_CAR(x)==scm_tc_dblr))
#define SCM_REALPART SCM_REAL
#endif /* SCM_SINGLES */
#define SCM_NUM2DBL(x) ((double) SCM_INUM (x))
#endif
#endif
-#define SCM_NUMP(x) ((0xfcff & (int)SCM_CAR(x))==scm_tc7_smob)
-#define SCM_BIGP(x) (SCM_TYP16S(x)==scm_tc16_bigpos)
+#define SCM_NUMP(x) (SCM_NIMP(x) && (0xfcff & (int)SCM_CAR(x))==scm_tc7_smob)
+#define SCM_BIGP(x) (SCM_NIMP(x) && SCM_TYP16S(x)==scm_tc16_bigpos)
#define SCM_BIGSIGN(x) (0x0100 & (int)SCM_CAR(x))
#define SCM_BDIGITS(x) ((SCM_BIGDIG *)(SCM_CDR(x)))
#define SCM_NUMDIGS(x) ((scm_sizet)(SCM_CAR(x)>>16))
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
/* #define SCM_CRDY (32L<<16) obsolete, for pushed back characters */
#define SCM_BUFLINE (64L<<16) /* Is it line-buffered? */
-#define SCM_PORTP(x) (SCM_TYP7(x)==scm_tc7_port)
-#define SCM_OPPORTP(x) (((0x7f | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN))
-#define SCM_OPINPORTP(x) (((0x7f | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG))
-#define SCM_OPOUTPORTP(x) (((0x7f | SCM_OPN | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG))
-#define SCM_INPORTP(x) (((0x7f | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_RDNG))
-#define SCM_OUTPORTP(x) (((0x7f | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_WRTNG))
-#define SCM_OPENP(x) (SCM_OPN & SCM_CAR(x))
+#define SCM_PORTP(x) (SCM_NIMP(x) && (SCM_TYP7(x)==scm_tc7_port))
+#define SCM_OPPORTP(x) (SCM_NIMP(x) && (((0x7f | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN)))
+#define SCM_OPINPORTP(x) (SCM_NIMP(x) && (((0x7f | SCM_OPN | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_RDNG)))
+#define SCM_OPOUTPORTP(x) (SCM_NIMP(x) && (((0x7f | SCM_OPN | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN | SCM_WRTNG)))
+#define SCM_INPORTP(x) (SCM_NIMP(x) && (((0x7f | SCM_RDNG) & SCM_CAR(x))==(scm_tc7_port | SCM_RDNG)))
+#define SCM_OUTPORTP(x) (SCM_NIMP(x) && (((0x7f | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_WRTNG)))
+#define SCM_OPENP(x) (SCM_NIMP(x) && (SCM_OPN & SCM_CAR(x)))
#define SCM_CLOSEDP(x) (!SCM_OPENP(x))
#define SCM_PTAB_ENTRY(x) ((scm_port *) SCM_CDR(x))
#define SCM_SETPTAB_ENTRY(x,ent) SCM_SETCDR ((x), (SCM)(ent))
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
#define SCM_PRINT_STATE(obj) ((scm_print_state *) SCM_STRUCT_DATA (obj))
#define RESET_PRINT_STATE(pstate) \
-{ \
+do { \
pstate->list_offset = 0; \
pstate->top = 0; \
-}
+} while (0)
#define SCM_WRITINGP(pstate) ((pstate)->writingp)
#define SCM_SET_WRITINGP(pstate, x) { (pstate)->writingp = (x); }
-#define SCM_PORT_WITH_PS_P(p) (SCM_TYP16 (p) == scm_tc16_port_with_ps)
+#define SCM_PORT_WITH_PS_P(p) (SCM_NIMP(p) && (SCM_TYP16 (p) == scm_tc16_port_with_ps))
#define SCM_PORT_WITH_PS_PORT(p) SCM_CADR (p)
#define SCM_PORT_WITH_PS_PS(p) SCM_CDDR (p)
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
/* Closures
*/
-#define SCM_CLOSUREP(x) (SCM_TYP3(x)==scm_tc3_closure)
+#define SCM_CLOSUREP(x) (SCM_NIMP(x) && (SCM_TYP3(x)==scm_tc3_closure))
#define SCM_CLOSCAR(x) (SCM_CAR(x)-scm_tc3_closure)
#define SCM_CODE(x) SCM_CAR(SCM_CLOSCAR (x))
#define SCM_PROCPROPS(x) SCM_CDR(SCM_CLOSCAR (x))
GETTER and SETTER slots can live directly on the heap, using the
new four-word cells. */
-#define SCM_PROCEDURE_WITH_SETTER_P(obj) (SCM_TYP7 (obj) == scm_tc7_pws)
+#define SCM_PROCEDURE_WITH_SETTER_P(obj) (SCM_NIMP(obj) && (SCM_TYP7 (obj) == scm_tc7_pws))
#define SCM_PROCEDURE(obj) SCM_CADR (obj)
#define SCM_SETTER(obj) SCM_CDDR (obj)
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
*/
extern long scm_tc16_rstate;
#define SCM_RSTATE(obj) ((scm_rstate *) SCM_CDR (obj))
-#define SCM_RSTATEP(obj) (SCM_TYP16 (obj) == scm_tc16_rstate)
+#define SCM_RSTATEP(obj) (SCM_NIMP(obj) && (SCM_TYP16 (obj) == scm_tc16_rstate))
extern unsigned char scm_masktab[256];
* If you do not wish that, delete this exception notice.
*/
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
+
#include "libguile/__scm.h"
extern long scm_tc16_regex;
#define SCM_RGX(X) ((regex_t *) SCM_CDR(X))
-#define SCM_RGXP(X) (SCM_CAR (X) == (SCM) scm_tc16_regex)
+#define SCM_RGXP(X) (SCM_NIMP(X) && (SCM_CAR (X) == (SCM) scm_tc16_regex))
extern SCM scm_make_regexp SCM_P ((SCM pat, SCM flags));
SCM scm_regexp_p SCM_P ((SCM x));
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
\f
extern long scm_tc16_root;
-#define SCM_ROOTP(obj) (scm_tc16_root == SCM_TYP16 (obj))
+#define SCM_ROOTP(obj) (SCM_NIMP(obj) && (scm_tc16_root == SCM_TYP16 (obj)))
#define SCM_ROOT_STATE(root) ((scm_root_state *) SCM_CDR (root))
typedef struct scm_root_state
*
* The author can be reached at djurfeldt@nada.kth.se
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
#define scm_whash_create_handle(whash, key) scm_hash_fn_create_handle_x (whash, key, SCM_UNSPECIFIED, scm_ihashq, scm_sloppy_assq, 0)
#define scm_whash_lookup(whash, obj) scm_hash_fn_ref (whash, obj, SCM_BOOL_F, scm_ihashq, scm_sloppy_assq, 0)
#define scm_whash_insert(whash, key, obj) \
-{ \
+do { \
register SCM w = (whash); \
SCM_WHASHSET (w, scm_whash_create_handle (w, key), obj); \
-} \
+} while (0)
/* {Source properties}
scm_srcprops srcprops[1];
} scm_srcprops_chunk;
-#define SRCPROPSP(p) (SCM_TYP16 (p) == scm_tc16_srcprops)
+#define SRCPROPSP(p) (SCM_NIMP(p) && (SCM_TYP16 (p) == scm_tc16_srcprops))
#define SRCPROPBRK(p) (SCM_BOOL((1L << 16) & SCM_CAR (p)))
#define SRCPROPPOS(p) ((scm_srcprops *) SCM_CDR (p))->pos
#define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12)
}
#define NEXT_FRAME(iframe, n, quit) \
-{ \
+do { \
if (SCM_NIMP (iframe->source) \
&& SCM_MEMOIZED_EXP (iframe->source) == applybody) \
{ \
++iframe; \
if (--n == 0) \
goto quit; \
-} \
+} while (0)
/* Fill the scm_info_frame vector IFRAME with data from N stack frames
*
* The author can be reached at djurfeldt@nada.kth.se
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
extern SCM scm_stack_type;
-#define SCM_STACKP(obj) (SCM_STRUCTP (obj) && SCM_STRUCT_VTABLE (obj) == scm_stack_type)
+#define SCM_STACKP(obj) (SCM_NIMP(obj) && \
+ SCM_STRUCTP (obj) && SCM_STRUCT_VTABLE (obj) == scm_stack_type)
#define SCM_STACK_LENGTH(stack) (SCM_STACK (stack) -> length)
#define SCM_FRAMEP(obj) (SCM_CONSP (obj) \
- && SCM_NIMP (SCM_CAR (obj)) \
&& SCM_STACKP (SCM_CAR (obj)) \
&& SCM_INUMP (SCM_CDR (obj))) \
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
-#define SCM_STRINGP(x) (SCM_TYP7S(x)==scm_tc7_string)
+#define SCM_STRINGP(x) (SCM_NIMP(x) && (SCM_TYP7S(x)==scm_tc7_string))
#define SCM_NSTRINGP(x) (!SCM_STRINGP(x))
/* Is X a writable string (i.e., not a substring)? */
-#define SCM_RWSTRINGP(x) (SCM_TYP7(x) == scm_tc7_string)
+#define SCM_RWSTRINGP(x) (SCM_NIMP(x) && (SCM_TYP7(x) == scm_tc7_string))
#define SCM_NRWSTRINGP(x) (! SCM_RWSTRINGP (x))
\f
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
#define SCM_STRUCTF_LIGHT (1L << 31) /* Light representation
(no hidden words) */
-#define SCM_STRUCTP(X) (SCM_TYP3(X) == scm_tc3_cons_gloc)
+#define SCM_STRUCTP(X) (SCM_NIMP(X) && (SCM_TYP3(X) == scm_tc3_cons_gloc))
#define SCM_STRUCT_DATA(X) ((SCM*)(SCM_CDR(X)))
#define SCM_STRUCT_VTABLE_DATA(X) ((SCM *)(SCM_CAR(X) - 1))
#define SCM_STRUCT_LAYOUT(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_vtable_index_layout])
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
the slots? That's a good question; ask the author. I think it was
the cognac. */
-#define SCM_SYMBOLP(x) (SCM_TYP7S(x)==scm_tc7_ssymbol)
+#define SCM_SYMBOLP(x) (SCM_NIMP(x) && (SCM_TYP7S(x)==scm_tc7_ssymbol))
#define SCM_LENGTH(x) (((unsigned long)SCM_CAR(x))>>8)
#define SCM_LENGTH_MAX (0xffffffL)
#define SCM_SETLENGTH(x, v, t) SCM_SETCAR((x), ((v)<<8)+(t))
#define SCM_SYMBOL_PROPS(X) (SCM_SLOTS(X)[1])
#define SCM_SYMBOL_HASH(X) (*(unsigned long*)(&SCM_SLOTS(X)[2]))
-#define SCM_ROSTRINGP(x) ((SCM_TYP7S(x)==scm_tc7_string) \
- || (SCM_TYP7S(x) == scm_tc7_ssymbol))
-#define SCM_ROCHARS(x) ((SCM_TYP7(x) == scm_tc7_substring) \
+#define SCM_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \
+ || (SCM_TYP7S(x) == scm_tc7_ssymbol)))
+#define SCM_ROCHARS(x) ((char *)((SCM_TYP7(x) == scm_tc7_substring) \
? SCM_INUM (SCM_CADR (x)) + SCM_CHARS (SCM_CDDR (x)) \
- : SCM_CHARS (x))
-#define SCM_ROUCHARS(x) ((SCM_TYP7(x) == scm_tc7_substring) \
+ : SCM_CHARS (x)))
+#define SCM_ROUCHARS(x) ((char *) ((SCM_TYP7(x) == scm_tc7_substring) \
? SCM_INUM (SCM_CADR (x)) + SCM_UCHARS (SCM_CDDR (x))\
- : SCM_UCHARS (x))
+ : SCM_UCHARS (x)))
#define SCM_ROLENGTH(x) SCM_LENGTH (x)
-#define SCM_SUBSTRP(x) ((SCM_TYP7(x) == scm_tc7_substring))
+#define SCM_SUBSTRP(x) (SCM_NIMP(x) && ((SCM_TYP7(x) == scm_tc7_substring)))
#define SCM_SUBSTR_STR(x) (SCM_CDDR (x))
#define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x))
* stored in the SCM_CAR of a non-immediate object have a 1 in bit 1:
*/
-#define SCM_NCONSP(x) (1 & SCM_CAR(x))
-#define SCM_CONSP(x) (!SCM_NCONSP(x))
+#define SCM_NCONSP(x) (SCM_IMP(x) || (1 & SCM_CAR(x)))
+#define SCM_CONSP(x) (SCM_NIMP(x) && !(1 & SCM_CAR(x)))
/* SCM_ECONSP should be used instead of SCM_CONSP at places where GLOCS
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
extern long scm_tc16_mutex;
extern long scm_tc16_condvar;
-#define SCM_THREADP(obj) (scm_tc16_thread == SCM_TYP16 (obj))
+#define SCM_THREADP(obj) (SCM_NIMP(obj) && (scm_tc16_thread == SCM_TYP16 (obj)))
#define SCM_THREAD_DATA(obj) ((void *) SCM_CDR (obj))
-#define SCM_MUTEXP(obj) (scm_tc16_mutex == SCM_TYP16 (obj))
+#define SCM_MUTEXP(obj) (SCM_NIMP(obj) && (scm_tc16_mutex == SCM_TYP16 (obj)))
#define SCM_MUTEX_DATA(obj) ((void *) SCM_CDR (obj))
-#define SCM_CONDVARP(obj) (scm_tc16_condvar == SCM_TYP16 (obj))
+#define SCM_CONDVARP(obj) (SCM_NIMP(obj) && (scm_tc16_condvar == SCM_TYP16 (obj)))
#define SCM_CONDVAR_DATA(obj) ((void *) SCM_CDR (obj))
/* Initialize implementation specific details of the threads support */
/* the jump buffer data structure */
static int scm_tc16_jmpbuffer;
-#define SCM_JMPBUFP(O) (SCM_TYP16(O) == scm_tc16_jmpbuffer)
+#define SCM_JMPBUFP(O) (SCM_NIMP(O) && (SCM_TYP16(O) == scm_tc16_jmpbuffer))
#define JBACTIVE(O) (SCM_CAR (O) & (1L << 16L))
#define ACTIVATEJB(O) (SCM_SETOR_CAR (O, (1L << 16L)))
#define DEACTIVATEJB(O) (SCM_SETAND_CAR (O, ~(1L << 16L)))
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
extern long scm_tc16_array;
-#define SCM_ARRAYP(a) (scm_tc16_array==SCM_TYP16(a))
+#define SCM_ARRAYP(a) (SCM_NIMP(a) && (scm_tc16_array==SCM_TYP16(a)))
#define SCM_ARRAY_NDIM(x) ((scm_sizet)(SCM_CAR(x)>>17))
#define SCM_ARRAY_CONTIGUOUS 0x10000
#define SCM_ARRAY_CONTP(x) (SCM_ARRAY_CONTIGUOUS & (int)SCM_CAR(x))
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
extern int scm_tc16_variable;
#define SCM_VARVCELL(V) SCM_CDR(V)
-#define SCM_VARIABLEP(X) (scm_tc16_variable == SCM_CAR(X))
+#define SCM_VARIABLEP(X) (SCM_NIMP(X) && (scm_tc16_variable == SCM_CAR(X)))
#define SCM_UDVARIABLEP(X) (SCM_VARIABLEP(X) && SCM_UNBNDP (SCM_CDR (SCM_VARVCELL (X))))
#define SCM_DEFVARIABLEP(X) (SCM_VARIABLEP(X) && !SCM_UNBNDP (SCM_CDR (SCM_VARVCELL (X))))
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
-#define SCM_VECTORP(x) (SCM_TYP7S(x)==scm_tc7_vector)
+#define SCM_VECTORP(x) (SCM_NIMP(x) && (SCM_TYP7S(x)==scm_tc7_vector))
#define SCM_NVECTORP(x) (!SCM_VECTORP(x))
#define SCM_VELTS(x) ((SCM *)SCM_CDR(x))
#define SCM_SETVELTS SCM_SETCDR
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
-#define SCM_WVECTP(x) (SCM_TYP7(x)==scm_tc7_wvect)
+#define SCM_WVECTP(x) (SCM_NIMP(x) && (SCM_TYP7(x)==scm_tc7_wvect))
#define SCM_IS_WHVEC(X) (SCM_VELTS(X)[-1] == 1)
#define SCM_IS_WHVEC_V(X) (SCM_VELTS(X)[-1] == 2)
#define SCM_IS_WHVEC_B(X) (SCM_VELTS(X)[-1] == 3)