1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

* scm_validate.h, chars.c, ports.c, print.c, read.c, strings.c,

strop.c: Use SCM_VALIDATE_ICHR, SCM_VALIDATE_ICHR_COPY instead of
SCM_VALIDATE_CHAR, SCM_VALIDATE_CHAR_COPY.  Change made for
consistency with the other macros dealing with immediate
characters.  (Similar to INT -> INUM change a week or so ago).
This commit is contained in:
Greg J. Badros 2000-01-11 19:19:59 +00:00
parent 7965d98fd6
commit 9a8351bc15
7 changed files with 39 additions and 39 deletions

View file

@ -66,8 +66,8 @@ SCM_DEFINE1 (scm_char_eq_p, "char=?", scm_tc7_rpsubr,
"Return #t iff X is the same character as Y, else #f.") "Return #t iff X is the same character as Y, else #f.")
#define FUNC_NAME s_scm_char_eq_p #define FUNC_NAME s_scm_char_eq_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(SCM_ICHR(x) == SCM_ICHR(y)); return SCM_BOOL(SCM_ICHR(x) == SCM_ICHR(y));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -78,8 +78,8 @@ SCM_DEFINE1 (scm_char_less_p, "char<?", scm_tc7_rpsubr,
"Return #t iff X is less than Y in the Ascii sequence, else #f.") "Return #t iff X is less than Y in the Ascii sequence, else #f.")
#define FUNC_NAME s_scm_char_less_p #define FUNC_NAME s_scm_char_less_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(SCM_ICHR(x) < SCM_ICHR(y)); return SCM_BOOL(SCM_ICHR(x) < SCM_ICHR(y));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -89,8 +89,8 @@ SCM_DEFINE1 (scm_char_leq_p, "char<=?", scm_tc7_rpsubr,
"Return #t iff X is less than or equal to Y in the Ascii sequence, else #f.") "Return #t iff X is less than or equal to Y in the Ascii sequence, else #f.")
#define FUNC_NAME s_scm_char_leq_p #define FUNC_NAME s_scm_char_leq_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(SCM_ICHR(x) <= SCM_ICHR(y)); return SCM_BOOL(SCM_ICHR(x) <= SCM_ICHR(y));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -100,8 +100,8 @@ SCM_DEFINE1 (scm_char_gr_p, "char>?", scm_tc7_rpsubr,
"Return #t iff X is greater than Y in the Ascii sequence, else #f.") "Return #t iff X is greater than Y in the Ascii sequence, else #f.")
#define FUNC_NAME s_scm_char_gr_p #define FUNC_NAME s_scm_char_gr_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(SCM_ICHR(x) > SCM_ICHR(y)); return SCM_BOOL(SCM_ICHR(x) > SCM_ICHR(y));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -111,8 +111,8 @@ SCM_DEFINE1 (scm_char_geq_p, "char>=?", scm_tc7_rpsubr,
"Return #t iff X is greater than or equal to Y in the Ascii sequence, else #f.") "Return #t iff X is greater than or equal to Y in the Ascii sequence, else #f.")
#define FUNC_NAME s_scm_char_geq_p #define FUNC_NAME s_scm_char_geq_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(SCM_ICHR(x) >= SCM_ICHR(y)); return SCM_BOOL(SCM_ICHR(x) >= SCM_ICHR(y));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -122,8 +122,8 @@ SCM_DEFINE1 (scm_char_ci_eq_p, "char-ci=?", scm_tc7_rpsubr,
"Return #t iff X is the same character as Y ignoring case, else #f.") "Return #t iff X is the same character as Y ignoring case, else #f.")
#define FUNC_NAME s_scm_char_ci_eq_p #define FUNC_NAME s_scm_char_ci_eq_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(scm_upcase(SCM_ICHR(x))==scm_upcase(SCM_ICHR(y))); return SCM_BOOL(scm_upcase(SCM_ICHR(x))==scm_upcase(SCM_ICHR(y)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -133,8 +133,8 @@ SCM_DEFINE1 (scm_char_ci_less_p, "char-ci<?", scm_tc7_rpsubr,
"Return #t iff X is less than Y in the Ascii sequence ignoring case, else #f.") "Return #t iff X is less than Y in the Ascii sequence ignoring case, else #f.")
#define FUNC_NAME s_scm_char_ci_less_p #define FUNC_NAME s_scm_char_ci_less_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL((scm_upcase(SCM_ICHR(x))) < scm_upcase(SCM_ICHR(y))); return SCM_BOOL((scm_upcase(SCM_ICHR(x))) < scm_upcase(SCM_ICHR(y)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -144,8 +144,8 @@ SCM_DEFINE1 (scm_char_ci_leq_p, "char-ci<=?", scm_tc7_rpsubr,
"Return #t iff X is less than or equal to Y in the Ascii sequence ignoring case, else #f.") "Return #t iff X is less than or equal to Y in the Ascii sequence ignoring case, else #f.")
#define FUNC_NAME s_scm_char_ci_leq_p #define FUNC_NAME s_scm_char_ci_leq_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(scm_upcase(SCM_ICHR(x)) <= scm_upcase(SCM_ICHR(y))); return SCM_BOOL(scm_upcase(SCM_ICHR(x)) <= scm_upcase(SCM_ICHR(y)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -155,8 +155,8 @@ SCM_DEFINE1 (scm_char_ci_gr_p, "char-ci>?", scm_tc7_rpsubr,
"Return #t iff X is greater than Y in the Ascii sequence ignoring case, else #f.") "Return #t iff X is greater than Y in the Ascii sequence ignoring case, else #f.")
#define FUNC_NAME s_scm_char_ci_gr_p #define FUNC_NAME s_scm_char_ci_gr_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(scm_upcase(SCM_ICHR(x)) > scm_upcase(SCM_ICHR(y))); return SCM_BOOL(scm_upcase(SCM_ICHR(x)) > scm_upcase(SCM_ICHR(y)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -166,8 +166,8 @@ SCM_DEFINE1 (scm_char_ci_geq_p, "char-ci>=?", scm_tc7_rpsubr,
"Return #t iff X is greater than or equal to Y in the Ascii sequence ignoring case, else #f.") "Return #t iff X is greater than or equal to Y in the Ascii sequence ignoring case, else #f.")
#define FUNC_NAME s_scm_char_ci_geq_p #define FUNC_NAME s_scm_char_ci_geq_p
{ {
SCM_VALIDATE_CHAR (1,x); SCM_VALIDATE_ICHR (1,x);
SCM_VALIDATE_CHAR (2,y); SCM_VALIDATE_ICHR (2,y);
return SCM_BOOL(scm_upcase(SCM_ICHR(x)) >= scm_upcase(SCM_ICHR(y))); return SCM_BOOL(scm_upcase(SCM_ICHR(x)) >= scm_upcase(SCM_ICHR(y)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -179,7 +179,7 @@ SCM_DEFINE (scm_char_alphabetic_p, "char-alphabetic?", 1, 0, 0,
Alphabetic means the same thing as the isalpha C library function.") Alphabetic means the same thing as the isalpha C library function.")
#define FUNC_NAME s_scm_char_alphabetic_p #define FUNC_NAME s_scm_char_alphabetic_p
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_BOOL(isascii(SCM_ICHR(chr)) && isalpha(SCM_ICHR(chr))); return SCM_BOOL(isascii(SCM_ICHR(chr)) && isalpha(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -190,7 +190,7 @@ SCM_DEFINE (scm_char_numeric_p, "char-numeric?", 1, 0, 0,
Numeric means the same thing as the isdigit C library function.") Numeric means the same thing as the isdigit C library function.")
#define FUNC_NAME s_scm_char_numeric_p #define FUNC_NAME s_scm_char_numeric_p
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_BOOL(isascii(SCM_ICHR(chr)) && isdigit(SCM_ICHR(chr))); return SCM_BOOL(isascii(SCM_ICHR(chr)) && isdigit(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -201,7 +201,7 @@ SCM_DEFINE (scm_char_whitespace_p, "char-whitespace?", 1, 0, 0,
Whitespace means the same thing as the isspace C library function.") Whitespace means the same thing as the isspace C library function.")
#define FUNC_NAME s_scm_char_whitespace_p #define FUNC_NAME s_scm_char_whitespace_p
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_BOOL(isascii(SCM_ICHR(chr)) && isspace(SCM_ICHR(chr))); return SCM_BOOL(isascii(SCM_ICHR(chr)) && isspace(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -214,7 +214,7 @@ SCM_DEFINE (scm_char_upper_case_p, "char-upper-case?", 1, 0, 0,
Uppercase means the same thing as the isupper C library function.") Uppercase means the same thing as the isupper C library function.")
#define FUNC_NAME s_scm_char_upper_case_p #define FUNC_NAME s_scm_char_upper_case_p
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_BOOL(isascii(SCM_ICHR(chr)) && isupper(SCM_ICHR(chr))); return SCM_BOOL(isascii(SCM_ICHR(chr)) && isupper(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -226,7 +226,7 @@ SCM_DEFINE (scm_char_lower_case_p, "char-lower-case?", 1, 0, 0,
Lowercase means the same thing as the islower C library function.") Lowercase means the same thing as the islower C library function.")
#define FUNC_NAME s_scm_char_lower_case_p #define FUNC_NAME s_scm_char_lower_case_p
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_BOOL(isascii(SCM_ICHR(chr)) && islower(SCM_ICHR(chr))); return SCM_BOOL(isascii(SCM_ICHR(chr)) && islower(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -240,7 +240,7 @@ Uppercase and lowercase are as defined by the isupper and islower
C library functions.") C library functions.")
#define FUNC_NAME s_scm_char_is_both_p #define FUNC_NAME s_scm_char_is_both_p
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_BOOL(isascii(SCM_ICHR(chr)) && (isupper(SCM_ICHR(chr)) || islower(SCM_ICHR(chr)))); return SCM_BOOL(isascii(SCM_ICHR(chr)) && (isupper(SCM_ICHR(chr)) || islower(SCM_ICHR(chr))));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -253,7 +253,7 @@ SCM_DEFINE (scm_char_to_integer, "char->integer", 1, 0, 0,
"Return the number corresponding to ordinal position of CHR in the Ascii sequence.") "Return the number corresponding to ordinal position of CHR in the Ascii sequence.")
#define FUNC_NAME s_scm_char_to_integer #define FUNC_NAME s_scm_char_to_integer
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return scm_ulong2num((unsigned long)SCM_ICHR(chr)); return scm_ulong2num((unsigned long)SCM_ICHR(chr));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -276,7 +276,7 @@ SCM_DEFINE (scm_char_upcase, "char-upcase", 1, 0, 0,
"Return the uppercase character version of CHR.") "Return the uppercase character version of CHR.")
#define FUNC_NAME s_scm_char_upcase #define FUNC_NAME s_scm_char_upcase
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_MAKICHR(scm_upcase(SCM_ICHR(chr))); return SCM_MAKICHR(scm_upcase(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME
@ -287,7 +287,7 @@ SCM_DEFINE (scm_char_downcase, "char-downcase", 1, 0, 0,
"Return the lowercase character version of CHR.") "Return the lowercase character version of CHR.")
#define FUNC_NAME s_scm_char_downcase #define FUNC_NAME s_scm_char_downcase
{ {
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
return SCM_MAKICHR(scm_downcase(SCM_ICHR(chr))); return SCM_MAKICHR(scm_downcase(SCM_ICHR(chr)));
} }
#undef FUNC_NAME #undef FUNC_NAME

View file

@ -973,7 +973,7 @@ not supplied, the current input port is used.")
{ {
int c; int c;
SCM_VALIDATE_CHAR (1,cobj); SCM_VALIDATE_ICHR (1,cobj);
if (SCM_UNBNDP (port)) if (SCM_UNBNDP (port))
port = scm_cur_inp; port = scm_cur_inp;
else else

View file

@ -1021,7 +1021,7 @@ SCM_DEFINE (scm_write_char, "write-char", 1, 1, 0,
if (SCM_UNBNDP (port)) if (SCM_UNBNDP (port))
port = scm_cur_outp; port = scm_cur_outp;
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
SCM_VALIDATE_OPORT_VALUE (2,port); SCM_VALIDATE_OPORT_VALUE (2,port);
scm_putc ((int) SCM_ICHR (chr), SCM_COERCE_OUTPORT (port)); scm_putc ((int) SCM_ICHR (chr), SCM_COERCE_OUTPORT (port));

View file

@ -709,7 +709,7 @@ SCM_DEFINE (scm_read_hash_extend, "read-hash-extend", 2, 0, 0,
SCM this; SCM this;
SCM prev; SCM prev;
SCM_VALIDATE_CHAR (1,chr); SCM_VALIDATE_ICHR (1,chr);
SCM_ASSERT (SCM_FALSEP (proc) || SCM_NIMP(proc), proc, SCM_ARG2, SCM_ASSERT (SCM_FALSEP (proc) || SCM_NIMP(proc), proc, SCM_ARG2,
FUNC_NAME); FUNC_NAME);

View file

@ -1,4 +1,4 @@
/* $Id: scm_validate.h,v 1.15 2000-01-09 13:41:53 ghouston Exp $ */ /* $Id: scm_validate.h,v 1.16 2000-01-11 19:19:59 gjb Exp $ */
/* Copyright (C) 1999 Free Software Foundation, Inc. /* Copyright (C) 1999 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -95,9 +95,9 @@
do { SCM_ASSERT(SCM_BOOLP(flag), flag, pos, FUNC_NAME); \ do { SCM_ASSERT(SCM_BOOLP(flag), flag, pos, FUNC_NAME); \
cvar = (SCM_BOOL_T == flag)? 1: 0; } while (0) cvar = (SCM_BOOL_T == flag)? 1: 0; } while (0)
#define SCM_VALIDATE_CHAR(pos,scm) SCM_MAKE_VALIDATE(pos,scm,ICHRP) #define SCM_VALIDATE_ICHR(pos,scm) SCM_MAKE_VALIDATE(pos,scm,ICHRP)
#define SCM_VALIDATE_CHAR_COPY(pos,scm,cvar) \ #define SCM_VALIDATE_ICHR_COPY(pos,scm,cvar) \
do { SCM_ASSERT(SCM_ICHRP(scm), scm, pos, FUNC_NAME); \ do { SCM_ASSERT(SCM_ICHRP(scm), scm, pos, FUNC_NAME); \
cvar = SCM_ICHR(scm); } while (0) cvar = SCM_ICHR(scm); } while (0)

View file

@ -258,7 +258,7 @@ SCM_DEFINE (scm_make_string, "make-string", 1, 1, 0,
res = scm_makstr (i, 0); res = scm_makstr (i, 0);
if (!SCM_UNBNDP (chr)) if (!SCM_UNBNDP (chr))
{ {
SCM_VALIDATE_CHAR (2,chr); SCM_VALIDATE_ICHR (2,chr);
{ {
unsigned char *dst = SCM_UCHARS (res); unsigned char *dst = SCM_UCHARS (res);
char c = SCM_ICHR (chr); char c = SCM_ICHR (chr);
@ -299,7 +299,7 @@ SCM_DEFINE (scm_string_set_x, "string-set!", 3, 0, 0,
{ {
SCM_VALIDATE_RWSTRING (1,str); SCM_VALIDATE_RWSTRING (1,str);
SCM_VALIDATE_INUM_RANGE (2,k,0,SCM_LENGTH(str)); SCM_VALIDATE_INUM_RANGE (2,k,0,SCM_LENGTH(str));
SCM_VALIDATE_CHAR (3,chr); SCM_VALIDATE_ICHR (3,chr);
SCM_UCHARS (str)[SCM_INUM (k)] = SCM_ICHR (chr); SCM_UCHARS (str)[SCM_INUM (k)] = SCM_ICHR (chr);
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }

View file

@ -186,7 +186,7 @@ SCM_DEFINE (scm_substring_fill_x, "substring-fill!", 4, 0, 0,
SCM_VALIDATE_STRING (1,str); SCM_VALIDATE_STRING (1,str);
SCM_VALIDATE_INUM_COPY (2,start,i); SCM_VALIDATE_INUM_COPY (2,start,i);
SCM_VALIDATE_INUM_COPY (3,end,e); SCM_VALIDATE_INUM_COPY (3,end,e);
SCM_VALIDATE_CHAR_COPY (4,fill,c); SCM_VALIDATE_ICHR_COPY (4,fill,c);
SCM_ASSERT_RANGE (2,start,i <= SCM_LENGTH (str) && i >= 0); SCM_ASSERT_RANGE (2,start,i <= SCM_LENGTH (str) && i >= 0);
SCM_ASSERT_RANGE (3,end,e <= SCM_LENGTH (str) && e >= 0); SCM_ASSERT_RANGE (3,end,e <= SCM_LENGTH (str) && e >= 0);
while (i<e) SCM_CHARS (str)[i++] = c; while (i<e) SCM_CHARS (str)[i++] = c;
@ -243,7 +243,7 @@ SCM_DEFINE (scm_string_fill_x, "string-fill!", 2, 0, 0,
register char *dst, c; register char *dst, c;
register long k; register long k;
SCM_VALIDATE_STRING_COPY (1,str,dst); SCM_VALIDATE_STRING_COPY (1,str,dst);
SCM_VALIDATE_CHAR_COPY (2,chr,c); SCM_VALIDATE_ICHR_COPY (2,chr,c);
for (k = SCM_LENGTH (str)-1;k >= 0;k--) dst[k] = c; for (k = SCM_LENGTH (str)-1;k >= 0;k--) dst[k] = c;
return SCM_UNSPECIFIED; return SCM_UNSPECIFIED;
} }