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

kzk at freedesktop.org kzk at freedesktop.org
Fri Sep 30 21:42:47 PDT 2005


Author: kzk
Date: 2005-09-30 21:42:45 -0700 (Fri, 30 Sep 2005)
New Revision: 1721

Modified:
   branches/r5rs/sigscheme/error.c
   branches/r5rs/sigscheme/eval.c
   branches/r5rs/sigscheme/operations-siod.c
   branches/r5rs/sigscheme/operations-srfi2.c
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* renaming of enviroment related function

* sigscheme/sigschemeinternal.h
* sigscheme/error.c
* sigscheme/operations-srfi2.c
* sigscheme/operations-siod.c
* sigscheme/eval.c
  - (Scm_ExtendEnvironment): renamed from extend_environment
  - (Scm_AddEnvironment): renamed from add_environment
  - (Scm_LookupEnvironment): renamed from lookup_environment
  - (Scm_LookupFrame): renamed from lookup_frame
  - (Scm_SymbolValue): renamed from symbol_value



Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c	2005-10-01 00:37:13 UTC (rev 1720)
+++ branches/r5rs/sigscheme/error.c	2005-10-01 04:42:45 UTC (rev 1721)
@@ -143,9 +143,9 @@
 
 void SigScm_ShowBacktrace(void)
 {
-#define UNBOUNDP(var, env)                                                   \
-        (NULLP(lookup_environment(var, env))                                 \
-         && !SCM_SYMBOL_BOUNDP(var))
+#define UNBOUNDP(var, env)                                              \
+    (NULLP(Scm_LookupEnvironment(var, env))                             \
+     && !SCM_SYMBOL_BOUNDP(var))
 
 #if SCM_DEBUG
     struct trace_frame *f;
@@ -173,7 +173,7 @@
             if (UNBOUNDP(obj, env))
                 break;
             SigScm_ErrorPrintf("  - [%s]: ", SCM_SYMBOL_NAME(obj));
-            SigScm_WriteToPort(scm_current_error_port, symbol_value(obj, env));
+            SigScm_WriteToPort(scm_current_error_port, Scm_SymbolValue(obj, env));
             SigScm_ErrorNewline();
             break;
 
@@ -185,14 +185,14 @@
                         break;
                     SigScm_ErrorPrintf("  - [%s]: ", SCM_SYMBOL_NAME(proc));
                     SigScm_WriteToPort(scm_current_error_port,
-                                       symbol_value(proc, env));
+                                       Scm_SymbolValue(proc, env));
                     SigScm_ErrorNewline();
                 }
             }
             if (SYMBOLP(obj)) {
                 SigScm_ErrorPrintf("  - [%s]: ", SCM_SYMBOL_NAME(proc));
                 SigScm_WriteToPort(scm_current_error_port,
-                                   symbol_value(proc, env));
+                                   Scm_SymbolValue(proc, env));
                 SigScm_ErrorNewline();
             }
             break;

Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-10-01 00:37:13 UTC (rev 1720)
+++ branches/r5rs/sigscheme/eval.c	2005-10-01 04:42:45 UTC (rev 1721)
@@ -103,13 +103,13 @@
  *             list.
  * @see ScmOp_eval()
  */
-ScmObj extend_environment(ScmObj vars, ScmObj vals, ScmObj env)
+ScmObj Scm_ExtendEnvironment(ScmObj vars, ScmObj vals, ScmObj env)
 {
     ScmObj frame     = SCM_NULL;
     ScmObj rest_vars, rest_vals;
 
     if (!CONSP(env) && !NULLP(env))
-        SigScm_Error("extend_environment : broken environment");
+        SigScm_Error("Scm_ExtendEnvironment : broken environment");
 
     /* sanity check & dot list handling */
     for (rest_vars = vars, rest_vals = vals;
@@ -168,7 +168,7 @@
  *
  * @todo describe more precicely
  */
-ScmObj lookup_environment(ScmObj var, ScmObj env)
+ScmObj Scm_LookupEnvironment(ScmObj var, ScmObj env)
 {
     ScmObj frame = SCM_NULL;
     ScmObj val   = SCM_NULL;
@@ -182,7 +182,7 @@
     /* lookup in frames */
     for (; !NULLP(env); env = CDR(env)) {
         frame = CAR(env);
-        val   = lookup_frame(var, frame);
+        val   = Scm_LookupFrame(var, frame);
         if (!NULLP(val))
             return val;
     }
@@ -191,7 +191,7 @@
 }
 
 /** Lookup a variable of a frame */
-ScmObj lookup_frame(ScmObj var, ScmObj frame)
+ScmObj Scm_LookupFrame(ScmObj var, ScmObj frame)
 {
     ScmObj vals = SCM_NULL;
     ScmObj vars = SCM_NULL;
@@ -296,7 +296,7 @@
 
     if (SYMBOLP(formals)) {
         /* (1) : <variable> */
-        eval_state->env = extend_environment(LIST_1(formals),
+        eval_state->env = Scm_ExtendEnvironment(LIST_1(formals),
                                              LIST_1(args),
                                              SCM_CLOSURE_ENV(proc));
     } else if (CONSP(formals)) {
@@ -304,9 +304,9 @@
          * (2) : (<variable1> <variable2> ...)
          * (3) : (<variable1> <variable2> ... <variable n-1> . <variable n>)
          *
-         *  - dot list is handled in lookup_frame().
+         *  - dot list is handled in Scm_ExtendEnvironment().
          */
-        eval_state->env = extend_environment(formals,
+        eval_state->env = Scm_ExtendEnvironment(formals,
                                              args,
                                              SCM_CLOSURE_ENV(proc));
     } else if (NULLP(formals)) {
@@ -314,7 +314,7 @@
          * (2') : <variable> is '()
          */
         eval_state->env
-            = extend_environment(SCM_NULL,
+            = Scm_ExtendEnvironment(SCM_NULL,
                                  SCM_NULL,
                                  SCM_CLOSURE_ENV(proc));
     } else {
@@ -480,7 +480,7 @@
 #endif
     switch (SCM_TYPE(obj)) {
     case ScmSymbol:
-        ret = symbol_value(obj, state.env);
+        ret = Scm_SymbolValue(obj, state.env);
         break;
 
     case ScmCons:
@@ -538,12 +538,12 @@
 }
 
 /* 'var' must be a symbol as precondition */
-ScmObj symbol_value(ScmObj var, ScmObj env)
+ScmObj Scm_SymbolValue(ScmObj var, ScmObj env)
 {
     ScmObj val = SCM_FALSE;
 
     /* first, lookup the environment */
-    val = lookup_environment(var, env);
+    val = Scm_LookupEnvironment(var, env);
     if (!NULLP(val)) {
         /* variable is found in environment, so returns its value */
         return CAR(val);
@@ -552,7 +552,7 @@
     /* finally, look at the VCELL */
     val = SCM_SYMBOL_VCELL(var);
     if (EQ(val, SCM_UNBOUND))
-        SigScm_ErrorObj("symbol_value : unbound variable ", var);
+        SigScm_ErrorObj("Scm_SymbolValue : unbound variable ", var);
 
     return val;
 }
@@ -867,7 +867,7 @@
     ScmObj locally_bound = SCM_NULL;
 
     evaled = EVAL(exp, env);
-    locally_bound = lookup_environment(sym, env);
+    locally_bound = Scm_LookupEnvironment(sym, env);
     if (NULLP(locally_bound)) {
         if (!SYMBOLP(sym))
             SigScm_ErrorObj("set! : symbol required but got ", sym);
@@ -1116,11 +1116,11 @@
         SigScm_Error("let : invalid bindings form");
 
 #if 1
-    /* current implementation extend_environment() contains unnecessary
+    /* current implementation Scm_ExtendEnvironment() contains unnecessary
        error checking for let variants. So we extend manually */
     env = CONS(CONS(vars, vals), env);
 #else
-    env = extend_environment(vars, vals, env);
+    env = Scm_ExtendEnvironment(vars, vals, env);
 #endif
     eval_state->env = env;
 
@@ -1166,12 +1166,12 @@
 
         /* extend env for each variable */
 #if 1
-        /* current implementation extend_environment() contains unnecessary
+        /* current implementation Scm_ExtendEnvironment() contains unnecessary
            error checking for let variants. So we extend manually */
         env = CONS(CONS(LIST_1(var), LIST_1(val)),
                    env);
 #else
-        env = extend_environment(LIST_1(var), LIST_1(val), env);
+        env = Scm_ExtendEnvironment(LIST_1(var), LIST_1(val), env);
 #endif
     }
 
@@ -1293,7 +1293,7 @@
     }
 
     /* now extend environment */
-    env = extend_environment(vars, vals, env);
+    env = Scm_ExtendEnvironment(vars, vals, env);
 
     /* construct test */
     test       = CAR(testframe);
@@ -1325,7 +1325,7 @@
              !NULLP(tmp_vars) && !NULLP(vals);
              tmp_vars = CDR(tmp_vars), vals = CDR(vals))
         {
-            obj = lookup_environment(CAR(tmp_vars), env);
+            obj = Scm_LookupEnvironment(CAR(tmp_vars), env);
             if (!NULLP(obj)) {
                 SET_CAR(obj, CAR(vals));
             } else {

Modified: branches/r5rs/sigscheme/operations-siod.c
===================================================================
--- branches/r5rs/sigscheme/operations-siod.c	2005-10-01 00:37:13 UTC (rev 1720)
+++ branches/r5rs/sigscheme/operations-siod.c	2005-10-01 04:42:45 UTC (rev 1721)
@@ -104,7 +104,7 @@
     /* SIOD compatible implementation */
     return (SCM_SYMBOL_BOUNDP(obj)) ? SCM_TRUE : SCM_FALSE;
 #else
-    return (!NULLP(lookup_environment(obj, env))
+    return (!NULLP(Scm_LookupEnvironment(obj, env))
             || SCM_SYMBOL_BOUNDP(obj)) ? SCM_TRUE : SCM_FALSE;
 #endif
 }
@@ -120,7 +120,7 @@
     if (!SYMBOLP(var))
         SigScm_ErrorObj("symbol-value : symbol required but got ", var);
 
-    return symbol_value(var, SCM_NULL);
+    return Scm_SymbolValue(var, SCM_NULL);
 }
 
 /*

Modified: branches/r5rs/sigscheme/operations-srfi2.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi2.c	2005-10-01 00:37:13 UTC (rev 1720)
+++ branches/r5rs/sigscheme/operations-srfi2.c	2005-10-01 04:42:45 UTC (rev 1721)
@@ -85,7 +85,7 @@
                     if (!NULLP(SCM_SHIFT_RAW_2(var, exp, claw)))
                         goto err;
                     val = EVAL(exp, env);
-                    env = extend_environment(LIST_1(var), LIST_1(val), env);
+                    env = Scm_ExtendEnvironment(LIST_1(var), LIST_1(val), env);
                 } else if (NULLP(CDR(claw))) {
                     /* (<expression>) */
                     exp = CAR(claw);
@@ -103,7 +103,7 @@
                 return SCM_FALSE;
         }
     } else if (NULLP(claws)) {
-        env = extend_environment(SCM_NULL, SCM_NULL, env);
+        env = Scm_ExtendEnvironment(SCM_NULL, SCM_NULL, env);
     } else {
         goto err;
     }

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2005-10-01 00:37:13 UTC (rev 1720)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2005-10-01 04:42:45 UTC (rev 1721)
@@ -349,11 +349,11 @@
  * FIXME: add a 'SCM' prefix to these functions since the symbols will be
  * global. See objdump -TC libsscm.so.
  */
-ScmObj extend_environment(ScmObj vars, ScmObj vals, ScmObj env);
-ScmObj add_environment(ScmObj var, ScmObj val, ScmObj env);
-ScmObj lookup_environment(ScmObj var, ScmObj env);
-ScmObj lookup_frame(ScmObj var, ScmObj frame);
-ScmObj symbol_value(ScmObj var, ScmObj env);
+ScmObj Scm_ExtendEnvironment(ScmObj vars, ScmObj vals, ScmObj env);
+ScmObj Scm_AddEnvironment(ScmObj var, ScmObj val, ScmObj env);
+ScmObj Scm_LookupEnvironment(ScmObj var, ScmObj env);
+ScmObj Scm_LookupFrame(ScmObj var, ScmObj frame);
+ScmObj Scm_SymbolValue(ScmObj var, ScmObj env);
 
 /* error.c */
 void SigScm_ShowErrorHeader(void);



More information about the uim-commit mailing list