Merge commit '5943a62042432b86d757200ef595d7aebb5c9bac'
authorAndy Wingo <wingo@pobox.com>
Thu, 22 Jan 2015 13:38:00 +0000 (14:38 +0100)
committerAndy Wingo <wingo@pobox.com>
Thu, 22 Jan 2015 13:38:00 +0000 (14:38 +0100)
1  2 
libguile/print.c

@@@ -701,27 -636,20 +704,23 @@@ iprin1 (SCM exp, SCM port, scm_print_st
              break;
            }
          break;
 +        case scm_tc7_stringbuf:
 +          scm_i_print_stringbuf (exp, port, pstate);
 +          break;
          case scm_tc7_string:
-           if (SCM_WRITINGP (pstate))
-             {
-               size_t len, i;
-               display_character ('"', port, iconveh_question_mark);
-               len = scm_i_string_length (exp);
-               for (i = 0; i < len; ++i)
-               write_character (scm_i_string_ref (exp, i), port, 1);
-               display_character ('"', port, iconveh_question_mark);
-               scm_remember_upto_here_1 (exp);
-             }
-           else
-           {
-             size_t len, printed;
+         {
+           size_t len, printed;
  
-             len = scm_i_string_length (exp);
+           len = scm_i_string_length (exp);
+           if (SCM_WRITINGP (pstate))
+             {
+               printed = write_string (scm_i_string_data (exp),
+                                       scm_i_is_narrow_string (exp),
+                                       len, port,
+                                       PORT_CONVERSION_HANDLER (port));
+               len += 2;                   /* account for the quotes */
+             }
+           else
              printed = display_string (scm_i_string_data (exp),
                                        scm_i_is_narrow_string (exp),
                                        len, port,
@@@ -1143,14 -1068,13 +1141,14 @@@ display_string (const void *str, int na
  
    if (pti->encoding_mode == SCM_PORT_ENCODING_MODE_UTF8)
      return display_string_as_utf8 (str, narrow_p, len, port);
 +  else if (pti->encoding_mode == SCM_PORT_ENCODING_MODE_LATIN1)
 +    return display_string_as_latin1 (str, narrow_p, len, port, strategy);
    else
 -    return display_string_using_iconv (str, narrow_p, len,
 -                                     port, strategy);
 +    return display_string_using_iconv (str, narrow_p, len, port, strategy);
  }
  
- /* Attempt to display CH to PORT according to STRATEGY.  Return non-zero
-    if CH was successfully displayed, zero otherwise (e.g., if it was not
+ /* Attempt to display CH to PORT according to STRATEGY.  Return one if
+    CH was successfully displayed, zero otherwise (e.g., if it was not
     representable in PORT's encoding.)  */
  static int
  display_character (scm_t_wchar ch, SCM port,