[uim-commit] r2791 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Jan 4 16:37:36 PST 2006


Author: yamaken
Date: 2006-01-04 16:37:32 -0800 (Wed, 04 Jan 2006)
New Revision: 2791

Modified:
   branches/r5rs/sigscheme/error.c
   branches/r5rs/sigscheme/eval.c
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/operations-srfi6.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/storage-gc.c
   branches/r5rs/sigscheme/syntax.c
Log:
* sigscheme/sigscheme.h
  - (SCM_GC_PROTECTED_CALL_INTERNAL, scm_providedp, scm_use,
    scm_port_char_readyp, scm_die): Replace boolean types and values
    with scm_bool
* sigscheme/sigscheme.c
  - (scm_use_internal, scm_providedp, scm_use, scm_use_internal,
    scm_register_func): Ditto
* sigscheme/eval.c
  - (EVAL_ARGS, SUPPRESS_EVAL_ARGS, reduce, call): Ditto
* sigscheme/syntax.c
  - (TR_ENDP): Ditto
* sigscheme/error.c
  - (srfi34_providedp, scm_die): Ditto
* sigscheme/operations-srfi6.c
  - (istrport_finalize, istrport_finalize): Ditto
* sigscheme/io.c
  - (file_existsp, scm_port_char_readyp): Ditto
* sigscheme/storage-gc.c
  - (within_heapp): Ditto


Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/error.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -67,7 +67,7 @@
 /*=======================================
   File Local Function Declarations
 =======================================*/
-static int srfi34_providedp(void);
+static scm_bool srfi34_providedp(void);
 #if (SCM_DEBUG && SCM_DEBUG_BACKTRACE_VAL)
 static void show_arg(ScmObj arg, ScmObj env);
 #endif
@@ -150,7 +150,7 @@
 }
 
 #if SCM_USE_SRFI34
-static int
+static scm_bool
 srfi34_providedp(void)
 {
     if (!srfi34_is_provided) {
@@ -289,7 +289,7 @@
     return SCM_UNDEF;
 }
 
-int
+scm_bool
 scm_die(const char *msg, const char *filename, int line)
 {
     char *reason;
@@ -302,7 +302,7 @@
 
     scm_fatal_error(reason);
     /* NOTREACHED */
-    return 1;  /* dummy value for boolean expression */
+    return scm_true;  /* dummy value for boolean expression */
 }
 
 void

Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/eval.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -49,8 +49,8 @@
 /*=======================================
   File Local Macro Declarations
 =======================================*/
-#define EVAL_ARGS          0
-#define SUPPRESS_EVAL_ARGS 1
+#define EVAL_ARGS          scm_false
+#define SUPPRESS_EVAL_ARGS scm_true
 
 #define SCM_ERRMSG_WRONG_NR_ARG " Wrong number of arguments "
 #define SCM_ERRMSG_NON_R5RS_ENV " the environment is not conformed to R5RS"
@@ -63,10 +63,10 @@
   File Local Function Declarations
 =======================================*/
 static ScmObj reduce(ScmObj (*func)(), ScmObj args, ScmObj env,
-                     int suppress_eval);
+                     scm_bool suppress_eval);
 static ScmObj call_closure(ScmObj proc, ScmObj args, ScmEvalState *eval_state);
 static ScmObj call(ScmObj proc, ScmObj args, ScmEvalState *eval_state,
-                   int suppress_eval);
+                   scm_bool suppress_eval);
 static ScmObj map_eval(ScmObj args, ScmObj env);
 
 /*=======================================
@@ -129,7 +129,7 @@
 
 /* ARGS should NOT have been evaluated yet. */
 static ScmObj
-reduce(ScmObj (*func)(), ScmObj args, ScmObj env, int suppress_eval)
+reduce(ScmObj (*func)(), ScmObj args, ScmObj env, scm_bool suppress_eval)
 {
     ScmObj left;
     ScmObj right;
@@ -225,7 +225,8 @@
  * through all necessary evaluations if this flag is nonzero.
  */
 static ScmObj
-call(ScmObj proc, ScmObj args, ScmEvalState *eval_state, int suppress_eval)
+call(ScmObj proc, ScmObj args, ScmEvalState *eval_state,
+     scm_bool suppress_eval)
 {
     ScmObj env, cont;
     ScmObj (*func)();

Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/io.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -76,7 +76,7 @@
 =======================================*/
 static void scm_load_internal(const char *filename);
 static char *find_path(const char *c_filename);
-static int    file_existsp(const char *filepath);
+static scm_bool file_existsp(const char *filepath);
 #if SCM_USE_SRFI22
 static void interpret_script_prelude(ScmObj port);
 static char **parse_script_prelude(ScmObj port);
@@ -209,7 +209,7 @@
     return SCM_CHARPORT_PEEK_CHAR(SCM_PORT_IMPL(port));
 }
 
-int
+scm_bool
 scm_port_char_readyp(ScmObj port)
 {
     SCM_ENSURE_LIVE_PORT(port);
@@ -612,7 +612,7 @@
     return NULL;
 }
 
-static int
+static scm_bool
 file_existsp(const char *c_filepath)
 {
     FILE *f;
@@ -620,9 +620,9 @@
     f = fopen(c_filepath, "r");
     if (f) {
         fclose(f);
-        return 1;
+        return scm_true;
     } else {
-        return 0;
+        return scm_false;
     }
 }
 

Modified: branches/r5rs/sigscheme/operations-srfi6.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi6.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/operations-srfi6.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -59,7 +59,7 @@
 /*=======================================
   File Local Function Declarations
 =======================================*/
-static void istrport_finalize(char **str, int ownership, void **opaque);
+static void istrport_finalize(char **str, scm_bool ownership, void **opaque);
 
 /*=======================================
   Function Implementations
@@ -73,7 +73,7 @@
 }
 
 static void
-istrport_finalize(char **str, int ownership, void **opaque)
+istrport_finalize(char **str, scm_bool ownership, void **opaque)
 {
     scm_gc_unprotect((ScmObj *)opaque);
 }

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/sigscheme.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -113,8 +113,9 @@
   File Local Function Declarations
 =======================================*/
 static void scm_initialize_internal(void);
-static int scm_use_internal(const char *feature);
-static int scm_register_func(const char *name, ScmFuncType func, enum ScmFuncTypeCode type);
+static scm_bool scm_use_internal(const char *feature);
+static scm_bool scm_register_func(const char *name, ScmFuncType func,
+                                  enum ScmFuncTypeCode type);
 static ScmObj scm_eval_c_string_internal(const char *exp);
 
 /*=======================================
@@ -211,22 +212,22 @@
     features = CONS(feature, features);
 }
 
-int
+scm_bool
 scm_providedp(ScmObj feature)
 {
     return NFALSEP(scm_p_member(feature, features));
 }
 
-int
+scm_bool
 scm_use(const char *feature)
 {
-    int ok;
+    scm_bool ok;
 #if !SCM_GCC4_READY_GC
     ScmObj stack_start;
 #endif
 
 #if SCM_GCC4_READY_GC
-    SCM_GC_PROTECTED_CALL(ok, int, scm_use_internal, (feature));
+    SCM_GC_PROTECTED_CALL(ok, scm_bool, scm_use_internal, (feature));
 #else
     scm_gc_protect_stack(&stack_start);
 
@@ -238,7 +239,7 @@
     return ok;
 }
 
-static int
+static scm_bool
 scm_use_internal(const char *feature)
 {
     ScmObj ok;
@@ -402,16 +403,18 @@
 /*===========================================================================
   Scheme Function Export Related Functions
 ===========================================================================*/
-/* New Interfaces */
-static int
-scm_register_func(const char *name, ScmFuncType c_func, enum ScmFuncTypeCode type)
+static scm_bool
+scm_register_func(const char *name, ScmFuncType c_func,
+                  enum ScmFuncTypeCode type)
 {
-    ScmObj sym  = scm_intern(name);
-    ScmObj func = MAKE_FUNC(type, c_func);
+    ScmObj sym, func;
 
+    sym  = scm_intern(name);
+    func = MAKE_FUNC(type, c_func);
+
     /* TODO: reject bad TYPE */
     SCM_SYMBOL_SET_VCELL(sym, func);
-    return 1;
+    return scm_true;
 }
 
 /* Not implemented yet. */

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/sigscheme.h	2006-01-05 00:37:32 UTC (rev 2791)
@@ -174,10 +174,10 @@
         ret_type (*volatile fp)() = (ret_type (*)())&func;                   \
         ScmObj *stack_start;                                                 \
                                                                              \
-        if (0) exp_ret func args;  /* compile-time type check */             \
-        stack_start = scm_gc_protect_stack(NULL);                          \
+        if (scm_false) exp_ret func args;  /* compile-time type check */     \
+        stack_start = scm_gc_protect_stack(NULL);                            \
         exp_ret (*fp)args;                                                   \
-        scm_gc_unprotect_stack(stack_start);                               \
+        scm_gc_unprotect_stack(stack_start);                                 \
     } while (/* CONSTCOND */ 0)
 
 #endif /* SCM_GCC4_READY_GC */
@@ -572,8 +572,8 @@
 void scm_finalize(void);
 void scm_define_alias(const char *newsym, const char *sym);
 void scm_provide(ScmObj feature);
-int  scm_providedp(ScmObj feature);
-int  scm_use(const char *feature);
+scm_bool scm_providedp(ScmObj feature);
+scm_bool scm_use(const char *feature);
 ScmObj scm_s_use(ScmObj feature, ScmObj env);
 ScmObj scm_eval_c_string(const char *exp);
 #if SCM_COMPAT_SIOD
@@ -922,7 +922,7 @@
 char *scm_port_inspect(ScmObj port);
 int scm_port_get_char(ScmObj port);
 int scm_port_peek_char(ScmObj port);
-int scm_port_char_readyp(ScmObj port);
+scm_bool scm_port_char_readyp(ScmObj port);
 int scm_port_puts(ScmObj port, const char *str);
 int scm_port_put_char(ScmObj port, int ch);
 int scm_port_printf(ScmObj port, const char *fmt, ...);
@@ -966,7 +966,7 @@
 int  scm_predefined_debug_categories(void);
 void scm_categorized_debug(int category, const char *msg, ...);
 void scm_debug(const char *msg, ...);
-int  scm_die(const char *msg, const char *filename, int line);
+scm_bool scm_die(const char *msg, const char *filename, int line);
 void scm_error(const char *msg, ...) SCM_NORETURN;
 void scm_error_obj(const char *funcname, const char *msg, ScmObj obj) SCM_NORETURN;
 void scm_show_backtrace(ScmObj trace_stack);

Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/storage-gc.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -113,7 +113,7 @@
 
 /* GC Mark Related Functions */
 static void mark_obj(ScmObj obj);
-static int  within_heapp(ScmObj obj);
+static scm_bool within_heapp(ScmObj obj);
 
 static void gc_mark_protected_var();
 static void gc_mark_locations_n(ScmObj *start, size_t n);
@@ -268,8 +268,7 @@
   Heap Allocator & Garbage Collector
 ============================================================================*/
 static void
-initialize_heap(size_t size, size_t alloc_threshold,
-                            int n_max, int n_init)
+initialize_heap(size_t size, size_t alloc_threshold, int n_max, int n_init)
 {
     int i;
 
@@ -410,7 +409,7 @@
 
 /* The core part of Conservative GC */
 
-static int
+static scm_bool
 within_heapp(ScmObj obj)
 {
     ScmCell *heap, *ptr;
@@ -418,7 +417,7 @@
 
 #if SCM_OBJ_COMPACT
     if (!SCM_CANBE_MARKED(obj))
-        return 0;
+        return scm_false;
     /* The pointer on the stack is 'tagged' to represent its types.
      * So we need to ignore the tag to get its real pointer value. */
     ptr = (ScmCell *)SCM_STRIP_TAG_INFO(obj);
@@ -432,15 +431,15 @@
      */
     if (((uintptr_t)ptr % sizeof(ScmCell))
         || (ptr < heaps_lowest || heaps_highest <= ptr))
-        return 0;
+        return scm_false;
 
     for (i = 0; i < n_heaps; i++) {
         heap = heaps[i];
         if (heap && &heap[0] <= ptr && ptr < &heap[heap_size])
-            return 1;
+            return scm_true;
     }
 
-    return 0;
+    return scm_false;
 }
 
 static void

Modified: branches/r5rs/sigscheme/syntax.c
===================================================================
--- branches/r5rs/sigscheme/syntax.c	2006-01-04 23:59:53 UTC (rev 2790)
+++ branches/r5rs/sigscheme/syntax.c	2006-01-05 00:37:32 UTC (rev 2791)
@@ -204,7 +204,7 @@
 #define TR_CALL(_t, _msg, _p) ((*(_t).trans)(&(_t), (_msg), (_p)))
 #define TR_GET_OBJ(_t)     (TR_CALL((_t), TR_MSG_GET_OBJ, SCM_INVALID))
 #define TR_NEXT(_t)        ((void)TR_CALL((_t), TR_MSG_NEXT, SCM_INVALID))
-#define TR_ENDP(_t)        ((int)TR_CALL((_t), TR_MSG_ENDP, SCM_INVALID))
+#define TR_ENDP(_t)        ((scm_bool)TR_CALL((_t), TR_MSG_ENDP, SCM_INVALID))
 #define TR_EXTRACT(_t)     (TR_CALL((_t), TR_MSG_EXTRACT, SCM_INVALID))
 
 



More information about the uim-commit mailing list