[armedbear-cvs] r12460 - trunk/abcl/src/org/armedbear/lisp

Ville Voutilainen vvoutilainen at common-lisp.net
Sat Feb 13 19:20:51 UTC 2010


Author: vvoutilainen
Date: Sat Feb 13 14:20:48 2010
New Revision: 12460

Log:
Reindentation.


Modified:
   trunk/abcl/src/org/armedbear/lisp/Do.java

Modified: trunk/abcl/src/org/armedbear/lisp/Do.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Do.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/Do.java	Sat Feb 13 14:20:48 2010
@@ -35,180 +35,156 @@
 
 import static org.armedbear.lisp.Lisp.*;
 
-public final class Do
-{
-  // ### do
-  private static final SpecialOperator DO = new sf_do();
-  private static final class sf_do extends SpecialOperator {
-      sf_do()
-      {
-        super(Symbol.DO, "varlist endlist &body body");
-      }
-	
-      @Override
-      public LispObject execute(LispObject args, Environment env)
-
-      {
-        return _do(args, env, false);
-      }
+public final class Do {
+    // ### do
+    private static final SpecialOperator DO = new sf_do();
+    private static final class sf_do extends SpecialOperator {
+        sf_do() {
+            super(Symbol.DO, "varlist endlist &body body");
+        }
+
+        @Override
+        public LispObject execute(LispObject args, Environment env)
+
+        {
+            return _do(args, env, false);
+        }
     };
 
-  // ### do*
-  private static final SpecialOperator DO_STAR = new sf_do_star();
-  private static final class sf_do_star extends SpecialOperator {
-      sf_do_star()
-      {
-        super(Symbol.DO_STAR, "varlist endlist &body body");
-      }
-	
-      @Override
-      public LispObject execute(LispObject args, Environment env)
-
-      {
-        return _do(args, env, true);
-      }
+    // ### do*
+    private static final SpecialOperator DO_STAR = new sf_do_star();
+    private static final class sf_do_star extends SpecialOperator {
+        sf_do_star() {
+            super(Symbol.DO_STAR, "varlist endlist &body body");
+        }
+
+        @Override
+        public LispObject execute(LispObject args, Environment env)
+
+        {
+            return _do(args, env, true);
+        }
     };
 
-  private static final LispObject _do(LispObject args, Environment env,
-                                      boolean sequential)
+    private static final LispObject _do(LispObject args, Environment env,
+                                        boolean sequential)
 
-  {
-    LispObject varlist = args.car();
-    LispObject second = args.cadr();
-    LispObject end_test_form = second.car();
-    LispObject result_forms = second.cdr();
-    LispObject body = args.cddr();
-    // Process variable specifications.
-    final int numvars = varlist.length();
-    Symbol[] vars = new Symbol[numvars];
-    LispObject[] initforms = new LispObject[numvars];
-    LispObject[] stepforms = new LispObject[numvars];
-    for (int i = 0; i < numvars; i++)
-      {
-        final LispObject varspec = varlist.car();
-        if (varspec instanceof Cons)
-          {
-            vars[i] = checkSymbol(varspec.car());
-            initforms[i] = varspec.cadr();
-            // Is there a step form?
-            if (varspec.cddr() != NIL)
-              stepforms[i] = varspec.caddr();
-          }
-        else
-          {
-            // Not a cons, must be a symbol.
-            vars[i] = checkSymbol(varspec);
-            initforms[i] = NIL;
-          }
-        varlist = varlist.cdr();
-      }
-    final LispThread thread = LispThread.currentThread();
-    final SpecialBindingsMark mark = thread.markSpecialBindings();
-    // Process declarations.
-
-    final LispObject bodyAndDecls = parseBody(body, false);
-    LispObject specials = parseSpecials(bodyAndDecls.NTH(1));
-    body = bodyAndDecls.car();
-
-    Environment ext = new Environment(env);
-    for (int i = 0; i < numvars; i++)
-      {
-        Symbol var = vars[i];
-        LispObject value = eval(initforms[i], (sequential ? ext : env), thread);
-	ext = new Environment(ext);
-        if (specials != NIL && memq(var, specials))
-            thread.bindSpecial(var, value);
-        else if (var.isSpecialVariable())
-          thread.bindSpecial(var, value);
-        else
-          ext.bind(var, value);
-      }
-    LispObject list = specials;
-    while (list != NIL)
-      {
-        ext.declareSpecial(checkSymbol(list.car()));
-        list = list.cdr();
-      }
-    // Look for tags.
-    LispObject localTags = preprocessTagBody(body, ext);
-    LispObject blockId = new LispObject();
-    try
-      {
-        // Implicit block.
-        ext.addBlock(NIL, blockId);
-        while (true)
-          {
-            // Execute body.
-            // Test for termination.
-            if (eval(end_test_form, ext, thread) != NIL)
-              break;
-
-            processTagBody(body, localTags, ext);
-
-            // Update variables.
-            if (sequential)
-              {
-                for (int i = 0; i < numvars; i++)
-                  {
-                    LispObject step = stepforms[i];
-                    if (step != null)
-                      {
-                        Symbol symbol = vars[i];
-                        LispObject value = eval(step, ext, thread);
-                        if (symbol.isSpecialVariable()
-                            || ext.isDeclaredSpecial(symbol))
-                          thread.rebindSpecial(symbol, value);
-                        else
-                          ext.rebind(symbol, value);
-                      }
-                  }
-              }
+    {
+        LispObject varlist = args.car();
+        LispObject second = args.cadr();
+        LispObject end_test_form = second.car();
+        LispObject result_forms = second.cdr();
+        LispObject body = args.cddr();
+        // Process variable specifications.
+        final int numvars = varlist.length();
+        Symbol[] vars = new Symbol[numvars];
+        LispObject[] initforms = new LispObject[numvars];
+        LispObject[] stepforms = new LispObject[numvars];
+        for (int i = 0; i < numvars; i++) {
+            final LispObject varspec = varlist.car();
+            if (varspec instanceof Cons) {
+                vars[i] = checkSymbol(varspec.car());
+                initforms[i] = varspec.cadr();
+                // Is there a step form?
+                if (varspec.cddr() != NIL)
+                    stepforms[i] = varspec.caddr();
+            } else {
+                // Not a cons, must be a symbol.
+                vars[i] = checkSymbol(varspec);
+                initforms[i] = NIL;
+            }
+            varlist = varlist.cdr();
+        }
+        final LispThread thread = LispThread.currentThread();
+        final SpecialBindingsMark mark = thread.markSpecialBindings();
+        // Process declarations.
+
+        final LispObject bodyAndDecls = parseBody(body, false);
+        LispObject specials = parseSpecials(bodyAndDecls.NTH(1));
+        body = bodyAndDecls.car();
+
+        Environment ext = new Environment(env);
+        for (int i = 0; i < numvars; i++) {
+            Symbol var = vars[i];
+            LispObject value = eval(initforms[i], (sequential ? ext : env), thread);
+            ext = new Environment(ext);
+            if (specials != NIL && memq(var, specials))
+                thread.bindSpecial(var, value);
+            else if (var.isSpecialVariable())
+                thread.bindSpecial(var, value);
             else
-              {
-                // Evaluate step forms.
-                LispObject results[] = new LispObject[numvars];
-                for (int i = 0; i < numvars; i++)
-                  {
-                    LispObject step = stepforms[i];
-                    if (step != null)
-                      {
-                        LispObject result = eval(step, ext, thread);
-                        results[i] = result;
-                      }
-                  }
+                ext.bind(var, value);
+        }
+        LispObject list = specials;
+        while (list != NIL) {
+            ext.declareSpecial(checkSymbol(list.car()));
+            list = list.cdr();
+        }
+        // Look for tags.
+        LispObject localTags = preprocessTagBody(body, ext);
+        LispObject blockId = new LispObject();
+        try {
+            // Implicit block.
+            ext.addBlock(NIL, blockId);
+            while (true) {
+                // Execute body.
+                // Test for termination.
+                if (eval(end_test_form, ext, thread) != NIL)
+                    break;
+
+                processTagBody(body, localTags, ext);
+
                 // Update variables.
-                for (int i = 0; i < numvars; i++)
-                  {
-                    if (results[i] != null)
-                      {
-                        Symbol symbol = vars[i];
-                        LispObject value = results[i];
-                        if (symbol.isSpecialVariable()
-                            || ext.isDeclaredSpecial(symbol))
-                          thread.rebindSpecial(symbol, value);
-                        else
-                          ext.rebind(symbol, value);
-                      }
-                  }
-              }
-            if (interrupted)
-              handleInterrupt();
-          }
-        LispObject result = progn(result_forms, ext, thread);
-        return result;
-      }
-    catch (Return ret)
-      {
-        if (ret.getBlock() == blockId)
-          {
-            return ret.getResult();
-          }
-        throw ret;
-      }
-    finally
-      {
-        thread.resetSpecialBindings(mark);
-        ext.inactive = true;
-      }
-  }
+                if (sequential) {
+                    for (int i = 0; i < numvars; i++) {
+                        LispObject step = stepforms[i];
+                        if (step != null) {
+                            Symbol symbol = vars[i];
+                            LispObject value = eval(step, ext, thread);
+                            if (symbol.isSpecialVariable()
+                                    || ext.isDeclaredSpecial(symbol))
+                                thread.rebindSpecial(symbol, value);
+                            else
+                                ext.rebind(symbol, value);
+                        }
+                    }
+                } else {
+                    // Evaluate step forms.
+                    LispObject results[] = new LispObject[numvars];
+                    for (int i = 0; i < numvars; i++) {
+                        LispObject step = stepforms[i];
+                        if (step != null) {
+                            LispObject result = eval(step, ext, thread);
+                            results[i] = result;
+                        }
+                    }
+                    // Update variables.
+                    for (int i = 0; i < numvars; i++) {
+                        if (results[i] != null) {
+                            Symbol symbol = vars[i];
+                            LispObject value = results[i];
+                            if (symbol.isSpecialVariable()
+                                    || ext.isDeclaredSpecial(symbol))
+                                thread.rebindSpecial(symbol, value);
+                            else
+                                ext.rebind(symbol, value);
+                        }
+                    }
+                }
+                if (interrupted)
+                    handleInterrupt();
+            }
+            LispObject result = progn(result_forms, ext, thread);
+            return result;
+        } catch (Return ret) {
+            if (ret.getBlock() == blockId) {
+                return ret.getResult();
+            }
+            throw ret;
+        }
+        finally {
+            thread.resetSpecialBindings(mark);
+            ext.inactive = true;
+        }
+    }
 }




More information about the armedbear-cvs mailing list