1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-05 03:30:24 +02:00

* Replaced SCM_CHARS with SCM_STRING_CHARS or SCM_SYMBOL_CHARS.

This commit is contained in:
Dirk Herrmann 2000-09-22 17:17:55 +00:00
parent c1aef03710
commit 86c991c2a2
17 changed files with 48 additions and 32 deletions

View file

@ -1,3 +1,19 @@
2000-09-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
* backtrace.c (display_frame_expr), environments.c
(print_observer, print_leaf_environment, print_eval_environment,
print_import_environment, print_export_environment), gh_data.c
(gh_set_substr, gh_symbol2newstr), keywords.c
(scm_make_keyword_from_dash_symbol), ports.c (scm_drain_input),
posix.c (scm_mknod), print.c (scm_iprin1), regexp-posix.c
(scm_regexp_error_msg), script.c (scm_compile_shell_switches),
simpos.c (scm_getenv), socket.c (scm_recv, scm_recvfrom),
strings.c (scm_makfromstr), strop.c (scm_substring_move_x,
scm_substring_fill_x, scm_string_capitalize_x), symbols.c
(scm_symbol_to_string), unif.c (scm_make_uve, scm_array_p),
validate.h (SCM_VALIDATE_STRING_COPY): Use SCM_STRING_CHARS or
SCM_SYMBOL_CHARS instead of SCM_CHARS.
2000-09-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
* strings.h (SCM_STRING_CHARS): Added, should be used instead of

View file

@ -333,16 +333,16 @@ display_frame_expr (char *hdr,SCM exp,char *tlr,int indentation,SCM sport,SCM po
string = scm_strport_to_string (sport);
/* Remove control characters */
for (i = 0; i < n; ++i)
if (iscntrl (SCM_CHARS (string)[i]))
SCM_CHARS (string)[i] = ' ';
if (iscntrl (SCM_STRING_CHARS (string)[i]))
SCM_STRING_CHARS (string)[i] = ' ';
/* Truncate */
if (indentation + n > SCM_BACKTRACE_WIDTH)
{
n = SCM_BACKTRACE_WIDTH - indentation;
SCM_CHARS (string)[n - 1] = '$';
SCM_STRING_CHARS (string)[n - 1] = '$';
}
scm_lfwrite (SCM_CHARS (string), n, port);
scm_lfwrite (SCM_STRING_CHARS (string), n, port);
}
static void

View file

@ -498,7 +498,7 @@ print_observer (SCM type, SCM port, scm_print_state *pstate)
SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16));
scm_puts ("#<observer ", port);
scm_puts (SCM_CHARS (base16), port);
scm_puts (SCM_STRING_CHARS (base16), port);
scm_puts (">", port);
return 1;
@ -994,7 +994,7 @@ print_leaf_environment (SCM type, SCM port, scm_print_state *pstate)
SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16));
scm_puts ("#<leaf environment ", port);
scm_puts (SCM_CHARS (base16), port);
scm_puts (SCM_STRING_CHARS (base16), port);
scm_puts (">", port);
return 1;
@ -1354,7 +1354,7 @@ print_eval_environment (SCM type, SCM port, scm_print_state *pstate)
SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16));
scm_puts ("#<eval environment ", port);
scm_puts (SCM_CHARS (base16), port);
scm_puts (SCM_STRING_CHARS (base16), port);
scm_puts (">", port);
return 1;
@ -1765,7 +1765,7 @@ print_import_environment (SCM type, SCM port, scm_print_state *pstate)
SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16));
scm_puts ("#<import environment ", port);
scm_puts (SCM_CHARS (base16), port);
scm_puts (SCM_STRING_CHARS (base16), port);
scm_puts (">", port);
return 1;
@ -2062,7 +2062,7 @@ print_export_environment (SCM type, SCM port, scm_print_state *pstate)
SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16));
scm_puts ("#<export environment ", port);
scm_puts (SCM_CHARS (base16), port);
scm_puts (SCM_STRING_CHARS (base16), port);
scm_puts (">", port);
return 1;

View file

@ -116,7 +116,7 @@ gh_set_substr (char *src, SCM dst, int start, int len)
SCM_ASSERT (SCM_STRINGP (dst), dst, SCM_ARG3,
"gh_set_substr");
dst_ptr = SCM_CHARS (dst);
dst_ptr = SCM_STRING_CHARS (dst);
dst_len = SCM_LENGTH (dst);
SCM_ASSERT (len >= 0 && (unsigned) len <= dst_len,
dst, SCM_ARG4, "gh_set_substr");
@ -605,7 +605,7 @@ gh_symbol2newstr (SCM sym, int *lenp)
ret_str = (char *) scm_must_malloc ((len + 1) * sizeof (char),
"gh_symbol2newstr");
/* so we copy tmp_str to ret_str, which is what we will allocate */
memcpy (ret_str, SCM_CHARS (sym), len);
memcpy (ret_str, SCM_SYMBOL_CHARS (sym), len);
/* now make sure we null-terminate it */
ret_str[len] = '\0';

View file

@ -74,7 +74,7 @@ SCM_DEFINE (scm_make_keyword_from_dash_symbol, "make-keyword-from-dash-symbol",
SCM vcell;
SCM_ASSERT (SCM_SYMBOLP (symbol)
&& ('-' == SCM_CHARS(symbol)[0]),
&& ('-' == SCM_SYMBOL_CHARS(symbol)[0]),
symbol, SCM_ARG1, FUNC_NAME);
SCM_DEFER_INTS;

View file

@ -290,7 +290,7 @@ SCM_DEFINE (scm_drain_input, "drain-input", 1, 0, 0,
count += pt->saved_read_end - pt->saved_read_pos;
result = scm_makstr (count, 0);
dst = SCM_CHARS (result);
dst = SCM_STRING_CHARS (result);
while (pt->read_pos < pt->read_end)
*dst++ = *(pt->read_pos++);

View file

@ -1213,7 +1213,7 @@ SCM_DEFINE (scm_mknod, "mknod", 4, 0, 0,
SCM_VALIDATE_INUM (4,dev);
SCM_COERCE_SUBSTR (path);
p = SCM_CHARS (type);
p = SCM_SYMBOL_CHARS (type);
if (strcmp (p, "regular") == 0)
ctype = S_IFREG;
else if (strcmp (p, "directory") == 0)

View file

@ -494,7 +494,7 @@ taloop:
int mw_pos = 0;
len = SCM_LENGTH (exp);
str = SCM_CHARS (exp);
str = SCM_SYMBOL_CHARS (exp);
scm_remember (&exp);
pos = 0;
weird = 0;

View file

@ -124,14 +124,14 @@ scm_regexp_error_msg (int regerrno, regex_t *rx)
errmsg = scm_make_string (SCM_MAKINUM (80), SCM_UNDEFINED);
SCM_DEFER_INTS;
l = regerror (regerrno, rx, SCM_CHARS (errmsg), 80);
l = regerror (regerrno, rx, SCM_STRING_CHARS (errmsg), 80);
if (l > 80)
{
errmsg = scm_make_string (SCM_MAKINUM (l), SCM_UNDEFINED);
regerror (regerrno, rx, SCM_CHARS (errmsg), l);
}
SCM_ALLOW_INTS;
return SCM_CHARS (errmsg);
return SCM_STRING_CHARS (errmsg);
}
SCM_DEFINE (scm_regexp_p, "regexp?", 1, 0, 0,

View file

@ -557,7 +557,7 @@ scm_compile_shell_switches (int argc, char **argv)
"certain other uses are permitted as well. For details, see the file\n"
"`COPYING', which is included in the Guile distribution.\n"
"There is no warranty, to the extent permitted by law.\n",
SCM_CHARS (scm_version ()));
SCM_STRING_CHARS (scm_version ()));
exit (0);
}

View file

@ -107,7 +107,7 @@ SCM_DEFINE (scm_getenv, "getenv", 1, 0, 0,
char *val;
SCM_VALIDATE_ROSTRING (1,nam);
nam = scm_makfromstr (SCM_ROCHARS (nam), SCM_ROLENGTH (nam), 0);
val = getenv(SCM_CHARS(nam));
val = getenv (SCM_STRING_CHARS (nam));
return (val) ? scm_makfromstr(val, (scm_sizet)strlen(val), 0) : SCM_BOOL_F;
}
#undef FUNC_NAME

View file

@ -709,7 +709,7 @@ SCM_DEFINE (scm_recv, "recv!", 2, 1, 0,
SCM_VALIDATE_INUM_DEF_COPY (3,flags,0,flg);
fd = SCM_FPORT_FDES (sock);
SCM_SYSCALL (rv = recv (fd, SCM_CHARS (buf), SCM_LENGTH (buf), flg));
SCM_SYSCALL (rv = recv (fd, SCM_STRING_CHARS (buf), SCM_LENGTH (buf), flg));
if (rv == -1)
SCM_SYSERROR;
@ -807,7 +807,7 @@ SCM_DEFINE (scm_recvfrom, "recvfrom!", 2, 3, 0,
fd = SCM_FPORT_FDES (sock);
tmp_size = scm_addr_buffer_size;
SCM_SYSCALL (rv = recvfrom (fd, SCM_CHARS (buf) + offset,
SCM_SYSCALL (rv = recvfrom (fd, SCM_STRING_CHARS (buf) + offset,
cend - offset, flg,
(struct sockaddr *) scm_addr_buffer,
&tmp_size));

View file

@ -186,7 +186,7 @@ SCM
scm_makfromstr (const char *src, scm_sizet len, int dummy)
{
SCM s = scm_makstr (len, 0);
char *dst = SCM_CHARS (s);
char *dst = SCM_STRING_CHARS (s);
while (len--)
*dst++ = *src++;

View file

@ -260,8 +260,8 @@ SCM_DEFINE (scm_substring_move_x, "substring-move!", 5, 0, 0,
SCM_ASSERT_RANGE (3,end1,e <= SCM_LENGTH (str1) && e >= 0);
SCM_ASSERT_RANGE (5,start2,len+s2 <= SCM_LENGTH (str2));
SCM_SYSCALL(memmove((void *)(&(SCM_CHARS(str2)[s2])),
(void *)(&(SCM_CHARS(str1)[s1])),
SCM_SYSCALL(memmove((void *)(&(SCM_STRING_CHARS(str2)[s2])),
(void *)(&(SCM_STRING_CHARS(str1)[s1])),
len));
return scm_return_first(SCM_UNSPECIFIED, str1, str2);
@ -290,7 +290,7 @@ SCM_DEFINE (scm_substring_fill_x, "substring-fill!", 4, 0, 0,
SCM_VALIDATE_CHAR_COPY (4,fill,c);
SCM_ASSERT_RANGE (2,start,i <= SCM_LENGTH (str) && i >= 0);
SCM_ASSERT_RANGE (3,end,e <= SCM_LENGTH (str) && e >= 0);
while (i<e) SCM_CHARS (str)[i++] = c;
while (i<e) SCM_STRING_CHARS (str)[i++] = c;
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
@ -454,7 +454,7 @@ SCM_DEFINE (scm_string_capitalize_x, "string-capitalize!", 1, 0, 0,
int i, len, in_word=0;
SCM_VALIDATE_STRING (1,str);
len = SCM_LENGTH(str);
sz = SCM_CHARS(str);
sz = SCM_STRING_CHARS (str);
for(i=0; i<len; i++) {
if(SCM_NFALSEP(scm_char_alphabetic_p(SCM_MAKE_CHAR(sz[i])))) {
if(!in_word) {

View file

@ -460,7 +460,7 @@ SCM_DEFINE (scm_symbol_to_string, "symbol->string", 1, 0, 0,
#define FUNC_NAME s_scm_symbol_to_string
{
SCM_VALIDATE_SYMBOL (1, s);
return scm_makfromstr (SCM_CHARS (s), SCM_LENGTH (s), 0);
return scm_makfromstr (SCM_SYMBOL_CHARS (s), SCM_LENGTH (s), 0);
}
#undef FUNC_NAME

View file

@ -183,7 +183,7 @@ scm_make_uve (long k, SCM prot)
{
char s;
s = SCM_CHARS (prot)[0];
s = SCM_SYMBOL_CHARS (prot)[0];
if (s == 's')
{
i = sizeof (short) * k;
@ -306,12 +306,12 @@ SCM_DEFINE (scm_array_p, "array?", 1, 1, 0,
case scm_tc7_svect:
protp = SCM_SYMBOLP (prot)
&& (1 == SCM_LENGTH (prot))
&& ('s' == SCM_CHARS (prot)[0]);
&& ('s' == SCM_SYMBOL_CHARS (prot)[0]);
#ifdef HAVE_LONG_LONGS
case scm_tc7_llvect:
protp = SCM_SYMBOLP (prot)
&& (1 == SCM_LENGTH (prot))
&& ('s' == SCM_CHARS (prot)[0]);
&& ('s' == SCM_SYMBOL_CHARS (prot)[0]);
#endif
case scm_tc7_fvect:
protp = singp (prot);

View file

@ -1,4 +1,4 @@
/* $Id: validate.h,v 1.14 2000-09-03 21:56:03 mdj Exp $ */
/* $Id: validate.h,v 1.15 2000-09-22 17:17:55 dirk Exp $ */
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
@ -156,7 +156,7 @@
#define SCM_VALIDATE_STRING_COPY(pos, str, cvar) \
do { \
SCM_ASSERT (SCM_STRINGP (str), str, pos, FUNC_NAME); \
cvar = SCM_CHARS(str); \
cvar = SCM_STRING_CHARS(str); \
} while (0)
#define SCM_VALIDATE_RWSTRING(pos, str) \