diff options
author | Gary Houston <ghouston@arglist.com> | 2001-01-08 23:10:06 +0000 |
---|---|---|
committer | Gary Houston <ghouston@arglist.com> | 2001-01-08 23:10:06 +0000 |
commit | 60d02d0914b57ba7e1ecd78a9ec27387cfd98b57 (patch) | |
tree | c3671b6c1f6d449539b78c6e419058c17ad6aa6c /libguile/validate.h | |
parent | 264e9cbc9317f94fe29a89fad6f2b5d617f0be27 (diff) | |
download | guile-60d02d0914b57ba7e1ecd78a9ec27387cfd98b57.tar.gz |
* validate.h (SCM_VALIDATE_SUBSTRING_SPEC_COPY): new macro.
* ioext.c (scm_read_string_x_partial, scm_read_delimited_x),
socket.c (scm_recvfrom): use the new macro, plus minor docstring
changes.
* ioext.c (scm_read_string_x_partial): don't crash if -1 is supplied
for fdes. if current input port is used, check that it's a file
port.
Diffstat (limited to 'libguile/validate.h')
-rw-r--r-- | libguile/validate.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libguile/validate.h b/libguile/validate.h index d15460aa5..d44d36c5a 100644 --- a/libguile/validate.h +++ b/libguile/validate.h @@ -1,4 +1,4 @@ -/* $Id: validate.h,v 1.23 2001-01-06 18:46:48 mvo Exp $ */ +/* $Id: validate.h,v 1.24 2001-01-08 23:10:06 ghouston Exp $ */ /* Copyright (C) 1999, 2000 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -135,6 +135,22 @@ cvar = SCM_STRING_CHARS(str); \ } while (0) +/* validate a string and optional start/end arguments which default to + 0/string-len. this is unrelated to the old shared substring + support, so please do not deprecate it :) */ +#define SCM_VALIDATE_SUBSTRING_SPEC_COPY(pos_str, str, c_str, \ + pos_start, start, c_start,\ + pos_end, end, c_end) \ + do {\ + SCM_VALIDATE_STRING_COPY (pos_str, str, c_str);\ + SCM_VALIDATE_INUM_DEF_COPY (pos_start, start, 0, c_start);\ + SCM_VALIDATE_INUM_DEF_COPY (pos_end, end, SCM_STRING_LENGTH (str), c_end);\ + SCM_ASSERT_RANGE (pos_start, start,\ + 0 <= c_start && c_start <= SCM_STRING_LENGTH (str));\ + SCM_ASSERT_RANGE (pos_end, end,\ + c_start <= c_end && c_end <= SCM_STRING_LENGTH (str));\ + } while (0) + #define SCM_VALIDATE_REAL(pos, z) SCM_MAKE_VALIDATE (pos, z, REALP) #define SCM_VALIDATE_NUMBER(pos, z) SCM_MAKE_VALIDATE (pos, z, NUMBERP) |