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

1802 commits

Author SHA1 Message Date
Daniel Llorens
d41d5bf05e Test that typed-array? returns #f with non-array argument
* test-suite/tests/arrays.test: ditto.
2014-02-09 12:55:49 +01:00
Daniel Llorens
8269f0be18 Fix array map functions with empty arguments
* libguile/array-map.c
  - scm_ra_matchp: look for empty axes and return new case 5 if so. Use
    array handles to remove the SCM_I_ARRAYP / not branch.
  - scm_ramapc: Heed case 5.
* test-suite/tests/ramap.test
  - test empty arguments for array-copy! and array-for-each. Note those
    that failed in 2.0.9.
2014-02-09 12:48:21 +01:00
Daniel Llorens
b0d9b0744a Fix empty array bug in array-index-map!
* libguile/array-map.c: (scm_array_index_map_x): bail out if any one of the
  axes is empty.
* test-suite/tests/ramap.test: add tests for empty array-case of
  array-index-map!. The 'f64 case with not-last emtpy axis is broken in 2.0.9.
2014-02-09 12:48:19 +01:00
Daniel Llorens
d747313100 Change uses of scm_is_simple_vector to scm_is_vector
* libguile/filesys.c, libguile/random.c, libguile/stime.c, libguile/trees.c,
  libguile/validate.h: use scm_is_vector instead of scm_is_simple_vector.
* libguile/sort.c (scm_sort_x, scm_sort, scm_stable_sort_x)
  (scm_stable_sort): Remove scm_is_vector check; scm_is_array is
  sufficient.
* test-suite/tests/arrays.test: Fix header.
* test-suite/tests/random.test: New coverage test covering
  random:normal-vector!.
* test-suite/Makefile.am: Include random.test in make check.
2014-02-08 18:26:49 +01:00
Andy Wingo
8051cf2304 Merge commit 'fb7dd00169'
This commit also renames uniform-vector-element-type-code to
array-type-code.

Conflicts:
	libguile/uniform.c
	libguile/uniform.h
	test-suite/tests/arrays.test
2014-02-08 15:31:37 +01:00
Andy Wingo
c8b7b0dad3 Merge commit 'b9b88351ea'
Conflicts:
	libguile/deprecated.h
	test-suite/tests/00-socket.test
2014-02-08 14:55:16 +01:00
Andy Wingo
12b8487d5d Merge commit '0ce224594a' 2014-02-08 14:48:56 +01:00
Andy Wingo
fb7dd00169 Deprecate general "uniform-vector" interface
* libguile/uniform.h:
* libguile/uniform.c (scm_is_uniform_vector, scm_uniform_vector_p)
  (scm_c_uniform_vector_length, scm_uniform_vector_length)
  (scm_uniform_vector_element_type, scm_uniform_vector_element_size)
  (scm_c_uniform_vector_ref, scm_uniform_vector_ref):
  (scm_c_uniform_vector_set_x, scm_uniform_vector_set_x):
  (scm_uniform_vector_to_list)
  (scm_uniform_vector_elements, scm_uniform_vector_writable_elements):
  Deprecate.  This interface lacked both generality and specificity.
  The general replacement is array-length, array-ref, and friends on the
  scheme side, or the array handle interface on the C side.  On the
  specific side of things, there are the specific bytevector, srfi-4,
  and bitvector interfaces.

* test-suite/tests/arrays.test:
* test-suite/tests/bitvectors.test:
* test-suite/tests/ports.test:
* test-suite/tests/srfi-4.test: Update to use array interfaces.

* doc/ref/api-foreign.texi (Void Pointers and Byte Access):
* doc/ref/srfi-modules.texi (SRFI-4): Update.
2014-02-08 14:28:07 +01:00
Andy Wingo
b9b88351ea Deprecate htons, htonl, ntohs, ntohl
* libguile/sockets.h:
* libguile/sockets.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_htons, scm_htonl, scm_ntohs, scm_ntohl):
  Deprecate.  Bytevectors adequately subsume their functionality.

* doc/ref/posix.texi:
* test-suite/tests/00-socket.test: Update.
2014-02-08 14:28:07 +01:00
Mark H Weaver
0ce224594a Improve handling of locales in the test suite.
* test-suite/guile-test (run-tests): Load each test file within
  (with-locale "C" ...).

* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
  the previous locale.

* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
  calling it.
2014-02-07 21:49:35 -05:00
Andy Wingo
9db57a19e1 Merge commit '9b5da400dd'
Conflicts:
	libguile/vectors.c
	test-suite/tests/weaks.test
2014-02-07 15:36:06 +01:00
Andy Wingo
b00c9b2214 Merge commit '866af5da3d'
Removes the special arity handler, and instead relies on the procedure
returning the correct number of values.
2014-02-07 15:24:43 +01:00
Andy Wingo
cd36c69619 Merge commit '34e8987734'
Conflicts:
	module/Makefile.am
2014-02-07 15:13:22 +01:00
Andy Wingo
ae7f13be4b Merge commit 'ca5e0414e9'
Conflicts:
	module/language/tree-il/primitives.scm
2014-02-07 15:05:55 +01:00
Andy Wingo
0dbc5e571a Merge commit '45a28515c1' 2014-02-07 14:43:42 +01:00
Andy Wingo
7d484bfa15 Merge commit 'a5cbbaa66a' 2014-02-07 14:43:23 +01:00
Andy Wingo
e4eb0e39b4 Merge commit '8ca97482b0'
Conflicts:
	libguile/r6rs-ports.c
2014-02-07 14:42:40 +01:00
Andy Wingo
e140d85d53 Merge commit '122f24cc8a'
Conflicts:
	libguile/fports.c
	libguile/ports.c
2014-02-07 14:39:01 +01:00
Andy Wingo
9b5da400dd Deprecate vector-ref, vector-length, vector-set! on weak vectors
* libguile/vectors.c (scm_vector_length, scm_c_vector_length):
  (scm_c_vector_ref, scm_c_vector_set_x): Deprecate the use of these
  procedures on weak vectors.

* test-suite/tests/guardians.test:
* test-suite/tests/weaks.test: Adapt test suites.
2014-02-07 12:42:44 +01:00
Daniel Llorens
69843ac1b9 Reorder arrays.test
* test-suite/tests/arrays.test: dependence reordering: first sanity, then
  make-array, then array-equal?, then make-shared-array, shared-array-root,
  then the rest, many of which use make-shared-array.
2014-02-06 21:40:38 +01:00
Daniel Llorens
a6f8d3ddd8 Don't use scm_is_generalized_vector in transpose-array
* libguile/arrays.c (scm_transpose_array)
  - Use scm_c_array_rank(), which contains an implicit is_array test.
  - Handle the rank 0 case.
* test-suite/tests/arrays.test
  - Add test for rank 0 case.
  - Add failure test for non array argument.
2014-02-06 21:40:38 +01:00
Daniel Llorens
ee23869521 Tests for transpose-array
* test-suite/tests/arrays.test: test transpose-array for ranks 1, 2, 3.
2014-02-06 21:40:38 +01:00
Daniel Llorens
1080ce25bc Tests for shared-array-root
* test-suite/tests/arrays.test: check shared-array-root against
  make-shared-array, array-contents.
2014-02-06 21:40:38 +01:00
Daniel Llorens
c4aca3b9da Don't use generalized-vector functions in uniform.c
* libguile/uniform.c (scm_is_uniform_vector): Replace
  scm_is_generalized_vector and scm_generalized_vector_get_handle by
  scm_is_array and manual rank check.
  (scm_c_uniform_vector_length): Use scm_c_array_length.
  (scm_c_uniform_vector_ref): Use scm_c_array_ref_1.
  (scm_c_uniform_vector_set): Use scm_c_array_set_1_x.
  (scm_uniform_vector_writable_elements): Use scm_array_get_handle, and
  assert that the rank is 1.

* test-suite/test/arrays.test: Rename the uniform-vector-ref block to
  uniform-vector.  Exercise uniform-vector-length and shared arrays
  remaining uniform.

Modifications by Andy Wingo <wingo@pobox.com>.
2014-02-06 11:17:47 +01:00
Daniel Llorens
7e7e3b7f06 Tests for array-copy!, empty case
* test-suite/tests/ramap.test: test array-copy! with empty destination.
  Fix uses of constant array as destination.
2014-02-06 10:44:02 +01:00
Mark H Weaver
48eb902119 Implement R7RS 'define-values'.
* module/ice-9/boot-9.scm (%define-values-arity-error): New procedure.
  (define-values): New macro.

* doc/ref/api-binding.texi (Binding Multiple Values): Add docs.

* test-suite/tests/syntax.test: Add tests.
2014-02-02 03:28:23 -05:00
Mark H Weaver
34e8987734 Implement SRFI-64 - A Scheme API for test suites.
* module/srfi/srfi-64.scm: New file.
* module/srfi/srfi-64/testing.scm: New file.
* module/Makefile.am: Add rule for srfi-64.go dependency on
  srfi-64/testing.scm.
  (SRFI_SOURCES): Add srfi/srfi-64.scm.
  (NOCOMP_SOURCES): Add srfi/srfi-64/testing.scm.
* doc/ref/srfi-modules.texi (SRFI-64): New node.
* test-suite/tests/srfi-64.test: New file.
* test-suite/tests/srfi-64-test.scm: New file.
* test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-64.test.
  (EXTRA_DIST): Add tests/srfi-64-test.scm.
2014-02-01 01:19:55 -05:00
Mark H Weaver
9060dc29d5 Implement SRFI-43 Vector Library.
* module/srfi/srfi-43.scm: New file.
* module/Makefile.am (SRFI_SOURCES): Add module/srfi/srfi-43.scm.
* test-suite/tests/srfi-43.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add test-suite/tests/srfi-43.test.
* doc/ref/srfi-modules.texi (SRFI-43, SRFI-43 Constructors)
  (SRFI-43 Predicates, SRFI-43 Selectors, SRFI-43 Iteration)
  (SRFI-43 Searching, SRFI-43 Mutators, SRFI-43 Conversion): New nodes.
2014-02-01 01:19:49 -05:00
Mark H Weaver
3e2e49650c Implement SRFI-111 Boxes.
* module/srfi/srfi-111.scm: New file.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-111.scm.
* test-suite/tests/srfi-111.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-111.test.
* doc/ref/srfi-modules.texi (SRFI-111): New node.
2014-01-24 10:50:51 -05:00
Ludovic Courtès
45a28515c1 Buffered custom binary input ports correctly handle partial read requests.
* libguile/r6rs-ports.c (cbip_fill_input): Always initialize 'read_pos'
  when BUFFERED.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port buffered partial reads"]: New test.
2014-01-21 23:39:53 +01:00
Mark H Weaver
d0d8c872af Write out HTTP Basic auth headers correctly.
Fixes <http://bugs.gnu.org/14370>.
Reported by Atom X Zane <atomx@deadlyhead.com>.

* module/web/http.scm (write-credentials): Handle the Basic auth scheme
  correctly.

* test-suite/tests/web-http.test (pass-if-round-trip): Use
  'pass-if-equal' for better error reporting.
  ("request headers"): Add tests.

* THANKS: Add "Atom X Zane" to bug fix section.
2014-01-21 16:11:04 -05:00
Mark H Weaver
ba578eb044 Merge branch 'stable-2.0'
Conflicts:
	libguile/read.c
	test-suite/tests/web-response.test
2014-01-21 03:57:04 -05:00
Andy Wingo
6f4cc6a31e Add support for content-disposition
* module/web/http.scm ("Content-Disposition"): Add a parser and
  serializer.  Defined in RFC2616 section 19.5.1.

* test-suite/tests/web-http.test ("entity headers"): New test case.
2014-01-20 19:03:58 -05:00
Ludovic Courtès
8ca97482b0 Custom binary input ports support 'setvbuf'.
* libguile/r6rs-ports.c (CBIP_BUFFER_SIZE): Adjust comment.  Set to 8KiB.
  (SCM_SET_CBIP_BYTEVECTOR): New macro.
  (cbip_setvbuf): New function.
  (make_cbip): Set PORT's 'setvbuf' internal field.
  (cbip_fill_input): Check whether PORT is buffered.  When unbuffered,
  check whether BV can hold C_REQUESTED bytes, and allocate a new
  bytevector if not; copy the data back from BV to c_port->read_pos.
  Remove 'again' label, and don't loop there.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port unbuffered & 'port-position'", "custom binary input port
  unbuffered & 'read!' calls", "custom binary input port, unbuffered
  then buffered", "custom binary input port, buffered then unbuffered"]:
  New tests.
* doc/ref/api-io.texi (R6RS Binary Input): Document the buffering of
  custom binary input ports, and link to 'setvbuf'.
2014-01-18 22:52:07 +01:00
Ludovic Courtès
122f24cc8a Prepare 'setvbuf' to support for non-file ports.
* libguile/ports-internal.h (struct scm_port_internal): Add
  setvbuf' field.  Change 'pending_eof' to a 1-bit unsigned char.
* libguile/ports.c (scm_new_port_table_entry): Clear 'pti->setvbuf'.
* libguile/fports.c (scm_setvbuf): Accept any open port, and error out
  when PORT's setvbuf' field is NULL.  Remove explicit 'scm_gc_free' calls.
  (scm_i_fdes_to_port): Set PORT's 'setvbuf' field.
* test-suite/tests/ports.test ("setvbuf")["closed port", "string port"]:
  New tests.
* doc/ref/posix.texi (Ports and File Descriptors): Suggest that
  'setvbuf' works for different port types.
2014-01-18 22:52:07 +01:00
Andy Wingo
97461d739b Add support for content-disposition
* module/web/http.scm ("Content-Disposition"): Add a parser and
  serializer.  Defined in RFC2616 section 19.5.1.

* test-suite/tests/web-http.test ("entity headers"): New test case.
2014-01-18 21:08:52 +01:00
Ludovic Courtès
3ff8a9d6ff Arrange so that 'file-encoding' does not truncate the encoding name.
Fixes <http://bugs.gnu.org/16463>.
Reported by Sree Harsha Totakura <sreeharsha@totakura.in>.

* libguile/read.c (ENCODING_NAME_MAX_SIZE): New macro.
  (SCM_ENCODING_SEARCH_SIZE): Change to 500 + ENCODING_NAME_MAX_SIZE.
  (scm_i_scan_for_encoding): Return NULL if there's less than
  ENCODING_NAME_MAX_SIZE bytes once "coding: *" has been read.
* test-suite/tests/coding.test ("line
  comment")["http://bugs.gnu.org/16463"]: New test.
2014-01-17 18:18:41 +01:00
Ludovic Courtès
802a25b1ed web: Don't throw if a response is longer than its Content-Length says.
* module/web/response.scm (make-delimited-input-port): Read at most LEN
  bytes from PORT, instead of trying to read more and returning an error
  if more is available.  Try again when 'get-bytevector-n!' return zero.
* test-suite/tests/web-response.test (example-1): Add garbage after the
  body itself.
2014-01-15 23:41:49 +01:00
Ludovic Courtès
6df0322212 Custom binary input ports sanity-check the return value of 'read!'.
* libguile/r6rs-ports.c (cbip_fill_input): Throw an exception when
  C_OCTETS is greater than what was requested.
* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary
  input port 'read!' returns too much"]: New test.
2014-01-15 23:41:49 +01:00
Mark H Weaver
2d6a3144a1 Document that we support srfi-46 and add it to %cond-expand-features.
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-46.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-46 to the list of core
  features.
  (SRFI-46): New node.

* doc/ref/api-macros.texi (Syntax Rules): Mention that the custom
  ellipsis identifier support is specified by SRFI-46.

* test-suite/tests/syntax.test ("syntax-rules"): Add ellipsis hygiene
  test from SRFI-46.
2014-01-15 03:21:07 -05:00
Mark H Weaver
fb484fefeb Merge branch 'stable-2.0' 2014-01-14 23:53:08 -05:00
Mark H Weaver
1fc651e3a5 print: In R7RS |...| symbols, print most graphic characters unescaped.
* libguile/print.c (print_r7rs_extended_symbol): Print any unicode
  graphic character other than '|' or '\' unescaped.  Escape any spacing
  character other than ASCII space.
2014-01-14 23:46:45 -05:00
Mark H Weaver
c92ee2b38c Merge branch 'stable-2.0'
Conflicts:
	libguile/print.c
	libguile/read.c
	test-suite/tests/print.test
2014-01-14 22:23:39 -05:00
Mark H Weaver
6e504a7b44 print: Support R7RS |...| symbol notation.
* libguile/print.c (scm_print_opts): Add 'r7rs-symbols' print option.
  (symbol_has_extended_read_syntax): If the 'r7rs-symbols' option is
  enabled, then disallow '|' and '\' from bare symbols.
  (print_extended_symbol): Use 'scm_lfwrite' and 'scm_putc' instead of
  'display_string' and 'display_character' when printing ASCII literals.
  (print_r7rs_extended_symbol): New static function.
  (scm_i_print_symbol_name): If the 'r7rs-symbols' option is enabled,
  use 'print_r7rs_extended_symbol' instead of 'print_extended_symbol'.

* libguile/private-options.h (SCM_PRINT_R7RS_SYMBOLS_P): New macro.
  (SCM_N_PRINT_OPTIONS): Increment.

* doc/ref/api-evaluation.texi (Scheme Write): Mention 'r7rs-symbols'
  print option.

* test-suite/tests/print.test ("write"): Add tests.
2014-01-14 20:30:24 -05:00
Mark H Weaver
dc59631d30 read: Support R7RS |...| symbol notation.
* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
  (SCM_N_READ_OPTIONS): Increment.

* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
  (t_read_opts): Add field for 'r7rs_symbols_p'.
  (scm_read_string_like_syntax): New function based on earlier
  'scm_read_string' that handles either string literals or R7RS quoted
  symbols (delimited by vertical bars), depending on the value of 'chr'.
  (scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
  (scm_read_r7rs_symbol): New static function.

* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
  symbol syntax, mention the 'r7rs-symbols' read option, and give some
  examples.

* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
  read option.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 20:23:21 -05:00
Mark H Weaver
cb8aaef4d0 Merge branch 'stable-2.0'
Conflicts:
	libguile/chars.c
	libguile/read.c
	test-suite/tests/reader.test
2014-01-14 03:18:34 -05:00
Mark H Weaver
394449d5d3 Recognize 'escape' character name, per R7RS.
* libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums):
  New static constants.
  (SCM_N_R7RS_CHARNAMES): New macro.
  (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS
  char names.

* doc/ref/api-data.texi (Characters): Document #\escape.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 02:24:44 -05:00
Mark H Weaver
6579c3308d read: Accept "\|" in string literals.
* libguile/read.c (scm_read_string): Accept "\|" in string literals.

* doc/ref/api-data.texi (String Syntax): Add "\|" to the list of
  supported backslash escapes.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 02:24:37 -05:00
Mark H Weaver
7a329029cf read: Support R7RS '#true' and '#false' syntax for booleans.
* libguile/read.c (try_read_ci_chars): New static function.
  (scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'.

* doc/ref/api-data.texi (Booleans): Update docs.

* test-suite/tests/reader.test ("reading"): Add tests.
2014-01-14 02:24:24 -05:00
Mark H Weaver
b958141cdb Merge branch 'stable-2.0'
Conflicts:
	libguile/hash.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/tests/r6rs-ports.test
2014-01-14 01:30:56 -05:00