summaryrefslogtreecommitdiff
path: root/doc/ref/api-io.texi
AgeCommit message (Collapse)AuthorFilesLines
2013-04-07Do not scan for coding declarations in open-file.Mark H Weaver1-8/+16
* libguile/fports.c (scm_open_file): Do not scan for coding declarations. Replace 'use_encoding' local variable with 'binary'. Update documentation string. * module/ice-9/psyntax.scm (include): Add the same file-encoding logic that's used in compile-file and scm_primitive_load. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-io.texi (File Ports): Update docs. * test-suite/tests/ports.test: Change "open-file HONORS file coding declarations" test to "open-file IGNORES file coding declaration". * test-suite/tests/coding.test (scan-coding): Use 'file-encoding' to scan for the encoding, since 'open-input-file' no longer does so.
2013-04-04Improve handling of Unicode byte-order marks (BOMs).Mark H Weaver1-1/+80
* libguile/ports-internal.h (struct scm_port_internal): Add new members 'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'. (SCM_UNICODE_BOM): New macro. (scm_i_port_iconv_descriptors): Add 'mode' parameter to prototype. * libguile/ports.c (scm_new_port_table_entry): Initialize 'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'. (get_iconv_codepoint): Pass new 'mode' parameter to 'scm_i_port_iconv_descriptors'. (get_codepoint): After reading a codepoint at stream start, record that we're no longer at stream start, and consume a BOM where appropriate. (scm_seek): Set the stream start flags according to the new position. (looking_at_bytes): New static function. (scm_utf8_bom, scm_utf16be_bom, scm_utf16le_bom, scm_utf32be_bom, scm_utf32le_bom): New static const arrays. (decide_utf16_encoding, decide_utf32_encoding): New static functions. (scm_i_port_iconv_descriptors): Add new 'mode' parameter. If the specified encoding is UTF-16 or UTF-32, make that precise by deciding what byte order to use, and construct iconv descriptors based on the precise encoding. (scm_i_set_port_encoding_x): Record that we are now at stream start. Do not open the new iconv descriptors immediately; let them be initialized lazily. * libguile/print.c (display_string_using_iconv): Record that we're no longer at stream start. Write a BOM if appropriate. * doc/ref/api-io.texi (BOM Handling): New node. * test-suite/tests/ports.test ("set-port-encoding!, wrong encoding"): Adapt test to cope with the fact that 'set-port-encoding!' does not immediately open the iconv descriptors. (bv-read-test): New procedure. ("unicode byte-order marks (BOMs)"): New test prefix.
2013-04-01Optimize 'get-bytevector-some'; it may now read less than possible.Mark H Weaver1-3/+4
* libguile/r6rs-ports.c (scm_get_bytevector_some): Rewrite to efficiently take the contents of the read/putback buffers. In the docstring, clarify that it might not return all available bytes. * doc/ref/api-io.texi (R6RS Binary Input): Clarify that 'get-bytevector-some' might not return all available bytes. * test-suite/tests/r6rs-ports.test ("get-bytevector-some [only-some]"): Remove bogus test, which requires more than the R6RS requires.
2013-01-22add read-string and read-string! to (ice-9 rdelim)Andy Wingo1-0/+27
* module/ice-9/rdelim.scm (read-string!, read-string): New functions. * test-suite/tests/rdelim.test: Add tests. * doc/ref/api-io.texi: Add docs. * module/ice-9/iconv.scm: * module/rnrs/io/ports.scm: * module/web/uri.scm: Use the new functions.
2012-05-31Add the `%default-port-conversion-strategy' fluid.Ludovic Courtès1-0/+15
Fixes <http://bugs.gnu.org/11468>. * libguile/ports.c (scm_conversion_strategy): Remove. (default_conversion_strategy_var, sym_error, sym_substitute, sym_escape): New variables. (scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x): Remove. (scm_i_default_port_conversion_handler, scm_i_set_default_port_conversion_handler): New functions. (scm_port_conversion_strategy): Use `scm_i_default_port_conversion_handler' when PORT is #f. (scm_set_port_conversion_strategy_x): Use SYM_ERROR, SYM_SUBSTITUTE, and SYM_ESCAPE. Use `scm_i_set_default_port_conversion_handler' when PORT is #f. (scm_init_ports): Initialize DEFAULT_CONVERSION_STRATEGY_VAR. * libguile/ports.h: Update declarations accordingly. * libguile/foreign.c: Change `scm_i_get_conversion_strategy (SCM_BOOL_F)' to `scm_i_default_port_conversion_handler ()'. * libguile/strings.c: Likewise. * test-suite/tests/ports.test ("%default-port-conversion-strategy"): New test prefix. * test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy is error", "%default-port-conversion-strategy is soft"]: New tests. * test-suite/test-suite/lib.scm (exception:encoding-error): Allow the regexp to match `scm_to_stringn' error messages. * doc/ref/api-io.texi (Ports): Document `%default-port-conversion-strategy'.
2012-02-04Improve consistency of definitions of C functions in manual.Bake Timmons1-1/+1
* doc/ref/api-compound.texi * doc/ref/api-evaluation.texi * doc/ref/api-foreign.texi * doc/ref/api-io.texi * doc/ref/posix.texi * doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions of C functions. * doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function with arguments not of SCM type.
2012-02-02Make consistent the usage of variable names in the function definitions ↵Bake Timmons1-28/+28
found in the Texinfo docs. * doc/r5rs/r5rs.texi: * doc/ref/api-compound.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-io.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/compiler.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/scheme-using.texi: * doc/ref/srfi-modules.texi: * doc/ref/vm.texi: * doc/ref/web.texi: * doc/sources/env.texi: Make usage of variable names of function definitions more consistent.
2012-01-05Placate a number of `syntax-check' verifications.Ludovic Courtès1-1/+1
- "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files
2011-08-18reword open-file docsAndy Wingo1-22/+22
* doc/ref/api-io.texi (File Ports): Refactor open-file docs. Thanks to Bake Timmons for the report.
2011-05-20fix documentation for option-set! syntaxenAndy Wingo1-8/+0
* doc/ref/api-evaluation.texi (Scheme Read): Note that read-set! is syntax. (Scheme Write): Likewise for print-set!. * doc/ref/api-io.texi (Writing): Remove reference to print-options-interface. * doc/ref/repl-modules.texi (Readline Options): Update, and add entries for readline-options, readline-set! et al.
2011-05-07More completely document the `(rnrs io ports)' libraryAndreas Rottmann1-21/+668
* doc/ref/api-io.texi (R6RS I/O Ports): Transcribe missing parts from the R6RS document.
2011-04-27Document `(ice-9 binary-ports)'.Ludovic Courtès1-0/+4
* doc/ref/api-io.texi (R6RS I/O Ports): Mention `(ice-9 binary-ports)'. * NEWS: Update.
2011-04-22Make sure binary ports pass `binary-port?' regardless of the locale.Ludovic Courtès1-0/+25
* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Set `c_port->encoding' to NULL. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["bytevector-input-port is binary"]: New test. ("7.2.7 Input Ports")["make-custom-binary-input-port"]: Make sure PORT passes `binary-port?' and `input-port?'. ("8.2.10 Output ports")["bytevector-output-port is binary"]: New test. ["make-custom-binary-output"]: Rename to... ["make-custom-binary-output-port"]: ... this. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute", "peek-char, wrong encoding, error"]: Use `set-port-encoding!' instead of `%default-port-encoding' to set the encoding of bytevector input ports. * test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding error, substitute"]: Likewise. * doc/ref/api-io.texi (R6RS Port Manipulation): Document `binary-port?' and `textual-port?'. * doc/ref/r6rs.texi (R6RS Incompatibilities): Mention the soft distinction between textual and binary ports.
2011-03-13doc: Remove "lack of support for Unicode I/O and strings".Ludovic Courtès1-2/+1
* doc/ref/api-io.texi (R6RS I/O Ports): Remove 1.8ish comment.
2011-02-28update port-filename docsAndy Wingo1-3/+2
* doc/ref/api-io.texi (File Ports): * libguile/ports.c (scm_port_filename): Fix docs to match implementation.
2011-02-09docs: fix typos in manual, and a couple in code comments.Ralf Wildenhues1-2/+2
* doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-debug.texi, doc/ref/api-io.texi, doc/ref/api-macros.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-undocumented.texi, doc/ref/api-utility.texi, doc/ref/compiler.texi, doc/ref/goops.texi, doc/ref/libguile-concepts.texi, doc/ref/misc-modules.texi, doc/ref/posix.texi, doc/ref/r6rs.texi, doc/ref/slib.texi, doc/ref/srfi-modules.texi, doc/ref/sxml-match.texi, doc/ref/tools.texi, doc/ref/vm.texi, doc/ref/web.texi, doc/sources/env.texi, doc/sources/jimb-org.texi, doc/sources/scheme-concepts.texi, doc/sources/unix.texi, module/ice-9/optargs.scm: Fix typos. * doc/r4rs/r5rs.texi: Likewise. Do not capitalize code symbols even at the start of a sentence. * doc/ref/api-data.texi: Likewise. Also, remove executable bit.
2011-02-02Have `read-char' & co. throw to `decoding-error'.Ludovic Courtès1-2/+14
* libguile/ports.c (scm_read_char): Mention `decoding-error' in the docstring. (get_codepoint): Change to return an error code; add `codepoint' output parameter. Don't raise an error from here. (scm_getc): Raise an error with `scm_decoding_error' if `get_codepoint' returns an error. (scm_peek_char): Likewise. Update docstring. * libguile/strings.c (scm_decoding_error_key): New variable. (scm_decoding_error): New function. (scm_from_stringn): Use `scm_decoding_error' instead of `scm_encoding_error'. * libguile/strings.h (scm_decoding_error): New declaration. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error"]: Change to expect `decoding-error'. Make sure PORT points past the error. ["read-char, wrong encoding, escape"]: Likewise. ["peek-char, wrong encoding, error"]: New test. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Change to expect `decoding-error'. ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Likewise. * test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding error, substitute"]: New tests. * doc/ref/api-io.texi (Reading): Update documentation of `read-char' and `peek-char'. (Line/Delimited): Update documentation of `read-line'.
2010-12-06update read-delimited! docsAndy Wingo1-8/+11
* doc/ref/api-io.texi (Line/Delimited): Update the read-delimited! docs.
2010-10-01move read and print options docs to the procedures they parameterizeAndy Wingo1-22/+7
* doc/ref/api-evaluation.texi (Scheme Read): Fold all reader options docs into this section. Undocument read-options-interface. (Scheme Write): New section for `write' and `display', and the print options. print-enable/print-disable are not documented, as there are no boolean print options. print-options-interface is likewise undocumented. * doc/ref/api-options.texi: Remove discussion of options in general. Move read options to Scheme Read, and print options to Scheme Write. * doc/ref/api-io.texi (Reading): Link to Scheme Read. (Writing): Move write and display to Scheme Write, and link there. * doc/ref/srfi-modules.texi: * doc/ref/api-debug.texi: * doc/ref/api-data.texi: Update xrefs.
2010-07-17open-file should handle binary mode and coding declarationsMichael Gran1-2/+16
The open-file port should use the 8-bit ISO-8859-1 encoding when a file is opened using mode "b". Also, it should honor a "coding:" declaration at the top of a file when reading files where it is present. * libguile/fports.c (scm_open_file): modified * test-suite/tests/ports.test: more tests for open-file * doc/ref/api-io.texi (File Ports): more documentation for open-file
2010-04-10Merge branch 'master' into wip-manual-2Neil Jerram1-1/+31
Conflicts: doc/ref/api-procedures.texi doc/ref/misc-modules.texi (Caused by me removing `@page' from a couple of sections that have been modified by others.)
2010-01-19Document modal encodings problem in ref docMichael Gran1-0/+6
* doc/ref/api-io.texi (Ports): note that modal encodings are not supported
2010-01-07Have string ports honor `%default-port-encoding'.Ludovic Courtès1-1/+25
* libguile/strports.c (scm_i_mkstrport): Remove. (scm_mkstrport): Don't change the port's encoding to UTF-8; convert STR to the default port encoding. (scm_strport_to_string): Fix documentation & indentation. * libguile/strports.h (scm_i_mkstrport): Remove. * test-suite/lib.scm (exception:encoding-error): New variable. (format-test-name): Set `%default-port-encoding' to "UTF-8". * test-suite/tests/ports.test ("string ports")["%default-port-encoding is honored", "suitable encoding [latin-1]", "suitable encoding [latin-3]", "wrong encoding"]: New tests. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with UTF-16 string port", "put-bytevector with wrong-encoding string port"]: New tests. * test-suite/tests/reader.test (read-string): Set `%default-port-encoding' to `#f'. ("reading")["unprintable symbol"]: Use a string that doesn't contain zeros. * doc/ref/api-io.texi (String Ports): Document encoding issues with `call-with-output-string' and `with-output-to-string'.
2009-12-19Remove page breaks except before new chapters and indicesNeil Jerram1-1/+0
* doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-data.texi, doc/ref/api-debug.texi, doc/ref/api-evaluation.texi, doc/ref/api-i18n.texi, doc/ref/api-io.texi, doc/ref/api-memory.texi, doc/ref/api-modules.texi, doc/ref/api-options.texi, doc/ref/api-overview.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-smobs.texi, doc/ref/api-translation.texi, doc/ref/api-utility.texi, doc/ref/expect.texi, doc/ref/libguile-concepts.texi, doc/ref/libguile-program.texi, doc/ref/misc-modules.texi, doc/ref/repl-modules.texi, doc/ref/scheme-debugging.texi, doc/ref/scheme-reading.texi, doc/ref/scheme-scripts.texi, doc/ref/script-getopt.texi, doc/ref/scsh.texi, doc/ref/srfi-modules.texi: Remove @page before @section.
2009-12-18more typo fixesBrian Gough1-1/+1
More spelling corrections and fixes for doubled words (e.g. "the the") -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 7be02beedc739c32cce2c8ec8f4ac814c994a13f Mon Sep 17 00:00:00 2001 From: Brian Gough <bjg@gnu.org> Date: Mon, 14 Dec 2009 22:06:22 +0000 Subject: [PATCH] fix various documentation typos (spelling & doubled words)
2009-11-16Improve documentation of supported encoding names.Ludovic Courtès1-5/+7
* doc/ref/api-evaluation.texi (Character Encoding of Source Files): Mention IANA as the list of supported character encodings. Thanks to Bruno Haible for pointing this out. * doc/ref/api-io.texi (Ports): Likewise. Improve documentation of `%default-port-encoding'.
2009-11-14Replace `setbinary' by a public `%default-port-encoding' fluid.Ludovic Courtès1-0/+6
* doc/ref/api-evaluation.texi (Character Encoding of Source Files): Add reference to the "Ports" node. * doc/ref/api-io.texi (Ports): Document `%default-port-encoding'. * libguile/ports.c (scm_port_encoding_var): Rename to... (default_port_encoding_var): ... this; update callers. Make `static'. * libguile/posix.c (scm_setbinary): Remove. * libguile/posix.h: Adjust accordingly. * test-suite/tests/numbers.test: Remove unneeded `setbinary' call. * test-suite/tests/ports.test: Replace `setbinary' call by equivalent `%default-port-encoding' mutation and `set-port-encoding!' calls. * test-suite/tests/r6rs-ports.test: Replace `setbinary' call by equivalent `%default-port-encoding' mutation.
2009-09-04Doc updates for Unicode string escapes and port encodingsMichael Gran1-8/+76
* NEWS: string and port changes * doc/ref/api-data.texi: string escapes and string-ci * doc/ref/api-io.texi: port encoding functions
2009-08-09In general, use @lisp in preference to @smalllispNeil Jerram1-8/+8
because it looks better in the DVI output. Exceptions are - wide examples, which would cause overfull hboxes if they used the bigger @lisp font - very large examples, which may look too big at the @lisp size.
2009-06-25Add `scm_t_off' type so that `scm_t_port' has a fixed layout.Ludovic Courtès1-2/+2
* libguile/gen-scmconfig.c (main): Produce a definition for `scm_t_off'. * libguile/ports.h (scm_t_port)[read_buf_size, saved_read_buf_size, write_buf_size, seek, truncate]: Use `scm_t_off' instead of `off_t' so that the layout and size of the structure does not depend on the application's `_FILE_OFFSET_BITS' value. Reported by Bill Schottstaedt, see http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html. (scm_set_port_seek, scm_set_port_truncate): Update. * libguile/ports.c (scm_set_port_seek, scm_set_port_truncate): Use `scm_t_off' and `off_t_or_off64_t'. * libguile/fports.c (fport_seek, fport_truncate): Use `scm_t_off' instead of `off_t'. * libguile/r6rs-ports.c (bip_seek, cbp_seek, bop_seek): Use `scm_t_off' instead of `off_t'. * libguile/rw.c (scm_write_string_partial): Likewise. * libguile/strports.c (st_resize_port, st_seek, st_truncate): Likewise. * doc/ref/api-io.texi (Port Implementation): Update prototype of `scm_set_port_seek ()' and `scm_set_port_truncate ()'. * NEWS: Update.
2009-06-18Import documentation for the R6RS bytevector and port APIs.Ludovic Courtès1-1/+265
* doc/ref/api-compound.texi (Uniform Numeric Vectors): Add xref to the bytevector API. * doc/ref/api-data.texi (Bytevectors): New node. * doc/ref/api-io.texi (R6RS I/O Ports): New node.
2007-03-07merge from 1.8 branchKevin Ryde1-1/+28
2006-10-09merge from 1.8 branchKevin Ryde1-8/+16
2006-06-17merge from 1.8 branchKevin Ryde1-20/+54
2006-01-29Renamed the "frames" that are related to dynamic-wind to "dynamicMarius Vollmer1-6/+6
contexts. Renamed all functions from scm_frame_ to scm_dynwind_. Updated documentation.
2005-08-06Index entries for ptob etc.Kevin Ryde1-0/+6
2005-05-02Tweaks.Kevin Ryde1-4/+4
2005-04-29(Default Ports): Describe buffering on standard ports.Kevin Ryde1-7/+29
2005-04-21Index entries for standard input/output/error.Kevin Ryde1-0/+3
2005-02-03(File Ports): In port-filename, cannot use after close.Kevin Ryde1-0/+3
2004-08-24Ran a (docstring-process-module "(guile)") and moved entries fromMarius Vollmer1-7/+12
new-docstrings.texi to their appropriate place.
2004-08-09In open-file, split a paragraph for clarity.Kevin Ryde1-2/+4
2004-08-09(File Ports): In open-file, describe the "b" binary flag.Kevin Ryde1-0/+15
2004-08-02* scheme-binding.texi: Renamed to api-binding.texi.Marius Vollmer1-0/+1161
* scheme-compound.texi: Renamed to api-compound.texi. * scheme-control.texi: Renamed to api-control.texi. * scheme-data.texi: Renamed to api-data.texi. * scheme-debug.texi: Renamed to api-debug.texi. * deprecated.texi: Renamed to api-deprecated.texi. * scheme-evaluation.texi: Renamed to api-evaluation.texi. * ref-init.texi: Renamed to api-init.texi. * scheme-io.texi: Renamed to api-io.texi. * scheme-memory.texi: Renamed to api-memory.texi. * scheme-modules.texi: Renamed to api-modules.texi. * scheme-options.texi: Renamed to api-options.texi. * scm.texi: Renamed to api-overview.texi. * scheme-procedures.texi: Renamed to api-procedures.texi. * scheme-scheduling.texi: Renamed to api-scheduling.texi. * scheme-scm.texi: Renamed to api-scm.texi. * scheme-smobs.texi: Renamed to api-smobs.texi. * scheme-snarf.texi: Renamed to api-snarf.texi. * scheme-translation.texi: Renamed to api-translation.texi. * scheme-utility.texi: Renamed to api-utility.texi. * debugging.texi: Renamed to scheme-debugging.texi. * scripts.texi: Renamed to scheme-scripts.texi. * program.texi: Renamed to libguile-program.texi.