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

kzk at freedesktop.org kzk at freedesktop.org
Fri Aug 12 02:11:14 EST 2005


Author: kzk
Date: 2005-08-11 09:11:11 -0700 (Thu, 11 Aug 2005)
New Revision: 1184

Modified:
   branches/r5rs/sigscheme/eval.c
   branches/r5rs/sigscheme/sigscheme.c
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/sigschemetype.h
Log:
* Abolish ARGNUM_R_NotEval and ARGNUM_R_Eval. And Introduce tail_flag.

* sigscheme/sigscheme.h
  - (Scm_InitSubrR_NotEval. Scm_InitSubrR_Eval): removed
  - (Scm_InitSubrR): new func
  - (ScmExp_lambda, ScmExp_if, ScmExp_set, ScmExp_cond,
     ScmExp_case, ScmExp_and, ScmExp_or, ScmExp_let,
     ScmExp_let_star, ScmExp_letrec, ScmExp_begin,
     ScmExp_do, ScmExp_delay, ScmExp_define): change args
* sigscheme/sigschemetype.h
  - (ARGNUM_R_Eval, ARGNUM_R_NotEval): removed
  - (ARGNUM_R): new enum variable
  - (subrr): renamed from subrm, and change args
* sigscheme/eval.c
  - (ScmOp_eval): introduce tail_flag
  - (ScmExp_lambda, ScmExp_if, ScmExp_set, ScmExp_cond,
     ScmExp_case, ScmExp_and, ScmExp_or, ScmExp_let,
     ScmExp_let_star, ScmExp_letrec, ScmExp_begin,
     ScmExp_do, ScmExp_delay, ScmExp_define)
     : change args and handle tail_flag
* sigscheme/sigscheme.c
  - (ScmExp_lambda, ScmExp_if, ScmExp_set, ScmExp_cond,
     ScmExp_case, ScmExp_and, ScmExp_or, ScmExp_let,
     ScmExp_let_star, ScmExp_letrec, ScmExp_begin,
     ScmExp_do, ScmExp_delay, ScmExp_define)
     : call Scm_InitSubrR for these function
  - (Scm_InitSubrR_NotEval, Scm_InitSubrR_Eval): removed
  - (Scm_InitSubrR): new func



Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-08-10 21:49:22 UTC (rev 1183)
+++ branches/r5rs/sigscheme/eval.c	2005-08-11 16:11:11 UTC (rev 1184)
@@ -204,6 +204,7 @@
 {
     ScmObj tmp  = SCM_NIL;
     ScmObj arg  = SCM_NIL;
+    int tail_flag = 0;
 
 eval_loop:
     switch (SCM_GETTYPE(obj)) {
@@ -248,14 +249,9 @@
 			 * - ARGNUM_L
 			 *     - evaluate all the args and pass it to func
 			 *
-			 * - ARGNUM_R_NotEval
+			 * - ARGNUM_R
 			 *     - not evaluate all the arguments
-			 *     - not evaluate the result of function
 			 *
-			 * - ARGNUM_R_Eval (for tail-recursion)
-			 *     - not evaluate all the arguments
-			 *     - evaluate the result of function
-			 *
 			 * - ARGNUM_2N
 			 *     - call the function with each 2 objs
 			 *
@@ -274,26 +270,24 @@
                                                                map_eval(SCM_CDR(obj), env),
 							       env);
                                 }
-			    case ARGNUM_R_NotEval:
+			    case ARGNUM_R:
 				{
-                                    return SCM_FUNC_EXEC_SUBRR(tmp,
-                                                               SCM_CDR(obj),
-							       &env);
-				}
-			    case ARGNUM_R_Eval:
-				{
 				    obj = SCM_FUNC_EXEC_SUBRR(tmp,
 							      SCM_CDR(obj),
-							      &env);
+							      &env,
+							      &tail_flag);
 
 				    /*
 				     * The core point of tail-recursion
 				     *
-				     * The return obj of ARGNUM_R_Eval func is the raw S-expression.
+				     * if tail_flag == 1, SCM_FUNC_EXEC_SUBRR returns raw S-expression.
 				     * So we need to evaluate it! This is for not to consume stack,
 				     * that is, tail-recursion optimization.
 				     */
-				    goto eval_loop;
+				    if (tail_flag == 1)
+					goto eval_loop;
+				    else
+					return obj;
 				}
 			    case ARGNUM_2N:
 				{
@@ -410,10 +404,9 @@
 			     * Notice
 			     *
 			     * The return obj of ScmExp_begin is the raw S-expression.
-			     * Because it is defined as ARGNUM_R_Eval function. So we
-			     * need to evaluate this!.
+			     * So we need to re-evaluate this!.
 			     */
-			    obj = ScmExp_begin(SCM_CDR(SCM_CLOSURE_EXP(tmp)), &env);
+			    obj = ScmExp_begin(SCM_CDR(SCM_CLOSURE_EXP(tmp)), &env, &tail_flag);
 			    goto eval_loop;
 			}
 		    case ScmContinuation:
@@ -460,6 +453,7 @@
 {
     ScmObj proc  = SCM_NIL;
     ScmObj obj   = SCM_NIL;
+    int tail_flag = 0;
 
     /* sanity check */
     if CHECK_2_ARGS(args)
@@ -590,10 +584,9 @@
 		 * Notice
 		 *
 		 * The return obj of ScmExp_begin is the raw S-expression.
-		 * Because it is defined as ARGNUM_R_Eval function. So we
-		 * need to evaluate this!.
+		 * So we need to re-evaluate this!.
 		 */
-		obj = ScmExp_begin(SCM_CDR(SCM_CLOSURE_EXP(proc)), &env);
+		obj = ScmExp_begin(SCM_CDR(SCM_CLOSURE_EXP(proc)), &env, &tail_flag);
 		return ScmOp_eval(obj, env);
 	    }
 	default:
@@ -742,10 +735,13 @@
 /*===========================================================================
   R5RS : 4.1 Primitive expression types : 4.1.4 Procedures
 ===========================================================================*/
-ScmObj ScmExp_lambda(ScmObj exp, ScmObj *envp)
+ScmObj ScmExp_lambda(ScmObj exp, ScmObj *envp, int *tail_flag)
 {
     ScmObj env = *envp;
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     if CHECK_2_ARGS(exp)
 	SigScm_Error("lambda : too few argument\n");
 
@@ -755,12 +751,15 @@
 /*===========================================================================
   R5RS : 4.1 Primitive expression types : 4.1.5 Conditionals
 ===========================================================================*/
-ScmObj ScmExp_if(ScmObj exp, ScmObj *envp)
+ScmObj ScmExp_if(ScmObj exp, ScmObj *envp, int *tail_flag)
 {
     ScmObj env       = *envp;
     ScmObj pred      = SCM_NIL;
     ScmObj false_exp = SCM_NIL;
 
+    /* set tail_flag */
+    (*tail_flag) = 1;
+
     /* sanity check */
     if (SCM_NULLP(exp) || SCM_NULLP(SCM_CDR(exp)))
 	SigScm_Error("if : syntax error\n");
@@ -786,7 +785,7 @@
 /*===========================================================================
   R5RS : 4.1 Primitive expression types : 4.1.6 Assignment
 ===========================================================================*/
-ScmObj ScmExp_set(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_set(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env = *envp;
     ScmObj sym = SCM_CAR(arg);
@@ -794,6 +793,9 @@
     ScmObj ret = SCM_NIL;
     ScmObj tmp = SCM_NIL;
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     if (SCM_NULLP(val))
 	SigScm_Error("set! : syntax error\n");
 
@@ -823,7 +825,7 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.1 Conditionals
 ===========================================================================*/
-ScmObj ScmExp_cond(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_cond(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     /*
      * (cond <clause1> <clause2> ...)
@@ -840,6 +842,9 @@
     ScmObj exps   = SCM_NIL;
     ScmObj proc   = SCM_NIL;
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     /* looping in each clause */
     for (; !SCM_NULLP(arg); arg = SCM_CDR(arg)) {
 	clause = SCM_CAR(arg);
@@ -878,14 +883,14 @@
 				   env);
 	    }
 	    
-	    return ScmExp_begin(exps, &env);
+	    return ScmExp_begin(exps, &env, tail_flag);
 	}
     }
 
     return SCM_UNSPECIFIED;
 }
 
-ScmObj ScmExp_case(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_case(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env    = *envp;
     ScmObj key    = ScmOp_eval(SCM_CAR(arg), env);
@@ -903,12 +908,12 @@
 
 	/* check "else" symbol */
 	if (SCM_NULLP(SCM_CDR(arg)) && !SCM_CONSP(datums) && EQ(SCM_SYMBOL_VCELL(datums), SCM_TRUE))
-	    return ScmExp_begin(exps, &env);
+	    return ScmExp_begin(exps, &env, tail_flag);
 
 	/* evaluate datums and compare to key by eqv? */
 	for (; !SCM_NULLP(datums); datums = SCM_CDR(datums)) {
 	    if (EQ(ScmOp_eqvp(ScmOp_eval(SCM_CAR(datums), env), key), SCM_TRUE)) {
-		return ScmExp_begin(exps, &env);;
+		return ScmExp_begin(exps, &env, tail_flag);
 	    }
 	}
     }
@@ -916,11 +921,10 @@
     return SCM_UNSPECIFIED;
 }
 
-ScmObj ScmExp_and(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_and(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env = *envp;
     ScmObj obj = SCM_NIL;
-    ScmObj ret = SCM_NIL;
 
     /* sanity check */
     if (SCM_NULLP(arg))
@@ -931,24 +935,32 @@
     /* check recursively */
     for (; !SCM_NULLP(arg); arg = SCM_CDR(arg)) {
 	obj = SCM_CAR(arg);
-	ret = ScmOp_eval(obj, env);
-	if (EQ(ret, SCM_FALSE))
-	    return SCM_FALSE;
 
 	/* return last item */
 	if (SCM_NULLP(SCM_CDR(arg))) {
-	    return ret;
+	    /* set tail_flag */
+	    (*tail_flag) = 1;
+
+	    return obj;
 	}
+
+	/* evaluate obj */
+	obj = ScmOp_eval(obj, env);
+	if (EQ(obj, SCM_FALSE)) {
+	    /* set tail_flag */
+	    (*tail_flag) = 0;
+
+	    return SCM_FALSE;
+	}
     }
 
     return SCM_NIL;
 }
 
-ScmObj ScmExp_or(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_or(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env = *envp;
     ScmObj obj = SCM_NIL;
-    ScmObj ret = SCM_NIL;
 
     /* sanity check */
     if (SCM_NULLP(arg))
@@ -959,14 +971,23 @@
     /* check recursively */
     for (; !SCM_NULLP(arg); arg = SCM_CDR(arg)) {
 	obj = SCM_CAR(arg);
-	ret = ScmOp_eval(obj, env);
-	if (!EQ(ret, SCM_FALSE))
-	    return ret;
 
 	/* return last item */
 	if (SCM_NULLP(SCM_CDR(arg))) {
-	    return ret;
+	    /* set tail_flag */
+	    (*tail_flag) = 1;
+
+	    return obj;
 	}
+
+	obj = ScmOp_eval(obj, env);
+	if (!EQ(obj, SCM_FALSE)) {
+	    /* set tail_flag */
+	    (*tail_flag) = 0;
+
+	    return obj;
+	}
+
     }
 
     return SCM_NIL;
@@ -975,7 +996,7 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.2 Binding constructs
 ===========================================================================*/
-ScmObj ScmExp_let(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_let(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env      = *envp;
     ScmObj bindings = SCM_NIL;
@@ -1013,7 +1034,7 @@
 	env = extend_environment(vars, vals, env);
 	*envp = env;
 
-	return ScmExp_begin(body, &env);
+	return ScmExp_begin(body, &env, tail_flag);
     }
 
 named_let:
@@ -1038,13 +1059,16 @@
     ScmExp_define(Scm_NewCons(Scm_NewCons(SCM_CAR(arg),
 					  vars),
 			      body),
-		  &env);
+		  &env, tail_flag);
 
+    /* set tail_flag */
+    (*tail_flag) = 1;
+
     /* (func <init1> <init2> ...) */
     return Scm_NewCons(SCM_CAR(arg), vals);
 }
 
-ScmObj ScmExp_let_star(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_let_star(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env      = *envp;
     ScmObj bindings = SCM_NIL;
@@ -1080,13 +1104,16 @@
 	/* set new env */
 	*envp = env;
 	
-	return ScmExp_begin(body, &env);;
+	return ScmExp_begin(body, &env, tail_flag);
     }
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     return SCM_UNDEF;
 }
 
-ScmObj ScmExp_letrec(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_letrec(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env       = *envp;
     ScmObj bindings  = SCM_NIL;
@@ -1142,9 +1169,12 @@
 	}
 	
 	/* evaluate body */
-	return ScmExp_begin(body, &env);
+	return ScmExp_begin(body, &env, tail_flag);
     }
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     SigScm_Error("letrec : syntax error\n");
     return SCM_UNDEF;
 }
@@ -1153,11 +1183,14 @@
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.3 Sequencing
 ===========================================================================*/
-ScmObj ScmExp_begin(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_begin(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env = *envp;
     ScmObj exp = SCM_NIL;
 
+    /* set tail_flag */
+    (*tail_flag) = 1;
+
     /* sanity check */
     if (SCM_NULLP(arg))
 	return SCM_UNDEF;
@@ -1179,13 +1212,16 @@
 	ScmOp_eval(exp, env);
     }
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     return SCM_UNDEF;
 }
 
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.4 Iteration
 ===========================================================================*/
-ScmObj ScmExp_do(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_do(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     /*
      * (do ((<variable1> <init1> <step1>)
@@ -1241,7 +1277,7 @@
     /* now excution phase! */
     while (SCM_EQ(ScmOp_eval(test, env), SCM_FALSE)) {
 	/* execute commands */
-	ScmOp_eval(ScmExp_begin(commands, &env), env);
+	ScmOp_eval(ScmExp_begin(commands, &env, tail_flag), env);
 
 	/*
 	 * Notice
@@ -1270,16 +1306,19 @@
     /* set new env */
     *envp = env;
 
-    return ScmExp_begin(expression, &env);
+    return ScmExp_begin(expression, &env, tail_flag);
 }
 
 /*===========================================================================
   R5RS : 4.2 Derived expression types : 4.2.5 Delayed evaluation
 ===========================================================================*/
-ScmObj ScmOp_delay(ScmObj arg, ScmObj *envp)
+ScmObj ScmOp_delay(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env = *envp;
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     if (SCM_INT_VALUE(ScmOp_length(arg)) != 1)
         SigScm_Error("delay : Wrong number of arguments\n");
 
@@ -1309,7 +1348,7 @@
 /*=======================================
   R5RS : 5.2 Definitions
 =======================================*/
-ScmObj ScmExp_define(ScmObj arg, ScmObj *envp)
+ScmObj ScmExp_define(ScmObj arg, ScmObj *envp, int *tail_flag)
 {
     ScmObj env     = *envp;
     ScmObj var     = SCM_CAR(arg);
@@ -1317,6 +1356,9 @@
     ScmObj val     = SCM_NIL;
     ScmObj formals = SCM_NIL;
 
+    /* set tail_flag */
+    (*tail_flag) = 0;
+
     /* sanity check */
     if (SCM_NULLP(var))
 	SigScm_ErrorObj("define : syntax error ", arg);
@@ -1365,10 +1407,10 @@
 	body    = SCM_CDR(arg);
 
 	/* (val (lambda formals body))  */
-	arg = Scm_NewCons(val, Scm_NewCons(ScmExp_lambda(Scm_NewCons(formals, body), &env),
+	arg = Scm_NewCons(val, Scm_NewCons(ScmExp_lambda(Scm_NewCons(formals, body), &env, tail_flag),
 					   SCM_NIL));
 
-	return ScmExp_define(arg, &env);
+	return ScmExp_define(arg, &env, tail_flag);
     }
 
     SigScm_ErrorObj("define : syntax error ", arg);

Modified: branches/r5rs/sigscheme/sigscheme.c
===================================================================
--- branches/r5rs/sigscheme/sigscheme.c	2005-08-10 21:49:22 UTC (rev 1183)
+++ branches/r5rs/sigscheme/sigscheme.c	2005-08-11 16:11:11 UTC (rev 1184)
@@ -110,20 +110,20 @@
     /* eval.c */
     Scm_InitSubr2("eval"                 , ScmOp_eval);
     Scm_InitSubrL("apply"                , ScmOp_apply);
-    Scm_InitSubrR_NotEval("lambda"       , ScmExp_lambda);
-    Scm_InitSubrR_Eval   ("if"           , ScmExp_if);
-    Scm_InitSubrR_NotEval("set!"         , ScmExp_set);
-    Scm_InitSubrR_Eval   ("cond"         , ScmExp_cond);
-    Scm_InitSubrR_Eval   ("case"         , ScmExp_case);
-    Scm_InitSubrR_NotEval("and"          , ScmExp_and);
-    Scm_InitSubrR_NotEval("or"           , ScmExp_or);
-    Scm_InitSubrR_Eval   ("let"          , ScmExp_let);
-    Scm_InitSubrR_Eval   ("let*"         , ScmExp_let_star);
-    Scm_InitSubrR_Eval   ("letrec"       , ScmExp_letrec);
-    Scm_InitSubrR_Eval   ("begin"        , ScmExp_begin);
-    Scm_InitSubrR_Eval   ("do"           , ScmExp_do);
-    Scm_InitSubrR_NotEval("delay"        , ScmOp_delay);
-    Scm_InitSubrR_NotEval("define"       , ScmExp_define);
+    Scm_InitSubrR("lambda"               , ScmExp_lambda);
+    Scm_InitSubrR("if"                   , ScmExp_if);
+    Scm_InitSubrR("set!"                 , ScmExp_set);
+    Scm_InitSubrR("cond"                 , ScmExp_cond);
+    Scm_InitSubrR("case"                 , ScmExp_case);
+    Scm_InitSubrR("and"                  , ScmExp_and);
+    Scm_InitSubrR("or"                   , ScmExp_or);
+    Scm_InitSubrR("let"                  , ScmExp_let);
+    Scm_InitSubrR("let*"                 , ScmExp_let_star);
+    Scm_InitSubrR("letrec"               , ScmExp_letrec);
+    Scm_InitSubrR("begin"                , ScmExp_begin);
+    Scm_InitSubrR("do"                   , ScmExp_do);
+    Scm_InitSubrR("delay"                , ScmOp_delay);
+    Scm_InitSubrR("define"               , ScmExp_define);
     Scm_InitSubr1("scheme-report-environment", ScmOp_scheme_report_environment);
     Scm_InitSubr1("null-environment"         , ScmOp_null_environment);
     /* operations.c */
@@ -342,16 +342,11 @@
     Scm_InitSubr(name, ARGNUM_L, (ScmFuncType)func);
 }
 
-void Scm_InitSubrR_NotEval(const char *name, ScmObj (*func) (ScmObj, ScmObj*))
+void Scm_InitSubrR(const char *name, ScmObj (*func) (ScmObj, ScmObj*, int *))
 {
-    Scm_InitSubr(name, ARGNUM_R_NotEval, (ScmFuncType)func);
+    Scm_InitSubr(name, ARGNUM_R, (ScmFuncType)func);
 }
 
-void Scm_InitSubrR_Eval(const char *name, ScmObj (*func) (ScmObj, ScmObj*))
-{
-    Scm_InitSubr(name, ARGNUM_R_Eval, (ScmFuncType)func);
-}
-
 void Scm_InitSubr2N(const char *name, ScmObj (*func) (ScmObj, ScmObj))
 {
     Scm_InitSubr(name, ARGNUM_2N, (ScmFuncType)func);

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-08-10 21:49:22 UTC (rev 1183)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-08-11 16:11:11 UTC (rev 1184)
@@ -108,9 +108,8 @@
 void Scm_InitSubr4(const char *name, ScmObj (*func) (ScmObj, ScmObj, ScmObj, ScmObj));
 void Scm_InitSubr5(const char *name, ScmObj (*func) (ScmObj, ScmObj, ScmObj, ScmObj, ScmObj));
 void Scm_InitSubrL(const char *name, ScmObj (*func) (ScmObj, ScmObj env));
-void Scm_InitSubrR_NotEval(const char *name, ScmObj (*func) (ScmObj, ScmObj *envp));
-void Scm_InitSubrR_Eval(const char *name, ScmObj (*func) (ScmObj, ScmObj *envp));
 void Scm_InitSubr2N(const char *name, ScmObj (*func) (ScmObj, ScmObj));
+void Scm_InitSubrR(const char *name, ScmObj (*func) (ScmObj, ScmObj *envp, int *tail_flag));
 
 /* datas.c */
 void   SigScm_InitStorage(void);
@@ -144,23 +143,23 @@
 ScmObj ScmOp_eval(ScmObj obj, ScmObj env);
 ScmObj ScmOp_apply(ScmObj arg, ScmObj env);
 ScmObj ScmOp_quote(ScmObj obj);
-ScmObj ScmExp_lambda(ScmObj exp, ScmObj *envp);
-ScmObj ScmExp_if(ScmObj exp, ScmObj *envp);
-ScmObj ScmExp_set(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_cond(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_case(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_and(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_or(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_let(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_let_star(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_letrec(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_begin(ScmObj arg, ScmObj *envp);
-ScmObj ScmExp_do(ScmObj arg, ScmObj *envp);
-ScmObj ScmOp_delay(ScmObj arg, ScmObj *envp);
+ScmObj ScmExp_lambda(ScmObj exp, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_if(ScmObj exp, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_set(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_cond(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_case(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_and(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_or(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_let(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_let_star(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_letrec(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_begin(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmExp_do(ScmObj arg, ScmObj *envp, int *tail_flag);
+ScmObj ScmOp_delay(ScmObj arg, ScmObj *envp, int *tail_flag);
 ScmObj ScmOp_quasiquote(ScmObj temp);
 ScmObj ScmOp_unquote(ScmObj exp);
 ScmObj ScmOp_unquote_splicint(ScmObj exp);
-ScmObj ScmExp_define(ScmObj arg, ScmObj *envp);
+ScmObj ScmExp_define(ScmObj arg, ScmObj *envp, int *tail_flag);
 ScmObj ScmOp_scheme_report_environment(ScmObj version);
 ScmObj ScmOp_null_environment(ScmObj version);
 

Modified: branches/r5rs/sigscheme/sigschemetype.h
===================================================================
--- branches/r5rs/sigscheme/sigschemetype.h	2005-08-10 21:49:22 UTC (rev 1183)
+++ branches/r5rs/sigscheme/sigschemetype.h	2005-08-11 16:11:11 UTC (rev 1184)
@@ -75,8 +75,7 @@
     ARGNUM_4         = 4, /* require 4 args */
     ARGNUM_5         = 5, /* require 5 args */
     ARGNUM_L         = 6, /* all args are already evaluated, and pass the arg-list to the func*/
-    ARGNUM_R_NotEval = 7, /* all args are "not" evaluated yet, and return obj is not evaluated */
-    ARGNUM_R_Eval    = 8, /* all args are "not" evaluated yet, and return obj is evaluated */
+    ARGNUM_R         = 7, /* all args are "not" evaluated */
     ARGNUM_2N        = 9  /* all args are evaluated with each 2 objs */
 };
 
@@ -177,8 +176,8 @@
                 } subr5;
                 
                 struct {
-                    ScmObj (*func) (ScmObj, ScmObj*);
-                } subrm;
+                    ScmObj (*func) (ScmObj, ScmObj*, int*);
+                } subrr;
                 
             } subrs;
 
@@ -282,7 +281,7 @@
 #define SCM_FUNC_EXEC_SUBR4(a, arg1, arg2, arg3, arg4)       ((*(a)->obj.func.subrs.subr4.func) ((arg1), (arg2), (arg3), (arg4)))
 #define SCM_FUNC_EXEC_SUBR5(a, arg1, arg2, arg3, arg4, arg5) ((*(a)->obj.func.subrs.subr5.func) ((arg1), (arg2), (arg3), (arg4), (arg5)))
 #define SCM_FUNC_EXEC_SUBRL(a, arg1, arg2)                   ((*(a)->obj.func.subrs.subr2.func) ((arg1), (arg2)))
-#define SCM_FUNC_EXEC_SUBRR(a, arg1, arg2)                   ((*(a)->obj.func.subrs.subrm.func) ((arg1), (arg2)))
+#define SCM_FUNC_EXEC_SUBRR(a, arg1, arg2, arg3)             ((*(a)->obj.func.subrs.subrr.func) ((arg1), (arg2), (arg3)))
 #define SCM_FUNC_EXEC_SUBR2N(a, arg1, arg2)                  ((*(a)->obj.func.subrs.subr2.func) ((arg1), (arg2)))
 
 #define SCM_CLOSUREP(a) (SCM_GETTYPE(a) == ScmClosure)



More information about the uim-commit mailing list