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

yamaken at freedesktop.org yamaken at freedesktop.org
Sat Dec 3 13:46:42 PST 2005


Author: yamaken
Date: 2005-12-03 13:46:38 -0800 (Sat, 03 Dec 2005)
New Revision: 2342

Modified:
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/operations-nonstd.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/sigschemeinternal.h
  - (SigScm_features): Removed
* sigscheme/io.c
  - (SigScm_features): Removed
* sigscheme/operations-nonstd.c
  - (SigScm_Initialize_NONSTD_FEATURES): New function
  - (ScmOp_provide): Replace main code with Scm_Provide()
  - (ScmOp_providedp): Replace main code with Scm_Providedp()
* sigscheme/sigscheme.h
  - (Scm_Provide, Scm_Providedp, SigScm_Initialize_NONSTD_FEATURES):
    New function
* sigscheme/sigscheme.c
  - (features): New static variable
  - (module_info_table): Enable "sscm"
  - (SigScm_Initialize_internal):
    * Remove SigScm_features initialization
    * Add 'features' initialization
    * Replace NONSTD_FEATURES initialization by Scm_Use("sscm")
    * Replace all ScmOp_provide() with Scm_Provide()
  - (Scm_Provide, Scm_Providedp): New function


Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2005-12-03 21:39:30 UTC (rev 2341)
+++ branches/r5rs/sigscheme/io.c	2005-12-03 21:46:38 UTC (rev 2342)
@@ -69,8 +69,6 @@
 ScmObj scm_current_output_port  = NULL;
 ScmObj scm_current_error_port  = NULL;
 
-ScmObj SigScm_features      = NULL;
-
 const char *scm_lib_path = NULL;
 
 const ScmSpecialCharInfo Scm_special_char_table[] = {

Modified: branches/r5rs/sigscheme/operations-nonstd.c
===================================================================
--- branches/r5rs/sigscheme/operations-nonstd.c	2005-12-03 21:39:30 UTC (rev 2341)
+++ branches/r5rs/sigscheme/operations-nonstd.c	2005-12-03 21:46:38 UTC (rev 2342)
@@ -62,6 +62,12 @@
 /*=======================================
   Function Implementations
 =======================================*/
+void SigScm_Initialize_NONSTD_FEATURES(void)
+{
+    REGISTER_FUNC_TABLE(nonstd_func_info_table);
+    Scm_DefineAlias("call/cc", "call-with-current-continuation");
+}
+
 /*
  * TODO:
  * - describe compatibility with de facto standard of other Scheme
@@ -145,9 +151,7 @@
 
     ASSERT_STRINGP(feature);
 
-    /* record to SigScm_features */
-    SCM_SYMBOL_SET_VCELL(SigScm_features,
-                         CONS(feature, SCM_SYMBOL_VCELL(SigScm_features)));
+    Scm_Provide(feature);
 
     return SCM_TRUE;
 }
@@ -163,9 +167,7 @@
 
     ASSERT_STRINGP(feature);
 
-    provided = ScmOp_member(feature, SCM_SYMBOL_VCELL(SigScm_features));
-
-    return (NFALSEP(provided)) ? SCM_TRUE : SCM_FALSE;
+    return (Scm_Providedp(feature)) ? SCM_TRUE : SCM_FALSE;
 }
 
 /*

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-12-03 21:39:30 UTC (rev 2341)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-12-03 21:46:38 UTC (rev 2342)
@@ -71,6 +71,7 @@
 ScmObj Scm_sym_else, Scm_sym_yields;
 
 static int scm_initialized;
+static ScmObj features;
 
 #if SCM_COMPAT_SIOD
 static ScmObj scm_return_value    = NULL;
@@ -78,10 +79,8 @@
 
 static struct module_info module_info_table[] = {
 #if SCM_USE_NONSTD_FEATURES
-#if 0
     {"sscm", SigScm_Initialize_NONSTD_FEATURES},
 #endif
-#endif
 #if SCM_USE_SRFI1
     {"srfi-1", SigScm_Initialize_SRFI1},
 #endif
@@ -159,11 +158,7 @@
     SCM_SYMBOL_SET_VCELL(Scm_Intern("else"), SCM_TRUE);
 #endif
 
-#if SCM_USE_NONSTD_FEATURES
-    /* FIXME: make invisible from users */
-    SigScm_features         = Scm_Intern("*features*");
-    SCM_SYMBOL_SET_VCELL(SigScm_features, SCM_NULL);
-#endif
+    features = SCM_NULL;
 
     /*=======================================================================
       Preallocated Ports
@@ -197,22 +192,19 @@
     REGISTER_FUNC_TABLE(r5rs_deepcadrs_func_info_table);
 #endif
 
-#if SCM_USE_NONSTD_FEATURES
-    /* Non-Standard Functions */
-    REGISTER_FUNC_TABLE(nonstd_func_info_table);
-    Scm_DefineAlias("call/cc", "call-with-current-continuation");
-#endif
-
     /*=======================================================================
       Fixing up
     =======================================================================*/
+#if SCM_USE_NONSTD_FEATURES
+    Scm_Use("sscm");
+#endif
     /* to evaluate SigScheme-dependent codes conditionally */
-    ScmOp_provide(Scm_NewImmutableStringCopying("sigscheme"));
+    Scm_Provide(Scm_NewImmutableStringCopying("sigscheme"));
 #if SCM_STRICT_R5RS
-    ScmOp_provide(Scm_NewImmutableStringCopying("strict-r5rs"));
+    Scm_Provide(Scm_NewImmutableStringCopying("strict-r5rs"));
 #endif
 #if SCM_COMPAT_SIOD_BUGS
-    ScmOp_provide(Scm_NewImmutableStringCopying("siod-bugs"));
+    Scm_Provide(Scm_NewImmutableStringCopying("siod-bugs"));
 #endif
     scm_initialized = TRUE;
 }
@@ -229,6 +221,16 @@
                          SCM_SYMBOL_VCELL(Scm_Intern(sym)));
 }
 
+void Scm_Provide(ScmObj feature)
+{
+    features = CONS(feature, features);
+}
+
+int Scm_Providedp(ScmObj feature)
+{
+    return NFALSEP(ScmOp_member(feature, features));
+}
+
 int Scm_Use(const char *feature)
 {
     ScmObj ok;

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-12-03 21:39:30 UTC (rev 2341)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-12-03 21:46:38 UTC (rev 2342)
@@ -246,6 +246,8 @@
 void SigScm_Initialize(void);
 void SigScm_Finalize(void);
 void Scm_DefineAlias(const char *newsym, const char *sym);
+void Scm_Provide(ScmObj feature);
+int  Scm_Providedp(ScmObj feature);
 int  Scm_Use(const char *feature);
 ScmObj ScmExp_use(ScmObj feature, ScmObj env);
 ScmObj Scm_eval_c_string(const char *exp);
@@ -590,6 +592,7 @@
 
 /* operations-nonstd.c */
 #if SCM_USE_NONSTD_FEATURES
+void SigScm_Initialize_NONSTD_FEATURES(void);
 ScmObj ScmOp_symbol_boundp(ScmObj sym, ScmObj rest);
 ScmObj ScmOp_load_path(void);
 /* FIXME: add ScmObj SigScm_require(const char *c_filename); */

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2005-12-03 21:39:30 UTC (rev 2341)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2005-12-03 21:46:38 UTC (rev 2342)
@@ -65,7 +65,6 @@
 extern ScmObj scm_current_input_port;
 extern ScmObj scm_current_output_port;
 extern ScmObj scm_current_error_port;
-extern ScmObj SigScm_features;
 extern const ScmSpecialCharInfo Scm_special_char_table[];
 
 extern void (*Scm_writess_func)(ScmObj port, ScmObj obj);



More information about the uim-commit mailing list