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

2484 commits

Author SHA1 Message Date
Mark H Weaver
495797ceb5 Improve formatting of options help given long option names
* module/ice-9/boot-9.scm (define-option-interface): When printing
  options help, e.g. for (read-options 'help), expand the width of the
  first column by another tab stop, to accommodate option names of up to
  23 characters.
2012-10-17 04:48:40 -04:00
Ludovic Courtès
f865ffaab1 web: Fix possible file descriptor leak in `open-socket-for-uri'.
* module/web/client.scm (open-socket-for-uri): Always close S in the
  `system-error' handler.
2012-10-13 21:13:10 +02:00
Ludovic Courtès
d74fcce9b9 web: Pass `AI_NUMERICSERV' when given a port number.
* module/web/client.scm (open-socket-for-uri)[addresses]: Pass
  AI_NUMERICSERV as the `getaddrinfo' hint when (uri-port URI) is true.
2012-10-12 23:21:39 +02:00
Ludovic Courtès
2663411bd7 web: Change `http-get' to try all the addresses for the given URI.
* module/web/client.scm (open-socket-for-uri): Try all the addresses
  returned by `getaddrinfo' until one succeeds.
2012-10-12 23:21:39 +02:00
Mark H Weaver
8b22ced1c9 Revert "Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'"
This reverts commit 3e3d32dd9b.
2012-10-10 13:13:19 -04:00
Mark H Weaver
3e3d32dd9b Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'
* module/ice-9/psyntax-pp.scm (syntax-rule, define-syntax-rule):
  Preserve the keyword identifier.

* module/ice-9/psyntax-pp.scm: Regenerate.
2012-10-08 14:08:43 -04:00
Mark H Weaver
75a5de18a0 Simplify calls to 'eqv?' when one argument is an immediate constant.
* module/language/tree-il/primitives.scm (maybe-simplify-to-eq): New
  helper procedure shared by expanders for 'eqv?' and 'equal?'.
  (*primitive-expand-table*): Add expansion rule for 'eqv?'.

* test-suite/tests/tree-il.test ("primitives"): Add tests.
2012-10-08 11:56:10 -04:00
Mark H Weaver
bcf87e35e1 Don't simplify 'equal?' to 'not' or 'null?'.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Don't simplify 'equal?' to 'not' or 'null?', but only to 'eq?'.

* test-suite/tests/tree-il.test ("primitives"): Adjust tests.
2012-10-08 00:37:09 -04:00
Mark H Weaver
ebd363161e Don't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer.
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Refine test for fixnums to verify that the small integer is exact.

* test-suite/tests/tree-il.test ("primitives"): Add test.
2012-10-07 23:57:13 -04:00
Ludovic Courtès
2446f8e126 Simplify calls to `equal?' when one argument is a constant.
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Add
  expansion rules for `equal?', when called with one constant and
  another argument.

* test-suite/tests/tree-il.test (pass-if-primitives-resolved): New
  macro.
  ("primitives"): New test prefix.
2012-10-06 22:34:00 +02:00
Chris K. Jester-Young
d6e1c8bfdb In fold-matches, set regexp/notbol unless matching string start.
* module/ice-9/regex.scm (fold-matches): Set regexp/notbol if the
  starting position is nonzero.
* test-suite/tests/regexp.test (fold-matches): Check that when
  matching /^foo/ against "foofoofoofoo", only one match results.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2012-09-26 23:46:05 +02:00
Ludovic Courtès
b6aedd68bc Don't stat(2) and access(2) the .go location before using it.
* module/system/base/compile.scm (ensure-directory): Rename to...
  (ensure-directory): ... this.  Update callers.  When ERRNO is EEXIST,
  assume DIR is a writable directory instead of calling `stat' and
  `access?' again.  Fixes UID/EUID mismatches for setuid binaries.
  Reported by rixed@happyleptic.org at
  <http://lists.gnu.org/archive/html/guile-user/2012-06/msg00023.html>.
2012-09-11 23:44:59 +02:00
Ludovic Courtès
e7350baf1e Rewrite SRFI-31 in terms of `syntax-rules'.
* module/srfi/srfi-31.scm: Use `#:export' instead of `#:export-syntax'.
  (rec): Rewrite using `syntax-rules'.

* test-suite/tests/srfi-31.test ("rec special form"): Change exception
  type to EXCEPTION:SYNTAX-PATTERN-UNMATCHED.
2012-09-11 23:39:32 +02:00
Ian Price
4aaceda29f `define-public' is no a longer curried definition by default.
* module/ice-9/boot-9.scm (define-public): Remove currying functionality.
* module/ice-9/curried-definitions.scm (define-public): New export.
2012-09-06 13:08:33 +01:00
Ian Price
d6bd182618 ISO 8601 time format specifies zero padding for hours, not blank padding.
* doc/ref/srfi-modules.texi ("SRFI-19 Date to string"): Fix iso 8601 format strings.
* module/srfi/srfi-19.scm (directives): Fix iso 8601 format strings.
2012-08-27 00:10:44 +02:00
Ian Price
866210bf24 Fix uri-encoding for strings with no unreserved chars
* module/web/uri.scm (uri-encode): Change test to check for unreserved
  chars instead of reserved chars.
* test-suite/tests/web-uri.test ("encode"): Add test.
2012-08-26 23:36:36 +02:00
Ian Price
b401fe7169 Fix uri-encoding for octets 0-15
* module/web/uri.scm (uri-encode): All encoded octets should be of the
  form % HEXDIGIT HEXDIGIT.
* test-suite/tests/web-uri.test ("encode"): Add test.
2012-08-26 23:35:33 +02:00
Andy Wingo
dc7a9cefbf more robust texinfo alias handling
* module/texinfo.scm (command-spec): Resolve aliases here.
  (complete-start-command, make-command-parser):
  (make-dom-parser, parse-environment-args): Reload command after
  resolving spec, so we get the alias target.
2012-08-25 14:11:45 +02:00
Ludovic Courtès
6c9220064d Micro-optimize (ice-9 format).
* module/ice-9/format.scm (format): Use `call-with-output-string'
  instead of `with-output-to-string'.
2012-08-21 00:36:50 +02:00
Andy Wingo
4bfe73072b Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
2012-07-24 23:22:41 +02:00
Ian Price
64ead01db7 Document and export `declare-opaque-header!'
* module/web/http.scm (declare-opaque-header!): Add docstring. New export.
* doc/ref/web.texi (HTTP): Add documentation.
2012-07-06 22:18:13 +02:00
Ian Price
312e79f8d5 Add HTTP Chunked Encoding support to web modules.
* doc/ref/web.texi(Transfer Codings): New subsection for transfer codings.
* module/web/http.scm(make-chunked-input-port,
  make-chunked-output-port): New procedures.
* module/web/response.scm (read-response-body): Handle chunked responses.
* test-suite/tests/web-response.test: Add test.
* test-suite/tests/web-http.test: Add tests.

afd
2012-07-06 22:18:12 +02:00
Mark H Weaver
8210c8538a Fix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries
* module/ice-9/psyntax.scm (@): Return top-wrap instead of the wrap
  applied to the '@' form, so that the symbol will be interpreted as a
  top-level identifier and never refer to any lexical variable.

  (@@): Change the syntax used to support R6RS 'library' forms to:
  (@@ @@ (mod ...) body).  Change the behavior of the documented
  (@@ (mod ...) id) form to be the same as that of @, except for the use
  of 'private' instead of 'public' in the psyntax mod: use syntax->datum
  on the identifier, and return top-wrap instead of the wrap applied to
  the '@@' form.

  This fixes <http://bugs.gnu.org/10756> reported by Ludovic Courtès.

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

* module/ice-9/r6rs-libraries.scm (library): Use '@@ @@' syntax instead
  of the older '@@' syntax.

* test-suite/tests/syncase.test (changes to expansion environment): Use
  '@@ @@' syntax.

* module/Makefile.am: Add explicit dependencies for boot-9.go on the
  files that it includes: quasisyntax.scm and r6rs-libraries.scm.
2012-07-06 20:12:50 +02:00
Andy Wingo
5f8d67ad09 simplify %condition-type-vtable
* module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable
  instead of make-vtable-vtable.
2012-07-06 18:32:14 +02:00
Andy Wingo
581bd72a7d record-type-vtable is not a new root of the vtable hierarchy
* module/ice-9/boot-9.scm (record-type-vtable): Simplify to use
  make-vtable instead of make-vtable-vtable.
2012-07-06 18:32:14 +02:00
Andy Wingo
2aed2667fc Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/expand.c
	libguile/hashtab.c
	libguile/ports.c
	libguile/vectors.c
	libguile/weaks.c
	module/language/ecmascript/compile-tree-il.scm
	module/language/tree-il/effects.scm
	module/language/tree-il/fix-letrec.scm
	module/language/tree-il/peval.scm
	test-suite/tests/peval.test
2012-07-06 16:52:54 +02:00
Daniel Krueger
e1fb0e811b fixed repl command ,describe to also handle syntax 2012-07-06 14:35:10 +02:00
Andy Wingo
3fabb2d2be more uri-related ipv6 fixes
* module/web/uri.scm (ipv6-regexp): IPv6 numeric addresses do not have
  brackets.  It's only in URIs that they have them.
  (ipv6-host-pat, authority-regexp, parse-authority): Refactor ipv6
  detection to fix a bug with |, and to extract IPv6 hosts from their
  brackets.  This way we can pass the uri-host directly to inet-pton.
  (uri->string): If the host contains a `:', assume it is ipv6 and add
  brackets.

* test-suite/tests/web-uri.test ("build-uri"): Adapt tests to assume
  that the address returned by uri-host and passed to build-uri #:host
  does not have brackets.
2012-07-06 13:13:19 +02:00
Daniel Hartwig
81e7210f14 enhance IPv6 support
* module/web/uri.scm (valid-host?): Support dotted-quad notation
  in IPv6 addresses.
  (parse-authority): Support IPv6 literals.
* test-suite/tests/web-uri.test: Add and fix tests.
2012-07-06 12:33:41 +02:00
Daniel Hartwig
274e2eecf1 support URIs with domain names starting with numbers
* module/web/uri.scm (valid-host?): Fix regexp to support
domain names starting with numbers.
* test-suite/tests/web-uri.scm: Add tests for above and
IP literals.
2012-07-06 12:33:16 +02:00
Andy Wingo
fc835b1b14 better procedure-arguments for interpreted procs with opt, rest, kwargs
* module/ice-9/session.scm (procedure-arguments): Arrange to interpret
  numbers in the "req" and "opt" positions of an 'arglist as N arguments
  with unknown name.

* module/ice-9/eval.scm (primitive-eval): Set 'arglist on "complex"
  procedures.  Fixes http://bugs.gnu.org/10922.

* test-suite/tests/session.test ("procedure-arguments"): Add a test.
2012-07-06 12:19:12 +02:00
Andy Wingo
13e3d3d95d fix `vector' instruction emission for big vectors
* module/language/glil/compile-assembly.scm (dump-constants): Only use
  the `vector' instruction for vectors whose length can fit in 16 bits.

  Fixes http://bugs.gnu.org/11087.
2012-07-05 23:26:38 +02:00
Andy Wingo
b8a5606b10 fix-letrec uses effects.scm for effects analysis
* module/language/tree-il/fix-letrec.scm: Use effects.scm for effects
  analysis, instead of primitives.scm.
  (simple-expression?, partition-vars): Adapt.
2012-07-05 20:40:56 +02:00
Andy Wingo
997ed30070 simplify one kind of degenerate prompt
* module/language/tree-il/peval.scm (<operand>): Instead of having a
  `residualize?' field, have it be a use count.
  (peval): Adapt to <operand> change.  Add function to kill uses of an
  operand.  Use it in the <prompt> inliner.  Add another kind of
  degenerate prompt to elide.  We should really switch to CPS though, as
  that will allow us to contify more aggressively.

* test-suite/tests/peval.test ("partial evaluation"): Adapt (while #t
  #t) test, which was sensitive to how far the recursive inlining got.
  Add a test for the degenerate prompt elision.
2012-07-05 20:39:16 +02:00
Andy Wingo
37081d5d4b fix bugs in effects analysis of "effect+exception-free-primitives"
* module/language/tree-il/effects.scm (make-effects-analyzer): Be more
  precise regarding the effects of the so-called
  effect+exception-free-primitives: now we check their arities.

* test-suite/tests/cse.test ("cse"): Add a test that we don't
  elide (cons 1 2 3) in effect context.
2012-07-05 20:34:28 +02:00
Andy Wingo
3d2bcd2c35 optimize (apply foo 0 (list 1 2)) => (foo 0 1 2)
* module/language/tree-il/peval.scm (peval): Inline applications where
  we know the contents of the tail.

* test-suite/tests/peval.test ("partial evaluation"): Add tests.
2012-07-05 20:30:18 +02:00
Andy Wingo
c0cfa9ef07 compile ecmascript's `return' as an abort
* module/language/ecmascript/compile-tree-il.scm (current-return-tag):
  (with-return-prompt, comp): Compile `return' as an abort instead of a
  primcall to `return'.  Fixes beta-reduction by the optimizer -- it
  doesn't make sense for `return' to move from one function to another!
2012-07-05 11:06:29 +02:00
Andy Wingo
21b83fb795 fix goops compilation when current language is not scheme
* module/oop/goops/dispatch.scm (compute-dispatch-procedure): Set source
  language to Scheme, not (current-language).
2012-07-05 10:15:02 +02:00
Andy Wingo
d0491c9a16 dead code elimination
* module/ice-9/psyntax.scm: Remove commented-out definitions of `do' and
  `case'.
2012-07-02 23:02:20 +02:00
Ludovic Courtès
a8215aedad Have procedure-arguments' always return the allow-other-keys?' pair.
Fixes <http://bugs.gnu.org/10938>.
Based on a patch by Stefan Israelsson Tampe <stefan.itampe@gmail.com>.

* module/ice-9/session.scm (procedure-arguments): When the 'arglist
  property is available, emit the `allow-other-keys?' pair.  Use
  `match-lambda'.

* test-suite/tests/session.test ("procedure-arguments")["aok? is
  preserved"]: New test.
2012-07-02 15:08:25 +02:00
Andy Wingo
b8bc86bce1 instead of our custom .go format, use elf
* libguile/objcodes.c: Change to expect objcode on disk to be embedded
  in ELF instead of having the funky cookie.

  (to_native_order): Use already existing SCM_BYTE_ORDER style byte
  order instead of chars.
  (bytecode_to_objcode): No need for word_size arg.
  (scm_bytecode_to_objcode, scm_objcode_to_bytecode): Take optional
  endianness arg instead of sometimes using target-endianness.
  (scm_load_objcode, scm_write_objcode, scm_bytecode_to_native_objcode):
  Remove.

* libguile/objcodes.h: Adapt.

* libguile/vm.c (scm_load_compiled_with_vm): Use
  scm_load_thunk_from_file.
  (make_boot_program): Adapt to use scm_bytecode_to_objcode with
  endianness arg.

* module/Makefile.am (OBJCODE_LANG_SOURCES): Add (language objcode
  elf).
* module/language/objcode/elf.scm: New module, embeds objcode in ELF.

* module/language/bytecode/spec.scm (compile-objcode):
  (decompile-objcode): Use (target-endianness).

* module/language/objcode/spec.scm: use (language objcode elf) for
  write-objcode.

* module/scripts/disassemble.scm (disassemble):
* module/system/repl/command.scm (disassemble-file): Use
  load-thunk-from-file.

* module/system/vm/objcode.scm: Remove load-objcode and write-objcode.

* test-suite/tests/asm-to-bytecode.test (test-target): Adapt to the new
  ELF world.
2012-06-22 13:40:50 +02:00
Andy Wingo
afc74c2920 add ELF loader
* libguile/objcodes.h:
* libguile/objcodes.c (scm_load_thunk_from_file)
  (scm_load_thunk_from_memory): New procedures.

* libguile/elf.h: Import from glibc.  Not installed.

* libguile/Makefile.am: Adapt for elf.h.

* module/system/vm/objcode.scm: (load-thunk-from-file)
  (load-thunk-from-memory): New exports.
2012-06-22 13:40:50 +02:00
Andy Wingo
83e7c58408 add elf parser and linker
* module/Makefile.am:
* module/system/vm/elf.scm: New file.
2012-06-22 13:40:46 +02:00
Andy Wingo
0dd7c54075 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/deprecated.c
	libguile/ports.c
	libguile/ports.h
	libguile/strports.c
	test-suite/tests/cse.test
2012-06-22 13:18:02 +02:00
Andy Wingo
2874f66017 add char->integer, number->string etc to interesting primitives
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*effect-free-primitives*): Add string->number, number->string,
  integer->char, and char->integer to allow for constant folding and
  better effects analysis.
2012-06-22 12:33:20 +02:00
Andy Wingo
5cfa385db7 update version-etc copyright year
* module/ice-9/command-line.scm (version-etc): Update copyright year to
  2012.
2012-06-22 12:33:20 +02:00
Andy Wingo
4d1ae11279 cse: expressions evaluated for effect do not provide predicates
* module/language/tree-il/cse.scm (cse): When trying to fold
  conditionals, only look at entries in the database that were added in
  test context.

* test-suite/tests/cse.test ("cse"): Add a test case.
2012-06-22 12:33:20 +02:00
Andy Wingo
378daa5fa5 scandir: select? takes basenames, operates on (sub)dirs also
* module/ice-9/ftw.scm (scandir): Run the select? procedure on all
  items, including subdirs and the `.' and `..' entries.  Pass it the
  basename of the file in question instead of the full name.

* test-suite/tests/ftw.test ("scandir"): Adapt expectation for the .test
  selector.  Add test for a selector that rejects everything.
2012-06-22 12:33:20 +02:00
Ludovic Courtès
ecb48dccba Make SRFI-6 string ports Unicode-capable.
Partly addresses <http://bugs.gnu.org/11197>.
Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>.

* module/srfi/srfi-6.scm (open-input-string, open-output-string): New
  procedures.

* test-suite/tests/srfi-6.test ("open-input-string")["read-char,
  Unicode"]: New test.
  ("open-output-string")["λ"]: New test.
2012-06-20 15:50:27 +02:00
Ludovic Courtès
f3b312a19d Fix cross-compilation of GOOPS-using code.
Fixes <http://bugs.gnu.org/11645>.
Reported by Bogdan A. Marinescu <bogdan.a.marinescu@intel.com>.

* module/oop/goops/dispatch.scm (compute-dispatch-procedure)[comp]:
  Wrap `compile' call in (with-target %host-type ...).
2012-06-20 01:11:44 +02:00