diff options
author | Mark H Weaver <mhw@netris.org> | 2012-10-30 23:46:31 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2012-10-30 23:46:31 -0400 |
commit | fa980bcc0f5b186b98d84fc5d165d35fcbb5d5ec (patch) | |
tree | 411ee841f7526fe7138e42cf399911518df06309 /libguile/print.c | |
parent | e088b09d7dce5d78c96288778969876b6d25d726 (diff) | |
parent | 10744b7c5007ccac19ea9654be6e749fe6a60992 (diff) | |
download | guile-fa980bcc0f5b186b98d84fc5d165d35fcbb5d5ec.tar.gz |
Merge remote-tracking branch 'origin/stable-2.0'
Moved scm_i_struct_hash from struct.c to hash.c and made it static.
The port's alist is now a field of 'scm_t_port'.
Conflicts:
libguile/arrays.c
libguile/hash.c
libguile/ports.c
libguile/print.h
libguile/read.c
Diffstat (limited to 'libguile/print.c')
-rw-r--r-- | libguile/print.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libguile/print.c b/libguile/print.c index 90bc9adf8..5d5c56d2f 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -1229,6 +1229,29 @@ write_character (scm_t_wchar ch, SCM port, int string_escapes_p) write_character_escaped (ch, string_escapes_p, port); } +/* Display STR to PORT from START inclusive to END exclusive. */ +void +scm_i_display_substring (SCM str, size_t start, size_t end, SCM port) +{ + int narrow_p; + const char *buf; + size_t len, printed; + + buf = scm_i_string_data (str); + len = end - start; + narrow_p = scm_i_is_narrow_string (str); + buf += start * (narrow_p ? sizeof (char) : sizeof (scm_t_wchar)); + + printed = display_string (buf, narrow_p, end - start, port, + PORT_CONVERSION_HANDLER (port)); + + if (SCM_UNLIKELY (printed < len)) + scm_encoding_error (__func__, errno, + "cannot convert to output locale", + port, scm_c_string_ref (str, printed + start)); +} + + /* Print an integer. */ |