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

2175 commits

Author SHA1 Message Date
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
Andy Wingo
85d3339d7e (srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4)
* module/srfi/srfi-4/gnu.scm: Re-use implementation of
  define-bytevector-type from srfi-4.
2014-02-07 18:00:04 +01:00
Andy Wingo
b5f9ba49db Remove private unused duplicate c32/c64vector definitions
* module/srfi/srfi-4.scm: Remove vestigial definitions for c32vectors
  and c64vectors.  Those are defined in (srfi srfi-4 gnu).
2014-02-07 17:57:30 +01:00
Andy Wingo
a675a2e81b SRFI-4 predicates, length accessors only accept bytevectors (not arrays)
* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
  and length accessors, only accept bytevectors.  Since arrays don't
  work for u32vector-ref et al, they shouldn't pass u32vector?.
2014-02-07 17:53:01 +01:00
Andy Wingo
1e3fd6a0c8 Add weak-vector-length, weak-vector-ref, weak-vector-set!
* libguile/weaks.c (scm_is_weak_vector, scm_c_weak_vector_length):
  (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for
  dealing with weak vectors from C.
  (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x):
  New Scheme interfaces to weak vectors; to be used instead of
  vector-length, vector-ref, etc.

* module/ice-9/weak-vector.scm: Export the new interfaces.

* doc/ref/api-memory.texi (Weak vectors): Document them.
2014-02-07 12:25:05 +01:00
Mark H Weaver
8a114e1b54 REPL Server: Remove unneeded error case in 'run-server'.
* module/system/repl/server.scm (run-server): Remove case that handled
  'interrupt' exceptions specially.  It is no longer needed since
  e6c8e6047e (REPL Server: Don't establish
  a SIGINT handler.)
2014-02-04 15:15:12 -05:00
Mark H Weaver
5e74217c7c REPL Server: Redirect warnings to client socket.
* module/system/repl/server.scm (serve-client): Use parameterize.
  Redirect warnings to client socket.
2014-02-04 15:15:00 -05:00
Mark H Weaver
866af5da3d define-values: Blackhole 'dummy'; work around lack of toplevel hygiene.
* module/ice-9/boot-9.scm (define-values): Use 'generate-temporaries' to
  generate a fresh name for 'dummy', to work around the lack of hygiene
  for macro-introduced toplevel identifiers.  Blackhole 'dummy' to avoid
  keeping garbage alive.  Add more comments.
2014-02-02 21:43:35 -05: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
58147d6780 Compile numerical comparisons with more than 2 arguments to VM code.
* module/language/tree-il/primitives.scm (chained-comparison-expander):
  New procedure.
  (*primitive-expand-table*): Add primitive expanders for '<', '>',
  '<=', '>=', and '='.
2014-02-01 01:19:16 -05:00
Mark H Weaver
e6c1c5f6cb Revert "Primitive expand numerical comparisons with more than 2 arguments."
This reverts commit 4dc4b86e85.
2014-01-31 04:01:12 -05:00
Mark H Weaver
4dc4b86e85 Primitive expand numerical comparisons with more than 2 arguments.
* module/language/tree-il/primitives.scm (chained-comparison-expander):
  New procedure.
  (*primitive-expand-table*): Add primitive expanders for '<', '>',
  '<=', '>=', and '='.
2014-01-28 17:44:22 -05:00
Mark H Weaver
ca5e0414e9 Add 'positive?' and 'negative?' as primitives.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*)
  (*effect-free-primitives*): Add 'positive?' and 'negative?'.
  (*primitive-expand-table*): Add primitive expanders for 'positive?'
  and 'negative?'.
2014-01-28 17:15:27 -05:00
Andy Wingo
a7a4ba6a2d Minor for-each speedup
* module/ice-9/boot-9.scm (for-each): Minor speedup by unrolling
  tortoise/hare loop.
2014-01-28 16:42:42 -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
Mark H Weaver
f6ddf827f8 Improve correctness and consistency of 'eval-when' usage.
* module/ice-9/boot-9.scm:
* module/ice-9/i18n.scm:
* module/ice-9/poll.scm:
* module/ice-9/popen.scm:
* module/ice-9/r6rs-libraries.scm:
* module/oop/goops.scm:
* module/oop/goops/compile.scm:
* module/oop/goops/dispatch.scm:
* module/srfi/srfi-88.scm:
* module/system/foreign.scm:
* module/texinfo/serialize.scm: Change most uses of 'compile' to
  'expand', except where we must avoid it during initial bootstrap
  before the module system is loaded.  Remove redundant uses of
  'compile' where 'expand' is also given.  Standardize on the
  "(expand load eval)" order of conditions.
2014-01-23 10:41:22 -05:00
Mark H Weaver
e6c8e6047e REPL Server: Don't establish a SIGINT handler.
* module/system/repl/server.scm (call-with-sigint): Remove.
  (accept-new-client): Don't wrap 'call-with-sigint' around call to
  'accept'.
2014-01-21 16:11:17 -05: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
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
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
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
da81e75d3e Document that we support srfi-87 and add it to %cond-expand-features.
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-87.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-87 to the list of core
  features.
  (SRFI-87): New node.
2014-01-15 02:37:46 -05:00
Mark H Weaver
b306fae0ab Document that we support srfi-62 and add it to %cond-expand-features.
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-62.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-62 to the list of core
  features.
  (SRFI-62): New node.
2014-01-14 13:26:30 -05:00
Mark H Weaver
61d509194c Add srfi-16 and srfi-30 to %cond-expand-features.
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-16 and
  srfi-30.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-16 and srfi-30 to the
  list of core features.

* module/srfi/srfi-16.scm: Remove call to 'cond-expand-provide'.
2014-01-14 02:19:52 -05:00
Mark H Weaver
f974224d97 Bump user-visible copyright years to 2014.
* doc/ref/guile.texi: Add 2014 to list of copyright years in @copying
  section.

* module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to
  2014.

* module/system/repl/common.scm (*version*): Add 2014 to the range of
  copyright years.
2014-01-12 04:16:39 -05:00
Mark H Weaver
0e18163366 Implement R7RS 'syntax-error'.
* module/ice-9/psyntax.scm (syntax-error): New macro.
  (syntax-rules): Handle 'syntax-error' templates specially
  for improved error reporting.

* module/ice-9/psyntax-pp.scm: Regenerate.

* doc/ref/api-macros.texi (Syntax Rules): Add new subsection "Reporting
  Syntax Errors in Macros".

* test-suite/tests/syntax.test: Add tests.
2014-01-09 17:43:53 -05:00
Mark H Weaver
1624e149f7 psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules.
* module/ice-9/psyntax.scm (binding-type): Update the header comment
  to mention the new 'ellipsis' binding type.
  (macros-only-env): Preserve ellipsis bindings.
  (ellipsis?): Add 'r' and 'mod' as arguments.  Search the lexical
  environment for an ellipsis binding, and use it.
  (gen-syntax): Adapt to the additional arguments of 'ellipsis?'.
  (with-ellipsis): New core syntax.
  (convert-pattern): Add unary 'ellipsis?' procedure as an argument.
  (gen-clause): Adapt to the additional arguments of 'ellipsis?'.
  Pass unary 'ellipsis?' procedure to 'convert-pattern'.
  (syntax-case): Adapt to the additional arguments of 'ellipsis?'.
  (syntax-local-binding): Support new 'ellipsis' binding type.
  (syntax-rules): Add support for a custom ellipsis identifier as
  the first operand, as per R7RS.  Collect common code within new
  local procedure 'expand-syntax-rules'.

* module/ice-9/psyntax-pp.scm: Regenerate.

* module/ice-9/local-eval.scm (analyze-identifiers): Add support for
  'ellipsis' binding type.

* doc/ref/api-macros.texi (Syntax Rules): Add docs for R7RS custom
  ellipsis syntax.  Use @dots{}.
  (Syntax Case): Add docs for 'with-ellipsis'.  Use @dots{}.
  (Syntax Transformer Helpers): Update to include new 'ellipsis'
  binding type.

* test-suite/tests/syntax.test: Add tests.
2014-01-09 17:41:19 -05:00
Mark H Weaver
8de355d08e psyntax: toplevel variable definitions discard previous syntactic binding.
* module/ice-9/psyntax.scm (expand-top-sequence): When defining a
  toplevel variable, use the value of the same-named imported
  _variable_, if any.  Do _not_ use an existing syntactic binding.

* module/ice-9/psyntax-pp.scm: Regenerate.
2014-01-09 17:40:43 -05:00
Ian Price
306cc01d39 Fix trap handlers to handle applicable structs.
Reported by Jordy Dickinson <jordy.dickinson@gmail.com>.
Fixes <http://bugs.gnu.org/15691>.

* module/system/vm/traps.scm (frame-matcher): Extract procedure when
  proc is an applicable struct.
2014-01-09 03:12:05 +00:00
Mark H Weaver
6146984cc5 boot-9: add comment about autoload thread-unsafety.
* module/ice-9/boot-9.scm: Add comment about lack of thread-safety in
  handling of autoloads.
2014-01-08 20:57:13 -05:00
Ian Price
265e7bd92a Fix inlining of tail list to apply.
Fixes <http://bugs.gnu.org/15533>.

* module/language/tree-il/peval.scm (peval): Final list argument to
  `apply' should not be inlined if it is mutable.
* test-suite/tests/peval.test ("partial evaluation"): Add test.
2014-01-07 03:37:21 +00:00
Mark H Weaver
0b83be7eb6 Revert "Fix bound-identifier=? to compare binding names, not just symbolic names."
This reverts commit 70c74b8476.
2013-12-16 22:55:25 -05:00
Mark H Weaver
70c74b8476 Fix bound-identifier=? to compare binding names, not just symbolic names.
Fixes <http://bugs.gnu.org/16158>.

* module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare
  binding names (gensyms), not just symbolic names.

* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Add test.
2013-12-15 19:04:59 -05:00
Mark H Weaver
aa8630efb3 syntax-case: fix error reporting for misplaced ellipses.
Reported by taylanbayirli@gmail.com (Taylan Ulrich B.).

* module/ice-9/psyntax.scm (cvt*): Use 'syntax-case' to destructure
  the pattern tail, instead of 'pair?', 'car', and 'cdr'.
  (gen-clause): When checking for errors, check for misplaced ellipsis
  before duplicate pattern variables, to improve the error message in
  case of multiple misplaced ellipses.

* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Add tests.
2013-12-13 13:25:07 -05:00
Andy Wingo
e54c7dd67c Fix brainfuck comment
* module/language/brainfuck/parse.scm: Fix outdated comment.
2013-12-02 19:03:50 +01:00
Andy Wingo
60ce72b9b9 Fix brainfuck->scheme compiler.
* module/language/brainfuck/compile-scheme.scm (compile-scheme): Fix
  brainfuck compiler.
2013-12-02 19:03:48 +01:00
Mark H Weaver
e7bd20f7d9 Make (ice-9 popen) thread-safe.
Fixes <http://bugs.gnu.org/15683>.
Reported by David Pirotte <david@altosw.be>.

* module/ice-9/popen.scm: Import (ice-9 threads) and (srfi srfi-9).
  (<pipe-info>): New record type.
  (port/pid-table): Mark as deprecated in comment.
  (port/pid-table-mutex): New variable.
  (open-pipe*): Store the pid in the pipe-info record, and store the
  pipe-info as a port property.  Guard the pipe-info instead of the
  port.  Lock 'port/pid-table-mutex' while mutating 'port/pid-table'.
  (fetch-pid): Removed.
  (fetch-pipe-info): New procedure.
  (close-process-quietly): Removed.
  (close-pipe): Use 'fetch-pipe-info' instead of 'fetch-pid'.  Clear
  the pid from the pipe-info.  Improve error messages.
  (reap-pipes): Adapt to the fact that the pipe-info is now guarded
  instead of the port.  Incorporate the 'waitpid' code that was
  previously in 'close-process-quietly', but let the port finalizer
  close the port.  Clear the pid from the pipe-info.
2013-11-23 17:47:39 -05:00
Mark H Weaver
17330398d5 Stylistic improvements for (ice-9 popen).
* module/ice-9/popen.scm (close-process, close-process-quietly): Accept
  'port' and 'pid' as separate arguments.  Improve style.
  (close-pipe, read-pipes): Improve style.
2013-11-23 15:53:33 -05:00
Mark H Weaver
8904b7a936 Web: accept "UTC" as the zone offset in date headers.
Fixes <http://bugs.gnu.org/14128>.
Reported by Aleix Conchillo Flaqué <aconchillo@gmail.com>.

* module/web/http.scm (parse-zone-offset): Accept "UTC".
2013-11-19 03:22:00 -05:00
David Thompson
5063f0a93b Add procedures to convert alists into hash tables.
* module/ice-9/hash-table.scm: New module.

* test-suite/tests/hash.test ("alist conversion"): Add tests.

* doc/ref/api-compound.texi (Hash Table Reference): Add docs.
2013-11-18 23:03:38 -05:00
Mark H Weaver
02500d4477 Convert guile exceptions to R6RS conditions in R6RS exception handlers.
* module/rnrs/exceptions.scm (&guile): New condition type.

  (guile-condition-converters): New variable.

  (convert-guile-condition, default-guile-condition-converter,
  set-guile-condition-converter!, guile-common-conditions,
  guile-lexical-violation-converter, guile-syntax-violation-converter,
  guile-assertion-violation-converter, guile-system-error-converter,
  guile-undefined-violation-converter, guile-error-converter,
  guile-implementation-restriction-converter): New procedures.

  (with-exception-handler): Catch all exceptions, not just R6RS
  exceptions.  Convert native Guile exceptions to R6RS conditions,
  preserving the original Guile exception information in the &guile
  condition object.

  (raise): If the condition includes a &guile condition, use 'throw' to
  throw the original native guile exception instead of raising an R6RS
  exception.

* test-suite/tests/r6rs-exceptions.test ("guile condition conversions"):
  Add tests.
2013-11-18 00:35:42 -05:00
Mark H Weaver
750ac8c592 Improve error when 'include' form with relative path is not in a file.
Reported by Nala Ginrut <nalaginrut@gmail.com>.

* module/ice-9/psyntax.scm (include): Give a proper error message when
  given a relative file name, and when the form is not in a file.

* module/ice-9/psyntax-pp.scm: Regenerate.
2013-11-18 00:14:23 -05:00
Mark H Weaver
76702cdcef Web: Use functional setters in extend-request and extend-response.
* module/web/client.scm (extend-request):
* module/web/server.scm (extend-response): Reimplement using
  functional setters.
2013-09-12 18:45:13 -04:00
Mark H Weaver
3b2226ec91 Web client+server: Add Content-Length header for empty bodies.
* module/web/client.scm (sanitize-request): Add a Content-Length
  header if a body if given, even if the body is empty.

* module/web/server.scm (sanitize-response): Add a Content-Length
  header if a body if given, even if the body is empty.
2013-09-12 18:36:45 -04:00
Mark H Weaver
361553b49d Adapt srfi-9.test to error reporting improvements; update copyright dates.
* module/srfi/srfi-9.scm: Add 2013 copyright date.

* test-suite/tests/srfi-9.test: Adapt to recent error reporting
  improvements to procedures defined by 'define-tagged-inlinable'.
2013-09-12 18:14:54 -04:00
Mark H Weaver
89ffbb1c2e Improve error reporting of procedures defined by define-inlinable.
* module/ice-9/boot-9.scm (define-inlinable): Improve error reporting
  when procedures defined using 'define-inlinable' are applied to the
  wrong number of arguments.

* module/srfi/srfi-9.scm (define-tagged-inlinable): Improve error
  reporting when procedures defined using 'define-tagged-inlinable' are
  applied to the wrong number of arguments.
2013-09-12 18:04:08 -04:00
Mark H Weaver
55e29bb55b web client: HTTP methods are symbols, not strings.
* module/web/client.scm (request, http-get, http-head, http-post,
  http-put, http-delete, http-trace, http-options): HTTP methods are
  symbols.
2013-09-10 01:39:52 -04:00
Alexandru Cojocaru
9c85fd0221 Fix extend-request to preserve method and meta.
* module/web/client.scm (extend-request): Preserve method and meta.
2013-09-10 01:36:00 -04:00