diff options
author | Greg J. Badros <gjb@cs.washington.edu> | 1999-12-12 18:08:24 +0000 |
---|---|---|
committer | Greg J. Badros <gjb@cs.washington.edu> | 1999-12-12 18:08:24 +0000 |
commit | 5bff3127b542b14a9f881af0b68d61e21712d9c8 (patch) | |
tree | 825d902b224d2473afb8f73785e3bec0848f3f0b | |
parent | 1bbd0b849f6b90f1ffe57e586e4ee5a884f84a11 (diff) | |
download | guile-5bff3127b542b14a9f881af0b68d61e21712d9c8.tar.gz |
* scm_validate.h: Added the FSF copyright to the top.
* strings.c: Use SCM_ASSERT_RANGE in a couple of places instead of
SCM_ASSERT w/ SCM_OUT_OF_RANGE.
-rw-r--r-- | libguile/scm_validate.h | 46 | ||||
-rw-r--r-- | libguile/strings.c | 11 |
2 files changed, 47 insertions, 10 deletions
diff --git a/libguile/scm_validate.h b/libguile/scm_validate.h index 54b529b43..eab2e3d16 100644 --- a/libguile/scm_validate.h +++ b/libguile/scm_validate.h @@ -1,8 +1,46 @@ -/* $Id: scm_validate.h,v 1.1 1999-12-12 02:36:16 gjb Exp $ - * scm_validate.h - * Copyright (C) 1999, Greg J. Badros +/* $Id: scm_validate.h,v 1.2 1999-12-12 18:08:24 gjb Exp $ */ +/* Copyright (C) 1999 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA * - */ + * As a special exception, the Free Software Foundation gives permission + * for additional uses of the text contained in its release of GUILE. + * + * The exception is that, if you link the GUILE library with other files + * to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the GUILE library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the + * Free Software Foundation under the name GUILE. If you copy + * code from other Free Software Foundation releases into a copy of + * GUILE, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * 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. */ + +/* Written by Greg J. Badros <gjb@cs.washington.edu>, Dec-1999 */ #ifndef SCM_VALIDATE_H__ #define SCM_VALIDATE_H__ diff --git a/libguile/strings.c b/libguile/strings.c index 4989436e1..3ed6fa2fc 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -276,7 +276,7 @@ GUILE_PROC(scm_string_ref, "string-ref", 1, 1, 0, { SCM_VALIDATE_ROSTRING(1,str); SCM_VALIDATE_INT_DEF(2,k,0); - SCM_ASSERT (SCM_INUM (k) < SCM_ROLENGTH (str) && SCM_INUM (k) >= 0, k, SCM_OUTOFRANGE, FUNC_NAME); + SCM_ASSERT_RANGE (2,k,SCM_INUM (k) < SCM_ROLENGTH (str) && SCM_INUM (k) >= 0); return SCM_MAKICHR (SCM_ROUCHARS (str)[SCM_INUM (k)]); } #undef FUNC_NAME @@ -305,8 +305,8 @@ GUILE_PROC(scm_substring, "substring", 2, 1, 0, SCM_VALIDATE_ROSTRING(1,str); SCM_VALIDATE_INT(2,start); SCM_VALIDATE_INT_DEF(3,end,SCM_ROLENGTH(str)); - SCM_ASSERT (SCM_INUM (start) <= SCM_ROLENGTH (str), start, SCM_OUTOFRANGE, FUNC_NAME); - SCM_ASSERT (SCM_INUM (end) <= SCM_ROLENGTH (str), end, SCM_OUTOFRANGE, FUNC_NAME); + SCM_ASSERT_RANGE (2,start,SCM_INUM (start) <= SCM_ROLENGTH (str)); + SCM_ASSERT_RANGE (2,end,SCM_INUM (end) <= SCM_ROLENGTH (str)); l = SCM_INUM (end)-SCM_INUM (start); SCM_ASSERT (l >= 0, SCM_MAKINUM (l), SCM_OUTOFRANGE, FUNC_NAME); return scm_makfromstr (&SCM_ROCHARS (str)[SCM_INUM (start)], (scm_sizet)l, 0); @@ -354,9 +354,8 @@ GUILE_PROC(scm_make_shared_substring, "make-shared-substring", 1, 2, 0, SCM_VALIDATE_INT_DEF_COPY(2,frm,0,f); SCM_VALIDATE_INT_DEF_COPY(3,to,0,t); - SCM_ASSERT ((f >= 0), frm, SCM_OUTOFRANGE, FUNC_NAME); - SCM_ASSERT ((f <= t) && (t <= SCM_ROLENGTH (str)), to, SCM_OUTOFRANGE, - FUNC_NAME); + SCM_ASSERT_RANGE (2,frm,(f >= 0)); + SCM_ASSERT_RANGE (3,to, (f <= t) && (t <= SCM_ROLENGTH (str))); SCM_NEWCELL (answer); SCM_NEWCELL (len_str); |