diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-03-11 15:02:29 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 1997-03-11 15:02:29 +0000 |
commit | 9fbaf27ccbf33b1d2f79f0eb3abf54347348905a (patch) | |
tree | 6d8b8068e15a4b79fd1c4c868ddabdbebdc88fac | |
parent | 14de3b4206bd84fd88e4a919ca2b222f6a6e450a (diff) | |
download | guile-9fbaf27ccbf33b1d2f79f0eb3abf54347348905a.tar.gz |
* print.c (scm_iprin1): Limit number of vector elements printed
according to pstate->length.
-rw-r--r-- | libguile/print.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/libguile/print.c b/libguile/print.c index 6a7ae85e4..b7e8040ef 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -494,18 +494,29 @@ taloop: ENTER_NESTED_DATA (pstate, exp, circref); scm_gen_puts (scm_regular_string, "#(", port); common_vector_printer: - for (i = 0; i + 1 < SCM_LENGTH (exp); ++i) - { - /* CHECK_INTS; */ - scm_iprin1 (SCM_VELTS (exp)[i], port, pstate); - scm_gen_putc (' ', port); - } - if (i < SCM_LENGTH (exp)) - { - /* CHECK_INTS; */ - scm_iprin1 (SCM_VELTS (exp)[i], port, pstate); - } - scm_gen_putc (')', port); + { + int last = SCM_LENGTH (exp) - 1; + int cutp = 0; + if (pstate->fancyp && SCM_LENGTH (exp) > pstate->length) + { + last = pstate->length - 1; + cutp = 1; + } + for (i = 0; i < last; ++i) + { + /* CHECK_INTS; */ + scm_iprin1 (SCM_VELTS (exp)[i], port, pstate); + scm_gen_putc (' ', port); + } + if (i == last) + { + /* CHECK_INTS; */ + scm_iprin1 (SCM_VELTS (exp)[i], port, pstate); + } + if (cutp) + scm_gen_puts (scm_regular_string, " ...", port); + scm_gen_putc (')', port); + } EXIT_NESTED_DATA (pstate); break; case scm_tc7_bvect: |