public static void javaOutputStartupUnitsToFile(StringHashTable startupht, Cons keylist) {
    { String classoutputfile = null;
      Cons startupfunctions = null;

      { Object old$CurrentStream$000 = Stella.$CURRENT_STREAM$.get();

        try {
          Native.setSpecial(Stella.$CURRENT_STREAM$, null);
          { StringWrapper classname = null;
            Cons iter000 = keylist;

            for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
              classname = ((StringWrapper)(iter000.value));
              startupfunctions = ((Cons)(startupht.lookup(classname.wrapperValue)));
              if ((startupfunctions != null) &&
                  (!(startupfunctions == null))) {
                { Object old$Module$000 = Stella.$MODULE$.get();
                  Object old$Context$000 = Stella.$CONTEXT$.get();

                  try {
                    Native.setSpecial(Stella.$MODULE$, ((TranslationUnit)(startupfunctions.value)).homeModule());
                    Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
                    classoutputfile = Stella.string_javaMakeCodeOutputFileName(classname.wrapperValue, false);
                    { OutputFileStream classoutputstream = null;

                      try {
                        classoutputstream = Stella.openOutputFile(classoutputfile, Stella.NIL);
                        Native.setSpecial(Stella.$CURRENT_STREAM$, classoutputstream);
                        if (((Integer)(Stella.$TRANSLATIONVERBOSITYLEVEL$.get())).intValue() >= 1) {
                          System.out.println("Writing `" + classoutputfile + "'...");
                        }
                        OutputStream.javaOutputFileHeader(classoutputstream, Stella.string_javaMakeCodeOutputFileName(classname.wrapperValue, true));
                        ((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.println("public class " + classname.wrapperValue + " {");
                        Stella.javaBumpIndent();
                        { TranslationUnit function = null;
                          Cons iter001 = startupfunctions;

                          for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
                            function = ((TranslationUnit)(iter001.value));
                            Cons.javaOutputMethod(TranslationUnit.javaTranslateUnit(function).rest);
                            function.translation = null;
                            function.codeRegister = null;
                          }
                        }
                        Stella.javaUnbumpIndent();
                        ((OutputStream)(Stella.$CURRENT_STREAM$.get())).nativeStream.println("}");

                      } finally {
                        if (classoutputstream != null) {
                          classoutputstream.free();
                        }
                      }
                    }

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

        } finally {
          Stella.$CURRENT_STREAM$.set(old$CurrentStream$000);
        }
      }
    }
  }