[uim-commit] r1615 - branches/r5rs/sigscheme
kzk at freedesktop.org
kzk at freedesktop.org
Tue Sep 27 10:21:43 PDT 2005
Author: kzk
Date: 2005-09-27 10:21:40 -0700 (Tue, 27 Sep 2005)
New Revision: 1615
Modified:
branches/r5rs/sigscheme/datas.c
branches/r5rs/sigscheme/debug.c
branches/r5rs/sigscheme/read.c
branches/r5rs/sigscheme/sigscheme.h
Log:
* sigscheme/sigscheme.h
* sigscheme/debug.c
- (SigScm_Debug): new func
* sigscheme/read.c
* sigscheme/datas.c
- replace "printf" debug message with SigScm_Debug
which uses stderr
Modified: branches/r5rs/sigscheme/datas.c
===================================================================
--- branches/r5rs/sigscheme/datas.c 2005-09-27 16:58:59 UTC (rev 1614)
+++ branches/r5rs/sigscheme/datas.c 2005-09-27 17:21:40 UTC (rev 1615)
@@ -227,7 +227,7 @@
ScmObj heap, cell;
#if DEBUG_GC
- printf("allocate_heap num:%d size:%d\n", num_heap, HEAP_SIZE);
+ SigScm_Debug("allocate_heap num:%d size:%d", num_heap, HEAP_SIZE);
#endif
/* allocate heap */
@@ -259,7 +259,7 @@
ScmObj heap, cell;
#if DEBUG_GC
- printf("add_heap current num of heaps:%d\n", *orig_num_heap);
+ SigScm_Debug("add_heap current num of heaps:%d", *orig_num_heap);
#endif
/* increment num_heap */
@@ -322,7 +322,7 @@
static void gc_mark_and_sweep(void)
{
#if DEBUG_GC
- printf("[ gc start ]\n");
+ SigScm_Debug("[ gc start ]");
#endif
gc_preprocess();
@@ -332,7 +332,7 @@
/* we cannot sweep the object, so let's add new heap */
if (NULLP(scm_freelist)) {
#if DEBUG_GC
- printf("Cannot sweeped the object, allocating new heap.\n");
+ SigScm_Debug("Cannot sweeped the object, allocating new heap.");
#endif
add_heap(&scm_heaps, &scm_heap_num, SCM_HEAP_SIZE, &scm_freelist);
}
@@ -471,7 +471,7 @@
size = end - start;
#if DEBUG_GC
- printf("gc_mark_locations() : size = %d\n", size);
+ SigScm_Debug("gc_mark_locations() : size = %d", size);
#endif
gc_mark_locations_n(start, size);
@@ -491,7 +491,7 @@
void *save_regs_buf_end = (char *)save_regs_buf + sizeof(save_regs_buf);
#if DEBUG_GC
- printf("gc_mark\n");
+ SigScm_Debug("gc_mark()");
#endif
setjmp(save_regs_buf);
@@ -589,7 +589,7 @@
}
#if DEBUG_GC
- printf("scm[%d] sweeped = %d\n", i, corrected_obj_num);
+ SigScm_Debug("scm[%d] sweeped = %d", i, corrected_obj_num);
#endif
}
scm_freelist = scm_new_freelist;
Modified: branches/r5rs/sigscheme/debug.c
===================================================================
--- branches/r5rs/sigscheme/debug.c 2005-09-27 16:58:59 UTC (rev 1614)
+++ branches/r5rs/sigscheme/debug.c 2005-09-27 17:21:40 UTC (rev 1615)
@@ -35,6 +35,7 @@
System Include
=======================================*/
#include <stdio.h>
+#include <stdarg.h>
/*=======================================
Local Include
@@ -118,6 +119,17 @@
/*=======================================
Function Implementations
=======================================*/
+void SigScm_Debug(const char *msg, ...)
+{
+ va_list va;
+
+ va_start(va, msg);
+ vfprintf(stderr, msg, va);
+ va_end(va);
+
+ fprintf(stderr, "\n");
+}
+
void SigScm_Display(ScmObj obj)
{
print_ScmObj_internal(SCM_PORTINFO_FILE(scm_current_output_port), obj, AS_WRITE);
Modified: branches/r5rs/sigscheme/read.c
===================================================================
--- branches/r5rs/sigscheme/read.c 2005-09-27 16:58:59 UTC (rev 1614)
+++ branches/r5rs/sigscheme/read.c 2005-09-27 17:21:40 UTC (rev 1615)
@@ -165,14 +165,14 @@
int c1 = 0;
#if DEBUG_PARSER
- printf("read_sexpression\n");
+ SigScm_Debug("read_sexpression");
#endif
while (1) {
c = skip_comment_and_space(port);
#if DEBUG_PARSER
- printf("read_sexpression c = %c\n", c);
+ SigScm_Debug("read_sexpression c = %c", c);
#endif
switch (c) {
@@ -245,14 +245,14 @@
char *token = NULL;
#if DEBUG_PARSER
- printf("read_list\n");
+ SigScm_Debug("read_list");
#endif
while (1) {
c = skip_comment_and_space(port);
#if DEBUG_PARSER
- printf("read_list c = [%c]\n", c);
+ SigScm_Debug("read_list c = [%c]", c);
#endif
if (c == EOF) {
@@ -267,7 +267,7 @@
SCM_PORT_GETC(port, c2);
#if DEBUG_PARSER
- printf("read_list process_dot c2 = [%c]\n", c2);
+ SigScm_Debug("read_list process_dot c2 = [%c]", c2);
#endif
if (isspace(c2) || c2 == '(' || c2 == '"' || c2 == ';') {
cdr = read_sexpression(port);
@@ -317,7 +317,7 @@
char *ch = read_char_sequence(port);
#if DEBUG_PARSER
- printf("read_char : ch = %s\n", ch);
+ SigScm_Debug("read_char : ch = %s", ch);
#endif
/* check special sequence "space" and "newline" */
@@ -346,14 +346,14 @@
int c = 0;
#if DEBUG_PARSER
- printf("read_string\n");
+ SigScm_Debug("read_string");
#endif
while (1) {
SCM_PORT_GETC(port, c);
#if DEBUG_PARSER
- printf("read_string c = %c\n", c);
+ SigScm_Debug("read_string c = %c", c);
#endif
switch (c) {
@@ -403,7 +403,7 @@
free(sym_name);
#if DEBUG_PARSER
- printf("read_symbol\n");
+ SigScm_Debug("read_symbol");
#endif
return sym;
@@ -418,7 +418,7 @@
ScmObj ret = SCM_NULL;
#if DEBUG_PARSER
- printf("read_number_or_symbol\n");
+ SigScm_Debug("read_number_or_symbol");
#endif
/* read char sequence */
@@ -449,7 +449,7 @@
SCM_PORT_GETC(port, c);
#if DEBUG_PARSER
- printf("c = %c\n", c);
+ SigScm_Debug("c = %c", c);
#endif
switch (c) {
@@ -479,7 +479,7 @@
SCM_PORT_GETC(port, c);
#if DEBUG_PARSER
- printf("c = %c\n", c);
+ SigScm_Debug("c = %c", c);
#endif
switch (c) {
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-09-27 16:58:59 UTC (rev 1614)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-09-27 17:21:40 UTC (rev 1615)
@@ -555,6 +555,7 @@
void SigScm_ShowBacktrace(void);
/* debug.c */
+void SigScm_Debug(const char *msg, ...);
void SigScm_Display(ScmObj obj);
void SigScm_WriteToPort(ScmObj port, ScmObj obj);
void SigScm_DisplayToPort(ScmObj port, ScmObj obj);
More information about the uim-commit
mailing list