bpt/guile.git
13 years agoFix missing port-table locking and bytevector output port segfault
Andreas Rottmann [Sat, 20 Nov 2010 17:40:30 +0000 (18:40 +0100)]
Fix missing port-table locking and bytevector output port segfault

* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Lock
  the port table.

* libguile/r6rs-ports.c (make_bop): Let the returned extraction
  procedure refer to the port's buffer instead of the port itself.  This
  fixes a segfault if the port is closed before the extraction procedure
  is called.
  (bop_proc_apply): Adapt accordingly.
* test-suite/tests/r6rs-ports.test (8.2.10 Output ports): Add testcase
  for extraction after close.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoAllow user-defined meta-commands
Andreas Rottmann [Sat, 20 Nov 2010 22:14:05 +0000 (23:14 +0100)]
Allow user-defined meta-commands

Besides allowing user-defined meta-commands, this change also refactors
the meta-command machinery to split reading a command's arguments from
the procedure actually implementing it, and hence allows nesting
meta-commands.  As an example of such a command, ",in" is added as a new
meta-command.

* module/system/repl/command.scm: Export `define-meta-command'.
  (*command-module*): Replaced by the hash table `*command-infos*'.
  (command-info, make-command-info, command-info-procedure)
  (command-info-arguments-reader): New procedures, encapsulating the
  information about a meta-command.
  (command-procedure): Adapted to use the `command-info' lookup
  procedure.
  (read-command-arguments): New auxiliary procedure invoking a command's
  argument reader procedure.
  (meta-command): Adapted to the split of reading arguments and
  executing a command.
  (add-meta-command!): New auxiliary procedure, registers a meta
  command's procedure and argument reader into `*command-infos* and
  `*command-table*.
  (define-meta-command): Extended to allow specification of the command's
  category; split the argument reader and actual command procedure.
  (guile:apropos, guile:load, guile:compile-file, guile:gc): Remove these
  aliases, they are unnecessary as we now use a hash table instead of the
  module to store the commands.
  (in): New meta-command, which evaluates an expression, or alternatively
  executes another meta-command, in the context of a specific module.
* doc/ref/scheme-using.texi (Module Commands): Document the `in'
  meta-command.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoannounce flex version in autogen.sh
Andy Wingo [Sat, 20 Nov 2010 22:18:43 +0000 (23:18 +0100)]
announce flex version in autogen.sh

* autogen.sh: Announce flex version. Has the side-effect of checking for
  flex when building from git.

13 years agoAllow specifying load extensions on the command line
Andreas Rottmann [Sat, 20 Nov 2010 00:05:10 +0000 (01:05 +0100)]
Allow specifying load extensions on the command line

Add a new command-line switch `-x', which manipulates the
%load-extensions list.

* libguile/script.c (scm_compile_shell_switches): Process the new "-x"
  switch.
  (scm_shell_usage): Mention the "-x" switch.
* doc/ref/scheme-scripts.texi (Invoking Guile): Add "-x" switch to the
  list of command-line switches.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoUse `define-module*' in (ice-9 history).
Ludovic Courtès [Fri, 19 Nov 2010 23:47:12 +0000 (00:47 +0100)]
Use `define-module*' in (ice-9 history).

* module/ice-9/history.scm: Use `define-module*' instead of
  `process-define-module'.

13 years agobump objcode version
Andy Wingo [Fri, 19 Nov 2010 16:51:16 +0000 (17:51 +0100)]
bump objcode version

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the
  process-define-module deprecation means that outside compiled code
  won't find process-define-module in the (guile) module, as they would
  before.

13 years agofix string-filter and string-delete argument order
Andy Wingo [Fri, 19 Nov 2010 16:08:36 +0000 (17:08 +0100)]
fix string-filter and string-delete argument order

* libguile/srfi-13.h:
* libguile/srfi-13.c (scm_string_filter, scm_string_delete): Swap
  char_pred and s argument order, to comply with SRFI-13. There is a
  back-compat shim that will detect programs that used the old,
  erroneous interface, while giving a warning.

* doc/ref/api-data.texi: Update docs.

13 years agodeprecate process-define-module
Andy Wingo [Fri, 19 Nov 2010 14:08:07 +0000 (15:08 +0100)]
deprecate process-define-module

* module/ice-9/boot-9.scm:
* module/ice-9/deprecated.scm (process-define-module): Deprecate.

13 years agodefine-module compiles to define-module*
Andy Wingo [Fri, 19 Nov 2010 13:43:31 +0000 (14:43 +0100)]
define-module compiles to define-module*

* module/ice-9/boot-9.scm (define-module): Compile down to a call to
  define-module*, not process-define-module.

13 years agoscm_c_define_module uses define-module*
Andy Wingo [Fri, 19 Nov 2010 12:11:47 +0000 (13:11 +0100)]
scm_c_define_module uses define-module*

* libguile/modules.c (scm_c_define_module):
* module/ice-9/boot-9.scm: Update to have the C function call
  define-module*.

13 years agomake module definition procedure more structured
Andy Wingo [Fri, 19 Nov 2010 12:06:03 +0000 (13:06 +0100)]
make module definition procedure more structured

* module/ice-9/boot-9.scm (define-module*): New procedure, like
  process-define-modules but more structured.
  (process-define-module): Reimplement in terms of define-module*.

13 years agorelax sizeof(long) restriction in configure.ac
Andy Wingo [Fri, 19 Nov 2010 10:39:06 +0000 (11:39 +0100)]
relax sizeof(long) restriction in configure.ac

* configure.ac: Relax the sizeof(long)==sizeof(void*) restriction,
  instead asserting that the sizeof(long)<=sizeof(void*). There will
  still be problems on nonstandard platforms related to the interface
  with gmp, but those are confined to numbers.c.

13 years agofix a number of assuptions that a long could hold an inum
Andy Wingo [Fri, 19 Nov 2010 10:29:26 +0000 (11:29 +0100)]
fix a number of assuptions that a long could hold an inum

* libguile/bytevectors.c:
* libguile/goops.c:
* libguile/instructions.c:
* libguile/numbers.c:
* libguile/random.c:
* libguile/read.c:
* libguile/vm-i-scheme.c: Fix a number of assumptions that a long could
  hold an inum. This is not the case on platforms whose void* is larger
  than their long.

* libguile/numbers.c (scm_i_inum2big): New helper, only implemented for
  sizeof(void*) == sizeof(long); produces a compile error on other
  platforms. Basically gmp doesn't have a nice interface for converting
  between mpz values and intmax_t.

13 years agosimpos tweak
Andy Wingo [Thu, 18 Nov 2010 21:31:34 +0000 (22:31 +0100)]
simpos tweak

* libguile/simpos.c (scm_system_star): Use scm_from_ulong, as we do cast
  to ulong.

13 years agofix a number of assumptions that a pointer could fit into a long
Andy Wingo [Thu, 18 Nov 2010 21:30:27 +0000 (22:30 +0100)]
fix a number of assumptions that a pointer could fit into a long

* libguile/debug.c:
* libguile/eval.c:
* libguile/frames.c:
* libguile/objcodes.c:
* libguile/print.c:
* libguile/programs.c:
* libguile/read.c:
* libguile/struct.c:
* libguile/vm.c: Fix a number of instances in which we assumed we could
  fit a pointer into a long.

13 years agoFix incorrect uses of en-dashes and em-dashes in the intro.
Ludovic Courtès [Fri, 19 Nov 2010 13:28:40 +0000 (14:28 +0100)]
Fix incorrect uses of en-dashes and em-dashes in the intro.

* doc/ref/intro.texi (Introduction): Use commas instead of en-dashes
  around "for example".  Use em-dashes instead of en-dashes around
  parenthetical phrases.  Remove spaces around em-dashes.

13 years agoInclude <alloca.h> wherever `alloca' is used.
Ludovic Courtès [Fri, 19 Nov 2010 13:14:53 +0000 (14:14 +0100)]
Include <alloca.h> wherever `alloca' is used.

Patch provided by <carlo.bramix@libero.it> (tiny change).

* libguile/control.c, libguile/fluids.c, libguile/foreign.c,
  libguile/hashtab.c, libguile/strings.c: Include <alloca.h>.

13 years agoOptimize fixnum comparison.
Ludovic Courtès [Fri, 19 Nov 2010 10:18:42 +0000 (11:18 +0100)]
Optimize fixnum comparison.

* libguile/vm-i-scheme.c (REL): Don't untag X and Y since tagging
  preserves ordering.

13 years agoAdd fixnum arithmetic benchmarks.
Ludovic Courtès [Fri, 19 Nov 2010 10:06:10 +0000 (11:06 +0100)]
Add fixnum arithmetic benchmarks.

* benchmark-suite/benchmarks/arithmetic.bm ("fixnum")["*", "/"]: New
  benchmarks.

13 years agoAdd optimized tagged integer addition/subtractions for x86_64.
Ludovic Courtès [Wed, 17 Nov 2010 22:06:26 +0000 (23:06 +0100)]
Add optimized tagged integer addition/subtractions for x86_64.

This results in a 17% improvement in the execution time of the "+" and
"-" benchmarks for fixnums.

* libguile/vm-i-scheme.c (ASM_ADD, ASM_SUB)[defined __x86_64__ &&
  SCM_GNUC_PREREQ (4, 5)]: New macros.
  (add)[defined ASM_ADD]: Use `ASM_ADD' for the fast path.
  (sub)[defined ASM_SUB]: Use `ASM_SUB' for the fast path.

* test-suite/tests/numbers.test ("+")["fixnum + fixnum = bignum
  (32-bit)", "fixnum + fixnum = bignum (64-bit)", "bignum + fixnum =
  fixnum", "wrong type"]: New tests.
  ("-")["fixnum - fixnum = bignum (32-bit)", "fixnum - fixnum = bignum
  (64-bit)", "bignum - fixnum = fixnum", "wrong type"]: New tests.

* test-suite/tests/00-initial-env.test ("goopsless")["+ wrong type
  argument"]: Use `with-test-prefix/c&e' instead of `with-test-prefix'.
  ["- wrong type argument"]: New test prefix.

13 years agoUse the `with-test-prefix/c&e' for the `1+' and `1-' tests.
Ludovic Courtès [Wed, 17 Nov 2010 22:05:50 +0000 (23:05 +0100)]
Use the `with-test-prefix/c&e' for the `1+' and `1-' tests.

* test-suite/tests/numbers.test ("1+"): Use `with-test-prefix/c&e'
  instead of `with-test-prefix'.  Provide a name to each `pass-if'
  invocation.
  ("1-"): Likewise.

13 years agoMove `with-test-prefix/c&e' to `(test-suite lib)'.
Ludovic Courtès [Wed, 17 Nov 2010 22:04:11 +0000 (23:04 +0100)]
Move `with-test-prefix/c&e' to `(test-suite lib)'.

* test-suite/tests/bytevectors.test (c&e, with-test-prefix/c&e): Move...
* test-suite/lib.scm: ... here.
  (with-test-prefix): Rewrite using `syntax-rules'.

13 years agoAdd `SCM_GNUC_PREREQ'.
Ludovic Courtès [Fri, 12 Nov 2010 08:54:49 +0000 (09:54 +0100)]
Add `SCM_GNUC_PREREQ'.

* libguile/__scm.h (SCM_GNUC_PREREQ): New macro.
  Use it in this file in lieu of hand-written GCC version tests.

13 years agoadd `reload-module' to boot-9
Andy Wingo [Thu, 18 Nov 2010 20:48:55 +0000 (21:48 +0100)]
add `reload-module' to boot-9

* module/ice-9/boot-9.scm (reload-module): New procedure,
  programmatically reloads the source file corresponding to the given
  module.

13 years agonumbers.test expects lower-case hexadecimals
Andy Wingo [Thu, 18 Nov 2010 15:06:46 +0000 (16:06 +0100)]
numbers.test expects lower-case hexadecimals

* test-suite/tests/numbers.test ("number->string"): Expect lower-case
  hexidecimals.

13 years agoread-set! takes effect at expand time
Andy Wingo [Thu, 18 Nov 2010 13:43:43 +0000 (14:43 +0100)]
read-set! takes effect at expand time

* module/ice-9/boot-9.scm (define-option-interface): The set! command
  goes in an eval-when to be run at expand-time, so that (read-set!
  keywords 'prefix) does what it used to in 1.8 (mostly).

13 years agorepl read/write using current ports, not captured ports
Andy Wingo [Thu, 18 Nov 2010 13:32:53 +0000 (14:32 +0100)]
repl read/write using current ports, not captured ports

Fixes bug in repl meta-commands after activating readline, which changes
the current input port.

* module/system/repl/common.scm (<repl>): Remove inport and outport
  fields.
  (make-repl): Adapt.
  (repl-read, repl-print): Just read and write to the current ports.

* module/system/repl/repl.scm (meta-reader): Meta-read from the current
  input port.

* module/system/repl/command.scm (read-command, define-meta-command):
  Read from the current input port.

13 years agolower-case hexadecimal digits again
Andy Wingo [Thu, 18 Nov 2010 12:10:45 +0000 (13:10 +0100)]
lower-case hexadecimal digits again

* libguile/numbers.c: Default to lower-case hexadecimal digits again.

13 years agobetter errors for ecmascript parser too
Andy Wingo [Thu, 18 Nov 2010 12:03:49 +0000 (13:03 +0100)]
better errors for ecmascript parser too

* module/language/ecmascript/parse.scm (syntax-error): Better errors
  here too.

13 years agoecmascript tokenization errors report source location
Andy Wingo [Thu, 18 Nov 2010 11:55:25 +0000 (12:55 +0100)]
ecmascript tokenization errors report source location

* module/language/ecmascript/tokenize.scm (syntax-error): Report source
  locations. Adapt all callers to pass source locations.

13 years agoadd source-location->source-properties to lalr
Andy Wingo [Thu, 18 Nov 2010 11:31:28 +0000 (12:31 +0100)]
add source-location->source-properties to lalr

* module/system/base/lalr.scm (source-location->source-properties): New
  public function, to produce source properties that can be given to the
  compiler.

13 years agomore ecmascript testing
Andy Wingo [Thu, 18 Nov 2010 11:26:20 +0000 (12:26 +0100)]
more ecmascript testing

* test-suite/tests/ecmascript.test (eread/1, parse): Also check
  read-ecmascript/1, which uses tokenize/1.

13 years agofix ecmascript at the repl
Andy Wingo [Thu, 18 Nov 2010 11:24:01 +0000 (12:24 +0100)]
fix ecmascript at the repl

* module/language/ecmascript/tokenize.scm (syntax-error): Reorder args
  to throw vals in the right order.
  (make-tokenizer/1): Fix. Broken since the lalr refactor...

13 years agorepl.scm displays syntax errors on read as well
Andy Wingo [Thu, 18 Nov 2010 11:21:36 +0000 (12:21 +0100)]
repl.scm displays syntax errors on read as well

* module/system/repl/repl.scm (prompting-meta-read): Use
  display-syntax-error as appropriate.

13 years agodeprecate cuserid
Andy Wingo [Thu, 18 Nov 2010 10:15:16 +0000 (11:15 +0100)]
deprecate cuserid

* libguile/posix.c:
* libguile/posix.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only
  returns 8 bytes of a user's login.

* doc/ref/posix.texi: Remove cuserid from docs.

13 years agoadapt tests to new syntax-error form
Andy Wingo [Thu, 18 Nov 2010 10:04:15 +0000 (11:04 +0100)]
adapt tests to new syntax-error form

* test-suite/tests/syntax.test (pass-if-syntax-error): Fix up for new
  form of syntax errors. Adapt all tests.

* test-suite/tests/srfi-17.test: Likewise.

13 years agoAdd exports for missing functions from `(rnrs base)'.
Julian Graham [Wed, 17 Nov 2010 05:59:45 +0000 (00:59 -0500)]
Add exports for missing functions from `(rnrs base)'.

* module/rnrs.scm (boolean=?): New export.
  Fix typo in export of`integer-valued?'.
* module/rnrs/base.scm: Add exports for `exact' and `inexact'.
  (boolean=?, symbol=?, infinite?, finite?, exact-integer-sqrt,
  integer-valued?, rational-valued?, real-valued?): New functions.
* test-suite/tests/r6rs-base.test (boolean=?, symbol=?, infinite?,
  finite?, exact-integer-sqrt, integer-valued?, rational-valued?,
  real-valued?): New test prefixes and tests.

13 years agofix the C syntax-error pretty-printer
Andy Wingo [Tue, 16 Nov 2010 02:00:01 +0000 (03:00 +0100)]
fix the C syntax-error pretty-printer

* libguile/throw.c (handler_message): Fix up a bit.

13 years agoadd proper pretty-printing for syntax errors
Andy Wingo [Tue, 16 Nov 2010 01:56:43 +0000 (02:56 +0100)]
add proper pretty-printing for syntax errors

* module/system/repl/repl.scm (display-syntax-error): New helper,
  displays a syntax error.
  (abort-on-error, run-repl): Use it.

* libguile/throw.c (handler_message): Re-code the same thing in C.

13 years agoremove syntax-error and call-with-compile-error-catch from compile.scm
Andy Wingo [Tue, 16 Nov 2010 01:55:46 +0000 (02:55 +0100)]
remove syntax-error and call-with-compile-error-catch from compile.scm

* module/system/base/compile.scm: Remove unused syntax-error and
  call-with-compile-error-catch exports.

13 years agoecmascript syntax errors throw to 'syntax-error
Andy Wingo [Tue, 16 Nov 2010 01:09:39 +0000 (02:09 +0100)]
ecmascript syntax errors throw to 'syntax-error

* module/language/ecmascript/parse.scm (syntax-error):
* module/language/ecmascript/tokenize.scm (syntax-error): Throw to
  'syntax-error as psyntax does.

13 years agosyntax-violation uses lambda*, throws a structured message
Andy Wingo [Tue, 16 Nov 2010 01:09:03 +0000 (02:09 +0100)]
syntax-violation uses lambda*, throws a structured message

* module/ice-9/psyntax.scm (syntax-violation): Use lambda* for subform
  arg. Instead of using scm-error, just throw to 'syntax-error with all
  we got.

* module/ice-9/psyntax-pp.scm (#{and-map*\ 37}): Regenerated.

13 years agofix string->number for bases > 16
Andy Wingo [Mon, 15 Nov 2010 22:43:30 +0000 (23:43 +0100)]
fix string->number for bases > 16

* libguile/numbers.c (scm_iuint2str): Add an assertion on the domain of
  the radix. Use the number_chars table to write the string, instead of
  doing strange math. Same effect, though.
  (mem2uinteger, char_decimal_value): Change logic to allow all ascii
  alphabetic chars as decimals, not just a-f. Thanks to Nils Gey for the
  report.

* test-suite/tests/numbers.test ("number->string"): Add some tests.

13 years agoExpression-oriented readline history
Neil Jerram [Sat, 30 Oct 2010 15:28:54 +0000 (16:28 +0100)]
Expression-oriented readline history

* guile-readline/ice-9/readline.scm (make-readline-port): Instead of
  calling add-history after every %readline call, do it only when
  starting a new read.  Other times, append the line just read to an
  internal buffer.

13 years agoflesh out (web server)'s sanitize-response
Andy Wingo [Sat, 13 Nov 2010 17:31:34 +0000 (18:31 +0100)]
flesh out (web server)'s sanitize-response

* module/web/server.scm (sanitize-response): Flesh out. If we get a
  string, we encode it to a bytevector using the encoding snarfed from
  the response. We should check the request, though...

13 years agoadd extend-response.
Andy Wingo [Sat, 13 Nov 2010 17:30:27 +0000 (18:30 +0100)]
add extend-response.

* module/web/response.scm (extend-response): New utility.

13 years ago(web http) parses content-type as "foo/bar", not "foo" "bar"
Andy Wingo [Sat, 13 Nov 2010 17:17:28 +0000 (18:17 +0100)]
(web http) parses content-type as "foo/bar", not "foo" "bar"

* module/web/http.scm (parse-media-type, validate-media-type,
  (content-type): Change to represent media types as ("foo/bar" ("param"
  . "val") ...) instead of ("foo" "bar" ("param" . "val") ...). Seems to
  be more in line with what people expect.

* test-suite/tests/web-http.test ("entity headers"): Add content-type
  test.

* test-suite/tests/web-response.test ("example-1"): Adapt expected
  parse.

13 years agoNUL vs NULL fix
Andy Wingo [Fri, 12 Nov 2010 16:18:08 +0000 (17:18 +0100)]
NUL vs NULL fix

* libguile/read.c (scm_i_scan_for_encoding): Fix NUL rather than NULL.

13 years agoremove (web toy-server)
Andy Wingo [Fri, 12 Nov 2010 11:16:26 +0000 (12:16 +0100)]
remove (web toy-server)

* module/Makefile.am
* module/web/toy-server.scm: Remove. It's not so much that the new (web
  server) stuff is not a toy, it's that users are expected to use the
  new backends (mod-lisp, etc) in "production".

13 years agoadd generic web server with http-over-tcp backend
Andy Wingo [Fri, 12 Nov 2010 11:07:24 +0000 (12:07 +0100)]
add generic web server with http-over-tcp backend

* module/web/server.scm: New generic web server module, with support for
  different backends. An HTTP-over-TCP backend is the only one included
  with Guile, though one can imagine FastCGI, mod-lisp, mongrel2/0mq etc
  backends as well.

* module/web/server/http.scm: The aforementioned HTTP backend.

13 years agoadd request-meta
Andy Wingo [Fri, 12 Nov 2010 11:12:34 +0000 (12:12 +0100)]
add request-meta

* module/web/request.scm (<request>): Add `meta' field and accessor, for
  metadata like the server IP, the client IP, CGI environment variables,
  etc.
  (build-request): Add meta kwarg.
  (read-request): Add meta optional arg.
  (write-request): Adapt.

13 years agomore (web http) exports for parsing request components
Andy Wingo [Fri, 12 Nov 2010 11:10:44 +0000 (12:10 +0100)]
more (web http) exports for parsing request components

* module/web/http.scm (lookup-header-decl): New exported function.
  (parse-http-version, parse-http-method, parse-request-uri): Export
  these functions.

13 years agocall-with-error-handling pass-keys w/ procedural handlers fix
Andy Wingo [Fri, 12 Nov 2010 11:08:54 +0000 (12:08 +0100)]
call-with-error-handling pass-keys w/ procedural handlers fix

* module/system/repl/error-handling.scm (call-with-error-handling):
  Respect the pass-keys set for procedural on-error and post-error
  handlers.

13 years agounparse-uri avoids serializing e.g. :80 in http:// uris
Andy Wingo [Mon, 8 Nov 2010 15:06:50 +0000 (16:06 +0100)]
unparse-uri avoids serializing e.g. :80 in  uris

* module/web/uri.scm (declare-default-port!): New function, declares a
  default port for a scheme. Predeclare default ports for http and
  https.
  (unparse-uri): If the port is the default port for the given scheme,
  don't serialize the port part of the URI.

13 years agoFix buffer over-read in port encoding scan.
Julian Graham [Fri, 12 Nov 2010 13:45:09 +0000 (08:45 -0500)]
Fix buffer over-read in port encoding scan.

* libguile/read.c (scm_i_scan_for_encoding): Add a NULL terminator to the
  end of header to prevent over-read by subsequent call to strstr.

13 years agoAdd FFI tests for `sizeof' and structs.
Ludovic Courtès [Thu, 11 Nov 2010 15:36:29 +0000 (16:36 +0100)]
Add FFI tests for `sizeof' and structs.

* test-suite/tests/foreign.test ("structs")["sizeof { int8, double }",
  "sizeof { short, int, long, pointer }"]: New tests.

13 years agoAdd FFI support for `short' and `unsigned short'.
Ludovic Courtès [Thu, 11 Nov 2010 15:26:50 +0000 (16:26 +0100)]
Add FFI support for `short' and `unsigned short'.

* libguile/foreign.c (sym_short, sym_unsigned_short): New variables.
  (scm_init_foreign): Define Scheme variables SYM_SHORT and
  SYM_UNSIGNED_SHORT.

* module/system/foreign.scm (short, unsigned-short): New exports.
  (integer-ref, integer-set): Support (= (sizeof TYPE) 2).
  (%read-short, %write-short!, %read-unsigned-short,
  %write-unsigned-short!): New variables.
  (*writers*): Add support for `short' and `unsigned-short'.
  (*readers*): Likewise.

* test-suite/tests/foreign.test ("structs")["int8, pointer, short,
  double"]: New test.

13 years agoHave `parse-c-struct' and `make-c-struct' support `int', pointers, etc.
Ludovic Courtès [Thu, 11 Nov 2010 15:09:22 +0000 (16:09 +0100)]
Have `parse-c-struct' and `make-c-struct' support `int', pointers, etc.

Reported by Tristan Colgate <tcolgate@gmail.com>.

* module/system/foreign.scm: Call `load-extension' at compile-time too.
  (compile-time-value): New macro.
  (integer-ref, integer-set): New procedures.
  (define-integer-reader, define-integer-writer): New macros.
  (%read-int, %read-long, %write-int!, %write-long!, %read-unsigned-int,
  %read-unsigned-long, %write-unsigned-int!, %write-unsigned-long!,
  %read-size_t, %write-size_t!, %read-pointer, %write-pointer!): New
  procedures.
  (*writers*): Add writers for `int', `unsigned-int', `long',
  `unsigned-long', `size_t', and `*'.
  (*readers*): Likewise.

* test-suite/tests/foreign.test ("structs")["int8, pointer",
  "unsigned-long, int8, size_t", "long, int, pointer"]: New tests.

13 years agoFFI: Honor alignment constraints in `parse-c-struct'.
Ludovic Courtès [Mon, 8 Nov 2010 22:08:48 +0000 (23:08 +0100)]
FFI: Honor alignment constraints in `parse-c-struct'.

* module/system/foreign.scm (parse-c-struct): Honor alignment
  constraints for TYPE.

* test-suite/tests/foreign.test ("structs")["alignment constraints
  honored"]: New test.

13 years agoUse ellipsis character in truncated pretty-print of sequences
Michael Gran [Tue, 9 Nov 2010 02:57:29 +0000 (18:57 -0800)]
Use ellipsis character in truncated pretty-print of sequences

* module/ice-9/pretty-print.scm (print-sequence): use ellipsis when available

13 years agopretty-print print-sequence width error
Mike [Mon, 8 Nov 2010 16:52:04 +0000 (08:52 -0800)]
pretty-print print-sequence width error

Avoid the "expected a positive width" display error when printing
sequences with no width remaining.

* module/ice-9/pretty-print (print-sequence): test for zero width when
  printing sequences

13 years agoFix `reader.test'.
Ludovic Courtès [Sun, 7 Nov 2010 22:31:53 +0000 (23:31 +0100)]
Fix `reader.test'.

This is a followup to a4e472294423bb796db3132c73027384fdfff820 ("need
read error for extra closing square brackets".)

* test-suite/tests/reader.test (exception:unexpected-rsqbracket): New
  variable.
  ("reading")["paren mismatch (2)"]: Change exception type to
  EXCEPTION:UNEXPECTED-RSQBRACKET.
  ["paren mismatch (3)", "paren mismatch (4)"]: New tests.
  ("mismatching parentheses")["closing square bracket following
  mismatched opening"]: New test.

13 years agopretty-print: Suitably indent macro-related constructs.
Ludovic Courtès [Sat, 6 Nov 2010 11:12:09 +0000 (12:12 +0100)]
pretty-print: Suitably indent macro-related constructs.

* module/ice-9/pretty-print.scm (generic-write)[pp-SYNTAX-CASE]: New
  procedure.
  [style]: Add support for `define-public', `define-syntax',
  `let-syntax', `letrec-syntax', `syntax-rules', and `syntax-case'.

13 years agofix up toy-server error handling
Andy Wingo [Fri, 5 Nov 2010 23:36:45 +0000 (00:36 +0100)]
fix up toy-server error handling

* module/web/toy-server.scm (serve-client): Fix up error handling, so we
  catch errors when reading, handling, and writing. If we run
  interactively, an error will enter the debugger.

13 years agoneed read error for extra closing square brackets
Michael Gran [Fri, 5 Nov 2010 05:07:50 +0000 (22:07 -0700)]
need read error for extra closing square brackets

* libguile/read.c (scm_read_expression): add test

13 years agoImprove handling of read macros in `pretty-print'.
Ludovic Courtès [Fri, 5 Nov 2010 00:34:08 +0000 (01:34 +0100)]
Improve handling of read macros in `pretty-print'.

* module/ice-9/pretty-print.scm (generic-write)[wr]: Handle read macros
  that appear in the middle of a list.

* test-suite/tests/print.test (prints?): New macro.
  ("pretty-print"): New test prefix.

13 years agoadd toy web server
Andy Wingo [Thu, 21 Oct 2010 23:07:27 +0000 (01:07 +0200)]
add toy web server

* module/web/toy-server.scm: New module, a toy web server.

* module/Makefile.am: Adapt.

13 years agoadd HTTP response module
Andy Wingo [Thu, 21 Oct 2010 23:06:54 +0000 (01:06 +0200)]
add HTTP response module

* module/web/response.scm: New module, for HTTP responses.
* test-suite/tests/web-response.test: Test suite.

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

13 years agoadd HTTP request module
Andy Wingo [Thu, 21 Oct 2010 22:06:32 +0000 (00:06 +0200)]
add HTTP request module

* module/web/request.scm: Add HTTP request module.
* test-suite/tests/web-request.test: Test cases.

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

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.