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

yamaken at freedesktop.org yamaken at freedesktop.org
Tue Sep 6 11:55:52 PDT 2005


Author: yamaken
Date: 2005-09-06 11:55:49 -0700 (Tue, 06 Sep 2005)
New Revision: 1443

Modified:
   branches/r5rs/sigscheme/eval.c
   branches/r5rs/sigscheme/operations-srfi8.c
   branches/r5rs/sigscheme/operations.c
Log:
* sigscheme/eval.c
* sigscheme/operations.c
* sigscheme/operations-srfi8.c
  - Add some important FIXME and TODO comments. Kazuki, would you do
    it? Since it will be a beneficial experience for you, I leave them
    untouched. Refer SRFI-60 functions and ScmExp_define, ScmExp_if
    which related to SCM_REDUCE* and SCM_SHIFT_* macros as example


Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-09-06 18:25:54 UTC (rev 1442)
+++ branches/r5rs/sigscheme/eval.c	2005-09-06 18:55:49 UTC (rev 1443)
@@ -223,6 +223,10 @@
 /*===========================================================================
   S-Expression Evaluation
 ===========================================================================*/
+/*
+ * TODO: split function invocation handling off to a function and share it with
+ * ScmOp_apply
+ */
 ScmObj ScmOp_eval(ScmObj obj, ScmObj env)
 {
     ScmObj tmp  = SCM_NULL;
@@ -462,6 +466,12 @@
     return ret;
 }
 
+/*
+ * TODO:
+ * - Simplify and optimize with SCM_SHIFT_EVALED_*() macro
+ * - split function invocation handling off to a function and share it with
+ *   ScmOp_eval
+ */
 ScmObj ScmOp_apply(ScmObj args, ScmObj env)
 {
     ScmObj proc  = SCM_NULL;
@@ -997,6 +1007,11 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.1 Conditionals
 ===========================================================================*/
+/*
+ * FIXME: following else handlings
+ * - depending on its own true value
+ * - can appeared in other than last clause
+ */
 ScmObj ScmExp_cond(ScmObj arg, ScmObj *envp)
 {
     /*
@@ -1006,7 +1021,10 @@
      *     (<test> <expression1> <expression2> ...)
      *
      * <clause> may be of the form
-     *     (<test> => <expression)
+     *     (<test> => <expression>)
+     *
+     * last <clause> may be of the form
+     *     (else <expression1> <expression2> ...)
      */
     ScmObj env    = *envp;
     ScmObj clause = SCM_NULL;
@@ -1041,6 +1059,7 @@
              * this procedure is then called on the value of the <test> and the value
              * returned by this procedure is returned by the cond expression.
              */
+            /* FIXME: remove expensive Scm_Intern() */
             if (EQ(Scm_Intern("=>"), CAR(exps))) {
                 proc = EVAL(CADR(exps), env);
                 if (FALSEP(ScmOp_procedurep(proc)))
@@ -1058,6 +1077,7 @@
     return SCM_UNDEF;
 }
 
+/* FIXME: argument extraction */
 ScmObj ScmExp_case(ScmObj arg, ScmObj *envp)
 {
     ScmObj env    = *envp;
@@ -1094,9 +1114,9 @@
     ScmObj env = *envp;
     ScmObj obj = SCM_NULL;
 
-    /* sanity check */
     if (NULLP(arg))
         return SCM_TRUE;
+    /* FIXME: expensive operation */
     if (FALSEP(ScmOp_listp(arg)))
         SigScm_ErrorObj("and : list required but got ", arg);
 
@@ -1130,9 +1150,9 @@
     ScmObj env = *envp;
     ScmObj obj = SCM_NULL;
 
-    /* sanity check */
     if (NULLP(arg))
         return SCM_FALSE;
+    /* FIXME: expensive operation */
     if (FALSEP(ScmOp_listp(arg)))
         SigScm_ErrorObj("or : list required but got ", arg);
 
@@ -1164,6 +1184,7 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.2 Binding constructs
 ===========================================================================*/
+/* TODO: Simplify and optimize with SCM_SHIFT_*() macro */
 ScmObj ScmExp_let(ScmObj arg, ScmObj *envp)
 {
     ScmObj env      = *envp;
@@ -1244,6 +1265,7 @@
     return CONS(CAR(arg), vals);
 }
 
+/* TODO: Simplify and optimize with SCM_SHIFT_*() macro */
 ScmObj ScmExp_let_star(ScmObj arg, ScmObj *envp)
 {
     ScmObj env      = *envp;
@@ -1304,6 +1326,7 @@
     return SCM_UNDEF;
 }
 
+/* TODO: Simplify and optimize with SCM_SHIFT_*() macro */
 ScmObj ScmExp_letrec(ScmObj arg, ScmObj *envp)
 {
     ScmObj env      = *envp;
@@ -1388,6 +1411,7 @@
     /* sanity check */
     if (NULLP(arg))
         return SCM_UNDEF;
+    /* FIXME: expensive operation */
     if (FALSEP(ScmOp_listp(arg)))
         SigScm_ErrorObj("begin : list required but got ", arg);
 
@@ -1414,6 +1438,7 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.4 Iteration
 ===========================================================================*/
+/* FIXME: Make safe, simple and optimized with SCM_SHIFT_*() macro */
 ScmObj ScmExp_do(ScmObj arg, ScmObj *envp)
 {
     /*
@@ -1527,6 +1552,8 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.6 Quasiquotation
 ===========================================================================*/
+/* FIXME: rename to ScmExp_quasiquote since quasiquote is a syntax */
+/* TODO: Simplify and optimize with SCM_SHIFT_*() macro */
 ScmObj ScmOp_quasiquote(ScmObj obj, ScmObj env)
 {
     ScmObj ret;
@@ -1540,6 +1567,7 @@
     return ret;
 }
 
+/* FIXME: rename to ScmExp_unquote since unquote is a syntax */
 ScmObj ScmOp_unquote(ScmObj obj, ScmObj env)
 {
     if (!CONSP(obj) || !NULLP(CDR(obj)))
@@ -1548,6 +1576,10 @@
     return SCM_NULL;
 }
 
+/*
+ * FIXME: rename to ScmExp_unquote_splicing since unquote_splicing is a
+ * syntax
+ */
 ScmObj ScmOp_unquote_splicing(ScmObj obj, ScmObj env)
 {
     if (!CONSP(obj) || !NULLP(CDR(obj)))

Modified: branches/r5rs/sigscheme/operations-srfi8.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi8.c	2005-09-06 18:25:54 UTC (rev 1442)
+++ branches/r5rs/sigscheme/operations-srfi8.c	2005-09-06 18:55:49 UTC (rev 1443)
@@ -63,6 +63,7 @@
 /*=============================================================================
   SRFI8 : Receive
 =============================================================================*/
+/* TODO: Simplify and optimize with SCM_SHIFT_*() macro */
 ScmObj ScmOp_SRFI8_receive(ScmObj args, ScmObj *envp)
 {
     /*

Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2005-09-06 18:25:54 UTC (rev 1442)
+++ branches/r5rs/sigscheme/operations.c	2005-09-06 18:55:49 UTC (rev 1443)
@@ -251,6 +251,7 @@
 ==============================================================================*/
 /* Note: SigScheme supports only the integer part of the numerical tower. */
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_add(ScmObj args, ScmObj env)
 {
     int result = 0;
@@ -266,6 +267,7 @@
     return Scm_NewInt(result);
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_multiply(ScmObj args, ScmObj env)
 {
     int result = 1;
@@ -281,6 +283,7 @@
     return Scm_NewInt(result);
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_subtract(ScmObj args, ScmObj env)
 {
     int result = 0;
@@ -306,6 +309,7 @@
     return Scm_NewInt(result);
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_divide(ScmObj args, ScmObj env)
 {
     int result = 0;
@@ -339,6 +343,7 @@
     return (INTP(obj)) ? SCM_TRUE : SCM_FALSE;
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_equal(ScmObj args, ScmObj env)
 {
     int    val = 0;
@@ -368,6 +373,7 @@
     return SCM_TRUE;
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_less(ScmObj args, ScmObj env )
 {
     int    val     = 0;
@@ -400,6 +406,7 @@
     return SCM_TRUE;
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_greater(ScmObj args, ScmObj env )
 {
     int    val     = 0;
@@ -433,6 +440,7 @@
     return SCM_TRUE;
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_less_eq(ScmObj args, ScmObj env )
 {
     int    val     = 0;
@@ -467,6 +475,7 @@
     return SCM_TRUE;
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_greater_eq(ScmObj args, ScmObj env )
 {
     int    val     = 0;
@@ -541,6 +550,7 @@
     return (SCM_INT_VALUE(scm_num) & 0x1) ? SCM_FALSE : SCM_TRUE;
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_max(ScmObj args, ScmObj env )
 {
     int max = 0;
@@ -563,6 +573,7 @@
     return Scm_NewInt(max);
 }
 
+/* TODO: Simplify with SCM_REDUCE*() macro */
 ScmObj ScmOp_min(ScmObj args, ScmObj env )
 {
     int min = 0;
@@ -1966,6 +1977,7 @@
     return Scm_NewValuePacket(argl);
 }
 
+/* TODO: Simplify and optimize with SCM_SHIFT_*() macro */
 ScmObj ScmOp_call_with_values(ScmObj argl, ScmObj *envp)
 {
     ScmObj vals;



More information about the uim-commit mailing list