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,
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,