Andy Wingo [Thu, 18 Feb 2010 16:10:29 +0000 (17:10 +0100)]
add with-fluids objects and primitive syntax
* libguile/tags.h (scm_tc7_with_fluids): Allocate a tc7 for
"with-fluids" objects, which will only live on the dynamic stack (wind
list), not in normal scheme-land.
* libguile/fluids.h (SCM_WITH_FLUIDS_P, SCM_WITH_FLUIDS_LEN)
(SCM_WITH_FLUIDS_NTH_FLUID, SCM_WITH_FLUIDS_NTH_VAL)
(SCM_WITH_FLUIDS_SET_NTH_VAL): Add some accessors.
* libguile/fluids.c (scm_i_make_with_fluids, scm_i_swap_with_fluids):
New internal functions.
(scm_c_with_fluids, scm_c_with_fluid): Push with-fluids objects on the
dynwind list, not winders.
* libguile/dynwind.c (scm_i_dowinds): Add cases for winding and
unwinding with-fluids objects.
* libguile/memoize.h (scm_sym_with_fluids, SCM_M_BEGIN): New public
data.
* libguile/memoize.c (scm_m_with_fluids): Define with-fluids as a
primitive syntax.
(unmemoize): Add with-fluids case.
* libguile/eval.c (eval):
* module/ice-9/eval.scm (primitive-eval): Add with-fluids cases.
* test-suite/tests/fluids.test
("fluids not modified if nonfluid passed to with-fluids"): Enable a
now-passing test.
Andy Wingo [Wed, 17 Feb 2010 21:36:14 +0000 (22:36 +0100)]
add fluid tests
* test-suite/Makefile.am:
* test-suite/tests/fluids.test: Add some fluid tests. One is an XFAIL
right now.
Andy Wingo [Thu, 18 Feb 2010 16:23:49 +0000 (17:23 +0100)]
rename <dynamic-wind> to <dynwind>
* module/language/tree-il.scm (<dynwind>): Rename from <dynamic-wind>.
* module/language/tree-il/analyze.scm:
* module/language/tree-il/primitives.scm:
* module/language/tree-il/compile-glil.scm: All accessors and callers
changed.
Andy Wingo [Thu, 18 Feb 2010 15:53:30 +0000 (16:53 +0100)]
fix unmemoization bug
* libguile/memoize.c (unmemoize): Fix unmemoization of memoized
toplevel-ref and module-ref forms.
Andy Wingo [Thu, 18 Feb 2010 15:50:57 +0000 (16:50 +0100)]
eval.c tweaks
* libguile/eval.c (eval): Fix a couple of uses of scm_cdr that should
use CDR.
Andy Wingo [Thu, 18 Feb 2010 15:50:26 +0000 (16:50 +0100)]
fix comment in continuations.c
* libguile/continuations.c: Fix a comment.
Andy Wingo [Thu, 18 Feb 2010 11:28:37 +0000 (12:28 +0100)]
memoize (begin foo) to foo
* libguile/memoize.c (memoize_sequence): Don't make a `begin' if there's
only one form.
Andy Wingo [Thu, 18 Feb 2010 15:59:41 +0000 (16:59 +0100)]
reorder eval clauses
* module/ice-9/eval.scm: Add a comment explaining the frequencies of the
various memoized expression types.
(eval): Reorder the cases based the profile.
Andy Wingo [Tue, 16 Feb 2010 22:01:09 +0000 (23:01 +0100)]
dynwind is now a part of guile's primitive language
* libguile/memoize.h (scm_sym_at_dynamic_wind, SCM_M_DYNWIND)
* libguile/memoize.c (memoized_tags, MAKMEMO_DYNWIND)
(scm_m_at_dynamic_wind, unmemoize): Add dynwind as a primitive
expression type.
* libguile/dynwind.c (scm_dynamic_wind): Downgrade to a normal C
function.
* libguile/eval.c (eval):
* module/ice-9/eval.scm (primitive-eval): Add dynwind support.
* module/ice-9/r4rs.scm: More relevant docs.
(apply): Define in a more regular way.
(dynamic-wind): Add to this file, with docs, dispatching to
@dynamic-wind.
* module/language/tree-il/primitives.scm: Parse @dynamic-wind into a
tree-il dynamic-wind.
Ludovic Courtès [Wed, 17 Feb 2010 17:11:49 +0000 (18:11 +0100)]
Bump version number for 1.9.8.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
Ludovic Courtès [Wed, 17 Feb 2010 16:50:43 +0000 (17:50 +0100)]
Update to Gnulib
v0.0-3448-g6078aa4 for its <netdb.h> fix.
Reverts commit
691b9ec196203fa5d6da3530d5355b2f73e707d1 ("getaddrinfo:
Define macros lacking in NetBSD 5.0.").
* libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): Remove
placeholder definitions, how provided by Gnulib's <netdb.h>.
Andy Wingo [Wed, 17 Feb 2010 16:34:58 +0000 (17:34 +0100)]
slight NEWS tweaks
* NEWS: Slight tweaks.
Ludovic Courtès [Wed, 17 Feb 2010 00:14:26 +0000 (01:14 +0100)]
getaddrinfo: Define macros lacking in NetBSD 5.0.
* libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): New
macros, when not already defined.
Ludovic Courtès [Tue, 16 Feb 2010 23:50:24 +0000 (00:50 +0100)]
Update `NEWS'.
Ludovic Courtès [Tue, 16 Feb 2010 23:44:56 +0000 (00:44 +0100)]
Mention libffi dependency in `README'.
Ludovic Courtès [Tue, 16 Feb 2010 23:44:14 +0000 (00:44 +0100)]
Include <libguile/__scm.h> in "foreign.h".
* libguile/foreign.h: Include <libguile/__scm.h>.
Ludovic Courtès [Tue, 16 Feb 2010 23:31:04 +0000 (00:31 +0100)]
Remove misplaced tabs from the manual.
* doc/ref/posix.texi (Network Databases): Remove tabs from `getaddrinfo'
example.
* .dir-locals.el: Set `indent-tabs-mode' to `t' for `texinfo-mode'.
Andy Wingo [Tue, 16 Feb 2010 22:45:28 +0000 (23:45 +0100)]
a start at NEWS
* NEWS: A start at NEWS; now to sleep.
Andy Wingo [Tue, 16 Feb 2010 20:47:34 +0000 (21:47 +0100)]
delete the tutorial
* configure.ac:
* doc/Makefile.am:
* doc/tutorial/ChangeLog-2008:
* doc/tutorial/ChangeLog-guile-doc-tutorial:
* doc/tutorial/Makefile.am:
* doc/tutorial/guile-tut.texi: Remove the tutorial. The history was out
of date (whereas the manual is current), the C examples are no longer
valid (and the manual does provide C examples), it was incomplete, and
its first person no longer hacks on Guile. So tutorial, you had a good
run, but the manual does your job now!
Andy Wingo [Tue, 16 Feb 2010 20:35:57 +0000 (21:35 +0100)]
fix a bug in the tutorial
* doc/tutorial/guile-tut.texi (c_builtins.c): Fix a typo with an
undeclared variable. Thanks to Raimon Grau for the pointer. This
tutorial is quite out of date, though...
Andy Wingo [Tue, 16 Feb 2010 20:11:27 +0000 (21:11 +0100)]
`load' doesn't cause the compiler to be loaded in some cases
* module/system/base/compile.scm (compiled-file-name): Add a comment.
* module/ice-9/boot-9.scm (load): Avoid loading up (system base compile)
just to compute an autocompiled file name. Fixes the issue whereby
guile-tools snarf-check-and-output-texi was inadvertantly loading up
srfi-1, and thereby a stale library, just to see if guile-tools itself
had a compiled version.
Not sure what the right unit test is here, other than vigilance.
Ludovic Courtès [Tue, 16 Feb 2010 19:50:27 +0000 (20:50 +0100)]
Add missing $(LTLIBINTL), suggested by Gnulib.
* libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBINTL).
Ludovic Courtès [Tue, 16 Feb 2010 19:46:49 +0000 (20:46 +0100)]
i18n: Define `nl_item' when it's not available (needed for Cygwin).
* configure.ac: Add check for `nl_item'.
* libguile/i18n.c: Separate check for `HAVE_LANGINFO_H' and
`HAVE_NL_TYPES_H'.
[!HAVE_NL_ITEM]: Define `nl_item'.
Ludovic Courtès [Tue, 16 Feb 2010 18:13:56 +0000 (19:13 +0100)]
Skip "wrong service name" `getaddrinfo' test on Darwin 9.2.
* test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]:
Skip test on Darwin 9.2.
Michael Gran [Tue, 16 Feb 2010 04:45:58 +0000 (20:45 -0800)]
Faster read of semicolon comments
There is no need to do character encoding processing within
semicolon comments.
* libguile/read.c (scm_read_semicolon_comment): changed
Ludovic Courtès [Mon, 15 Feb 2010 18:40:42 +0000 (19:40 +0100)]
Fix builds of `i18n.c' on non-GNU systems.
* libguile/i18n.c (chr_to_case, str_to_case): Add `func_name' argument
and `FUNC_NAME' macro. Update callers.
Ludovic Courtès [Mon, 15 Feb 2010 17:43:20 +0000 (18:43 +0100)]
Add `getaddrinfo' test.
* test-suite/tests/net-db.test ("getaddrinfo")["port 80 with family and
socket type"]: New test.
Ludovic Courtès [Mon, 15 Feb 2010 17:42:34 +0000 (18:42 +0100)]
Use `#f' for `addrinfo:canonname' when it wasn't supplied by getaddrinfo(3).
* libguile/net_db.c (scm_from_addrinfo): Use `#f' when `ai_canonname'
isn't set.
Ludovic Courtès [Mon, 15 Feb 2010 15:10:01 +0000 (16:10 +0100)]
Fix `getaddrinfo' tests.
Thanks to Ken Raeburn.
* test-suite/tests/net-db.test ("getaddrinfo")["port 80"]: Fix bogus
check of `addrinfo:flags' (POSIX says that the "contents of the
ai_flags field of the returned structures are undefined.").
("wrong service name"): Accept `EAI_NONAME' as a valid error code.
Ludovic Courtès [Sun, 14 Feb 2010 23:43:20 +0000 (00:43 +0100)]
Make the `getaddrinfo' "no name" test more robust.
* test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Check for
`EAI_EAGAIN' too.
Ludovic Courtès [Sun, 14 Feb 2010 21:37:39 +0000 (22:37 +0100)]
Add missing Gnulib files; update `.gitignore'.
This files were missing from commit
61cd9dc907b8a09990b14e9aeac7e20fe77cecc6 ("Use Gnulib's `getaddrinfo'
module.").
Ludovic Courtès [Sun, 14 Feb 2010 19:56:31 +0000 (20:56 +0100)]
Add `getaddrinfo' and related procedures.
* libguile/net_db.c (sym_getaddrinfo_error, sym_ai_passive,
sym_ai_canonname, sym_ai_numerichost, sym_ai_numericserv,
sym_ai_v4mapped, sym_ai_all, sym_ai_addrconfig, sym_eai_badflags,
sym_eai_noname, sym_eai_again, sym_eai_fail, sym_eai_family,
sym_eai_socktype, sym_eai_service, sym_eai_memory, sym_eai_system,
sym_eai_overflow, sym_eai_nodata, sym_eai_addrfamily,
sym_eai_inprogress, sym_eai_canceled, sym_eai_notcanceled,
sym_eai_alldone, sym_eai_intr, sym_eai_idn_encode): New variables.
(scm_from_addrinfo, scm_getaddrinfo, scm_gai_strerror): New functions.
* libguile/net_db.h (scm_getaddrinfo, scm_gai_strerror): New functions.
* module/ice-9/networking.scm (addrinfo:flags, addrinfo:fam,
addrinfo:socktype, addrinfo:protocol, addrinfo:addr,
addrinfo:canonname): New procedures.
* test-suite/tests/net-db.test: New file.
* test-suite/Makefile.am (SCM_TESTS): Add `tests/net-db.test'.
* doc/ref/posix.texi (Network Databases)[getaddrinfo]: New subsection.
[The Host Database]: Suggest using `getaddrinfo'.
Ludovic Courtès [Sun, 14 Feb 2010 16:06:13 +0000 (17:06 +0100)]
Use Gnulib's `getaddrinfo' module.
* m4/gnulib-cache.m4: Add `getaddrinfo'.
* libguile/Makefile.am (libguile_la_LDFLAGS): Add `$(GETADDRINFO_LIB)
$(HOSTENT_LIB) $(SERVENT_LIB)'.
Thien-Thi Nguyen [Tue, 9 Feb 2010 13:29:36 +0000 (14:29 +0100)]
Document trailing whitespace policy.
* HACKING (Coding standards): Delete trailing whitespace.
Add blurb documenting trailing whitespace policy.
Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Sat, 13 Feb 2010 22:50:06 +0000 (23:50 +0100)]
Document the maximum number of arguments for a subr.
* doc/ref/api-procedures.texi (Primitive Procedures): Specify the
maximum number of arguments. Patch by guign@mails.selgrad.org.
Ludovic Courtès [Sat, 13 Feb 2010 18:33:51 +0000 (19:33 +0100)]
Reinstate `scm_protects', for backward compatibility.
Partly reverts
e7efe8e793fa51ea898aea4477939c598b3e9fac ("decruftify
scm_sys_protects").
* libguile/gc.c (protects): Rename to...
(scm_protects): ... this.
* libguile/gc.h (scm_protects): Add declaration.
Ludovic Courtès [Tue, 9 Feb 2010 23:39:25 +0000 (00:39 +0100)]
Fix documentation of the `string->utf' and `utf->string' functions.
* doc/ref/api-data.texi (Bytevectors as Strings): Describe optional
parameter of `string->utf{16,32}' and `utf{16,32}->string'.
Ludovic Courtès [Tue, 9 Feb 2010 23:34:05 +0000 (00:34 +0100)]
Use the R6RS I/O API in `write-bytecode'.
* module/language/assembly/compile-bytecode.scm
(write-bytecode)[u32-bv]: New variable.
[write-char, write-uint16-be, write-uint16-le, write-uint32-le]:
Remove.
[write-string, write-uint32-be, write-uint32, write-wide-string,
write-bytevector]: Rewrite using the `(rnrs io ports)' API.
[write-uint24-be]: Rename to...
[write-int24-be]: ... this. Use `(rnrs io ports)' API. Callers
updated.
[write-uint16]: Remove.
Ludovic Courtès [Fri, 5 Feb 2010 10:11:56 +0000 (11:11 +0100)]
Change `write-bytecode' to accept a bytevector.
* module/language/assembly/compile-bytecode.scm (write-bytecode):
Replace the WRITE-BYTE and GET-ADDR parameters with PORT. New ADDRESS
and EMIT-OPCODE? parameters. Callers updated.
[write-byte, get-addr]: New procedures.
Adjust to write to PORT.
(compile-bytecode): Update accordingly.
* test-suite/tests/asm-to-bytecode.test (munge-bytecode): Return a
bytevector instead of a u8vector.
(comp-test): Deal with bytevectors.
Ludovic Courtès [Fri, 5 Feb 2010 09:38:38 +0000 (10:38 +0100)]
vlist: Slightly improve readability and consistency.
* module/ice-9/vlist.scm (define-inline): Fix case with non-singleton
body.
(make-vhash-assoc): Remove. Change to...
(%vhash-assoc): ... this, using `define-inline'.
Andy Wingo [Mon, 8 Feb 2010 21:59:25 +0000 (22:59 +0100)]
continuations return multiple values on the stack
* libguile/vm.h (struct scm_vm_cont): Instead of saving the "IP", save
"RA" and "MVRA". That is, save singly-valued and multiply-valued
return addresses, so that we can return multiple values on the stack.
(scm_i_vm_reinstate_continuation): Remove.
* libguile/vm.c (vm_capture_continuation): Rename from capture_vm_cont,
and change the prototype so we can capture the RA and MVRA, and so
that tail calls to call/cc can capture a continuation without the
call/cc application frame.
(vm_return_to_continuation): Rename from reinstate_vm_cont, and take
arguments to return to the continuation. Handles returning to single
or multiple-value RA.
(scm_i_vm_capture_continuation): Change to invoke
vm_capture_continuation. Kept around for the benefit of make-stack.
* libguile/vm-i-system.c (continuation-call): Handle reinstatement of
the VM stack, with arguments.
(call/cc, tail-call/cc): Adapt to new vm_capture_continuation
prototype. tail-call/cc captures tail continuations.
* libguile/stacks.c (scm_make_stack): Update for scm_vm_cont structure
change.
* libguile/continuations.h (struct scm_contregs): Remove throw_value
member, which was used to return a value to a continuation.
(scm_i_check_continuation): New internal function, checks that a
continuation may be reinstated.
(scm_i_reinstate_continuation): Replaces scm_i_continuation_call; just
reinstates the C stack.
(scm_i_contregs_vm, scm_i_contregs_vm_cont): New internal accessors.
* libguile/continuations.c (scm_i_make_continuation): Return
SCM_UNDEFINED if we are returning again.
(grow_stack, copy_stack_and_call, scm_dynthrow): Remove extra arg, as
vm opcodes handle value returns.
(copy_stack): No need to instate VM continuation.
(scm_i_reinstate_continuation): Adapt.
Andy Wingo [Sun, 7 Feb 2010 13:50:51 +0000 (14:50 +0100)]
scm_i_make_continuation takes vm and vm_cont args explicitly
* libguile/continuations.h:
* libguile/continuations.c (scm_i_make_continuation): Take VM and VM
continuation arguments as well; I'm not convinced that saving all VM
continuations was the right thing, and in any case we only ever saved
the latest. Running a new VM should create a continuation barrier.
* libguile/stacks.c (scm_make_stack):
* libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers.
* libguile/vm.h (scm_i_vm_capture_continuation)
(scm_i_vm_reinstate_continuation): Change to be internal, and to only
capture and reinstate continuations for a particular VM.
Andy Wingo [Sun, 7 Feb 2010 13:16:54 +0000 (14:16 +0100)]
make scm_make_continuation internal
* libguile/continuations.h:
* libguile/continuations.c (scm_i_make_continuation): Change from
scm_make_continuation, and make internal.
* libguile/vm-i-system.c (call/cc, tail-call/cc): Adapt callers.
* test-suite/standalone/test-unwind.c (check_cont_body): Adapt a test.
* doc/ref/api-control.texi (Continuations): Update docs.
Andy Wingo [Mon, 8 Feb 2010 12:33:21 +0000 (13:33 +0100)]
eval.c uses scm_i_call_with_current_continuation
* libguile/continuations.h
* libguile/continuations.c (scm_i_call_with_current_continuation): New
internal function. Not exported because I'm not sure whether or not
this should have a continuation barrier in the future. Uses a
hand-coded VM procedure.
* libguile/eval.c (eval): Use scm_i_call_with_current_continuation.
Andy Wingo [Sat, 6 Feb 2010 16:00:03 +0000 (17:00 +0100)]
continuations are vm procedures
* libguile/vm-i-system.c (continuation-call): New op, like subr-call or
foreign-call, but for continuations.
* libguile/continuations.h: Add scm_i_continuation_call internal
declaration.
(SCM_CONTINUATIONP): Reimplement in terms of
SCM_PROGRAM_IS_CONTINUATION.
(scm_tc16_continuation, SCM_CONTREGS, SCM_CONTINUATION_LENGTH)
(SCM_SET_CONTINUATION_LENGTH, SCM_JMPBUF, SCM_DYNENV, SCM_THROW_VALUE)
(SCM_CONTINUATION_ROOT, SCM_DFRAME): Remove these from the exposed
API.
(scm_i_continuation_to_frame): New internal declaration.
* libguile/continuations.c
* libguile/continuations.c: Add trickery like in foreign.c, smob.c, and
gsubr.c, so that we can make procedural trampolines for continuations.
(scm_i_continuation_to_frame): New internal function, from stacks.c.
* libguile/programs.h (SCM_F_PROGRAM_IS_CONTINUATION)
(SCM_PROGRAM_IS_CONTINUATION): Add a flag for programs that are
continuations. Probably should add flags for the other trampoline
types too.
* libguile/programs.c (scm_i_program_print): Print continuations as
before.
* libguile/stacks.c (scm_stack_id, scm_make_stack): Use
scm_i_continuation_to_frame in the continuation case.
Andy Wingo [Fri, 5 Feb 2010 10:30:53 +0000 (11:30 +0100)]
push a prompt handler value even in the inline-handler case
* module/language/tree-il/compile-glil.scm (flatten): Push a handler
value even in the inline-handler case, to make prompt's interface more
uniform, and also to correspond to the existing VM implementation.
Andy Wingo [Tue, 2 Feb 2010 21:59:55 +0000 (22:59 +0100)]
connect a few more wires to promptenstein
* libguile/tags.h (scm_tc7_prompt): Allocate a tc7 for prompt objects.
* libguile/control.h (SCM_F_PROMPT_INLINE, SCM_F_PROMPT_ESCAPE)
(SCM_PROMPT_P, SCM_PROMPT_FLAGS, SCM_PROMPT_INLINE_P)
(SCM_PROMPT_ESCAPE_P, SCM_PROMPT_TAG, SCM_PROMPT_REGISTERS)
(SCM_PROMPT_DYNENV, SCM_PROMPT_HANDLER)
(SCM_PROMPT_PRE_UNWIND_HANDLER, SCM_PROMPT_SETJMP)
(struct scm_prompt_registers):
* libguile/control.c (scm_c_make_prompt): Flesh out a simple prompts
implementation.
* libguile/vm-i-system.c (prompt): Wire up the implementation.
* libguile/vm.c: Add a needed #include.
Michael Gran [Wed, 3 Feb 2010 04:33:41 +0000 (20:33 -0800)]
Optimize reader by preferring stack-allocated buffers
* libguile/read.c (read_token): now takes a C buffer instead of a SCM.
string. All callers changed.
(read_complete_token): now takes C buffers, not SCM strings. No longer
does port position updates or encoding processing. All callers changed.
(scm_read_number, scm_read_mixed_case_symbol, scm_read_number_and_radix)
(scm_read_character): Do port updates and string processing no longer
done by read_complete_token. Some reordering for optimization.
Ludovic Courtès [Tue, 2 Feb 2010 22:58:03 +0000 (23:58 +0100)]
Use vhashes in `unused-variable-analysis'.
* module/language/tree-il/analyze.scm (unused-variable-analysis): Use
vhashes instead of alists/lists.
Ludovic Courtès [Tue, 2 Feb 2010 23:00:05 +0000 (00:00 +0100)]
Use vhashes in `arity-analysis'.
* module/language/tree-il/analyze.scm (arity-analysis): Use vhashes
instead of alists.
Ludovic Courtès [Tue, 2 Feb 2010 22:59:34 +0000 (23:59 +0100)]
Use vhashes in `unbound-variable-analysis'.
* module/language/tree-il/analyze.scm (unbound-variable-analysis): Use
vhashes instead of alists/lists.
Ludovic Courtès [Tue, 2 Feb 2010 22:59:03 +0000 (23:59 +0100)]
Use vhashes in `unused-toplevel-analysis'.
* module/language/tree-il/analyze.scm (graph-reachable-nodes): Add
REACHABLE argument. Update to use vhash instead of alists or lists.
(graph-reachable-nodes*): Adjust accordingly.
(partition*): New function.
(unused-toplevel-analysis): Adjust to use vhash instead of alists or
lists.
Ludovic Courtès [Tue, 2 Feb 2010 22:57:02 +0000 (23:57 +0100)]
Add `(ice-9 vlist)'.
* module/ice-9/vlist.scm, test-suite/tests/vlist.test,
benchmark-suite/benchmarks/vlists.bm: New files.
* module/Makefile.am (ICE_9_SOURCES): Add `vlist.scm'.
* test-suite/Makefile.am (SCM_TESTS): Add `tests/vlist.test'.
* benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add
`benchmarks/vlists.bm'.
* doc/ref/api-compound.texi (VLists, VHashes): New nodes.
Ludovic Courtès [Sat, 30 Jan 2010 21:54:20 +0000 (22:54 +0100)]
Inline SRFI-9 constructors too.
* module/srfi/srfi-9.scm (define-record-type)[constructor]: Use
`define-inlinable' instead of `define'.
* test-suite/lib.scm (exception:syntax-pattern-unmatched): New variable.
* test-suite/tests/srfi-9.test ("constructor")["foo 0 args (inline)",
"foo 2 args (inline)"]: New tests.
["foo 0 args", "foo 2 args"]: Adjust to constructor inlining.
* testsuite/t-records.scm: Remove wrong-arg-count case.
Ludovic Courtès [Fri, 29 Jan 2010 10:26:17 +0000 (11:26 +0100)]
SRFI-9: Fix `define-inlinable'.
* module/srfi/srfi-9.scm (define-inlinable): Fix the catch-all case of
the generated macro.
Andy Wingo [Sat, 30 Jan 2010 23:02:00 +0000 (00:02 +0100)]
add (ice-9 control)
* module/language/tree-il/primitives.scm (define-primitive-expander):
Allow quoted datums. Allow all self-evaluating expressions to be
constants.
(prompt, control): Add primitive expanders to turn these into @prompt
and @control.
* module/ice-9/control.scm: New module, for delimited continuation
operators.
* module/Makefile.am: Add.
Andy Wingo [Sat, 30 Jan 2010 23:01:11 +0000 (00:01 +0100)]
add @control and @prompt stub primitives
* libguile/Makefile.am:
* libguile/control.c:
* libguile/control.h:
* libguile/init.c: Add stub @control and @prompt primitives, for use
when bootstrapping (ice-9 control).
Andy Wingo [Sat, 30 Jan 2010 14:09:41 +0000 (15:09 +0100)]
GLIL and assembly support for prompt compilation
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
<glil-prompt> appropriately.
* module/language/assembly/disassemble.scm (code-annotation):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
Assemble and disassemble `prompt' appropriately.
Andy Wingo [Sat, 30 Jan 2010 14:52:48 +0000 (15:52 +0100)]
tree-il -> glil compilation of prompt, dynamic-wind, control
* module/language/tree-il/compile-glil.scm (flatten): Compile <prompt>,
<dynamic-wind>, and <control>.
Andy Wingo [Sun, 31 Jan 2010 09:44:44 +0000 (10:44 +0100)]
add return/nvalues
* libguile/vm-i-system.c (return/nvalues): New instruction, like
call/nargs.
Andy Wingo [Sat, 30 Jan 2010 14:51:44 +0000 (15:51 +0100)]
GLIL support for <prompt>
* module/language/glil.scm (<glil>): Add <glil-prompt>, with
handler-label and escape-only? fields.
Andy Wingo [Sat, 30 Jan 2010 14:49:50 +0000 (15:49 +0100)]
tree-il analyzer and inliner handle <prompt>
* module/language/tree-il/analyze.scm (analyze-lexicals): Add cases for
<prompt>, <dynamic-wind>, and <control>. If a continuation is not
referenced in the body of a prompt handler, mark the prompt as
escape-only.
* module/language/tree-il/inline.scm (inline!): Inline the handler of a
prompt if it is a simple lambda.
Andy Wingo [Sun, 31 Jan 2010 19:30:46 +0000 (20:30 +0100)]
dynamic-wind compilation to VM ops
* module/language/tree-il/primitives.scm: Resolve calls to dynamic-wind
to <dynamic-wind>, thereby inlining the dynwind to VM ops, and
allowing inline allocation of the body thunk.
Andy Wingo [Sat, 30 Jan 2010 14:47:44 +0000 (15:47 +0100)]
new tree-il for prompt, control, and dynamic-wind
* module/language/tree-il.scm: Initial tree-il support for <prompt>,
<control>, and <dynamic-wind>.
Andy Wingo [Sat, 30 Jan 2010 14:45:37 +0000 (15:45 +0100)]
initial VM support for delimited continuations and dynamic-wind
* libguile/vm-i-system.c (prompt, wind, throw, unwind):
New instructions, for implementing dynamic-wind and delimited
continuations.
* libguile/vm.c: Add some stub support for the new instructions.
* libguile/vm-engine.c: Some new error conditions.
Andy Wingo [Wed, 27 Jan 2010 21:25:29 +0000 (22:25 +0100)]
add a test for ffi and pointers
* test-suite/standalone/test-ffi:
* test-suite/standalone/test-ffi-lib.c: Add a pointer test.
Andy Wingo [Wed, 27 Jan 2010 21:12:58 +0000 (22:12 +0100)]
add simple foreign finalization, and pointer support
* libguile/foreign.h:
* libguile/foreign.c (scm_foreign_set_finalizer_x): New function, for a
limited form of finalization (like `free').
(scm_alignof, scm_sizeof, parse_ffi_type, fill_ffi_type): For the
purposes of make-foreign-function, treat '* (the asterisk symbol) as a
pointer.
* module/system/foreign.scm: Export foreign-set-finalizer!.
Andy Wingo [Wed, 27 Jan 2010 20:52:05 +0000 (21:52 +0100)]
statprof bugfixes
* module/statprof.scm (get-call-data): For closures, get call data by
the program's objcode.
(statprof-start, statprof-stop): Fix bug in which all statprof runs
were enabling the apply hook regardless of the setting of
#:count-calls?. The result was distorted timings, where procedure
calls were unfairly penalized.
(procedure=?): Streamline.
Andy Wingo [Wed, 27 Jan 2010 20:48:06 +0000 (21:48 +0100)]
inline calls to variable-bound?
* module/language/tree-il/compile-glil.scm (*primcall-ops*):
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Actually resolve calls to
`variable-bound?' to the opcode that we have for it.
Andy Wingo [Wed, 27 Jan 2010 20:47:01 +0000 (21:47 +0100)]
fix to variable-bound? instruction prototype
* libguile/vm-i-system.c (variable-bound?): Correctly declare as popping
one item.
Andy Wingo [Wed, 27 Jan 2010 20:45:47 +0000 (21:45 +0100)]
remove incremental NEWS entries in preparation for 1.9.8
* NEWS
Andy Wingo [Tue, 26 Jan 2010 21:55:58 +0000 (22:55 +0100)]
add a test for foreign functions taking struct args
* test-suite/standalone/test-ffi (f-sum-struct):
* test-suite/standalone/test-ffi-lib.c (test_ffi_sum_struct): Add a
struct test. Wheee....
Andy Wingo [Tue, 26 Jan 2010 21:55:13 +0000 (22:55 +0100)]
turn asserts into exceptions in foreign.c
* libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x)
(scm_i_foreign_print, fill_ffi_type, cif_to_procedure, unpack): Turn a
number of asserts into proper errors.
Andy Wingo [Tue, 26 Jan 2010 21:18:42 +0000 (22:18 +0100)]
add make-c-struct, parse-c-struct
* module/system/foreign.scm: Export alignof and sizeof.
(make-c-struct, parse-c-struct): New public functions.
Andy Wingo [Tue, 26 Jan 2010 21:16:35 +0000 (22:16 +0100)]
add `alignof' and `sizeof' Scheme functions
* libguile/foreign.h:
* libguile/foreign.c (scm_alignof, scm_sizeof): New functions.
Andy Wingo [Mon, 25 Jan 2010 22:45:15 +0000 (23:45 +0100)]
add ffi tests
* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-ffi:
* test-suite/standalone/test-ffi-lib.c: Add some tests for the ffi.
Andy Wingo [Mon, 25 Jan 2010 17:04:45 +0000 (18:04 +0100)]
implement foreign-call
* libguile/foreign.h:
* libguile/foreign.c (scm_i_foreign_call): New internal function,
actually implementing foreign calls. Untested.
* libguile/vm-i-system.c (foreign-call): Wire up the call to
scm_i_foreign_call.
Andy Wingo [Mon, 25 Jan 2010 17:15:35 +0000 (18:15 +0100)]
first pass at implementing low-level foreign functions
* libguile/Makefile.am (AM_CPPFLAGS): Move LIBFFI_CFLAGS here (from
AM_CFLAGS), allowing snarfing to work.
* libguile/foreign.h (scm_make_foreign_function): New public function.
* libguile/foreign.c: Flesh out an implementation of foreign functions.
(scm_take_foreign_pointer): Bugfix for the case in which we have a
finalizer.
* module/system/foreign.scm: Export `make-foreign-function'.
Andy Wingo [Mon, 25 Jan 2010 00:59:19 +0000 (18:59 -0600)]
renumber VM opcodes
* libguile/vm-i-loader.c:
* libguile/vm-i-scheme.c:
* libguile/vm-i-system.c: Renumber ops. Add a foreign-call op stub.
Rearrange some ops.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump
Andy Wingo [Mon, 18 Jan 2010 13:36:23 +0000 (14:36 +0100)]
byte access to foreigns via bytevectors
* libguile/foreign.h:
* libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x): Remove all
bits about offsets and aliasing; bytevectors are much better at that.
(scm_foreign_to_bytevector, scm_bytevector_to_foreign): New functions
for getting at the bytes of a memory region.
* module/system/foreign.scm (foreign->bytevector, bytevector->foreign):
Export these.
Andy Wingo [Mon, 18 Jan 2010 11:16:13 +0000 (12:16 +0100)]
move foreign function interface to its own module
* libguile/foreign.h:
* libguile/init.c: Change so that init just registers an extension,
later called by foreign.scm.
* libguile/foreign.c (scm_init_foreign): Define constants for the
various foreign types.
* module/Makefile.am:
* module/system/foreign.scm: New module, for the foreign function
interface.
Andy Wingo [Mon, 18 Jan 2010 10:42:35 +0000 (11:42 +0100)]
foreign.h presents a more pointer-centric interface
* libguile/foreign.c:
* libguile/foreign.h: Rework interface to be more pointer-centric.
Details are:
(SCM_FOREIGN_TYPE_STRUCT, SCM_FOREIGN_TYPE_POINTER): Removed; now the
pointer in a foreign is first-class. If it points to a native type
like uint32, then it still has a tag; but if it points to something
else, like a struct or a pointer or something, then its type is VOID
(i.e., void*).
(SCM_FOREIGN_POINTER): Rename from SCM_FOREIGN_OBJECT.
(SCM_FOREIGN_VALUE_REF, SCM_FOREIGN_VALUE_SET): Rename from
SCM_FOREIGN_OBJECT_REF and SCM_FOREIGN_OBJECT_SET, to indicate that
they only work with value types.
(SCM_FOREIGN_HAS_FINALIZER): Reserve a bit to indicate if the foreign
pointer in question has a finalizer registered.
(SCM_FOREIGN_LEN): For void* pointers, optionally store the length in
bytes of the associated memory region.
(SCM_FOREIGN_VALUE_P): Rename from SCM_FOREIGN_SIMPLE_P.
(SCM_VALIDATE_FOREIGN_VALUE): Rename from SCM_VALIDATE_FOREIGN_SIMPLE.
(scm_take_foreign_pointer): Rename from scm_c_take_foreign. Remove
scm_c_from_foreign.
(scm_foreign_type): New accessor.
(scm_foreign_ref, scm_foreign_set_x): Take some optional args, used
when dereferencing void pointers.
* libguile/dynl.h:
* libguile/dynl.c (scm_dynamic_pointer): New function, used by
scm_dynamic_func. Adapt code to foreign.h changes.
* libguile/goops.c (scm_enable_primitive_generic_x)
(scm_set_primitive_generic_x): Use the SCM_SET_SUBR_GENERIC macro.
* libguile/gsubr.c (create_gsubr): Adapt to API change.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Store the pointer
directly, not indirected.
* libguile/snarf.h (SCM_DEFINE, SCM_IMMUTABLE_FOREIGN): Store subr
pointers directly. Adapt to SCM_FOREIGN_TYPE_VOID change.
* libguile/vm-i-system.c (subr-call): Access the void* directly.
Andy Wingo [Fri, 15 Jan 2010 21:55:11 +0000 (22:55 +0100)]
add libffi dependency
* configure.ac:
* libguile/Makefile.am (AM_CFLAGS, libguile_la_LDFLAGS): Add a libffi
dependency, for making a dynamic FFI.
Ludovic Courtès [Mon, 25 Jan 2010 23:00:58 +0000 (00:00 +0100)]
Recognize structs with both "pr" and "pw" flags as simple.
* libguile/struct.c (set_vtable_layout_flags): Keep the
`SCM_VTABLE_FLAG_SIMPLE' flag when VTABLE has a mixture of `r' and `w'
fields.
* libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE): Adjust comment.
Ludovic Courtès [Mon, 25 Jan 2010 22:43:41 +0000 (23:43 +0100)]
Add ASCII art representing the basic struct layout.
* libguile/struct.h: Add ASCII art version of the basic struct layout as
shown in Andy's diagrams.
Ludovic Courtès [Mon, 25 Jan 2010 22:41:27 +0000 (23:41 +0100)]
Reinstate 2-word displacement for structs.
* libguile/struct.c (scm_init_struct): Reinstate 2-word displacement
removed by
01e74380f6170b5cb1105e5df9a368ab257420ef.
Michael Gran [Sat, 23 Jan 2010 17:15:10 +0000 (09:15 -0800)]
R6RS string escapes broken on string output
scm_to_stringn failed to do the necessary escape conversion for
R6RS hex escapes
* libguile/strings.c (unistring_escapes_to_r6rs_escapes): new function
(scm_to_stringn): use new function when r6rs hex escapes are enabled
* test-suite/tests/reader.test: new test for string display
Ludovic Courtès [Sat, 23 Jan 2010 16:03:11 +0000 (17:03 +0100)]
Revert "Install `standard-library.info'."
This reverts commit
0e64cbea3d22411564af302a63b670fe0617ccf3.
Ludovic Courtès [Sat, 23 Jan 2010 15:43:50 +0000 (16:43 +0100)]
Add `struct-ref' and `struct-set' VM opcodes.
* libguile/vm-i-scheme.c (make_struct): Optimize the
`SCM_VTABLE_FLAG_SIMPLE' case.
(struct_ref, struct_set): New opcodes.
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Add
`struct-ref' and `struct-set!'.
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Likewise.
(*effect-free-primitives*): Add `struct-ref'.
Ludovic Courtès [Sat, 23 Jan 2010 15:41:28 +0000 (16:41 +0100)]
Slightly improve comments and style in `struct.c'.
* libguile/struct.c (scm_i_struct_inherit_vtable_magic): Comment.
Punctuate comments within the body, have them follow GCS.
(scm_make_vtable_vtable): Clarify comments.
Ludovic Courtès [Sat, 23 Jan 2010 15:39:14 +0000 (16:39 +0100)]
Clarify GC-registered displacements for structs.
* libguile/struct.c (scm_init_struct): Remove unneeded
`GC_REGISTER_DISPLACEMENT ()' call. Comment the remaining one.
Ludovic Courtès [Sat, 23 Jan 2010 15:21:13 +0000 (16:21 +0100)]
Optimize struct initialization and accessors for the common case.
* libguile/struct.c (set_vtable_layout_flags): New function.
(scm_i_struct_inherit_vtable_magic): Use it.
(scm_struct_init): Optimize the case where HANDLE's vtable has the
`SCM_VTABLE_FLAG_SIMPLE' flag.
(scm_struct_ref): Likewise.
(scm_struct_ref): Likewise, when `SCM_VTABLE_FLAG_SIMPLE_RW' is also set.
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Update comment for the
next-to-last hidden field.
(scm_vtable_index_reserved_6): Rename to...
(scm_vtable_index_size): ... this.
(SCM_VTABLE_FLAG_RESERVED_0): Rename to...
(SCM_VTABLE_FLAG_SIMPLE): ... this.
(SCM_VTABLE_FLAG_RESERVED_1): Rename to...
(SCM_VTABLE_FLAG_SIMPLE_RW): ... this.
* test-suite/tests/structs.test ("low-level struct
procedures")["struct-ref", "struct-set!", "struct-ref out-of-range",
"struct-set! out-of-range"]: New tests.
Ludovic Courtès [Fri, 22 Jan 2010 15:55:24 +0000 (16:55 +0100)]
Install `standard-library.info'.
* doc/ref/Makefile.am (BUILT_SOURCES): Move `standard-library.texi'
to...
(nodist_info_TEXINFOS): ... here. New variable.
Ludovic Courtès [Wed, 20 Jan 2010 22:58:39 +0000 (23:58 +0100)]
Fix `uniform-vector-read!' and `uniform-vector-write'.
* libguile/deprecated.c (scm_uniform_vector_read_x,
scm_uniform_vector-write): Account for optional arguments. Make sure
the former always returns an integer.
* libguile/deprecated.h (scm_uniform_vector_read_x,
scm_uniform_vector_write, scm_uniform_array_read_x,
scm_uniform_array_write): Mark as `SCM_DEPRECATED'.
Ludovic Courtès [Tue, 19 Jan 2010 22:28:59 +0000 (23:28 +0100)]
Bump version number for 1.9.7.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
Ludovic Courtès [Tue, 19 Jan 2010 21:29:13 +0000 (22:29 +0100)]
Update `NEWS'.
Ludovic Courtès [Tue, 19 Jan 2010 21:28:38 +0000 (22:28 +0100)]
Document `guile-tools compile'.
* doc/ref/api-evaluation.texi (Compilation): Document `guile-tools
compile'.
Ludovic Courtès [Tue, 19 Jan 2010 20:41:41 +0000 (21:41 +0100)]
Reinstate `scm_is_bool ()' as a function.
* libguile/boolean.c (scm_is_bool): New function.
* libguile/boolean.h (scm_is_bool): New function declaration.
Ludovic Courtès [Tue, 19 Jan 2010 17:49:06 +0000 (18:49 +0100)]
Make `sockets.test' more robust.
* test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): Gracefully
handle cases where this combination is not supported.
Michael Gran [Tue, 19 Jan 2010 16:42:44 +0000 (08:42 -0800)]
Document modal encodings problem in ref doc
* doc/ref/api-io.texi (Ports): note that modal encodings are not
supported