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

kzk at freedesktop.org kzk at freedesktop.org
Mon Aug 15 08:19:47 PDT 2005


Author: kzk
Date: 2005-08-15 08:19:43 -0700 (Mon, 15 Aug 2005)
New Revision: 1202

Modified:
   branches/r5rs/sigscheme/io.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigscheme.h
Log:
* implement "provide" and "provided?"

* sigscheme/sigscheme.h
* sigscheme/io.c
  - (ScmOp_provide, ScmOp_providedp): new func

* sigscheme/sigscheme.c
  - (SigScm_Initialize): export "provide", "provided?"
  


Modified: branches/r5rs/sigscheme/io.c
===================================================================
--- branches/r5rs/sigscheme/io.c	2005-08-15 09:29:30 UTC (rev 1201)
+++ branches/r5rs/sigscheme/io.c	2005-08-15 15:19:43 UTC (rev 1202)
@@ -525,6 +525,28 @@
     return Scm_NewString(loaded_str);
 }
 
+ScmObj ScmOp_provide(ScmObj feature)
+{
+    if (!SCM_STRINGP(feature))
+	SigScm_ErrorObj("provide : string required but got ", feature);
+
+    /* record to provided_feature */
+    provided_feature = Scm_NewCons(feature, provided_feature);
+
+    return SCM_TRUE;
+}
+
+ScmObj ScmOp_providedp(ScmObj feature)
+{
+    if (!SCM_STRINGP(feature))
+	SigScm_ErrorObj("provide : string required but got ", feature);
+
+    if (EQ(ScmOp_member(feature, provided_feature), SCM_TRUE))
+	return SCM_TRUE;
+
+    return SCM_FALSE;
+}
+
 ScmObj ScmOp_file_existsp(ScmObj filepath)
 {
     FILE *f = NULL;

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-08-15 09:29:30 UTC (rev 1201)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-08-15 15:19:43 UTC (rev 1202)
@@ -269,6 +269,8 @@
     Scm_RegisterFuncL("write-char"           , ScmOp_write_char);
     Scm_RegisterFunc1("load"                 , ScmOp_load);
     Scm_RegisterFunc1("require"              , ScmOp_require);
+    Scm_RegisterFunc1("provide"              , ScmOp_provide);
+    Scm_RegisterFunc1("provided?"            , ScmOp_providedp);
     Scm_RegisterFunc1("file-exists?"         , ScmOp_file_existsp);
     Scm_RegisterFunc1("delete-file"          , ScmOp_delete_file);
     /*=======================================================================

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-08-15 09:29:30 UTC (rev 1201)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-08-15 15:19:43 UTC (rev 1202)
@@ -318,6 +318,8 @@
 ScmObj SigScm_load(const char *c_filename);
 ScmObj ScmOp_load(ScmObj filename);
 ScmObj ScmOp_require(ScmObj filename);
+ScmObj ScmOp_provide(ScmObj feature);
+ScmObj ScmOp_providedp(ScmObj feature);
 ScmObj ScmOp_file_existsp(ScmObj filepath);
 ScmObj ScmOp_delete_file(ScmObj filepath);
 



More information about the uim-commit mailing list