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

17820 commits

Author SHA1 Message Date
David Michael
99555262a9 Fix the rule to check for new signals and errors
Fixes <http://bugs.gnu.org/21114>.

* libguile/Makefile.am (chknew-E chknew-SIG): Remove the line
  continuation after the targets, and include numbers in the
  recipe's signal/error regexp to catch names like E2BIG.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-05-22 19:50:07 +02:00
Ludovic Courtès
2e3f6c3c67 i18n: Add new collation test for posterity.
* test-suite/tests/i18n.test ("text collation (Czech)"): New test
  prefix.
2016-05-22 19:49:44 +02:00
Ludovic Courtès
0bcf5d78ec web: Gracefully handle premature EOF when reading chunk header.
* module/web/http.scm (read-chunk-header): Return 0 when 'read-line'
  returns EOF.
2016-05-22 19:49:33 +02:00
Mark H Weaver
d975a8dec6 docs: Fix external representation of <toplevel-define> in tree-il.
* doc/ref/compiler.texi (Tree-IL): Provide the correct external
  representation of <toplevel-define>.
2016-05-22 19:49:15 +02:00
Ludovic Courtès
d52edc05d3 web: Fix 'close' method of delimited input ports.
* module/web/response.scm (make-delimited-input-port)[close]: Replace
  erroneous self-recursive call with a call to 'close-port'.
* test-suite/tests/web-response.test ("example-1")["response-body-port +
  close"]: New test.
2016-05-22 19:48:47 +02:00
Ludovic Courtès
013e69838c Thank Ricardo. 2016-05-22 19:45:50 +02:00
Ludovic Courtès
e8d3733521 doc: Fix menu order for SXML.
* doc/ref/sxml.texi (SXML): Add missing quotes in example.
  Fix node order in menu.
2016-05-22 19:45:40 +02:00
Ricardo Wurmus
b6c1018d96 doc: Add SXPath documentation from sources
Fixes <http://bugs.gnu.org/19478>.

* doc/ref/sxml.texi (SXPath): Add procedure documentation from sources.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2016-05-22 19:45:28 +02:00
Mark H Weaver
bb7075dc1a psyntax: Fix bug in match-each+.
Reported by Panicz Maciej Godek <godek.maciek@gmail.com> in
<http://lists.gnu.org/archive/html/guile-user/2015-09/msg00017.html>.

* module/ice-9/psyntax.scm (match-each+): Fix the case where a non-pair
  syntax object is encountered in a dotted tail.
* module/ice-9/psyntax-pp.scm: Regenerate.
2016-05-22 19:42:35 +02:00
Taylan Ulrich Bayırlı/Kammer
a04c849b09 Clarify datum->syntax documentation.
* doc/ref/api-macros.texi (Syntax Case): Make it clear that the first
  argument to datum->syntax must be an identifier.
2016-05-22 19:42:23 +02:00
Mark H Weaver
3cf70e36f1 Fix uses of 'scm_gc_protect', which does not exist, in the manual.
* doc/ref/api-memory.texi (Garbage Collection Functions),
  doc/ref/libguile-concepts.texi (Garbage Collection): Change
  'scm_gc_protect' --> 'scm_gc_protect_object'.
2016-05-22 19:42:13 +02:00
Andreas Rottmann
d77247b90b Heed the reader settings implied by #!r6rs
When encountering the #!r6rs directive, apply the appropriate reader
settings to the port.

* libguile/read.scm (read-string-as-list): New helper procedure.
  (scm_read_shebang): Set reader options implied by the R6RS syntax
  upon encountering the #!r6rs directive.
* test-suite/tests/reader.test (per-port-read-options): Add tests for
  the #!r6rs directive.
2016-05-22 19:40:37 +02:00
Mark H Weaver
aa13da5189 Fix atan procedure when applied to complex numbers.
Fixes a regression introduced in commit
ad79736c68.

* libguile/numbers.c (scm_atan): Fix the complex case.
* test-suite/tests/numbers.test ("atan"): Add test.
2016-05-22 19:29:38 +02:00
Mathieu Lirzin
ea8fa622ec doc: Fix parameter of 'set-record-type-printer!'.
* doc/ref/api-compound.texi (SRFI-9 Records)[set-record-type-printer!]:
  Fix parameter name.
2016-05-22 19:29:17 +02:00
Natanael Copa
7413430fd7 i18n: Check for non-POSIX strtol_l.
* configure.ac: Check for strtol_l.
* libguile/i18n.c: Check HAVE_STRTOL_L before using strtol_l.
2016-05-22 19:29:17 +02:00
Alex Kost
96b299045f Fix typo in the man page.
* doc/guile.1: "--no-autocompile" -> "--no-auto-compile".
2016-05-22 19:29:17 +02:00
Alex Kost
e7cde8be9e Fix typo in manual.
* doc/ref/api-modules.texi (Using Guile Modules): Remove extra "yet".
2016-05-22 19:29:17 +02:00
Ludovic Courtès
93c3b060c1 doc: Update libgc URL.
* doc/ref/data-rep.texi (Conservative GC): Update libgc URL.
2016-05-22 19:29:17 +02:00
Mark H Weaver
82357f7bd8 Add more R6RS port encoding tests
Originally applied to stable-2.0 as "Fix bytevector and custom binary
ports to actually use ISO-8859-1 encoding.", commit
d574d96f87.  Related to
http://bugs.gnu.org/20200, which was introduced in in stable-2.0 but
never existed on master.  Test modified by Andy Wingo to add a
`force-output' where needed.

* test-suite/tests/r6rs-ports.test: Add tests.
2016-05-22 19:29:09 +02:00
Mark H Weaver
7b1069269b Handle zero-length bytevectors correctly in (system base types).
* module/system/base/types.scm (cell->object): Use 'get-bytevector-n'
  instead of 'get-bytevector-all', so that the zero-length case does not
  return EOF.
2016-05-22 19:14:48 +02:00
Mark H Weaver
8dcf3c6163 Work around requirement that size be non-zero in GDB 'open-memory'.
* module/system/base/types.scm (memory-port): Handle zero size case
  specially.
2016-05-22 19:13:22 +02:00
Ludovic Courtès
d848067b89 web: Export 'server-impl' procedures and the 'http' server implementation.
* module/web/server.scm: Export the 'server-impl' procedures.
* module/web/server/http.scm: Export 'http'.
2016-05-22 19:11:32 +02:00
Taylan Ulrich Bayırlı/Kammer
704c911893 Correct docstring of 'symlink'.
* libguile/filesys.c (symlink): Correct the docstring, which had
  'oldpath' and 'newpath' confused.
2016-05-22 19:09:47 +02:00
Ludovic Courtès
70d8ef786a tests: Gracefully handle ENOSYS return for 'setaffinity'.
Fixes <http://bugs.gnu.org/19646>.
Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>.

* test-suite/tests/posix.test ("affinity")["setaffinity"]: Wrap in
  'catch' and throw 'unresolved upon ENOSYS.
2016-05-22 19:09:33 +02:00
Ludovic Courtès
05bea208b3 tests: Make 'test-guild-compile' more reliable.
Before that it would occasionally fail because the "$target" (not the
intermediate temporary file) would be produced.

* test-suite/standalone/test-guild-compile: Call 'pause' before 'sleep'
  in test program.
2016-05-22 19:09:25 +02:00
Mark H Weaver
30db824b92 Don't return expressions from void functions in numbers.c
Although popular compilers allow it as long as the expression is of type
void, it violates C99 and some compilers choke on it.

* libguile/numbers.c (scm_euclidean_divide, scm_floor_divide)
  (scm_ceiling_divide, scm_truncate_divide, scm_centered_divide)
  (scm_round_divide): Don't use the return statement with an expression
  from functions with return type void.
2016-05-22 19:07:56 +02:00
Mark H Weaver
e390e5760b Implement 'string-utf8-length' and 'scm_c_string_utf8_length'.
* libguile/strings.c (utf8_length, scm_c_string_utf8_length)
  (scm_string_utf8_length): New functions.
* libguile/strings.h (scm_c_string_utf8_length, scm_string_utf8_length):
  New prototypes.
* doc/ref/api-data.texi (Bytevectors as Strings): Add docs.
* doc/ref/guile.texi: Update manual copyright date to 2015.
* test-suite/tests/strings.test (string-utf8-length): Add tests.
2016-05-22 19:03:37 +02:00
Ludovic Courtès
751a55e355 http: Do not buffer HTTP chunks.
Fixes <http://bugs.gnu.org/19939>.

* module/web/http.scm (read-chunk, read-chunk-body): Remove.
  (make-chunked-input-port)[next-chunk, buffer-, buffer-size,
  buffer-pointer]: Remove.
  [chunk-size, remaining]: New variables.
  [read!]: Rewrite to write directly to BV.
* test-suite/tests/web-http.test ("chunked encoding")["reads chunks
  without buffering", "reads across chunk boundaries"]: New tests.
2016-05-22 18:43:28 +02:00
Ludovic Courtès
c6d88d1234 tests: Use 'pass-if-equal' in web-http chunked encoding tests.
* test-suite/tests/web-http.test ("chunked encoding"): Use
  'pass-if-equal' where appropriate.
2016-05-22 18:40:43 +02:00
Andy Wingo
fd17cf9f72 Speed up port position access from Scheme
* libguile/ports-internal.h (scm_port_buffer_position):
  (scm_port_position_line, scm_port_position_set_line):
  (scm_port_position_column, scm_port_position_set_column): New
  helpers.
  (scm_t_port): Ports now hold position as a pair, so that Scheme can
  access it easily.
  (SCM_LINUM, SCM_COL, SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL)
  (SCM_DECCOL, SCM_TABCOL): Remove.
* libguile/ports.c (make_port_buffer): Rename from
  scm_c_make_port_buffer, make static, and take port as an argument so
  we can initialize the position field.
  (initialize_port_buffers): Adapt make_port_buffer change.
  (scm_c_make_port_with_encoding): Initialize position.
  (update_port_position): Rename from update_port_lf, and operate on
  port position objects.
  (scm_ungetc): Operate on port position objects.
  (scm_setvbuf, scm_expand_port_read_buffer_x): Adapt to
  make_port_buffer change.
  (scm_lfwrite): Adapt to call update_port_position.
  (scm_port_line, scm_set_port_line_x, scm_port_column)
  (scm_set_port_column_x): Adapt to use port positions.
* libguile/ports.h (scm_c_make_port_buffer): Remove internal decl.
* libguile/read.c: Adapt to use scm_port_line / scm_port_column instead
  of SCM_LINUM et al.
* module/ice-9/ports.scm (port-buffer-position, port-position-line)
  (port-position-column, set-port-position-line!)
  (set-port-position-column!): New accessors for the internals module.
* module/ice-9/sports.scm (advance-port-position!): Rename from
  port-advance-position! and use the new accessors.
  (read-char, port-fold-chars/iso-8859-1): Adapt to use
  advance-port-position!.
2016-05-22 18:16:19 +02:00
Andy Wingo
a4b06357f6 Implementation of read-delimited in Scheme
* module/ice-9/sports.scm (port-fold-chars/iso-8859-1):
  (port-fold-chars, read-delimited, read-line, %read-line): Initial
  implementation of read-delimited.
2016-05-22 14:52:15 +02:00
Andy Wingo
fd5e69d3c1 Sports refactor
* module/ice-9/sports.scm (port-advance-position!): Factor out to a
  helper.
  (read-char): Use port-advance-position!.
2016-05-22 13:42:00 +02:00
Andy Wingo
1852633a9b Add install-sports!, uninstall-sports! functions
* module/ice-9/sports.scm (install-sports!, uninstall-sports!): New
  functions.
2016-05-20 23:15:50 +02:00
Andy Wingo
534139e458 Support for non-blocking I/O
* doc/ref/api-io.texi (I/O Extensions): Document read_wait_fd /
  write_wait_fd members.
  (Non-Blocking I/O): New section.
* libguile/fports.c (fport_read, fport_write): Return -1 if the
  operation would block.
  (fport_wait_fd, scm_make_fptob): Add read/write wait-fd
  implementation.
* libguile/ports-internal.h (scm_t_port_type): Add read_wait_fd /
  write_wait_fd.
* libguile/ports.c (default_read_wait_fd, default_write_wait_fd): New
  functions.
  (scm_make_port_type): Initialize default read/write wait fd impls.
  (trampoline_to_c_read, trampoline_to_scm_read)
  (trampoline_to_c_write, trampoline_to_scm_write): To Scheme, a return
  of #f indicates EWOULDBLOCk.
  (scm_set_port_read_wait_fd, scm_set_port_write_wait_fd): New
  functions.
  (port_read_wait_fd, port_write_wait_fd, scm_port_read_wait_fd)
  (scm_port_write_wait_fd, port_poll, scm_port_poll): New functions.
  (scm_i_read_bytes, scm_i_write_bytes): Poll if the read or write would
  block.
* libguile/ports.h (scm_set_port_read_wait_fd)
  (scm_set_port_write_wait_fd): Add declarations.
* module/ice-9/ports.scm: Shunt port-poll and port-{read,write}-wait-fd
  to the internals module.
* module/ice-9/sports.scm (current-write-waiter):
  (current-read-waiter): Implement.
* test-suite/tests/ports.test: Adapt non-blocking test to new behavior.
* NEWS: Add entry.
2016-05-20 14:57:27 +02:00
Andy Wingo
8b6f4df3f4 Fix sports.test
* test-suite/tests/sports.test (include-tests): Fix encoding when
  reading ports.test.
2016-05-18 22:11:32 +02:00
Andy Wingo
e32dcf214e Test Scheme port implementation
* module/ice-9/ports.scm: Add port-decode-char to internals export
  list.
* test-suite/Makefile.am:
* test-suite/tests/sports.test: Add new test.
2016-05-16 14:04:54 +02:00
Andy Wingo
1e058add7b U+FFFD is the input substitution character
* libguile/ports.c (UNICODE_REPLACEMENT_CHARACTER):
* libguile/ports.c (peek_utf8_codepoint)
  (scm_port_decode_char, peek_iconv_codepoint):
* module/ice-9/sports.scm (peek-char-and-len/utf8):
  (peek-char-and-len/iconv): Return U+FFFD when we get a decoding error
  when reading, instead of '?', in accordance with Unicode
  recommendations.
* test-suite/tests/iconv.test:
* test-suite/tests/ports.test:
* test-suite/tests/rdelim.test: Update tests.
* NEWS: Update.
2016-05-16 10:48:35 +02:00
Andy Wingo
da456d23be Bump objcode version
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION):
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump for
  Guile 2.1.3.
2016-05-16 09:38:09 +02:00
Andy Wingo
d6922b4af4 Update NEWS for release
* NEWS: Try to tell the port story better.
2016-05-15 22:26:34 +02:00
Andy Wingo
745cbb4918 Remove unused type from ports-internal
* libguile/ports-internal.h: Remove unused scm_t_port_rw_active.
* libguile/deprecated.h (scm_port_rw_active): Remove deprecation shim,
  as this thing is just gone now.
2016-05-14 23:46:17 +02:00
Andy Wingo
556ac9777b Document scm_c_make_port and friends
* doc/ref/api-io.texi (I/O Extensions): Document scm_c_make_port and
  friends, and document "mode bits".
2016-05-14 23:27:38 +02:00
Andy Wingo
a9d0fe9ea1 Update port mode bits documentation.
* libguile/ports.h: Update documentation of port mode bits.
2016-05-14 23:26:50 +02:00
Andy Wingo
9ecf77a82d Add SCM_OPN to mode bits when making ports
* libguile/ports.c (scm_c_make_port_with_encoding): Add SCM_OPN to mode
  bits, so that users don't have to.
  (scm_i_mode_bits_n):
* libguile/print.c (scm_simple_format)
* libguile/r6rs-ports.c (make_bytevector_input_port)
  (make_custom_binary_input_port, make_bytevector_output_port)
  (make_custom_binary_output_port, make_transcoded_port)
* libguile/strports.c (scm_object_to_string, scm_open_input_string)
  (scm_open_output_string, scm_c_read_string): Remove now-unneeded
  SCM_OPN mentions.
2016-05-14 12:42:17 +02:00
Andy Wingo
9322902d02 Update port type documentation
* doc/ref/api-io.texi (I/O Extensions): Update for port type change.
2016-05-13 18:34:12 +02:00
Andy Wingo
cd51ce81d0 Use heap-allocated port types instead of ptobnums
This removes a limitation on the number of port types, simplifies the
API, and removes a central point of coordination.

* libguile/ports-internal.h (struct scm_t_port_type): Rename from
  scm_t_ptob_descriptor, now that it's private.  Add GOOPS class
  fields.
  (struct scm_t_port): Rename from struct scm_port, especially
  considering that deprecated.h redefines scm_port using the
  preprocessor :(.
* libguile/ports.h: Add definitions of SCM_PORT and SCM_PORT_TYPE,
  though the scm_t_port and scm_t_port_type types are incomplete.
  (SCM_TC2PTOBNUM, SCM_PTOBNUM, SCM_PTOBNAME): Remove, as there are no
  more typecodes for port types.
  (scm_c_num_port_types, scm_c_port_type_ref, scm_c_port_type_add_x):
  Remove.
  (scm_make_port_type): Return a scm_t_port_type*.  All methods adapted
  to take a scm_t_port_type* instead of a ptobnum.
  (scm_c_make_port_with_encoding, scm_c_make_port): Take a port type
  pointer instead of a tag.
  (scm_new_port_table_entry): Remove; not useful.
* libguile/ports.c: Remove things related to the port kind table.  Adapt
  uses of SCM_PORT_DESCRIPTOR / scm_t_ptob_descriptor to use
  SCM_PORT_TYPE and scm_t_port_type.
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/filesys.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/print.c:
* libguile/r6rs-ports.c:
* libguile/strports.c:
* libguile/strports.h:
* libguile/tags.h:
* libguile/vports.c:
* test-suite/standalone/test-scm-c-read.c: Adapt to change.
* libguile/goops.c (scm_class_of, make_port_classes)
  (scm_make_port_classes, create_port_classes): Adapt to store the
  classes in the ptob.
2016-05-13 18:31:29 +02:00
Andy Wingo
17f90360b6 Make scm_t_ptob_descriptor private.
* libguile/goops.c: Use port internals header.
* libguile/ports-internal.h (scm_t_port_type_flags)
  (struct scm_t_ptob_descriptor): Make private.
* libguile/ports.h: Adapt.
2016-05-13 17:14:59 +02:00
Andy Wingo
af1c443f83 Update port documentation
* doc/ref/api-io.texi: Update for refactorings.
2016-05-13 16:48:02 +02:00
Andy Wingo
08574987d9 Remove scm_t_port_internal
* libguile/ports-internal.h (SCM_PORT): Rename from SCM_PTAB_ENTRY.
  (scm_t_port_internal, SCM_PORT_GET_INTERNAL): Remove.
  (SCM_FILENAME, SCM_SET_FILENAME, SCM_LINUM, SCM_COL): Adapt.
* libguile/ports.c:
* libguile/poll.c:
* libguile/ioext.c:
* libguile/fports.c:
* libguile/filesys.c:
* libguile/print.c:
* libguile/read.c:
* libguile/rw.c:
* libguile/strings.c: Adapt.
2016-05-13 11:34:52 +02:00
Andy Wingo
e5d2f4e566 Make scm_t_port private
* libguile/ports-internal.h (enum scm_port_encoding_mode): Remove unused
  enum.
  (scm_t_port_internal, scm_t_port): Make encoding and
  conversion_strategy private. Instead of scm_t_port_internal containing
  scm_t_port, now that all members are private, we can store the user's
  "stream" in a word in the port object itself and make the whole of
  scm_t_port private.  The next commit will remove scm_t_port_internal.
  (SCM_PTAB_ENTRY, SCM_PORT_DESCRIPTOR): Make private.
* libguile/ports.c (scm_c_make_port_with_encoding): Adapt to new port
  layout.
  (scm_port_print): Use SCM_PTAB_ENTRY when printing.
* libguile/ports.h: Remove scm_t_port definition.
* libguile/ioext.c (get_matching_port): Simplify.
* libguile/fports.c (scm_i_evict_port): Simplify.
2016-05-13 11:27:37 +02:00
Andy Wingo
9a9e0cceae Make port buffering fields private
* libguile/ports-internal.h (enum scm_port_buffer_field)
  (scm_t_port_internal): Make port buffering fields private.
* libguile/ports.h (scm_t_port): Adapt.
* libguile/filesys.c (set_element):
* libguile/ioext.c (scm_redirect_port):
* libguile/poll.c (scm_primitive_poll):
* libguile/ports.c:
* libguile/read.c (scm_i_scan_for_encoding):
* libguile/rw.c (scm_write_string_partial): Adapt users.
2016-05-13 10:58:19 +02:00