[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
guile/guile-core NEWS RELEASE libguile/backtrac...
From: |
Dirk Herrmann |
Subject: |
guile/guile-core NEWS RELEASE libguile/backtrac... |
Date: |
Thu, 02 Nov 2000 02:36:32 -0800 |
CVSROOT: /cvs
Module name: guile
Changes by: Dirk Herrmann <address@hidden> 00/11/02 02:36:32
Modified files:
guile-core : NEWS RELEASE
guile-core/libguile: backtrace.c fports.c gc.c gh_data.c goops.c
objects.c ports.c ports.h print.c symbols.h
Log message:
* Get rid of calls to SCM_ROSTRINGP.
* Fix some string/symbol output problems with regards to substrings.
* Fix error output to prefer procedure name parameters over stack data.
* Use SCM_(SET_)?FILENAME where appropriate.
* Prefer calling scm_remember over scm_protect/unprotect_object calls.
CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/NEWS.diff?r1=1.210&r2=1.211
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/RELEASE.diff?r1=1.73&r2=1.74
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/backtrace.c.diff?r1=1.55&r2=1.56
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/fports.c.diff?r1=1.81&r2=1.82
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/gc.c.diff?r1=1.161&r2=1.162
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/gh_data.c.diff?r1=1.42&r2=1.43
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/goops.c.diff?r1=1.1&r2=1.2
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/objects.c.diff?r1=1.50&r2=1.51
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ports.c.diff?r1=1.117&r2=1.118
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ports.h.diff?r1=1.65&r2=1.66
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/print.c.diff?r1=1.102&r2=1.103
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/symbols.h.diff?r1=1.39&r2=1.40
Patches:
Index: guile/guile-core/NEWS
diff -u guile/guile-core/NEWS:1.210 guile/guile-core/NEWS:1.211
--- guile/guile-core/NEWS:1.210 Mon Oct 30 03:42:25 2000
+++ guile/guile-core/NEWS Thu Nov 2 02:36:31 2000
@@ -227,7 +227,8 @@
SCM_VALIDATE_STRINGORSUBSTR, SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS,
SCM_VALIDATE_ROSTRING, SCM_VALIDATE_ROSTRING_COPY,
SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH, SCM_LENGTH, SCM_HUGE_LENGTH,
-SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR
+SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
+SCM_ROSTRINGP
Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
Use scm_memory_error instead of SCM_NALLOC.
@@ -238,6 +239,7 @@
Use a type specific accessor instead of SCM(_|_RO|_HUGE_)LENGTH.
Use SCM_VALIDATE_(SYMBOL|STRING) instead of SCM_VALIDATE_ROSTRING.
Use SCM_STRING_COERCE_0TERMINATION_X instead of SCM_COERCE_SUBSTR.
+Use SCM_STRINGP or SCM_SYMBOLP instead of SCM_ROSTRINGP.
** Removed function: scm_struct_init
Index: guile/guile-core/RELEASE
diff -u guile/guile-core/RELEASE:1.73 guile/guile-core/RELEASE:1.74
--- guile/guile-core/RELEASE:1.73 Mon Oct 30 03:42:25 2000
+++ guile/guile-core/RELEASE Thu Nov 2 02:36:31 2000
@@ -49,7 +49,7 @@
SCM_FREEP, SCM_NFREEP, SCM_CHARS, SCM_UCHARS, SCM_VALIDATE_ROSTRING,
SCM_VALIDATE_ROSTRING_COPY, SCM_VALIDATE_NULLORROSTRING_COPY, SCM_ROLENGTH,
SCM_LENGTH, SCM_HUGE_LENGTH, SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET,
- SCM_COERCE_SUBSTR
+ SCM_COERCE_SUBSTR, SCM_ROSTRINGP
- remove scm_vector_set_length_x
- remove function scm_call_catching_errors
(replaced by catch functions from throw.[ch])
Index: guile/guile-core/libguile/backtrace.c
diff -u guile/guile-core/libguile/backtrace.c:1.55
guile/guile-core/libguile/backtrace.c:1.56
--- guile/guile-core/libguile/backtrace.c:1.55 Fri Sep 22 10:17:55 2000
+++ guile/guile-core/libguile/backtrace.c Thu Nov 2 02:36:31 2000
@@ -110,15 +110,15 @@
void
scm_display_error_message (SCM message, SCM args, SCM port)
{
- if (SCM_ROSTRINGP (message) && SCM_NFALSEP (scm_list_p (args)))
+ if (SCM_STRINGP (message) && !SCM_FALSEP (scm_list_p (args)))
{
scm_simple_format (port, message, args);
scm_newline (port);
}
else
{
- scm_prin1 (message, port, 0);
- scm_putc ('\n', port);
+ scm_display (message, port);
+ scm_newline (port);
}
}
@@ -131,7 +131,7 @@
pstate->fancyp = 1;
pstate->level = 2;
pstate->length = 3;
- if (SCM_ROSTRINGP (pname))
+ if (SCM_SYMBOLP (pname) || SCM_STRINGP (pname))
{
if (SCM_FRAMEP (frame)
&& SCM_FRAME_EVAL_ARGS_P (frame))
@@ -170,8 +170,8 @@
{
SCM current_frame = SCM_BOOL_F;
SCM source = SCM_BOOL_F;
- SCM pname = SCM_BOOL_F;
SCM prev_frame = SCM_BOOL_F;
+ SCM pname = a->subr;
if (SCM_DEBUGGINGP
&& SCM_STACKP (a->stack)
@@ -182,13 +182,11 @@
prev_frame = SCM_FRAME_PREV (current_frame);
if (!SCM_MEMOIZEDP (source) && !SCM_FALSEP (prev_frame))
source = SCM_FRAME_SOURCE (prev_frame);
- if (SCM_FRAME_PROC_P (current_frame)
+ if (!SCM_SYMBOLP (pname) && !SCM_STRINGP (pname) && SCM_FRAME_PROC_P
(current_frame)
&& SCM_EQ_P (scm_procedure_p (SCM_FRAME_PROC (current_frame)),
SCM_BOOL_T))
pname = scm_procedure_name (SCM_FRAME_PROC (current_frame));
}
- if (!SCM_ROSTRINGP (pname))
- pname = a->subr;
- if (SCM_ROSTRINGP (pname) || SCM_MEMOIZEDP (source))
+ if (SCM_SYMBOLP (pname) || SCM_STRINGP (pname) || SCM_MEMOIZEDP (source))
{
display_header (source, a->port);
display_expression (current_frame, pname, source, a->port);
Index: guile/guile-core/libguile/fports.c
diff -u guile/guile-core/libguile/fports.c:1.81
guile/guile-core/libguile/fports.c:1.82
--- guile/guile-core/libguile/fports.c:1.81 Mon Oct 30 03:42:26 2000
+++ guile/guile-core/libguile/fports.c Thu Nov 2 02:36:31 2000
@@ -77,7 +77,7 @@
scm_fport_buffer_add (SCM port, int read_size, int write_size)
{
struct scm_fport *fp = SCM_FSTREAM (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
+ scm_port *pt = SCM_PTAB_ENTRY (port);
char *s_scm_fport_buffer_add = "scm_fport_buffer_add";
if (read_size == -1 || write_size == -1)
@@ -377,7 +377,7 @@
else
scm_fport_buffer_add (port, -1, -1);
}
- SCM_PTAB_ENTRY (port)->file_name = name;
+ SCM_SET_FILENAME (port, name);
SCM_ALLOW_INTS;
return port;
}
@@ -429,11 +429,11 @@
if (SCM_OPFPORTP (exp))
{
int fdes;
- SCM name = SCM_PTAB_ENTRY (exp)->file_name;
- scm_puts (SCM_ROSTRINGP (name)
- ? SCM_ROCHARS (name)
- : SCM_PTOBNAME (SCM_PTOBNUM (exp)),
- port);
+ SCM name = SCM_FILENAME (exp);
+ if (SCM_STRINGP (name) || SCM_SYMBOLP (name))
+ scm_display (name, port);
+ else
+ scm_puts (SCM_PTOBNAME (SCM_PTOBNUM (exp)), port);
scm_putc (' ', port);
fdes = (SCM_FSTREAM (exp))->fdes;
Index: guile/guile-core/libguile/gc.c
diff -u guile/guile-core/libguile/gc.c:1.161
guile/guile-core/libguile/gc.c:1.162
--- guile/guile-core/libguile/gc.c:1.161 Wed Oct 25 05:58:51 2000
+++ guile/guile-core/libguile/gc.c Thu Nov 2 02:36:31 2000
@@ -1319,7 +1319,7 @@
if (!(i < scm_numptob))
goto def;
if (SCM_PTAB_ENTRY(ptr))
- scm_gc_mark (SCM_PTAB_ENTRY(ptr)->file_name);
+ scm_gc_mark (SCM_FILENAME (ptr));
if (scm_ptobs[i].mark)
{
ptr = (scm_ptobs[i].mark) (ptr);
@@ -2272,7 +2272,9 @@
void
scm_remember (SCM *ptr)
-{ /* empty */ }
+{
+ /* empty */
+}
/*
Index: guile/guile-core/libguile/gh_data.c
diff -u guile/guile-core/libguile/gh_data.c:1.42
guile/guile-core/libguile/gh_data.c:1.43
--- guile/guile-core/libguile/gh_data.c:1.42 Tue Oct 10 02:22:31 2000
+++ guile/guile-core/libguile/gh_data.c Thu Nov 2 02:36:31 2000
@@ -113,18 +113,16 @@
unsigned long dst_len;
unsigned long effective_length;
- SCM_ASSERT (SCM_STRINGP (dst), dst, SCM_ARG3,
- "gh_set_substr");
+ SCM_ASSERT (SCM_STRINGP (dst), dst, SCM_ARG3, "gh_set_substr");
dst_ptr = SCM_STRING_CHARS (dst);
dst_len = SCM_STRING_LENGTH (dst);
SCM_ASSERT (len >= 0 && (unsigned) len <= dst_len,
dst, SCM_ARG4, "gh_set_substr");
- scm_protect_object (dst);
effective_length = ((unsigned) len < dst_len) ? len : dst_len;
memmove (dst_ptr + start, src, effective_length);
- scm_unprotect_object (dst);
+ scm_remember (&dst);
}
/* Return the symbol named SYMBOL_STR. */
@@ -539,19 +537,17 @@
SCM_ASSERT (SCM_STRINGP (str), str, SCM_ARG3, "gh_scm2newstr");
- /* protect str from GC while we copy off its data */
- scm_protect_object (str);
-
len = SCM_STRING_LENGTH (str);
ret_str = (char *) scm_must_malloc ((len + 1) * sizeof (char),
"gh_scm2newstr");
/* so we copy tmp_str to ret_str, which is what we will allocate */
memcpy (ret_str, SCM_ROCHARS (str), len); /* test ROCHARS here -twp */
+ /* from now on we don't mind if str gets GC collected. */
+ scm_remember (&str);
/* now make sure we null-terminate it */
ret_str[len] = '\0';
- scm_unprotect_object (str);
if (lenp != NULL)
{
@@ -575,12 +571,11 @@
int src_len, effective_length;
SCM_ASSERT (SCM_STRINGP (src), src, SCM_ARG3, "gh_get_substr");
- scm_protect_object (src);
src_len = SCM_STRING_LENGTH (src);
effective_length = (len < src_len) ? len : src_len;
memcpy (dst + start, SCM_ROCHARS (src), effective_length * sizeof (char));
/* FIXME: must signal an error if len > src_len */
- scm_unprotect_object (src);
+ scm_remember (&src);
}
@@ -596,23 +591,19 @@
{
char *ret_str;
int len;
-
- SCM_ASSERT (SCM_SYMBOLP (sym), sym, SCM_ARG3,
- "gh_scm2newsymbol");
- /* protect str from GC while we copy off its data */
- scm_protect_object (sym);
+ SCM_ASSERT (SCM_SYMBOLP (sym), sym, SCM_ARG3, "gh_scm2newsymbol");
len = SCM_SYMBOL_LENGTH (sym);
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 */
+ /* so we copy sym to ret_str, which is what we will allocate */
memcpy (ret_str, SCM_SYMBOL_CHARS (sym), len);
+ /* from now on we don't mind if sym gets GC collected. */
+ scm_remember (&sym);
/* now make sure we null-terminate it */
ret_str[len] = '\0';
-
- scm_unprotect_object (sym);
if (lenp != NULL)
{
Index: guile/guile-core/libguile/goops.c
diff -u guile/guile-core/libguile/goops.c:1.1
guile/guile-core/libguile/goops.c:1.2
--- guile/guile-core/libguile/goops.c:1.1 Wed Oct 25 07:49:31 2000
+++ guile/guile-core/libguile/goops.c Thu Nov 2 02:36:31 2000
@@ -2479,7 +2479,7 @@
if (SCM_NFALSEP (SCM_STRUCT_TABLE_NAME (data)))
SCM_SET_STRUCT_TABLE_CLASS (data,
scm_make_extended_class
- (SCM_ROCHARS (SCM_STRUCT_TABLE_NAME (data))));
+ (SCM_SYMBOL_CHARS (SCM_STRUCT_TABLE_NAME
(data))));
return SCM_UNSPECIFIED;
}
Index: guile/guile-core/libguile/objects.c
diff -u guile/guile-core/libguile/objects.c:1.50
guile/guile-core/libguile/objects.c:1.51
--- guile/guile-core/libguile/objects.c:1.50 Wed Oct 25 07:50:18 2000
+++ guile/guile-core/libguile/objects.c Thu Nov 2 02:36:31 2000
@@ -191,7 +191,7 @@
{
SCM name = SCM_STRUCT_TABLE_NAME (SCM_CDR (handle));
SCM class = scm_make_extended_class (SCM_NFALSEP (name)
- ? SCM_ROCHARS (name)
+ ? SCM_SYMBOL_CHARS (name)
: 0);
SCM_SET_STRUCT_TABLE_CLASS (SCM_CDR (handle), class);
return class;
Index: guile/guile-core/libguile/ports.c
diff -u guile/guile-core/libguile/ports.c:1.117
guile/guile-core/libguile/ports.c:1.118
--- guile/guile-core/libguile/ports.c:1.117 Mon Oct 30 03:42:26 2000
+++ guile/guile-core/libguile/ports.c Thu Nov 2 02:36:31 2000
@@ -1271,7 +1271,7 @@
{
port = SCM_COERCE_OUTPORT (port);
SCM_VALIDATE_OPENPORT (1,port);
- return SCM_PTAB_ENTRY (port)->file_name;
+ return SCM_FILENAME (port);
}
#undef FUNC_NAME
@@ -1286,7 +1286,8 @@
port = SCM_COERCE_OUTPORT (port);
SCM_VALIDATE_OPENPORT (1,port);
/* We allow the user to set the filename to whatever he likes. */
- return SCM_PTAB_ENTRY (port)->file_name = filename;
+ SCM_SET_FILENAME (port, filename);
+ return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
Index: guile/guile-core/libguile/ports.h
diff -u guile/guile-core/libguile/ports.h:1.65
guile/guile-core/libguile/ports.h:1.66
--- guile/guile-core/libguile/ports.h:1.65 Wed May 24 04:22:38 2000
+++ guile/guile-core/libguile/ports.h Thu Nov 2 02:36:31 2000
@@ -169,6 +169,7 @@
#define SCM_STREAM(x) (SCM_PTAB_ENTRY(x)->stream)
#define SCM_SETSTREAM(x,s) (SCM_PTAB_ENTRY(x)->stream = (scm_bits_t)
(s))
#define SCM_FILENAME(x) (SCM_PTAB_ENTRY(x)->file_name)
+#define SCM_SET_FILENAME(x, n) (SCM_PTAB_ENTRY(x)->file_name = (n))
#define SCM_LINUM(x) (SCM_PTAB_ENTRY(x)->line_number)
#define SCM_COL(x) (SCM_PTAB_ENTRY(x)->column_number)
#define SCM_REVEALED(x) (SCM_PTAB_ENTRY(x)->revealed)
Index: guile/guile-core/libguile/print.c
diff -u guile/guile-core/libguile/print.c:1.102
guile/guile-core/libguile/print.c:1.103
--- guile/guile-core/libguile/print.c:1.102 Wed Oct 25 04:01:03 2000
+++ guile/guile-core/libguile/print.c Thu Nov 2 02:36:31 2000
@@ -439,11 +439,16 @@
env = SCM_ENV (exp);
scm_puts ("#<procedure", port);
}
- if (SCM_ROSTRINGP (name))
+ if (SCM_SYMBOLP (name))
{
scm_putc (' ', port);
- scm_puts (SCM_ROCHARS (name), port);
+ scm_lfwrite (SCM_SYMBOL_CHARS (name), SCM_SYMBOL_LENGTH (name),
port);
}
+ else if (SCM_STRINGP (name))
+ {
+ scm_putc (' ', port);
+ scm_lfwrite (SCM_ROCHARS (name), SCM_STRING_LENGTH (name),
port);
+ }
if (!SCM_UNBNDP (code))
{
if (SCM_PRINT_SOURCE_P)
@@ -505,7 +510,6 @@
len = SCM_SYMBOL_LENGTH (exp);
str = SCM_SYMBOL_CHARS (exp);
- scm_remember (&exp);
pos = 0;
weird = 0;
maybe_weird = 0;
@@ -568,6 +572,7 @@
}
if (pos < end)
scm_lfwrite (str + pos, end - pos, port);
+ scm_remember (&exp);
if (weird)
scm_lfwrite ("}#", 2, port);
break;
@@ -664,7 +669,7 @@
if (SCM_NFALSEP (name))
{
scm_putc (' ', port);
- scm_puts (SCM_ROCHARS (name), port);
+ scm_display (name, port);
}
}
scm_putc ('>', port);
@@ -972,6 +977,7 @@
int fReturnString = 0;
int writingp;
char *start;
+ char *end;
char *p;
if (SCM_EQ_P (destination, SCM_BOOL_T))
@@ -995,13 +1001,16 @@
SCM_VALIDATE_REST_ARGUMENT (args);
start = SCM_ROCHARS (message);
- for (p = start; *p != '\0'; ++p)
+ end = start + SCM_STRING_LENGTH (message);
+ for (p = start; p != end; ++p)
if (*p == '~')
{
- if (SCM_IMP (args) || SCM_NCONSP (args))
+ if (!SCM_CONSP (args))
+ continue;
+
+ if (++p == end)
continue;
- ++p;
if (*p == 'A' || *p == 'a')
writingp = 0;
else if (*p == 'S' || *p == 's')
Index: guile/guile-core/libguile/symbols.h
diff -u guile/guile-core/libguile/symbols.h:1.39
guile/guile-core/libguile/symbols.h:1.40
--- guile/guile-core/libguile/symbols.h:1.39 Mon Oct 30 03:42:26 2000
+++ guile/guile-core/libguile/symbols.h Thu Nov 2 02:36:31 2000
@@ -75,8 +75,6 @@
#define SCM_SYMBOL_HASH(X) (SCM_CELL_WORD_2 (X))
#define SCM_SET_SYMBOL_HASH(X, v) (SCM_SET_CELL_WORD_2 ((X), (v)))
-#define SCM_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \
- || (SCM_TYP7(x) == scm_tc7_symbol)))
#define SCM_ROCHARS(x) ((SCM_TYP7 (x) == scm_tc7_substring) \
? (SCM_INUM (SCM_CADR (x)) + SCM_STRING_CHARS (SCM_CDDR
(x))) \
: ((SCM_TYP7 (x) == scm_tc7_string) \
@@ -133,6 +131,8 @@
#define SCM_SUBSTR_STR(x) (SCM_CDDR (x))
#define SCM_SUBSTR_OFFSET(x) (SCM_CADR (x))
#define SCM_LENGTH(x) (((unsigned long) SCM_CELL_WORD_0 (x)) >> 8)
+#define SCM_ROSTRINGP(x) (SCM_NIMP(x) && ((SCM_TYP7S(x)==scm_tc7_string) \
+ || (SCM_TYP7(x) == scm_tc7_symbol)))
#define SCM_ROLENGTH(x) SCM_LENGTH (x)
#define SCM_SUBSTRP(x) (SCM_NIMP (x) && (SCM_TYP7 (x) == scm_tc7_substring))
#define SCM_COERCE_SUBSTR(x) SCM_STRING_COERCE_0TERMINATION_X (x)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- guile/guile-core NEWS RELEASE libguile/backtrac...,
Dirk Herrmann <=