bpt/guile.git
11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Fri, 6 Jul 2012 14:52:54 +0000 (16:52 +0200)]
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

11 years agoadd --match pattern to git-version-gen
Andy Wingo [Fri, 6 Jul 2012 14:13:57 +0000 (16:13 +0200)]
add --match pattern to git-version-gen

* configure.ac: Add --match pattern so we only get v2.0.x tagx.

11 years agogit-version-gen: add --match argument
Andy Wingo [Fri, 6 Jul 2012 13:51:05 +0000 (15:51 +0200)]
git-version-gen: add --match argument

* build-aux/git-version-gen (Options): Add --match argument.
  (v_from_git): Remove path without --match.

11 years agoupdate git-version-gen from gnulib
Andy Wingo [Fri, 6 Jul 2012 13:17:07 +0000 (15:17 +0200)]
update git-version-gen from gnulib

* build-aux/git-version-gen: Import from gnulib.

11 years agofixed repl command ,describe to also handle syntax
Daniel Krueger [Wed, 28 Mar 2012 16:25:15 +0000 (18:25 +0200)]
fixed repl command ,describe to also handle syntax

11 years agoAdd alignment for Sun Studio 12
Dagobert Michelsen [Mon, 6 Feb 2012 08:45:41 +0000 (09:45 +0100)]
Add alignment for Sun Studio 12

11 years agomore uri-related ipv6 fixes
Andy Wingo [Fri, 6 Jul 2012 11:13:19 +0000 (13:13 +0200)]
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.

11 years agoenhance IPv6 support
Daniel Hartwig [Fri, 30 Dec 2011 16:16:42 +0000 (00:16 +0800)]
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.

11 years agosupport URIs with domain names starting with numbers
Daniel Hartwig [Fri, 30 Dec 2011 09:49:37 +0000 (17:49 +0800)]
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.

11 years agofix typo in web.texi
Andy Wingo [Fri, 6 Jul 2012 10:23:39 +0000 (12:23 +0200)]
fix typo in web.texi

* doc/ref/web.texi (HTTP Headers): Fix typo in example.  Fixes
  http://bugs.gnu.org/10890.

11 years agobetter procedure-arguments for interpreted procs with opt, rest, kwargs
Andy Wingo [Fri, 6 Jul 2012 10:19:12 +0000 (12:19 +0200)]
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.

11 years agoadd check for fchmod
Andy Wingo [Fri, 6 Jul 2012 09:01:51 +0000 (11:01 +0200)]
add check for fchmod

* configure.ac: Add a check for fchmod.

* libguile/filesys.c (scm_chmod): Guard the fchmod case with
  HAVE_FCHMOD.

11 years agoremove mkdir alias in filesys.c for mingw
Andy Wingo [Fri, 6 Jul 2012 08:56:02 +0000 (10:56 +0200)]
remove mkdir alias in filesys.c for mingw

* libguile/filesys.c (mkdir): Remove alias, as gnulib handles this for
  us.

11 years agofix warnings in mingw in expand.c
Andy Wingo [Fri, 6 Jul 2012 08:50:31 +0000 (10:50 +0200)]
fix warnings in mingw in expand.c

* libguile/expand.c (VOID_, CONST_): Add trailing underscores to avoid
  name conflicts on MinGW.

11 years agofix warning about vsnprintf on mingw
Andy Wingo [Fri, 6 Jul 2012 08:43:29 +0000 (10:43 +0200)]
fix warning about vsnprintf on mingw

* libguile/deprecation.c: Remove a vsnprintf alias for mingw, now that
  gnulib handles it correctly.

11 years agobe sure to include time.h for struct timespec
Andy Wingo [Fri, 6 Jul 2012 08:43:02 +0000 (10:43 +0200)]
be sure to include time.h for struct timespec

* libguile/gen-scmconfig.c: The GNU libc manual says that struct
  timespec is defined in time.h.  So, just include both sys/time.h and
  time.h, if they are available.

11 years agofix `vector' instruction emission for big vectors
Andy Wingo [Thu, 5 Jul 2012 21:26:38 +0000 (23:26 +0200)]
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.

11 years agofix-letrec uses effects.scm for effects analysis
Andy Wingo [Thu, 5 Jul 2012 18:40:56 +0000 (20:40 +0200)]
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.

11 years agosimplify one kind of degenerate prompt
Andy Wingo [Thu, 5 Jul 2012 18:39:16 +0000 (20:39 +0200)]
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.

11 years agofix bugs in effects analysis of "effect+exception-free-primitives"
Andy Wingo [Thu, 5 Jul 2012 18:34:28 +0000 (20:34 +0200)]
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.

11 years agooptimize (apply foo 0 (list 1 2)) => (foo 0 1 2)
Andy Wingo [Thu, 5 Jul 2012 18:30:18 +0000 (20:30 +0200)]
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.

11 years agocompile ecmascript's `return' as an abort
Andy Wingo [Thu, 5 Jul 2012 09:06:29 +0000 (11:06 +0200)]
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!

11 years agofix goops compilation when current language is not scheme
Andy Wingo [Thu, 5 Jul 2012 08:15:02 +0000 (10:15 +0200)]
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).

11 years agoadd scm_c_nvalues to news
Andy Wingo [Wed, 4 Jul 2012 15:54:57 +0000 (17:54 +0200)]
add scm_c_nvalues to news

* NEWS: Add scm_c_nvalues.

11 years agoadd scm_c_nvalues with docs; also, docs for scm_c_values
Andy Wingo [Wed, 4 Jul 2012 15:48:06 +0000 (17:48 +0200)]
add scm_c_nvalues with docs; also, docs for scm_c_values

* libguile/values.h:
* libguile/values.c (scm_c_nvalues): New function.

* doc/ref/api-control.texi (Multiple Values): Add docs for scm_c_values
  and scm_c_nvalues.

Fixes http://bugs.gnu.org/11764.

11 years agoadd scm_{to,from}_pointer docs
Andy Wingo [Wed, 4 Jul 2012 15:43:53 +0000 (17:43 +0200)]
add scm_{to,from}_pointer docs

* doc/ref/api-foreign.texi: Add documentation for scm_to_pointer and
  scm_from_pointer.

11 years agoupdate NEWS
Andy Wingo [Mon, 2 Jul 2012 21:02:08 +0000 (23:02 +0200)]
update NEWS

* NEWS: Update.

11 years agodead code elimination
Andy Wingo [Mon, 2 Jul 2012 21:01:21 +0000 (23:01 +0200)]
dead code elimination

* module/ice-9/psyntax.scm: Remove commented-out definitions of `do' and
  `case'.

11 years agoremove docs for smob-call instruction
Andy Wingo [Mon, 2 Jul 2012 21:00:49 +0000 (23:00 +0200)]
remove docs for smob-call instruction

* doc/ref/vm.texi (Trampoline Instructions): Remove docs for smob-call.

11 years agotypo fix in web.texi
Andy Wingo [Fri, 29 Jun 2012 09:55:40 +0000 (11:55 +0200)]
typo fix in web.texi

* doc/ref/web.texi (URIs): Fix a typo/thinko.

11 years agoHave `procedure-arguments' always return the `allow-other-keys?' pair.
Ludovic Courtès [Sun, 1 Jul 2012 15:32:03 +0000 (17:32 +0200)]
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.

11 years agoAdd tests for `procedure-arguments'.
Ludovic Courtès [Sun, 1 Jul 2012 15:32:03 +0000 (17:32 +0200)]
Add tests for `procedure-arguments'.

* test-suite/tests/session.test ("procedure-arguments"): New test
  prefix.

11 years agoUpdate `THANKS'.
Ludovic Courtès [Sun, 1 Jul 2012 15:32:03 +0000 (17:32 +0200)]
Update `THANKS'.

11 years agoRemove backward-compatible `GC_PTR' definition.
Ludovic Courtès [Sun, 1 Jul 2012 15:32:03 +0000 (17:32 +0200)]
Remove backward-compatible `GC_PTR' definition.

Fixes <http://bugs.gnu.org/11500>.
Reported by Kevin J. Fletcher <dev@kjfletch.co.uk>.

* libguile/bdw-gc.h (GC_PTR)[(defined GC_VERSION_MAJOR)
  && (GC_VERSION_MAJOR >= 7)]: Remove.

11 years agoUse `void *' instead of `GC_PTR' internally.
Ludovic Courtès [Sun, 1 Jul 2012 15:32:03 +0000 (17:32 +0200)]
Use `void *' instead of `GC_PTR' internally.

* libguile/finalizers.c, libguile/foreign.c, libguile/guardians.c,
  libguile/hashtab.c, libguile/numbers.c, libguile/ports.c,
  libguile/smob.c, libguile/struct.c, libguile/vectors.c,
  libguile/weaks.c: Use `void *' instead of `GC_PTR'.

11 years agodoc: Remove reference to `closure?', now deprecated.
Ludovic Courtès [Sun, 1 Jul 2012 15:32:03 +0000 (17:32 +0200)]
doc: Remove reference to `closure?', now deprecated.

Fixed <http://bugs.gnu.org/11611>.

* doc/ref/api-procedures.texi (Procedure Properties): Remove reference
  to `closure?'.  Suggested by David Jaquay <djaquay@gmail.com>.

11 years agoinstead of our custom .go format, use elf
Andy Wingo [Fri, 22 Jun 2012 11:35:55 +0000 (13:35 +0200)]
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.

11 years agoadd ELF loader
Andy Wingo [Fri, 1 Jun 2012 19:33:46 +0000 (21:33 +0200)]
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.

11 years agoadd elf parser and linker
Andy Wingo [Wed, 23 May 2012 18:25:34 +0000 (20:25 +0200)]
add elf parser and linker

* module/Makefile.am:
* module/system/vm/elf.scm: New file.

11 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Fri, 22 Jun 2012 11:18:02 +0000 (13:18 +0200)]
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

11 years agoadd char->integer, number->string etc to interesting primitives
Andy Wingo [Fri, 22 Jun 2012 10:30:39 +0000 (12:30 +0200)]
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.

11 years agoupdate version-etc copyright year
Andy Wingo [Fri, 22 Jun 2012 10:29:08 +0000 (12:29 +0200)]
update version-etc copyright year

* module/ice-9/command-line.scm (version-etc): Update copyright year to
  2012.

11 years agocse: expressions evaluated for effect do not provide predicates
Andy Wingo [Fri, 22 Jun 2012 10:25:34 +0000 (12:25 +0200)]
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.

11 years agoscandir: select? takes basenames, operates on (sub)dirs also
Andy Wingo [Mon, 11 Jun 2012 10:25:24 +0000 (12:25 +0200)]
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.

11 years agoFix possible deadlock upon `encoding-error' in `open-input-string'.
Ludovic Courtès [Wed, 20 Jun 2012 20:56:11 +0000 (22:56 +0200)]
Fix possible deadlock upon `encoding-error' in `open-input-string'.

Partly addresses <http://bugs.gnu.org/11197>.

* libguile/strports.c (scm_mkstrport): Call `scm_port_non_buffer', set
  Z's cell type and stream, and release `scm_i_port_table_mutex' early.
  Reacquire `scm_i_port_table_mutex' once BUF, C_BUF, and STR_LEN are
  initialized.

* test-suite/tests/ports.test ("string ports")["encoding failure leads
  to exception"]: New test.

11 years agoMake SRFI-6 string ports Unicode-capable.
Ludovic Courtès [Wed, 20 Jun 2012 13:49:42 +0000 (15:49 +0200)]
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.

11 years agoUpdate `THANKS'.
Ludovic Courtès [Wed, 20 Jun 2012 13:44:29 +0000 (15:44 +0200)]
Update `THANKS'.

11 years agoFix cross-compilation of GOOPS-using code.
Ludovic Courtès [Tue, 19 Jun 2012 23:11:44 +0000 (01:11 +0200)]
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 ...).

11 years agoFix unbound variables and unbound values
Sjoerd van Leent [Sat, 9 Jun 2012 01:21:08 +0000 (21:21 -0400)]
Fix unbound variables and unbound values

* module/language/ecmascript/base.scm: fix two wrong variable names and a wrong
  number of arguments in a function call.

11 years agoFix invalid use of `SCM' as a Boolean.
Ludovic Courtès [Fri, 8 Jun 2012 10:44:07 +0000 (12:44 +0200)]
Fix invalid use of `SCM' as a Boolean.

* libguile/deprecated.c (scm_sym2var): Check `scm_is_true (definep)'.

11 years agoUpdate (ice-9 match) from Chibi-Scheme.
Ludovic Courtès [Fri, 8 Jun 2012 10:42:08 +0000 (12:42 +0200)]
Update (ice-9 match) from Chibi-Scheme.

Fixes <http://bugs.gnu.org/10651>.

* module/ice-9/match.upstream.scm: Update.

11 years agoMake `substitute' conversion strategy test portable.
Ludovic Courtès [Thu, 31 May 2012 13:53:06 +0000 (15:53 +0200)]
Make `substitute' conversion strategy test portable.

* test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy
  is soft"]: Split into the following tests.
  ["%default-port-conversion-strategy is escape",
  "%default-port-conversion-strategy is substitute"]: New tests.  In the
  latter, add the escape form returned on FreeBSD 8.2 and Darwin 10.8.0.

11 years agoFix port test that assumed string ports use the `error' conversion strategy.
Ludovic Courtès [Thu, 31 May 2012 12:29:25 +0000 (14:29 +0200)]
Fix port test that assumed string ports use the `error' conversion strategy.

This is a followup to 9f6e3f5a997f484548bd03e7e7573c38a95c8d09 ("Have
string ports honor `%default-port-conversion-strategy'.").

* test-suite/tests/r6rs-ports.test ("7.2.11 Binary
  Output")["put-bytevector with wrong-encoding string port"]: Set
  %DEFAULT-PORT-CONVERSION-STRATEGY to 'error.  Return #f when no
  exception is raised.
  ("8.2.6  Input and output ports")["transcoded-port [error handling
  mode = raise]"]: Return #f when no exception is raised.

11 years agoHave string ports honor `%default-port-conversion-strategy'.
Ludovic Courtès [Tue, 29 May 2012 21:39:05 +0000 (23:39 +0200)]
Have string ports honor `%default-port-conversion-strategy'.

* libguile/strports.c (scm_mkstrport): Remove initialization of
  `pt->ilseq_handler'.

* module/ice-9/pretty-print.scm (truncated-print)[ellipsis]: Set
  %DEFAULT-PORT-CONVERSION-STRATEGY to 'error.

* test-suite/tests/ports.test ("string
  ports")["%default-port-conversion-strategy is honored"]: New test.
  ["wrong encoding"]: Rename to...
  ["wrong encoding, error"]: ... this.  Explicitly set
  %DEFAULT-PORT-CONVERSION-STRATEGY to 'error.  Return #f when no
  exception is raised.

11 years agoAdd the `%default-port-conversion-strategy' fluid.
Ludovic Courtès [Tue, 29 May 2012 21:39:05 +0000 (23:39 +0200)]
Add the `%default-port-conversion-strategy' fluid.

Fixes <http://bugs.gnu.org/11468>.

* libguile/ports.c (scm_conversion_strategy): Remove.
  (default_conversion_strategy_var, sym_error, sym_substitute,
  sym_escape): New variables.
  (scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x):
  Remove.
  (scm_i_default_port_conversion_handler,
  scm_i_set_default_port_conversion_handler): New functions.
  (scm_port_conversion_strategy): Use
  `scm_i_default_port_conversion_handler' when PORT is #f.
  (scm_set_port_conversion_strategy_x): Use SYM_ERROR, SYM_SUBSTITUTE,
  and SYM_ESCAPE.  Use `scm_i_set_default_port_conversion_handler' when
  PORT is #f.
  (scm_init_ports): Initialize DEFAULT_CONVERSION_STRATEGY_VAR.

* libguile/ports.h: Update declarations accordingly.

* libguile/foreign.c: Change
  `scm_i_get_conversion_strategy (SCM_BOOL_F)' to
  `scm_i_default_port_conversion_handler ()'.
* libguile/strings.c: Likewise.

* test-suite/tests/ports.test ("%default-port-conversion-strategy"): New
  test prefix.

* test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy
  is error", "%default-port-conversion-strategy is soft"]: New tests.

* test-suite/test-suite/lib.scm (exception:encoding-error): Allow the
  regexp to match `scm_to_stringn' error messages.

* doc/ref/api-io.texi (Ports): Document `%default-port-conversion-strategy'.

11 years agoAccess `pt->ilseq_handler' directly when needed.
Ludovic Courtès [Tue, 29 May 2012 21:39:05 +0000 (23:39 +0200)]
Access `pt->ilseq_handler' directly when needed.

* libguile/print.c (PORT_CONVERSION_HANDLER): New macro.
  (print_extended_symbol, iprin1, write_character, scm_write_char): Use
  it instead of `scm_i_get_conversion_strategy'.

* libguile/strports.c (scm_mkstrport): Assign `pt->ilseq_handler'
  directly instead of via `scm_i_set_conversion_strategy_x'.

11 years agocoverage: Add test for applicable structs.
Ludovic Courtès [Tue, 15 May 2012 22:04:07 +0000 (00:04 +0200)]
coverage: Add test for applicable structs.

* test-suite/tests/coverage.test ("procedure-execution-count")["applicable
  struct"]: New test.

12 years agoMerge remote-tracking branch 'origin/stable-2.0' master
Andy Wingo [Wed, 23 May 2012 10:38:56 +0000 (12:38 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

This commit removes code that was newly deprecated in stable-2.0.

Conflicts:
libguile/deprecated.c
libguile/deprecated.h
libguile/modules.c
module/ice-9/boot-9.scm
module/ice-9/deprecated.scm

12 years agofinish deprecating eval closures
Andy Wingo [Wed, 23 May 2012 10:11:08 +0000 (12:11 +0200)]
finish deprecating eval closures

* libguile/deprecated.h:
* libguile/deprecated.c (scm_eval_closure_lookup)
  (scm_standard_eval_closure, scm_standard_interface_eval_closure)
  (scm_eval_closure_module): Deprecate these, as they are unused.

* libguile/modules.h:
* libguile/modules.c: Remove deprecated code.

* module/oop/goops/util.scm (top-level-env, top-level-env?): Deprecate.

* module/ice-9/deprecated.scm (set-system-module!): Deprecate.
  (module-eval-closure): Deprecate, by overriding the core definition to
  return a fresh eval closure.

* module/ice-9/boot-9.scm (make-module): Don't set an eval closure on
  the module.
  (the-root-module, the-scm-module): Don't call set-system-module!.

12 years agodeprecate lookup closures
Andy Wingo [Wed, 23 May 2012 10:00:23 +0000 (12:00 +0200)]
deprecate lookup closures

* libguile/deprecated.h (SCM_TOP_LEVEL_LOOKUP_CLOSURE):
* libguile/deprecated.c (scm_lookup_closure_module):
  (scm_module_lookup_closure):
  (scm_current_module_lookup_closure): Deprecate this part of the eval
  closure interface.  It was unused internally, after the scm_sym2var
  refactor.

* libguile/eval.h:
* libguile/modules.c:
* libguile/modules.h: Remove deprecated code.

* libguile/goops.c (scm_ensure_accessor): Use scm_module_variable
  instead of calling the lookup closure.  However I'm not sure that this
  code is used at all.

12 years agodeprecate scm_sym2var
Andy Wingo [Wed, 23 May 2012 09:46:30 +0000 (11:46 +0200)]
deprecate scm_sym2var

* libguile/deprecated.h:
* libguile/deprecated.c (scm_sym2var): Deprecate this function.

* libguile/modules.h:
* libguile/modules.c (scm_module_ensure_local_variable): New public
  function, replacing scm_sym2var with a true definep, without going
  through eval closures (which are deprecated).
  (scm_current_module): Rework to do something sensible before modules
  are booted.
  (scm_module_lookup, scm_lookup): Refactor to use scm_module_variable.
  (scm_module_define, scm_define): Refactor to use
  scm_module_ensure_local_variable.

* libguile/vm-i-system.c (define!): Use scm_define.

* libguile/vm.c (resolve_variable): Use scm_module_lookup.

* libguile/macros.c (scm_make_syntax_transformer): Use
  scm_module_variable.

* libguile/gdbint.c (gdb_binding): Use scm_define.

* doc/ref/api-modules.texi (Accessing Modules from C): Add docs for
  scm_module_ensure_local_variable.

12 years agoMerge remote-tracking branch 'origin/master'
Andy Wingo [Mon, 21 May 2012 17:20:55 +0000 (19:20 +0200)]
Merge remote-tracking branch 'origin/master'

12 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Mon, 21 May 2012 17:20:27 +0000 (19:20 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
module/language/tree-il/analyze.scm
module/language/tree-il/effects.scm
module/language/tree-il/fix-letrec.scm
module/language/tree-il/peval.scm
test-suite/tests/cse.test
test-suite/tests/peval.test

12 years agofix arity check for applicable structs
Andy Wingo [Mon, 21 May 2012 16:06:34 +0000 (18:06 +0200)]
fix arity check for applicable structs

* module/language/tree-il/analyze.scm (validate-arity): Fix for
  applicable structs.  Applicable structs are procedures, but not every
  struct has a first slot, and not every struct with a procedure in its
  first slot is applicable.  Besides, the approach in this patch gives
  better errors.

12 years agorearrange scheme compilation order
Andy Wingo [Mon, 21 May 2012 15:48:45 +0000 (17:48 +0200)]
rearrange scheme compilation order

* module/Makefile.am (SOURCES): Move vlists, srfi-1, peval, and cse up
  in the compilation order.  These are exercised a lot in the compiler.

12 years agovm.c: remove a useless check
Andy Wingo [Mon, 21 May 2012 15:31:58 +0000 (17:31 +0200)]
vm.c: remove a useless check

* libguile/vm.c: Remove a check for modules being booted.  If the module
  passed in is true, that is guaranteed to have been the case.  Passes a
  fresh bootstrap.

12 years agoFix FFI struct sizing to account for trailing padding.
Ken Raeburn [Mon, 21 May 2012 04:30:45 +0000 (00:30 -0400)]
Fix FFI struct sizing to account for trailing padding.

* libguile/foreign.c (scm_sizeof): Make sure the overall size is a
  multiple of the alignment of the structure.
* test-suite/tests/foreign.test: Test size of { double, int8 }.

12 years agoFix lock handling bug in commit aac980de43a0466b968a56607664f5ebbca6b751.
Ken Raeburn [Sun, 20 May 2012 09:22:01 +0000 (05:22 -0400)]
Fix lock handling bug in commit aac980de43a0466b968a56607664f5ebbca6b751.

* libguile/weak-set.c (resize_set): When releasing a lock temporarily to do
  an allocation, re-lock it afterwards, instead of unlocking again.
* libguile/weak-table.c (resize_table): Likewise.

12 years agoinline scm_cons, scm_car, scm_cdr
Andy Wingo [Thu, 17 May 2012 09:21:15 +0000 (11:21 +0200)]
inline scm_cons, scm_car, scm_cdr

* libguile/pairs.h (scm_cons, scm_car, scm_cdr): Define these as inline
  functions.
  (scm_is_pair): Move here from inline.h.
* libguile/pairs.c: Remove definitions here, and define gsubrs.

* libguile/inline.h: Remove scm_is_pair implementation.
* libguile/inline.c: Include pairs.h to residualize inlines from
  pairs.h.

12 years agoadd guile-2.2 feature
Andy Wingo [Thu, 17 May 2012 08:19:33 +0000 (10:19 +0200)]
add guile-2.2 feature

* module/ice-9/boot-9.scm (%cond-expand-features): Add guile-2.2
  feature.

12 years agoAdd more `%file-port-name-canonicalization' tests.
Ludovic Courtès [Tue, 15 May 2012 17:12:39 +0000 (19:12 +0200)]
Add more `%file-port-name-canonicalization' tests.

* test-suite/tests/ports.test ("%file-port-name-canonicalization")["relative
  canonicalization with /", "relative canonicalization from ice-9",
  "absolute canonicalization from ice-9"]: New tests.

12 years agoFix relative file name canonicalization with empty %LOAD-PATH entries.
Ludovic Courtès [Tue, 15 May 2012 17:05:37 +0000 (19:05 +0200)]
Fix relative file name canonicalization with empty %LOAD-PATH entries.

* libguile/filesys.c (scm_i_relativize_path): Don't attempt to
  canonicalize when encountering an entry of IN_PATH that is the empty
  string.

* test-suite/tests/ports.test (with-load-path): New macro.
  ("%file-port-name-canonicalization"): New test prefix.

12 years agofix the cse tests
Andy Wingo [Tue, 15 May 2012 15:37:57 +0000 (17:37 +0200)]
fix the cse tests

* test-suite/tests/cse.test (pass-if-cse): Fix-letrec and canonicalize
  the output, so that unreferenced failure continuations get trimmed.
  ("cse"): Fix the two tests regarding bailout info.

12 years agocse passes a lookup procedure to the effects analyzer
Andy Wingo [Tue, 15 May 2012 15:23:06 +0000 (17:23 +0200)]
cse passes a lookup procedure to the effects analyzer

* module/language/tree-il/cse.scm (cse): Arrange to pass a lookup
  procedure to compute-effects, for better effects analysis.

12 years agobetter effects analysis for calls to lexically bound procedures
Andy Wingo [Tue, 15 May 2012 15:22:05 +0000 (17:22 +0200)]
better effects analysis for calls to lexically bound procedures

* module/language/tree-il/effects.scm (make-effects-analyzer): The
  analyzer will take an optional second argument, a lookup procedure of
  type sym -> exp.  This can let the analyzer dig into calls to
  lexically bound procedures.

12 years agofix-letrec tweak
Andy Wingo [Tue, 15 May 2012 15:20:57 +0000 (17:20 +0200)]
fix-letrec tweak

* module/language/tree-il/fix-letrec.scm (make-sequence*, fix-letrec!):
  When turning unreferenced bindings into sequences, don't bother
  emitting trivially constant expressions in effect position.

12 years agoCSE in tail position
Andy Wingo [Tue, 15 May 2012 15:20:01 +0000 (17:20 +0200)]
CSE in tail position

* module/language/tree-il/cse.scm (singly-valued-expression?, cse):
  Allow CSE to propagate lexicals to tail positions, if the expression
  is singly-valued.

12 years agostronger conditional optimization
Andy Wingo [Tue, 15 May 2012 10:21:57 +0000 (12:21 +0200)]
stronger conditional optimization

* module/language/tree-il/peval.scm (peval): If we can lift one common
  test, see if we can lift others as well.

* test-suite/tests/peval.test: Add a test.

12 years agooptimization for chain of if expressions with common tests
Andy Wingo [Tue, 15 May 2012 10:18:30 +0000 (12:18 +0200)]
optimization for chain of if expressions with common tests

* module/language/tree-il/peval.scm (peval): Optimize common tests in
  chains of "if" expressions, like those generated by matchers.

* test-suite/tests/peval.test ("partial evaluation"): Add a test.

12 years agomvoe tree-il=? and tree-il-hash to tree-il.scm
Andy Wingo [Tue, 15 May 2012 10:14:22 +0000 (12:14 +0200)]
mvoe tree-il=? and tree-il-hash to tree-il.scm

* module/language/tree-il.scm (tree-il=?, tree-il-hash): Move these
  helpers here, from cse.scm.  Export them.

* module/language/tree-il/cse.scm (cse): Adapt accordingly.

12 years agoHonor $(program_transform_name) for the `guile-tools' symlink.
Ludovic Courtès [Mon, 14 May 2012 17:21:35 +0000 (19:21 +0200)]
Honor $(program_transform_name) for the `guile-tools' symlink.

Fixes <http://bugs.gnu.org/11451>.
Reported by Cyprien Nicolas <c.nicolas@gmail.com>.

* meta/Makefile.am (install-data-hook): Honor $(program_transform_name).

12 years agoHave `-Wformat' remain quiet for any procedure called `_' or `N_'.
Ludovic Courtès [Sat, 12 May 2012 14:11:51 +0000 (16:11 +0200)]
Have `-Wformat' remain quiet for any procedure called `_' or `N_'.

* module/language/tree-il/analyze.scm (proc-ref?)[special?]: New
  procedure.
  Return #t for any toplevel-ref of `_'.

* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
  format string using gettext as top-level _"): New test.

12 years agoHave `-Warity-mismatch' handle applicable structs.
Ludovic Courtès [Sat, 12 May 2012 13:58:23 +0000 (15:58 +0200)]
Have `-Warity-mismatch' handle applicable structs.

* module/language/tree-il/analyze.scm (arity-analysis): Honor applicable
  structs.

* test-suite/tests/tree-il.test ("warnings")["arity
  mismatch"]("top-level applicable struct", "top-level applicable struct
  with wrong arguments"): New tests.

12 years agoImprove special-casing of `_' in `-Wformat'.
Ludovic Courtès [Sat, 12 May 2012 13:31:28 +0000 (15:31 +0200)]
Improve special-casing of `_' in `-Wformat'.

* module/language/tree-il/analyze.scm (proc-ref?): Check for
  SPECIAL-NAME in the <module-ref> and <lexical-ref> cases too.

* test-suite/tests/tree-il.test ("warnings")["format"]("non-literal
  format string using gettext as module-ref _", "non-literal format
  string using gettext as lexical _"): New tests.

12 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Fri, 11 May 2012 12:31:17 +0000 (14:31 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

12 years agofix more assumptions that the frame-procedure is a procedure
Andy Wingo [Fri, 11 May 2012 12:30:43 +0000 (14:30 +0200)]
fix more assumptions that the frame-procedure is a procedure

* libguile/frames.c (scm_frame_source, scm_frame_previous):
* libguile/stacks.c (scm_make_stack):
* module/ice-9/boot-9.scm (exception-printers):
* module/system/vm/frame.scm (frame-call-representation): Fix more
  assumptions that frame-procedure is a program, or even a procedure.

12 years agoMerge remote-tracking branch 'origin/stable-2.0' into stable-2.0
Andy Wingo [Thu, 10 May 2012 13:55:25 +0000 (15:55 +0200)]
Merge remote-tracking branch 'origin/stable-2.0' into stable-2.0

12 years agoMerge remote-tracking branch 'local-2.0/stable-2.0'
Andy Wingo [Thu, 10 May 2012 11:02:11 +0000 (13:02 +0200)]
Merge remote-tracking branch 'local-2.0/stable-2.0'

Conflicts:
libguile/vm-engine.c
libguile/vm-i-system.c
libguile/vm.c

12 years agorefactor vm application of non-programs; boot continuation refactor
Andy Wingo [Thu, 10 May 2012 10:43:33 +0000 (12:43 +0200)]
refactor vm application of non-programs; boot continuation refactor

* libguile/frames.c (scm_frame_instruction_pointer):
* module/system/vm/frame.scm (frame-bindings):
  (frame-next-source, frame-call-representation): Fix a few locations
  that thought that the frame-procedure will always be a VM
  procedure.  This will not not be the case when traversing the stack of
  an application of a non-procedure.

* libguile/vm-i-system.c (call, tail-call, mv-call): Instead of
  special-casing structs and smobs at these call sites, just set up the
  stack, and jump to a generic apply loop if the proc is not a program.

* libguile/vm-engine.c: The generic apply loop is here.  Also, the boot
  program is now simply a boot continuation, and can handle any number
  of arguments.

* libguile/vm.c (make_boot_program): Update the code that makes the boot
  continuation.

12 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Tue, 8 May 2012 20:43:04 +0000 (22:43 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
libguile/ports.c
libguile/ports.h
libguile/read.c
libguile/vm-i-system.c

12 years agoAdd missing `SCM_API' for `scm_take_from_input_buffers'.
Ludovic Courtès [Tue, 8 May 2012 10:43:06 +0000 (12:43 +0200)]
Add missing `SCM_API' for `scm_take_from_input_buffers'.

* libguile/ports.h (scm_take_from_input_buffers): Add `SCM_API'.

12 years agoFix `setvbuf' to leave the line/column number unchanged.
Ludovic Courtès [Tue, 8 May 2012 10:43:06 +0000 (12:43 +0200)]
Fix `setvbuf' to leave the line/column number unchanged.

* libguile/fports.c (scm_setvbuf): Use `scm_take_from_input_buffers'
  directly instead of `scm_drain_input'; use `scm_unget_byte' instead of
  `scm_unread_string' to put the drained input back to PORT.  This
  leaves PORT's line/column numbers unchanged, whereas they'd previously
  be decreased by the `scm_unread_string' call.

* libguile/ports.c (scm_take_from_input_buffers): Update description and
  variable names to refer to "bytes", not "chars".

* test-suite/tests/ports.test ("setvbuf"): New test prefix.

12 years agodocbook->texi fix
Andy Wingo [Tue, 8 May 2012 14:03:54 +0000 (16:03 +0200)]
docbook->texi fix

* module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Only convert
  ulink to uref if there is a URL attribute.

12 years ago(texinfo docbook) support for @acronym
Andy Wingo [Mon, 7 May 2012 18:39:14 +0000 (20:39 +0200)]
(texinfo docbook) support for @acronym

* module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Recognize
  "acronym" as parsing to the @acronym texinfo command.

12 years agoadd support for texinfo parsed arguments, like @acronym
Andy Wingo [Mon, 7 May 2012 18:18:56 +0000 (20:18 +0200)]
add support for texinfo parsed arguments, like @acronym

* module/texinfo.scm (texi-command-specs): Add a new kind of texinfo
  command, inline-text-args, a sort of a cross between inline-args,
  which are unparsed, and inline-text, which is.  Perhaps this should
  supersede inline-args at some point.  In any case, add acronym as an
  inline-text-args element.
  (inline-content?, arguments->attlist, complete-start-command)
  (parse-inline-text-args, make-dom-parser): Adapt for
  inline-text-args.

* module/texinfo/serialize.scm (inline-text-args): Add serialization for
  @acronym.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add some
  tests.

12 years agoAdd a missing SYNC_ALL in variable-ref
Andy Wingo [Wed, 2 May 2012 10:59:11 +0000 (12:59 +0200)]
Add a missing SYNC_ALL in variable-ref

* libguile/vm-i-system.c (variable-ref): Add a missing SYNC_ALL.

12 years agoOptimize `scm_read_string'.
Ludovic Courtès [Sun, 6 May 2012 22:32:01 +0000 (00:32 +0200)]
Optimize `scm_read_string'.

According to the new benchmarks, this leads a 5% speed improvement when
reading small strings, and a 27% improvement when reading large strings.

* libguile/read.c (READER_STRING_BUFFER_SIZE): Change to 128; update
  comment to mention codepoints.
  (scm_read_string): Make `str' a list of strings, instead of a string.
  Store characters read in buffer `c_str'.  Cons to STR when C_STR is
  full, and concatenate/reverse at the end.

* benchmark-suite/benchmarks/read.bm (small, large): New variables.
  Set %DEFAULT-PORT-ENCODING to "UTF-8".
  ("read")["small strings", "large strings"]: New benchmarks.

12 years agoMake `scm_unget_byte' public.
Ludovic Courtès [Sun, 6 May 2012 20:24:47 +0000 (22:24 +0200)]
Make `scm_unget_byte' public.

* libguile/ports.h (scm_unget_byte): Make `SCM_API' instead of
  `SCM_INTERNAL'.

12 years agoread: Avoid `void *' pointer arithmetic.
Ludovic Courtès [Sun, 6 May 2012 20:23:58 +0000 (22:23 +0200)]
read: Avoid `void *' pointer arithmetic.

* libguile/read.c (read_complete_token): Make `new_buf' a `char *' to
  avoid pointer arithmetic on `void *'.

12 years agoBuild with `-Wpointer-arith' when available.
Ludovic Courtès [Sun, 6 May 2012 20:23:12 +0000 (22:23 +0200)]
Build with `-Wpointer-arith' when available.

* configure.ac (POTENTIAL_GCC_CFLAGS): Add `-Wpointer-arith'.