diff options
author | Greg J. Badros <gjb@cs.washington.edu> | 1999-12-19 01:04:37 +0000 |
---|---|---|
committer | Greg J. Badros <gjb@cs.washington.edu> | 1999-12-19 01:04:37 +0000 |
commit | 30939477457667b1307de3d2d3251bcd188ebf1b (patch) | |
tree | 81bcc6c4292f15c577582e2e81b836c1924c155d /libguile | |
parent | 97b9d8ba4e1a38c87a2dd58a2aa346fed0204812 (diff) | |
download | guile-30939477457667b1307de3d2d3251bcd188ebf1b.tar.gz |
* tags.h (SCM_CONSP, SCM_NCONSP): Define these in terms of
SCM_SLOPPY_CONSP and SCM_SLOPPY_NCONSP. (SCM_CONSP) Define this
in terms of SCM_SLOPPY_NCONSP instead of repeating the
expression.
* symbols.h (SCM_SLOPPY_SUBSTRP, SCM_SUBSTRP): Added former, and
define latter in terms of sloppy variant.
* strings.h (SCM_SLOPPY_STRINGP, SCM_STRINGP): Added former, and
define latter in terms of sloppy variant.
* scm_validate.h (SCM_MAKE_VALIDATE): Added this macro to factor
out the commonality of the various basic SCM_VALIDATE_foop
macros. Use SCM_MAKE_VALIDATE macro where possible. Fix
SCM_VALIDATE_INT_COPY to not use scm_num2ulong -- that does
coercion to an integer which is more advanced than desired and
SCM_NUM2ULONG provides that functionality. Use SCM_ASSERT_RANGE
appropriately for the various _MIN, _MAX, _RANGE macros. Drop
some superfluous "SCM_NIMP &&" where possible. Eliminate obsoleted
SCM_VALIDATE_NIMCONS (SCM_VALIDATE_CONS now does the NIMP test as
part of its SCM_CONSP test).
* socket.c, ports.c, pairs.c, list.c, lang.c, async.c: Use
SCM_VALIDATE_CONS, not obsoleted SCM_VALIDATE_NIMCONS.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/async.c | 2 | ||||
-rw-r--r-- | libguile/lang.c | 4 | ||||
-rw-r--r-- | libguile/list.c | 8 | ||||
-rw-r--r-- | libguile/pairs.c | 4 | ||||
-rw-r--r-- | libguile/ports.c | 2 | ||||
-rw-r--r-- | libguile/scm_validate.h | 160 | ||||
-rw-r--r-- | libguile/socket.c | 2 | ||||
-rw-r--r-- | libguile/strings.h | 3 | ||||
-rw-r--r-- | libguile/symbols.h | 3 | ||||
-rw-r--r-- | libguile/tags.h | 6 |
10 files changed, 79 insertions, 115 deletions
diff --git a/libguile/async.c b/libguile/async.c index db636611e..6b0c7364a 100644 --- a/libguile/async.c +++ b/libguile/async.c @@ -346,7 +346,7 @@ GUILE_PROC(scm_run_asyncs, "run-asyncs", 1, 0, 0, { SCM a; struct scm_async * it; - SCM_VALIDATE_NIMCONS(1,list_of_a); + SCM_VALIDATE_CONS(1,list_of_a); a = SCM_CAR (list_of_a); SCM_ASSERT (SCM_ASYNCP (a), a, SCM_ARG1, FUNC_NAME); it = SCM_ASYNC (a); diff --git a/libguile/lang.c b/libguile/lang.c index 25181309a..3fe42c1c5 100644 --- a/libguile/lang.c +++ b/libguile/lang.c @@ -84,7 +84,7 @@ GUILE_PROC (scm_nil_car, "nil-car", 1, 0, 0, { if (SCM_NILP (x)) return scm_nil; - SCM_VALIDATE_NIMCONS(1,x); + SCM_VALIDATE_CONS(1,x); return SCM_CAR (x); } #undef FUNC_NAME @@ -96,7 +96,7 @@ GUILE_PROC (scm_nil_cdr, "nil-cdr", 1, 0, 0, { if (SCM_NILP (x)) return scm_nil; - SCM_VALIDATE_NIMCONS(1,x); + SCM_VALIDATE_CONS(1,x); return SCM_EOL2NIL (SCM_CDR (x), x); } #undef FUNC_NAME diff --git a/libguile/list.c b/libguile/list.c index 556dbf7ab..eac4c9292 100644 --- a/libguile/list.c +++ b/libguile/list.c @@ -233,7 +233,7 @@ GUILE_PROC (scm_append_x, "append!", 0, 0, 1, args = SCM_CDR(args); if (SCM_NULLP(args)) return arg; if (SCM_NULLP(arg)) goto tail; - SCM_VALIDATE_NIMCONS(SCM_ARG1,arg); + SCM_VALIDATE_CONS(SCM_ARG1,arg); SCM_SETCDR (scm_last_pair (arg), scm_append_x (args)); return arg; } @@ -252,7 +252,7 @@ GUILE_PROC(scm_last_pair, "last-pair", 1, 0, 0, if (SCM_NULLP (sx)) return SCM_EOL; - SCM_VALIDATE_NIMCONS(SCM_ARG1,res); + SCM_VALIDATE_CONS(SCM_ARG1,res); while (!0) { x = SCM_CDR(res); if (SCM_IMP(x) || SCM_NCONSP(x)) return res; @@ -386,7 +386,7 @@ or returning the results of cdring @var{k} times down @var{lst}.") register long i; SCM_VALIDATE_INT_MIN_COPY(2,k,0,i); while (i-- > 0) { - SCM_VALIDATE_NIMCONS(1,lst); + SCM_VALIDATE_CONS(1,lst); lst = SCM_CDR(lst); } return lst; @@ -432,7 +432,7 @@ return it.") pos = &answer; while (i-- > 0) { - SCM_VALIDATE_NIMCONS(1,lst); + SCM_VALIDATE_CONS(1,lst); *pos = scm_cons (SCM_CAR (lst), SCM_EOL); pos = SCM_CDRLOC (*pos); lst = SCM_CDR(lst); diff --git a/libguile/pairs.c b/libguile/pairs.c index 8211426c4..96f1896e7 100644 --- a/libguile/pairs.c +++ b/libguile/pairs.c @@ -99,7 +99,7 @@ GUILE_PROC (scm_set_car_x, "set-car!", 2, 0, 0, "") #define FUNC_NAME s_scm_set_car_x { - SCM_VALIDATE_NIMCONS(1,pair); + SCM_VALIDATE_CONS(1,pair); SCM_SETCAR (pair, value); return SCM_UNSPECIFIED; } @@ -110,7 +110,7 @@ GUILE_PROC (scm_set_cdr_x, "set-cdr!", 2, 0, 0, "") #define FUNC_NAME s_scm_set_cdr_x { - SCM_VALIDATE_NIMCONS(1,pair); + SCM_VALIDATE_CONS(1,pair); SCM_SETCDR (pair, value); return SCM_UNSPECIFIED; } diff --git a/libguile/ports.c b/libguile/ports.c index 1a765c7f2..c584b0739 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -610,7 +610,7 @@ which are not needed in the new process.") #define FUNC_NAME s_scm_close_all_ports_except { int i = 0; - SCM_VALIDATE_NIMCONS(1,ports); + SCM_VALIDATE_CONS(1,ports); while (i < scm_port_table_size) { SCM thisport = scm_port_table[i]->port; diff --git a/libguile/scm_validate.h b/libguile/scm_validate.h index d47392125..3af1c9789 100644 --- a/libguile/scm_validate.h +++ b/libguile/scm_validate.h @@ -1,4 +1,4 @@ -/* $Id: scm_validate.h,v 1.7 1999-12-16 20:48:04 gjb Exp $ */ +/* $Id: scm_validate.h,v 1.8 1999-12-19 01:04:36 gjb Exp $ */ /* Copyright (C) 1999 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -85,33 +85,26 @@ #define SCM_MUST_MALLOC(size) (scm_must_malloc((size), FUNC_NAME)) -#define SCM_MAKE_NIM_VALIDATE(pos,var,pred) \ - do { SCM_ASSERT (SCM_NIMP(var) && SCM ## pred(var), var, pos, FUNC_NAME); } while (0) - #define SCM_MAKE_VALIDATE(pos,var,pred) \ - do { SCM_ASSERT (SCM ## pred(var), var, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT (SCM_ ## pred(var), var, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_NIM(pos,scm) \ - do { SCM_ASSERT(SCM_NIMP(scm), scm, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_NIM(pos,scm) SCM_MAKE_VALIDATE(pos,scm,NIMP) -#define SCM_VALIDATE_BOOL(pos,flag) \ - do { SCM_ASSERT(SCM_BOOLP(flag), pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_BOOL(pos,flag) SCM_MAKE_VALIDATE(pos,flag,BOOLP) #define SCM_VALIDATE_BOOL_COPY(pos,flag,cvar) \ do { SCM_ASSERT(SCM_BOOLP(flags), flag, pos, FUNC_NAME); \ cvar = (SCM_BOOL_T == flag)? 1: 0; } while (0) -#define SCM_VALIDATE_CHAR(pos,scm) \ - do { SCM_ASSERT(SCM_ICHRP(scm), scm, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_CHAR(pos,scm) SCM_MAKE_VALIDATE(pos,scm,ICHRP) #define SCM_VALIDATE_CHAR_COPY(pos,scm,cvar) \ do { SCM_ASSERT(SCM_ICHRP(scm), scm, pos, FUNC_NAME); \ cvar = SCM_ICHR(scm); } while (0) -#define SCM_VALIDATE_ROSTRING(pos,str) \ - do { SCM_ASSERT(SCM_NIMP (str) && SCM_ROSTRINGP (str), str, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_ROSTRING(pos,str) SCM_MAKE_VALIDATE(pos,str,ROSTRINGP) #define SCM_VALIDATE_ROSTRING_COPY(pos,str,cvar) \ do { SCM_ASSERT(SCM_NIMP (str) && SCM_ROSTRINGP (str), str, pos, FUNC_NAME); \ @@ -121,50 +114,48 @@ do { SCM_ASSERT(SCM_FALSEP(str) || (SCM_NIMP (str) && SCM_ROSTRINGP (str)), str, pos, FUNC_NAME); \ if (SCM_FALSEP(str)) cvar = NULL; else cvar = SCM_ROCHARS(str); } while (0) -#define SCM_VALIDATE_STRING(pos,str) \ - do { SCM_ASSERT(SCM_NIMP (str) && SCM_STRINGP (str), str, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_STRING(pos,str) SCM_MAKE_VALIDATE(pos,str,STRINGP) #define SCM_VALIDATE_STRINGORSUBSTR(pos,str) \ - do { SCM_ASSERT(SCM_NIMP (str) && (SCM_STRINGP (str) || SCM_SUBSTRP(str)), str, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT(SCM_NIMP (str) && \ + (SCM_SLOPPY_STRINGP (str) || SCM_SLOPPY_SUBSTRP(str)), str, pos, FUNC_NAME); } while (0) #define SCM_VALIDATE_STRING_COPY(pos,str,cvar) \ - do { SCM_ASSERT(SCM_NIMP (str) && SCM_STRINGP (str), str, pos, FUNC_NAME); \ + do { SCM_ASSERT(SCM_STRINGP (str), str, pos, FUNC_NAME); \ cvar = SCM_CHARS(str); } while (0) #define SCM_VALIDATE_RWSTRING(pos,str) \ - do { SCM_ASSERT(SCM_NIMP (str) && SCM_STRINGP (str), str, pos, FUNC_NAME); \ + do { SCM_ASSERT(SCM_STRINGP (str), str, pos, FUNC_NAME); \ if (!SCM_RWSTRINGP(str)) scm_misc_error(FUNC_NAME, "argument is a read-only string", str); } while (0) -#define SCM_VALIDATE_REAL(pos,z) \ - do { SCM_ASSERT (SCM_NIMP (z) && SCM_REALP (z), z, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_REAL(pos,z) SCM_MAKE_VALIDATE(pos,z,REALP) -#define SCM_VALIDATE_INT(pos,k) \ - do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_INT(pos,k) SCM_MAKE_VALIDATE(pos,k,INUMP) #define SCM_VALIDATE_INT_COPY(pos,k,cvar) \ - do { cvar = scm_num2ulong(k,(char *)pos,FUNC_NAME); } while (0) + do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \ + cvar = SCM_INUM(k); } while (0) -#define SCM_VALIDATE_BIGINT(pos,k) \ - do { SCM_ASSERT(SCM_NIMP(k) && SCM_BIGP(k), k, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_BIGINT(pos,k) SCM_MAKE_VALIDATE(pos,k,BIGP) #define SCM_VALIDATE_INT_MIN(pos,k,min) \ do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \ - SCM_ASSERT(SCM_INUM(k) >= min, k, SCM_OUTOFRANGE, FUNC_NAME); } while (0) + SCM_ASSERT_RANGE(pos,k,(SCM_INUM(k) >= min)); } while (0) #define SCM_VALIDATE_INT_MIN_COPY(pos,k,min,cvar) \ do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \ cvar = SCM_INUM(k); \ - SCM_ASSERT(cvar >= min, k, SCM_OUTOFRANGE, FUNC_NAME); } while (0) + SCM_ASSERT_RANGE(pos,k,(cvar >= min)); } while (0) #define SCM_VALIDATE_INT_MIN_DEF_COPY(pos,k,min,default,cvar) \ do { if (SCM_UNBNDP(k)) k = SCM_MAKINUM(default); \ SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \ cvar = SCM_INUM(k); \ - SCM_ASSERT(cvar >= min, k, SCM_OUTOFRANGE, FUNC_NAME); } while (0) - + SCM_ASSERT_RANGE(pos,k,(cvar >= min)); } while (0) #define SCM_VALIDATE_INT_DEF(pos,k,default) \ - do { if (SCM_UNDEFINED==k) k = SCM_MAKINUM(default); else SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); } while (0) + do { if (SCM_UNDEFINED==k) k = SCM_MAKINUM(default); \ + else SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); } while (0) #define SCM_VALIDATE_INT_DEF_COPY(pos,k,default,cvar) \ do { if (SCM_UNDEFINED==k) { k = SCM_MAKINUM(default); cvar=default; } \ @@ -173,18 +164,12 @@ /* [low,high) */ #define SCM_VALIDATE_INT_RANGE(pos,k,low,high) \ do { SCM_ASSERT(SCM_INUMP(k), k, pos, FUNC_NAME); \ - SCM_ASSERT(SCM_INUM (k) >= low && ((unsigned) SCM_INUM (k)) < high, \ - k, SCM_OUTOFRANGE, FUNC_NAME); } while (0) + SCM_ASSERT_RANGE(pos,k,(SCM_INUM (k) >= low && ((unsigned) SCM_INUM (k)) < high)); \ + } while (0) -#define SCM_VALIDATE_NULL(pos,scm) \ - do { SCM_ASSERT(SCM_NULLP(scm), scm, pos, FUNC_NAME); } while (0) - -#define SCM_VALIDATE_CONS(pos,scm) \ - do { SCM_ASSERT(SCM_CONSP(scm), scm, pos, FUNC_NAME); } while (0) - -#define SCM_VALIDATE_NIMCONS(pos,scm) \ - do { SCM_ASSERT(SCM_CONSP(scm), scm, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_NULL(pos,scm) SCM_MAKE_VALIDATE(pos,scm,NULLP) +#define SCM_VALIDATE_CONS(pos,scm) SCM_MAKE_VALIDATE(pos,scm,CONSP) #define SCM_VALIDATE_LIST(pos,lst) \ do { SCM_ASSERT (scm_ilength (lst) >= 0, lst, pos, FUNC_NAME); } while (0) @@ -197,117 +182,94 @@ #define SCM_VALIDATE_ALISTCELL(pos,alist) \ do { \ - SCM_ASSERT(SCM_CONSP(alist), alist, pos, FUNC_NAME); \ - { SCM tmp = SCM_CAR(alist); \ - SCM_ASSERT(SCM_NIMP(tmp) && SCM_CONSP(tmp), alist, pos, FUNC_NAME); } } while (0) + SCM_ASSERT(SCM_CONSP(alist) && SCM_CONSP(SCM_CAR(alist)), alist, pos, FUNC_NAME); \ + } while (0) -#define SCM_VALIDATE_ALISTCELL_COPYSCM(pos,alist,tmp) \ +#define SCM_VALIDATE_ALISTCELL_COPYSCM(pos,alist,cvar) \ do { \ SCM_ASSERT(SCM_CONSP(alist), alist, pos, FUNC_NAME); \ - tmp = SCM_CAR(alist); \ - SCM_ASSERT(SCM_NIMP(tmp) && SCM_CONSP(tmp), alist, pos, FUNC_NAME); } while (0) + cvar = SCM_CAR(alist); \ + SCM_ASSERT(SCM_CONSP(cvar), alist, pos, FUNC_NAME); } while (0) #define SCM_VALIDATE_OPORT_VALUE(pos,port) \ do { SCM_ASSERT (scm_valid_oport_value_p (port), port, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_PRINTSTATE(pos,a) \ - do { SCM_ASSERT (SCM_NIMP (a) && SCM_PRINT_STATE_P (a), a, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_PRINTSTATE(pos,a) SCM_MAKE_VALIDATE(pos,a,PRINT_STATE_P) #define SCM_VALIDATE_SMOB(pos,obj,type) \ do { SCM_ASSERT ((SCM_NIMP(obj) && SCM_TYP16 (obj) == scm_tc16_ ## type), obj, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_ASYNC(pos,a) \ - do { SCM_ASSERT (SCM_NIMP (a) && SCM_ASYNCP (a), a, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_ASYNC(pos,a) SCM_MAKE_VALIDATE(pos,a,ASYNCP) #define SCM_VALIDATE_ASYNC_COPY(pos,a,cvar) \ - do { SCM_ASSERT (SCM_NIMP (a) && SCM_ASYNCP (a), a, pos, FUNC_NAME); \ + do { SCM_ASSERT (SCM_ASYNCP (a), a, pos, FUNC_NAME); \ cvar = SCM_ASYNC(a); } while (0) -#define SCM_VALIDATE_THREAD(pos,a) \ - do { SCM_ASSERT (SCM_NIMP (a) && SCM_THREADP (a), a, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_THREAD(pos,a) SCM_MAKE_VALIDATE(pos,a,THREADP) #define SCM_VALIDATE_THUNK(pos,thunk) \ do { SCM_ASSERT (SCM_NFALSEP (scm_thunk_p (thunk)), thunk, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_SYMBOL(pos,sym) \ - do { SCM_ASSERT (SCM_NIMP(sym) && SCM_SYMBOLP(sym), sym, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_SYMBOL(pos,sym) SCM_MAKE_VALIDATE(pos,sym,SYMBOLP) -#define SCM_VALIDATE_VARIABLE(pos,var) \ - do { SCM_ASSERT (SCM_NIMP(var) && SCM_VARIABLEP(var), var, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_VARIABLE(pos,var) SCM_MAKE_VALIDATE(pos,var,VARIABLEP) -#define SCM_VALIDATE_MEMOIZED(pos,obj) \ - do { SCM_ASSERT (SCM_NIMP(obj) && SCM_MEMOIZEDP(obj), obj, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_MEMOIZED(pos,obj) SCM_MAKE_VALIDATE(pos,obj,MEMOIZEDP) -#define SCM_VALIDATE_CLOSURE(pos,obj) \ - do { SCM_ASSERT (SCM_NIMP(obj) && SCM_CLOSUREP(obj), obj, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_CLOSURE(pos,obj) SCM_MAKE_VALIDATE(pos,obj,CLOSUREP) #define SCM_VALIDATE_PROC(pos,proc) \ do { SCM_ASSERT ( SCM_BOOL_T == scm_procedure_p(proc), proc, pos, FUNC_NAME); } while (0) #define SCM_VALIDATE_NULLORCONS(pos,env) \ - do { SCM_ASSERT (SCM_NULLP (env) || (SCM_NIMP (env) && SCM_CONSP (env)), env, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT (SCM_NULLP (env) || SCM_CONSP (env), env, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_HOOK(pos,a) \ - do { SCM_ASSERT (SCM_NIMP (a) && SCM_HOOKP (a), a, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_HOOK(pos,a) SCM_MAKE_VALIDATE(pos,a,HOOKP) -#define SCM_VALIDATE_RGXP(pos,a) \ - do { SCM_ASSERT (SCM_NIMP (a) && SCM_RGXP (a), a, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_RGXP(pos,a) SCM_MAKE_VALIDATE(pos,a,RGXP) -#define SCM_VALIDATE_OPDIR(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_OPDIRP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_OPDIR(pos,port) SCM_MAKE_VALIDATE(pos,port,OPDIRP) -#define SCM_VALIDATE_DIR(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_DIRP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_DIR(pos,port) SCM_MAKE_VALIDATE(pos,port,DIRP) -#define SCM_VALIDATE_PORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_PORTP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_PORT(pos,port) SCM_MAKE_VALIDATE(pos,port,PORTP) -#define SCM_VALIDATE_FPORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_FPORTP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_FPORT(pos,port) SCM_MAKE_VALIDATE(pos,port,FPORTP) -#define SCM_VALIDATE_OPFPORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_OPFPORTP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_OPFPORT(pos,port) SCM_MAKE_VALIDATE(pos,port,OPFPORTP) -#define SCM_VALIDATE_OPINPORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_OPINPORT(pos,port) SCM_MAKE_VALIDATE(pos,port,OPINPORTP) #define SCM_VALIDATE_OPENPORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_PORTP (port) && SCM_OPENP(port), port, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT (SCM_PORTP (port) && SCM_OPENP(port), port, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_OPPORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_OPPORTP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_OPPORT(pos,port) SCM_MAKE_VALIDATE(pos,port,OPPORTP) -#define SCM_VALIDATE_OPOUTPORT(pos,port) \ - do { SCM_ASSERT (SCM_NIMP (port) && SCM_OPOUTPORTP (port), port, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_OPOUTPORT(pos,port) SCM_MAKE_VALIDATE(pos,port,OPOUTPORTP) -#define SCM_VALIDATE_FLUID(pos,fluid) \ - do { SCM_ASSERT (SCM_NIMP (fluid) && SCM_FLUIDP (fluid), fluid, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_FLUID(pos,fluid) SCM_MAKE_VALIDATE(pos,fluid,FLUIDP) -#define SCM_VALIDATE_KEYWORD(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_KEYWORDP (v), v, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_KEYWORD(pos,v) SCM_MAKE_VALIDATE(pos,v,KEYWORDP) -#define SCM_VALIDATE_STACK(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_STACKP (v), v, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_STACK(pos,v) SCM_MAKE_VALIDATE(pos,v,STACKP) -#define SCM_VALIDATE_FRAME(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_FRAMEP (v), v, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_FRAME(pos,v) SCM_MAKE_VALIDATE(pos,v,FRAMEP) -#define SCM_VALIDATE_RSTATE(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_RSTATEP (v), v, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_RSTATE(pos,v) SCM_MAKE_VALIDATE(pos,v,RSTATEP) #define SCM_VALIDATE_ARRAY(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_BOOL_F != scm_array_p(v,SCM_UNDEFINED), v, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT (SCM_NIMP (v) && \ + SCM_BOOL_F != scm_array_p(v,SCM_UNDEFINED), \ + v, pos, FUNC_NAME); } while (0) -#define SCM_VALIDATE_VECTOR(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_VECTORP (v), v, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_VECTOR(pos,v) SCM_MAKE_VALIDATE(pos,v,VECTORP) -#define SCM_VALIDATE_STRUCT(pos,v) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_STRUCTP (v), v, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_STRUCT(pos,v) SCM_MAKE_VALIDATE(pos,v,STRUCTP) #define SCM_VALIDATE_VTABLE(pos,v) \ do { SCM_ASSERT (SCM_NIMP (v) && SCM_NFALSEP(scm_struct_vtable_p(v)), v, pos, FUNC_NAME); } while (0) #define SCM_VALIDATE_VECTOR_LEN(pos,v,len) \ - do { SCM_ASSERT (SCM_NIMP (v) && SCM_VECTORP (v) && len == SCM_LENGTH(v), v, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT (SCM_VECTORP (v) && len == SCM_LENGTH(v), v, pos, FUNC_NAME); } while (0) #endif diff --git a/libguile/socket.c b/libguile/socket.c index 22a601255..54838c84b 100644 --- a/libguile/socket.c +++ b/libguile/socket.c @@ -883,7 +883,7 @@ any unflushed buffered port data is ignored.") flg = 0; else { - SCM_VALIDATE_NIMCONS(5,args_and_flags); + SCM_VALIDATE_CONS(5,args_and_flags); flg = SCM_NUM2ULONG (5,SCM_CAR (args_and_flags)); } SCM_SYSCALL (rv = sendto (fd, SCM_ROCHARS (message), SCM_ROLENGTH (message), diff --git a/libguile/strings.h b/libguile/strings.h index 279dd57e8..d7decc92f 100644 --- a/libguile/strings.h +++ b/libguile/strings.h @@ -55,7 +55,8 @@ -#define SCM_STRINGP(x) (SCM_NIMP(x) && (SCM_TYP7S(x)==scm_tc7_string)) +#define SCM_SLOPPY_STRINGP(x) ((SCM_TYP7S(x)==scm_tc7_string)) +#define SCM_STRINGP(x) (SCM_NIMP(x) && SCM_SLOPPY_STRINGP(x)) #define SCM_NSTRINGP(x) (!SCM_STRINGP(x)) /* Is X a writable string (i.e., not a substring)? */ diff --git a/libguile/symbols.h b/libguile/symbols.h index d592833ba..cc441c34b 100644 --- a/libguile/symbols.h +++ b/libguile/symbols.h @@ -98,7 +98,8 @@ extern int scm_symhash_dim; ? SCM_INUM (SCM_CADR (x)) + SCM_UCHARS (SCM_CDDR (x))\ : SCM_UCHARS (x))) #define SCM_ROLENGTH(x) SCM_LENGTH (x) -#define SCM_SUBSTRP(x) (SCM_NIMP(x) && ((SCM_TYP7(x) == scm_tc7_substring))) +#define SCM_SLOPPY_SUBSTRP(x) (SCM_TYP7(x) == scm_tc7_substring) +#define SCM_SUBSTRP(x) (SCM_NIMP(x) && SCM_SLOPPY_SUBSTRP(x)) #define SCM_SUBSTR_STR(x) (SCM_CDDR (x)) #define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x)) diff --git a/libguile/tags.h b/libguile/tags.h index 27b36e4c2..fc21e73f3 100644 --- a/libguile/tags.h +++ b/libguile/tags.h @@ -265,10 +265,10 @@ typedef long SCM; */ #define SCM_SLOPPY_NCONSP(x) (1 & SCM_CAR (x)) -#define SCM_SLOPPY_CONSP(x) (!(1 & SCM_CAR (x))) +#define SCM_SLOPPY_CONSP(x) (!SCM_SLOPPY_NCONSP(x)) -#define SCM_NCONSP(x) (SCM_IMP (x) || (1 & SCM_CAR (x))) -#define SCM_CONSP(x) (SCM_NIMP (x) && !(1 & SCM_CAR (x))) +#define SCM_NCONSP(x) (SCM_IMP (x) || SCM_SLOPPY_NCONSP(x)) +#define SCM_CONSP(x) (SCM_NIMP (x) && SCM_SLOPPY_CONSP(x)) /* SCM_ECONSP should be used instead of SCM_CONSP at places where GLOCS |