1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

* 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.
This commit is contained in:
Greg J. Badros 1999-12-12 18:08:24 +00:00
parent 1bbd0b849f
commit 5bff3127b5
2 changed files with 47 additions and 10 deletions

View file

@ -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__

View file

@ -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);