bpt/guile.git
13 years agoadd HTTP module
Andy Wingo [Sun, 24 Oct 2010 10:36:17 +0000 (12:36 +0200)]
add HTTP module

* module/web/http.scm: New module, declares known HTTP headers, and
  their parsers and unparsers.

* test-suite/tests/web-http.test: Add test suite.

* module/Makefile.am:
* test-suite/Makefile.am: Adapt.

13 years agoURI parsing errors throw to `uri-error'
Andy Wingo [Sat, 23 Oct 2010 13:23:42 +0000 (15:23 +0200)]
URI parsing errors throw to `uri-error'

* module/web/uri.scm (uri-error): New proc, throws to 'uri-error.
  (validate-uri, uri-decode, uri-encode): Use uri-error.

* test-suite/tests/web-uri.test: Update for uri-error.

13 years agoFinish adding api-regex.texi
Neil Jerram [Thu, 4 Nov 2010 01:13:16 +0000 (01:13 +0000)]
Finish adding api-regex.texi

* doc/ref/Makefile.am (guile_TEXINFOS): Add api-regex.texi, so that it
  gets into distributions.

13 years agoAdd implementation of SRFI 38
Andreas Rottmann [Tue, 2 Nov 2010 23:19:54 +0000 (00:19 +0100)]
Add implementation of SRFI 38

* module/srfi/srfi-38.scm: New file, partly based on the reference
  implementation and on Alex Shinn's public-domain implementation for
  Chicken.
* module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-38.scm.

* test-suite/tests/srfi-38.test: New file, minimal test suite for SRFI
  38.
* test-suite/Makefile.am (SCM_TESTS): Added tests/srfi-38.test.

* doc/ref/srfi-modules.texi: Add a node for SRFI 38.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoUse a fluid for the list of the reader's "hash procedures"
Andreas Rottmann [Tue, 2 Nov 2010 23:09:57 +0000 (00:09 +0100)]
Use a fluid for the list of the reader's "hash procedures"

This allows customizing the reader behavior for a dynamic extent more easily.

* libguile/read.c (scm_read_hash_procedures): Renamed to
  `scm_i_read_hash_procedures'.
  (scm_i_read_hash_procedures_ref, scm_i_read_hash_procedures_set_x):
  New (internal) accessor functions for the fluid.
  (scm_read_hash_extend, scm_get_hash_procedure): Use these accessor
  functions.
  (scm_init_read): Create the fluid, named `%read-hash-procedures' instead of
  the previous plain list `read-hash-procedures'.

* test-suite/tests/reader.test: Adapt the "R6RS/SRFI-30 block comment
  syntax overridden" test to make use of the fluid.

* module/ice-9/deprecated.scm (read-hash-procedures):
  New identifier macro -- backward-compatibility shim.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoManual sections don't need a page break before
Neil Jerram [Sun, 31 Oct 2010 08:34:05 +0000 (08:34 +0000)]
Manual sections don't need a page break before

* doc/ref/api-coverage.texi (Code Coverage): Remove @page.

* doc/ref/api-foreign.texi (Foreign Function Interface): Ditto.

* doc/ref/api-lalr.texi: (LALR(1) Parsing): Ditto.

* doc/ref/api-macros.texi (Macros): Ditto.

13 years agoAdd ref to new location for regex doc
Neil Jerram [Sun, 31 Oct 2010 08:27:56 +0000 (08:27 +0000)]
Add ref to new location for regex doc

* doc/ref/api-data.texi: Add ref to new location for regex doc.  Also
  correct other refs to say section rather than chapter.

13 years agoPromote regex doc out of the `Simple Data Types' section
Neil Jerram [Sun, 31 Oct 2010 08:24:28 +0000 (08:24 +0000)]
Promote regex doc out of the `Simple Data Types' section

Because that probably isn't where people will look for it.
Thanks to Noah Lavine for the idea.

* doc/ref/api-regex.texi (Regular Expressions): New file, containing
  the regex doc (promoted one level) that used to be in api-data.texi.

* doc/ref/guile.texi (API Reference): Include new file, and add menu
  entry for the new section.

* THANKS: Add Noah.

13 years agoFix typo in the (system base lalr) documentation.
Ludovic Courtès [Wed, 27 Oct 2010 22:03:54 +0000 (00:03 +0200)]
Fix typo in the (system base lalr) documentation.

* doc/ref/api-lalr.texi (LALR(1) Parsing): "The tokenizer should be a
  unary procedure" -> "thunk".  Patch by Noah Lavine
  <noah.b.lavine@gmail.com>.

13 years agoExtend the #:replace list of the SRFI 69 module
Andreas Rottmann [Wed, 27 Oct 2010 21:33:40 +0000 (23:33 +0200)]
Extend the #:replace list of the SRFI 69 module

* module/srfi/srfi-69.scm: Add `make-hash-table' and `hash-table?' to
  the #:replace list of the module definition.

13 years agoHave "frisk" recognize `#:use-module' and `#:autoload'.
Ludovic Courtès [Wed, 27 Oct 2010 21:31:49 +0000 (23:31 +0200)]
Have "frisk" recognize `#:use-module' and `#:autoload'.

* module/scripts/frisk.scm (grok-proc): Support keywords `#:use-module'
  and `#:autoload'.

13 years agoAugment `arithmetic.bm'.
Ludovic Courtès [Wed, 27 Oct 2010 21:28:58 +0000 (23:28 +0200)]
Augment `arithmetic.bm'.

* benchmark-suite/benchmarks/arithmetic.bm (repeat): Change the syntax.
  Add support for binary OP.
  ("fixnum")["1+", "1-"]: Adjust accordingly.
  ["+", "-"]: New benchmarks.

13 years agoFix manual typo
Neil Jerram [Tue, 26 Oct 2010 08:11:52 +0000 (09:11 +0100)]
Fix manual typo

* doc/ref/api-foreign.texi: "prodedures" -> "procedures".

13 years agoImprove performance of R6RS records implementation
Julian Graham [Sun, 10 Oct 2010 05:35:26 +0000 (01:35 -0400)]
Improve performance of R6RS records implementation

Reimplement record-type descriptors as vtables for record structs, saving
us what was an expensive inspection of a record's vtable layout string to
determine its type.

* module/rnrs/records/inspection.scm (record-field-mutable?): Check
  mutability using the bit field stored in the record-type descriptor
  instead of the record struct's vtable.
* module/rnrs/records/procedural.scm (record-internal?): Reimplement as a
  delegation to a check of the passed struct's vtable against
  `record-type-descriptor?'.
  (record-type-vtable): Modify to include base vtable layout as a prefix
  of the record-type-descriptor layout so that all record-type instances
  are now also vtables.
  (make-record-type-descriptor): Remove field vtable; build up a mutability
  bit field to use for fast mutability checks.
  (record-accessor, record-mutator): Use field struct and mutability bit
  field.

13 years agoTweak `-Wunused-variable' and `-Wunused-toplevel' for special names.
Ludovic Courtès [Wed, 20 Oct 2010 20:40:10 +0000 (22:40 +0200)]
Tweak `-Wunused-variable' and `-Wunused-toplevel' for special names.

* module/language/tree-il/analyze.scm (gensym?): New procedure.
  (unused-variable-analysis): Ignore variables whose name passes
  `gensym?' or is `_'.
  (unused-toplevel-analysis): Ignore variables whose name passes
  `gensym?'.

* test-suite/tests/tree-il.test ("warnings")["unused-variable"]("special
  variable names"): New test.
  ["unused-toplevel"]("special variable names"): New test.

13 years agoAdd `Libs.private' to the `.pc' files.
Ludovic Courtès [Tue, 19 Oct 2010 21:36:04 +0000 (23:36 +0200)]
Add `Libs.private' to the `.pc' files.

* meta/guile-2.0-uninstalled.pc.in (Libs): Remove @GUILE_LIBS@.
  (Libs.private): New field.
* meta/guile-2.0.pc.in (Libs): Remove @GUILE_LIBS@.
  (Libs.private): New field.

13 years agoconfigure: Don't needlessly augment $LIBS (and $GUILE_LIBS.)
Ludovic Courtès [Tue, 19 Oct 2010 21:32:16 +0000 (23:32 +0200)]
configure: Don't needlessly augment $LIBS (and $GUILE_LIBS.)

* configure.ac: Don't augment $LIBS with $LTLIBUNISTRING and
  $BDW_GC_LIBS.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
  Remove @LTLIBINTL@.  Add $(BDW_GC_LIBS).

13 years agoAdd support for more multicast sockopts.
Tristan Colgate-McFarlane [Wed, 20 Oct 2010 08:36:32 +0000 (09:36 +0100)]
Add support for more multicast sockopts.

* libguile/socket.c: Add support for IP_MULTICAST_TTL and IP_MILTICAST_IF sockopts.

13 years agoFix detection of struct ip_mreq
Tristan Colgate-McFarlane [Wed, 20 Oct 2010 08:28:30 +0000 (09:28 +0100)]
Fix detection of struct ip_mreq

* configura.ac: netinet/in.h is required to complete definition of
  struct ip_mreq.

13 years agordelim cleanups
Andy Wingo [Tue, 19 Oct 2010 20:58:00 +0000 (22:58 +0200)]
rdelim cleanups

* module/ice-9/rdelim.scm: Clean up export list.
  (read-line!, read-delimited!, read-delimited, read-line): Use
  define*.

13 years agomore -Wundef on darwin fixes
Andy Wingo [Mon, 18 Oct 2010 11:35:46 +0000 (13:35 +0200)]
more -Wundef on darwin fixes

* libguile/threads.c:
* libguile/posix.c: Change a couple #if HAVE_FOO to #ifdef HAVE_FOO to
  pacify -Wundef. Some vars are defined or not, whereas some are always
  defined to 0 or 1. The inconsistency is unfortunate.

13 years agouninitialized var in scm_read_character
Andy Wingo [Mon, 18 Oct 2010 11:29:58 +0000 (13:29 +0200)]
uninitialized var in scm_read_character

* libguile/read.c (scm_read_character): Fix error condition where
  charname could be uninitialized.

13 years ago_scm GUILE_USE_64_CALLS compilation warning fix
Andy Wingo [Mon, 18 Oct 2010 11:27:17 +0000 (13:27 +0200)]
_scm GUILE_USE_64_CALLS compilation warning fix

* libguile/_scm.h: Check that GUILE_USE_64_CALLS is defined. Fixes an
  error on i386-apple-darwin9.8.0.

13 years agoweb/uri: reimplement for rfc 3986, add tests
Andy Wingo [Fri, 15 Oct 2010 18:56:42 +0000 (20:56 +0200)]
web/uri: reimplement for rfc 3986, add tests

* module/web/uri.scm: Reimplement for RFC 3986.

* module/Makefile.am: Add to build.

* test-suite/Makefile.am:
* test-suite/tests/web-uri.test: Add tests.

13 years agoimport uri.scm from tekuti, from guile-www
Andy Wingo [Fri, 15 Oct 2010 18:51:29 +0000 (20:51 +0200)]
import uri.scm from tekuti, from guile-www

13 years agoBump version number for 1.9.13.
Ludovic Courtès [Fri, 15 Oct 2010 08:19:57 +0000 (10:19 +0200)]
Bump version number for 1.9.13.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

13 years agoUpdate `cpp-E.syms' and `cpp-SIG.syms'.
Ludovic Courtès [Fri, 15 Oct 2010 08:36:36 +0000 (10:36 +0200)]
Update `cpp-E.syms' and `cpp-SIG.syms'.

* libguile/cpp-E.syms, libguile/cpp-SIG.syms: Update on a Glibc 2.11.1
  system.

13 years agoFix the `chknew-E' and `chknew-SIG' rules.
Ludovic Courtès [Fri, 15 Oct 2010 08:34:33 +0000 (10:34 +0200)]
Fix the `chknew-E' and `chknew-SIG' rules.

* libguile/Makefile.am (chknew-E chknew-SIG): Run gcc without `-undef'
  since otherwise it ends up trying to include headers that are not
  available (e.g., <gnu/stubs-32.h> on an x86_64-linux-gnu system.)

13 years agoUnresolved var errors don't work for top-level vars
Michael Gran [Fri, 15 Oct 2010 01:27:41 +0000 (18:27 -0700)]
Unresolved var errors don't work for top-level vars

* libguile/vm-i-system.c (toplevel_ref, long_toplevel_ref): modified

13 years agoUpdate charsets to Unicode 6.0.0
Michael Gran [Fri, 15 Oct 2010 01:21:28 +0000 (18:21 -0700)]
Update charsets to Unicode 6.0.0

* libguile/srfi-14.i.c: regenerated

13 years agore-implement srfi-34's guard with syntax-case
Andy Wingo [Thu, 14 Oct 2010 14:13:57 +0000 (16:13 +0200)]
re-implement srfi-34's guard with syntax-case

* module/srfi/srfi-34.scm (guard): Re-implement using syntax-case.

13 years agossax: add procs to define parsed entities
Andy Wingo [Thu, 14 Oct 2010 10:37:31 +0000 (12:37 +0200)]
ssax: add procs to define parsed entities

* module/sxml/ssax.scm (reset-parsed-entity-definitions!)
  (define-parsed-entity!): New heavy-handed knobs for adding to the set
  of parsed entity definitions.

13 years agoNuke GOOPS `Quick Start' section, in favour of the `Tutorial'
Neil Jerram [Wed, 13 Oct 2010 22:16:29 +0000 (23:16 +0100)]
Nuke GOOPS `Quick Start' section, in favour of the `Tutorial'

These sections are pretty similar in aim, but `Tutorial' is mostly
better material.

* doc/ref/goops-tutorial.texi (Class definition): Add a sentence about
  what slots are.

* doc/ref/goops-tutorial.texi (Tutorial): Remove repetition of the Stk
  origin, and index entries that are overly general in the context of
  the whole Guile manual.

  (Generic functions): Add text here about the nature of methods,
  previously in Quick Start.

* doc/ref/goops.texi (Quick Start): Move `Built-in classes' subsection
  to be part of `Introspection'.  Delete the rest, apart from snippets
  moved into Tutorial.

13 years agofix bug in with-fluids in a non-tail position
Andy Wingo [Wed, 13 Oct 2010 19:18:44 +0000 (21:18 +0200)]
fix bug in with-fluids in a non-tail position

* libguile/vm-i-system.c (VM_DEFINE_INSTRUCTION): Drop the stack items
  corresponding the the with-fluids object. Thanks very much to Stefan
  Israelsson Tampe for the fix.

13 years agoOptimize `1+' and `1-' on fixnums.
Ludovic Courtès [Tue, 12 Oct 2010 23:31:19 +0000 (01:31 +0200)]
Optimize `1+' and `1-' on fixnums.

* libguile/vm-i-scheme.c (INUM_MAX, INUM_MIN): New macros.
  (add1, sub1): Add/subtract without untagging the operand.  This leads
  to a 44% run time improvement compared to the previous
  implementation.

* libguile/vm.c: Include <stdint.h>.

* test-suite/tests/numbers.test ("1+", "1-"): Add tests for
  MOST-POSITIVE-FIXNUM, resp. MOST-NEGATIVE-FIXNUM, for 32-bit and
  34-bit values thereof.

* benchmark-suite/benchmarks/arithmetic.bm: New file.

* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add it.

13 years agoEdit `Adding Methods to Generic Functions'
Neil Jerram [Tue, 12 Oct 2010 23:08:27 +0000 (00:08 +0100)]
Edit `Adding Methods to Generic Functions'

* doc/ref/goops.texi (Adding Methods to Generic Functions): Move the
  bit about no applicable methods to `Invoking Generic Functions'.
  Other minor edits.
  (Basic Method Definition): Flattened into parent.
  (Method Definition Internals): Moved to MOP section at end of
  chapter.

13 years agoTwo very small edits
Neil Jerram [Tue, 12 Oct 2010 22:41:41 +0000 (23:41 +0100)]
Two very small edits

* doc/ref/goops.texi (User-defined classes): Remove brackets around
  `formally', for better flow.
  (Creating Instances): Lengthen hyphen.

13 years agoEdit `Generic Functions and Accessors'
Neil Jerram [Tue, 12 Oct 2010 22:40:01 +0000 (23:40 +0100)]
Edit `Generic Functions and Accessors'

* doc/ref/goops.texi (Generic Function Internals): Moved to MOP section
  at end of chapter.
  (Basic Generic Function Creation): Flattened into parent, and text
  simplified.
  (Extending Primitives): Renamed from `Extending Guiles Primitives';
  removed `generic-capability?', which is no longer available;
  simplified a bit.
  (Merging Generics): New subsection for the material about merging;
  text simplified a bit.

13 years agoAllocate complex numbers in contiguous pointer-less memory.
Ludovic Courtès [Tue, 12 Oct 2010 20:57:08 +0000 (22:57 +0200)]
Allocate complex numbers in contiguous pointer-less memory.

* libguile/numbers.h (SCM_COMPLEX_MEM): Remove.
  (SCM_COMPLEX_REAL): Change to just fetch the `real' field of the
  pointed-to `scm_t_complex'.
  (SCM_COMPLEX_IMAG): Likewise.
  (scm_t_complex)[type, pad]: New fields.

* libguile/numbers.c (scm_c_make_rectangular): Allocate the whole
  complex contiguously, with `scm_gc_malloc_pointerless'.

13 years agoAllocate inexact numbers in pointer-less memory.
Ludovic Courtès [Tue, 12 Oct 2010 20:00:28 +0000 (22:00 +0200)]
Allocate inexact numbers in pointer-less memory.

* libguile/numbers.c (scm_from_double): Use `scm_gc_malloc_pointerless'
  instead of `scm_double_cell'.

13 years agoPlacate `-Wformat'.
Ludovic Courtès [Tue, 12 Oct 2010 19:59:53 +0000 (21:59 +0200)]
Placate `-Wformat'.

* module/scripts/compile.scm (fail): Use a fancy format string instead
  of a non-literal one.

13 years agoupdate NEWS for 1.9.13
Andy Wingo [Tue, 12 Oct 2010 20:27:01 +0000 (22:27 +0200)]
update NEWS for 1.9.13

* NEWS: Update for 1.9.13.

13 years agoAdd TeX form of jao's name
Neil Jerram [Tue, 12 Oct 2010 19:00:21 +0000 (20:00 +0100)]
Add TeX form of jao's name

* doc/ref/scheme-using.texi: Add TeX equivalent for José.

13 years agofold old news items into main news body
Andy Wingo [Tue, 12 Oct 2010 11:58:39 +0000 (13:58 +0200)]
fold old news items into main news body

* NEWS: Fold 1.9.12 items into the main body.

13 years ago,frame and related commands handle for-trap? appropriately
Andy Wingo [Tue, 12 Oct 2010 11:24:46 +0000 (13:24 +0200)]
,frame and related commands handle for-trap? appropriately

* module/system/repl/debug.scm (print-frame): Add #:next-source? arg,
  for when print-frame should use frame-next-source instead of
  frame-source.
  (print-frames): Add #:for-trap? arg. If true, the 0th frame should be
  printed with frame-next-source.

* module/system/repl/command.scm (define-stack-command): Introduce
  for-trap? into the lexical env.
  (backtrace, up, down, frame): Update to do the right thing regarding
  #:for-trap?.

13 years agodon't warn for (format #t fmt) -- format string actually named fmt
Andy Wingo [Tue, 12 Oct 2010 11:11:40 +0000 (13:11 +0200)]
don't warn for (format #t fmt) -- format string actually named fmt

* module/language/tree-il/analyze.scm (format-analysis): Don't warn on
  non-literal format string if the format string is a lexical ref to a
  variable named "fmt". A slight hack, but effective :)
* module/system/repl/command.scm (display-stat): Rename the format
  string to "fmt".

13 years agodebug has for-trap? field
Andy Wingo [Tue, 12 Oct 2010 11:09:48 +0000 (13:09 +0200)]
debug has for-trap? field

* module/system/repl/debug.scm (<debug>): New field, `for-trap?'. True
  if the stack is for a trap, and thus the top frame should use
  frame-next-source instead of frame-source.

* module/system/repl/command.scm (repl-pop-continuation-resumer)
  (repl-next-resumer):
* module/system/repl/error-handling.scm (call-with-error-handling):
  Update callers.

13 years agoremove gds docs, telling users instead to use geiser and paredit
Andy Wingo [Tue, 12 Oct 2010 11:01:10 +0000 (13:01 +0200)]
remove gds docs, telling users instead to use geiser and paredit

* doc/ref/scheme-using.texi (Using Guile in Emacs): Remove GDS docs, as
  we don't have GDS any more. Instead of surveying the field, be
  opinionated and tell users what to use: Geiser and Paredit.

13 years agominor doc fixups
Andy Wingo [Tue, 12 Oct 2010 10:58:36 +0000 (12:58 +0200)]
minor doc fixups

* doc/ref/scheme-scripts.texi (Invoking Guile): Some typos.
* doc/ref/tour.texi (Running Guile Scripts): More typos and PDF
  improvements.
* doc/ref/scheme-using.texi (Readline, Value History): Minor rewording.
  (Help Commands): Minor fixup.

13 years agoadd --listen docs
Andy Wingo [Mon, 11 Oct 2010 21:53:40 +0000 (23:53 +0200)]
add --listen docs

* doc/ref/scheme-scripts.texi (Invoking Guile): Add --listen
  documentation.

13 years agopreface contributors tweaks
Andy Wingo [Mon, 11 Oct 2010 21:32:30 +0000 (23:32 +0200)]
preface contributors tweaks

* doc/ref/preface.texi (Contributors): A couple tweaks

13 years agoupdate preface.texi contributors
Andy Wingo [Mon, 11 Oct 2010 20:50:55 +0000 (22:50 +0200)]
update preface.texi contributors

* doc/ref/preface.texi (Contributors): Rewrite and update.

13 years agoAllow arbitrary code in ASSOC procedures for weak hash tables (bug #29616).
Ludovic Courtès [Mon, 11 Oct 2010 13:38:06 +0000 (15:38 +0200)]
Allow arbitrary code in ASSOC procedures for weak hash tables (bug #29616).

* libguile/hashtab.c (struct t_assoc_args, do_weak_bucket_assoc):
  Remove.
  (struct t_fixup_args): New type.
  (do_weak_bucket_fixup): New function.
  (weak_bucket_assoc): Use it.  Keep strong references to BUCKET's
  entries in STRONG_REFS.  Call ASSOC once the alloc lock has been
  released.  This fixes bug #29616.

* test-suite/tests/weaks.test ("assoc can do anything"): New test.

13 years agoFix a bug in weak hash table bucket fixup.
Ludovic Courtès [Mon, 11 Oct 2010 13:14:55 +0000 (15:14 +0200)]
Fix a bug in weak hash table bucket fixup.

* libguile/hashtab.c (scm_fixup_weak_alist): Keep the value of PREV
  unchanged after a nullified pair is deleted; this fixes a bug whereby
  if several successive nullified pairs were encountered, not all of them
  would be removed, and the assertion in `weak_bucket_assoc' would be
  hit.  In addition, remove the `scm_is_pair (pair)' test.

13 years agoFix typo.
Ludovic Courtès [Sun, 10 Oct 2010 17:09:20 +0000 (19:09 +0200)]
Fix typo.

* module/system/repl/command.scm (repl-pop-continuation-resumer): Remove
  extraneous argument to `format'.

13 years agoAdd warnings for obvious syntax errors in format strings.
Ludovic Courtès [Sun, 10 Oct 2010 17:08:11 +0000 (19:08 +0200)]
Add warnings for obvious syntax errors in format strings.

* module/language/tree-il/analyze.scm (&syntax-error): New variable.
  (format-string-argument-count): Throw to &SYNTAX-ERROR when a syntax
  error in a format string is encountered.
  (format-analysis): Catch &SYNTAX-ERROR and convert as a warning of the
  appropriate type.

* module/system/base/message.scm (%warning-types)[format]: Handle
  `syntax-error' warnings.

* test-suite/tests/tree-il.test
  ("warnings")["conditionals"]("unterminated", "unexpected ~;",
  "unexpected ~]"): New tests.
  ["unterminated ~{...~}"]: New test.

13 years agoAdd new `format' warnings.
Ludovic Courtès [Sun, 10 Oct 2010 16:10:18 +0000 (18:10 +0200)]
Add new `format' warnings.

* module/language/tree-il/analyze.scm (format-analysis): Add new
  sub-warnings: `wrong-port', `wrong-format-string',
  `non-literal-format-string', and `wrong-num-args'.

* module/system/base/message.scm (%warning-types)[format]: Handle
  them.

* test-suite/tests/tree-il.test ("warnings")["wrong port arg",
  "wrong format string", "non-literal format string",
  "wrong number of args"]: New tests.

13 years agoCompile with `-Wformat'.
Ludovic Courtès [Sun, 10 Oct 2010 15:13:36 +0000 (17:13 +0200)]
Compile with `-Wformat'.

* am/guilec (GUILE_WARNINGS): Add `-Wformat'.

13 years agoImplement fancy format string analysis.
Ludovic Courtès [Sun, 10 Oct 2010 15:13:21 +0000 (17:13 +0200)]
Implement fancy format string analysis.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Return two values, the minimum and maximum number of arguments.
  Add support for most of `format' escapes, including conditionals.
  (format-analysis): Adjust accordingly.

* module/system/base/message.scm (%warning-types)[format]: Take two
  arguments, MIN and MAX, instead of EXPECTED.  Display warning
  accordingly.

* test-suite/tests/tree-il.test ("warnings")["format"]("~%, ~~, ~&, ~t,
  ~_, and ~\\n", "~{...~}", "~{...~}, too many args", "~@{...~}",
  "~@{...~}, too few args", "~(...~)", "~v", "~v:@y", "~*", "~?",
  "complex 1", "complex 2", "complex 3"): New tests.
  ("conditionals"): New test prefix.

13 years agoEscape newlines from format strings in warnings.
Ludovic Courtès [Sat, 9 Oct 2010 16:06:36 +0000 (18:06 +0200)]
Escape newlines from format strings in warnings.

* module/system/base/message.scm (%warning-types)[format]: Escape
  newlines from FMT.

13 years agoadd --listen command line argument.
Andy Wingo [Sun, 10 Oct 2010 10:56:53 +0000 (12:56 +0200)]
add --listen command line argument.

* libguile/script.c (scm_shell_usage, scm_compile_shell_switches): Add a
  --listen argument to spawn a REPL server, possibly specifying the port
  or path to listen on. The goal is for this to be the default way to
  allow debugging via Emacs or simply using netcat.

13 years agoadd (system repl server)
Andy Wingo [Sun, 10 Oct 2010 10:15:34 +0000 (12:15 +0200)]
add (system repl server)

* module/system/repl/server.scm: New module, listens on a socket for
  connections, then serves repls to those sockets.

* module/Makefile.am: Add repl server.

13 years agofix segfaults when closing the current input port
Andy Wingo [Sun, 10 Oct 2010 10:13:04 +0000 (12:13 +0200)]
fix segfaults when closing the current input port

* libguile/ports.c (scm_char_ready_p, scm_peek_char, scm_unread_char)
  (scm_unread_string): Always validate the port, even in the case that
  we get it the default current-input-port. Otherwise the following
  causes a segfault:

    (begin (close-port (current-input-port)) (peek-char))

13 years agoreadline repl-reader falls back to boot-9 definition for other ports
Andy Wingo [Sun, 10 Oct 2010 09:49:50 +0000 (11:49 +0200)]
readline repl-reader falls back to boot-9 definition for other ports

* guile-readline/ice-9/readline.scm (readline-repl-reader): Pull
  definition out of activate-readline. If the current input port is not
  the readline port, fall back to the boot-9 repl reader.
  (activate-readline): Adapt.

13 years agointerrupted syscalls run asyncs before throwing syserror
Andy Wingo [Sun, 10 Oct 2010 09:24:29 +0000 (11:24 +0200)]
interrupted syscalls run asyncs before throwing syserror

* libguile/error.c (scm_syserror, scm_syserror_msg): Run pending pending
  asyncs before throwing the error, as one of the asyncs might be a
  signal handler. But there is unfortunately a race here, as noted in a
  comment.

13 years agofurther repl tweaks
Andy Wingo [Fri, 8 Oct 2010 17:27:45 +0000 (19:27 +0200)]
further repl tweaks

* module/system/repl/error-handling.scm (error-string): Refactor a
  little.
  (call-with-error-handling): Ensure a trailing newline when printing
  the error-msg.

* module/system/repl/repl.scm (run-repl): We don't know the name of the
  meta-command here.

13 years agoImprove pretty-printing of tree-il objects.
Ludovic Courtès [Fri, 8 Oct 2010 13:24:15 +0000 (15:24 +0200)]
Improve pretty-printing of tree-il objects.

* module/language/tree-il.scm (print-tree-il): Print the AST with ~S
  instead of ~A.

13 years agoAdd `-Wformat'.
Ludovic Courtès [Fri, 8 Oct 2010 14:25:32 +0000 (16:25 +0200)]
Add `-Wformat'.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  New procedure.
  (format-analysis): New tree analysis.

* module/language/tree-il/compile-glil.scm (%warning-passes): Add
  `format'.

* module/system/base/message.scm (%warning-types): Add `format'.

* test-suite/tests/tree-il.test (%opts-w-format): New variable.
  ("warnings")["format"]: New test prefix.

* doc/ref/api-evaluation.texi (Compilation): Mention `format' warnings.

13 years agoFixlets for REPL error handling.
Ludovic Courtès [Fri, 8 Oct 2010 11:50:24 +0000 (13:50 +0200)]
Fixlets for REPL error handling.

* module/system/repl/error-handling.scm (error-string): Don't call
  `display-error' when STACK is empty.
  (call-with-error-handling): Display ERROR-MSG instead of using
  `format', since ERROR-MSG may contain `format' escapes.

* module/system/repl/repl.scm (run-repl): Add missing argument to
  `format'.

13 years agoSRFI-1: Rewrite `split-at' and `split-at!' in Scheme.
Ludovic Courtès [Fri, 8 Oct 2010 11:48:02 +0000 (13:48 +0200)]
SRFI-1: Rewrite `split-at' and `split-at!' in Scheme.

This partially reverts commit bb560b9c16893f762699ba5a3109c8367fff8dfc
(Tue Mar 15 2005).

* module/srfi/srfi-1.scm (out-of-range, split-at, split-at!): New
  procedures.

* libguile/srfi-1.c (scm_srfi1_split_at, scm_srfi1_split_at_x): Remove.
* libguile/srfi-1.h (scm_srfi1_split_at, scm_srfi1_split_at_x): Ditto.

13 years agoSRFI-1: Rewrite `filter-map' in Scheme.
Ludovic Courtès [Fri, 8 Oct 2010 09:03:51 +0000 (11:03 +0200)]
SRFI-1: Rewrite `filter-map' in Scheme.

This partially reverts commit c16359466bcc3f2ebf6d750c069f787f629fc625
(Thu Mar 17 2005).

* libguile/srfi-1.c (scm_srfi1_filter_map): Remove.
* libguile/srfi-1.h (scm_srfi1_filter_map): Ditto.

* module/srfi/srfi-1.scm (filter-map): New procedure.

13 years agoSRFI-1: Make `fold-right' tail-recursive.
Ludovic Courtès [Fri, 8 Oct 2010 08:43:59 +0000 (10:43 +0200)]
SRFI-1: Make `fold-right' tail-recursive.

* module/srfi/srfi-1.scm (fold-right): Make tail-recursive.

* test-suite/tests/srfi-1.test ("fold-right"): New test prefix.

13 years agoSRFI-1: Make `unfold' tail-recursive (fix bug #30071).
Ludovic Courtès [Fri, 8 Oct 2010 08:23:52 +0000 (10:23 +0200)]
SRFI-1: Make `unfold' tail-recursive (fix bug #30071).

* module/srfi/srfi-1.scm (unfold): Make tail-recursive, following a
  suggestion by Szavai Gyula.

* test-suite/tests/srfi-1.test ("unfold"): New test prefix.

13 years agoRegister `scm_init_r6rs_ports' as an extension.
Ludovic Courtès [Fri, 8 Oct 2010 07:49:12 +0000 (09:49 +0200)]
Register `scm_init_r6rs_ports' as an extension.

* libguile/r6rs-ports.c (scm_register_r6rs_ports): New function.
* libguile/r6rs-ports.h (scm_register_r6rs_ports): New declaration.

* libguile/init.c (scm_i_init_guile): Call it.

13 years agoAlways run at least the ASCII regexp tests.
Ludovic Courtès [Fri, 8 Oct 2010 07:46:39 +0000 (09:46 +0200)]
Always run at least the ASCII regexp tests.

* test-suite/tests/regexp.test (with-ascii-or-latin1-locale): New macro.
  ("regexp-quote"): Use it instead of `with-latin1-locale'.

13 years agofix a bug in `finish'
Andy Wingo [Fri, 8 Oct 2010 10:29:54 +0000 (12:29 +0200)]
fix a bug in `finish'

* module/system/repl/command.scm (repl-pop-continuation-resumer)
  (finish): Fix a bug printing return values.

13 years agostepping traps use frame-next-source, not frame-source
Andy Wingo [Fri, 8 Oct 2010 10:23:34 +0000 (12:23 +0200)]
stepping traps use frame-next-source, not frame-source

* module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): Use
  frame-next-source in stepping traps.

13 years agoadd program-sources-pre-retire to core and define frame-next-source
Andy Wingo [Fri, 8 Oct 2010 10:21:20 +0000 (12:21 +0200)]
add program-sources-pre-retire to core and define frame-next-source

* libguile/programs.h:
* libguile/programs.c (scm_program_source): Add an optional arg, the
  sources table to traverse. Defaults to the result of
  scm_program_sources.

* module/system/vm/program.scm (program-sources-pre-retire): Move
  definition here from (system vm traps), and export.

* module/system/vm/traps.scm: Adapt.

* module/system/vm/frame.scm (frame-next-source): New exported binding,
  returns the source line corresponding to the next instruction instead
  of the previous instruction.

13 years agofix error in frame-return-values
Andy Wingo [Fri, 8 Oct 2010 09:53:59 +0000 (11:53 +0200)]
fix error in frame-return-values

* module/system/vm/frame.scm (frame-return-values): Fix off-by-one
  error.

13 years agofix tracing of mv returns
Andy Wingo [Fri, 8 Oct 2010 09:52:38 +0000 (11:52 +0200)]
fix tracing of mv returns

* module/system/vm/trace.scm (print-return): Fix multiple-value-return
  printing.

13 years agomore inlining in psyntax
Andy Wingo [Fri, 8 Oct 2010 09:43:15 +0000 (11:43 +0200)]
more inlining in psyntax

* module/ice-9/psyntax.scm (make-wrap, wrap-marks, wrap-subst): Use
  identifier syntax here too.

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

13 years agoinline symbol? and vector? to opcodes, and a psyntax inlining tweak
Andy Wingo [Fri, 8 Oct 2010 09:30:17 +0000 (11:30 +0200)]
inline symbol? and vector? to opcodes, and a psyntax inlining tweak

* libguile/vm-i-scheme.c (symbol?, vector?): New
  instructions. Renumbered the rest.
* libguile/vm-i-system.c: Renumber instructions.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.

* module/ice-9/psyntax.scm (binding-type, binding-value): Define using
  macros so that we inline to car and cdr opcodes. Oh, for an inliner :)

* module/language/tree-il/compile-glil.scm (*primcall-ops*)
* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*, *effect-free-primitives*)
  (*effect+exception-free-primitives*): Add symbol? and vector?
  inlines.

13 years agoadd repl debugging command docs
Andy Wingo [Fri, 8 Oct 2010 09:13:19 +0000 (11:13 +0200)]
add repl debugging command docs

* doc/ref/scheme-using.texi (Debug Commands): Add docs for new debugging
  commands (break, step, registers, etc).

13 years agoproof-reading fixen in api-debug
Andy Wingo [Fri, 8 Oct 2010 08:54:03 +0000 (10:54 +0200)]
proof-reading fixen in api-debug

* doc/ref/api-debug.texi (Trap States, High-Level Traps): A couple of
  proof-reading fixes.

13 years agofinish traps documentation
Andy Wingo [Thu, 7 Oct 2010 22:00:16 +0000 (00:00 +0200)]
finish traps documentation

* doc/ref/api-debug.texi (Low-Level Traps, Tracing Traps, Trap States):
  Add notes on using modules.
  (High-Level Traps): Combine "Trap Handlers" and "Setting Traps"
  here. Flesh out docs.

13 years agoremove old debugging examples from api-debug
Andy Wingo [Thu, 7 Oct 2010 20:57:07 +0000 (22:57 +0200)]
remove old debugging examples from api-debug

* doc/ref/api-debug.texi (Debugging Examples): Remove section, as the
  tracing bits are adequately covered in tracing, and the breakpoints
  and such will get covered in the debugging meta-commands section.

13 years agodocument trap states
Andy Wingo [Thu, 7 Oct 2010 20:50:33 +0000 (22:50 +0200)]
document trap states

* module/system/vm/trap-state.scm: Export add-trap!.

* doc/ref/api-debug.texi (Trap States): Document.

13 years agodocument tracing traps
Andy Wingo [Thu, 7 Oct 2010 20:27:00 +0000 (22:27 +0200)]
document tracing traps

* doc/ref/api-debug.texi (Tracing Traps): Document the traps.

13 years agofinish documenting low-level traps, other api-debug.texi fixes
Andy Wingo [Thu, 7 Oct 2010 20:15:35 +0000 (22:15 +0200)]
finish documenting low-level traps, other api-debug.texi fixes

* doc/ref/api-debug.texi (Stack Capture): Rename from "Capturing the
  Stack or Innermost Stack Frame". Move start-stack docs here.
  (Frames): Document accessors for fp, sp, ip, et al.
  (Source Properties): Raise to a subsection.
  (VM Hooks): Add notes about the VM trace level within hook firing.
  (Low-Level Traps): Flesh out.

13 years agoupdate traps documentation (unfinished)
Andy Wingo [Thu, 7 Oct 2010 11:06:57 +0000 (13:06 +0200)]
update traps documentation (unfinished)

* doc/ref/Makefile.am:
* doc/ref/guile.texi:
* doc/ref/scheme-debugging.texi: Remove scheme-debugging.texi, which
  only described tracing. Tracing documentation is now in
  api-debugging.

* doc/ref/scheme-using.texi (Evaluating Scheme Code): Remove reference
  to source traps, as that section is going away.

* doc/ref/api-modules.texi (Included Guile Modules): Remove reference to
  Tracing. This section is a little silly, anyway...

* doc/ref/api-evaluation.texi (VM Behaviour): Remove section, it is in
  api-debugging now.

* doc/ref/api-debug.texi (Stacks, Frames): Rename sections from
  "Examining the Stack" and "Examining Stack Frames", respectively.
  (Traps): Update for current API. A big and not-quite-finished update.

13 years agoupdate docs regarding --debug
Andy Wingo [Thu, 7 Oct 2010 10:56:43 +0000 (12:56 +0200)]
update docs regarding --debug

* doc/ref/scheme-scripts.texi (Invoking Guile): Update docs on --debug.

13 years agorename vm-trace to call-with-trace
Andy Wingo [Thu, 7 Oct 2010 10:55:37 +0000 (12:55 +0200)]
rename vm-trace to call-with-trace

* module/system/vm/trace.scm (print-application, print-return): Change
  to add more whitespace, as (ice-9 debug) did.
  (call-with-trace): Rename from vm-trace, and make the vm a keyword
  argument.

* module/system/repl/command.scm: Don't autoload (system vm profile).
  (trace): Update for call-with-trace name change.

13 years agoupdate (system repl debug) todo
Andy Wingo [Wed, 6 Oct 2010 19:19:49 +0000 (21:19 +0200)]
update (system repl debug) todo

* module/system/repl/debug.scm: Update todo.

13 years agoadd ,step ,stepi ,next and ,nexti
Andy Wingo [Wed, 6 Oct 2010 19:19:08 +0000 (21:19 +0200)]
add ,step ,stepi ,next and ,nexti

* module/system/vm/traps.scm (trap-matching-instructions): New trap,
  just installs a next hook and runs the handler when a predicate
  succeeds.

* module/system/vm/trap-state.scm (add-ephemeral-stepping-trap!): New
  procedure, uses trap-matching-instructions with an appropriate
  predicate to handle step, stepi, next, and nexti repl metacommands.

* module/system/repl/command.scm (step, step-instruction, next)
  (next-instruction): New repl debugger commands.

13 years agocleanups to ,finish
Andy Wingo [Wed, 6 Oct 2010 19:17:06 +0000 (21:17 +0200)]
cleanups to ,finish

* module/system/repl/command.scm (repl-pop-continuation-resumer): Factor
  out of finish.
  (finish): Adapt.

* module/system/vm/trap-state.scm (add-ephemeral-trap-at-frame-finish!):
  Rename to add "ephemeral" to the name.

* module/system/vm/traps.scm (trap-calls-to-procedure): Remove unused
  #:width kwarg.

13 years agobuild guile-readline/ after module/
Andy Wingo [Wed, 6 Oct 2010 08:24:45 +0000 (10:24 +0200)]
build guile-readline/ after module/

* Makefile.am (SUBDIRS): Build module/ before guile-readline/. Reformat.

13 years agoadd ,finish repl meta-command
Andy Wingo [Tue, 5 Oct 2010 19:53:58 +0000 (21:53 +0200)]
add ,finish repl meta-command

* module/system/repl/command.scm (finish): New REPL meta command. Uses
  fancy prompt stuff.

13 years ago(system vm trap-state): add-trap-at-frame-finish!
Andy Wingo [Tue, 5 Oct 2010 19:53:29 +0000 (21:53 +0200)]
(system vm trap-state): add-trap-at-frame-finish!

* module/system/vm/traps.scm: Fix a comment.

* module/system/vm/trap-state.scm (<trap-state>): Add next-ephemeral-idx
  slot.
  (wrapper-at-index): Use eqv? instead of = to avoid type errors in user
  inputs.
  (next-ephemeral-index!, ephemeral-handler-for-index): New functions,
  allocate ephemeral trap ids for functions to be called only once.
  (add-trap-at-frame-finish!): New export, traps when a frame finishes.

13 years ago(system vm frame): frame-return-values
Andy Wingo [Tue, 5 Oct 2010 19:51:44 +0000 (21:51 +0200)]
(system vm frame): frame-return-values

* module/system/vm/frame.scm (frame-return-values): New exported
  function, gives the return values for a frame.
* module/system/vm/trace.scm: Remove frame-return-values from here.

13 years agodebug-trap-handler ephemeral trap enhancement
Andy Wingo [Tue, 5 Oct 2010 19:50:57 +0000 (21:50 +0200)]
debug-trap-handler ephemeral trap enhancement

* module/system/repl/error-handling.scm (call-with-error-handling): If
  the given index is false, assume this was an ephemeral trap, and don't
  print a welcome message or reference the trap by index.