1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +02:00

* *.h: Use SCM_NIMP(X) && in all the FOOP macros.

* *.[ch]: Use do { ... } while (0) idiom in macros that expanded
to a bare block.
This commit is contained in:
Greg J. Badros 1999-12-16 03:46:42 +00:00
parent f353a9e232
commit d3a6bc9484
35 changed files with 186 additions and 102 deletions

View file

@ -42,13 +42,16 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
#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)) #define SCM_ASYNC(X) ((struct scm_async *)SCM_CDR (X))
struct scm_async struct scm_async

View file

@ -43,6 +43,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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 */
# ifdef TIME_WITH_SYS_TIME # ifdef TIME_WITH_SYS_TIME
@ -201,14 +204,14 @@ extern coop_t *coop_wait_for_runnable_thread (void);
#if 0 #if 0
#define SCM_THREAD_SWITCHING_CODE \ #define SCM_THREAD_SWITCHING_CODE \
{ \ do { \
if (scm_thread_count > 1) \ if (scm_thread_count > 1) \
coop_yield(); \ coop_yield(); \
} \ } while (0)
#else #else
#define SCM_THREAD_SWITCHING_CODE \ #define SCM_THREAD_SWITCHING_CODE \
{ \ do { \
if (scm_thread_count > 1) \ if (scm_thread_count > 1) \
{ \ { \
scm_switch_counter--; \ scm_switch_counter--; \
@ -218,7 +221,7 @@ extern coop_t *coop_wait_for_runnable_thread (void);
coop_yield(); \ coop_yield(); \
} \ } \
} \ } \
} \ } while (0)
#endif #endif

View file

@ -45,6 +45,9 @@
* *
* The author can be reached at djurfeldt@nada.kth.se * The author can be reached at djurfeldt@nada.kth.se
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */ * 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 */
#include "libguile/__scm.h" #include "libguile/__scm.h"
@ -93,13 +96,13 @@ extern int scm_check_entry_p, scm_check_apply_p, scm_check_exit_p;
#define CHECK_EXIT scm_check_exit_p #define CHECK_EXIT scm_check_exit_p
#define SCM_RESET_DEBUG_MODE \ #define SCM_RESET_DEBUG_MODE \
{\ do {\
CHECK_ENTRY = SCM_ENTER_FRAME_P || SCM_BREAKPOINTS_P;\ CHECK_ENTRY = SCM_ENTER_FRAME_P || SCM_BREAKPOINTS_P;\
CHECK_APPLY = SCM_APPLY_FRAME_P || SCM_TRACE_P;\ CHECK_APPLY = SCM_APPLY_FRAME_P || SCM_TRACE_P;\
CHECK_EXIT = SCM_EXIT_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_debug_mode = SCM_DEVAL_P || CHECK_ENTRY || CHECK_APPLY || CHECK_EXIT;\
scm_ceval_ptr = scm_debug_mode ? scm_deval : scm_ceval;\ scm_ceval_ptr = scm_debug_mode ? scm_deval : scm_ceval;\
} } while (0)
/* {Evaluator} /* {Evaluator}
@ -163,7 +166,7 @@ extern scm_debug_frame *scm_last_debug_frame;
extern long scm_tc16_debugobj; 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_DEBUGOBJ_FRAME(x) SCM_CDR (x)
#define SCM_SET_DEBUGOBJ_FRAME(x, f) SCM_SETCDR (x, f) #define SCM_SET_DEBUGOBJ_FRAME(x, f) SCM_SETCDR (x, f)
@ -172,7 +175,7 @@ extern long scm_tc16_debugobj;
extern long scm_tc16_memoized; 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_EXP(x) SCM_CAR (SCM_CDR (x))
#define SCM_MEMOIZED_ENV(x) SCM_CDR (SCM_CDR (x)) #define SCM_MEMOIZED_ENV(x) SCM_CDR (SCM_CDR (x))

View file

@ -156,7 +156,7 @@ typedef struct guardsmem {
#define SCM_BEFORE_GUARD(obj) (SCM_GUARDSMEM (obj)->before) #define SCM_BEFORE_GUARD(obj) (SCM_GUARDSMEM (obj)->before)
#define SCM_AFTER_GUARD(obj) (SCM_GUARDSMEM (obj)->after) #define SCM_AFTER_GUARD(obj) (SCM_GUARDSMEM (obj)->after)
#define SCM_GUARD_DATA(obj) (SCM_GUARDSMEM (obj)->data) #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; static long tc16_guards;

View file

@ -1611,7 +1611,7 @@ scm_eval_body (SCM code, SCM env)
{ ++debug.info; debug.info->a.proc = p; debug.info->a.args = l; } { ++debug.info; debug.info->a.proc = p; debug.info->a.args = l; }
#undef ENTER_APPLY #undef ENTER_APPLY
#define ENTER_APPLY \ #define ENTER_APPLY \
{\ do { \
SCM_SET_ARGSREADY (debug);\ SCM_SET_ARGSREADY (debug);\
if (CHECK_APPLY && SCM_TRAPS_P)\ if (CHECK_APPLY && SCM_TRAPS_P)\
if (SCM_APPLY_FRAME_P || (SCM_TRACE_P && PROCTRACEP (proc)))\ if (SCM_APPLY_FRAME_P || (SCM_TRACE_P && PROCTRACEP (proc)))\
@ -1630,7 +1630,7 @@ scm_eval_body (SCM code, SCM env)
scm_ithrow (scm_sym_apply_frame, scm_cons2 (tmp, tail, SCM_EOL), 0);\ scm_ithrow (scm_sym_apply_frame, scm_cons2 (tmp, tail, SCM_EOL), 0);\
}\ }\
}\ }\
} } while (0)
#undef RETURN #undef RETURN
#define RETURN(e) {proc = (e); goto exit;} #define RETURN(e) {proc = (e); goto exit;}
#ifdef STACK_CHECKING #ifdef STACK_CHECKING

View file

@ -42,11 +42,14 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__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_ARITY(hook) (SCM_CAR (hook) >> 16)
#define SCM_HOOK_NAME(hook) SCM_CADR (hook) #define SCM_HOOK_NAME(hook) SCM_CADR (hook)
#define SCM_HOOK_PROCEDURES(hook) SCM_CDDR (hook) #define SCM_HOOK_PROCEDURES(hook) SCM_CDDR (hook)

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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 <stdio.h> #include <stdio.h>
@ -50,8 +53,8 @@
extern long scm_tc16_dir; extern long scm_tc16_dir;
#define SCM_DIRP(x) (SCM_TYP16(x)==(scm_tc16_dir)) #define SCM_DIRP(x) (SCM_NIMP(x) && (SCM_TYP16(x)==(scm_tc16_dir)))
#define SCM_OPDIRP(x) (SCM_CAR(x)==(scm_tc16_dir | SCM_OPN)) #define SCM_OPDIRP(x) (SCM_NIMP(x) && (SCM_CAR(x)==(scm_tc16_dir | SCM_OPN)))
extern SCM scm_chown SCM_P ((SCM object, SCM owner, SCM group)); extern SCM scm_chown SCM_P ((SCM object, SCM owner, SCM group));

View file

@ -44,6 +44,9 @@
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
#include "libguile/root.h" #include "libguile/root.h"
#include "libguile/vectors.h" #include "libguile/vectors.h"
@ -72,7 +75,7 @@
extern long scm_tc16_fluid; 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) #define SCM_FLUID_NUM(x) SCM_CDR(x)
/* The fastest way to acces/modify the value of a fluid. These macros /* The fastest way to acces/modify the value of a fluid. These macros

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -58,10 +61,10 @@ struct scm_fport {
#define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x)) #define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x))
#define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes) #define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes)
#define SCM_FPORTP(x) (SCM_TYP16S(x)==scm_tc7_port) #define SCM_FPORTP(x) (SCM_NIMP(x) && (SCM_TYP16S(x)==scm_tc7_port))
#define SCM_OPFPORTP(x) (((0xfeff | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN)) #define SCM_OPFPORTP(x) (SCM_NIMP(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_OPINFPORTP(x) (SCM_NIMP(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_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. */ /* test whether fdes supports random access. */
#define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1) #define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1)

View file

@ -38,6 +38,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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 */
#ifndef SCM_FSU_PTHREADS_H #ifndef SCM_FSU_PTHREADS_H
@ -99,24 +102,24 @@
#define SCM_NO_CRITICAL_SECTION_OWNER 0 #define SCM_NO_CRITICAL_SECTION_OWNER 0
#define SCM_DEFER_INTS \ #define SCM_DEFER_INTS \
{ \ do { \
SCM_IASSERT(scm_critical_section_owner != pthread_self()); \ SCM_IASSERT(scm_critical_section_owner != pthread_self()); \
pthread_mutex_lock(&scm_critical_section_mutex); \ pthread_mutex_lock(&scm_critical_section_mutex); \
scm_critical_section_owner = pthread_self(); \ scm_critical_section_owner = pthread_self(); \
scm_ints_disabled = 1; \ scm_ints_disabled = 1; \
} } while (0)
#define SCM_ALLOW_INTS \ #define SCM_ALLOW_INTS \
{ \ do { \
SCM_IASSERT(scm_critical_section_owner == pthread_self()); \ SCM_IASSERT(scm_critical_section_owner == pthread_self()); \
scm_ints_disabled = 0; \ scm_ints_disabled = 0; \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \ scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock(&scm_critical_section_mutex); \ pthread_mutex_unlock(&scm_critical_section_mutex); \
SCM_CHECK_INTS; \ SCM_CHECK_INTS; \
} } while (0)
#define SCM_REDEFER_INTS \ #define SCM_REDEFER_INTS \
{ \ do { \
if ((scm_critical_section_owner != pthread_self()) || \ if ((scm_critical_section_owner != pthread_self()) || \
(scm_critical_section_owner == SCM_NO_CRITICAL_SECTION_OWNER)) \ (scm_critical_section_owner == SCM_NO_CRITICAL_SECTION_OWNER)) \
{ \ { \
@ -124,10 +127,10 @@
scm_critical_section_owner = pthread_self(); \ scm_critical_section_owner = pthread_self(); \
} \ } \
++scm_ints_disabled; \ ++scm_ints_disabled; \
} } while (0)
#define SCM_REALLOW_INTS \ #define SCM_REALLOW_INTS \
{ \ do { \
SCM_IASSERT(scm_critical_section_owner == pthread_self()); \ SCM_IASSERT(scm_critical_section_owner == pthread_self()); \
--scm_ints_disabled; \ --scm_ints_disabled; \
if (!scm_ints_disabled) \ if (!scm_ints_disabled) \
@ -136,7 +139,7 @@
pthread_mutex_unlock(&scm_critical_section_mutex); \ pthread_mutex_unlock(&scm_critical_section_mutex); \
SCM_CHECK_INTS; \ SCM_CHECK_INTS; \
} \ } \
} } while (0)
*fixme* *fixme*
#define scm_root ((scm_root_state *) pthread_self()->prots) #define scm_root ((scm_root_state *) pthread_self()->prots)

View file

@ -42,12 +42,15 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
#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)) #define SCM_NFREEP(x) (!SCM_FREEP(x))
/* 1. This shouldn't be used on immediates. /* 1. This shouldn't be used on immediates.

View file

@ -87,28 +87,28 @@
* debugger. * debugger.
*/ */
#define SCM_BEGIN_FOREIGN_BLOCK \ #define SCM_BEGIN_FOREIGN_BLOCK \
{ \ do { \
old_ints = scm_ints_disabled; scm_ints_disabled = 1; \ old_ints = scm_ints_disabled; scm_ints_disabled = 1; \
old_gc = scm_block_gc; scm_block_gc = 1; \ old_gc = scm_block_gc; scm_block_gc = 1; \
scm_print_carefully_p = 1; \ scm_print_carefully_p = 1; \
} \ } while (0)
#define SCM_END_FOREIGN_BLOCK \ #define SCM_END_FOREIGN_BLOCK \
{ \ do { \
scm_print_carefully_p = 0; \ scm_print_carefully_p = 0; \
scm_block_gc = old_gc; \ scm_block_gc = old_gc; \
scm_ints_disabled = old_ints; \ scm_ints_disabled = old_ints; \
} \ } while (0)
#define RESET_STRING { gdb_output_length = 0; } #define RESET_STRING { gdb_output_length = 0; }
#define SEND_STRING(str) \ #define SEND_STRING(str) \
{ \ do { \
gdb_output = str; \ gdb_output = str; \
gdb_output_length = strlen (str); \ gdb_output_length = strlen (str); \
} \ } while (0)
/* {Gdb interface} /* {Gdb interface}

View file

@ -72,19 +72,19 @@ static long scm_tc16_guardian;
so that no synchronization between these needs to take place. so that no synchronization between these needs to take place.
*/ */
#define TCONC_IN(tc, obj, pair) \ #define TCONC_IN(tc, obj, pair) \
{ \ do { \
SCM_SETCAR ((tc).tail, obj); \ SCM_SETCAR ((tc).tail, obj); \
SCM_SETCAR (pair, SCM_BOOL_F); \ SCM_SETCAR (pair, SCM_BOOL_F); \
SCM_SETCDR (pair, SCM_BOOL_F); \ SCM_SETCDR (pair, SCM_BOOL_F); \
SCM_SETCDR ((tc).tail, pair); \ SCM_SETCDR ((tc).tail, pair); \
(tc).tail = pair; \ (tc).tail = pair; \
} \ } while (0)
#define TCONC_OUT(tc, res) \ #define TCONC_OUT(tc, res) \
{ \ do { \
(res) = SCM_CAR ((tc).head); \ (res) = SCM_CAR ((tc).head); \
(tc).head = SCM_CDR ((tc).head); \ (tc).head = SCM_CDR ((tc).head); \
} \ } while (0)
#define TCONC_EMPTYP(tc) ((tc).head == (tc).tail) #define TCONC_EMPTYP(tc) ((tc).head == (tc).tail)

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -49,7 +52,7 @@
extern int scm_tc16_keyword; 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)) #define SCM_KEYWORDSYM(X) (SCM_CDR(X))

View file

@ -43,6 +43,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -111,43 +114,43 @@
#define SCM_THREAD_REDEFER pthread_kernel_lock++ #define SCM_THREAD_REDEFER pthread_kernel_lock++
#define SCM_THREAD_REALLOW_1 pthread_kernel_lock-- #define SCM_THREAD_REALLOW_1 pthread_kernel_lock--
#define SCM_THREAD_REALLOW_2 \ #define SCM_THREAD_REALLOW_2 \
{ \ do { \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \ scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock(&scm_critical_section_mutex); \ pthread_mutex_unlock(&scm_critical_section_mutex); \
} } while (0)
#else #else
#define SCM_NO_CRITICAL_SECTION_OWNER 0 #define SCM_NO_CRITICAL_SECTION_OWNER 0
#define SCM_THREAD_DEFER \ #define SCM_THREAD_DEFER \
{ \ do { \
pthread_mutex_lock (&scm_critical_section_mutex); \ pthread_mutex_lock (&scm_critical_section_mutex); \
scm_critical_section_owner = pthread_self(); \ scm_critical_section_owner = pthread_self(); \
} } while (0)
#define SCM_THREAD_ALLOW \ #define SCM_THREAD_ALLOW \
{ \ do { \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \ scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock (&scm_critical_section_mutex); \ pthread_mutex_unlock (&scm_critical_section_mutex); \
} } while (0)
#define SCM_THREAD_REDEFER \ #define SCM_THREAD_REDEFER \
{ \ do { \
if ((scm_critical_section_owner != pthread_self()) || \ if ((scm_critical_section_owner != pthread_self()) || \
(scm_critical_section_owner == SCM_NO_CRITICAL_SECTION_OWNER)) \ (scm_critical_section_owner == SCM_NO_CRITICAL_SECTION_OWNER)) \
{ \ { \
pthread_mutex_lock(&scm_critical_section_mutex); \ pthread_mutex_lock(&scm_critical_section_mutex); \
scm_critical_section_owner = pthread_self(); \ scm_critical_section_owner = pthread_self(); \
} \ } \
} } while (0)
#define SCM_THREAD_REALLOW_1 #define SCM_THREAD_REALLOW_1
#define SCM_THREAD_REALLOW_2 \ #define SCM_THREAD_REALLOW_2 \
{ \ do { \
scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \ scm_critical_section_owner = SCM_NO_CRITICAL_SECTION_OWNER; \
pthread_mutex_unlock (&scm_critical_section_mutex); \ pthread_mutex_unlock (&scm_critical_section_mutex); \
} } while (0)
#endif #endif
@ -155,12 +158,12 @@
#define SCM_THREAD_LOCAL_DATA (pthread_self () -> attr.arg_attr) #define SCM_THREAD_LOCAL_DATA (pthread_self () -> attr.arg_attr)
#define SCM_SET_THREAD_LOCAL_DATA(new_root) \ #define SCM_SET_THREAD_LOCAL_DATA(new_root) \
{ \ do { \
pthread_t t = pthread_self (); \ pthread_t t = pthread_self (); \
void *r = (new_root); \ void *r = (new_root); \
pthread_attr_setcleanup (&t -> attr, NULL, r); \ pthread_attr_setcleanup (&t -> attr, NULL, r); \
pthreads_find_info (t) -> root = r; \ pthreads_find_info (t) -> root = r; \
} } while (0)

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -128,20 +131,20 @@
/* Numbers /* Numbers
*/ */
#define SCM_INEXP(x) (SCM_TYP16(x)==scm_tc16_flo) #define SCM_INEXP(x) (SCM_NIMP(x) && (SCM_TYP16(x)==scm_tc16_flo))
#define SCM_CPLXP(x) (SCM_CAR(x)==scm_tc_dblc) #define SCM_CPLXP(x) (SCM_NIMP(x) && (SCM_CAR(x)==scm_tc_dblc))
#define SCM_REAL(x) (*(((scm_dbl *) (SCM2PTR(x)))->real)) #define SCM_REAL(x) (*(((scm_dbl *) (SCM2PTR(x)))->real))
#define SCM_IMAG(x) (*((double *)(SCM_CHARS(x)+sizeof(double)))) #define SCM_IMAG(x) (*((double *)(SCM_CHARS(x)+sizeof(double))))
/* ((&SCM_REAL(x))[1]) */ /* ((&SCM_REAL(x))[1]) */
#ifdef SCM_SINGLES #ifdef SCM_SINGLES
#define SCM_REALP(x) ((~SCM_REAL_PART & 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_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_FLO(x) (((scm_flo *)(SCM2PTR(x)))->num)
#define SCM_REALPART(x) (SCM_SINGP(x)?0.0+SCM_FLO(x):SCM_REAL(x)) #define SCM_REALPART(x) (SCM_SINGP(x)?0.0+SCM_FLO(x):SCM_REAL(x))
#else /* SCM_SINGLES */ #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 #define SCM_REALPART SCM_REAL
#endif /* SCM_SINGLES */ #endif /* SCM_SINGLES */
@ -209,8 +212,8 @@
#define SCM_NUM2DBL(x) ((double) SCM_INUM (x)) #define SCM_NUM2DBL(x) ((double) SCM_INUM (x))
#endif #endif
#endif #endif
#define SCM_NUMP(x) ((0xfcff & (int)SCM_CAR(x))==scm_tc7_smob) #define SCM_NUMP(x) (SCM_NIMP(x) && (0xfcff & (int)SCM_CAR(x))==scm_tc7_smob)
#define SCM_BIGP(x) (SCM_TYP16S(x)==scm_tc16_bigpos) #define SCM_BIGP(x) (SCM_NIMP(x) && SCM_TYP16S(x)==scm_tc16_bigpos)
#define SCM_BIGSIGN(x) (0x0100 & (int)SCM_CAR(x)) #define SCM_BIGSIGN(x) (0x0100 & (int)SCM_CAR(x))
#define SCM_BDIGITS(x) ((SCM_BIGDIG *)(SCM_CDR(x))) #define SCM_BDIGITS(x) ((SCM_BIGDIG *)(SCM_CDR(x)))
#define SCM_NUMDIGS(x) ((scm_sizet)(SCM_CAR(x)>>16)) #define SCM_NUMDIGS(x) ((scm_sizet)(SCM_CAR(x)>>16))

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -150,13 +153,13 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */
/* #define SCM_CRDY (32L<<16) obsolete, for pushed back characters */ /* #define SCM_CRDY (32L<<16) obsolete, for pushed back characters */
#define SCM_BUFLINE (64L<<16) /* Is it line-buffered? */ #define SCM_BUFLINE (64L<<16) /* Is it line-buffered? */
#define SCM_PORTP(x) (SCM_TYP7(x)==scm_tc7_port) #define SCM_PORTP(x) (SCM_NIMP(x) && (SCM_TYP7(x)==scm_tc7_port))
#define SCM_OPPORTP(x) (((0x7f | SCM_OPN) & SCM_CAR(x))==(scm_tc7_port | SCM_OPN)) #define SCM_OPPORTP(x) (SCM_NIMP(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_OPINPORTP(x) (SCM_NIMP(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_OPOUTPORTP(x) (SCM_NIMP(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_INPORTP(x) (SCM_NIMP(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_OUTPORTP(x) (SCM_NIMP(x) && (((0x7f | SCM_WRTNG) & SCM_CAR(x))==(scm_tc7_port | SCM_WRTNG)))
#define SCM_OPENP(x) (SCM_OPN & SCM_CAR(x)) #define SCM_OPENP(x) (SCM_NIMP(x) && (SCM_OPN & SCM_CAR(x)))
#define SCM_CLOSEDP(x) (!SCM_OPENP(x)) #define SCM_CLOSEDP(x) (!SCM_OPENP(x))
#define SCM_PTAB_ENTRY(x) ((scm_port *) SCM_CDR(x)) #define SCM_PTAB_ENTRY(x) ((scm_port *) SCM_CDR(x))
#define SCM_SETPTAB_ENTRY(x,ent) SCM_SETCDR ((x), (SCM)(ent)) #define SCM_SETPTAB_ENTRY(x,ent) SCM_SETCDR ((x), (SCM)(ent))

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -62,15 +65,15 @@ extern scm_option scm_print_opts[];
#define SCM_PRINT_STATE(obj) ((scm_print_state *) SCM_STRUCT_DATA (obj)) #define SCM_PRINT_STATE(obj) ((scm_print_state *) SCM_STRUCT_DATA (obj))
#define RESET_PRINT_STATE(pstate) \ #define RESET_PRINT_STATE(pstate) \
{ \ do { \
pstate->list_offset = 0; \ pstate->list_offset = 0; \
pstate->top = 0; \ pstate->top = 0; \
} } while (0)
#define SCM_WRITINGP(pstate) ((pstate)->writingp) #define SCM_WRITINGP(pstate) ((pstate)->writingp)
#define SCM_SET_WRITINGP(pstate, x) { (pstate)->writingp = (x); } #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_PORT(p) SCM_CADR (p)
#define SCM_PORT_WITH_PS_PS(p) SCM_CDDR (p) #define SCM_PORT_WITH_PS_PS(p) SCM_CDDR (p)

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -97,7 +100,7 @@ typedef struct
/* Closures /* 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_CLOSCAR(x) (SCM_CAR(x)-scm_tc3_closure)
#define SCM_CODE(x) SCM_CAR(SCM_CLOSCAR (x)) #define SCM_CODE(x) SCM_CAR(SCM_CLOSCAR (x))
#define SCM_PROCPROPS(x) SCM_CDR(SCM_CLOSCAR (x)) #define SCM_PROCPROPS(x) SCM_CDR(SCM_CLOSCAR (x))
@ -154,7 +157,7 @@ typedef struct
GETTER and SETTER slots can live directly on the heap, using the GETTER and SETTER slots can live directly on the heap, using the
new four-word cells. */ 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_PROCEDURE(obj) SCM_CADR (obj)
#define SCM_SETTER(obj) SCM_CDDR (obj) #define SCM_SETTER(obj) SCM_CDDR (obj)

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -107,7 +110,7 @@ extern SCM scm_c_random_bignum (scm_rstate *, SCM m);
*/ */
extern long scm_tc16_rstate; extern long scm_tc16_rstate;
#define SCM_RSTATE(obj) ((scm_rstate *) SCM_CDR (obj)) #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]; extern unsigned char scm_masktab[256];

View file

@ -45,11 +45,14 @@
* If you do not wish that, delete this exception notice. * 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/__scm.h"
extern long scm_tc16_regex; extern long scm_tc16_regex;
#define SCM_RGX(X) ((regex_t *) SCM_CDR(X)) #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)); extern SCM scm_make_regexp SCM_P ((SCM pat, SCM flags));
SCM scm_regexp_p SCM_P ((SCM x)); SCM scm_regexp_p SCM_P ((SCM x));

View file

@ -43,6 +43,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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 */
@ -82,7 +85,7 @@ extern SCM scm_sys_protects[];
extern long scm_tc16_root; 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)) #define SCM_ROOT_STATE(root) ((scm_root_state *) SCM_CDR (root))
typedef struct scm_root_state typedef struct scm_root_state

View file

@ -45,6 +45,9 @@
* *
* The author can be reached at djurfeldt@nada.kth.se * The author can be reached at djurfeldt@nada.kth.se
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */ * 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 */
#include "libguile/__scm.h" #include "libguile/__scm.h"
@ -66,10 +69,10 @@
#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_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_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) \ #define scm_whash_insert(whash, key, obj) \
{ \ do { \
register SCM w = (whash); \ register SCM w = (whash); \
SCM_WHASHSET (w, scm_whash_create_handle (w, key), obj); \ SCM_WHASHSET (w, scm_whash_create_handle (w, key), obj); \
} \ } while (0)
/* {Source properties} /* {Source properties}
@ -92,7 +95,7 @@ typedef struct scm_srcprops_chunk
scm_srcprops srcprops[1]; scm_srcprops srcprops[1];
} scm_srcprops_chunk; } 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 SRCPROPBRK(p) (SCM_BOOL((1L << 16) & SCM_CAR (p)))
#define SRCPROPPOS(p) ((scm_srcprops *) SCM_CDR (p))->pos #define SRCPROPPOS(p) ((scm_srcprops *) SCM_CDR (p))->pos
#define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12) #define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12)

View file

@ -233,7 +233,7 @@ get_applybody ()
} }
#define NEXT_FRAME(iframe, n, quit) \ #define NEXT_FRAME(iframe, n, quit) \
{ \ do { \
if (SCM_NIMP (iframe->source) \ if (SCM_NIMP (iframe->source) \
&& SCM_MEMOIZED_EXP (iframe->source) == applybody) \ && SCM_MEMOIZED_EXP (iframe->source) == applybody) \
{ \ { \
@ -247,7 +247,7 @@ get_applybody ()
++iframe; \ ++iframe; \
if (--n == 0) \ if (--n == 0) \
goto quit; \ goto quit; \
} \ } while (0)
/* Fill the scm_info_frame vector IFRAME with data from N stack frames /* Fill the scm_info_frame vector IFRAME with data from N stack frames

View file

@ -45,6 +45,9 @@
* *
* The author can be reached at djurfeldt@nada.kth.se * The author can be reached at djurfeldt@nada.kth.se
* Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */ * 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 */
#include "libguile/__scm.h" #include "libguile/__scm.h"
@ -72,11 +75,11 @@ typedef struct scm_stack {
extern SCM scm_stack_type; 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_STACK_LENGTH(stack) (SCM_STACK (stack) -> length)
#define SCM_FRAMEP(obj) (SCM_CONSP (obj) \ #define SCM_FRAMEP(obj) (SCM_CONSP (obj) \
&& SCM_NIMP (SCM_CAR (obj)) \
&& SCM_STACKP (SCM_CAR (obj)) \ && SCM_STACKP (SCM_CAR (obj)) \
&& SCM_INUMP (SCM_CDR (obj))) \ && SCM_INUMP (SCM_CDR (obj))) \

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -52,11 +55,11 @@
#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)) #define SCM_NSTRINGP(x) (!SCM_STRINGP(x))
/* Is X a writable string (i.e., not a substring)? */ /* 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)) #define SCM_NRWSTRINGP(x) (! SCM_RWSTRINGP (x))

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -74,7 +77,7 @@ typedef scm_sizet (*scm_struct_free_t) (SCM *vtable, SCM *data);
#define SCM_STRUCTF_LIGHT (1L << 31) /* Light representation #define SCM_STRUCTF_LIGHT (1L << 31) /* Light representation
(no hidden words) */ (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_DATA(X) ((SCM*)(SCM_CDR(X)))
#define SCM_STRUCT_VTABLE_DATA(X) ((SCM *)(SCM_CAR(X) - 1)) #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]) #define SCM_STRUCT_LAYOUT(X) (SCM_STRUCT_VTABLE_DATA(X)[scm_vtable_index_layout])

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -73,7 +76,7 @@ extern int scm_symhash_dim;
the slots? That's a good question; ask the author. I think it was the slots? That's a good question; ask the author. I think it was
the cognac. */ 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(x) (((unsigned long)SCM_CAR(x))>>8)
#define SCM_LENGTH_MAX (0xffffffL) #define SCM_LENGTH_MAX (0xffffffL)
#define SCM_SETLENGTH(x, v, t) SCM_SETCAR((x), ((v)<<8)+(t)) #define SCM_SETLENGTH(x, v, t) SCM_SETCAR((x), ((v)<<8)+(t))
@ -86,16 +89,16 @@ extern int scm_symhash_dim;
#define SCM_SYMBOL_PROPS(X) (SCM_SLOTS(X)[1]) #define SCM_SYMBOL_PROPS(X) (SCM_SLOTS(X)[1])
#define SCM_SYMBOL_HASH(X) (*(unsigned long*)(&SCM_SLOTS(X)[2])) #define SCM_SYMBOL_HASH(X) (*(unsigned long*)(&SCM_SLOTS(X)[2]))
#define SCM_ROSTRINGP(x) ((SCM_TYP7S(x)==scm_tc7_string) \ #define SCM_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \
|| (SCM_TYP7S(x) == scm_tc7_ssymbol)) || (SCM_TYP7S(x) == scm_tc7_ssymbol)))
#define SCM_ROCHARS(x) ((SCM_TYP7(x) == scm_tc7_substring) \ #define SCM_ROCHARS(x) ((char *)((SCM_TYP7(x) == scm_tc7_substring) \
? SCM_INUM (SCM_CADR (x)) + SCM_CHARS (SCM_CDDR (x)) \ ? SCM_INUM (SCM_CADR (x)) + SCM_CHARS (SCM_CDDR (x)) \
: SCM_CHARS (x)) : SCM_CHARS (x)))
#define SCM_ROUCHARS(x) ((SCM_TYP7(x) == scm_tc7_substring) \ #define SCM_ROUCHARS(x) ((char *) ((SCM_TYP7(x) == scm_tc7_substring) \
? SCM_INUM (SCM_CADR (x)) + SCM_UCHARS (SCM_CDDR (x))\ ? 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_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_STR(x) (SCM_CDDR (x))
#define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x)) #define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x))

View file

@ -264,8 +264,8 @@ typedef long SCM;
* stored in the SCM_CAR of a non-immediate object have a 1 in bit 1: * 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_NCONSP(x) (SCM_IMP(x) || (1 & SCM_CAR(x)))
#define SCM_CONSP(x) (!SCM_NCONSP(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 /* SCM_ECONSP should be used instead of SCM_CONSP at places where GLOCS

View file

@ -43,6 +43,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -53,13 +56,13 @@ extern long scm_tc16_thread;
extern long scm_tc16_mutex; extern long scm_tc16_mutex;
extern long scm_tc16_condvar; 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_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_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)) #define SCM_CONDVAR_DATA(obj) ((void *) SCM_CDR (obj))
/* Initialize implementation specific details of the threads support */ /* Initialize implementation specific details of the threads support */

View file

@ -68,7 +68,7 @@
/* the jump buffer data structure */ /* the jump buffer data structure */
static int scm_tc16_jmpbuffer; 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 JBACTIVE(O) (SCM_CAR (O) & (1L << 16L))
#define ACTIVATEJB(O) (SCM_SETOR_CAR (O, (1L << 16L))) #define ACTIVATEJB(O) (SCM_SETOR_CAR (O, (1L << 16L)))
#define DEACTIVATEJB(O) (SCM_SETAND_CAR (O, ~(1L << 16L))) #define DEACTIVATEJB(O) (SCM_SETAND_CAR (O, ~(1L << 16L)))

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -73,7 +76,7 @@ typedef struct scm_array_dim
extern long scm_tc16_array; 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_NDIM(x) ((scm_sizet)(SCM_CAR(x)>>17))
#define SCM_ARRAY_CONTIGUOUS 0x10000 #define SCM_ARRAY_CONTIGUOUS 0x10000
#define SCM_ARRAY_CONTP(x) (SCM_ARRAY_CONTIGUOUS & (int)SCM_CAR(x)) #define SCM_ARRAY_CONTP(x) (SCM_ARRAY_CONTIGUOUS & (int)SCM_CAR(x))

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -53,7 +56,7 @@
extern int scm_tc16_variable; extern int scm_tc16_variable;
#define SCM_VARVCELL(V) SCM_CDR(V) #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_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)))) #define SCM_DEFVARIABLEP(X) (SCM_VARIABLEP(X) && !SCM_UNBNDP (SCM_CDR (SCM_VARVCELL (X))))

View file

@ -42,13 +42,16 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
#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_NVECTORP(x) (!SCM_VECTORP(x))
#define SCM_VELTS(x) ((SCM *)SCM_CDR(x)) #define SCM_VELTS(x) ((SCM *)SCM_CDR(x))
#define SCM_SETVELTS SCM_SETCDR #define SCM_SETVELTS SCM_SETCDR

View file

@ -42,6 +42,9 @@
* If you write modifications of your own for GUILE, it is your choice * If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications. * whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */ * 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/__scm.h"
@ -49,7 +52,7 @@
#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(X) (SCM_VELTS(X)[-1] == 1)
#define SCM_IS_WHVEC_V(X) (SCM_VELTS(X)[-1] == 2) #define SCM_IS_WHVEC_V(X) (SCM_VELTS(X)[-1] == 2)
#define SCM_IS_WHVEC_B(X) (SCM_VELTS(X)[-1] == 3) #define SCM_IS_WHVEC_B(X) (SCM_VELTS(X)[-1] == 3)