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

1731 commits

Author SHA1 Message Date
Andy Wingo
7081d4f981 rename <application> to <call>
* doc/ref/compiler.texi (The Scheme Compiler): Update docs.

* libguile/expand.h:
* libguile/expand.c:
* module/language/tree-il.scm: Rename <application> to <call>.  Change
  the external representation from (apply proc arg ...) to (call proc
  arg ...).

* libguile/memoize.c:
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm:
* module/language/brainfuck/compile-tree-il.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/inline.scm:
* module/language/tree-il/primitives.scm:
* test-suite/tests/tree-il.test: Update all callers.
2011-06-02 13:42:55 +02:00
Andy Wingo
d31d703fd4 Merge remote-tracking branch 'origin/stable-2.0' 2011-05-30 11:50:38 +02:00
Andreas Rottmann
0687e826a1 rnrs io ports: fix port encoding when opening file ports
* module/rnrs/io/ports.scm (open-file-input-port)
  (open-file-output-port): Ensure the resulting ports are binary when no
  transcoder is specified.

* test-suite/tests/r6rs-ports.test: Remove superfluous global change of
  `%default-port-encoding' and accompanying comment.
  ("7.2.7 Input Ports"): Add test ensuring `open-file-input-port' opens
  a binary port when no transcoder is specified.
  ("8.2.10 Output ports"): Strengthen existing `open-file-output-port'
  binary-ness test by setting `%default-port-encoding' to "UTF-8".
2011-05-27 15:32:01 +02:00
Andreas Rottmann
dfc4d56df1 Add some tests for the R6RS I/O libraries
* test-suite/tests/r6rs-ports.test
  (call-with-bytevector-output-port/transcoded): New helper procedure.
  ("8.2.6 Input and output ports"): Use that helper procedure.
  (encoding-error-predicate): New helper procedure.
  ("8.2.12 Textual Output"): Add tests for `put-char' and `put-string'
  exception behavior on encoding errors.
2011-05-27 14:48:31 +02:00
Neil Jerram
6b4b4bfb09 Implement #:stop-at-first-non-option option for getopt-long
(For use by guile-tools)

* module/ice-9/getopt-long.scm: Use (ice-9 optargs) so we can use
  define*.

  (process-options): Add stop-at-first-non-option parameter.  When
  this is true, stop processing when we hit a non-option (so long as
  that non-option isn't something that resulted from the unclumping of
  a short option group).

  (getopt-long): Add #:stop-at-first-non-option keyword; pass it on to
  process-options.

* test-suite/tests/getopt-long.test ("stop-at-first-non-option"): New
  test (for the above).
2011-05-26 17:58:18 +01:00
Neil Jerram
ec7ea550f2 Fix "occurrances" typos in getopt-long code and test
* module/ice-9/getopt-long.scm (process-options, getopt-long): Change
  to "occurrences".

* test-suite/tests/getopt-long.test ("multiple occurrences"): Same
  again.
2011-05-26 17:58:18 +01:00
Andy Wingo
a099c8d971 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/procprop.c
2011-05-25 10:32:19 +02:00
Andy Wingo
7ad0737de9 out-of-tree build fix
* test-suite/standalone/Makefile.am (GUILE_AUTO_COMPILE): Add srcdir to
  the environment.
* test-suite/standalone/test-import-order: Look for the modules in the
  srcdir.  Fixes out-of-tree builds.
2011-05-25 10:27:46 +02:00
Andy Wingo
ad4bd7c2c0 fix define-module ordering
* module/ice-9/boot-9.scm (define-module): Fix to load the #:use-module
  clauses in the order in which they appear in the define-module form.
  Thanks to Jan Nieuwenhuizen for the report.

* test-suite/standalone/test-import-order: Add new test that
  define-module and use-modules resolve the interface in the right
  order.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-import-order-a.scm:
* test-suite/standalone/test-import-order-b.scm:
* test-suite/standalone/test-import-order-c.scm:
* test-suite/standalone/test-import-order-d.scm: Aux files.
2011-05-21 18:29:03 +02:00
Andy Wingo
a1a3a0dd5d regexp.test needed char-code-limit
* test-suite/tests/regexp.test (char-code-limit): Define a local version
  of this recently removed definition.  Hopefully that's the only use
  of it though!
2011-05-15 17:29:46 +02:00
Andy Wingo
4f1ce27a36 remove SCM_I_LLONG and SCM_I_ULLONG limit defines
* test-suite/standalone/test-num2integral.c (test_long_long):
  (test_ulong_long): Replace SCM_I_LLONG and SCM_I_ULLONG defines with
  their counterparts from limits.h.

* libguile/__scm.h: Remove SCM_I_LLONG and SCM_I_ULLONG limit defines.
2011-05-15 15:34:15 +02:00
Andy Wingo
6bc898466b fix type errors in test suite
* test-suite/standalone/test-num2integral.c (out_of_range_handler): Fix
  SCM used as a truth value.
* test-suite/standalone/test-scm-spawn-thread.c (inner_main): Use
  SCM2PTR here.
2011-05-15 15:34:14 +02:00
Andreas Rottmann
b6a66c21fc Improve R6RS conformance wrt. conditions in the I/O libraries
* module/rnrs/io/ports.scm (open-file-output-port): Handle `no-fail'
  file option.
  (with-i/o-filename-conditions): Use `with-throw-handler' instead of `catch'.
  (with-i/o-port-error,
  with-textual-output-conditions. with-textual-input-conditions): New
  exception-conversion helpers.
  (put-char, put-datum, put-string, display): Use
  `with-textual-output-conditions' instead of `with-i/o-encoding-error'
  to get proper conditions in case of write errors.
  (get-char, get-datum, get-line, get-string-all, lookahead-char):
  Likewise, for the input case.

* test-suite/tests/r6rs-ports.test (pass-if-condition, test-file,
  make-failing-port): New helpers.
  ("8.2.10 Output ports"): Add some tests for `open-file-output-port'.
  ("8.2.9 Textual Input"): Add tests read error conditions.
  ("8.2.12 Textual Output"): Add tests for write error conditions.
  ("8.3 Simple I/O"): Add tests for conditions, `call-with-input-file'
  and `call-with-output-file'.
2011-05-14 19:29:26 +02:00
Andy Wingo
e690a3cbf2 Merge remote-tracking branch 'origin/stable-2.0' 2011-05-09 00:13:04 +02:00
Ludovic Courtès
19301dc56d Add `vhash-fold-right'.
* module/ice-9/vlist.scm (vhash-fold-right): New procedure.

* test-suite/tests/vlist.test ("vhash")["vhash-fold-right"]: New test.

* doc/ref/api-compound.texi (VHashes): Document `vhash-fold-right'.
2011-05-08 18:20:42 +02:00
Andy Wingo
10483f9e64 fix `hash' for inf and nan
* libguile/hash.c (scm_hasher): Fix to work on inf and nan.
* test-suite/tests/hash.test ("hash"): Add tests.
2011-05-08 16:07:10 +02:00
Ludovic Courtès
7be1705dbd Fix `get_utf8_codepoint' to not consume valid starting bytes.
Thanks to Mark H. Weaver for pointing this out.

* libguile/ports.c (CONSUME_PEEKED_BYTE): New macro.
  (get_utf8_codepoint): New variable `pt'.  Use
  `scm_peek_byte_or_eof'/`CONSUME_PEEKED_BYTE' pairs instead of
  `scm_get_byte_or_eof'.

* test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42, #xe0 #xa0
  #x41 #x42, #xf0 #x88 #x88 #x88]: Fix to conform to Unicode 6.0.0.
  [#xe0 #x88 #x88]: Remove test.
  [#xf0 #x80 #x80 #x41]: New test.
2011-05-07 22:47:49 +02:00
Ludovic Courtès
7b292a9d34 Special-case UTF-8 ports to bypass `iconv' entirely.
* libguile/ports.c (update_port_lf): Handle EOF.
  (get_utf8_codepoint, get_iconv_codepoint): New functions.
  (get_codepoint): Use them.
  (scm_i_set_port_encoding_x): Don't open conversion descriptors when
  ENCODING is "UTF-8".

* libguile/print.c (display_string_as_utf8, display_string_using_iconv):
  New functions.
  (display_string): Use them.

* test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42]: Add a
  note that this is not the wrong behavior per Unicode 6.0.0.
2011-05-06 17:54:09 +02:00
Ludovic Courtès
1f78c6691f Fix `foreign.test' for big endian machines.
* test-suite/tests/foreign.test ("pointer<->bytevector")["pointer from
  bits", "dereference-pointer"]: Fix iteration order for big endian
  machines.
2011-05-06 17:43:37 +02:00
Andy Wingo
5eb75b5de0 Merge remote-tracking branch 'origin/stable-2.0' 2011-05-06 00:18:52 +02:00
Andy Wingo
a2230b653b map and for-each in scheme
* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead
  of C.  There are boot versions before `cond' is defined.
  (map-in-order): Define this alias here instead of in evalext.h.

* libguile/eval.c: Stub out the map and for-each definitions to just
  call into Scheme.

* libguile/evalext.c: Remove map-in-order definition.

* module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map.
  (map, for-each): Define implementations here, in Scheme, instead of in
  C.

* test-suite/tests/eval.test (exception:wrong-length, "map"): Update the
  expected exception for mapping over lists of different lengths.

* libguile/srfi-1.h:
* libguile/srfi-1.c: Remove map and for-each definitions.  Remove the
  bit that extended the core `map' primitive with another method: the
  right way to do that is with modules.
2011-05-05 23:07:37 +02:00
Ludovic Courtès
3009b93e9b Generate escape' and substitute' port decoding tests. 2011-05-05 17:56:47 +02:00
Andy Wingo
891a1851a1 Merge remote-tracking branch 'origin/stable-2.0' 2011-05-05 14:09:29 +02:00
Andy Wingo
89f9dd7065 speed up compile-bytecode
* module/language/assembly/compile-bytecode.scm (compile-bytecode):
  Rewrite to fill a bytevector directly, instead of using bytevector
  ports.  `write-bytecode' itself is still present and almost the same
  as before; it's just that `write-byte' et al now inline the effect of
  writing a byte to a binary port.

* test-suite/tests/asm-to-bytecode.test (comp-test): Refactor to use
  public interfaces.
2011-05-05 11:43:12 +02:00
Ludovic Courtès
e6e286bb58 Automatically generate `peek-char' decoding error tests.
* test-suite/tests/ports.test ("string ports")[make-peek+read-checks]:
  New macro.
  [test-decoding-error]: Change to take a list of expected characters or
  conditions.  Use `make-peek+read-checks' to generate a `peek-char'
  test.
  [(#xc2 #x41 #x42), (#xe0 #xa0 #x41 #x42)]: New tests.
2011-05-04 23:52:53 +02:00
Andy Wingo
1903eae4c9 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
2011-04-28 15:53:35 +02:00
Andy Wingo
91956a94fe allow while as an expression
* module/ice-9/boot-9.scm (while): Specify the return value as #f under
  normal conditions, #t under (break), and arg... under (break arg...).
* test-suite/tests/syntax.test ("while"): Test.
* doc/ref/api-control.texi (while do): Document.
2011-04-28 15:48:35 +02:00
Andy Wingo
18e444b40e add reset and shift
* module/ice-9/control.scm (reset, shift): Add implementations of these
  operators from Wolfgang J Moeller, derived from implementations by
  Oleg Kiselyov.
  (reset*, shift*): Procedural variants.

* test-suite/tests/control.test ("shift and reset"): Add tests,
  originally from Oleg Kiselyov.
2011-04-28 15:48:28 +02:00
Ludovic Courtès
4cadf64f9a Add tests for UTF-8 ill-formed sequence handling.
* test-suite/tests/ports.test ("string ports"): Add for
  `test-decoding-error' tests for ill-formed UTF-8 sequences.  Thanks
  to Mark H Weaver <mhw@netris.org> for pointing this out.
2011-04-27 21:55:42 +02:00
Ludovic Courtès
a42d79711b Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'.
* libguile/ports.c (get_codepoint): Return EILSEQ when OUTPUT_SIZE == 0.

* test-suite/tests/ports.test ("string ports"): Add 2 tests for
  unterminated sequences.
2011-04-27 20:34:08 +02:00
Ludovic Courtès
d84783a80c Add a couple more Unicode I/O tests.
* test-suite/tests/ports.test ("string ports")["%default-port-encoding
  is honored"]: Make sure `(port-encoding p)' is as expected.
  ["peek-char [utf-16]"]: New test.
2011-04-27 16:28:32 +02:00
Ludovic Courtès
9a201881e6 Rewrite port decoding error tests using a mini DSL.
* test-suite/tests/ports.test ("string ports")[test-decoding-error]: New
  macro.
  ["read-char, wrong encoding, error", "read-char, wrong encoding,
  escape", "read-char, wrong encoding, substitute", "peek-char, wrong
  encoding, error"]: Rewrite using `test-decoding-error'.
2011-04-27 16:28:29 +02:00
Ludovic Courtès
7c86abd9ce Use scm_with_guile' in test-pthread-create'.
* test-suite/standalone/test-pthread-create.c (inner_main): New
  function.
  (main): Call it within `scm_with_guile', instead of using
  `scm_init_guile'.  This improves portability--e.g.,
  `GC_get_stack_base', used by `scm_init_guile', failed on Darwin
  up to BDW-GC 7.1alpha4 included (thanks, Mark, for the hint.)
2011-04-25 23:59:42 +02:00
Ludovic Courtès
eb0ffdd819 Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.
* test-suite/standalone/test-asmobs-lib.c,
  test-suite/standalone/test-extensions-lib.c,
  test-suite/standalone/test-ffi-lib.c,
  test-suite/standalone/test-list.c,
  test-suite/standalone/test-num2integral.c,
  test-suite/standalone/test-with-guile-module.c: Change `#ifndef
  HAVE_CONFIG_H' to `#ifdef HAVE_CONFIG_H' (!).
2011-04-25 23:59:35 +02:00
Ludovic Courtès
d20912e67d Move {total,current}-processor-count' outside of posix.c'.
* libguile/posix.c (scm_total_processor_count,
  scm_current_processor_count): Move to...
* libguile/threads.c: ... here.

* libguile/posix.h (scm_total_processor_count,
  scm_current_processor_count): Move declarations to...
* libguile/threads.h: ... here.

* test-suite/tests/posix.test ("nproc"): Move tests to...
* test-suite/tests/threads.test: ... here.
2011-04-25 22:41:58 +02:00
Ludovic Courtès
4a23562339 Add pthread-related tests.
* test-suite/standalone/Makefile.am (test_scm_spawn_thread_CFLAGS,
  test_scm_spawn_thread_LDADD, test_pthread_create_CFLAGS,
  test_pthread_create_LDADD, test_pthread_create_secondary_CFLAGS,
  test_pthread_create_secondary_LDADD): New variables.
  (check_PROGRAMS)[BUILD_PTHREAD_SUPPORT]: Add `test-scm-spawn-thread',
  `test-pthread_create', `test-pthread_create-secondary'.
  (TESTS)[BUILD_PTHREAD_SUPPORT]: Likewise.

* test-suite/standalone/test-scm-spawn-thread.c,
  test-suite/standalone/test-pthread-create.c,
  test-suite/standalone/test-pthread-create-secondary.c: New files.
2011-04-25 16:45:24 +02:00
Ludovic Courtès
96128014bf Make sure binary ports pass `binary-port?' regardless of the locale.
* 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-04-22 23:58:00 +02:00
Ludovic Courtès
ed756f7817 Increase the timeout of timing-sensitive thread tests.
* test-suite/tests/threads.test ("timed locking succeeds if mutex
  unlocked within timeout", "timed unlocking returns #t if condition
  signaled", "timed joining succeeds if thread exits within timeout"):
  Increase the timeout.  Reported by Dale P. Smith <dsmich@roadrunner.com>.
2011-04-22 16:59:05 +02:00
Ludovic Courtès
022ae742d1 Add tests for `-Wformat' and gettext.
* test-suite/tests/tree-il.test ("warnings")["non-literal format string
  using gettext", "one missing argument, gettext"]: New tests.
2011-04-14 23:14:14 +02:00
Andy Wingo
21c05db45b Merge remote branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	test-suite/tests/srfi-4.test
2011-04-11 23:30:52 +02:00
Ian Price
c89b452993 Fix fencepost error in bip_seek
* libguile/r6rs-ports.c (bip_seek): Fix to allow seeking to end of port.

* test-suite/tests/r6rs-ports.test ("bytevector input port can seek to
  very end"): Add tests.
2011-04-11 18:14:18 +02:00
Ian Price
15993bce1c fix assert to return true value.
* module/rnrs/base.scm (assert): returns value instead of void.

* test-suite/tests/r6rs-base.test ("assert"): add test cases.
2011-04-11 18:00:36 +02:00
Ian Price
cf9d4a8214 Added optional second arg to R6RS log function
* module/rnrs/base.scm (log): now takes a base argument, using the
  change of base formula for logs.
* test-suite/tests/r6rs-base.test ("log (2nd arg)"): Add test cases.
2011-04-11 17:58:12 +02:00
Andy Wingo
62ef23cbb8 fix reader.test for --disable-deprecated
* test-suite/tests/reader.test: Fix deprecated tests; begin-deprecated
  was splicing in expression context before, which is a no-no.
2011-04-11 17:21:20 +02:00
Andy Wingo
2e9fc9fc73 symbols with odd characters print better in #{}#
* libguile/print.c (symbol_has_extended_read_syntax): Use a more
  general, unicode-appropriate algorithm.  Hopefully doesn't cause
  any current #{}# cases to be unescaped.
  (print_extended_symbol): Use more appropriate unicode algorithm, and
  emit unicode hex escapes instead of our own lame escapes.

* test-suite/tests/symbols.test: Add tests.
2011-04-11 13:48:11 +02:00
Andy Wingo
d9527cfafd read-extended-symbol handles backslash better, including r6rs hex escapes
* libguile/read.c (scm_read_extended_symbol): Interpret '\' as an escape
  character.  Due to some historical oddities we have to support '\'
  before any character, but since we never emitted '\' in front of
  "normal" characters like 'x' we can interpret "\x..;" to be an R6RS
  hex escape.

* test-suite/tests/reader.test ("#{}#"): Add tests.
2011-04-11 12:48:06 +02:00
Mark H Weaver
882c89636a Fix the R6RS exact-integer-sqrt and import into core guile
* libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to
  compute exact integer square root and remainder.
  (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt'
  from the R6RS, imported into core guile.

* libguile/numbers.h: Add prototypes.

* module/rnrs/base.scm: Remove broken stub implementation, which would
  fail badly when applied to large integers.

* doc/ref/api-data.texi: Add documentation.

* doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a
  stub that xrefs the core docs, as is done for other operations
  available in core.

* test-suite/tests/numbers.test: Add tests.

* NEWS: Add news entries.
2011-04-09 16:11:49 -04:00
Mark H Weaver
6ebecdeb7d Fix parsing of exact numbers with negative exponents
* libguile/numbers.c (mem2decimal_from_point): Use scm_divide instead of
  scm_divide2real when applying a negative exponent, to preserve
  exactness in case the "#e" forced exactness specifier is present.
  This fixes a bug where numeric literals such as "#e1e-5" yielded
  incorrect fractions.
2011-04-06 18:24:40 -04:00
Andy Wingo
39bed56f67 fix c32vector-set!, c64vector-set!
* module/srfi/srfi-4/gnu.scm (bytevector-c32-native-set!):
  (bytevector-c64-native-set!): Fix to actually allow complex numbers.

* test-suite/tests/srfi-4.test: Add tests.
2011-04-01 16:45:58 +02:00
Andy Wingo
c6b08d2194 string->pointer and pointer->string have optional encoding arg
* test-suite/tests/foreign.test ("pointer<->string"): Add test cases.

* libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Add
  optional encoding, and in the pointer->string case, length arguments.

* libguile/foreign.h: Update prototypes of internal functions.
  Shouldn't affect ABI as they are internal.

* doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update
  docs.
2011-04-01 13:31:26 +02:00