mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* unif.c, symbols.c, strings.c, stacks.c, random.c, print.c,
posix.c: Eliminated a bunch of SCM_NIMP(..)s that are now redundant with the safer macros. Patch from Dirk Hermann applied by hand. Thanks Dirk! * scm_validate.h: Added SCM_VALIDATE_VECTOR_OR_DVECTOR for some uses in random.c. * ramap.c: whitespace change.
This commit is contained in:
parent
339999c72e
commit
368cf54d89
9 changed files with 24 additions and 37 deletions
|
@ -928,8 +928,7 @@ environ_list_to_c (SCM envlist, int arg, const char *proc)
|
|||
int len;
|
||||
char *src;
|
||||
|
||||
SCM_ASSERT (SCM_NIMP (SCM_CAR (envlist))
|
||||
&& SCM_ROSTRINGP (SCM_CAR (envlist)),
|
||||
SCM_ASSERT (SCM_ROSTRINGP (SCM_CAR (envlist)),
|
||||
envlist, arg, proc);
|
||||
len = 1 + SCM_ROLENGTH (SCM_CAR (envlist));
|
||||
result[i] = malloc ((long) len);
|
||||
|
|
|
@ -888,10 +888,9 @@ circref:
|
|||
int
|
||||
scm_valid_oport_value_p (SCM val)
|
||||
{
|
||||
return (SCM_NIMP (val)
|
||||
&& (SCM_OPOUTPORTP (val)
|
||||
|| (SCM_PORT_WITH_PS_P (val)
|
||||
&& SCM_OPOUTPORTP (SCM_PORT_WITH_PS_PORT (val)))));
|
||||
return (SCM_OPOUTPORTP (val)
|
||||
|| (SCM_PORT_WITH_PS_P (val)
|
||||
&& SCM_OPOUTPORTP (SCM_PORT_WITH_PS_PORT (val))));
|
||||
}
|
||||
|
||||
/* SCM_GPROC(s_write, "write", 1, 1, 0, scm_write, g_write); */
|
||||
|
@ -1022,13 +1021,10 @@ GUILE_PROC (scm_get_print_state, "get-print-state", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_get_print_state
|
||||
{
|
||||
if (SCM_NIMP (port))
|
||||
{
|
||||
if (SCM_PORT_WITH_PS_P (port))
|
||||
return SCM_PORT_WITH_PS_PS (port);
|
||||
if (SCM_OUTPORTP (port))
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
if (SCM_PORT_WITH_PS_P (port))
|
||||
return SCM_PORT_WITH_PS_PS (port);
|
||||
if (SCM_OUTPORTP (port))
|
||||
return SCM_BOOL_F;
|
||||
RETURN_SCM_WTA (1,port);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
|
|
@ -182,8 +182,7 @@ scm_ra_matchp (SCM ra0, SCM ras)
|
|||
bas0 = SCM_ARRAY_BASE (ra0);
|
||||
break;
|
||||
}
|
||||
while SCM_NIMP
|
||||
(ras)
|
||||
while (SCM_NIMP (ras))
|
||||
{
|
||||
ra1 = SCM_CAR (ras);
|
||||
if (SCM_IMP (ra1))
|
||||
|
|
|
@ -466,9 +466,7 @@ GUILE_PROC (scm_random_solid_sphere_x, "random:solid-sphere!", 1, 1, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_random_solid_sphere_x
|
||||
{
|
||||
SCM_ASSERT (SCM_NIMP (v)
|
||||
&& (SCM_VECTORP (v) || SCM_TYP7 (v) == scm_tc7_dvect),
|
||||
v, SCM_ARG1, FUNC_NAME);
|
||||
SCM_VALIDATE_VECTOR_OR_DVECTOR(1,v);
|
||||
if (SCM_UNBNDP (state))
|
||||
state = SCM_CDR (scm_var_random_state);
|
||||
SCM_VALIDATE_RSTATE(2,state);
|
||||
|
@ -486,9 +484,7 @@ GUILE_PROC (scm_random_hollow_sphere_x, "random:hollow-sphere!", 1, 1, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_random_hollow_sphere_x
|
||||
{
|
||||
SCM_ASSERT (SCM_NIMP (v)
|
||||
&& (SCM_VECTORP (v) || SCM_TYP7 (v) == scm_tc7_dvect),
|
||||
v, SCM_ARG1, FUNC_NAME);
|
||||
SCM_VALIDATE_VECTOR_OR_DVECTOR(1,v);
|
||||
if (SCM_UNBNDP (state))
|
||||
state = SCM_CDR (scm_var_random_state);
|
||||
SCM_VALIDATE_RSTATE(2,state);
|
||||
|
@ -505,9 +501,7 @@ GUILE_PROC (scm_random_normal_vector_x, "random:normal-vector!", 1, 1, 0,
|
|||
#define FUNC_NAME s_scm_random_normal_vector_x
|
||||
{
|
||||
int n;
|
||||
SCM_ASSERT (SCM_NIMP (v)
|
||||
&& (SCM_VECTORP (v) || SCM_TYP7 (v) == scm_tc7_dvect),
|
||||
v, SCM_ARG1, FUNC_NAME);
|
||||
SCM_VALIDATE_VECTOR_OR_DVECTOR(1,v);
|
||||
if (SCM_UNBNDP (state))
|
||||
state = SCM_CDR (scm_var_random_state);
|
||||
SCM_VALIDATE_RSTATE(2,state);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: scm_validate.h,v 1.8 1999-12-19 01:04:36 gjb Exp $ */
|
||||
/* $Id: scm_validate.h,v 1.9 2000-01-05 16:16:57 gjb Exp $ */
|
||||
/* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -264,6 +264,11 @@
|
|||
|
||||
#define SCM_VALIDATE_VECTOR(pos,v) SCM_MAKE_VALIDATE(pos,v,VECTORP)
|
||||
|
||||
#define SCM_VALIDATE_VECTOR_OR_DVECTOR(pos,v) \
|
||||
do { SCM_ASSERT ((SCM_VECTORP (v) || \
|
||||
(SCM_NIMP (v) && SCM_TYP7 (v) == scm_tc7_dvect)), \
|
||||
v, pos, FUNC_NAME); } while (0)
|
||||
|
||||
#define SCM_VALIDATE_STRUCT(pos,v) SCM_MAKE_VALIDATE(pos,v,STRUCTP)
|
||||
|
||||
#define SCM_VALIDATE_VTABLE(pos,v) \
|
||||
|
|
|
@ -364,15 +364,13 @@ narrow_stack (SCM stack,int inner,SCM inner_key,int outer,SCM outer_key)
|
|||
for (i = 0; inner; ++i, --inner)
|
||||
{
|
||||
SCM m = s->frames[i].source;
|
||||
if (SCM_NIMP (m)
|
||||
&& SCM_MEMOIZEDP (m)
|
||||
if ( SCM_MEMOIZEDP (m)
|
||||
&& SCM_NIMP (SCM_MEMOIZED_ENV (m))
|
||||
&& SCM_FALSEP (scm_system_module_env_p (SCM_MEMOIZED_ENV (m))))
|
||||
{
|
||||
/* Back up in order to include any non-source frames */
|
||||
while (i > 0
|
||||
&& !((SCM_NIMP (m = s->frames[i - 1].source)
|
||||
&& SCM_MEMOIZEDP (m))
|
||||
&& !((m = s->frames[i - 1].source, SCM_MEMOIZEDP (m))
|
||||
|| (SCM_NIMP (m = s->frames[i - 1].proc)
|
||||
&& SCM_NFALSEP (scm_procedure_p (m))
|
||||
&& SCM_NFALSEP (scm_procedure_property
|
||||
|
|
|
@ -333,8 +333,7 @@ GUILE_PROC(scm_string_append, "string-append", 0, 0, 1,
|
|||
register long i = 0;
|
||||
register SCM l, s;
|
||||
register unsigned char *data;
|
||||
for (l = args;SCM_NIMP (l);) {
|
||||
SCM_ASSERT (SCM_CONSP (l), l, SCM_ARGn, FUNC_NAME);
|
||||
for (l = args;SCM_CONSP (l);) {
|
||||
s = SCM_CAR (l);
|
||||
SCM_VALIDATE_ROSTRING(SCM_ARGn,s);
|
||||
i += SCM_ROLENGTH (s);
|
||||
|
|
|
@ -827,8 +827,7 @@ prefix for the new symbol's name. The default prefix is @code{%%gensym}.")
|
|||
goto skip_test;
|
||||
}
|
||||
else
|
||||
SCM_ASSERT (SCM_NIMP (obarray)
|
||||
&& (SCM_VECTORP (obarray) || SCM_WVECTP (obarray)),
|
||||
SCM_ASSERT ((SCM_VECTORP (obarray) || SCM_WVECTP (obarray)),
|
||||
obarray,
|
||||
SCM_ARG2,
|
||||
FUNC_NAME);
|
||||
|
|
|
@ -305,15 +305,13 @@ loop:
|
|||
return nprot || SCM_BOOL(SCM_INUMP(prot) && SCM_INUM(prot)<=0);
|
||||
case scm_tc7_svect:
|
||||
return ( nprot
|
||||
|| (SCM_NIMP (prot)
|
||||
&& SCM_SYMBOLP (prot)
|
||||
|| (SCM_SYMBOLP (prot)
|
||||
&& (1 == SCM_LENGTH (prot))
|
||||
&& ('s' == SCM_CHARS (prot)[0])));
|
||||
#ifdef HAVE_LONG_LONGS
|
||||
case scm_tc7_llvect:
|
||||
return ( nprot
|
||||
|| (SCM_NIMP (prot)
|
||||
&& SCM_SYMBOLP (prot)
|
||||
|| (SCM_SYMBOLP (prot)
|
||||
&& (1 == SCM_LENGTH (prot))
|
||||
&& ('s' == SCM_CHARS (prot)[0])));
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue