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

yamaken at freedesktop.org yamaken at freedesktop.org
Mon Oct 3 04:53:21 PDT 2005


Author: yamaken
Date: 2005-10-03 04:53:19 -0700 (Mon, 03 Oct 2005)
New Revision: 1769

Modified:
   branches/r5rs/sigscheme/operations-siod.c
   branches/r5rs/sigscheme/sigscheme.h
Log:
* sigscheme/sigscheme.h
  - (ScmOp_symbol_boundp): Change type for args
* sigscheme/operations-siod.c
  - (SigScm_Initialize_SIOD): Follow the type change of
    ScmOp_symbol_boundp
  - (ScmOp_symbol_boundp):
    * Accept optional 'env' as 2nd argument
    * Simplify with new macros
    * Make SIOD-compatible behavior SCM_COMPAT_SIOD_BUGS


Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c	2005-10-03 11:21:39 UTC (rev 1768)
+++ branches/r5rs/sigscheme/operations-siod.c	2005-10-03 11:53:19 UTC (rev 1769)
@@ -94,8 +94,7 @@
     /*=======================================================================
       SIOD Compatible Variables and Procedures
     =======================================================================*/
-    /* operations-siod.c */
-    Scm_RegisterProcedureFixed1("symbol-bound?"        , ScmOp_symbol_boundp);
+    Scm_RegisterProcedureVariadic1("symbol-bound?"     , ScmOp_symbol_boundp);
     Scm_RegisterProcedureFixed1("symbol-value"         , ScmOp_symbol_value);
     Scm_RegisterProcedureFixed2("set-symbol-value!"    , ScmOp_set_symbol_value);
 #if SCM_COMPAT_SIOD_BUGS
@@ -119,17 +118,25 @@
  * - describe compatibility with de facto standard of other Scheme
  *   implementations (accept env as optional arg, etc)
  */
-ScmObj ScmOp_symbol_boundp(ScmObj obj)
+ScmObj ScmOp_symbol_boundp(ScmObj sym, ScmObj rest)
 {
-    if (!SYMBOLP(obj))
-        SigScm_ErrorObj("symbol-bound? : symbol required but got ", obj);
+    ScmObj env = SCM_INVALID;
+    DECLARE_FUNCTION("symbol-bound?", ProcedureVariadic1);
 
-#if 1
+    ASSERT_SYMBOLP(sym);
+
+#if SCM_COMPAT_SIOD_BUGS
     /* SIOD compatible implementation */
-    return (SCM_SYMBOL_BOUNDP(obj)) ? SCM_TRUE : SCM_FALSE;
+    return (SCM_SYMBOL_BOUNDP(sym)) ? SCM_TRUE : SCM_FALSE;
 #else
-    return (!NULLP(Scm_LookupEnvironment(obj, env))
-            || SCM_SYMBOL_BOUNDP(obj)) ? SCM_TRUE : SCM_FALSE;
+    env = POP_ARG(rest);
+    if (VALIDP(env))
+        ASSERT_ENVP(env);
+    else
+        env = SCM_INTERACTION_ENV;
+
+    return (!NULLP(Scm_LookupEnvironment(sym, env))
+            || SCM_SYMBOL_BOUNDP(sym)) ? SCM_TRUE : SCM_FALSE;
 #endif
 }
 

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-10-03 11:21:39 UTC (rev 1768)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-10-03 11:53:19 UTC (rev 1769)
@@ -662,7 +662,7 @@
 #if SCM_COMPAT_SIOD
 /* operations-siod.c */
 void   SigScm_Initialize_SIOD(void);
-ScmObj ScmOp_symbol_boundp(ScmObj obj);
+ScmObj ScmOp_symbol_boundp(ScmObj sym, ScmObj rest);
 ScmObj ScmOp_symbol_value(ScmObj var);
 ScmObj ScmOp_set_symbol_value(ScmObj var, ScmObj val);
 ScmObj ScmOp_siod_eql(ScmObj obj1, ScmObj obj2);



More information about the uim-commit mailing list