diff options
author | Greg J. Badros <gjb@cs.washington.edu> | 2000-01-12 01:51:18 +0000 |
---|---|---|
committer | Greg J. Badros <gjb@cs.washington.edu> | 2000-01-12 01:51:18 +0000 |
commit | c1bfcf602b80bca6c6ccec0a100ec59258c4160d (patch) | |
tree | d94171f20b886a35e02b324407af13d27d3957b5 /libguile/scm_validate.h | |
parent | d61f6b028874eee1656d3b4211189fcb80cb8ec0 (diff) | |
download | guile-c1bfcf602b80bca6c6ccec0a100ec59258c4160d.tar.gz |
* scm_validate.h: Added SCM_NUM2LONG_DEF macro. Make
SCM_OUT_OF_RANGE use SCM_MAKINUM, not scm_long2num. Added
SCM_COERCE_ROSTRING macro. Added SCM_VALIDATE_NONEMPTYLIST
macro. Fix SCM_VALIDATE_STRINGORSUBSTR macro to not use SLOPPY
variants.
* ports.c (scm_port_closed_p): Validate that the arg is a PORT,
then return whether it's an open port (was validating that it was
an open port -- this was a bug I introduced back in December, but
my careful reading of diffs caught it).
* numbers.c: Recombine the two conditional-compilation paths for
all the log* primitives -- they were split based on #ifndef
scm_long2num; factored out a SCM_LOGOP_RETURN macro, and fixed
some bugs and inconsistencies in the two sets of implementations.
(scm_lognot) Fixed *atrocious* re-use of a SCM as an integer!
* ioext.c: Use SCM_ASSERT_RANGE in a couple places, and
SCM_VALIDATE_INUM_COPY once where it should've been used.
* fluids.c (scm_internal_with_fluids): Use
SCM_VALIDATE_LIST_COPYLEN.
* filesys.c: Use SCM_NUM2LONG instead of SCM_VALIDATE_INUM_COPY;
this is questionable as it relaxes type safety, but other changes
were useful and all SCM_NUM2LONG's should probably be
revisited. Use SCM_OUT_OF_RANGE, SCM_WRONG_TYPE_ARG.
* evalext.c: line-break change on 1 line.
* eval.c (nconc2last): Takes a non-empty list as its first
argument, not just a list.
* dynl.c: Use new SCM_COERCE_ROSTRING macro.
Diffstat (limited to 'libguile/scm_validate.h')
-rw-r--r-- | libguile/scm_validate.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libguile/scm_validate.h b/libguile/scm_validate.h index 5a883cc7c..6b41f158b 100644 --- a/libguile/scm_validate.h +++ b/libguile/scm_validate.h @@ -1,4 +1,4 @@ -/* $Id: scm_validate.h,v 1.16 2000-01-11 19:19:59 gjb Exp $ */ +/* $Id: scm_validate.h,v 1.17 2000-01-12 01:51:18 gjb Exp $ */ /* Copyright (C) 1999 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -54,6 +54,9 @@ #define SCM_SYSERROR_MSG(str,args,val) \ do { scm_syserror_msg(FUNC_NAME,(str),(args),(val)); } while (0) +#define SCM_COERCE_ROSTRING(pos,scm) \ + do { scm = scm_coerce_rostring (scm, FUNC_NAME, pos); } while (0) + #define SCM_WTA(pos,scm) \ do { scm_wta(scm,(char *)pos,FUNC_NAME); } while (0) @@ -70,9 +73,11 @@ #define SCM_NUM2LONG(pos,arg) (scm_num2long(arg, (char *) pos, FUNC_NAME)) +#define SCM_NUM2LONG_DEF(pos,arg,def) (SCM_UNBNDP(arg)?SCM_MAKINUM(def):(scm_num2long(arg, (char *) pos, FUNC_NAME))) + #define SCM_NUM2LONG_LONG(pos,arg) (scm_num2long_long(arg, (char *) pos, FUNC_NAME)) -#define SCM_OUT_OF_RANGE(pos,arg) do { scm_out_of_range_pos(FUNC_NAME,arg,scm_long2num(pos)); } while (0) +#define SCM_OUT_OF_RANGE(pos,arg) do { scm_out_of_range_pos(FUNC_NAME,arg, SCM_MAKINUM(pos)); } while (0) #define SCM_ASSERT_RANGE(pos,arg,f) do { SCM_ASSERT(f,arg,SCM_OUTOFRANGE,FUNC_NAME); } while (0) @@ -114,8 +119,8 @@ #define SCM_VALIDATE_STRING(pos,str) SCM_MAKE_VALIDATE(pos,str,STRINGP) #define SCM_VALIDATE_STRINGORSUBSTR(pos,str) \ - do { SCM_ASSERT(SCM_SLOPPY_STRINGP (str) || \ - SCM_SLOPPY_SUBSTRP(str), str, pos, FUNC_NAME); } while (0) + do { SCM_ASSERT(SCM_STRINGP (str) || \ + SCM_SUBSTRP(str), str, pos, FUNC_NAME); } while (0) #define SCM_VALIDATE_STRING_COPY(pos,str,cvar) \ do { SCM_ASSERT(SCM_STRINGP (str), str, pos, FUNC_NAME); \ @@ -171,6 +176,9 @@ #define SCM_VALIDATE_LIST(pos,lst) \ do { SCM_ASSERT (scm_ilength (lst) >= 0, lst, pos, FUNC_NAME); } while (0) +#define SCM_VALIDATE_NONEMPTYLIST(pos,lst) \ + do { SCM_ASSERT (scm_ilength (lst) > 0, lst, pos, FUNC_NAME); } while (0) + #define SCM_VALIDATE_LIST_COPYLEN(pos,lst,cvar) \ do { cvar = scm_ilength(lst); SCM_ASSERT(cvar >= 0,lst,pos,FUNC_NAME); } while (0) |