public static void testLogicFile(String file) {
    Stella.ensureFileExists(file, "test-logic-file");
    { int currentlevel = ((Integer)(Logic.$DEMO_LEVEL$.get())).intValue();
      Stella_Object command = null;
      Stella_Object result = null;
      boolean exitP = false;
      InputStream inputstream = InputFileStream.newInputFileStream(file);
      String filebasename = Stella.fileNameWithoutDirectory(file);

      { Object old$CarefulLogicCommandLoopExit$P000 = Logic.$CAREFUL_LOGIC_COMMAND_LOOP_EXIT$p.get();
        Object old$DemoLevel$000 = Logic.$DEMO_LEVEL$.get();
        Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
        Object old$PrintprettyP$000 = Stella.$PRINTPRETTYp$.get();

        try {
          Native.setBooleanSpecial(Logic.$CAREFUL_LOGIC_COMMAND_LOOP_EXIT$p, false);
          Native.setIntSpecial(Logic.$DEMO_LEVEL$, currentlevel + 1);
          Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
          Native.setBooleanSpecial(Stella.$PRINTPRETTYp$, false);
          { Object old$Module$000 = Stella.$MODULE$.get();
            Object old$Context$000 = Stella.$CONTEXT$.get();

            try {
              Native.setSpecial(Stella.$MODULE$, ((Module)(Stella.$MODULE$.get())));
              Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
              {
                System.out.println();
                System.out.println("Now testing file `" + filebasename + "':");
              }
;
              loop000 : for (;;) {
                try {
                  System.out.println();
                  Logic.printDemoPrompt();
                  if (!(exitP)) {
                    { Object [] caller_MV_returnarray = new Object[1];

                      command = InputStream.readSExpression(inputstream, caller_MV_returnarray);
                      exitP = ((boolean)(((BooleanWrapper)(caller_MV_returnarray[0])).wrapperValue));
                    }
                  }
                  if (exitP ||
                      Logic.logicCommandLoopExitP(command, new Object[1])) {
                    break loop000;
                  }
                  {
                    System.out.println(command);
                    System.out.println();
                  }
;
                  result = Logic.evaluateLogicCommand(command, false);
                  Logic.printLogicCommandResult(result);
                } catch (EvaluationException e) {
                  Stella.STANDARD_ERROR.nativeStream.print(">> Error: " + Stella.exceptionMessage(e));
                }
              }
              inputstream.free();
              {
                System.out.println();
                System.out.println();
                System.out.println(Logic.$LOGIC_COMMAND_RESULT_INDENT$ + "Finished testing file `" + filebasename + "'.");
              }
;

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

        } finally {
          Stella.$PRINTPRETTYp$.set(old$PrintprettyP$000);
          Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
          Logic.$DEMO_LEVEL$.set(old$DemoLevel$000);
          Logic.$CAREFUL_LOGIC_COMMAND_LOOP_EXIT$p.set(old$CarefulLogicCommandLoopExit$P000);
        }
      }
    }
  }