public static Stella_Object evaluateLogicCommand(Stella_Object command, boolean finalizeP) {
    { Object old$Translationerrors$000 = Stella.$TRANSLATIONERRORS$.get();
      Object old$Translationwarnings$000 = Stella.$TRANSLATIONWARNINGS$.get();
      Object old$IgnoretranslationerrorsP$000 = Stella.$IGNORETRANSLATIONERRORSp$.get();
      Object old$Translationunits$000 = Stella.$TRANSLATIONUNITS$.get();
      Object old$Translationphase$000 = Stella.$TRANSLATIONPHASE$.get();
      Object old$Evaluationtree$000 = Stella.$EVALUATIONTREE$.get();

      try {
        Native.setIntSpecial(Stella.$TRANSLATIONERRORS$, 0);
        Native.setIntSpecial(Stella.$TRANSLATIONWARNINGS$, 0);
        Native.setBooleanSpecial(Stella.$IGNORETRANSLATIONERRORSp$, false);
        Native.setSpecial(Stella.$TRANSLATIONUNITS$, null);
        Native.setSpecial(Stella.$TRANSLATIONPHASE$, Logic.KWD_DEFINE);
        Native.setSpecial(Stella.$EVALUATIONTREE$, null);
        { Stella_Object operator = null;
          String operatorname = null;
          Stella_Object result = null;

          { Surrogate testValue000 = Stella_Object.safePrimaryType(command);

            if (testValue000 == Logic.SGT_STELLA_CONS) {
              { Cons command000 = ((Cons)(command));

                operator = command000.value;
                if (Surrogate.subtypeOfSymbolP(Stella_Object.safePrimaryType(operator))) {
                  { Symbol operator000 = ((Symbol)(operator));

                    operatorname = operator000.symbolName;
                    if (Stella.stringEqualP(operatorname, "DEFMODULE")) {
                      operator000 = Logic.SYM_STELLA_DEFMODULE;
                      command000.value = operator000;
                    }
                    if (Stella.stringEqualP(operatorname, "IN-MODULE")) {
                      Cons.handleInModuleTree(command000, false, false, new Object[1]);
                    }
                    else if (Stella.stringEqualP(operatorname, "IN-PACKAGE")) {
                    }
                    else if (Cons.declarationTreeP(command000)) {
                      Native.setSpecial(Stella.$TRANSLATIONUNITS$, List.list(Stella.NIL));
                      Cons.walkTopLevelTree(command000, false);
                      switch (((List)(Stella.$TRANSLATIONUNITS$.get())).reverse().length()) {
                        case 0: 
                          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                            stream000.nativeStream.print("Translation failed: `" + command000 + "'");
                            throw ((EvaluationException)(EvaluationException.newEvaluationException(stream000.theStringReader()).fillInStackTrace()));
                          }
                        case 1: 
                          result = ((TranslationUnit)(((List)(Stella.$TRANSLATIONUNITS$.get())).first())).theObject;
                        break;
                        default:
                          { Cons results = Stella.NIL;

                            { TranslationUnit unit = null;
                              Cons iter000 = ((List)(Stella.$TRANSLATIONUNITS$.get())).theConsList;
                              Cons collect000 = null;

                              for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                                unit = ((TranslationUnit)(iter000.value));
                                if (collect000 == null) {
                                  {
                                    collect000 = Cons.cons(unit.theObject, Stella.NIL);
                                    if (results == Stella.NIL) {
                                      results = collect000;
                                    }
                                    else {
                                      Cons.addConsToEndOfConsList(results, collect000);
                                    }
                                  }
                                }
                                else {
                                  {
                                    collect000.rest = Cons.cons(unit.theObject, Stella.NIL);
                                    collect000 = collect000.rest;
                                  }
                                }
                              }
                            }
                            result = results;
                          }
                        break;
                      }
                    }
                    else {
                      synchronized (Logic.$POWERLOOM_LOCK$) {
                        result = Stella_Object.evaluate(command000);
                      }
                    }
                  }
                }
                else {
                  synchronized (Logic.$POWERLOOM_LOCK$) {
                    result = Stella_Object.evaluate(command000);
                  }
                }
              }
            }
            else if (Surrogate.subtypeOfKeywordP(testValue000)) {
              { Keyword command000 = ((Keyword)(command));

                result = command000;
              }
            }
            else if (Surrogate.subtypeOfSurrogateP(testValue000)) {
              { Surrogate command000 = ((Surrogate)(command));

                result = command000;
              }
            }
            else {
              synchronized (Logic.$POWERLOOM_LOCK$) {
                result = Stella_Object.evaluate(command);
              }
            }
          }
          if ((!Stella.translationErrorsP()) &&
              finalizeP) {
            Native.setSpecial(Stella.$TRANSLATIONPHASE$, Logic.KWD_FINALIZE);
            Logic.finalizeObjects();
          }
          return (result);
        }

      } finally {
        Stella.$EVALUATIONTREE$.set(old$Evaluationtree$000);
        Stella.$TRANSLATIONPHASE$.set(old$Translationphase$000);
        Stella.$TRANSLATIONUNITS$.set(old$Translationunits$000);
        Stella.$IGNORETRANSLATIONERRORSp$.set(old$IgnoretranslationerrorsP$000);
        Stella.$TRANSLATIONWARNINGS$.set(old$Translationwarnings$000);
        Stella.$TRANSLATIONERRORS$.set(old$Translationerrors$000);
      }
    }
  }