public static Cons cppTranslateUnit(TranslationUnit unit) {
    { Object old$CppCurrentUnitModule$000 = Stella.$CPP_CURRENT_UNIT_MODULE$.get();

      try {
        Native.setSpecial(Stella.$CPP_CURRENT_UNIT_MODULE$, ((Module)(Stella.$MODULE$.get())));
        if (unit.theObject != null) {
          Native.setSpecial(Stella.$CPP_CURRENT_UNIT_MODULE$, unit.theObject.homeModule());
        }
        { Symbol testValue000 = unit.category;

          if (testValue000 == Stella.SYM_STELLA_GLOBAL_VARIABLE) {
            return (TranslationUnit.cppTranslateDefineGlobalVariableUnit(unit));
          }
          else if (testValue000 == Stella.SYM_STELLA_CLASS) {
            return (TranslationUnit.cppTranslateDefineNativeClassUnit(unit));
          }
          else if (testValue000 == Stella.SYM_STELLA_TYPE) {
            return (Stella.NIL);
          }
          else if ((testValue000 == Stella.SYM_STELLA_METHOD) ||
              (testValue000 == Stella.SYM_STELLA_MACRO)) {
            return (TranslationUnit.cppTranslateDefineMethodUnit(unit));
          }
          else if (testValue000 == Stella.SYM_STELLA_PRINT_METHOD) {
            return (TranslationUnit.cppTranslateDefprintUnit(unit));
          }
          else if ((testValue000 == Stella.SYM_STELLA_STARTUP_TIME_PROGN) ||
              (testValue000 == Stella.SYM_STELLA_VERBATIM)) {
            return (((Cons)(Stella_Object.cppTranslateATree(unit.theObject))));
          }
          else {
            { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

              stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
              throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
            }
          }
        }

      } finally {
        Stella.$CPP_CURRENT_UNIT_MODULE$.set(old$CppCurrentUnitModule$000);
      }
    }
  }