mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-03 13:20:26 +02:00
* options.c, objects.c, keywords.c, gc.c: Some redundant SCM_NIMP
removals from Dirk Hermann. * alist.c: Rename formals to match the parameter names in the documentation, updates to documentation. Thanks Dirk Hermann!
This commit is contained in:
parent
db62436ece
commit
0b5f3f34c2
5 changed files with 41 additions and 50 deletions
|
@ -54,38 +54,40 @@
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC(scm_acons, "acons", 3, 0, 0,
|
GUILE_PROC(scm_acons, "acons", 3, 0, 0,
|
||||||
(SCM w, SCM x, SCM y),
|
(SCM key, SCM value, SCM alist),
|
||||||
"Adds a new key-value pair to @var{alist}. A new pair is
|
"Adds a new key-value pair to @var{alist}. A new pair is
|
||||||
created whose car is @var{key} and whose cdr is @var{value}, and the
|
created whose car is @var{key} and whose cdr is @var{value}, and the
|
||||||
pair is consed onto @var{alist}, and the new list is returned. This
|
pair is consed onto @var{alist}, and the new list is returned. This
|
||||||
function is @emph{not} destructive; @var{alist} is not modified.")
|
function is @emph{not} destructive; @var{alist} is not modified.")
|
||||||
#define FUNC_NAME s_scm_acons
|
#define FUNC_NAME s_scm_acons
|
||||||
{
|
{
|
||||||
register SCM z;
|
SCM pair;
|
||||||
SCM_NEWCELL (z);
|
SCM head;
|
||||||
SCM_SETCAR (z, w);
|
|
||||||
SCM_SETCDR (z, x);
|
SCM_NEWCELL (pair);
|
||||||
x = z;
|
SCM_SETCAR (pair, key);
|
||||||
SCM_NEWCELL (z);
|
SCM_SETCDR (pair, value);
|
||||||
SCM_SETCAR (z, x);
|
|
||||||
SCM_SETCDR (z, y);
|
SCM_NEWCELL (head);
|
||||||
return z;
|
SCM_SETCAR (head, pair);
|
||||||
|
SCM_SETCDR (head, alist);
|
||||||
|
|
||||||
|
return head;
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC (scm_sloppy_assq, "sloppy-assq", 2, 0, 0,
|
GUILE_PROC (scm_sloppy_assq, "sloppy-assq", 2, 0, 0,
|
||||||
(SCM x, SCM alist),
|
(SCM key, SCM alist),
|
||||||
"Behaves like @code{assq} but does not do any error checking.
|
"Behaves like @code{assq} but does not do any error checking.
|
||||||
Recommended only for use in Guile internals.")
|
Recommended only for use in Guile internals.")
|
||||||
#define FUNC_NAME s_scm_sloppy_assq
|
#define FUNC_NAME s_scm_sloppy_assq
|
||||||
{
|
{
|
||||||
|
|
||||||
for (; SCM_CONSP (alist); alist = SCM_CDR (alist))
|
for (; SCM_CONSP (alist); alist = SCM_CDR (alist))
|
||||||
{
|
{
|
||||||
SCM tmp = SCM_CAR(alist);
|
SCM tmp = SCM_CAR(alist);
|
||||||
if (SCM_CONSP (tmp) && (SCM_CAR (tmp)==x))
|
if (SCM_CONSP (tmp) && (SCM_CAR (tmp)==key))
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
@ -95,7 +97,7 @@ Recommended only for use in Guile internals.")
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC (scm_sloppy_assv, "sloppy-assv", 2, 0, 0,
|
GUILE_PROC (scm_sloppy_assv, "sloppy-assv", 2, 0, 0,
|
||||||
(SCM x, SCM alist),
|
(SCM key, SCM alist),
|
||||||
"Behaves like @code{assv} but does not do any error checking.
|
"Behaves like @code{assv} but does not do any error checking.
|
||||||
Recommended only for use in Guile internals.")
|
Recommended only for use in Guile internals.")
|
||||||
#define FUNC_NAME s_scm_sloppy_assv
|
#define FUNC_NAME s_scm_sloppy_assv
|
||||||
|
@ -103,9 +105,8 @@ Recommended only for use in Guile internals.")
|
||||||
for (; SCM_CONSP (alist); alist = SCM_CDR (alist))
|
for (; SCM_CONSP (alist); alist = SCM_CDR (alist))
|
||||||
{
|
{
|
||||||
SCM tmp = SCM_CAR(alist);
|
SCM tmp = SCM_CAR(alist);
|
||||||
if (SCM_NIMP (tmp)
|
if (SCM_CONSP (tmp)
|
||||||
&& SCM_CONSP (tmp)
|
&& SCM_NFALSEP (scm_eqv_p (SCM_CAR (tmp), key)))
|
||||||
&& SCM_NFALSEP (scm_eqv_p (SCM_CAR (tmp), x)))
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
@ -114,7 +115,7 @@ Recommended only for use in Guile internals.")
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC (scm_sloppy_assoc, "sloppy-assoc", 2, 0, 0,
|
GUILE_PROC (scm_sloppy_assoc, "sloppy-assoc", 2, 0, 0,
|
||||||
(SCM x, SCM alist),
|
(SCM key, SCM alist),
|
||||||
"Behaves like @code{assoc} but does not do any error checking.
|
"Behaves like @code{assoc} but does not do any error checking.
|
||||||
Recommended only for use in Guile internals.")
|
Recommended only for use in Guile internals.")
|
||||||
#define FUNC_NAME s_scm_sloppy_assoc
|
#define FUNC_NAME s_scm_sloppy_assoc
|
||||||
|
@ -122,9 +123,8 @@ Recommended only for use in Guile internals.")
|
||||||
for (; SCM_CONSP (alist); alist = SCM_CDR (alist))
|
for (; SCM_CONSP (alist); alist = SCM_CDR (alist))
|
||||||
{
|
{
|
||||||
SCM tmp = SCM_CAR(alist);
|
SCM tmp = SCM_CAR(alist);
|
||||||
if (SCM_NIMP (tmp)
|
if (SCM_CONSP (tmp)
|
||||||
&& SCM_CONSP (tmp)
|
&& SCM_NFALSEP (scm_equal_p (SCM_CAR (tmp), key)))
|
||||||
&& SCM_NFALSEP (scm_equal_p (SCM_CAR (tmp), x)))
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
@ -135,7 +135,7 @@ Recommended only for use in Guile internals.")
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC(scm_assq, "assq", 2, 0, 0,
|
GUILE_PROC(scm_assq, "assq", 2, 0, 0,
|
||||||
(SCM x, SCM alist),
|
(SCM key, SCM alist),
|
||||||
"@deffnx primitive assv key alist
|
"@deffnx primitive assv key alist
|
||||||
@deffnx primitive assoc key alist
|
@deffnx primitive assoc key alist
|
||||||
Fetches the entry in @var{alist} that is associated with @var{key}. To
|
Fetches the entry in @var{alist} that is associated with @var{key}. To
|
||||||
|
@ -150,7 +150,7 @@ return the entire alist entry found (i.e. both the key and the value).")
|
||||||
SCM tmp;
|
SCM tmp;
|
||||||
for(;SCM_NIMP(alist);alist = SCM_CDR(alist)) {
|
for(;SCM_NIMP(alist);alist = SCM_CDR(alist)) {
|
||||||
SCM_VALIDATE_ALISTCELL_COPYSCM(2,alist,tmp);
|
SCM_VALIDATE_ALISTCELL_COPYSCM(2,alist,tmp);
|
||||||
if (SCM_CAR(tmp)==x) return tmp;
|
if (SCM_CAR(tmp)==key) return tmp;
|
||||||
}
|
}
|
||||||
SCM_VALIDATE_NULL(2,alist);
|
SCM_VALIDATE_NULL(2,alist);
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
@ -159,8 +159,8 @@ return the entire alist entry found (i.e. both the key and the value).")
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC(scm_assv, "assv", 2, 0, 0,
|
GUILE_PROC(scm_assv, "assv", 2, 0, 0,
|
||||||
(SCM x, SCM alist),
|
(SCM key, SCM alist),
|
||||||
"")
|
"Behaves like @code{assq} but uses @code{eqv?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assv
|
#define FUNC_NAME s_scm_assv
|
||||||
{
|
{
|
||||||
SCM tmp;
|
SCM tmp;
|
||||||
|
@ -168,7 +168,7 @@ GUILE_PROC(scm_assv, "assv", 2, 0, 0,
|
||||||
SCM_ASRTGO(SCM_CONSP(alist), badlst);
|
SCM_ASRTGO(SCM_CONSP(alist), badlst);
|
||||||
tmp = SCM_CAR(alist);
|
tmp = SCM_CAR(alist);
|
||||||
SCM_ASRTGO(SCM_CONSP(tmp), badlst);
|
SCM_ASRTGO(SCM_CONSP(tmp), badlst);
|
||||||
if SCM_NFALSEP(scm_eqv_p(SCM_CAR(tmp), x)) return tmp;
|
if SCM_NFALSEP(scm_eqv_p(SCM_CAR(tmp), key)) return tmp;
|
||||||
}
|
}
|
||||||
# ifndef SCM_RECKLESS
|
# ifndef SCM_RECKLESS
|
||||||
if (!(SCM_NULLP(alist)))
|
if (!(SCM_NULLP(alist)))
|
||||||
|
@ -180,14 +180,14 @@ GUILE_PROC(scm_assv, "assv", 2, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
GUILE_PROC(scm_assoc, "assoc", 2, 0, 0,
|
GUILE_PROC(scm_assoc, "assoc", 2, 0, 0,
|
||||||
(SCM x, SCM alist),
|
(SCM key, SCM alist),
|
||||||
"See @code{assq}.")
|
"Behaves like @code{assq} but uses @code{equal?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assoc
|
#define FUNC_NAME s_scm_assoc
|
||||||
{
|
{
|
||||||
SCM tmp;
|
SCM tmp;
|
||||||
for(;SCM_NIMP(alist);alist = SCM_CDR(alist)) {
|
for(;SCM_NIMP(alist);alist = SCM_CDR(alist)) {
|
||||||
SCM_VALIDATE_ALISTCELL_COPYSCM(2,alist,tmp);
|
SCM_VALIDATE_ALISTCELL_COPYSCM(2,alist,tmp);
|
||||||
if SCM_NFALSEP(scm_equal_p(SCM_CAR(tmp), x)) return tmp;
|
if SCM_NFALSEP(scm_equal_p(SCM_CAR(tmp), key)) return tmp;
|
||||||
}
|
}
|
||||||
SCM_VALIDATE_NULL(2,alist);
|
SCM_VALIDATE_NULL(2,alist);
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
@ -227,7 +227,7 @@ where @var{associator} is one of @code{assq}, @code{assv} or @code{assoc}.")
|
||||||
|
|
||||||
GUILE_PROC (scm_assv_ref, "assv-ref", 2, 0, 0,
|
GUILE_PROC (scm_assv_ref, "assv-ref", 2, 0, 0,
|
||||||
(SCM alist, SCM key),
|
(SCM alist, SCM key),
|
||||||
"See @code{assq-ref}.")
|
"Behaves like @code{assq-ref} but uses @code{eqv?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assv_ref
|
#define FUNC_NAME s_scm_assv_ref
|
||||||
{
|
{
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
@ -244,7 +244,7 @@ GUILE_PROC (scm_assv_ref, "assv-ref", 2, 0, 0,
|
||||||
|
|
||||||
GUILE_PROC (scm_assoc_ref, "assoc-ref", 2, 0, 0,
|
GUILE_PROC (scm_assoc_ref, "assoc-ref", 2, 0, 0,
|
||||||
(SCM alist, SCM key),
|
(SCM alist, SCM key),
|
||||||
"See @code{assq-ref}.")
|
"Behaves like @code{assq-ref} but uses @code{equal?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assoc_ref
|
#define FUNC_NAME s_scm_assoc_ref
|
||||||
{
|
{
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
@ -292,7 +292,7 @@ association list.")
|
||||||
|
|
||||||
GUILE_PROC (scm_assv_set_x, "assv-set!", 3, 0, 0,
|
GUILE_PROC (scm_assv_set_x, "assv-set!", 3, 0, 0,
|
||||||
(SCM alist, SCM key, SCM val),
|
(SCM alist, SCM key, SCM val),
|
||||||
"See @code{assq-set!}.")
|
"Behaves like @code{assq-set!} but uses @code{eqv?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assv_set_x
|
#define FUNC_NAME s_scm_assv_set_x
|
||||||
{
|
{
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
@ -310,7 +310,7 @@ GUILE_PROC (scm_assv_set_x, "assv-set!", 3, 0, 0,
|
||||||
|
|
||||||
GUILE_PROC (scm_assoc_set_x, "assoc-set!", 3, 0, 0,
|
GUILE_PROC (scm_assoc_set_x, "assoc-set!", 3, 0, 0,
|
||||||
(SCM alist, SCM key, SCM val),
|
(SCM alist, SCM key, SCM val),
|
||||||
"See @code{assq-set!}.")
|
"Behaves like @code{assq-set!} but uses @code{equal?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assoc_set_x
|
#define FUNC_NAME s_scm_assoc_set_x
|
||||||
{
|
{
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
@ -352,7 +352,7 @@ the resulting alist.")
|
||||||
|
|
||||||
GUILE_PROC (scm_assv_remove_x, "assv-remove!", 2, 0, 0,
|
GUILE_PROC (scm_assv_remove_x, "assv-remove!", 2, 0, 0,
|
||||||
(SCM alist, SCM key),
|
(SCM alist, SCM key),
|
||||||
"See @code{assq-remove!}.")
|
"Behaves like @code{assq-remove!} but uses @code{eqv?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assv_remove_x
|
#define FUNC_NAME s_scm_assv_remove_x
|
||||||
{
|
{
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
@ -370,7 +370,7 @@ GUILE_PROC (scm_assv_remove_x, "assv-remove!", 2, 0, 0,
|
||||||
|
|
||||||
GUILE_PROC (scm_assoc_remove_x, "assoc-remove!", 2, 0, 0,
|
GUILE_PROC (scm_assoc_remove_x, "assoc-remove!", 2, 0, 0,
|
||||||
(SCM alist, SCM key),
|
(SCM alist, SCM key),
|
||||||
"See @code{assq-remove!}.")
|
"Behaves like @code{assq-remove!} but uses @code{equal?} for key comparison.")
|
||||||
#define FUNC_NAME s_scm_assoc_remove_x
|
#define FUNC_NAME s_scm_assoc_remove_x
|
||||||
{
|
{
|
||||||
SCM handle;
|
SCM handle;
|
||||||
|
|
|
@ -805,10 +805,8 @@ gc_mark_nimp:
|
||||||
|
|
||||||
/* mark everything on the alist except the keys or
|
/* mark everything on the alist except the keys or
|
||||||
* values, according to weak_values and weak_keys. */
|
* values, according to weak_values and weak_keys. */
|
||||||
while ( SCM_NIMP (alist)
|
while ( SCM_CONSP (alist)
|
||||||
&& SCM_CONSP (alist)
|
|
||||||
&& !SCM_GCMARKP (alist)
|
&& !SCM_GCMARKP (alist)
|
||||||
&& SCM_NIMP (SCM_CAR (alist))
|
|
||||||
&& SCM_CONSP (SCM_CAR (alist)))
|
&& SCM_CONSP (SCM_CAR (alist)))
|
||||||
{
|
{
|
||||||
SCM kvpair;
|
SCM kvpair;
|
||||||
|
@ -1063,10 +1061,8 @@ scm_mark_weak_vector_spines ()
|
||||||
SCM alist;
|
SCM alist;
|
||||||
|
|
||||||
alist = ptr[j];
|
alist = ptr[j];
|
||||||
while ( SCM_NIMP (alist)
|
while ( SCM_CONSP (alist)
|
||||||
&& SCM_CONSP (alist)
|
|
||||||
&& !SCM_GCMARKP (alist)
|
&& !SCM_GCMARKP (alist)
|
||||||
&& SCM_NIMP (SCM_CAR (alist))
|
|
||||||
&& SCM_CONSP (SCM_CAR (alist)))
|
&& SCM_CONSP (SCM_CAR (alist)))
|
||||||
{
|
{
|
||||||
SCM_SETGCMARK (alist);
|
SCM_SETGCMARK (alist);
|
||||||
|
@ -1404,9 +1400,7 @@ scm_gc_sweep ()
|
||||||
fixup = ptr + j;
|
fixup = ptr + j;
|
||||||
alist = *fixup;
|
alist = *fixup;
|
||||||
|
|
||||||
while (SCM_NIMP (alist)
|
while ( SCM_CONSP (alist)
|
||||||
&& SCM_CONSP (alist)
|
|
||||||
&& SCM_NIMP (SCM_CAR (alist))
|
|
||||||
&& SCM_CONSP (SCM_CAR (alist)))
|
&& SCM_CONSP (SCM_CAR (alist)))
|
||||||
{
|
{
|
||||||
SCM key;
|
SCM key;
|
||||||
|
|
|
@ -75,8 +75,7 @@ GUILE_PROC (scm_make_keyword_from_dash_symbol, "make-keyword-from-dash-symbol",
|
||||||
{
|
{
|
||||||
SCM vcell;
|
SCM vcell;
|
||||||
|
|
||||||
SCM_ASSERT (SCM_NIMP (symbol)
|
SCM_ASSERT (SCM_SYMBOLP (symbol)
|
||||||
&& SCM_SYMBOLP (symbol)
|
|
||||||
&& ('-' == SCM_CHARS(symbol)[0]),
|
&& ('-' == SCM_CHARS(symbol)[0]),
|
||||||
symbol, SCM_ARG1, FUNC_NAME);
|
symbol, SCM_ARG1, FUNC_NAME);
|
||||||
|
|
||||||
|
|
|
@ -373,8 +373,7 @@ GUILE_PROC (scm_operator_p, "operator?", 1, 0, 0,
|
||||||
"")
|
"")
|
||||||
#define FUNC_NAME s_scm_operator_p
|
#define FUNC_NAME s_scm_operator_p
|
||||||
{
|
{
|
||||||
return SCM_BOOL(SCM_NIMP (obj)
|
return SCM_BOOL(SCM_STRUCTP (obj)
|
||||||
&& SCM_STRUCTP (obj)
|
|
||||||
&& SCM_I_OPERATORP (obj)
|
&& SCM_I_OPERATORP (obj)
|
||||||
&& !SCM_I_ENTITYP (obj));
|
&& !SCM_I_ENTITYP (obj));
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,8 +177,7 @@ scm_options (SCM arg, scm_option options[], int n, const char *s)
|
||||||
goto cont;
|
goto cont;
|
||||||
case SCM_OPTION_INTEGER:
|
case SCM_OPTION_INTEGER:
|
||||||
new_mode = SCM_CDR (new_mode);
|
new_mode = SCM_CDR (new_mode);
|
||||||
SCM_ASSERT (SCM_NIMP (new_mode)
|
SCM_ASSERT ( SCM_CONSP (new_mode)
|
||||||
&& SCM_CONSP (new_mode)
|
|
||||||
&& SCM_INUMP (SCM_CAR (new_mode)),
|
&& SCM_INUMP (SCM_CAR (new_mode)),
|
||||||
new_mode,
|
new_mode,
|
||||||
SCM_ARG1,
|
SCM_ARG1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue