Ejemplo n.º 1
0
AbstractString * ZeroRankArray::write_to_string()
{
  Thread * thread = current_thread();
  bool print_readably = (thread->symbol_value(S_print_readably) != NIL);
  if (print_readably)
    {
      if (_element_type != T)
        signal_lisp_error(new PrintNotReadable(make_value(this)));
    }
  if (print_readably || thread->symbol_value(S_print_array) != NIL)
    {
      String * s = new String("#0A");
      if (aref(0) == make_value(this) && thread->symbol_value(S_print_circle) != NIL)
        {
          StringOutputStream * stream = new StringOutputStream(S_character);
          thread->execute(the_symbol(S_output_object)->function(), aref(0), make_value(stream));
          s->append(stream->get_string());
        }
      else
        s->append(::write_to_string(aref(0)));
      return s;
    }
  else
    return unreadable_string();
}
Ejemplo n.º 2
0
AbstractString * StandardObject::write_to_string()
{
  if (CL_fboundp(S_print_object) != NIL)
    {
      Thread * const thread = current_thread();
      StringOutputStream * stream = new StringOutputStream(S_character);
      thread->execute(the_symbol(S_print_object)->function(),
                      make_value(this),
                      make_value(stream));
      AbstractString * s = stream->get_string();
      return s;
    }
  else
    return unreadable_string();
}
Ejemplo n.º 3
0
AbstractString * Condition::write_to_string()
{
  Thread * const thread = current_thread();
  if (CL_fboundp(S_print_object) != NIL)
    {
      StringOutputStream * stream = new StringOutputStream(S_character);
      thread->execute(the_symbol(S_print_object)->function(),
                      make_value(this),
                      make_value(stream));
      AbstractString * s = stream->get_string();
      return s;
    }
  if (thread->symbol_value(S_print_escape) == NIL && thread->symbol_value(S_print_readably) == NIL)
    {
      if (stringp(format_control()))
        {
          if (format_arguments() != NIL)
            return format_to_string(format_control(), format_arguments());
          else
            return the_string(format_control());
        }
    }
  return unreadable_string();
}