1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

30 commits

Author SHA1 Message Date
Morgan Smith
f27e8b855f
Fix typos throughout codebase.
* NEWS:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-debug.texi:
* doc/ref/api-deprecated.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-foreign.texi:
* doc/ref/api-i18n.texi:
* doc/ref/api-io.texi:
* doc/ref/api-languages.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-memory.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-options.texi:
* doc/ref/api-peg.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/api-utility.texi:
* doc/ref/expect.texi:
* doc/ref/goops.texi:
* doc/ref/misc-modules.texi:
* doc/ref/posix.texi:
* doc/ref/repl-modules.texi:
* doc/ref/scheme-ideas.texi:
* doc/ref/scheme-scripts.texi:
* doc/ref/srfi-modules.texi:
* gc-benchmarks/larceny/dynamic.sch:
* gc-benchmarks/larceny/twobit-input-long.sch:
* gc-benchmarks/larceny/twobit.sch:
* libguile/gc.h:
* libguile/ioext.c:
* libguile/list.c:
* libguile/options.c:
* libguile/posix.c:
* libguile/threads.c:
* module/ice-9/boot-9.scm:
* module/ice-9/optargs.scm:
* module/ice-9/ports.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/psyntax.scm:
* module/language/elisp/parser.scm:
* module/language/tree-il/compile-bytecode.scm:
* module/srfi/srfi-37.scm:
* module/srfi/srfi-43.scm:
* module/statprof.scm:
* module/texinfo/reflection.scm:
* test-suite/tests/eval.test:
* test-suite/tests/fluids.test:
Fix typos.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06 11:51:53 +02:00
Andy Wingo
437e5ac43d Fix pretty-print with a per-line prefix
* module/ice-9/pretty-print.scm (pretty-print): Include the per-line
prefix in the indent.
* test-suite/tests/print.test ("pretty-print"): Add test.
2023-11-15 09:35:23 +01:00
Andy Wingo
b5bedf74ad Fix missing port in `pretty-print'
* module/ice-9/pretty-print.scm (pretty-print): We were defaulting to
the current output port.
2023-09-06 16:28:45 +02:00
Andy Wingo
1f724ccd39 Fix embarrassing pretty-print bug
* module/ice-9/pretty-print.scm (pretty-print): We were never indenting
more than 8 spaces.  Doh!
* test-suite/tests/print.test (prints?, "pretty-print"): Add test.
2023-08-24 12:20:45 +02:00
Andy Wingo
5af66570bb Fix allow-newline? in call-with-truncating-output-string
* module/ice-9/pretty-print.scm (call-with-truncating-output-string):
Actually detect newlines.
2023-06-08 10:21:28 +02:00
Andy Wingo
0e4334406a truncated-print: use call-with-truncating-output-string
* module/ice-9/pretty-print.scm (truncated-print): Use new
call-with-truncating-output-string, to allow for early bailout when
printing large records.
2023-06-08 10:21:28 +02:00
Andy Wingo
379a9a64c6 Inline generic-write into pretty-print
* module/ice-9/pretty-print.scm (pretty-print): Inline generic-write
into its only caller.
2023-06-08 10:21:28 +02:00
Andy Wingo
75f96e825c pretty-print: width arg is never false
* module/ice-9/pretty-print.scm (generic-write): width is never false.
2023-06-08 10:21:28 +02:00
Andy Wingo
29a9f26a36 Rewrite pretty-print to rely on port-column, abort early
* module/ice-9/pretty-print.scm (call-with-truncating-output-string):
New function.
* module/ice-9/pretty-print.scm (generic-write): Rewrite so that instead
of keeping track of the column, we just use port-column on the port.
Also, when checking if a possibly-improper list can print on one line,
use new call-with-truncating-output-string so as to always abort early,
even for long bytevectors.
2023-06-08 10:21:28 +02:00
Andy Wingo
03344ce431 pretty-print: inline some handling of read macros
* module/ice-9/pretty-print.scm (generic-write): Not really sure why
read macros are duplicated, but this is a refactor to use more match and
less cadr.
2023-06-08 08:32:25 +02:00
Andy Wingo
ec3bf4e2ba pretty-print: inline genwrite:newline-str
* module/ice-9/pretty-print.scm (genwrite:newline-str): Remove.
(generic-write): Just use "\n".
2023-06-08 08:32:25 +02:00
Andy Wingo
f74565defd pretty-print: Use string-concatenate-reverse
* module/ice-9/pretty-print.scm (generic-write): Use
string-concatenate-reverse instead of locally-defined
reverse-string-append.
(reverse-string-append): Remove.
2023-06-08 08:32:25 +02:00
Daniel Llorens
e0bcda4ad9 Fix bitvectors and non-zero lower bound arrays in truncated-print
* module/ice-9/arrays.scm (array-print-prefix): New private function.
* libguile/arrays.c (scm_i_print_array): Reuse (array-print-prefix) from
  (ice-9 arrays). Make sure to release the array handle.
* module/ice-9/pretty-print.scm (truncated-print): Support
  bitvectors.
  Don't try to guess the array prefix but call array-print-prefix from
  (ice-9 arrays) instead.
  Fix call to print-sequence to support non-zero lower bound arrays.
* test-suite/tests/arrays.test: Test that arrays print properly.
* test-suite/tests/print.test: Test truncated-print with bitvectors,
  non-zero lower bound arrays.
2017-10-31 13:23:44 +01:00
Daniel Llorens
93cbaef134 Fix rank 0 arrays and nested arrays in truncated-print
* module/ice-9/pretty-print.scm (print): In the array case, pass
  #:inner? along to (print-sequence), unless we're at the last dimension
  of the array.
  Special case for 0-rank arrays, which cannot be empty and have no
  length.
* test-suite/tests/print.test: Test some of the cases fixed by this
  patch.
2017-02-07 15:56:40 +01:00
Daniel Llorens
ee2125c639 Support arrays in truncated-print
* module/ice-9/pretty-print.scm (print): Handle general arrays.
* test-suite/tests/print.test: Test truncated-print with general arrays.
2017-02-07 12:19:04 +01:00
Andy Wingo
5fc051babe Merge commit '2f3b7e9a41'
Conflicts:
	module/ice-9/pretty-print.scm
2014-02-08 14:44:11 +01:00
Andy Wingo
2f3b7e9a41 Fix truncated-print for uniform vectors
* module/ice-9/pretty-print.scm (truncated-print): Use bytevector?
  instead of uniform-vector?; the latter could be true for shared arrays
  with non-zero lower bounds.
2014-02-07 18:04:20 +01:00
Mark H Weaver
6dce942c46 String ports use UTF-8; ignore %default-port-encoding.
* libguile/strports.c (scm_mkstrport): Use UTF-8; ignore
  %default-port-encoding.  Rename 'str_len' and 'c_pos' to
  'num_bytes' and 'c_byte_pos'.  Interpret 'pos' argument
  as a character index instead of a byte index.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-6 to the
  list of core features.

* module/srfi/srfi-6.scm (open-input-string, open-output-string): Simply
  re-export these, since the core versions are now compliant.

* doc/ref/api-io.texi (String Ports): Remove text that describes
  non-compliant behavior of string ports with regard to encoding.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-6 to the list of
  core features.
  (SRFI-6): Remove text that mentions non-compliant behavior of
  core string ports.

* module/ice-9/format.scm (format):
* module/ice-9/pretty-print.scm (truncated-print):
* module/rnrs/io/ports.scm (open-string-input-port,
  open-string-output-port):
* test-suite/test-suite/lib.scm (format-test-name):
* test-suite/tests/chars.test ("combining accent is pretty-printed",
  "combining X is pretty-printed"):
* test-suite/tests/ecmascript.test (eread, eread/1):
* test-suite/tests/rdelim.test:
* test-suite/tests/reader.test (read-string):
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-105.test (read-string): Don't set
  %default-port-encoding before creating string ports.

* benchmark-suite/benchmarks/ports.bm (%latin1-port): Use
  'set-port-encoding!' to set the string port encoding.
  (%utf8/ascii-port, %utf8/wide-port, "rdelim"): Don't set
  %default-port-encoding before creating string ports.

* test-suite/tests/r6rs-ports.test ("lookahead-u8 non-ASCII"): Don't set
  %default-port-encoding before creating string ports.
  ("put-bytevector with UTF-16 string port", "put-bytevector with
  wrong-encoding string port"): Use 'set-port-encoding!' to set the
  string port encoding.

* test-suite/tests/print.test (tprint): Use 'set-port-encoding!' to set
  the string port encoding.
  ("truncated-print"): Use 'pass-if-equal'.

* test-suite/tests/ports.test ("encoding failure leads to exception",
  "%default-port-encoding is honored", "peek-char [latin-1]", "peek-char
  [utf-8]", "peek-char [utf-16]"): Remove tests.
  ("%default-port-encoding is ignored", "peek-char"): Add tests.
  ("suitable encoding [latin-1]", "suitable encoding [latin-3]",
  "wrong encoding, error", "wrong encoding, substitute",
  "wrong encoding, escape"): Use 'set-port-encoding!' to set the
  string port encoding.
  ("%default-port-encoding, wrong encoding"): Rewrite to use
  a file port instead of a string port.
2013-08-07 01:22:22 -04:00
Ludovic Courtès
9f6e3f5a99 Have string ports honor `%default-port-conversion-strategy'.
* libguile/strports.c (scm_mkstrport): Remove initialization of
  `pt->ilseq_handler'.

* module/ice-9/pretty-print.scm (truncated-print)[ellipsis]: Set
  %DEFAULT-PORT-CONVERSION-STRATEGY to 'error.

* test-suite/tests/ports.test ("string
  ports")["%default-port-conversion-strategy is honored"]: New test.
  ["wrong encoding"]: Rename to...
  ["wrong encoding, error"]: ... this.  Explicitly set
  %DEFAULT-PORT-CONVERSION-STRATEGY to 'error.  Return #f when no
  exception is raised.
2012-05-31 00:54:21 +02:00
Mark H Weaver
8c43b28a11 pretty-print: allow max-expr-width to be set; recognize more keywords
* module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument
  '#:max-expr-width'.

  (generic-write): Add new argument 'max-expr-width'.  Previously this
  was internally defined to the constant value 50.
2012-03-02 18:29:29 -05:00
Bake Timmons
91a214ebd9 Improve the usage of variable names in Scheme docstrings.
* module/ice-9/boot-9.scm:
* module/ice-9/popen.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/r4rs.scm:
* module/rnrs/io/ports.scm:
* module/texinfo/string-utils.scm:
* module/web/http.scm:
* module/web/request.scm:
* module/web/response.scm:
* test-suite/vm/run-vm-tests.scm: Make the variable names in Scheme docstrings more
  consistent.  Replace a few instances of @var with @code when appropriate.
2012-02-02 12:24:40 +01:00
Michael Gran
8a6b693817 Use ellipsis character in truncated pretty-print of sequences
* module/ice-9/pretty-print.scm (print-sequence): use ellipsis when available
2010-11-08 18:57:29 -08:00
Mike
bf61ca3302 pretty-print print-sequence width error
Avoid the "expected a positive width" display error when printing
sequences with no width remaining.

* module/ice-9/pretty-print (print-sequence): test for zero width when
  printing sequences
2010-11-08 08:52:04 -08:00
Ludovic Courtès
253f26085e pretty-print: Suitably indent macro-related constructs.
* module/ice-9/pretty-print.scm (generic-write)[pp-SYNTAX-CASE]: New
  procedure.
  [style]: Add support for `define-public', `define-syntax',
  `let-syntax', `letrec-syntax', `syntax-rules', and `syntax-case'.
2010-11-07 23:18:40 +01:00
Ludovic Courtès
5bae880e26 Improve handling of read macros in `pretty-print'.
* module/ice-9/pretty-print.scm (generic-write)[wr]: Handle read macros
  that appear in the middle of a list.

* test-suite/tests/print.test (prints?): New macro.
  ("pretty-print"): New test prefix.
2010-11-05 01:39:26 +01:00
Ludovic Courtès
c5e05a1c70 Use HORIZONTAL ELLIPSIS' when available in truncated-print'.
* module/ice-9/pretty-print.scm (truncated-print): Set
  `%default-port-encoding' to the encoding of PORT.  Choose either
  U+2026 or "..." depending on PORT's encoding.

* test-suite/tests/print.test ("truncated-print")[tprint]: New ENCODING
  argument.  Update existing tests accordingly. Add UTF-8 tests.

* doc/ref/misc-modules.texi (Pretty Printing): Mention the possible use
  of U+2026.
2010-01-08 10:57:32 +01:00
Andy Wingo
8c6eea2f1a add truncated-print to (ice-9 pretty-print)
* module/ice-9/pretty-print.scm (pretty-print): Rework so "port" is the
  kwarg, and "port*" is the optional arg. #:port is still the keyword.

  (truncated-print): Add a printer that will ensure that the output
  stays within a certain width. It could use genwrite but it doesn't
  because it seems nice to allow breadth-first allocation of screen
  space, and it's also nice to balance some delimiters (e.g. #< and >).
2009-12-29 13:29:02 +01:00
Andy Wingo
c1ff4aa786 pretty-print is a lambda*
* module/ice-9/pretty-print.scm (pretty-print): Fix to always be a
  define*. Shouldn't change behavior, but it will be more
  introspectible.
2009-12-28 17:41:50 +01:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
00d0489205 move ice-9/ and oop/ under module/
Moved ice-9/ and oop/ under module/, with the idea being that we have
only scheme under module/. Adjusted configure.in and Makefile.am
appropriately. Put oop/ at the end of the compilation order.
2008-11-01 12:44:21 +01:00
Renamed from ice-9/pretty-print.scm (Browse further)