* @param defaultModule
   */
  public static void loadStreamInModule(InputStream stream, Module defaultModule) {
    { Keyword currentdialect = ((Keyword)(Logic.$LOGIC_DIALECT$.get()));
      boolean skipcommandP = false;
      boolean seeninmoduleP = defaultModule != null;
      Cons commands = Stella.NIL;
      Module loadModule = (seeninmoduleP ? defaultModule : ((Module)(Stella.$MODULE$.get())));

      { Object old$LogicDialect$000 = Logic.$LOGIC_DIALECT$.get();
        Object old$Translationerrors$000 = Stella.$TRANSLATIONERRORS$.get();
        Object old$Translationwarnings$000 = Stella.$TRANSLATIONWARNINGS$.get();
        Object old$Translationnotes$000 = Stella.$TRANSLATIONNOTES$.get();

        try {
          Native.setSpecial(Logic.$LOGIC_DIALECT$, currentdialect);
          Native.setIntSpecial(Stella.$TRANSLATIONERRORS$, 0);
          Native.setIntSpecial(Stella.$TRANSLATIONWARNINGS$, 0);
          Native.setIntSpecial(Stella.$TRANSLATIONNOTES$, 0);
          { Object old$Module$000 = Stella.$MODULE$.get();
            Object old$Context$000 = Stella.$CONTEXT$.get();

            try {
              Native.setSpecial(Stella.$MODULE$, loadModule);
              Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
              { Stella_Object tree = null;
                SExpressionIterator iter000 = InputStream.sExpressions(stream);

                loop000 : while (iter000.nextP()) {
                  tree = iter000.value;
                  if (Stella_Object.safePrimaryType(tree) == Logic.SGT_STELLA_CONS) {
                    { Cons tree000 = ((Cons)(tree));

                      { Object [] caller_MV_returnarray = new Object[1];

                        skipcommandP = Cons.handleInModuleTree(tree000, seeninmoduleP, false, caller_MV_returnarray);
                        seeninmoduleP = ((boolean)(((BooleanWrapper)(caller_MV_returnarray[0])).wrapperValue));
                      }
                      if (skipcommandP) {
                        continue loop000;
                      }
                      { Stella_Object operator = tree000.value;

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

                            if ((operator000 == Logic.SYM_STELLA_DEFMODULE) ||
                                ((operator000 == Logic.SYM_STELLA_CLEAR_MODULE) ||
                                 ((operator000 == Logic.SYM_STELLA_DEFCLASS) ||
                                  ((operator000 == Logic.SYM_STELLA_DEFSLOT) ||
                                   ((operator000 == Logic.SYM_STELLA_DEFUN) ||
                                    ((operator000 == Logic.SYM_STELLA_DEFMETHOD) ||
                                     ((operator000 == Logic.SYM_LOGIC_DEFCONCEPT) ||
                                      ((operator000 == Logic.SYM_LOGIC_DEFFUNCTION) ||
                                       ((operator000 == Logic.SYM_LOGIC_DEFRELATION) ||
                                        ((operator000 == Logic.SYM_LOGIC_DEFOBJECT) ||
                                         (operator000 == Logic.SYM_LOGIC_DEFINSTANCE))))))))))) {
                              Logic.evaluateLogicCommand(tree000, false);
                            }
                            else if (operator000 == Logic.SYM_LOGIC_IN_DIALECT) {
                              Logic.evaluateLogicCommand(tree000, false);
                              commands = Cons.cons(tree000, commands);
                            }
                            else {
                              if ((!Logic.definitionNameP(operator000)) &&
                                  (Symbol.lookupCommand(operator000) != null)) {
                                commands = Cons.cons(tree000, commands);
                              }
                              else {
                                Logic.evaluateLogicCommand(tree000, false);
                              }
                            }
                          }
                        }
                        else {
                          Logic.evaluateLogicCommand(tree000, false);
                        }
                      }
                    }
                  }
                  else {
                    Logic.evaluateLogicCommand(tree, false);
                  }
                }
              }
              { Object old$Translationphase$000 = Stella.$TRANSLATIONPHASE$.get();

                try {
                  Native.setSpecial(Stella.$TRANSLATIONPHASE$, Logic.KWD_FINALIZE);
                  Logic.finalizeObjects();

                } finally {
                  Stella.$TRANSLATIONPHASE$.set(old$Translationphase$000);
                }
              }
              { Stella_Object tree = null;
                Cons iter001 = commands.reverse();

                for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
                  tree = iter001.value;
                  Logic.evaluateLogicCommand(tree, true);
                }
              }

            } finally {
              Stella.$CONTEXT$.set(old$Context$000);
              Stella.$MODULE$.set(old$Module$000);
            }
          }
          if (!(Stella.ignoreTranslationErrorsP())) {
            Stella.summarizeTranslationErrors();
          }

        } finally {
          Stella.$TRANSLATIONNOTES$.set(old$Translationnotes$000);
          Stella.$TRANSLATIONWARNINGS$.set(old$Translationwarnings$000);
          Stella.$TRANSLATIONERRORS$.set(old$Translationerrors$000);
          Logic.$LOGIC_DIALECT$.set(old$LogicDialect$000);
        }
      }
    }
  }