public static void printTopLevelObject(Stella_Object self, PrintableStringWriter nativestream) {
    { OutputStream stream = Logic.wrapNativeOutputStream(nativestream);

      if (self.deletedP()) {
        stream.nativeStream.print("#DELETED#");
      }
      { Surrogate testValue000 = Stella_Object.safePrimaryType(self);

        if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_DESCRIPTION)) {
          { Description self000 = ((Description)(self));

            Description.printDescription(self000, stream, true);
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
          { PatternVariable self000 = ((PatternVariable)(self));

            stream.nativeStream.print("|V|");
            PatternVariable.printVariable(self000, stream);
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_SKOLEM)) {
          { Skolem self000 = ((Skolem)(self));

            Skolem.printSkolem(self000, stream, true);
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_TRUTH_VALUE)) {
          { TruthValue self000 = ((TruthValue)(self));

            TruthValue.printTruthValue(self000, stream);
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_LOGIC_OBJECT)) {
          { LogicObject self000 = ((LogicObject)(self));

            LogicObject.printLogicObject(self000, stream, true);
          }
        }
        else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PROPOSITION)) {
          { Proposition self000 = ((Proposition)(self));

            Proposition.printProposition(self000, stream, true);
          }
        }
        else {
          stream.nativeStream.print(self);
        }
      }
    }
  }