⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.23
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
doc
/
guile-2.0.9
/
View File Name :
ChangeLog
2013-04-10 Ludovic Courtès <ludo@gnu.org> Mention `open-file' in NEWS. doc: Require libunistring 0.9.3 in `README'. * README: Require libunistring 0.9.3. The <unitypes.h> header in 0.9.1 lacks the _UC_ATTRIBUTE_CONST definition, leading to build failures. build: Tell `gen-scmconfig' whether the system has `struct timespec'. * configure.ac: Reinstate `struct timespec' check removed in commit 7e7c6f6a937005b08fffd5aeccdf992459b07137, but define `HAVE_SYSTEM_STRUCT_TIMESPEC' instead of `HAVE_STRUCT_TIMESPEC'. * libguile/gen-scmconfig.c (main): Change `HAVE_STRUCT_TIMESPEC' to `HAVE_SYSTEM_STRUCT_TIMESPEC'. Bump version number for 2.0.9. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. doc: Update `release.org'. * doc/release.org: Recommend "distcheck". Add `makeinfo' to the bootstrap tool list. stime: Remove #ifdef HAVE_*_H for headers provided by Gnulib. * libguile/stime.c: Remove #ifdef HAVE_SYS_TIMES_H, HAVE_SYS_TYPES_H, and HAVE_STRING_H since those headers are always provided by Gnulib when the corresponding macro is undefined. Fixes a regression on MinGW introduced by commit 40e2a31. Make `build-aux/gendocs.sh' executable. 2013-04-09 Ludovic Courtès <ludo@gnu.org> Bump version number for 2.0.8. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C functions `scm_c_bind_keyword_arguments' et al. (LIBGUILE_INTERFACE_AGE): Increment. tests: Skip FFI tests involving `scm_is_pair' when `dynamic-func' fails. * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Wrap `dynamic-func' in `false-if-exception' (static builds on NetBSD 5.1 raise "Symbol not found" here.) doc: Cosmetic change for `release.org'. * doc/release.org: Add #+STARTUP. Update `THANKS'. 2013-04-09 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Updates. fix stime patch for HAVE_TIMES removal * libguile/stime.c (scm_init_stime): Fix previous patch. At this point in the source, we definitely have a run-time function, but don't necessarily have a real-time function. 2013-04-09 Andy Wingo <wingo@pobox.com> simplify configure checks for functionality provided by gnulib * configure.ac: Remove checks for pipe, stftime, times, and select, as our Gnulib modules already ensure they are provided. * libguile/stime.c: Rely on gnulib providing `times'. 2013-04-09 Mark H Weaver <mhw@netris.org> Minor 'THANKS' fix. Fix alignment in 'THANKS'. Update bug report section of 'THANKS'. Update 'THANKS'. 2013-04-09 Mark H Weaver <mhw@netris.org> Manual: Don't promise to signal an error for an illegal 'letrec'. Reported by Nikita Karetnikov <nikita@karetnikov.org>. * doc/ref/api-binding.texi (Local Bindings): Remove the incorrect claim that improperly accessing a letrec-bound variable during evaluation of its initializers will necessarily cause an error to be signalled. 2013-04-09 Ludovic Courtès <ludo@gnu.org> tests: Skip IPv6 socket tests when OS support is missing. Reported by Samuel Thibault <samuel.thibault@gnu.org> and Peter Simons <simons@cryp.to>. * test-suite/tests/00-socket.test ("AF_INET6/SOCK_STREAM"): Throw `unresolved' when `bind' throws EADDRNOTAVAIL. 2013-04-08 Mark H Weaver <mhw@netris.org> Update 'NEWS'. Update 'NEWS'. Consume a peeked EOF at the REPL. * module/system/repl/repl.scm (meta-reader): Consume peeked EOF. 2013-04-08 Mark H Weaver <mhw@netris.org> Miscellaneous 'sendfile' fixes and improved tests. * libguile/filesys.c (scm_sendfile): In Linux-style sendfile(2) code, if EINTR or EAGAIN occurs, set result to 1 (not 0) so that we actually keep going. In non-sendfile(2) code, deal gracefully with short reads due to EOF. * test-suite/tests/filesys.test ("sendfile"): Use 'let*' to guarantee the needed order of operations: write (test-file) and then read it. Add code to check the written data (not just the returned length) in all tests, including the cases that hit EOF prematurely. 2013-04-07 Mark H Weaver <mhw@netris.org> Update 'NEWS'. 2013-04-07 Ludovic Courtès <ludo@gnu.org> Change `sendfile' to loop until everything has been sent. * libguile/filesys.c (scm_sendfile)[HAVE_SYS_SENDFILE_H && HAVE_SENDFILE]: Compare RESULT with C_COUNT. Loop until C_COUNT bytes have been sent. * doc/ref/posix.texi (File System): Update the description. Explain the new semantics. * test-suite/tests/filesys.test ("sendfile"): Rewrite using `pass-if-equal'. Check the return value for all the tests. ["file with offset past the end", "file with offset near the end"]: New tests. 2013-04-07 Mark H Weaver <mhw@netris.org> Remove outdated and misplaced "Included Guile Modules" node from manual. * doc/ref/api-modules.texi (Included Guile Modules): Remove. (Using Guile Modules): Fix cross reference. Clarify 'file-encoding' docs: heuristics may be improved later. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Mention UTF-8 as another common encoding used for Scheme source files, and that it is used by default. Change the description to leave open the possibility of adding additional heuristics in the future. Mention that if the coding declaration is in a #!-style block comment, it must be the first such comment in the file. Mention the '#:guess-encoding' keyword argument. 2013-04-07 Mark H Weaver <mhw@netris.org> Add keyword arguments to file opening procedures. * libguile/fports.c (scm_open_file_with_encoding): New API function, containing the code previously found in 'scm_open_file', but modified to accept the new 'guess_encoding' and 'encoding' arguments. (scm_open_file): Now just a simple wrapper that calls 'scm_open_file_with_encoding'. (scm_i_open_file): New implementation of 'open-file' that accepts keyword arguments '#:guess-encoding' and '#:encoding', and calls 'scm_open_file_with_encoding'. (scm_init_fports_keywords): New initialization function that gets called after keywords are initialized. * libguile/fports.h (scm_open_file_with_encoding, scm_init_fports_keywords): Add prototypes. * libguile/init.c (scm_i_init_guile): Call 'scm_init_fports_keywords'. * module/ice-9/boot-9.scm: Add enhanced versions of 'open-input-file', 'open-output-file', 'call-with-input-file', 'call-with-output-file', 'with-input-from-file', 'with-output-to-file', and 'with-error-to-file', that accept keyword arguments '#:binary', '#:encoding', and (for input port constructors) '#:guess-encoding'. * doc/ref/api-io.texi (File Ports): Update documentation. * test-suite/tests/ports.test ("keyword arguments for file openers"): Add tests. 2013-04-07 Chris K. Jester-Young <cky944@gmail.com> Add record type printer for srfi-41. * module/srfi/srfi-41.scm: Add record type printer for streams. (stream-promise-visit): New helper for visiting stream promises. Add record type printer for srfi-45. * module/srfi/srfi-45.scm: Add record type printer for promises. (promise-visit): New helper for visiting lazy promises. 2013-04-07 Mark H Weaver <mhw@netris.org> Implement efficient 'scm_unget_bytes' and 'unget-bytevector'. * libguile/ports.c (scm_i_unget_bytes): New static function. (scm_unget_bytes): New API function. (scm_unget_byte): Rewrite to simply call 'scm_i_unget_bytes'. (scm_ungetc, scm_peek_char, looking_at_bytes): Use 'scm_i_unget_bytes'. * libguile/ports.h: Add prototype for 'scm_unget_bytes'. * libguile/fports.c (scm_setvbuf): Use 'scm_unget_bytes'. * libguile/r6rs-ports.c (scm_unget_bytevector): New procedure. * module/ice-9/binary-ports.scm (unget-bytevector): New export. * doc/ref/api-io.texi (R6RS Binary Input): Add documentation. (R6RS I/O Ports): Update brief description of (ice-9 binary-ports) to reflect the new reality: it is no longer a subset of (rnrs io ports). * test-suite/tests/ports.test ("unget-bytevector"): Add test. 2013-04-07 Mark H Weaver <mhw@netris.org> Remove byte-order mark check from 'scm_i_scan_for_encoding'. * libguile/read.c (scm_i_scan_for_encoding): Remove byte-order mark check. 2013-04-07 Mark H Weaver <mhw@netris.org> Do not scan for coding declarations in open-file. * libguile/fports.c (scm_open_file): Do not scan for coding declarations. Replace 'use_encoding' local variable with 'binary'. Update documentation string. * module/ice-9/psyntax.scm (include): Add the same file-encoding logic that's used in compile-file and scm_primitive_load. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-io.texi (File Ports): Update docs. * test-suite/tests/ports.test: Change "open-file HONORS file coding declarations" test to "open-file IGNORES file coding declaration". * test-suite/tests/coding.test (scan-coding): Use 'file-encoding' to scan for the encoding, since 'open-input-file' no longer does so. 2013-04-07 Ludovic Courtès <ludo@gnu.org> doc: Link exceptions and escape continuations. * doc/ref/api-control.texi (Prompt Primitives): Mention exceptions. (Exception Terminology): Link to `call/ec'. doc: Warn against misuses of `file-name-separator-string'. * doc/ref/posix.texi (File System): Warn against misuses of `file-name-separator-string'. 2013-04-07 Daniel Llorens <daniel.llorens@bluewin.ch> Don't use scm_generalized_vector_get_handle() in array-map.c * libguile/array-map.c: (rafill, racp, ramap, rafe): use scm_array_get_handle() instead of scm_generalized_get_vector_handle(). 2013-04-07 Mark H Weaver <mhw@netris.org> Fix the recommendations for conversion of C string constants. * doc/ref/api-data.texi (Conversion to/from C, Symbol Primitives, Keyword Procedures): Fix the recommendations for conversion of C string constants. The encoding of the source code is irrelevant in modern compilers. What is relevant is the execution character set. Both GCC and clang use UTF-8 by default, so recommend the 'scm_from_utf8_*' functions when the argument is a C string constant. Also fix the broken texinfo markup for 'scm_from_*_symbol' that prevented them from being listed in the index. 2013-04-07 Mark H Weaver <mhw@netris.org> Fix indentation in test-scm-c-bind-keyword-arguments.c. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_invalid_keyword): Fix indentation. 2013-04-07 Mark H Weaver <mhw@netris.org> Implement 'scm_c_bind_keyword_arguments'. * libguile/keywords.c (scm_keyword_argument_error): New variable. (scm_c_bind_keyword_arguments): New API function. * libguile/keywords.h (enum scm_keyword_arguments_flags): New enum. (scm_t_keyword_arguments_flags): New typedef. (scm_c_bind_keyword_arguments): New prototype. * doc/ref/api-data.texi (Coding With Keywords, Keyword Procedures): Add documentation. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c: New file. * test-suite/standalone/Makefile.am: Add test-scm-c-bind-keyword-arguments test. 2013-04-06 Andy Wingo <wingo@pobox.com> NEWS tweaks * NEWS: Correct some errors. 2013-04-06 Mark H Weaver <mhw@netris.org> Bump 'copyright-year' to 2013. * module/ice-9/command-line.scm (version-etc): Bump 'copyright-year' to 2013. 2013-04-06 Ian Price <ianprice90@googlemail.com> Remove duplicate definitions of `call/ec' and `let/ec'. * module/language/tree-il/peval.scm (let/ec): Remove. Import (ice-9 control). * module/sxml/match.scm (%call/ec-prompt, call/ec, let/ec): Remove. Import (ice-9 control). 2013-04-06 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. doc: Document `--language'. * doc/ref/guile-invoke.texi (Command-line Options): Document `--language'. doc: Document file name separator procedures. * doc/ref/posix.texi (File System): Document `system-file-name-convention', `file-name-separator?', `absolute-file-name?', and `file-name-separator-string'. 2013-04-06 Chris K. Jester-Young <cky944@gmail.com> Use a fresh cons for %stream-null. * module/srfi/srfi-41.scm (%stream-null): Use a fresh cons rather than a literal cons. You never know what peval constant-folding could do with the latter, either now or in the future. 2013-04-05 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. 2013-04-05 Daniel Llorens <daniel.llorens@bluewin.ch> Deprecate scm_array_fill_int() * libguile/array-map.h, libgule/array-map.c: move scm_array_fill_int to the deprecated section. Remove double indirection in array-fill! * libguile/array-map.c: new function rafill, like scm_array_fill_int, but factors GVSET out of the loop. Use it in scm_array_fill_x instead of scm_array_fill_int. * test-suite/tests/arrays.test: add test for array-fill! with stride != 1. Tests for array-copy! * test-suite/tests/arrays.test: tests for arguments of rank 0, 1 and 2. 2013-04-05 Ludovic Courtès <ludo@gnu.org> Add `call/ec' and `let/ec'. Based on a patch by Nala Ginrut <nalaginrut@gmail.com>, with suggestions from Mark H. Weaver. * module/ice-9/control.scm (call-with-escape-continuation, call/ec): New procedures. (let-escape-continuation, let/ec): New macros. * module/ice-9/futures.scm (let/ec): Remove. * test-suite/tests/control.test ("escape-only continuations")["call/ec", "let/ec"]: New tests. * doc/ref/api-control.texi (Prompt Primitives): Document `call/ec', `let/ec', and their long names. 2013-04-05 Ludovic Courtès <ludo@gnu.org> tests: Add `pass-if-equal' support in `c&e'. * test-suite/test-suite/lib.scm (c&e): Add case for `pass-if-equal'. 2013-04-05 Mark H Weaver <mhw@netris.org> Use 'c_strcasecmp' instead of 'strcasecmp'. * libguile/ports.c (scm_new_port_table_entry, get_codepoint, scm_i_set_default_port_encoding, scm_i_port_iconv_descriptors, scm_i_set_port_encoding_x): * libguile/print.c (display_string_using_iconv): * libguile/read.c (scm_i_scan_for_encoding): Use 'c_strcasecmp'. Import 'c-strcase' from Gnulib. * lib/Makefile.am: * m4/gnulib-cache.m4: Add 'c-strcase' Gnulib module. 2013-04-05 Chris K. Jester-Young <cky944@gmail.com> Revert "Add record type printers for srfi-41 and srfi-45." This reverts commit 4a1cdc9d5d643d05fa7a18febc7c12070f3ef6d9, which was prematurely pushed. Add record type printers for srfi-41 and srfi-45. * module/srfi/srfi-41.scm: Add record type printer for streams. * module/srfi/srfi-45.scm: Add record type printer for promises. 2013-04-05 Mark H Weaver <mhw@netris.org> Improve handling of Unicode byte-order marks (BOMs). * libguile/ports-internal.h (struct scm_port_internal): Add new members 'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'. (SCM_UNICODE_BOM): New macro. (scm_i_port_iconv_descriptors): Add 'mode' parameter to prototype. * libguile/ports.c (scm_new_port_table_entry): Initialize 'at_stream_start_for_bom_read' and 'at_stream_start_for_bom_write'. (get_iconv_codepoint): Pass new 'mode' parameter to 'scm_i_port_iconv_descriptors'. (get_codepoint): After reading a codepoint at stream start, record that we're no longer at stream start, and consume a BOM where appropriate. (scm_seek): Set the stream start flags according to the new position. (looking_at_bytes): New static function. (scm_utf8_bom, scm_utf16be_bom, scm_utf16le_bom, scm_utf32be_bom, scm_utf32le_bom): New static const arrays. (decide_utf16_encoding, decide_utf32_encoding): New static functions. (scm_i_port_iconv_descriptors): Add new 'mode' parameter. If the specified encoding is UTF-16 or UTF-32, make that precise by deciding what byte order to use, and construct iconv descriptors based on the precise encoding. (scm_i_set_port_encoding_x): Record that we are now at stream start. Do not open the new iconv descriptors immediately; let them be initialized lazily. * libguile/print.c (display_string_using_iconv): Record that we're no longer at stream start. Write a BOM if appropriate. * doc/ref/api-io.texi (BOM Handling): New node. * test-suite/tests/ports.test ("set-port-encoding!, wrong encoding"): Adapt test to cope with the fact that 'set-port-encoding!' does not immediately open the iconv descriptors. (bv-read-test): New procedure. ("unicode byte-order marks (BOMs)"): New test prefix. 2013-04-04 Mark H Weaver <mhw@netris.org> Peeks do not consume EOFs. Fixes <http://bugs.gnu.org/12216>. * libguile/ports-internal.h (struct scm_port_internal): Add 'pending_eof' flag. * libguile/ports.c (scm_i_set_pending_eof, scm_i_clear_pending_eof): New static functions. (scm_new_port_table_entry): Initialize 'pending_eof'. (scm_i_fill_input): Check for 'pending_eof'. (scm_i_peek_byte_or_eof): Set 'pending_eof' flag before returning EOF. (scm_end_input, scm_unget_byte, scm_seek, scm_truncate): Clear 'pending_eof'. (scm_peek_char): Set 'pending_eof' flag before returning EOF. * test-suite/tests/ports.test ("pending EOF behavior"): Add tests. 2013-04-04 Mark H Weaver <mhw@netris.org> Nicer docstring syntax for case-lambda. * module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow a docstring to be placed immediately after the 'case-lambda' or 'case-lambda*'. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-procedures.texi (Case-lambda): Update docs. * test-suite/tests/optargs.test ("case-lambda", "case-lambda*"): Add tests. 2013-04-04 Mark H Weaver <mhw@netris.org> Cross reference 'SRFI-9 Records' directly instead of 'SRFI-9'. * doc/ref/api-compound.texi (Record Overview, Records): doc/ref/api-modules.texi (Included Guile Modules): doc/ref/r6rs.texi (R6RS Records): Cross reference 'SRFI-9 Records' directly instead of 'SRFI-9'. 2013-04-03 Mark H Weaver <mhw@netris.org> Preserve the case of the user-specified port encoding string. * libguile/ports.c (scm_i_set_port_encoding_x): Always copy the user-provided port encoding string, so that its case will be preserved and returned exactly by subsequent calls to 'port-encoding'. 2013-04-03 Daniel Llorens <daniel.llorens@bluewin.ch> Remove double indirection for 1st arg of array-for-each * libguile/array-map.c: (rafe): factor GVREF out of rank-1 loop for ra0. 2013-04-03 Ludovic Courtès <ludo@gnu.org> tests: Add `array-for-each' tests for one-dimensional traversals. * test-suite/tests/ramap.test ("array-for-each")["1 source"]: New test prefix. tests: Use `pass-if-equal' in ramap.test. * test-suite/tests/ramap.test ("array-for-each"): Use `pass-if-equal' instead of `(pass-if ... (equal? ...))'. 2013-04-03 Daniel Llorens <daniel.llorens@bluewin.ch> Remove double indirection in array-map! with <2 args * libguile/array-map.c: (ramap): factor GVSET/GVREF out of rank-1 loop for ra0 and the first element of ras. Avoid per-element cons for 1-arg case of array-map! * libguile/array-map.c: (ramap): special case when ras is a 1-element list. Deprecate dead code in array-map.c * libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp, scm_ra_lessp, scm_ra_leqp, scm_ra_grp, scm_ra_greqp, scm_ra_sum, scm_ra_product, scm_ra_difference, scm_ra_divide, scm_array_identity. 2013-04-03 Mark H Weaver <mhw@netris.org> Use 'strcasecmp' to compare encoding names. Reported by Ludovic Courtès <ludo@gnu.org>. * libguile/ports.c (scm_new_port_table_entry, scm_i_set_default_port_encoding, scm_i_set_port_encoding_x): libguile/read.c (scm_i_scan_for_encoding): Use 'strcasecmp' to compare encoding names. 2013-04-03 Daniel Llorens <daniel.llorens@bluewin.ch> Remove double indirection in element access in array-copy! * libguile/array-map.c: (racp): factor scm_generalized_vector_ref, scm_generalized_vector_set_x out of the rank-1 loop. 2013-04-03 Mark H Weaver <mhw@netris.org> Remove BOM tests that depend on GNU iconv behavior. * test-suite/tests/ports.test ("unicode byte-order marks (BOMs)"): Remove tests that depend on GNU iconv behavior. We will add them back when we have portable BOM support. 2013-04-03 Mark H Weaver <mhw@netris.org> Rename 'scm_i_get_byte_or_eof' et al; mark them as SCM_API. * libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof', respectively. * libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Rename to 'scm_slow_get_byte_or_eof' and 'scm_slow_peek_byte_or_eof', respectively, and mark them as SCM_API. * libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Adjust to use the new names. 2013-04-03 Mark H Weaver <mhw@netris.org> Remove uses of GC_PTR in 'finalize_iconv_descriptors'. * libguile/ports.c (finalize_iconv_descriptors): Change GC_PTR to (void *) in parameter types. 2013-04-02 Mark H Weaver <mhw@netris.org> Rewrite get_iconv_codepoint to fix a bug involving byte-order marks. * libguile/ports.c (get_iconv_codepoint): Rewrite to fix a bug and improve efficiency and clarity. Previously, it incorrectly assumed that iconv would never consume input without producing output, which led to a buffer overrun and subsequent assertion failure. This happens when a byte-order mark is consumed by iconv at the beginning of the stream when using the UTF-16 or UTF-32 encodings. * test-suite/tests/ports.test (unicode byte-order marks (BOMs)): Add tests. 2013-04-02 Mark H Weaver <mhw@netris.org> Move slow path out of 'scm_get_byte_or_eof' et al. Suggested by Andy Wingo. * libguile/inline.h (scm_get_byte_or_eof, scm_peek_byte_or_eof): Keep only the fast path here, with fallback to 'scm_i_get_byte_or_eof' and 'scm_i_peek_byte_or_eof'. * libguile/ports.c (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): New internal functions. * libguile/ports.h (scm_i_get_byte_or_eof, scm_i_peek_byte_or_eof): Add prototypes. 2013-04-02 Mark H Weaver <mhw@netris.org> Add a static version of 'scm_fill_input' to ports.c. * libguile/ports.c (scm_i_fill_input): New static function, containing the code that was previously in 'scm_fill_input'. (scm_fill_input): Simply call 'scm_i_fill_input'. (scm_c_read): Use 'scm_i_fill_input'. 2013-04-01 Mark H Weaver <mhw@netris.org> Move the port alist from the hash table to the internal port structure. * libguile/ports-internal.h (struct scm_port_internal): Add 'alist' member. * libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): New internal functions. (scm_i_port_weak_hash): Update comment: the hash table is no longer used to store the port's alist. (scm_new_port_table_entry): Initialize 'alist'. Store SCM_BOOL_F in the port weak hash, not SCM_EOL. * libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Add protoypes. * libguile/read.c (set_port_read_option, init_read_options): Access the port's alist via 'scm_i_port_alist' and 'scm_i_set_port_alist_x'. 2013-04-01 Mark H Weaver <mhw@netris.org> Optimize 'get-bytevector-some'; it may now read less than possible. * libguile/r6rs-ports.c (scm_get_bytevector_some): Rewrite to efficiently take the contents of the read/putback buffers. In the docstring, clarify that it might not return all available bytes. * doc/ref/api-io.texi (R6RS Binary Input): Clarify that 'get-bytevector-some' might not return all available bytes. * test-suite/tests/r6rs-ports.test ("get-bytevector-some [only-some]"): Remove bogus test, which requires more than the R6RS requires. 2013-04-01 Mark H Weaver <mhw@netris.org> Refactor port encoding modes: utf-8 and iconv Based on 6c98257f2ead0855f218369ea7f9a823cdb9727e by Andy Wingo. * libguile/ports-internal.h (struct scm_port_internal): Add a flag for the port encoding mode: UTF8 or iconv. The iconv descriptors are now in a separate structure so that we can avoid attaching finalizers to the ports themselves in the future. (enum scm_port_encoding_mode): New enum. (struct scm_iconv_descriptors): New struct. (scm_i_port_iconv_descriptors): Add prototype. * libguile/ports.c (finalize_port): Don't close iconv descriptors here. (scm_new_port_table_entry): Adapt to the iconv descriptors being moved. Initialize 'encoding_mode'. (scm_i_remove_port): Adapt to call 'close_iconv_descriptors'. (close_iconv_descriptors): New static function. (get_iconv_codepoint): Use 'scm_i_port_iconv_descriptors'. (get_codepoint): Check the port 'encoding_mode'. (finalize_iconv_descriptors, open_iconv_descriptors, close_iconv_descriptors, scm_i_port_iconv_descriptors): New static functions. (scm_i_set_port_encoding_x): Adapt to iconv descriptors being moved to separate structure, to set the 'encoding_mode' flag, and to use 'open_iconv_descriptors' and 'close_iconv_descriptors'. * libguile/print.c (display_string_using_iconv): Use 'scm_i_port_iconv_descriptors'. (display_string): Use 'encoding_mode' flag. 2013-04-01 Mark H Weaver <mhw@netris.org> Add internal-only port structure and move iconv descriptors there. * libguile/ports-internal.h: New file. * libguile/Makefile.am (noinst_HEADERS): Add ports-internal.h. * libguile/ports.h (scm_t_port): Add a comment mentioning that the 'input_cd' and 'output_cd' fields of the public structure are no longer what they seem to be. * libguile/ports.c: Include ports-internal.h. (finalize_port, scm_i_remove_port, get_iconv_codepoint, get_codepoint, scm_i_set_port_encoding_x): Access 'input_cd' and 'output_cd' via the new internal port structure. (scm_new_port_table_entry): Allocate and initialize the internal port structure. * libguile/print.c: Include ports-internal.h. (display_string_using_iconv, display_string): Access 'input_cd' and 'output_cd' via 'internal' pointer. 2013-04-01 Mark H Weaver <mhw@netris.org> Add 'scm_gc_typed_calloc' macro. * libguile/gc.h (scm_gc_typed_calloc): New macro. Fix broken texinfo markup in (ice-9 iconv) docs. * doc/ref/api-data.texi (Representing Strings as Bytes): Fix broken @deffn syntax. scm_string_join: properly sequence operations in ADD_TO_APPEND_LIST * libguile/srfi-13.c (scm_string_join): Properly sequence operations in ADD_TO_APPEND_LIST macro. Optimize 'string-join'. * libguile/srfi-13.c (string-join): Rewrite to call 'scm_string_append' only once. Make 'string-append' more efficient and robust. * libguile/strings.c (scm_string_append): Check for numerical overflow while computing the length of the result. Double-check that we don't overflow the result string, and that it is the correct length in the end (in case another thread changed the list). When copying a narrow string to a wide result, avoid calling 'scm_i_string_length' and 'scm_i_string_chars' on each character. 2013-04-01 Mark H Weaver <mhw@netris.org> Fix typos in 'string-join' docs: 'string-infix' -> 'strict-infix'. * doc/ref/api-data.texi (String Constructors): In definition of 'string-join', change 'string-infix' -> 'strict-infix'. * libguile/srfi-13.c (scm_string_join): In docstring, change 'string-infix' -> 'strict-infix'. 2013-04-01 Mark H Weaver <mhw@netris.org> Avoid unnecessary peeks for EOF in r6rs-ports. * libguile/r6rs-ports.c (scm_get_bytevector_n, scm_get_bytevector_n_x, scm_get_bytevector_some, scm_get_bytevector_all): Avoid peeking for EOF when we already know. 2013-03-31 Mark H Weaver <mhw@netris.org> Add -C command-line option to adjust %load-compiled-path. * module/ice-9/command-line.scm (compile-shell-switches): Implement -C option. (*usage*): Add -C option. * doc/ref/guile-invoke.texi (Command-line Options): Add docs. 2013-03-29 Ludovic Courtès <ludo@gnu.org> Augment `.gitignore'. 2013-03-29 Ludovic Courtès <ludo@gnu.org> build: Build and check (ice-9 popen) only when --enable-posix and HAVE_FORK. Fixes <http://bugs.gnu.org/13848>. Reported by Jan Schukat <shookie@email.de>. * configure.ac: Rename `HAVE_FORK' conditional to `BUILD_ICE_9_POPEN'. Set it when both $enable_posix and $ac_cv_func_fork are true. * libguile/posix.c (scm_init_posix): Add the `fork' feature. * doc/ref/api-options.texi (Common Feature Symbols): Add `fork'. * doc/ref/posix.texi (Pipes): Add footnote mentioning the `fork' feature. * module/Makefile.am (SCRIPTS_SOURCES): Make `scripts/autofrisk.scm' and `scripts/scan-api.scm' conditional on `BUILD_ICE_9_POPEN'. * test-suite/tests/popen.test (if-supported): New macro. Wrap body in `if-supported'. 2013-03-29 Ludovic Courtès <ludo@gnu.org> build: Remove redundant check for `struct timespec'. * m4/gnulib-cache.m4: Add `time'. * lib/Makefile.am: Update, still from v0.0-7865-ga828bb2. * configure.ac: Remove check for `struct timespec', which was redundant with Gnulib, and conflicted with pthread-win32's <pthread.h>: <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00096.html>. 2013-03-29 Mark H Weaver <mhw@netris.org> doc: Use '@defvr' to introduce 'stream-null'. * doc/ref/srfi-modules.texi (SRFI-41): Use @defvr to introduce 'stream-null'. Revert "doc: Consider `stream-null' as a variable." This reverts commit 4a0821a8d5cfff50fef8c119a0d76355b6126009. 2013-03-28 Ludovic Courtès <ludo@gnu.org> tests: Skip `test-pthread-create-secondary' except on Linux-based systems. * test-suite/standalone/test-pthread-create-secondary.c: Skip on non-Linux-based systems. build: Require GMP >= 4.2. * NEWS, README: Update. tests: Fix file name canonicalization tests for when $srcdir contains symlinks. * test-suite/tests/ports.test ("%file-port-name-canonicalization"): Use `pass-if-equal' instead of `pass-if'. ["relative canonicalization from ice-9"]: Throw to `unresolved' when %LOAD-PATH is not canonical. ["absolute canonicalization from ice-9"]: Canonicalize the result. Add Gnulib commit ID in `NEWS'. Allow compilation with GMP < 5.0.0. * libguile/numbers.c (VARARG_MPZ_ITERATOR)[!HAVE_DECL_MPZ_INITS]: New macro. (mpz_inits, mpz_clears)[!HAVE_DECL_MPZ_INITS]: New functions. * configure.ac: Check for the declaration of `mpz_inits'. Fix erroneous `FUNC_NAME' for `scm_array_length'. * libguile/generalized-arrays.c (scm_array_length): Fix `FUNC_NAME'. doc: Consider `stream-null' as a variable. * doc/ref/srfi-modules.texi (SRFI-41): Use @var{stream-null}, not @code{stream-null}. Use @defvr to introduce `stream-null'. 2013-03-28 Ian Price <ianprice90@googlemail.com> Document (system repl server) * doc/ref/api-evaluation.texi (REPL Servers): New Subsection. 2013-03-28 Mark H Weaver <mhw@netris.org> SRFI-41 stream-null is a Scheme Variable, not a Constant. Suggested by Ludovic Courtès <ludo@gnu.org>. * doc/ref/srfi-modules.texi (SRFI-41 Stream Primitives): Label 'stream-null' as a Scheme Variable, not a Constant. 2013-03-27 Chris K. Jester-Young <cky944@gmail.com> Use BT Templeton's preferred name. * THANKS: Use BT Templeton's preferred name. 2013-03-27 Mark H Weaver <mhw@netris.org> Thanks Chris K. Jester-Young. * THANKS: Add Chris K Jester-Young to the list of contributors. 2013-03-27 Mark H Weaver <mhw@netris.org> Add full documentation for SRFI-41. * doc/ref/misc-modules.texi (Streams): Add cross-reference to SRFI-41. * doc/ref/srfi-modules.texi (SRFI-41): Replace stub with full documentation. (SRFI-41 Stream Fundamentals, SRFI-41 Stream Primitives, SRFI-41 Stream Library): New subsubsections. 2013-03-27 Chris K. Jester-Young <cky944@gmail.com> Add SRFI-41. Incorporates suggestions from Mark H Weaver <mhw@netris.org> and Ian Price <ianprice90@googlemail.com>. * module/srfi/srfi-41.scm: New file. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-41.scm. * test-suite/tests/srfi-41.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-41.test. * doc/ref/srfi-modules.texi (SRFI Support): Add SRFI-41. (SRFI-41): New node which refers the reader to <http://srfi.schemers.org/srfi-41/srfi-41.html>. 2013-03-27 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. 2013-03-27 Ludovic Courtès <ludo@gnu.org> futures: Limit the number of nested futures on the same stack. Fixes <http://bugs.gnu.org/13188>. Reported by Nala Ginrut <nalaginrut@gmail.com>. * module/ice-9/futures.scm (%nesting-level): Rename to... (%nesting-level): ... this. Default to 0 instead of #f. Update users. (%max-nesting-level): New variable. (touch): When FUTURE is queued and (%nesting-level) is above %MAX-NESTING-LEVEL, abort to %FUTURE-PROMPT. * test-suite/tests/future.test ("nested futures")["loop"]: Remove `compile' call. * test-suite/tests/threads.test ("par-map")["long list"]: New test. * doc/ref/api-scheduling.texi (Futures): Add a paragraph about stack consumption. 2013-03-27 Ludovic Courtès <ludo@gnu.org> Document `and=>'. * module/ice-9/boot-9.scm (and=>): Add docstring. * doc/ref/api-procedures.texi (Higher-Order Functions): Add `and=>'. 2013-03-27 Daniel Hartwig <mandyke@gmail.com> web http: parse numeric time zones in headers * module/web/http.scm (parse-zone-offset, normalize-date): New procedures. (parse-rfc-822-date, parse-rfc-850-date, parse-date): Update. * test-suite/tests/web-http.test ("general headers"): Add test. 2013-03-27 Ludovic Courtès <ludo@gnu.org> doc: Use a preferred naming convention in SRFI-9 examples. * doc/ref/api-compound.texi (SRFI-9 Records): Use "Scheme Syntax" instead of "library syntax". Remove `get-' from getter names, and add an exclamation mark in setter names. Change `employee-type' to `<employee>'. 2013-03-27 Mark H Weaver <mhw@netris.org> Manual: xref SRFI-45 from core Delayed Evaluation section. * doc/ref/api-evaluation.texi (Delayed Evaluation): Add cross-reference to SRFI-45. 2013-03-27 Mark H Weaver <mhw@netris.org> SRFI-45: add promise? predicate. * module/srfi/srfi-45.scm (promise?): Export. * doc/ref/srfi-modules.texi (SRFI-45): Update docs. * test-suite/tests/srfi-45.test: Add test. Add FSF copyright for 2010 and 2013. Add missing year to André van Tonder's copyright notice. 2013-03-27 Mark H Weaver <mhw@netris.org> Revert "SRFI-45: Support multiple values; add promise? predicate." This reverts commit 1d64b4edb9da4011ad06c0fab1c6225ec20b0876. 2013-03-25 Ludovic Courtès <ludo@gnu.org> SRFI-37: Fix infinite loop when processing short option with no required arg. Fixes <http://bugs.gnu.org/13176>. * module/srfi/srfi-37.scm (args-fold)[short-option-argument]: When ARGS is a pair, always set it to its cdr. * test-suite/tests/srfi-37.test ("SRFI-37")["short option with optional argument omitted", "short option with optional argument provided"]: New tests. 2013-03-25 Ludovic Courtès <ludo@gnu.org> getaddrinfo: Document the missing errno value for EAI_SYSTEM. In response to <http://bugs.gnu.org/13958>. Reported by Lluís Batlle i Rossell <viric@viric.name>. * doc/ref/posix.texi (Network Databases): Document the missing errno value for EAI_SYSTEM. * libguile/net_db.c (scm_getaddrinfo): Likewise. 2013-03-25 Ludovic Courtès <ludo@gnu.org> build: Use portable sed constructs. Partly fixes <http://bugs.gnu.org/14042>. Reported by Marc Girod <marc.girod@gmail.com>. * meta/Makefile.am (guile-config): Use separate "s" expressions to accommodate Solaris sed. 2013-03-25 Ludovic Courtès <ludo@gnu.org> sendfile: Make sure we have a Linux-style `sendfile'. * libguile/filesys.c (scm_sendfile): Change conditional to HAVE_SYS_SENDFILE_H && HAVE_SENDFILE. sendfile: Check return value of `lseek'. * libguile/filesys.c (scm_sendfile): Check return value of `lseek_or_lseek64', and use `SCM_SYSERROR' upon error. Skip relevant `sendfile' tests when thread support is lacking. * test-suite/tests/filesys.test ("sendfile")["pipe", "pipe with offset"]: Throw to `unresolved' when not (provided? 'threads). 2013-03-22 Ludovic Courtès <ludo@gnu.org> tests: Add more `maybe-gc-flakiness'. Fixes <http://bugs.gnu.org/14001>. Reported by Dennis Clarke <dclarke@blastwave.org>. * test-suite/tests/gc.test ("gc")["Lexical vars are collectable"]: Wrap in `maybe-gc-flakiness'. 2013-03-22 Ludovic Courtès <ludo@gnu.org> Add bindings for `sendfile'. * configure.ac: Check for <sys/sendfile.h> and `sendfile'. * libguile/filesys.c (scm_sendfile): New function. * libguile/filesys.h (scm_sendfile): New declaration. * test-suite/tests/filesys.test ("sendfile"): New test prefix. * doc/ref/posix.texi (File System): Document `sendfile'. texinfo plain-text: Use `match' for `stexi->plain-text'. * module/texinfo/plain-text.scm (def)[list/spaces]: Remove. (stexi->plain-text): Use `match' instead of `cond'. texinfo: Add whitespace after periods. * module/texinfo/string-utils.scm (end-of-sentence?): New procedure. (make-text-wrapper): Append an extra space after LINE when it matches `end-of-sentence?' and COLLAPSE-WHITESPACE? is false. * test-suite/tests/texinfo.serialize.test ("test-serialize"): Adjust accordingly. * test-suite/tests/texinfo.string-utils.test ("text wrapping")["two spaces after end of sentence"]: New test prefix. build: Adjust makefiles for `guile-procedures.txt'. * libguile/Makefile.am (all-local): New target. * Makefile.am (libguile/guile-procedures.txt): Output to $@.tmp first. (CLEANFILES): New variable. 2013-03-21 Ludovic Courtès <ludo@gnu.org> Build `guile-procedures.txt' using (texinfo) instead of `makeinfo'. * Makefile.am (schemelibdir, schemelib_DATA): New variables. (libguile/guile-procedures.txt): New target. (EXTRA_DIST): Add libguile/texi-fragments-to-docstrings. * libguile/Makefile.am (guile-procedures.txt): Remove target. (schemelibdir, schemelib_DATA): Remove. * libguile/texi-fragments-to-docstrings: New file. texinfo plain-text: Properly render @dots{}. * module/texinfo/plain-text.scm (tag-handlers): Add `dot' handler. test suite: Fix typo in `texinfo.test'. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add missing quote. texinfo: Recognize `@:'. * module/texinfo.scm (read-command-token): Recognize @:. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add test. texinfo: Allow markup in the arguments of `@pxref'. * module/texinfo.scm (texi-command-specs)[pxref]: Change to `INLINE-TEXT-ARGS'. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@pxref{Locales, @code{setlocale}}"]: New test. test suite: Use `pass-if-equal' in texinfo.test. * test-suite/tests/texinfo.test: Replace occurrences of `(pass-if (equal? ...))' by `pass-if-equal'. 2013-03-21 Mike Gran <spk121@yahoo.com> Document quit and exit * doc/ref/posix.texi (Processes): document `quit' and `exit' * doc/ref/r6rs.texi (rnrs programs): xref exit 2013-03-21 Mark H Weaver <mhw@netris.org> Add missing 'cond-expand' feature identifiers; remove srfi-6 from core list. * module/ice-9/boot-9.scm (%cond-expand-features): Remove redundant list of feature identifiers in the comment. Explain more clearly what belongs in this list. Remove srfi-6. * module/srfi/srfi-4.scm, module/srfi/srfi-27.scm, module/srfi/srfi-31.scm, module/srfi/srfi-38.scm, module/srfi/srfi-39.scm, module/srfi/srfi-42.scm, module/srfi/srfi-45.scm, module/srfi/srfi-67.scm: Add missing 'cond-expand-provide'. * module/srfi/srfi-69.scm: Fix erroneous 'cond-expand-provide'. * doc/ref/srfi-modules.texi (SRFI-0): Update the list of features in Guile core. 2013-03-21 Mark H Weaver <mhw@netris.org> Mention the non-conformance of the core SRFI-6 procedures in the manual. * doc/ref/srfi-modules.texi (About SRFI Usage): Use SRFI-13 as an example of a module which is included in core Guile, instead of SRFI-6. (SRFI-6): Mention the non-conformance of the core 'open-input-string' and 'open-output-string' procedures. Remove the claim that importing this module does nothing. Recommend that users import the module. 2013-03-20 Mark H Weaver <mhw@netris.org> Improve sqrt handling of large integers and large and small rationals. * libguile/numbers.c (exact_integer_is_perfect_square, exact_integer_floor_square_root): New static functions. (scm_sqrt): Use SCM_LIKELY. Add 'scm_t_inum' variable in inum case to reduce the number of uses of SCM_I_INUM. Rename 'mpz_t' variable. Remove unneeded sign check. Handle bignums too large to fit in a double. Handle fractions too large or too small to fit in a normalized double. * test-suite/tests/numbers.test ("sqrt"): Add tests. 2013-03-20 Mark H Weaver <mhw@netris.org> Optimize inum case of exact-integer-sqrt. * libguile/numbers.c (scm_exact_integer_sqrt): Use GMP for inum case. It is faster than what we had before. 2013-03-20 Mark H Weaver <mhw@netris.org> Sqrt returns exact results when possible. * libguile/numbers.c (scm_sqrt): Handle exact integers and rationals in such a way that exact results are returned whenever possible. * test-suite/tests/numbers.test ("sqrt"): Add tests. 2013-03-20 Mark H Weaver <mhw@netris.org> Optimize scm_i_divide2double for integers less than 2^DBL_MANT_DIG. * libguile/numbers.c (scm_i_divide2double): Optimize for common case when both operands are less than 2^DBL_MANT_DIG (normally 2^53). 2013-03-19 Mark H Weaver <mhw@netris.org> SRFI-45: Support multiple values; add promise? predicate. * module/srfi/srfi-45.scm (eager): Accept any number of arguments. Store the list of arguments in the value record. Previously, only one argument was accepted, and that value was stored in the value record. (delay): Support expressions that return any number of arguments. (force): Return the list of values stored in the value record. (promise?): Export. * doc/ref/srfi-modules.texi (SRFI-45): Update docs. Remove typing for simplicity in discussing multiple values. * test-suite/tests/srfi-45.test: Add tests. Add FSF copyright for 2010 and 2013. Add missing year to André van Tonder's copyright notice. 2013-03-19 Mark H Weaver <mhw@netris.org> Use scientific notation only if there are enough trailing zeroes. * libguile/numbers.c (idbl2str): Print large numbers in scientific notation only if the exponent is >= 7 and the least significant non-zero digit has value >= radix^4. * test-suite/tests/numbers.test ("number->string"): Add tests. 2013-03-18 Ludovic Courtès <ludo@gnu.org> Avoid rebuild of `guile.info' at the user's site. * configure.ac: Remove `doc/ref/effective-version.texi' from the `AC_CONFIG_FILES'. * doc/ref/Makefile.am ($(srcdir)/effective-version.texi): New target. Use byte-oriented functions in `get-bytevector*'. * libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_n, scm_get_bytevector_n_x, scm_get_bytevector_all): Use `scm_get_byte_or_eof' and `scm_peek_byte_or_eof' instead of their `char' counterparts. Reported by Chris K. Jester-Young. Define the new Linux-specific `SO_REUSEPORT'. * libguile/socket.c (scm_init_socket)[SO_REUSEPORT]: Define `SO_REUSEPORT'. (scm_setsockopt, scm_getsockopt): Update docstring. * doc/ref/posix.texi (Network Sockets and Communication): List `SO_REUSEPORT'. 2013-03-17 Mark H Weaver <mhw@netris.org> Reimplement idbl2str number printer. Fixes <http://bugs.gnu.org/13757>. * libguile/numbers.c (idbl2str): Reimplement. (mem2decimal_from_point): Accept negative exponents larger than SCM_MAXEXP that produce subnormals. (SCM_MAX_DBL_PREC): Removed preprocessor macro. (scm_dblprec, fx_per_radix): Removed static variables. (init_dblprec, init_fx_radix): Removed static functions. (scm_init_numbers): Remove initialization code for 'scm_dblprec' and 'fx_per_radix'. * test-suite/tests/numbers.test ("number->string"): Restore tests that previously failed. Remove comments about problems in the number printer that are now fixed. 2013-03-17 Mark H Weaver <mhw@netris.org> Improve inexact division of exact integers. * libguile/numbers.c (scm_i_divide2double): New function. (scm_i_divide2double_lo2b): New variable. (scm_i_fraction2double, log_of_fraction): Use 'scm_i_divide2double'. (do_divide): Removed. Its code is now in 'scm_divide'. (scm_divide2real): Removed. Superceded by 'scm_i_divide2double'. (scm_divide): Inherit code from 'do_divide', but without support for forcing a 'double' result (that functionality is now implemented by 'scm_i_divide2double'). Add FIXME comments in cases where divisions might not be as precise as they should be. (scm_init_numbers): Initialize 'scm_i_divide2double_lo2b'. * test-suite/tests/numbers.test (dbl-epsilon-exact, dbl-max-exp): New variables. ("exact->inexact"): Add tests. ("inexact->exact"): Add test for largest finite inexact. 2013-03-16 Daniel Hartwig <mandyke@gmail.com> http: support IP-literal (IPv6 address) in Host header * module/web/http.scm ("Host"): Parse and write IP-literals treating escapes as uri module does: remove brackets on parse, replace them on write. * test-suite/tests/web-http.test ("request headers"): Add tests. add tests for read-request-line, etc. * test-suite/web/web-http.test ("read-request-line"): ("write-request-line", "read-response-line", "write-response-line"): Add. 2013-03-16 Daniel Hartwig <mandyke@gmail.com> minor tweaks to web documentation * doc/ref/web.texi: Say `World Wide Web'; the hyphenated form is almost never used (c.f. w3.org). General predicate arguments are named `obj'. Fill in arguments omitted from some procedure definitions (e.g. `request-method'). Minor tweaks, such as using en-dash and missing markup as appropriate. Wrap very long deffn lines. * module/web/*.scm: Expand texinfo markup in doc strings. Synchronize with changes in web.texi. 2013-03-15 Andy Wingo <wingo@igalia.com> more NEWS * NEWS: Update. incremental NEWS work * NEWS: Checkpoint. fix doc build * doc/ref/api-data.texi (Bitwise Operations): Don't use @-commands in @math. Fixes doc build. * doc/ref/api-macros.texi (Syntax Rules): Fix example result. 2013-03-13 Andy Wingo <wingo@igalia.com> very beginnings of NEWS * NEWS: A very very very rough start at 2.0.8 news allow for spurious wakeups from pthread_cond_wait * libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow for spurious wakeups while waiting on cond variables. Should fix bug 10641. 2013-03-13 Andy Wingo <wingo@igalia.com> failing to load module in psyntax indicates an identifier is not macro * module/ice-9/boot-9.scm (false-if-exception): Add optional #:warning TEMPLATE ARG... tail, which indicates that we should print a warning on failure. (load-in-vicinity): Use the new #:warning. (make-autoload-interface): Surround the bits that load modules with a false-if-exception with #:warning. Fixes http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12202. * test-suite/tests/syncase.test ("missing autoloads do not foil psyntax"): Add a test. 2013-03-12 Mark H Weaver <mhw@netris.org> Reimplement 'inexact->exact' to avoid mpq functions. * libguile/numbers.c (scm_inexact_to_exact): Implement conversion of a double to an exact rational without using the mpq functions. * test-suite/tests/numbers.test (dbl-mant-dig): Simplify initializer. (dbl-epsilon, dbl-min-exp): New variables. ("inexact->exact"): Add tests. Fix broken "2.0**i to exact and back" test, and change it to "2.0**i to exact", to avoid use of 'exact->inexact'. 2013-03-12 Mark H Weaver <mhw@netris.org> Optimize logarithms using scm_i_big2dbl_2exp * libguile/numbers.c (log_of_exact_integer_with_size): Removed. (log_of_exact_integer): Handle bignums too large to fit in a double using 'scm_i_big2dbl_2exp' instead of 'scm_integer_length' and 'scm_ash'. (log_of_fraction): Use 'log_of_exact_integer' instead of 'log_of_exact_integer_with_size'. 2013-03-12 Mark H Weaver <mhw@netris.org> Simplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp * libguile/numbers.c (scm_i_big2dbl_2exp): New static function. (scm_i_big2dbl): Reimplement in terms of 'scm_i_big2dbl_2exp', with proper rounding. * test-suite/tests/numbers.test ("exact->inexact"): Add tests. 2013-03-12 Mark H Weaver <mhw@netris.org> Add 'round-ash', a rounding arithmetic shift operator * libguile/numbers.c (left_shift_exact_integer, floor_right_shift_exact_integer, round_right_shift_exact_integer): New static functions. (scm_round_ash): New procedure. (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and 'floor_right_shift_exact_integer'. * libguile/numbers.h: Add prototype for scm_round_ash. Rename the second argument of 'scm_ash' from 'cnt' to 'count'. * test-suite/tests/numbers.test (round-ash, ash): Add new unified testing framework for 'ash' and 'round-ash'. Previously, the tests for 'ash' were not very comprehensive; for example, they did not include a single test where the number to be shifted was a bignum. * doc/ref/api-data.texi (Bitwise Operations): Add documentation for 'round-ash'. Improve documentation for `ash'. 2013-03-12 Mark H Weaver <mhw@netris.org> Optimize and simplify fractions code. * libguile/numbers.c (scm_exact_integer_quotient, scm_i_make_ratio_already_reduced): New static functions. (scm_i_make_ratio): Rewrite in terms of 'scm_i_make_ratio_already_reduced'. (scm_integer_expt): Optimize fraction case. (scm_abs, scm_magnitude, scm_difference, do_divide): Use 'scm_i_make_ratio_already_reduced'. * test-suite/tests/numbers.test (expt, integer-expt): Add tests. 2013-03-11 Mike Gran <spk121@yahoo.com> Add standalone test for smob marking * test-suite/standalone/Makefile.am (TESTS, check_PROGRAMS): add test-smob-mark (test_smob_mark_SOURCES, test_smob_mark_CFLAGS, test_smob_mark_LDADD): new variables * test-suite/standalone/test-smob-mark.c: new file 2013-03-10 Jason Earl <jearl@notengoamigos.org> rely on gnulib for `poll' * configure.ac: * libguile/fports.c (fport_input_waiting): * libguile/poll.c (scm_primitive_poll): Rely on gnulib to provide poll for us. import `poll' from gnulib * lib/Makefile.am: * lib/poll.c: * lib/poll.in.h: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: * m4/poll.m4: * m4/poll_h.m4: Add poll gnulib module. 2013-03-10 Andy Wingo <wingo@pobox.com> guile.m4 allows selection of guile 2.0, 1.8, etc. * meta/guile.m4 (GUILE_PKG): New macro, chooses a version of Guile against which to compile. (GUILE_FLAGS, GUILE_PROGS): Rewrite to call GUILE_PKG as necessary, to respect any previous call to GUILE_PKG, and to not require guile-tools. 2013-03-10 Jason Earl <jearl@notengoamigos.org> add %site-ccache-dir * libguile/load.h: * libguile/load.c (scm_sys_site_ccache_dir): New procedure. * doc/ref/scheme-using.texi (Installing Site Packages): * doc/ref/api-options.texi (Build Config): Add docs. Fixes bug 10326. 2013-03-10 Jason Earl <jearl@notengoamigos.org> excise use of "iff" in the manual * doc/ref/api-compound.texi: * doc/ref/api-control.texi: * doc/ref/api-data.texi: * doc/ref/api-macros.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/api-undocumented.texi: * doc/ref/api-utility.texi: * doc/ref/compiler.texi: * doc/ref/intro.texi: * doc/ref/scheme-using.texi: * doc/ref/sxml.texi: * doc/ref/web.texi: Change uses of "iff" to "if, otherwise". Fixes bug 10302. fix AC_CHECK_DECLS for `alarm' * configure.ac: Fix decl check for `alarm'. use chmod portably in (system base compile) * module/system/base/compile.scm (call-with-output-file/atomic): Call chmod with the file name instead of the port. fix response-body-port for responses without content-length * module/web/response.scm (response-body-port): Correctly handle cases in which EOF terminates the body. 2013-03-09 Andy Wingo <wingo@pobox.com> provide getlogin declaration if needed. * configure.ac: Check for getlogin decl. * libguile/posix.c: Declare getlogin if needed. fix mingw issues with posix.c * libguile/posix.c (scm_execl, scm_execlp, scm_execle) (scm_open_process): Remove casts for ancient mingw. (scm_utime): If we fall back to utime, assert that flags is 0. (scm_getlogin): Rely on gnulib. add getlogin from gnulib * lib/Makefile.am: * lib/getlogin.c: * m4/getlogin.m4: * m4/gnulib-cache.m4: Add getlogin module. 2013-03-09 Andy Wingo <wingo@pobox.com> don't provide scm_std_select on mingw and similar platforms * libguile/iselect.h: If we do not have sys/select.h, don't provide scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR. Guile should not be setting these macros in public API. This is an incompatible change on mingw, but oh well. * libguile/threads.c: Rely on gnulib's select, and use that to implement scm_std_select. * libguile/deprecated.h: * libguile/deprecated.c: Only provide scm_internal_select if we have sys/select.h. 2013-03-09 Andy Wingo <wingo@pobox.com> simplify posix.c * libguile/posix.c: Reorder includes to fix mingw include-order problem. Remove ttyname shims; gnulib is the place to fix that. Remove winsock2 include, as gnulib seems to handle that OK. Rely on the new pipe-posix gnulib module. Don't bother shimming getlogin, etc on mingw; gnulib is the place for shims. simplify readline.c * guile-readline/readline.c: Remove all mingw special-casing, relying instead on mingw / gnulib doing the right thing. simplify stime back-compat shims for tzname * libguile/stime.c: Remove tzname declarations for ancient mingw and SGI RS6000. mingw include order for socket.c * libguile/socket.c: Reorder includes to fix include order on mingw. fix include-order problem in net_db.c for mingw * libguile/net_db.c: Reorder includes to avoid include-order problem on mingw. silence mingw32 warning in i18n.c * libguile/i18n.c (scm_make_locale): Silence a warning. fports uses gnulib's select * libguile/fports.c: Reorder includes to put system includes first; fixes windows/winsock2 include error problem. Rely on Gnulib's select module. (fport_input_waiting): Use select instead of scm_std_select. simplify filesys.c via gnulib's select and fstat modules * libguile/filesys.c: Instead of using scm_std_select, just use select, relying on gnulib to provide it to us. Likewise, rely on fstat. if we have threads on windows, we have pthreads; inform bdw-gc of that * libguile/bdw-gc.h: If we have threads enabled on mingw32, explicitly mark GC_WIN32_PTHREADS. See http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/5564 for more info. remove init.c iselect include * libguile/init.c: Remove iselect include. portability simplification with scmsigs.c and alarm * configure.ac (alarm): Check for decl. * libguile/scmsigs.c: Reorder includes to put system includes first. Fixes include order on mingw. Remove #define for alarm, as we will use HAVE_DECL_ALARM. Remove #defines for sleep and usleep, as they are not used. (scm_alarm): Only define if HAVE_DECL_ALARM. add gnulib fstat module explicitly * lib/Makefile.am: * m4/gnulib-cache.m4: Explicitly add fstat module. Import `pipe-posix' module from gnulib. * lib/Makefile.am: * lib/pipe.c: * m4/gnulib-cache.m4: * m4/gnulib-comp.m4: * m4/pipe.m4: Add pipe-posix module. 2013-03-09 Andy Wingo <wingo@pobox.com> squish remove some mingw-specific code that is covered by gnulib * libguile/socket.c (scm_init_socket): Remove mingw-specific code. * libguile/fports.c: Remove ftruncate redefine; mingw is fine. (scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat. The right place for an F_GETFL replacement would be in gnulib. (fport_input_waiting): Remove an outdated comment. * libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses with strerror and errno. * libguile/win32-socket.c: * libguile/win32-socket.h: Remove. Mingw has suitable replacements. * configure.ac: * libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (noinst_HEADERS): Update for win32-socket removal. 2013-03-09 Andy Wingo <wingo@pobox.com> remove mingw32 implementations of {get,end,set}{serv,proto}ent * libguile/win32-socket.h: * libguile/win32-socket.c (getservent, endservent, setservent) (getprotoent, endprotoent, setprotoent): Remove mingw32 wrappers. Their place is in gnulib, if anywhere. 2013-03-09 Andy Wingo <wingo@pobox.com> add check for struct pollfd * configure.ac: Add check for struct pollfd. * libguile/fports.c (fport_input_waiting): * libguile/poll.c (scm_primitive_poll): Require struct pollfd. Fixes bug 13903. 2013-03-09 Andy Wingo <wingo@pobox.com> allow case-lambda expressions with no clauses * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow 0 clauses. * module/language/scheme/decompile-tree-il.scm (do-decompile): (choose-output-names): * module/language/tree-il.scm (unparse-tree-il): (tree-il-fold, post-order!, pre-order!): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/cse.scm (cse): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/peval.scm (peval): Allow for lambda-body to be #f. * libguile/memoize.c (memoize): * module/language/tree-il/canonicalize.scm (canonicalize!): Give a body to empty case-lambda before evaluating it or compiling it, respectively. * test-suite/tests/optargs.test ("case-lambda", "case-lambda*"): Add tests. 2013-03-09 Andy Wingo <wingo@pobox.com> fix in-tree guile reference * meta/guile.in (GUILE): Add @EXEEXT@ for libguile/guile reference, for MinGW compiles. 2013-03-07 Mark H Weaver <mhw@netris.org> Improve standards conformance of string->number. Fixes <http://bugs.gnu.org/11887>. * libguile/numbers.c (mem2ureal): New argument 'allow_inf_or_nan'. Accept infinities and NaNs only if 'allow_inf_or_nan' is true and "#e" is not present. Check for "inf.0" or "nan." case-insensitively. Do not accept rationals with zero divisors. (mem2complex): Pass new 'allow_inf_or_nan' argument to 'mem2ureal', which is set if and only if a explicit sign was present. * test-suite/tests/numbers.test ("string->number"): Add tests. 2013-03-07 Stefan Israelsson Tampe <stefan.itampe@gmail.com> add GUILE_STACK_SIZE environment variable * libguile/vm.c (initialize_default_stack_size): New helper. (scm_bootstrap_vm): Call initialize_default_stack_size. * doc/ref/guile-invoke.texi (Environment Variables): Add docs. Based on a patch by Stefan Israelsson Tampe. 2013-03-07 Andy Wingo <wingo@pobox.com> support calls and tail-calls with more than 255 formals * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Support calls and tail-calls with more than 255 formals. * test-suite/tests/tree-il.test ("many args"): Add a test. 2013-03-07 Andy Wingo <wingo@pobox.com> ,option evaluates its right-hand-side * doc/ref/scheme-using.texi (System Commands): Better documentation for ,option. * module/system/repl/command.scm (option): Evaluate the RHS when setting an option. Fixes bug 13076. 2013-03-07 Andy Wingo <wingo@pobox.com> GUILE_INSTALL_LOCALE=1 during build * doc/ref/Makefile.am (autoconf-macros.texi): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.scm.gen, ice-9/psyntax-pp.go): * test-suite/Makefile.am (GUILE_AUTO_COMPILE): * test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE): * test-suite/vm/Makefile.am (TESTS_ENVIRONMENT): * am/guilec (.scm.go): Set GUILE_INSTALL_LOCALE to 1 during the build. Fixes bug 12887. 2013-03-07 Ludovic Courtès <ludo@gnu.org> Install the current locale if GUILE_INSTALL_LOCALE is nonzero. * libguile/guile.c (get_integer_from_environment) (should_install_locale): New functions. (main): Add `setlocale' call. * doc/ref/guile-invoke.texi (Environment Variables): Add documentation. 2013-03-07 Andy Wingo <wingo@pobox.com> structs with tail arrays are not simple * libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE, SCM_VTABLE_FLAG_SIMPLE_RW): * libguile/struct.c (set_vtable_layout_flags): Vtable whose layouts include a tail array are not simple. Fixes bug 12808. fix compilation under mingw * libguile/load.c (is_absolute_file_name, search_path): Fix compilation under mingw. 2013-03-07 Ludovic Courtès <ludo@gnu.org> Make `SCM_LONG_BIT' usable in preprocessor conditionals. Reported by Jan Schukat <shookie@email.de>. Partly fixes <http://bugs.gnu.org/13848>. * libguile/__scm.h (SCM_LONG_BIT)[!defined LONG_BIT]: Use SCM_SIZEOF_LONG since `sizeof' cannot be used in #if directives as found in numbers.c. 2013-03-07 Ludovic Courtès <ludo@gnu.org> Use `scm_is_eq' in load.c. * libguile/load.c (is_file_name_separator): Use `scm_is_eq' instead of `=='. doc: Allow compilation of r5rs.texi with Texinfo 5.0. * doc/r5rs/r5rs.texi: Remove extraneous @author. Change @unnumbered to @majorheading within @titlepage. 2013-03-06 Mark H Weaver <mhw@netris.org> Verify that FLT_RADIX is 2. * libguile/numbers.c: Trigger a compilation error if FLT_RADIX is not 2. This has long been assumed by code in numbers.c. Improve code in scm_gcd for inum/inum case * libguile/numbers.c (scm_gcd): Improve implementation of inum/inum case to be more clear and efficient. 2013-03-05 Mark H Weaver <mhw@netris.org> Fix thread-unsafe lazy initializations. * libguile/debug.c (scm_local_eval): libguile/ports.c (scm_current_warning_port): libguile/strports.c (scm_eval_string_in_module): Perform lazy-initialization while holding a mutex. Use SCM_UNDEFINED as the uninitialized value. Use 'scm_c_*_variable'. * doc/ref/api-modules.texi (Accessing Modules from C): Fix 'my_eval_string' example to be thread-safe. 2013-03-04 Ludovic Courtès <ludo@gnu.org> doc: Rename "Texinfo" node to "Texinfo Processing". * doc/ref/texinfo.texi (Texinfo): Rename to... (Texinfo Processing): ... this. * doc/ref/guile.texi (Guile Modules): Update menu. Use `scm_is_eq' in filesys.c. * libguile/filesys.c (is_file_name_separator): Use `scm_is_eq' instead of `=='. Fixes <http://hydra.nixos.org/build/4261579>. 2013-03-02 Bake Timmons <b3timmons@speedymail.org> Improve keyword notation of Texinfo function definitions. * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-modules.texi: * doc/ref/compiler.texi: * doc/ref/web.texi: Make Texinfo function headers more consistent. Change lesser used keyword notation to the predominant form. * doc/ref/api-procedures.texi: Fix an argument name in a header that should use repeated argument notation. * doc/ref/srfi-modules.texi: Update references in Texinfo function definition body to match previously updated variable notation in definition header. 2013-03-01 Ludovic Courtès <ludo@gnu.org> doc: Fix build with Texinfo 5.0. * doc/ref/api-control.texi (Handling Errors): Move misplaced description for `scm_memory_error' & co. * doc/ref/r6rs.texi (rnrs base): Change `deffnx' of `let-syntax' and `letrec-syntax' to fit on one line. 2013-03-01 Ludovic Courtès <ludo@gnu.org> Allow the SMOB mark procedures to be called when libgc uses parallel markers. Fixes <http://bugs.gnu.org/13611>. Reported by Mike Gran <spk121@yahoo.com>. * libguile/smob.c (current_mark_stack_pointer, current_mark_stack_limit): New variables. (smob_mark): Use CURRENT_MARK_STACK_POINTER and CURRENT_MARK_STACK_LIMIT instead of the same-named fields of `SCM_I_CURRENT_THREAD'. (scm_gc_mark): Likewise. (scm_smob_prehistory): Initialize CURRENT_MARK_STACK_LIMIT and CURRENT_MARK_STACK_POINTER. * libguile/threads.h (scm_i_thread): Add comment that `current_mark_stack_ptr' and `current_mark_stack_limit' are no longer used. 2013-03-01 Ludovic Courtès <ludo@gnu.org> Use accessors instead of symbols deprecated in libgc 7.3. * configure.ac: Check for `GC_set_all_interior_pointers', `GC_get_gc_no', and `GC_set_java_finalization'. * libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'. (scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use `GC_set_all_interior_pointers'. * libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]: Use `GC_set_java_finalization'. 2013-03-01 Daniel Hartwig <mandyke@gmail.com> test-suite: eq-ness of numbers, characters is unspecified * test-suite/tests/00-socket.test: * test-suite/tests/alist.test: * test-suite/tests/elisp.test: * test-suite/tests/encoding-iso88591.test: * test-suite/tests/encoding-iso88597.test: * test-suite/tests/encoding-utf8.test: * test-suite/tests/hash.test: * test-suite/tests/i18n.test: * test-suite/tests/modules.test: * test-suite/tests/ports.test: * test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when comparing numbers, characters. Checked also for similar uses of assq[-ref]. * test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test to use eqv-ness, not eq-ness, which should not impact its purpose as these two are equivalent for strings. 2013-03-01 Mark H Weaver <mhw@netris.org> Fix later-bindings-win logic in with-fluids. Based on a patch by David Kastrup <dak@gnu.org>. Fixes <http://bugs.gnu.org/13843>. * libguile/fluids.c (scm_i_make_with_fluids): Reverse direction of inner loop that checks for duplicates, to properly handle more than two bindings to the same fluid. 2013-02-28 Mark H Weaver <mhw@netris.org> Fix duplicate removal of with-fluids. Based on a patch by David Kastrup <dak@gnu.org>. Fixes <http://bugs.gnu.org/13838>. * libguile/fluids.c (scm_i_make_with_fluids): Remove the duplicate binding instead of the last binding. * test-suite/tests/fluids.test: Add test, and fix existing duplicate tests. * THANKS: Thanks David Kastrup. 2013-02-28 Mark H Weaver <mhw@netris.org> Support calling foreign functions of 10 arguments or more. * libguile/foreign.c (OBJCODE_HEADER, META_HEADER, META): Change these into higher-order macros. (GEN_CODE): New higher-order macro based on 'CODE'. (M_STATIC, M_DYNAMIC): New macros. (CODE): Reimplement using 'GEN_CODE' and 'M_STATIC'. (make_objcode_trampoline): New static function. (large_objcode_trampolines, large_objcode_trampolines_mutex): New static variables. (get_objcode_trampoline): New static function. (cif_to_procedure): Use 'get_objcode_trampoline'. * test-suite/standalone/test-ffi-lib.c (test_ffi_sum_many): New function. * test-suite/standalone/test-ffi: Add test. 2013-02-28 Ludovic Courtès <ludo@gnu.org> Fix handling of the *-gnux32 target. * module/system/base/target.scm (triplet-pointer-size): Fix typo in the x32 triplet name. * test-suite/tests/asm-to-bytecode.test (native-os): New procedure. (test-target): Use (native-word-size) only when both the CPU and OS match. 2013-02-28 David Kastrup <dak@gnu.org> Let reverse! accept arbitrary types as second argument (new_tail) * libguile/list.c (scm_reverse_x): remove typecheck for 2nd arg. 2013-02-27 Ludovic Courtès <ludo@gnu.org> Recognize the `x86_64.*-gnux32' triplet. * module/system/base/target.scm (triplet-pointer-size): Add case for "^x64_64-.*-gnux32". * test-suite/tests/asm-to-bytecode.test ("cross-compilation"): ["x86_64-unknown-linux-gnux32"]: New test. Check whether a triplet's OS part specifies an ABI. * module/system/base/target.scm (cpu-word-size): Rename to... (triplet-pointer-size): ... this. Update caller. Take a triplet as the argument. Check the `triplet-os' part when checking for equality with the host. Add support "mips64.*-gnuabi64". * test-suite/tests/asm-to-bytecode.test ("cross-compilation") [ "mips64el-unknown-linux-gnuabi64"]: New test. Recognize mips64* as having 32-bit pointers by default. * module/system/base/target.scm (cpu-word-size): Consider MIPS64 to default to n32 or o32. * test-suite/tests/asm-to-bytecode.test ("cross-compilation") ["mips64el-unknown-linux-gnu"]: New test. tests: Avoid missing missing-prototype warning with <fenv.h> on glibc 2.17. * test-suite/standalone/test-round.c: Avoid missing-prototype warning with <fenv.h> on glibc 2.17. Fix cross-compilation of `c-tokenize.o'. * libguile/Makefile.am (c-tokenize.$(OBJEXT)): Pass -I$(top_builddir) when cross-compiling. 2013-02-26 Mark H Weaver <mhw@netris.org> Update copyright dates on random.c * libguile/random.c: Add 2012 and 2013 to the copyright notice. 2013-02-25 Mark H Weaver <mhw@netris.org> random_state_of_last_resort: use getpid directly, instead of scm_getpid * libguile/random.c: Include <sys/types.h> and <unistd.h> (if present). (random_state_of_last_resort): Use getpid directly. Revert "random_state_of_last_resort doesn't rely on HAVE_POSIX" This reverts commit eaf21539d4afb8df5d1b549215fd397b23004947. Revert "random-state-from-platform: simplify pid conditional, and clarify docs." This reverts commit 08904661a2b1c6d461b2f5abfe3226a4023453fb. 2013-02-25 Mark H Weaver <mhw@netris.org> random-state-from-platform: simplify pid conditional, and clarify docs. * libguile/random.c (random_state_of_last_resort): Simplify optional inclusion of PID in the random state. Clarify in the comments that the PID is only included where scm_getpid is present. * doc/ref/api-data.texi (Random): Clarify that 'random-state-from-platform' includes the PID in the random state only if scm_getpid is present. 2013-02-24 Andy Wingo <wingo@pobox.com> remove language/glil/decompile-assembly.scm * module/language/glil/decompile-assembly.scm: Remove. This module never worked, and even failed to compile. * module/language/glil/spec.scm: * module/Makefile.am: Remove references to (language glil decompile-assembly). 2013-02-24 Andy Wingo <wingo@pobox.com> deprecate (ice-9 mapping) * module/ice-9/mapping.scm: Add deprecation warning. 2013-02-24 Daniel Hartwig <mandyke@gmail.com> fix and update (ice-9 mapping) * module/ice-9/mapping.scm (mapping-create-handle!): INIT is required. (mapping-ref): Rewrite. Fix problem with DFLT. (hash-table-mapping-hooks): Drop DELETE-PROC, hash-table accessors only use ASSOC-PROC. Add INIT to create-handle hook. Use correct hash-table accessors. (make-hash-table-mapping): Drop DELETE-PROC. (hash-table-mapping): Rewrite. Drop DELETE-PROC. 2013-02-24 Andy Wingo <wingo@pobox.com> cleanup to filesys.c's handling of file name separators * libguile/filesys.c (is_file_name_separator): New helper, as in load.c. (scm_dirname, scm_basename, scm_i_relativize_path): Use is_file_name_separator. simplify scm_stat on mingw * libguile/filesys.c (scm_stat): Don't munge the filename on MinGW; gnulib does that for us. load.c uses same logic as boot-9 for file names * libguile/load.c (is_file_name_separator, is_drive_letter): (is_absolute_file_name): New helpers, like the ones in boot-9. Perhaps we should just define them in C. (search_path, scm_try_auto_compile, canonical_suffix): Rewrite using the new helpers. allow '/' in the prefix of UNC file names on windows * module/ice-9/boot-9.scm (absolute-file-name?) [WINDOWS]: Allow '/' as well as '\' when detecting UNC names. (load-in-vicinity): Add a comment about the purpose of canonical->suffix. random_state_of_last_resort doesn't rely on HAVE_POSIX * libguile/random.c (random_state_of_last_resort): Add the PID as a seed only if we have scm_getpid(). 2013-02-21 Mike Gran <spk121@yahoo.com> Update predefined character sets to Unicode 6.2 * libguile/srfi-14.i.c (cs_graphic_ranges, cs_printing_ranges, cs_symbol_ranges) (cs_designated_ranges): modified 2013-02-20 Andy Wingo <wingo@pobox.com> net_db.c doesn't import winsock2.h * libguile/net_db.c: Don't include winsock2.h; gnulib handles this for us as necessary. mkstemp uses O_BINARY * libguile/mkstemp.c (mkstemp): Add O_BINARY. Since temp files are empty at the beginning, we're not changing the behavior for reading files. For writing files `newline' and ~% can add \r elements as needed. So this is a reasonable thing to do, and it prevents mangling of temp files for the compiler. fix compilation of functions with more than 255 local variables. * module/language/glil/compile-assembly.scm (glil->assembly): Fix case where there are more than 255 local variables. Whoops! 2013-02-19 Andy Wingo <wingo@pobox.com> fix an error message loading invalid bytecode * libguile/objcodes.c (make_objcode_from_file): Add correct error message if full_read failed without an errno. copy-file and load-objcode use O_BINARY * libguile/filesys.c (scm_copy_file): * libguile/objcodes.c (scm_load_objcode): Use O_BINARY. Thanks to Eli Zaretskii for the patch. 2013-02-19 Eli Zaretskii <eliz@gnu.org> Fix startup of guile.exe on MS-Windows. * module/system/base/compile.scm (call-with-output-file/atomic): Call close-port before deleting the temporary file name, otherwise deletion fails on MS-Windows (cannot delete a file that is still open). 2013-02-19 Andy Wingo <wingo@pobox.com> add link to doc about UNC names * module/ice-9/boot-9.scm (compile-time-case): Add link to docs about UNC names. 2013-02-19 Andy Wingo <wingo@pobox.com> better handling of windows file name conventions * libguile/filesys.c (scm_system_file_name_convention): New function. Exported to Scheme only. * module/ice-9/boot-9.scm (file-name-separator?, absolute-file-name?): New predicates. (file-name-separator-string): New global variable. (in-vicinity): Use the new procedures. (load-user-init, try-module-autoload): Use file-name-separator-string. (load-in-vicinity): Update canonical->suffix. Consistently use the term "file name" throughout. * module/ice-9/psyntax.scm (include): Use global `absolute-file-name?'. * module/ice-9/psyntax-pp.scm: Regenerate. 2013-02-19 Mark H Weaver <mhw@netris.org> Remove flawed test that assumed (eq? 1/2 2/4) would return false. * test-suite/tests/hash.test ("hash-count"): Remove flawed test. 2013-02-18 Ludovic Courtès <ludo@gnu.org> build: Fix compilation of `c-tokenize.c' with latest Gnulib. * libguile/c-tokenize.lex: Include <config.h>, to pull in Gnulib macro definitions now required. 2013-02-18 Andy Wingo <wingo@pobox.com> add gnulib `times' module * lib: Add `times' module. Should fix socket.c on MinGW. Thanks to Eli Zaretskii for the report. Add gnulib `select' module. Should fix fport_input_waiting when neither poll nor select nor FIONREAD are available, which is the case on MinGW. Thanks to Eli Zaretskii for the report. Update to gnulib 0.0.7865-a828. 2013-02-18 Daniel Llorens <daniel.llorens@bluewin.ch> Array documentation fixes * libguile/generalized-arrays.c: Fix wording of docstring for array-length. * doc/ref/api-compund.texi: - Document scm_array_type(), scm_array_ref(), array-length, scm_array_length(), scm_c_array_length(). - Fix wording of documentation for array-in-bounds? 2013-02-18 Andy Wingo <wingo@pobox.com> deprecate generalized vectors in favor of arrays * libguile/generalized-arrays.h: * libguile/generalized-arrays.c (scm_c_array_length): (scm_array_length): New functions. * module/ice-9/deprecated.scm: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_generalized_vector_p) (scm_generalized_vector_length, scm_generalized_vector_ref) (scm_generalized_vector_set_x, scm_generalized_vector_to_list): Deprecate. * libguile/uniform.c (scm_uniform_vector_to_list): Use scm_array_to_list. * module/ice-9/boot-9.scm (case): Arrays are generalized vectors. * module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array functions instead of the generalized-vector functions. * test-suite/tests/arrays.test: Remove generalized-vector->list test; covered by array->list test. * test-suite/tests/bitvectors.test: * test-suite/tests/bytevectors.test: * test-suite/tests/srfi-4.test: Adapt to test using array interfaces instead of generalized-vector interfaces. * doc/ref/api-compound.texi: Remove generalized vector docs. * doc/ref/api-data.texi: * doc/ref/srfi-modules.texi: Adapt. 2013-02-18 Andy Wingo <wingo@pobox.com> optimize access to arrays of rank 1 or 2 * libguile/array-handle.c (scm_array_handle_pos_1): (scm_array_handle_pos_2): New functions. * libguile/generalized-arrays.c (scm_c_array_ref_1, scm_c_array_ref_2): (scm_c_array_set_1_x, scm_c_array_set_2_x): New functions. (scm_i_array_ref, scm_i_array_set_x): New subr bindings for array-ref and array-set! that avoid consing for arrays of rank 1 or 2. * test-suite/tests/arrays.test ("array-set!"): Fix expected exception for wrong number of indices. 2013-02-18 Andy Wingo <wingo@pobox.com> array handle inline functions defined in array-handle.h. * libguile/inline.h: * libguile/array-handle.h (scm_array_handle_ref): (scm_array_handle_set): Move definitions here from inline.h. * libguile/inline.c: Include array-handle.h. 2013-02-18 Daniel Hartwig <mandyke@gmail.com> add hash-count for native tables * libguile/hashtab.c (scm_hash_count): New function. Count the number of elements in a hash table. * doc/ref/api-compound.texi (Hash Tables): Update examples and reference. * test-suite/tests/hash.test (hash-count): New test. 2013-02-16 Ludovic Courtès <ludo@gnu.org> Fix `getgroups' for when zero supplementary group IDs exist. * libguile/posix.c (scm_getgroups): Return the empty vector when NGROUPS is zero. Reported by Mike Gran <spk121@yahoo.com>. 2013-02-15 Andy Wingo <wingo@pobox.com> local rewrite for apply to a let-bound rest list * module/language/tree-il/peval.scm (peval): Add a special-case inlining pattern for apply to a let-bound rest arg that preserves effect ordering. * test-suite/tests/peval.test ("partial evaluation"): Add a test, and update an older test with a better result. 2013-02-15 Andy Wingo <wingo@pobox.com> inline call-with-values consumers with optional and/or rest args * module/language/tree-il/peval.scm (peval): Inline call-with-values whose consumers have optional and rest arguments. * test-suite/tests/peval.test ("partial evaluation"): Add test. 2013-02-15 Andy Wingo <wingo@pobox.com> more rest argument inlining improvements * module/language/tree-il/peval.scm (peval): Correct comment on find-definition, and allow a find-definition to fall back on a source expression. Avoid copying non-constant expressions. * test-suite/tests/peval.test ("partial evaluation"): Add a test that inlining rest arguments works with complicated argument expressions, and a test that order of effects in rest args is preserved. 2013-02-15 Andy Wingo <wingo@pobox.com> better inlining of `apply' with rest arguments * module/language/tree-il/peval.scm (peval): Move up the find-definition helper. Use it to speculatively destructure conses and lists into the tail position of an `apply' form. * test-suite/tests/peval.test ("partial evaluation"): Add tests. 2013-02-15 Andy Wingo <wingo@pobox.com> procedures with rest arguments can get inlined * module/language/tree-il/peval.scm (peval): Allow inlining of procedures with rest arguments. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2013-02-14 Andy Wingo <wingo@pobox.com> peval can inline let-bound lambdas * module/language/tree-il/peval.scm (peval): Better inlining of complicated operators. * test-suite/tests/peval.test ("partial evaluation"): Add a couple tests. 2013-02-14 Daniel Hartwig <mandyke@gmail.com> update old references in FFI doc * doc/ref/api-foreign.texi (Foreign Types): Replace references to the old foreign->bytevector and bytevector->foreign with the new procedure names using pointer. 2013-02-12 Andy Wingo <wingo@pobox.com> allow (define-macro name (lambda ...)) * module/ice-9/boot-9.scm (define-macro): Allow define-macro NAME LAMBDA. A bugfix. Thanks to Akop Pogosian. 2013-02-09 Andy Wingo <wingo@pobox.com> (texinfo): add a command-spec for @math{}. * module/texinfo.scm (texi-command-specs): Add `math' as inline-text. (texinfo docbook): informaltable is a block element. * module/texinfo/docbook.scm (*sdocbook-block-commands*): informaltable is a block element. (texinfo plain-text): Pass @math{} through as-is. * module/texinfo/plain-text.scm (tag-handlers): Pass `math' through as-is. (texinfo serialize): don't break words when wrapping * module/texinfo/serialize.scm (wrap): Don't break long words by default; that could break @-commands. 2013-02-02 Mark H Weaver <mhw@netris.org> Add copyright notice to gen-scmconfig.c. * libguile/gen-scmconfig.c: Add copyright notice. 2013-02-02 Mark H Weaver <mhw@netris.org> Add foreign types: ssize_t and ptrdiff_t. * libguile/foreign.c (sym_ssize_t, sym_ptrdiff_t): New symbols. (scm_init_foreign): Add bindings for ssize_t and ptrdiff_t. * module/system/foreign.scm: Export ssize_t and ptrdiff_t. * doc/ref/api-foreign.texi (Foreign Types): Add docs. 2013-02-02 Mark H Weaver <mhw@netris.org> Add scm_from_ptrdiff_t and scm_to_ptrdiff_t. * libguile/numbers.h (scm_from_ptrdiff_t, scm_to_ptrdiff_t): New macros (function aliases). * doc/ref/api-data.texi: Add docs. 2013-02-02 Mark H Weaver <mhw@netris.org> Fix typo in comment generated by gen-scmconfig.c. * libguile/gen-scmconfig.c (main): Fix typo in generated comment. 2013-02-01 Ludovic Courtès <ludo@gnu.org> guild: Gracefully handle failures to install the locale. * meta/guild.in (main): Catch `system-error' when calling `setlocale', and gracefully handle any error. Skip FFI tests that rely on `-export-dynamic' behavior when not available. * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Skip when `scm_is_pair' cannot be found, as is the case on Cygwin. Reported by "objc" <objcjohn@hotmail.com>. 2013-01-31 Mark H Weaver <mhw@netris.org> Do not defer expansion of internal define-syntax forms. * module/ice-9/psyntax.scm (expand-body): As required by R6RS, evaluate the right-hand-sides of internal 'define-syntax' forms and add their transformers to the compile-time environment immediately, so that the newly-defined keywords may be used in definition context within the same lexical contour. Fixes #13509. Bump copyright year to 2013 in REPL greeting. * module/system/repl/common.scm: Add not only 2013, but also 2012 to the copyright notice at the top of the file, since the file was changed in 2012. (*version*): Bump copyright year to 2013 in REPL greeting. 2013-01-30 Andy Wingo <wingo@pobox.com> Revert "detect and consume byte-order marks for textual ports" This reverts commit b2cb557d75e4daf8c7c8cd43313f4cc51d9a3f1b, which was pushed accidentally. 2013-01-30 Andy Wingo <wingo@pobox.com> add #:doctype-handler to xml->sxml * module/sxml/simple.scm (read-internal-doctype-as-string): New helper. (xml->sxml): Add #:doctype-handler argument. * doc/ref/sxml.texi (Reading and Writing XML): Document #:doctype-handler. Fix some other examples, and fix the default value of #:declare-namespaces?. * test-suite/tests/sxml.simple.test: Add all tests from the manual here. 2013-01-30 Andy Wingo <wingo@pobox.com> quick fix to ssax.scm * module/sxml/ssax.scm: Fix previous commit. fix ssax:warn to work as intended * module/sxml/ssax.scm (ssax:warn): Fix to make more sense. 2013-01-30 Andy Wingo <wingo@pobox.com> detect and consume byte-order marks for textual ports * libguile/ports.h: * libguile/ports.c (scm_consume_byte_order_mark): New procedure. * libguile/fports.c (scm_open_file): Call consume-byte-order-mark if we are opening a file in "r" mode. * libguile/read.c (scm_i_scan_for_encoding): Don't do anything about byte-order marks. * libguile/load.c (scm_primitive_load): Add a note about the duplicate encoding scan. * test-suite/tests/filesys.test: Add tests for UTF-8, UTF-16BE, and UTF-16LE BOM handling. 2013-01-30 Andy Wingo <wingo@pobox.com> require automake 1.12 for `serial-tests'. * configure.ac: Require automake 1.12 for `serial-tests'. 2013-01-28 Ludovic Courtès <ludo@gnu.org> build: Allow use of Automake 1.13. Fixes <http://bugs.gnu.org/13558>. Reported by DNS <dns@rbose.org>. * configure.ac: Use the `serial-tests' Automake option to cope with Automake 1.13, which uses `parallel-tests' by default. 2013-01-28 Ludovic Courtès <ludo@gnu.org> Remove unneeded SMOB mark procedure in `memoize.c'. * libguile/memoize.c (scm_init_memoize): Remove unnecessary call to `scm_set_smob_mark'. 2013-01-28 Ian Price <ianprice90@googlemail.com> Fix argument count for various format string escape sequences. * module/language/tree-il/analyze.scm (format-string-argument-count): Handle ~t and ~k options case-insensitively. ~! ~| ~/ ~q and ~Q should not update the min-count or max-count. ~^ returns the min-count and 'any + - # and ' should not increase the argument count. * test-suite/tests/tree-il.test (*): Tests for new parameters. 2013-01-28 Andy Wingo <wingo@pobox.com> xml->sxml argument can be a port or a string * module/sxml/simple.scm (xml->sxml): Allow the optional arg to be a port or a string. * doc/ref/sxml.texi (Reading and Writing XML): Update docs. 2013-01-28 Andy Wingo <wingo@pobox.com> make (sxml simple)'s xml->sxml more capable * module/sxml/simple.scm (xml->sxml): Add #:namespaces, #:declare-namespaces?, #:entities, #:default-entity-handler, and #:trim-whitespace? arguments. * doc/ref/sxml.texi (Reading and Writing XML): Document the new options. 2013-01-28 Andy Wingo <wingo@pobox.com> ssax: treat *DEFAULT* as a fallback handler in entity alist * module/sxml/upstream/SSAX.scm (ssax:handle-parsed-entity): Interpret *DEFAULT* as being a default handler procedure for parsed entities. Includes test. 2013-01-28 Andy Wingo <wingo@pobox.com> begin rewriting SXML docs * doc/ref/sxml.texi (SXML): Reorder and begin rewriting. Fix formatting throughout, provide a new introduction, and the beginning of proper SSAX documentation. * doc/ref/sxml-match.texi: * doc/ref/texinfo.texi: * doc/ref/web.texi: Update references to new node names. 2013-01-27 Andy Wingo <wingo@pobox.com> current-ssax-error-port is a parameter * module/sxml/ssax.scm (current-ssax-error-port): Change to be a parameter. 2013-01-27 Mark H Weaver <mhw@netris.org> Fix source annotation bug in psyntax 'expand-body'. * module/ice-9/psyntax.scm (expand-body): Apply source-annotation to an expression, not to the expression's compile-time environment. * module/ice-9/psyntax-pp.scm: Regenerate. 2013-01-27 Mark H Weaver <mhw@netris.org> Add 'for-humans?' flag to <language> specifications. * module/system/base/language.scm (<language>): Add 'for-humans?' field, and export new 'language-for-humans?' predicate. * doc/ref/compiler.texi (Compiler Tower): Document. * module/language/assembly/spec.scm, module/language/bytecode/spec.scm, module/language/glil/spec.scm, module/language/objcode/spec.scm, module/language/tree-il/spec.scm, module/language/value/spec.scm: Mark these languages as 'for-humans?'. 2013-01-26 Ludovic Courtès <ludo@gnu.org> Add tests for `--language'. * test-suite/standalone/Makefile.am (top_srcdir): Add `top_srcdir'. (check_SCRIPTS, TESTS): Add `test-language'. (EXTRA_DIST): Add `test-language.el' and `test-language.js'. * test-suite/standalone/test-language, test-suite/standalone/test-language.el, test-suite/standalone/test-language.js: New files. ecmascript: Fix conversion to boolean for non-numbers. * module/language/ecmascript/base.scm (->boolean): Call `zero?' and `nan?' only when X is a number. * test-suite/tests/ecmascript.test ("compiler"): Add test case. Clarify the copyright status of GOOPS. * module/oop/goops.scm, module/oop/goops/active-slot.scm, module/oop/goops/composite-slot.scm, module/oop/goops/describe.scm: Add a copyright line for Érick Gallesio. Mention the STk version GOOPS was derived from. Remove mentions of the ‘COPYRIGHTS’ file. Thanks to Karl Berry <karl@freefriends.org> for pointing it out, and to Michael Djurfeldt <mikael@djurfeldt.com>. 2013-01-23 Mark H Weaver <mhw@netris.org> Regenerate psyntax-pp.scm. * module/ice-9/psyntax-pp.scm: Regenerate. This should have been done in commit 84f5a8251710c7d2a01590aa083d9dd409a56279 (`include' relative paths relative to including file). 2013-01-23 Andy Wingo <wingo@pobox.com> oop goops save: fix compile-time availability of write-component * module/oop/goops/save.scm (write-component) (write-component-procedure): Move definitions up so that syntax definition is available when compiling the rest of the file. fix regression in -l * module/ice-9/command-line.scm (compile-shell-switches): Fix regression with -l argument, which was loading arg0 instead. load files from the command line relative to the cwd * module/ice-9/command-line.scm (load/lang): Load files from the command line relative to the current working directory (fixes regression). add --language argument * module/ice-9/command-line.scm (*usage*): Make usage of capitalization and sentences consistent (lower-case and semicolons, as in ls --help). Be less specific about languages (Scheme is the default but not the only language). Document --language. (load/lang, eval-string/lang): New helpers. (compile-shell-switches): Parse a --language argument, and use it to set (current-language). fix dynamic-call doc * doc/ref/api-foreign.texi (Foreign Functions): Fix doc: interrupts are not deferred in a dynamic-call. 2013-01-22 Andy Wingo <wingo@pobox.com> paameterize in read-and-compile * module/system/base/compile.scm (read-and-compile): Use current-language parameter. docstring in rdelim * module/ice-9/rdelim.scm: Update docstring. 2013-01-22 Andy Wingo <wingo@pobox.com> current-language is a parameter in boot-9 * module/ice-9/boot-9.scm (current-language): New parameter. * module/system/base/language.scm (*current-language*): Pull fluid from parameter. (current-language): Now a re-exported parameter. * doc/ref/compiler.texi: Update reference from *current-language* fluid to current-language parameter. * module/system/base/compile.scm (compile-and-load): * module/ice-9/top-repl.scm (top-repl): Default to the current language, not to Scheme. * module/ice-9/eval-string.scm: * module/system/base/language.scm: * module/system/repl/command.scm: * module/system/repl/repl.scm: Update to use current-language parameter and parameterize. 2013-01-22 Andy Wingo <wingo@pobox.com> add fluid->parameter * module/ice-9/boot-9.scm (make-parameter): Add a docstring. (fluid->parameter): New interface. Use it when turning port fluids into parameters. * doc/ref/api-scheduling.texi (Parameters): Deffn instead of defun for make-parameter documentation. Add docs for fluid->parameter. 2013-01-22 Andy Wingo <wingo@pobox.com> add read-string and read-string! to (ice-9 rdelim) * module/ice-9/rdelim.scm (read-string!, read-string): New functions. * test-suite/tests/rdelim.test: Add tests. * doc/ref/api-io.texi: Add docs. * module/ice-9/iconv.scm: * module/rnrs/io/ports.scm: * module/web/uri.scm: Use the new functions. 2013-01-22 Andy Wingo <wingo@pobox.com> `include' relative paths relative to including file * module/ice-9/psyntax.scm (include): Like `load', interpret relative paths as being relative to the file that does the `include'. * doc/ref/api-evaluation.texi: Update docs. 2013-01-22 Andy Wingo <wingo@pobox.com> libguile examples use scm_c_vector functions instead of SCM_SIMPLE_VECTOR_* * doc/ref/libguile-concepts.texi (Multi-Threading): Use functions in the example instead of macros. Performance is really not a concern with this interface, especially now that scm_car and scm_cdr are inline functions. 2013-01-22 Andy Wingo <wingo@pobox.com> documentation recommends scm_new_smob instead of SCM_NEWSMOB * doc/ref/api-smobs.texi (Smobs): Document scm_new_smob and scm_new_double_smob instead of the SCM_NEWSMOB / SCM_RETURN_NEWSMOB family of macros. * doc/ref/libguile-smobs.texi (Creating Smob Instances): Use scm_new_smob. 2013-01-22 Andy Wingo <wingo@pobox.com> fix compilation of glil to assembly * libguile/vm-i-scheme.c (VM_VALIDATE_STRUCT): Fix the error message if the value was not a struct. * module/system/base/compile.scm (find-language-joint): Default to joining at the target language. (default-language-joiner): Allow sequences of one compiled expression to pass through. Otherwise error as before. (read-and-parse): New helper; actually parses. (read-and-compile): Use read-and-parse, and fall back to default-language-joiner. Thanks to Nala Ginrut for the report. 2013-01-21 Andy Wingo <wingo@pobox.com> Fix http-get* deprecation note * module/web/client.scm (http-get*): Fix deprecation warning. Thanks to Daniel Hartwig for the report. add dynl.x dep on libpath.h * libguile/Makefile.am (dynl.x): Add dep on libpath.h. Thanks to Bogdan Marinescu for the report. read-and-compile closes input file after seeing EOF * module/system/base/compile.scm (read-and-compile): Close the input port after we read all of its data. Perhaps this cleans up some NFS ghosts that David Pirotte was seeing. 2013-01-21 Andy Wingo <wingo@pobox.com> fix try-module-autoload, which did not detect failure to find the file * libguile/load.c (scm_primitive_load_path): If the second argument is a procedure, call it like a thunk. * doc/ref/api-evaluation.texi (Load Paths): Update docs. * module/ice-9/boot-9.scm (resolve-interface): Use `unless'. (try-module-autoload): Use the new primitive-load-path to detect failure to find an appropriate file. Fixes a bug reported by Diogo F. S. Ramos. Thanks to Noah Lavine for tracking it down. 2013-01-20 Andy Wingo <wingo@pobox.com> Fix attempt to get handle of weak table in (oop goops save) * module/oop/goops/save.scm (readable?): Fix. Thanks to Andrew Gaylard for the report. 2013-01-17 Andy Wingo <wingo@pobox.com> warn on multithreaded fork * libguile/posix.c (scm_fork): Issue a warning on a multithreaded fork. * doc/ref/posix.texi (Processes): Add note about multithreaded fork. * test-suite/tests/00-socket.test: Moved here, from socket.test, so as to run before any threads are created. * test-suite/Makefile.am: Adapt. 2013-01-16 Andy Wingo <wingo@pobox.com> trace: limit length of "| | | "... prefix * module/system/vm/trace.scm (build-prefix): New helper. (print-application, print-return): Use the helper. (trace-calls-to-procedure, trace-calls-in-procedure): (trace-instructions-in-procedure, call-with-trace): Add #:max-indent argument, defaulting to the terminal width less 40 characters. * doc/ref/scheme-using.texi: Update `trace' docs. Based on a patch by Nala Ginrut. 2013-01-16 Andy Wingo <wingo@pobox.com> peval-introduced gensyms infix " " * module/language/tree-il/peval.scm (peval): Gensyms use whitespace as an infix, not a dash. Helps gensym?-like procedures like those in the unused lexical analysis. an end to the generated-documentation experiment * doc/ref/statprof.texi: * doc/ref/sxml.texi: * doc/ref/texinfo.texi: New files, containing the documentation that was previously generated from source and rendered into standard-library.texi. The documentation is still horrible, but at least now it is user-editable. 2013-01-15 Greg Benison <gbenison@gmail.com> doc/ref/hierarchy.png: conform to hierarchy.txt and manual hierarchy.png (and .pdf, .eps) were changed to add one node to the graph, getting them in sync with hierarchy.txt (and the GOOPS section of the manual). Also added hierarchy.dot, a file to generate said figure using graphviz. 2013-01-15 Andy Wingo <wingo@pobox.com> fix string->bytevector for utf-8 and non-error conversion strategies * module/ice-9/iconv.scm (call-with-encoded-output-string): (string->bytevector, bytevector->string): Only call string->utf8 and utf8->string if the conversion strategy is `error'. 2013-01-14 Andy Wingo <wingo@pobox.com> case-lambda* clauses fail to match if too many positionals * doc/ref/api-procedures.texi (Case-lambda): Expand case-lambda* documentation. * module/ice-9/eval.scm (primitive-eval): * libguile/eval.c (prepare_boot_closure_env_for_apply): Dispatch to the next case-lambda clause if there are too many positionals. * doc/ref/vm.texi (Function Prologue Instructions): * libguile/vm-i-system.c (bind-optionals/shuffle-or-br): New instruction, like bind-optionals/shuffle but can dispatch to the next clause if there are too many positionals. * module/language/assembly/disassemble.scm (code-annotation): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/compile-bytecode.scm (compile-bytecode): Add case for bind-optionals/shuffle-or-br. * module/language/glil/compile-assembly.scm (glil->assembly): If there is an alternate, use bind-optionals/shuffle-or-br instead of bind-optionals/shuffle. * test-suite/tests/optargs.test ("case-lambda*"): Add tests. 2013-01-11 Andy Wingo <wingo@pobox.com> Docstrings in (ice-9 iconv) * module/ice-9/iconv.scm: Add docstrings. 2013-01-11 Andy Wingo <wingo@pobox.com> Change iconv procedures to take optional instead of keyword arg * module/ice-9/iconv.scm (call-with-encoded-output-string): (string->bytevector, bytevector->string): Take an optional instead of a keyword argument. * doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to change, and fix a number of errors. Thanks to Ludovic Courtès for the pointers. * test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for the 'substitute path. 2013-01-11 Andy Wingo <wingo@pobox.com> Add http-post, http-put, et cetera * module/web/client.scm (ensure-uri): New helper. (open-socket-for-uri): Accept a URI as a string or as a URI object. (extend-request, sanitize-request): New helpers, like the corresponding functions in (web server). (decode-response-body): Add a reference to the HTTP/1.1 spec, and use (ice-9 iconv). (request): New helper, factoring all aspects of sending an HTTP request and getting a response. (http-get): Redefine in terms of http-get. Deprecate the #:extra-headers argument in favor of #:headers. Allow a body. Add a #:streaming? argument, subsuming the functionality of http-get*. (http-get*): Deprecate. (http-head, http-post, http-put, http-delete, http-trace) (http-options): Define interfaces for all HTTP verbs. * test-suite/tests/web-client.test: Add tests. * doc/ref/web.texi: Update documentation. Thanks to Gregory Benison for the initial patch. 2013-01-11 Andy Wingo <wingo@pobox.com> read-response-body always returns bytevector or #f * module/web/response.scm (read-response-body): Fix to always return either a bytevector or #f. Previously, reading a 0-length body could return the EOF object. remove (web http) TODO list * module/web/http.scm: Remove outdated TODO list. (web server) uses (ice-9 iconv) * module/web/server.scm (sanitize-response): Use the procedures from (ice-9 iconv) to encode the response. 2013-01-11 Andy Wingo <wingo@pobox.com> add bytevector->string and string->bytevector in new (ice-9 iconv) module * module/Makefile.am: * module/ice-9/iconv.scm: New module implementing procedures to encode and decode representations of strings as bytes. * test-suite/Makefile.am: * test-suite/tests/iconv.test: Add tests. * doc/ref/api-data.texi: Add docs. 2013-01-10 Andy Wingo <wingo@pobox.com> fix ice-9/slib * module/ice-9/slib.scm: Change to just load up slib.init directly. The recently submitted patch to slib-discuss and guile-user should make this work correctly. 2013-01-10 Andy Wingo <wingo@pobox.com> deprecate SCM_CHAR_CODE_LIMIT and char-code-limit * libguile/__scm.h: * libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here from __scm.h. * libguile/feature.c: * module/ice-9/deprecated.scm (char-code-limit): Move definition here. * test-suite/tests/regexp.test: Update to not use char-code-limit. 2013-01-08 Andy Wingo <wingo@pobox.com> slight open-pipe* / open-process refactor * libguile/posix.c (scm_open_process): Return the ports as values instead of calling out to Scheme again to make-rw-port. This function is private to (ice-9 popen). * module/ice-9/popen.scm (open-pipe*): Adapt to change. 2013-01-07 Andy Wingo <wingo@pobox.com> http-get: don't shutdown write end of socket * module/web/http.scm ("Connection"): Write the "close" token in lower-case. * module/web/client.scm (http-get): Don't shutdown the writing side of the pipe if we are not doing a keepalive, as this may prevent the request from being sent at all. Prevented http://friendfeed.com/ from being correctly fetched. 2013-01-07 Andy Wingo <wingo@pobox.com> Fix partial commit of documentation update * doc/ref/api-procedures.texi (Compiled Procedures): Fix partially-committed doc update. 2013-01-07 Andy Wingo <wingo@pobox.com> More procedure-arguments-alist documentation and a bugfix * doc/ref/api-procedures.texi (Compiled Procedures): Expand program-arguments-alist and program-lambda-list documentation. * module/system/vm/program.scm (arity->arguments-alist): Fix the rest arg if there are also keyword args, a bug found while documenting! * test-suite/tests/session.test ("procedure-arguments"): Update. 2013-01-07 Cedric Cellier <cedric.cellier@securactive.net> document program-arguments-alist and program-lambda-list 2013-01-07 Andy Wingo <wingo@pobox.com> minor cleanup in values.c * libguile/values.c (scm_c_value_ref): Use scm_from_size_t to assimilate a size_t. 2012-12-19 Ludovic Courtès <ludo@gnu.org> tests: Remove leftover `pk'. * test-suite/tests/posix.test ("system*"): Remove `pk'. 2012-12-19 Ludovic Courtès <ludo@gnu.org> Change `system*' to not leave dangling processes behind. Fixes <http://bugs.gnu.org/13166>. * libguile/simpos.c (scm_system_star): In the child, call `_exit' instead of `SCM_SYSERROR' when `execvp' fails. * test-suite/tests/posix.test ("system*"): New test prefix. 2012-12-17 Ludovic Courtès <ludo@gnu.org> web: Correctly detect "No route to host" conditions. * module/web/client.scm (open-socket-for-uri): Delete addrinfos with the same address. Always open SOCK_STREAM/IPPROTO_IP sockets. Fix the error handler's condition to determine what to do. Reported by Nikita Karetnikov <nikita.karetnikov@gmail.com> at <http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00150.html>. 2012-12-10 Ludovic Courtès <ludo@gnu.org> build: Require Automake 1.11.2 or later. * configure.ac: Require Automake 1.11.2 or later. Reported by Sjoerd van Leent Privé <svanleent@gmail.com> in <http://bugs.gnu.org/13117>. 2012-12-10 Daniel Hartwig <mandyke@gmail.com> repl: add repl-option for customized print Closes <http://bugs.gnu.org/13077>. * module/system/repl/common.scm (repl-default-options) (repl-print): Add option to use customized print procedure. * doc/ref/scheme-using.texi (REPL Commands): Update. 2012-12-10 Ludovic Courtès <ludo@gnu.org> test-suite: Skip `EACCES' test of `file-system-fold' when run as root. * test-suite/tests/ftw.test ("file-system-fold")["EACCES"]: Use `pass-if-equal'. Throw `unresolved' when run as root. Reported by Andreas Enge <andreas@enge.fr> at <http://lists.gnu.org/archive/html/bug-guix/2012-12/msg00073.html>. Verify the value of `SHUT_RD' and related constants. * libguile/socket.c: Add `verify' clauses for the values of `SHUT_RD', `SHUT_WR', and `SHUT_RDWR'. doc: Update `release.org'. * doc/release.org (Use porter boxes): Mention Snakebite. 2012-12-07 Mark H Weaver <mhw@netris.org> Thanks Jozef Chraplewski. * THANKS: Jozef Chraplewski. 2012-12-07 Mark H Weaver <mhw@netris.org> Avoid signed integer overflow in scm_product * libguile/numbers.c (scm_product): Avoid signed integer overflow, which modern C compilers are allowed to assume will never happen, thus allowing them to optimize out our overflow checks. * test-suite/tests/numbers.test (*): Add tests. 2012-11-30 Daniel Hartwig <mandyke@gmail.com> doc: remove more references to hash-tables-as-vectors * doc/ref/api-compound.texi (Hash Tables): Update. 2012-11-30 Ludovic Courtès <ludo@gnu.org> doc: Update `release.org'. * doc/release.org: Fix typos, and update. NEWS: Add "R6RS SRFI support" text. * NEWS: Add proper text for "R6RS SRFI support", by Ian Price and Mark Weaver. Bump version number for 2.0.7. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C function `scm_make_vtable_vtable'. (LIBGUILE_INTERFACE_AGE): Increment. 2012-11-29 Mark H Weaver <mhw@netris.org> NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling. * NEWS: Add entry for new GUILE_LOAD_PATH (et al) ellipsis handling. NEWS: Mention par-for-each, alongside par-map, being fixed to use all cores * NEWS: Mention par-for-each, alongside par-map, being fixed to use all cores. Minor fixes in NEWS * NEWS: Minor fixes to the descriptions. 2012-11-29 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. * NEWS: Add news for 2.0.7. futures: Remove circular dependency with (ice-9 threads). * module/ice-9/futures.scm: Remove now-useless import of (ice-9 threads) introduced in commit be05b336. doc: Document nested futures. * doc/ref/api-scheduling.texi (Futures): Mention nested futures. Explain what happens upon `touch'. 2012-11-29 Ludovic Courtès <ludo@gnu.org> doc: Remove example use of vectors as hash tables. Fixes <http://bugs.gnu.org/13022>. Reported by Daniel Hartwig <mandyke@gmail.com>. * doc/ref/api-compound.texi (Hash Table Examples): Remove example use of vectors as hash tables. 2012-11-29 Mark H Weaver <mhw@netris.org> Add parse-path-with-ellipsis, and use it for GUILE_LOAD_PATH et al. * libguile/load.c (scm_ellipsis): New Variable. (scm_parse_path_with_ellipsis): New procedure. (scm_init_load): Initialize 'scm_ellipsis'. (scm_init_load_path): Use 'scm_parse_path_with_ellipsis' to handle GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH. * libguile/load.h (scm_parse_path_with_ellipsis): Add prototype. * doc/ref/guile-invoke.texi (Environment Variables): doc/ref/api-evaluation.texi (Load Paths): Add documentation. Correct description of default load path to reflect reality. Remove 'GUILE_LOAD_PATH' from the concept index; it is already in the variable index. Add cross references between these two sections of the manual. 2012-11-28 Ludovic Courtès <ludo@gnu.org> Remove definition of the `SHARED_LIBRARY_PATH_VARIABLE' C macro. This is a follow-up to fc32c44. * configure.ac: Remove definition of `SHARED_LIBRARY_PATH_VARIABLE', which was added in e66ff09a. 2012-11-28 Ludovic Courtès <ludo@gnu.org> web: Add `http-get*'. * module/web/client.scm (http-get*): New procedure. * doc/ref/web.texi (Web Client): Document it. 2012-11-28 Ludovic Courtès <ludo@gnu.org> web: Add `response-body-port'. * module/web/response.scm (make-delimited-input-port, response-body-port): New procedures. (read-response-body): Use `response-body-port'. * test-suite/tests/web-response.test ("example-1")["response-body-port"]: New test. ("example-2")["response-body-port"]: New test. 2012-11-28 Ludovic Courtès <ludo@gnu.org> web: Export `text-content-type?'. * module/web/client.scm (text-type?): Remove. (decode-response-body): Use `text-content-type?'. * module/web/response.scm (text-content-type?): New procedure. * doc/ref/web.texi (Responses): Document it. tests: Use `pass-if-equal' in `web-response.test'. * test-suite/tests/web-response.test: Cleanup whitespace. Use `pass-if-equal' when appropriate. 2012-11-28 Ludovic Courtès <ludo@gnu.org> eval: Store docstrings for lambdas. Fixes <http://bugs.gnu.org/12173>. Reported by Ian Price <ianprice90@googlemail.com>. * libguile/memoize.c (MAKMEMO_LAMBDA): New `docstring' parameter. Add it as the second argument of `SCM_M_LAMBDA'. Update caller. (memoize)[SCM_M_LAMBDA]: Extract docstring from EXP; when `memoize' returns, add the docstring to the lambda's arguments. (unmemoize)[SCM_M_LAMBDA]: Adjust to new argument layout of `SCM_M_LAMBDA'. * libguile/eval.c (BOOT_CLOSURE_NUM_REQUIRED_ARGS, BOOT_CLOSURE_HAS_REST_ARGS, BOOT_CLOSURE_IS_REST, BOOT_CLOSURE_PARSE_FULL): Adjust to new argument layout of `SCM_M_LAMBDA'. * module/ice-9/eval.scm (primitive-eval)[make-general-closure]: Likewise. [eval]: When EXP is a lambda, match its docstring; when the docstring is not #f, add it to the closures procedure properties. * test-suite/tests/eval.test ("docstrings"): New test prefix. * libguile/procs.c (sym_documentation): Rename to... (scm_sym_documentation): ... this. Make it global. * libguile/procs.h (scm_sym_documentation): New declaration. 2012-11-28 Mark H Weaver <mhw@netris.org> Fix library search order and don't change LD_LIBRARY_PATH * libguile/dynl.c (system_extensions_path): New static variable. (sysdep_dynl_link): If 'lt_dlopenext' fails, manually search in 'system_extensions_path'. (augment_env): Remove. (sysdep_dynl_init): Don't change LD_LIBRARY_PATH, and don't use lt_dladdsearchdir if GUILE_SYSTEM_EXTENSIONS_PATH is set. Instead, initialize 'system_extensions_path' from GUILE_SYSTEM_EXTENSIONS_PATH (or if it's unset: <SCM_LIB_DIR>:<SCM_EXTENSIONS_DIR>), and rely on sysdep_dynl_link to search those directories manually. 2012-11-27 Ludovic Courtès <ludo@gnu.org> vlist: Remove Texinfo markup from docstrings. * module/ice-9/vlist.scm: Remove Texinfo markup from docstrings with sed -e"s/@var{\([a-z0-9?!-]\+\)}/\U\1/g ; s/@code{\([^}]\+\)}/‘\1’/g". 2012-11-27 Daniel Hartwig <mandyke@gmail.com> web client: correctly handle uri-query, etc. in relative URI headers * module/web/uri.scm (uri-pat): Make scheme part optional. (string->uri*): New private procedure to also parse relative URIs. * module/web/http.scm (declare-relative-uri-header!): Use that. 2012-11-27 Ludovic Courtès <ludo@gnu.org> web client: Support relative URIs in some headers. Fixes <http://bugs.gnu.org/12827>. * module/web/http.scm (declare-relative-uri-header!): New procedure. ("Content-Location", "Referer"): Use it. Based on discussions with Daniel Hartwig <mandyke@gmail.com>. 2012-11-27 Ludovic Courtès <ludo@gnu.org> Have `load-in-vicinity' look for `.go' files in %LOAD-COMPILED-PATH. Fixes <http://bugs.gnu.org/12519>. * module/ice-9/boot-9.scm (load-in-vicinity)[fresh-compiled-file-name]: New `scmstat' parameter; use it. [sans-extension]: New procedure. [load-absolute]: Call (stat ABS-PATH) from here. Search a `.go' file from %LOAD-COMPILED-PATH before searching %COMPILE-FALLBACK-PATH. 2012-11-27 Ludovic Courtès <ludo@gnu.org> Split `load-in-vicinity' into small procedures. * module/ice-9/boot-9.scm (load-in-vicinity)[compiled-extension]: New variable. [compiled-file-name]: Rename to... [fallback-file-name]: ... this; update caller. Use COMPILED-EXTENSION. [more-recent?, compile, warn-about-exception]: New procedures. [fresh-compiled-file-name]: Use them. 2012-11-26 Ian Price <ianprice90@googlemail.com> Update thanks * THANKS: Add Sjoerd Van Leent Fix docs for `hashtable-copy' * doc/ref/r6rs.texi (rnrs hashtables): a true mutable argument means a mutable copy. 2012-11-25 Ian Price <ianprice90@googlemail.com> R6RS srfi library names should ignore first identifier after the :n * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): (srfi :n name ids ...) -> (srfi srfi-n ids ...) * test-suite/tests/rnrs-libraries.test ("srfi"): Add test. 2012-11-24 Daniel Hartwig <mandyke@gmail.com> (web uri): document that uri-port is an integer * doc/ref/web.texi (URIs): * module/web/uri.scm (build-uri): Document that uri-port is an integer. 2012-11-24 Daniel Hartwig <mandyke@gmail.com> syncronize web module docstrings with manual * doc/ref/web.texi: Fix spacing. Update with a few missing function descriptions. * module/web/client.scm: * module/web/http.scm: * module/web/request.scm: * module/web/server.scm: * module/web/uri.scm: Update docstrings from manual (reworked by Ludovic Courtès). 2012-11-24 Ludovic Courtès <ludo@gnu.org> Augment `.dir-locals.el'. * .dir-locals.el: Add more `scheme-indent-function' rules. Turn on the `case' warnings in auto-compilation. * module/ice-9/boot-9.scm (%auto-compilation-options): Add `duplicate-case-datum' and `bad-case-datum'. 2012-11-23 Ludovic Courtès <ludo@gnu.org> Add tests for `-Wduplicate-case-datum' and `-Wbad-case-datum'. * test-suite/tests/tree-il.test (%opts-w-duplicate-case-datum, %opts-w-bad-case-datum): New variables. ("warnings")["duplicate-case-datum", "bad-case-datum"]: New tests. doc: Mention the `duplicate-case-datum' and `bad-case-datum' warnings. * doc/ref/api-evaluation.texi (Compilation): List the `duplicate-case-datum' and `bad-case-datum' warnings. 2012-11-23 Ludovic Courtès <ludo@gnu.org> Remove reference to `scm_init_popen' when `fork' is unavailable. Fixes <http://bugs.gnu.org/12477>. Reported by lin ray <lin.wei.ray@gmail.com>. * configure.ac: Define the `HAVE_FORK' Automake conditional. * module/Makefile.am (ICE_9_SOURCES): Add `ice-9/popen.scm' only when HAVE_FORK. * libguile/posix.c (scm_init_posix): Register `scm_init_popen' only when HAVE_FORK. 2012-11-22 Ian Price <ianprice90@googlemail.com> R6RS `string-for-each' should accept multiple string arguments * module/rnrs/base.scm (string-for-each): Rewrite. * test-suite/tests/r6rs-base.test ("string-for-each"): Add tests. 2012-11-21 Ludovic Courtès <ludo@gnu.org> cse: Fix out-of-bounds access to the database. Fixes <http://bugs.gnu.org/12883>. * module/language/tree-il/cse.scm (cse)[find-dominating-lexical]: Fix computation of the last argument passed to `unroll'. Patch by Stefan Israelsson Tampe <stefan.itampe@gmail.com>. * test-suite/tests/cse.test ("cse")["http://bugs.gnu.org/12883"]: New test. 2012-11-21 Ludovic Courtès <ludo@gnu.org> Update `par-map' to use nested futures. This allows it to actually use all CPU cores, instead of having the main thread stuck on a `wait-condition-variable'. * module/ice-9/threads.scm (par-mapper): Add a `cons' argument; update callers accordingly. Rewrite using nested futures. 2012-11-21 Ludovic Courtès <ludo@gnu.org> futures: Allow nested futures; put the main thread to work. * module/ice-9/futures.scm (%futures-waiting, %within-future?, %future-prompt): New variables. (let/ec): New macro. (process-future!): Run FUTURE's thunk in a prompt; capture FUTURE's continuation when it aborts, and add it to %FUTURES-WAITING. Set %WITHIN-FUTURE? in the dynamic extent of the call FUTURE's thunk. (process-futures): Move loop body to... (process-one-future): ... here. New procedure. (notify-completion): New procedure. (touch)[work, loop]: New procedures. When %WITHIN-FUTURE? and FUTURE is started, abort; if not %WITHIN-FUTURE, call `work' while waiting. When FUTURE is queued, call `work' too. * test-suite/tests/future.test ("nested futures"): New tests. 2012-11-21 Ludovic Courtès <ludo@gnu.org> futures: Add a record printer. * module/ice-9/futures.scm: Add a record printer for <future>. futures: Keep futures unlocked while they are processing. * module/ice-9/futures.scm (<future>)[completion]: New field. [done?]: Rename to... [state]: ... this. Change `set-future-done?!' to `set-future-state!', and `future-done?' to `future-state'. (make-future): Initialize the `completion' field to 'queued. (with-mutex): New macro. (process-future!): Remove `set-future-done?!' call. (process-futures): Check `future-state'. Unlock FUTURE's mutex before processing it. Broadcast FUTURE's `completion' cond. var. when done. (touch): Likewise. 2012-11-17 Ludovic Courtès <ludo@gnu.org> Update Gnulib to v0.0-7695-g26c0590. * gnulib-local/m4/canonicalize.m4.diff: Remove. * Makefile.am (EXTRA_DIST): Adjust accordingly. doc: Strengthen the case for pattern matching. * doc/ref/api-compound.texi (Pairs): Warn against `cadr' & co., and add a link to "Pattern Matching". * doc/ref/match.texi (Pattern Matching): Add example with nested lists. Add paragraph comparing `match' expressions and hand-written code. doc: Fix typo in `set-record-type-printer!' doc. * module/srfi/srfi-9/gnu.scm (set-record-type-printer!): Change the parameter name to `proc'. * doc/ref/api-compound.texi (SRFI-9 Records): Update accordingly. 2012-11-12 Andreas Rottmann <a.rottmann@gmx.at> Add missing R6RS `open-file-input/output-port' procedure * module/rnrs/io/port.scm (r6rs-open): New internal helper procedure for opening files. (open-file-input-port, open-file-output-port): Make use of `r6rs-open'. (open-file-input/output-port): Implement in terms of `r6rs-open', add to exported identifiers list. * module/rnrs.scm (open-file-input/output-port): Add to exported identifiers. * test-suite/tests/r6rs-ports.test (test-input-file-opener): New procedure, collects several tests for opening file input ports. ("7.2.7 Input Ports"): Use `test-input-file-opener' for checking `open-file-input-port'. (test-output-file-opener): New procedure, collects several tests for opening file output ports. ("8.2.10 Output ports"): Use `test-output-file-opener' for checking `open-file-output-port'. ("8.2.13 Input/output ports"): New test prefix, making use of both `test-input-file-opener' and `test-output-file-opener' to check `open-file-input/output-port'. 2012-11-11 Ludovic Courtès <ludo@gnu.org> doc: Update argument order of SRFI-9 `set-field'. * doc/ref/api-compound.texi (SRFI-9 Records): Change argument order for `set-field'. 2012-11-11 Mark H Weaver <mhw@netris.org> srfi-9.test: avoid symbols of the form ':bar' for more robust checking. * test-suite/tests/srfi-9.test ("incompatible field paths"): Rename ':bar' to 'bar' to avoid the possibility of the symbol name being printed with #{...}# notation. 2012-11-10 Ludovic Courtès <ludo@gnu.org> doc: Document SRFI-9 functional setters. * doc/ref/api-compound.texi (Functional ``Setters''): New section. 2012-11-10 Ludovic Courtès <ludo@gnu.org> doc: Move SRFI-9 records under "Compound Data Types". Suggested by Mark Weaver. * doc/ref/srfi-modules.texi (SRFI-9): Keep the node, but move contents to... * doc/ref/api-compound.texi (SRFI-9 Records): ...here. (Record Overview): New section. 2012-11-10 Mark H Weaver <mhw@netris.org> Change the argument order of 'set-fields' to match that of 'set-fields'. * module/srfi/srfi-9/gnu.scm (set-fields): Swap order of first two arguments. * test-suite/tests/srfi-9.test: Update tests. 2012-11-10 Mark H Weaver <mhw@netris.org> Add system/base/ck.scm to SYSTEM_BASE_SOURCES in module/Makefile.am. * module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/ck.scm. Futures: Avoid creating the worker pool more than once. * module/ice-9/futures.scm (%create-workers!): Use 'with-mutex' in case an exception is thrown. Within the critical section, check to make sure the worker pool hasn't already been created by another thread. 2012-11-10 Mark H Weaver <mhw@netris.org> Improve error for set-fields paths leading to different types. * module/system/base/ck.scm: New module. * module/srfi/srfi-9.scm: Import (system base ck). (getter-type, getter-index, getter-copier): Convert incoming argument convention to CK form. (define-tagged-inlinable): Convert return value convention for key lookup to CK form. * module/srfi/srfi-9/gnu.scm: Import (system base ck). Rename '%set-fields-unknown-getter' to 'unknown-getter'. (c-list, c-same-type-check): New macros. (%set-fields): Using the CK abstract machine, arrange to check (at macro expansion time) that all of the getters in head position correspond to the same record type. * test-suite/tests/srfi-9.test: Add test. 2012-11-10 Mark H Weaver <mhw@netris.org> Improve error messages for invalid record definitions. * module/srfi/srfi-9.scm (%define-record-type): Accept additional 'form' parameter which contains the original form of 'define-record-type' or 'define-immutable-record-type'. Add elaborate pattern guard which raises descriptive syntax errors for specific errors, and a fallback pattern to catch anything else. (define-record-type): Pass 'form' parameter to %define-record-type. * module/srfi/srfi-9/gnu.scm (define-immutable-record-type): Pass 'form' parameter to %define-record-type. * test-suite/tests/srfi-9.test: Add tests. 2012-11-10 Mark H Weaver <mhw@netris.org> Fix non-toplevel srfi-9 compile-time error tests to actually be non-toplevel. * test-suite/tests/srfi-9.test: Move non-toplevel record definitions to be within the expression passed to 'compile'. Use 'pass-if-equal' to check syntax-error exceptions in srfi-9.test. * test-suite/tests/srfi-9.test: Convert detailed syntax-error exception tests to use 'pass-if-equal'. 2012-11-09 Mark H Weaver <mhw@netris.org> Fix record constructor in getopt-long. * module/ice-9/getopt-long.scm (%make-option-spec): Fix the formal argument list to match the actual fields present. (make-option-spec): Update to match the fixed %make-option-spec. 2012-11-09 Mark H Weaver <mhw@netris.org> Implement functional record setters. Written in collaboration with Ludovic Courtès <ludo@gnu.org> * module/srfi/srfi-9.scm: Internally, rename 'accessor' to 'getter' and 'modifier' to 'setter'. (define-tagged-inlinable, getter-type, getter-index, getter-copier, %%on-error, %%set-fields): New macros. (%define-record-type): New macro for creating both mutable and immutable records, and containing a substantially rewritten version of the code formerly in 'define-record-type'. (define-record-type): Now just a wrapper for '%define-record-type'. (throw-bad-struct, make-copier-id): New procedures. * module/srfi/srfi-9/gnu.scm (define-immutable-record-type, set-field, and set-fields): New exported macros. (collate-set-field-specs): New procedure. (%set-fields-unknown-getter, %set-fields): New macros. * test-suite/tests/srfi-9.test: Add tests. Rename getters and setters in existing tests to make the functional setters look better. 2012-11-05 Ludovic Courtès <ludo@gnu.org> Fix invalid assertion about mutex ownership in threads.c. * libguile/threads.c (do_thread_exit): Don't assert m->owner == t->handle since that is not the case when MUTEX was abandoned by T. Reported by Mark Weaver and others. Have `SCM_NUM2FLOAT' and `SCM_NUM2DOUBLE' use `scm_to_double'. * libguile/validate.h (SCM_NUM2FLOAT, SCM_NUM2DOUBLE): Use `scm_to_double' instead of the deprecated functions. Reported by Aleix Conchillo Flaqué <aconchillo@gmail.com>. Fix copyright years in `futures.scm'. * module/ice-9/futures.scm: Update copyright years. 2012-11-05 Mark H Weaver <mhw@netris.org> Preserve additional R6RS library name components after srfi :n * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): (srfi :n ...) -> (srfi srfi-n ...) instead of (srfi srfi-n). 2012-11-03 Ludovic Courtès <ludo@gnu.org> futures: Have workers work when futures are available. Reported by David Pirotte. * module/ice-9/futures.scm (process-futures): Wait on %FUTURES-AVAILABLE only when %FUTURES is empty. The problem was obvious when running (begin (use-modules (ice-9 threads)) (par-map 1+ (iota 400000))) : eventually, only the main thread would do the work, while the others would remain idle, waiting on %FUTURES-AVAILABLE. 2012-11-03 Ludovic Courtès <ludo@gnu.org> Fix `generalized-vector->list' indexing bug with shared arrays. Fixes <http://bugs.gnu.org/12465>. Reported by Daniel Llorens <daniel.llorens@bluewin.ch>. * libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix initial value of POS; pass the `h.base + pos', not just `pos' as the `vref' argument. * test-suite/tests/arrays.test ("array->list")["http://bugs.gnu.org/12465 - ok", "http://bugs.gnu.org/12465 - bad]: New tests. ("generalized-vector->list"): New test prefix. 2012-11-02 Ludovic Courtès <ludo@gnu.org> test-suite: Add a nameless form of `pass-if-equal'. * test-suite/test-suite/lib.scm (pass-if-equal): Add a nameless pattern. * test-suite/tests/arrays.test ("array->list"): Use `pass-if-equal'. 2012-11-01 Ludovic Courtès <ludo@gnu.org> scandir: Use `lstat' instead of `stat'. * module/ice-9/ftw.scm (scandir): Use `lstat', not `stat'. * test-suite/tests/ftw.test ("scandir")["symlink to directory"]: New test. 2012-11-01 Ludovic Courtès <ludo@gnu.org> test-suite: Use `pass-if-equal' in `ftw.test'. * test-suite/tests/ftw.test ("file-system-fold")["test-suite (never enter)", "test-suite/lib.scm (flat file)"]: Use `pass-if-equal' instead of `pass-if'. test-suite: Add `pass-if-equal'. * test-suite/test-suite/lib.scm (pass-if-equal): New macro. (run-test): Upon `fail', pass ARGS to REPORT. 2012-10-31 Mark H Weaver <mhw@netris.org> Fix formatting of comments in scm_read_array. * libguile/read.c (scm_read_array): Fix formatting of comments. scm_read_shebang: handle non-ascii characters properly. * libguile/read.c (scm_read_shebang): Abort scan for reader directive if a character other than [-a-z0-9] is encountered. 2012-10-30 Mark H Weaver <mhw@netris.org> Test number-theoretic division by -0.0. * test-suite/tests/numbers.test ("Number-theoretic division"): Fix typo so that we actually test for division by -0.0. Minor tweaks to srfi-105.test * test-suite/tests/srfi-105.test ("curly-infix"): Minor tweaks. 2012-10-27 Mark H Weaver <mhw@netris.org> Implement SRFI-105 curly infix expressions. * libguile/private-options.h: Add SCM_CURLY_INFIX_P macro, and increment SCM_N_READ_OPTIONS. * libguile/read.c (sym_nfx, sym_bracket_list, sym_bracket_apply): New variables. (scm_read_opts): Add curly-infix reader option. Reformat to comply with GNU coding standards. (scm_t_read_opts): Add curly_infix_p and neoteric_p fields. (init_read_options): Initialize new fields. (CHAR_IS_DELIMITER): Add '{', '}', '[', and ']' as delimiters if curly_infix_p is set. (set_port_square_brackets_p, set_port_curly_infix_p): New functions. (read_inner_expression): New function which contains the code that was previously in 'scm_read_expression'. Handle curly braces when curly_infix_p is set. If curly_infix_p is set and square_brackets_p is unset, follow the Kawa convention: [...] => ($bracket-list$ ...) (scm_read_expression): New function body to handle neoteric expressions where appropriate. (scm_read_shebang): Handle the new reader directives: '#!curly-infix' and the non-standard '#!curly-infix-and-bracket-lists'. (scm_read_sexp): Handle curly infix lists. * module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-105 feature identifier. * doc/ref/srfi-modules.texi (SRFI-105): Add stub doc for SRFI-105. * doc/ref/api-evaluation.texi (Scheme Read): Add documentation for the 'curly-infix' read option, and the '#!curly-infix' and '#!curly-infix-and-bracket-lists' reader directives. * doc/ref/api-options.texi (Runtime Options): Add 'curly-infix' to the list of read options. * test-suite/Makefile.am: Add tests/srfi-105.test. * test-suite/tests/srfi-105.test: New file. 2012-10-26 Mark H Weaver <mhw@netris.org> Implement #!fold-case and #!no-fold-case reader directives. * libguile/read.c (set_port_case_insensitive_p): New function. (scm_read_shebang): Handle #!fold-case and #!no-fold-case. * doc/ref/api-evaluation.texi (Case Sensitivity, Scheme Read): Document the #!fold-case and #!no-fold-case reader directives. * test-suite/tests/reader.test ("per-port-read-options"): Add tests. 2012-10-26 Mark H Weaver <mhw@netris.org> Implement per-port read options. * libguile/read.c (scm_t_read_opts): Update comment to mention the per-port read options. (sym_port_read_options): New variable. (set_port_read_option): New function. (init_read_options): Add new 'port' parameter, and consult the per-port read option overrides when initializing the 'scm_t_read_opts' struct. Move to bottom of file. (scm_read): Pass 'port' parameter to init_read_options. 2012-10-24 Mark H Weaver <mhw@netris.org> Repurpose scm_i_port_weak_hash to associate an alist with each port. * libguile/ports.c (scm_i_port_weak_hash): Document that the values in this hash table will now be alists. Previously the value slots were unused. (scm_new_port_table_entry): Change the initial value of the entry in scm_i_port_weak_hash from SCM_BOOL_F to SCM_EOL. 2012-10-24 Mark H Weaver <mhw@netris.org> Generalize scm_read_shebang to handle other reader directives. * libguile/read.c (READER_DIRECTIVE_NAME_MAX_SIZE): New C macro. (scm_read_shebang): Rewrite to handle arbitrary reader directives. Add source properties to more datum types in scm_read_sharp_extension. * libguile/read.c (scm_read_sharp_extension): Attach source properties to the result of a custom token reader if the returned datum is not immediate. Previously, source properties were added to pairs only. 2012-10-24 Mark H Weaver <mhw@netris.org> Change reader to pass read options to helpers via explicit parameter. * libguile/read.c (enum t_keyword_style, struct t_read_opts, scm_t_read_opts): New types. (init_read_options): New function. (CHAR_IS_DELIMITER): Look up square-brackets option via local 'opts'. (scm_read): Call 'init_read_options', and pass 'opts' to helpers. (flush_ws, maybe_annotate_source, read_complete_token, read_token, scm_read_bytevector, scm_read_character, scm_read_commented_expression, scm_read_expression, scm_read_guile_bit_vector, scm_read_keyword, scm_read_mixed_case_symbol, scm_read_nil, scm_read_number, scm_read_number_and_radix, scm_read_quote, scm_read_sexp, scm_read_sharp, scm_read_sharp_extension, scm_read_shebang, scm_read_srfi4_vector, scm_read_string, scm_read_syntax, scm_read_vector, scm_read_array): Add 'opts' as an additional parameter, and use it to look up read options. Previously the global read options were consulted directly. 2012-10-24 Mark H Weaver <mhw@netris.org> Minor tweaks to delimiter handling in read.c * libguile/read.c (CHAR_IS_R5RS_DELIMITER, CHAR_IS_DELIMITER): Move the '[' and ']' delimiters from CHAR_IS_R5RS_DELIMITER to CHAR_IS_DELIMITER. Parenthesize all references to the macro parameter. Don't check the global square-brackets read option until after we know the character is '[' or ']'. (scm_read_sexp): Don't check the global square-brackets read option until after we know the character is ']'. 2012-10-24 Mark H Weaver <mhw@netris.org> Move array reader from arrays.c to read.c * libguile/arrays.c (read_decimal_integer): Move to read.c. (scm_i_read_array): Remove. Incorporate the code into the 'scm_read_array' static function in read.c. * libguile/arrays.h (scm_i_read_array): Remove prototype. * libguile/read.c (read_decimal_integer): Move here from read.c. (scm_read_array): Incorporate the code from 'scm_i_read_array'. Call 'scm_read_vector' and 'scm_read_sexp' instead of 'scm_read'. 2012-10-18 Ian Price <ianprice90@googlemail.com> Fix typo in scheme-using.texi * doc/ref/scheme-using.texi (System Commands): Fix typo. Fix @@ usage in --listen option * module/ice-9/command-line.scm (compile-shell-switches): Fix usage of @@, which no longer supports arbitrary expressions, only identifiers. 2012-10-17 Mark H Weaver <mhw@netris.org> Remove prototype for scm_read_token, which does not exist. * libguile/read.h: Remove prototype for scm_read_token. Improve formatting of options help given long option names * module/ice-9/boot-9.scm (define-option-interface): When printing options help, e.g. for (read-options 'help), expand the width of the first column by another tab stop, to accommodate option names of up to 23 characters. 2012-10-13 Ludovic Courtès <ludo@gnu.org> web: Fix possible file descriptor leak in `open-socket-for-uri'. * module/web/client.scm (open-socket-for-uri): Always close S in the `system-error' handler. 2012-10-12 Ludovic Courtès <ludo@gnu.org> web: Pass `AI_NUMERICSERV' when given a port number. * module/web/client.scm (open-socket-for-uri)[addresses]: Pass AI_NUMERICSERV as the `getaddrinfo' hint when (uri-port URI) is true. web: Change `http-get' to try all the addresses for the given URI. * module/web/client.scm (open-socket-for-uri): Try all the addresses returned by `getaddrinfo' until one succeeds. 2012-10-12 Ludovic Courtès <ludo@gnu.org> Implement `hash' for structs. * libguile/hash.c (scm_hasher): Call `scm_i_struct_hash' upon `scm_tcs_struct'. * libguile/struct.c (scm_i_struct_hash): New function. * libguile/struct.h (scm_i_struct_hash): New declaration. * test-suite/tests/structs.test ("hash"): New test prefix. 2012-10-12 Mark H Weaver <mhw@netris.org> Thanks Daniel Hartwig. * THANKS (Contributors since the last release): Add Daniel Hartwig. 2012-10-12 Daniel Hartwig <mandyke@gmail.com> In string-split, add support for character sets and predicates. * libguile/srfi-13.c (string-split): Add support for splitting on character sets and predicates, like string-index and others. * test-suite/tests/strings.test (string-split): Add tests covering the new argument types. * doc/ref/api-data.texi (string-split): Update. 2012-10-10 Mark H Weaver <mhw@netris.org> Revert "Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule'" This reverts commit 3e3d32dd9b2d71ffb0703dedc4d47387e981c9b5. 2012-10-08 Mark H Weaver <mhw@netris.org> Preserve keyword identifier in 'syntax-rules' and 'define-syntax-rule' * module/ice-9/psyntax-pp.scm (syntax-rule, define-syntax-rule): Preserve the keyword identifier. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-10-08 Mark H Weaver <mhw@netris.org> Simplify calls to 'eqv?' when one argument is an immediate constant. * module/language/tree-il/primitives.scm (maybe-simplify-to-eq): New helper procedure shared by expanders for 'eqv?' and 'equal?'. (*primitive-expand-table*): Add expansion rule for 'eqv?'. * test-suite/tests/tree-il.test ("primitives"): Add tests. 2012-10-08 Mark H Weaver <mhw@netris.org> Don't simplify 'equal?' to 'not' or 'null?'. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't simplify 'equal?' to 'not' or 'null?', but only to 'eq?'. * test-suite/tests/tree-il.test ("primitives"): Adjust tests. 2012-10-08 Mark H Weaver <mhw@netris.org> Don't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Refine test for fixnums to verify that the small integer is exact. * test-suite/tests/tree-il.test ("primitives"): Add test. 2012-10-06 Ludovic Courtès <ludo@gnu.org> Simplify calls to `equal?' when one argument is a constant. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Add expansion rules for `equal?', when called with one constant and another argument. * test-suite/tests/tree-il.test (pass-if-primitives-resolved): New macro. ("primitives"): New test prefix. 2012-10-06 Mark H Weaver <mhw@netris.org> Improve error reporting in 'append!' * libguile/list.c (scm_append_x): Report correct argument number when validating arguments. Validate that the last cdr of each argument is null or nil. Rename formal rest argument from 'lists' to 'args'. * test-suite/tests/list.test (append!): Update tests to expect correct handling of improper lists. 2012-10-04 Mark H Weaver <mhw@netris.org> Change inappropriate uses of expect-fail X to pass-if not X in chars.test * test-suite/tests/chars.test (basic char handling): Change inappropriate uses of 'expect-fail' to 'pass-if' with 'not' applied to the test. 2012-09-26 Chris K. Jester-Young <cky944@gmail.com> In fold-matches, set regexp/notbol unless matching string start. * module/ice-9/regex.scm (fold-matches): Set regexp/notbol if the starting position is nonzero. * test-suite/tests/regexp.test (fold-matches): Check that when matching /^foo/ against "foofoofoofoo", only one match results. 2012-09-11 Ludovic Courtès <ludo@gnu.org> Don't stat(2) and access(2) the .go location before using it. * module/system/base/compile.scm (ensure-directory): Rename to... (ensure-directory): ... this. Update callers. When ERRNO is EEXIST, assume DIR is a writable directory instead of calling `stat' and `access?' again. Fixes UID/EUID mismatches for setuid binaries. Reported by rixed@happyleptic.org at <http://lists.gnu.org/archive/html/guile-user/2012-06/msg00023.html>. 2012-09-11 Ludovic Courtès <ludo@gnu.org> Rewrite SRFI-31 in terms of `syntax-rules'. * module/srfi/srfi-31.scm: Use `#:export' instead of `#:export-syntax'. (rec): Rewrite using `syntax-rules'. * test-suite/tests/srfi-31.test ("rec special form"): Change exception type to EXCEPTION:SYNTAX-PATTERN-UNMATCHED. 2012-09-06 Ian Price <ianprice90@googlemail.com> Document (ice-9 curried definitions) * doc/ref/Makefile.am (guile_TEXINFOS): Add curried.texi to list * doc/ref/curried.texi: New file. * doc/ref/guile.texi (Guile Modules): Add "Curried Definitions" to menu. * doc/ref/scheme-ideas.texi (Lambda Alternatives): Refer to "Curried Definitions" from the `define' section. `define-public' is no a longer curried definition by default. * module/ice-9/boot-9.scm (define-public): Remove currying functionality. * module/ice-9/curried-definitions.scm (define-public): New export. 2012-09-03 Ludovic Courtès <ludo@gnu.org> build: Fix race between installing `guild' and the `guile-tools' symlink. Fixes <http://bugs.gnu.org/12015>. Report and patch by Song.Li <Song.Li@windriver.com>. * meta/Makefile.am (install-data-hook): Rename to... (install-exec-hook): ... this. 2012-09-03 Ludovic Courtès <ludo@gnu.org> doc: Use scm_{to,from}_double instead of old API in example. Fixed <http://bugs.gnu.org/12241>. Reported by Kurt W. Gochko <kgochko@comcast.net>. * doc/ref/tour.texi (Writing Guile Extensions): Change example to use scm_{to,from}_double instead of the pre-1.8 API. 2012-09-03 Ludovic Courtès <ludo@gnu.org> build: Use Automake's `color-tests'. * configure.ac: Use Automake's `color-tests'. 2012-08-27 Ian Price <ianprice90@googlemail.com> ISO 8601 time format specifies zero padding for hours, not blank padding. * doc/ref/srfi-modules.texi ("SRFI-19 Date to string"): Fix iso 8601 format strings. * module/srfi/srfi-19.scm (directives): Fix iso 8601 format strings. 2012-08-27 Ludovic Courtès <ludo@gnu.org> doc: Fix description of regexp/locale encoding interaction. * doc/ref/api-regex.texi (Regexp Functions): Update paragraph that mentions locale encoding and strings-as-bytes. * test-suite/tests/regexp.test ("nonascii locales")["match structures refer to char offsets, non-ASCII pattern"]: New test. 2012-08-26 Ludovic Courtès <ludo@gnu.org> Update `texinfo.test' to match latest change. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo")["@url{arg}"]: Update test as a follow-up to dc7a9cefbf5434b6e7e503fe83faa07b24a1a6cd ("more robust texinfo alias handling"). 2012-08-26 Ian Price <ianprice90@googlemail.com> Fix uri-encoding for strings with no unreserved chars * module/web/uri.scm (uri-encode): Change test to check for unreserved chars instead of reserved chars. * test-suite/tests/web-uri.test ("encode"): Add test. Fix uri-encoding for octets 0-15 * module/web/uri.scm (uri-encode): All encoded octets should be of the form % HEXDIGIT HEXDIGIT. * test-suite/tests/web-uri.test ("encode"): Add test. 2012-08-25 Andy Wingo <wingo@pobox.com> more robust texinfo alias handling * module/texinfo.scm (command-spec): Resolve aliases here. (complete-start-command, make-command-parser): (make-dom-parser, parse-environment-args): Reload command after resolving spec, so we get the alias target. 2012-08-21 Ludovic Courtès <ludo@gnu.org> Micro-optimize (ice-9 format). * module/ice-9/format.scm (format): Use `call-with-output-string' instead of `with-output-to-string'. 2012-08-20 Ludovic Courtès <ludo@gnu.org> Optimize `scm_lfwrite_substr', used by `scm_simple_format'. Fixes <http://bugs.gnu.org/12033>. Reported by nalaginrut <nalaginrut@gmail.com>. * libguile/print.c (scm_i_display_substring): New function. * libguile/print.h (scm_i_display_substring): New internal declaration. * libguile/ports.c (scm_lfwrite_substr): Use it instead of `scm_display' + `scm_c_substring'. 2012-08-17 Andy Wingo <wingo@pobox.com> reinstate type check to scm_to_utf8_stringn * libguile/strings.c (scm_to_utf8_stringn): Re-add missing type check, inadvertantly removed in e3d4597469a543d97c4997b128509c2ceb13ca2b. 2012-08-08 Mark H Weaver <mhw@tines.lan> Revert "Add tests for 'exp' and 'expt' that should produce complex NaNs" This reverts commit cc26b9de1d3c21cb4be49cc61c4b5872b8f607c5. Revert "Avoid cexp, whose C standard definition is mathematically incorrect" This reverts commit ecbded71bb423a6055c541d6272796aefd1486f9. 2012-08-01 Mark H Weaver <mhw@netris.org> Avoid cexp, whose C standard definition is mathematically incorrect * libguile/numbers.c (scm_exp): Do not use cexp. 2012-07-28 Mark H Weaver <mhw@netris.org> Add tests for 'exp' and 'expt' that should produce complex NaNs * test-suite/tests/numbers.test (exp, expt): Add tests that should produce complex NaNs, but apparently don't on all systems. 2012-07-28 Andy Wingo <wingo@pobox.com> set struct names for <standard-vtable>, etc * libguile/struct.c (scm_init_struct): Set the struct names for <standard-vtable>, <applicable-struct-vtable>, and <applicable-struct-with-setter-vtable>. 2012-07-28 Andy Wingo <wingo@pobox.com> update tests after vtable-vtable deprecation * test-suite/tests/goops.test ("classes for built-in types"): Use a vtable instead of a vtable-vtable. * test-suite/tests/structs.test (ball-root) ("low-level struct procedures", "make-struct"): Rework to use normal vtables instead of making new vtable-vtable. 2012-07-28 Andy Wingo <wingo@pobox.com> deprecate make-vtable-vtable * libguile/struct.h: * libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can handle most of the use cases with make-vtable, and we don't want to promote the creation of new roots to the type hierarchy. (scm_i_make_vtable_vtable): The internal replacement. improve documentation for structs * doc/ref/api-compound.texi (Structures): Update to describe <standard-vtable>, to remove documentation for make-vtable-vtable, to describe meta-vtables, and to add a long example. update structure documentation * doc/ref/api-compound.texi (Records): Add a link to SRFI-9 records. (Structures): Add a link to Records. Describe tail arrays as deprecated, and add a rationale and some details. 2012-07-28 Mark H Weaver <mhw@netris.org> Angle of -0.0 is pi, not zero * libguile/numbers.c (scm_angle): Check the sign of an inexact real zero, to ensure that (angle -0.0) => pi and (angle 0.0) => 0.0. * test-suite/tests/numbers.test (angle): Add tests, and increase precision of tests where the angle should be pi. 2012-07-11 Noah Lavine <noah.b.lavine@gmail.com> Document (ice-9 and-let-star) * doc/ref/srfi-modules.texi: note that (srfi srfi-2) is the same as (ice-9 and-let-star). 2012-07-07 Ludovic Courtès <ludo@gnu.org> build: Use `AM_PROG_AR'. * configure.ac: Use `AM_PROG_AR', as suggested by Automake 1.12.1 ("warning: 'libguilereadline-v-@LIBGUILEREADLINE_MAJOR@.la': linking libtool libraries using a non-POSIX archiver requires 'AM_PROG_AR' in 'configure.ac'"). Fix typos in `NEWS'. * NEWS: Fix typos. Bump version number for 2.0.6. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment, to account for new C functions like `scm_c_nvalues', `scm_to_pointer', etc. (LIBGUILE_INTERFACE_AGE): Increment. Store the `git-version-gen' patch. * gnulib-local/build-aux/git-version-gen.diff: New file. * Makefile.am (EXTRA_DIST): Add it. Work around `gl_CANONICALIZE_LGPL' bug when cross-compiling to GNU/Hurd. * gnulib-local/m4/canonicalize.m4.diff: New file. * Makefile.am (EXTRA_DIST): Add it. Work around `gl_CANONICALIZE_LGPL' bug when cross-compiling. * gnulib-local/m4/canonicalize.m4.diff: New file. * Makefile.am (EXTRA_DIST): Add it. Add missing `m4/clock_time.m4'. 2012-07-06 Ludovic Courtès <ludo@gnu.org> Use `clock-time' directly from Gnulib, but with a local patch. This is equivalent to the previous situation, but more easily maintainable. * acinclude.m4 (gl_CLOCK_TIME): Remove. * configure.ac: Remove explicit use of `gl_CLOCK_TIME'. * m4/gnulib-cache.m4 (gl_MODULES): Add `clock-time'. * gnulib-local/m4/clock_time.m4.diff: New file. * Makefile.am (EXTRA_DIST): Add it. 2012-07-06 Ludovic Courtès <ludo@gnu.org> Update Gnulib to v0.0-7509-g98a2286. * Makefile.am (EXTRA_DIST): Add `m4/gnulib-cache.m4'. * build-aux/git-version-gen: Keep unchanged. 2012-07-06 Andy Wingo <wingo@pobox.com> add http/1.1 transfer codings to the NEWS * doc/ref/web.texi (Transfer Codings): Add a note about modules. * NEWS: Add NEWS for transfer codings. 2012-07-06 Ian Price <ianprice90@googlemail.com> Document and export `declare-opaque-header!' * module/web/http.scm (declare-opaque-header!): Add docstring. New export. * doc/ref/web.texi (HTTP): Add documentation. 2012-07-06 Ian Price <ianprice90@googlemail.com> Add HTTP Chunked Encoding support to web modules. * doc/ref/web.texi(Transfer Codings): New subsection for transfer codings. * module/web/http.scm(make-chunked-input-port, make-chunked-output-port): New procedures. * module/web/response.scm (read-response-body): Handle chunked responses. * test-suite/tests/web-response.test: Add test. * test-suite/tests/web-http.test: Add tests. afd 2012-07-06 Mark H Weaver <mhw@netris.org> Fix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries * module/ice-9/psyntax.scm (@): Return top-wrap instead of the wrap applied to the '@' form, so that the symbol will be interpreted as a top-level identifier and never refer to any lexical variable. (@@): Change the syntax used to support R6RS 'library' forms to: (@@ @@ (mod ...) body). Change the behavior of the documented (@@ (mod ...) id) form to be the same as that of @, except for the use of 'private' instead of 'public' in the psyntax mod: use syntax->datum on the identifier, and return top-wrap instead of the wrap applied to the '@@' form. This fixes <http://bugs.gnu.org/10756> reported by Ludovic Courtès. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/r6rs-libraries.scm (library): Use '@@ @@' syntax instead of the older '@@' syntax. * test-suite/tests/syncase.test (changes to expansion environment): Use '@@ @@' syntax. * module/Makefile.am: Add explicit dependencies for boot-9.go on the files that it includes: quasisyntax.scm and r6rs-libraries.scm. 2012-07-06 Andy Wingo <wingo@pobox.com> simplify %condition-type-vtable * module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable instead of make-vtable-vtable. record-type-vtable is not a new root of the vtable hierarchy * module/ice-9/boot-9.scm (record-type-vtable): Simplify to use make-vtable instead of make-vtable-vtable. Scheme standard-vtable-fields binding * libguile/struct.c (scm_init_struct): Export standard-vtable-fields to Scheme. add Scheme binding for scm_standard_vtable_vtable * libguile/struct.c (scm_init_struct): Export <standard-vtable> to Scheme. simplify scm_init_print * libguile/print.c (scm_init_print): Simplify creation of print-state vtable. deprecate struct-vtable-tag * libguile/deprecated.c: * libguile/deprecated.h: * libguile/struct.c: * libguile/struct.h: * doc/ref/api-compound.texi: Deprecate struct-vtable-tag. disable some uri tests if --disable-networking * test-suite/tests/web-uri.test: Disable some tests if we don't have inet-pton. add --match pattern to git-version-gen * configure.ac: Add --match pattern so we only get v2.0.x tagx. git-version-gen: add --match argument * build-aux/git-version-gen (Options): Add --match argument. (v_from_git): Remove path without --match. update git-version-gen from gnulib * build-aux/git-version-gen: Import from gnulib. 2012-07-06 Daniel Krueger <keenbug@gmail.com> fixed repl command ,describe to also handle syntax 2012-07-06 Dagobert Michelsen <dam@opencsw.org> Add alignment for Sun Studio 12 2012-07-06 Andy Wingo <wingo@pobox.com> more uri-related ipv6 fixes * module/web/uri.scm (ipv6-regexp): IPv6 numeric addresses do not have brackets. It's only in URIs that they have them. (ipv6-host-pat, authority-regexp, parse-authority): Refactor ipv6 detection to fix a bug with |, and to extract IPv6 hosts from their brackets. This way we can pass the uri-host directly to inet-pton. (uri->string): If the host contains a `:', assume it is ipv6 and add brackets. * test-suite/tests/web-uri.test ("build-uri"): Adapt tests to assume that the address returned by uri-host and passed to build-uri #:host does not have brackets. 2012-07-06 Daniel Hartwig <mandyke@gmail.com> enhance IPv6 support * module/web/uri.scm (valid-host?): Support dotted-quad notation in IPv6 addresses. (parse-authority): Support IPv6 literals. * test-suite/tests/web-uri.test: Add and fix tests. support URIs with domain names starting with numbers * module/web/uri.scm (valid-host?): Fix regexp to support domain names starting with numbers. * test-suite/tests/web-uri.scm: Add tests for above and IP literals. 2012-07-06 Andy Wingo <wingo@pobox.com> fix typo in web.texi * doc/ref/web.texi (HTTP Headers): Fix typo in example. Fixes http://bugs.gnu.org/10890. 2012-07-06 Andy Wingo <wingo@pobox.com> better procedure-arguments for interpreted procs with opt, rest, kwargs * module/ice-9/session.scm (procedure-arguments): Arrange to interpret numbers in the "req" and "opt" positions of an 'arglist as N arguments with unknown name. * module/ice-9/eval.scm (primitive-eval): Set 'arglist on "complex" procedures. Fixes http://bugs.gnu.org/10922. * test-suite/tests/session.test ("procedure-arguments"): Add a test. 2012-07-06 Andy Wingo <wingo@pobox.com> add check for fchmod * configure.ac: Add a check for fchmod. * libguile/filesys.c (scm_chmod): Guard the fchmod case with HAVE_FCHMOD. 2012-07-06 Andy Wingo <wingo@pobox.com> remove mkdir alias in filesys.c for mingw * libguile/filesys.c (mkdir): Remove alias, as gnulib handles this for us. fix warnings in mingw in expand.c * libguile/expand.c (VOID_, CONST_): Add trailing underscores to avoid name conflicts on MinGW. fix warning about vsnprintf on mingw * libguile/deprecation.c: Remove a vsnprintf alias for mingw, now that gnulib handles it correctly. be sure to include time.h for struct timespec * libguile/gen-scmconfig.c: The GNU libc manual says that struct timespec is defined in time.h. So, just include both sys/time.h and time.h, if they are available. 2012-07-05 Andy Wingo <wingo@pobox.com> fix `vector' instruction emission for big vectors * module/language/glil/compile-assembly.scm (dump-constants): Only use the `vector' instruction for vectors whose length can fit in 16 bits. Fixes http://bugs.gnu.org/11087. 2012-07-05 Andy Wingo <wingo@pobox.com> fix-letrec uses effects.scm for effects analysis * module/language/tree-il/fix-letrec.scm: Use effects.scm for effects analysis, instead of primitives.scm. (simple-expression?, partition-vars): Adapt. 2012-07-05 Andy Wingo <wingo@pobox.com> simplify one kind of degenerate prompt * module/language/tree-il/peval.scm (<operand>): Instead of having a `residualize?' field, have it be a use count. (peval): Adapt to <operand> change. Add function to kill uses of an operand. Use it in the <prompt> inliner. Add another kind of degenerate prompt to elide. We should really switch to CPS though, as that will allow us to contify more aggressively. * test-suite/tests/peval.test ("partial evaluation"): Adapt (while #t #t) test, which was sensitive to how far the recursive inlining got. Add a test for the degenerate prompt elision. 2012-07-05 Andy Wingo <wingo@pobox.com> fix bugs in effects analysis of "effect+exception-free-primitives" * module/language/tree-il/effects.scm (make-effects-analyzer): Be more precise regarding the effects of the so-called effect+exception-free-primitives: now we check their arities. * test-suite/tests/cse.test ("cse"): Add a test that we don't elide (cons 1 2 3) in effect context. 2012-07-05 Andy Wingo <wingo@pobox.com> optimize (apply foo 0 (list 1 2)) => (foo 0 1 2) * module/language/tree-il/peval.scm (peval): Inline applications where we know the contents of the tail. * test-suite/tests/peval.test ("partial evaluation"): Add tests. 2012-07-05 Andy Wingo <wingo@pobox.com> compile ecmascript's `return' as an abort * module/language/ecmascript/compile-tree-il.scm (current-return-tag): (with-return-prompt, comp): Compile `return' as an abort instead of a primcall to `return'. Fixes beta-reduction by the optimizer -- it doesn't make sense for `return' to move from one function to another! fix goops compilation when current language is not scheme * module/oop/goops/dispatch.scm (compute-dispatch-procedure): Set source language to Scheme, not (current-language). 2012-07-04 Andy Wingo <wingo@pobox.com> add scm_c_nvalues to news * NEWS: Add scm_c_nvalues. 2012-07-04 Andy Wingo <wingo@pobox.com> add scm_c_nvalues with docs; also, docs for scm_c_values * libguile/values.h: * libguile/values.c (scm_c_nvalues): New function. * doc/ref/api-control.texi (Multiple Values): Add docs for scm_c_values and scm_c_nvalues. Fixes http://bugs.gnu.org/11764. 2012-07-04 Andy Wingo <wingo@pobox.com> add scm_{to,from}_pointer docs * doc/ref/api-foreign.texi: Add documentation for scm_to_pointer and scm_from_pointer. 2012-07-02 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update. dead code elimination * module/ice-9/psyntax.scm: Remove commented-out definitions of `do' and `case'. remove docs for smob-call instruction * doc/ref/vm.texi (Trampoline Instructions): Remove docs for smob-call. typo fix in web.texi * doc/ref/web.texi (URIs): Fix a typo/thinko. 2012-07-02 Ludovic Courtès <ludo@gnu.org> Have `procedure-arguments' always return the `allow-other-keys?' pair. Fixes <http://bugs.gnu.org/10938>. Based on a patch by Stefan Israelsson Tampe <stefan.itampe@gmail.com>. * module/ice-9/session.scm (procedure-arguments): When the 'arglist property is available, emit the `allow-other-keys?' pair. Use `match-lambda'. * test-suite/tests/session.test ("procedure-arguments")["aok? is preserved"]: New test. 2012-07-02 Ludovic Courtès <ludo@gnu.org> Add tests for `procedure-arguments'. * test-suite/tests/session.test ("procedure-arguments"): New test prefix. Update `THANKS'. 2012-07-02 Ludovic Courtès <ludo@gnu.org> Remove backward-compatible `GC_PTR' definition. Fixes <http://bugs.gnu.org/11500>. Reported by Kevin J. Fletcher <dev@kjfletch.co.uk>. * libguile/bdw-gc.h (GC_PTR)[(defined GC_VERSION_MAJOR) && (GC_VERSION_MAJOR >= 7)]: Remove. 2012-07-02 Ludovic Courtès <ludo@gnu.org> Use `void *' instead of `GC_PTR' internally. * libguile/finalizers.c, libguile/foreign.c, libguile/guardians.c, libguile/hashtab.c, libguile/numbers.c, libguile/ports.c, libguile/smob.c, libguile/struct.c, libguile/vectors.c, libguile/weaks.c: Use `void *' instead of `GC_PTR'. 2012-07-02 Ludovic Courtès <ludo@gnu.org> doc: Remove reference to `closure?', now deprecated. Fixed <http://bugs.gnu.org/11611>. * doc/ref/api-procedures.texi (Procedure Properties): Remove reference to `closure?'. Suggested by David Jaquay <djaquay@gmail.com>. 2012-06-22 Andy Wingo <wingo@pobox.com> add char->integer, number->string etc to interesting primitives * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*effect-free-primitives*): Add string->number, number->string, integer->char, and char->integer to allow for constant folding and better effects analysis. update version-etc copyright year * module/ice-9/command-line.scm (version-etc): Update copyright year to 2012. 2012-06-22 Andy Wingo <wingo@pobox.com> cse: expressions evaluated for effect do not provide predicates * module/language/tree-il/cse.scm (cse): When trying to fold conditionals, only look at entries in the database that were added in test context. * test-suite/tests/cse.test ("cse"): Add a test case. 2012-06-22 Andy Wingo <wingo@pobox.com> scandir: select? takes basenames, operates on (sub)dirs also * module/ice-9/ftw.scm (scandir): Run the select? procedure on all items, including subdirs and the `.' and `..' entries. Pass it the basename of the file in question instead of the full name. * test-suite/tests/ftw.test ("scandir"): Adapt expectation for the .test selector. Add test for a selector that rejects everything. 2012-06-20 Ludovic Courtès <ludo@gnu.org> Fix possible deadlock upon `encoding-error' in `open-input-string'. Partly addresses <http://bugs.gnu.org/11197>. * libguile/strports.c (scm_mkstrport): Call `scm_port_non_buffer', set Z's cell type and stream, and release `scm_i_port_table_mutex' early. Reacquire `scm_i_port_table_mutex' once BUF, C_BUF, and STR_LEN are initialized. * test-suite/tests/ports.test ("string ports")["encoding failure leads to exception"]: New test. 2012-06-20 Ludovic Courtès <ludo@gnu.org> Make SRFI-6 string ports Unicode-capable. Partly addresses <http://bugs.gnu.org/11197>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * module/srfi/srfi-6.scm (open-input-string, open-output-string): New procedures. * test-suite/tests/srfi-6.test ("open-input-string")["read-char, Unicode"]: New test. ("open-output-string")["λ"]: New test. 2012-06-20 Ludovic Courtès <ludo@gnu.org> Update `THANKS'. 2012-06-20 Ludovic Courtès <ludo@gnu.org> Fix cross-compilation of GOOPS-using code. Fixes <http://bugs.gnu.org/11645>. Reported by Bogdan A. Marinescu <bogdan.a.marinescu@intel.com>. * module/oop/goops/dispatch.scm (compute-dispatch-procedure)[comp]: Wrap `compile' call in (with-target %host-type ...). 2012-06-09 Sjoerd van Leent <svanleent@gmail.com> Fix unbound variables and unbound values * module/language/ecmascript/base.scm: fix two wrong variable names and a wrong number of arguments in a function call. 2012-06-08 Ludovic Courtès <ludo@gnu.org> Fix invalid use of `SCM' as a Boolean. * libguile/deprecated.c (scm_sym2var): Check `scm_is_true (definep)'. 2012-06-08 Ludovic Courtès <ludo@gnu.org> Update (ice-9 match) from Chibi-Scheme. Fixes <http://bugs.gnu.org/10651>. * module/ice-9/match.upstream.scm: Update. 2012-05-31 Ludovic Courtès <ludo@gnu.org> Make `substitute' conversion strategy test portable. * test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy is soft"]: Split into the following tests. ["%default-port-conversion-strategy is escape", "%default-port-conversion-strategy is substitute"]: New tests. In the latter, add the escape form returned on FreeBSD 8.2 and Darwin 10.8.0. 2012-05-31 Ludovic Courtès <ludo@gnu.org> Fix port test that assumed string ports use the `error' conversion strategy. This is a followup to 9f6e3f5a997f484548bd03e7e7573c38a95c8d09 ("Have string ports honor `%default-port-conversion-strategy'."). * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Set %DEFAULT-PORT-CONVERSION-STRATEGY to 'error. Return #f when no exception is raised. ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Return #f when no exception is raised. 2012-05-31 Ludovic Courtès <ludo@gnu.org> Have string ports honor `%default-port-conversion-strategy'. * libguile/strports.c (scm_mkstrport): Remove initialization of `pt->ilseq_handler'. * module/ice-9/pretty-print.scm (truncated-print)[ellipsis]: Set %DEFAULT-PORT-CONVERSION-STRATEGY to 'error. * test-suite/tests/ports.test ("string ports")["%default-port-conversion-strategy is honored"]: New test. ["wrong encoding"]: Rename to... ["wrong encoding, error"]: ... this. Explicitly set %DEFAULT-PORT-CONVERSION-STRATEGY to 'error. Return #f when no exception is raised. 2012-05-31 Ludovic Courtès <ludo@gnu.org> Add the `%default-port-conversion-strategy' fluid. Fixes <http://bugs.gnu.org/11468>. * libguile/ports.c (scm_conversion_strategy): Remove. (default_conversion_strategy_var, sym_error, sym_substitute, sym_escape): New variables. (scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x): Remove. (scm_i_default_port_conversion_handler, scm_i_set_default_port_conversion_handler): New functions. (scm_port_conversion_strategy): Use `scm_i_default_port_conversion_handler' when PORT is #f. (scm_set_port_conversion_strategy_x): Use SYM_ERROR, SYM_SUBSTITUTE, and SYM_ESCAPE. Use `scm_i_set_default_port_conversion_handler' when PORT is #f. (scm_init_ports): Initialize DEFAULT_CONVERSION_STRATEGY_VAR. * libguile/ports.h: Update declarations accordingly. * libguile/foreign.c: Change `scm_i_get_conversion_strategy (SCM_BOOL_F)' to `scm_i_default_port_conversion_handler ()'. * libguile/strings.c: Likewise. * test-suite/tests/ports.test ("%default-port-conversion-strategy"): New test prefix. * test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy is error", "%default-port-conversion-strategy is soft"]: New tests. * test-suite/test-suite/lib.scm (exception:encoding-error): Allow the regexp to match `scm_to_stringn' error messages. * doc/ref/api-io.texi (Ports): Document `%default-port-conversion-strategy'. 2012-05-31 Ludovic Courtès <ludo@gnu.org> Access `pt->ilseq_handler' directly when needed. * libguile/print.c (PORT_CONVERSION_HANDLER): New macro. (print_extended_symbol, iprin1, write_character, scm_write_char): Use it instead of `scm_i_get_conversion_strategy'. * libguile/strports.c (scm_mkstrport): Assign `pt->ilseq_handler' directly instead of via `scm_i_set_conversion_strategy_x'. 2012-05-31 Ludovic Courtès <ludo@gnu.org> coverage: Add test for applicable structs. * test-suite/tests/coverage.test ("procedure-execution-count")["applicable struct"]: New test. 2012-05-23 Andy Wingo <wingo@pobox.com> finish deprecating eval closures * libguile/deprecated.h: * libguile/deprecated.c (scm_eval_closure_lookup) (scm_standard_eval_closure, scm_standard_interface_eval_closure) (scm_eval_closure_module): Deprecate these, as they are unused. * libguile/modules.h: * libguile/modules.c: Remove deprecated code. * module/oop/goops/util.scm (top-level-env, top-level-env?): Deprecate. * module/ice-9/deprecated.scm (set-system-module!): Deprecate. (module-eval-closure): Deprecate, by overriding the core definition to return a fresh eval closure. * module/ice-9/boot-9.scm (make-module): Don't set an eval closure on the module. (the-root-module, the-scm-module): Don't call set-system-module!. 2012-05-23 Andy Wingo <wingo@pobox.com> deprecate lookup closures * libguile/deprecated.h (SCM_TOP_LEVEL_LOOKUP_CLOSURE): * libguile/deprecated.c (scm_lookup_closure_module): (scm_module_lookup_closure): (scm_current_module_lookup_closure): Deprecate this part of the eval closure interface. It was unused internally, after the scm_sym2var refactor. * libguile/eval.h: * libguile/modules.c: * libguile/modules.h: Remove deprecated code. * libguile/goops.c (scm_ensure_accessor): Use scm_module_variable instead of calling the lookup closure. However I'm not sure that this code is used at all. 2012-05-23 Andy Wingo <wingo@pobox.com> deprecate scm_sym2var * libguile/deprecated.h: * libguile/deprecated.c (scm_sym2var): Deprecate this function. * libguile/modules.h: * libguile/modules.c (scm_module_ensure_local_variable): New public function, replacing scm_sym2var with a true definep, without going through eval closures (which are deprecated). (scm_current_module): Rework to do something sensible before modules are booted. (scm_module_lookup, scm_lookup): Refactor to use scm_module_variable. (scm_module_define, scm_define): Refactor to use scm_module_ensure_local_variable. * libguile/vm-i-system.c (define!): Use scm_define. * libguile/vm.c (resolve_variable): Use scm_module_lookup. * libguile/macros.c (scm_make_syntax_transformer): Use scm_module_variable. * libguile/gdbint.c (gdb_binding): Use scm_define. * doc/ref/api-modules.texi (Accessing Modules from C): Add docs for scm_module_ensure_local_variable. 2012-05-21 Andy Wingo <wingo@pobox.com> fix arity check for applicable structs * module/language/tree-il/analyze.scm (validate-arity): Fix for applicable structs. Applicable structs are procedures, but not every struct has a first slot, and not every struct with a procedure in its first slot is applicable. Besides, the approach in this patch gives better errors. rearrange scheme compilation order * module/Makefile.am (SOURCES): Move vlists, srfi-1, peval, and cse up in the compilation order. These are exercised a lot in the compiler. vm.c: remove a useless check * libguile/vm.c: Remove a check for modules being booted. If the module passed in is true, that is guaranteed to have been the case. Passes a fresh bootstrap. 2012-05-15 Ludovic Courtès <ludo@gnu.org> Add more `%file-port-name-canonicalization' tests. * test-suite/tests/ports.test ("%file-port-name-canonicalization")["relative canonicalization with /", "relative canonicalization from ice-9", "absolute canonicalization from ice-9"]: New tests. 2012-05-15 Ludovic Courtès <ludo@gnu.org> Fix relative file name canonicalization with empty %LOAD-PATH entries. * libguile/filesys.c (scm_i_relativize_path): Don't attempt to canonicalize when encountering an entry of IN_PATH that is the empty string. * test-suite/tests/ports.test (with-load-path): New macro. ("%file-port-name-canonicalization"): New test prefix. 2012-05-15 Andy Wingo <wingo@pobox.com> fix the cse tests * test-suite/tests/cse.test (pass-if-cse): Fix-letrec and canonicalize the output, so that unreferenced failure continuations get trimmed. ("cse"): Fix the two tests regarding bailout info. cse passes a lookup procedure to the effects analyzer * module/language/tree-il/cse.scm (cse): Arrange to pass a lookup procedure to compute-effects, for better effects analysis. better effects analysis for calls to lexically bound procedures * module/language/tree-il/effects.scm (make-effects-analyzer): The analyzer will take an optional second argument, a lookup procedure of type sym -> exp. This can let the analyzer dig into calls to lexically bound procedures. fix-letrec tweak * module/language/tree-il/fix-letrec.scm (make-sequence*, fix-letrec!): When turning unreferenced bindings into sequences, don't bother emitting trivially constant expressions in effect position. CSE in tail position * module/language/tree-il/cse.scm (singly-valued-expression?, cse): Allow CSE to propagate lexicals to tail positions, if the expression is singly-valued. 2012-05-15 Andy Wingo <wingo@pobox.com> stronger conditional optimization * module/language/tree-il/peval.scm (peval): If we can lift one common test, see if we can lift others as well. * test-suite/tests/peval.test: Add a test. 2012-05-15 Andy Wingo <wingo@pobox.com> optimization for chain of if expressions with common tests * module/language/tree-il/peval.scm (peval): Optimize common tests in chains of "if" expressions, like those generated by matchers. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2012-05-15 Andy Wingo <wingo@pobox.com> mvoe tree-il=? and tree-il-hash to tree-il.scm * module/language/tree-il.scm (tree-il=?, tree-il-hash): Move these helpers here, from cse.scm. Export them. * module/language/tree-il/cse.scm (cse): Adapt accordingly. 2012-05-14 Ludovic Courtès <ludo@gnu.org> Honor $(program_transform_name) for the `guile-tools' symlink. Fixes <http://bugs.gnu.org/11451>. Reported by Cyprien Nicolas <c.nicolas@gmail.com>. * meta/Makefile.am (install-data-hook): Honor $(program_transform_name). 2012-05-12 Ludovic Courtès <ludo@gnu.org> Have `-Wformat' remain quiet for any procedure called `_' or `N_'. * module/language/tree-il/analyze.scm (proc-ref?)[special?]: New procedure. Return #t for any toplevel-ref of `_'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext as top-level _"): New test. 2012-05-12 Ludovic Courtès <ludo@gnu.org> Have `-Warity-mismatch' handle applicable structs. * module/language/tree-il/analyze.scm (arity-analysis): Honor applicable structs. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("top-level applicable struct", "top-level applicable struct with wrong arguments"): New tests. 2012-05-12 Ludovic Courtès <ludo@gnu.org> Improve special-casing of `_' in `-Wformat'. * module/language/tree-il/analyze.scm (proc-ref?): Check for SPECIAL-NAME in the <module-ref> and <lexical-ref> cases too. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext as module-ref _", "non-literal format string using gettext as lexical _"): New tests. 2012-05-11 Andy Wingo <wingo@pobox.com> fix more assumptions that the frame-procedure is a procedure * libguile/frames.c (scm_frame_source, scm_frame_previous): * libguile/stacks.c (scm_make_stack): * module/ice-9/boot-9.scm (exception-printers): * module/system/vm/frame.scm (frame-call-representation): Fix more assumptions that frame-procedure is a program, or even a procedure. 2012-05-10 Andy Wingo <wingo@pobox.com> Merge remote-tracking branch 'origin/stable-2.0' into stable-2.0 2012-05-10 Andy Wingo <wingo@pobox.com> refactor vm application of non-programs; boot continuation refactor * libguile/frames.c (scm_frame_instruction_pointer): * module/system/vm/frame.scm (frame-bindings): (frame-next-source, frame-call-representation): Fix a few locations that thought that the frame-procedure will always be a VM procedure. This will not not be the case when traversing the stack of an application of a non-procedure. * libguile/vm-i-system.c (call, tail-call, mv-call): Instead of special-casing structs and smobs at these call sites, just set up the stack, and jump to a generic apply loop if the proc is not a program. * libguile/vm-engine.c: The generic apply loop is here. Also, the boot program is now simply a boot continuation, and can handle any number of arguments. * libguile/vm.c (make_boot_program): Update the code that makes the boot continuation. 2012-05-08 Ludovic Courtès <ludo@gnu.org> Add missing `SCM_API' for `scm_take_from_input_buffers'. * libguile/ports.h (scm_take_from_input_buffers): Add `SCM_API'. 2012-05-08 Ludovic Courtès <ludo@gnu.org> Fix `setvbuf' to leave the line/column number unchanged. * libguile/fports.c (scm_setvbuf): Use `scm_take_from_input_buffers' directly instead of `scm_drain_input'; use `scm_unget_byte' instead of `scm_unread_string' to put the drained input back to PORT. This leaves PORT's line/column numbers unchanged, whereas they'd previously be decreased by the `scm_unread_string' call. * libguile/ports.c (scm_take_from_input_buffers): Update description and variable names to refer to "bytes", not "chars". * test-suite/tests/ports.test ("setvbuf"): New test prefix. 2012-05-08 Andy Wingo <wingo@pobox.com> docbook->texi fix * module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Only convert ulink to uref if there is a URL attribute. 2012-05-07 Andy Wingo <wingo@pobox.com> (texinfo docbook) support for @acronym * module/texinfo/docbook.scm (*sdocbook->stexi-rules*): Recognize "acronym" as parsing to the @acronym texinfo command. 2012-05-07 Andy Wingo <wingo@pobox.com> add support for texinfo parsed arguments, like @acronym * module/texinfo.scm (texi-command-specs): Add a new kind of texinfo command, inline-text-args, a sort of a cross between inline-args, which are unparsed, and inline-text, which is. Perhaps this should supersede inline-args at some point. In any case, add acronym as an inline-text-args element. (inline-content?, arguments->attlist, complete-start-command) (parse-inline-text-args, make-dom-parser): Adapt for inline-text-args. * module/texinfo/serialize.scm (inline-text-args): Add serialization for @acronym. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add some tests. 2012-05-07 Andy Wingo <wingo@pobox.com> Add a missing SYNC_ALL in variable-ref * libguile/vm-i-system.c (variable-ref): Add a missing SYNC_ALL. 2012-05-07 Ludovic Courtès <ludo@gnu.org> Optimize `scm_read_string'. According to the new benchmarks, this leads a 5% speed improvement when reading small strings, and a 27% improvement when reading large strings. * libguile/read.c (READER_STRING_BUFFER_SIZE): Change to 128; update comment to mention codepoints. (scm_read_string): Make `str' a list of strings, instead of a string. Store characters read in buffer `c_str'. Cons to STR when C_STR is full, and concatenate/reverse at the end. * benchmark-suite/benchmarks/read.bm (small, large): New variables. Set %DEFAULT-PORT-ENCODING to "UTF-8". ("read")["small strings", "large strings"]: New benchmarks. 2012-05-06 Ludovic Courtès <ludo@gnu.org> Make `scm_unget_byte' public. * libguile/ports.h (scm_unget_byte): Make `SCM_API' instead of `SCM_INTERNAL'. read: Avoid `void *' pointer arithmetic. * libguile/read.c (read_complete_token): Make `new_buf' a `char *' to avoid pointer arithmetic on `void *'. Build with `-Wpointer-arith' when available. * configure.ac (POTENTIAL_GCC_CFLAGS): Add `-Wpointer-arith'. 2012-05-05 Ludovic Courtès <ludo@gnu.org> Correct typing of assertion in the `wind' instruction. * libguile/vm-i-system.c (wind): Check `scm_to_bool (scm_thunk_p (x))' instead of `scm_thunk_p'. 2012-05-04 Ludovic Courtès <ludo@gnu.org> Simplify the reader's `read_complete_token'. * libguile/read.c (read_token): Remove unneeded `const' before `size_t'. (read_complete_token): Remove `overflow_buffer' parameter; return `char *' instead of `int'. Allocate the overflow buffer with `scm_gc_malloc_pointerless' instead of `scm_malloc'. Return either the overflow buffer or BUFFER. (scm_read_number, scm_read_mixed_case_symbol, scm_read_number_and_radix): Rename `buffer' to `local_buffer', and `overflow_buffer' to `buffer'. Remove `overflow'. Adjust code to new `read_complete_token'. 2012-04-30 Andy Wingo <wingo@pobox.com> push error handlers out of line in the vm * libguile/vm.c: (vm_error): (vm_error_bad_instruction): (vm_error_unbound): (vm_error_unbound_fluid): (vm_error_not_a_variable): (vm_error_not_a_thunk): (vm_error_apply_to_non_list): (vm_error_kwargs_length_not_even): (vm_error_kwargs_invalid_keyword): (vm_error_kwargs_unrecognized_keyword): (vm_error_too_many_args): (vm_error_wrong_num_args): (vm_error_wrong_type_apply): (vm_error_stack_overflow): (vm_error_stack_underflow): (vm_error_improper_list): (vm_error_not_a_pair): (vm_error_not_a_bytevector): (vm_error_not_a_struct): (vm_error_no_values): (vm_error_not_enough_values): (vm_error_continuation_not_rewindable): (vm_error_bad_wide_string_length): (vm_error_invalid_address): (vm_error_object): (vm_error_free_variable): New internal helpers, implementing VM error handling. * libguile/vm-engine.h (VM_ASSERT): New helper macro. (ASSERT, CHECK_OBJECT, CHECK_FREE_VARIABLE): (PRE_CHECK_UNDERFLOW, PUSH_LIST): Use the new helper. * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Use VM_ASSERT and the out-of-line error handlers. * libguile/vm-engine.c (vm_engine): Remove inline error handlers, and remove a couple of local vars. Use VM_ASSERT. Have halt handle the return itself. 2012-04-30 Andy Wingo <wingo@pobox.com> add internal SCM_NOINLINE definition * libguile/_scm.h (SCM_NOINLINE): New internal define, for things that we definitely don't want the compiler to inline. add scm_c_values helper * libguile/values.h: * libguile/values.c (scm_c_values): New public helper. 2012-04-23 Andy Wingo <wingo@pobox.com> vlist performance improvements; allocate vhash data inline * module/ice-9/vlist.scm (make-block): If we are making a hash table, allocate it inline with the contents. Otherwise don't even add a pointer to the block. (block-hash-table?): New internal accessor. (block-ref*): Remove. Vhash entries are no longer wrapped. (block-ref): (block-hash-table-next-offset): (block-hash-table-set-next-offset!): (block-hash-table-ref): (block-hash-table-set!): (block-hash-table-add!): Adapt to take content vector explicitly, and to expect the hash table inline with the contents. Some of these accessors are new. Adapt callers. (assert-vlist): New helper. (vlist-cons): Update comment. (vhash?): Update scheme to allocate the hash table and chain links inline with the contents. (%vhash-fold*, %vhash-assoc): Rewrite to be more performant. 2012-04-23 Andy Wingo <wingo@pobox.com> avoid emitting degenerate aliases in peval * module/language/tree-il/peval.scm (<operand>, make-operand) (make-bound-operands, peval): Avoid emitting needless aliases in degenerate cases of let. (visit-operand): If we visit an operand with a fresh counter and have to abort, record that fact. * test-suite/tests/peval.test ("partial evaluation"): Add a test. 2012-04-23 Andy Wingo <wingo@pobox.com> vlist-cons micro-optimizations * module/ice-9/vlist.scm (set-block-next-free!): Define this instead of increment-block-next-free!. (block-append!): Refactor to take an offset, and only append if the offset is the next free value, and there is space in the block. (block-cons): Refactor to not be a loop. The partial evaluator would have to understand effects analysis in order to be able to unroll it, and there's at most one recursion. Recovers the performance loss resulting from the previous commit. 2012-04-23 Andy Wingo <wingo@pobox.com> slight vlist refactor * module/ice-9/vlist.scm: Use define-inlinable instead of define-inline, to ensure strict argument evaluation. There is a slight performance penalty, but I hope subsequent hacks make it up. 2012-04-23 Andy Wingo <wingo@pobox.com> fix replacement of CSE with lexical-ref * module/language/tree-il/cse.scm (cse): Fix dominator unrolling for lexical propagation. * test-suite/tests/cse.test ("cse"): Add test. 2012-04-23 Andy Wingo <wingo@pobox.com> cse hashing tweak * module/language/tree-il/cse.scm (cse): Minor tweak to hash depth based on time profile of compiling peval.scm. more inlining in effects.scm * module/language/tree-il/effects.scm (define-effects) (&no-effects, &all-effects-but-bailout): (cause, &depends-on, &causes, depends-on-effects?) (causes-effects?, effects-commute?): Add ham-fisted inlining. better primitives support for bit operations * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add lognot. (*effect-free-primitives*): Add ash, logand, logior, logxor, and lognot. (logior, logand): Define associative expanders. disable optimizations in goops dispatch procedures * module/oop/goops/dispatch.scm: Disable peval and cse. 2012-04-23 Andy Wingo <wingo@pobox.com> enable cse * module/language/tree-il/optimize.scm: Enable CSE unless #:cse? #f is passed. * test-suite/tests/tree-il.test: Disable CSE for one test. 2012-04-23 Andy Wingo <wingo@pobox.com> new pass: cse * module/language/tree-il/cse.scm: New pass, some simple common subexpression elimination with effects analysis. * test-suite/tests/cse.test: New test. * test-suite/Makefile.am: * module/Makefile.am: Adapt. 2012-04-23 Andy Wingo <wingo@pobox.com> minor tweaks to a peval test * test-suite/tests/peval.test: Update mutable var test to really ensure that the function can't inline. peval uses effects analysis * module/language/tree-il/peval.scm: Use effects analysis from (language tree-il effects) instead of our own constant-expression?. Eagerly mark assigned lexicals as non-copyable. add effects * module/language/tree-il/effects.scm: New module, for effects analysis. * module/Makefile.am: Adapt. 2012-04-23 Andy Wingo <wingo@pobox.com> peval tests into separate file * test-suite/tests/tree-il.test ("partial evaluation"): * test-suite/tests/peval.test ("partial evaluation"): Separate peval * tests. * test-suite/Makefile.am: Adapt. 2012-04-23 Andy Wingo <wingo@pobox.com> add more primitives and predicates to (language tree-il primitives) * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add number? and char?. Add more numeric predicates. Add character comparators. Add throw, error, and scm-error. (*primitive-accessors*): Remove struct-vtable. Though the vtable's contents may change (through redefinition), its identity does not change. (*effect-free-primitives*): Put struct-vtable, number?, and char? here. (*multiply-valued-primitives*): Instead of listing singly-valued primitives, list multiply-valued primitives. (*bailout-primitives*): New list. (*negatable-primitives*): New alist. (*bailout-primitive-table*, *multiply-valued-primitive-table*) (*negatable-primitive-table*): New tables. (singly-valued-primitive?): Adapt to use *multiply-valued-primitive-table*. (bailout-primitive?, negate-primitive): New exported procedures. modernize (benchmark-suite lib) * benchmark-suite/benchmark-suite/lib.scm: Rewrite to be more modern, using parameters, records, and higher precision timers. Since this file was never installed, this is an acceptable interface change. (run-benchmark): Run the thunk once before going into the benchmark. Adapt to new `report' interface. (report): Change to expect only one argument, a <benchmark-result> object. (print-result): Adapt. The result is in the same format as before. (print-user-result): Adapt. The result is different from before, but as this is just printed on stdout and not logged, there should be no problem. (calibrate-benchmark-framework): Pull initialization into a function. avoid inexact iteration count in benchmarks * benchmark-suite/benchmarks/arithmetic.bm: * benchmark-suite/benchmarks/r6rs-arithmetic.bm: Use #e1e7 for the iteration count, instead of the flonum 1e7. 2012-04-23 Andy Wingo <wingo@pobox.com> move (test-suite lib) to lower dir; cleans up uninstalled paths. * check-guile.in: * test-suite/Makefile.am: * test-suite/test-suite/lib.scm: * benchmark-guile.in: * benchmark-suite/Makefile.am: * benchmark-suite/benchmark-suite/lib.scm: Lower the lib modules in the source tree. This lets us remove top_srcdir and top_builddir from the uninstalled paths. * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/brainfuck.test: * test-suite/tests/compiler.test: * test-suite/tests/ftw.test: * test-suite/tests/gc.test: * test-suite/tests/match.test: * test-suite/tests/rnrs-libraries.test: * test-suite/tests/rnrs-test-a.scm: * test-suite/tests/sxml.match.test: Adapt to not expect that module names be prefixed with "test-suite". 2012-04-22 Ludovic Courtès <ludo@gnu.org> Thank Klaus. 2012-04-22 Ludovic Courtès <ludo@gnu.org> bytevectors: Fix IEEE-754 endianness conversion. Fixes <http://bugs.gnu.org/11310>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * libguile/ieee-754.h: Remove. * libguile/Makefile.am (noinst_HEADERS): Remove `ieee-754.h'. * libguile/bytevectors.c (scm_ieee754_float, scm_ieee754_double): New unions. (float_to_foreign_endianness, float_from_foreign_endianness, double_to_foreign_endianness, double_from_foreign_endianness): Rewrite in terms of the new unions. * test-suite/tests/bytevectors.test ("2.8 Operations on IEEE-754 Representations")["single, little endian", "single, big endian", "double, little endian", "double, big endian"]: New tests. 2012-04-22 Ludovic Courtès <ludo@gnu.org> Fix and clarify documentation of `sorted?'. Fixed <http://bugs.gnu.org/11262>. Reported by Alexei Matveev <alexei.matveev@gmail.com>. * libguile/sort.c (scm_sorted_p): Fix and clarify docstring. * doc/ref/api-utility.texi (Sorting): Update accordingly. 2012-04-22 Ludovic Courtès <ludo@gnu.org> Remove duplicate test in `tree-il.test'. * test-suite/tests/tree-il.test ("partial evaluation"): Remove duplicate test for `(cons 0 (cons 1 (cons 2 (list 3 4 5))))'. 2012-04-12 Ludovic Courtès <ludo@gnu.org> Avoid use of `GC_PTR' in "smob.h". Commit c46fee438cf9f4a3449e8d04e7a54805517fd092 removed the "bdw-gc.h" include from "smob.h", so better avoid `GC_PTR'. * libguile/smob.c (scm_i_finalize_smob): Use `void *' instead of `GC_PTR'. * libguile/smob.h (scm_i_finalize_smob): Update declaration accordingly. 2012-04-10 Ludovic Courtès <ludo@gnu.org> SRFI-9: Set the `record-constructor' slot of the RTD. Fixed <http://bugs.gnu.org/11196>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * module/srfi/srfi-9.scm (define-record-type): Define the contructor before TYPE-NAME. Set RTD's constructor field. * test-suite/tests/srfi-9.test ("record compatibility"): New test prefix. 2012-04-05 Mark H Weaver <mhw@netris.org> Fix scm_to_utf8_stringn once and for all; optimize; add tests * libguile/strings.c (scm_to_utf8_stringn): Fix another new bug in this recent comedy of errors: pass the size of the preallocated buffer to u32_to_u8. Arrange to call 'scm_i_string_wide_chars' and 'scm_i_string_length' only once each. Rename local variables for improved code clarity. * test-suite/standalone/test-conversion.c (test_to_utf8_stringn): New function to test scm_to_utf8_stringn. 2012-04-03 Mark H Weaver <mhw@netris.org> Fix scm_to_utf8_stringn to NUL-terminate properly * libguile/strings.c (scm_to_utf8_stringn): NUL-terminate using the correct pointer. 2012-04-03 Mark H Weaver <mhw@netris.org> Fix scm_to_utf8_stringn to return the length in bytes, et al * libguile/strings.c (u32_u8_length_in_bytes): Internal static function renamed from u32_u8_strlen, whose name was potentially confusing. For added safety, handle everything that can be encoded in the more general UTF-8 encoding: up to six bytes for each code point, with code points up to 2^31-1. (scm_to_utf8_stringn): NUL-terminate only if (lenp == NULL). If (lenp != NULL) return the length in bytes in *lenp. 2012-04-01 Andy Wingo <wingo@pobox.com> fix scm_to_utf8_stringn for wide strings to NUL-append the strings * libguile/strings.c (u32_u8_strlen, scm_to_utf8_stringn): Sigh, fix the u32-to-u8 optimization to ensure that the utf8 string is NUL-terminated. 2012-03-24 BT Templeton <bpt@hcoop.net> primitive resolution for public refs * module/language/tree-il/primitives.scm (resolve-primitives!): Resolve public module-refs to primitives. * test-suite/tests/tree-il.test: New tests for primitive resolution. 2012-03-22 Andy Wingo <wingo@pobox.com> add bad-request printer * module/web/request.scm (bad-request-printer): Add printer for these exceptions. add exception printers for bad-header, bad-header-component * module/web/http.scm (bad-header-component): Throw 'bad-header-component instead of 'bad-header. (bad-header-printer, bad-header-component-printer): Add exception printers. 2012-03-22 Andy Wingo <wingo@pobox.com> micro-optimizations to string-trim-both, and to (web http) * libguile/srfi-13.c (scm_string_trim, scm_string_trim_right) (scm_string_trim_both): Take the whitespace fast-path if the char_pred is scm_char_set_whitespace. * module/web/http.scm (read-header, split-and-trim, parse-quality-list): (parse-param-component, parse-credentials, "Content-Type"): (read-request-line, read-response-line): Use char-set:whitespace instead of char-whitespace?. It avoids recursing into the VM. 2012-03-18 Andy Wingo <wingo@pobox.com> make applicable smob calls cheaper, and fix a memory leak * libguile/vm.c (prepare_smob_call): New helper. Now, instead of making a per-smob trampoline, we will shuffle the smob into the args and use a gsubr. This prevents a memory leak in which the trampolines, which were values in a weak-key table, were preventing the smobs from being collected. * libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob application mechanism. (smob-call): Remove this instruction. * libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode to apply_trampoline. * libguile/smob.c: Remove our own objcode trampolines in favor of using scm_c_make_gsubr. (scm_smob_prehistory): No more trampoline weak map. * libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob representation change. 2012-03-12 Andy Wingo <wingo@pobox.com> web http: fix Ma -> Mar * module/web/http.scm (write-date): Fix serialization of Mar. Oops. 2012-03-11 Andy Wingo <wingo@pobox.com> web server http: 400 Bad Request on bad requests * module/web/server/http.scm (bad-request, http-read): If an exception is raised while reading a response, write out a 400 Bad Request response before closing the port. 2012-03-08 Andy Wingo <wingo@pobox.com> more libgc 7.1 compat * configure.ac: * libguile/gc.c (GC_set_finalize_on_demand): Check for this function, and shim if it isn't present. 2012-03-08 Andy Wingo <wingo@pobox.com> run finalizers asynchronously in asyncs * libguile/finalizers.c: New excitement! We'll be running finalizers asynchronously, from asyncs. This will make it safer to allocate while holding a mutex. (GC_set_finalizer_notifier): Add back-compat shim. * libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism during boot. * libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing on demand. (scm_gc): Explicitly run finalizers here. * libguile/threads.c (guilify_self_2): Run finalizers here if queue_finalizer_async happened to run during guilify_self_1. * configure.ac: Add check for GC_set_finalizer_notifier. 2012-03-08 Andy Wingo <wingo@pobox.com> use the new finalizer helpers * libguile/foreign.c (scm_set_pointer_finalizer_x) * libguile/ports.c (finalize_port) * libguile/smob.c (scm_i_new_smob, scm_i_new_double_smob) * libguile/struct.c (scm_i_alloc_struct) * libguile/numbers.c (make_bignum): Use the new API. 2012-03-08 Andy Wingo <wingo@pobox.com> add scm_i_set_finalizer, scm_i_add_finalizer, scm_i_add_resuscitator * libguile/finalizers.h: * libguile/finalizers.c: New files. * libguile.h: * libguile/Makefile.am: Add to build. 2012-03-08 Andy Wingo <wingo@pobox.com> scm_new_smob, scm_new_double_smob inline functions * libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors, which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline functions instead of macros. They also bail to scm_i_new_smob / scm_i_new_double_smob in either the mark or the free case, so that the inline definition doesn't reference other internal details like libgc stuff. (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see them as already being declared. (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2): (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new inline functions. Remove now-unneeded bdw-gc include. * libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and make static. (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators. (scm_i_finalize_smob, scm_i_new_smob_with_mark_proc): Add back-compatibility shims to preserve ABI. * libguile/inline.c: Include smob.h, so as to reify scm_new_smob and scm_new_double_smob. 2012-03-08 Andy Wingo <wingo@pobox.com> scm_cell, scm_double_cell, scm_words back to gc.h * libguile/inline.h: * libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move declarations and definitions back here, from inline.h. It's more natural. * libguile/inline.c: Include gc.h as well. 2012-03-08 Andy Wingo <wingo@pobox.com> simplify inline function infrastructure * libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here, from inline.h. We'd like to support inline function definitions in more header files: not just inline.h. (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New definitions. * libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these wrappers, which redirect to the GC_MALLOC macros when building Guile, and the scm_gc_malloc functions otherwise. A step towards getting BDW-GC out of Guile's API. * libguile/inline.h: Simplify, using SCM_INLINE, SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES. Also use the new SCM_GC_MALLOC macros. 2012-03-08 Ian Price <ianprice90@googlemail.com> Fix flush on soft ports, so that it actually runs. * libguile/vports.c (sf_flush): Remove conditional testing the position in the port's write_buf, as it is no longer used. 2012-03-07 Ludovic Courtès <ludo@gnu.org> Improve port benchmark. * benchmark-suite/benchmarks/ports.bm (sequence): New macro, formerly local to the "rdelim" benchmark prefix. (large-string): New procedure. (%latin1-port, %utf8/ascii-port, %utf8/wide-port): Use it. ("peek-char", "char-ready?", "read-char"): Use `sequence'. 2012-03-07 Giuseppe Scrivano <giuseppe@southpole.se> Fix a segfault when /dev/urandom is not accessible * libguile/init.c (scm_i_init_guile): Call `scm_init_random' before `scm_init_macros'. 2012-03-05 Andy Wingo <wingo@pobox.com> deprecate close-io-port * module/ice-9/r4rs.scm: * module/ice-9/deprecated.scm (close-io-port): Deprecate. 2012-03-05 Mark H Weaver <mhw@netris.org> Don't call SYMBOL_STRINGBUF on a string * libguile/strings.c (scm_i_make_symbol): Use STRING_STRINGBUF instead of SYMBOL_STRINGBUF to get the stringbuf of a string. Remove documentation of internal static string comparison functions * doc/ref/api-data.texi (String Comparison): Remove documentation for scm_i_string{,_ci}_{equal,less,leq,gr,geq}_p, which are not only internal functions but static, and thus unusable by external code. 2012-03-04 Mark H Weaver <mhw@netris.org> Comment out unused definitions of 'do' and 'case' in psyntax.scm * module/ice-9/psyntax.scm (do, case): Comment out these definitions, which are never used and immediately replaced by definitions in boot-9.scm. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-03-04 Mark H Weaver <mhw@netris.org> Fix syntax wrap comments; remove old unused cruft * module/ice-9/psyntax.scm (subst-rename?, rename-old, rename-new, rename-marks, make-rename): Remove these unused syntax rules. Fix description of syntax wraps to match current reality. 2012-03-04 Mark H Weaver <mhw@netris.org> Minimize size of embedded syntax objects in psyntax-pp.scm * module/ice-9/compile-psyntax.scm: Minimize syntax object literals embedded in psyntax-pp.scm. * module/ice-9/psyntax.scm: Rename a few variables so that syntax objects embedded in macros have no lexical bindings, so that their minimized syntax objects will have no embedded labels. These labels were the last remaining gensym counters in psyntax-pp.scm. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than one quarter of its previous size! More importantly, this file no longer contains any gensym counters, which means that in the future, local changes to psyntax.scm will usually result in only local changes to psyntax-pp.scm. 2012-03-04 Mark H Weaver <mhw@netris.org> tree-il->scheme improvements * module/language/tree-il.scm (tree-il->scheme): New implementation that simply calls 'decompile-tree-il'. * module/language/scheme/decompile-tree-il.scm (choose-output-names, do-decompile): New internal procedures. (decompile-tree-il): New and improved implementation. Print source identifiers where possible, otherwise add minimal numeric suffixes. Previously we printed the gensyms. Avoid 'begin' in contexts that provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or', 'let*', named let, and internal defines where appropriate. Recognize keyword arguments in 'opts' to disable the production of these derived syntactic forms, and to optionally strip numeric suffixes from variable names. * module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec fixing, and primitive expansion when producing psyntax-pp.scm, in order to produce output as close to the original source as practical. Disable production of derived syntactic forms as needed during bootstrap. Strip numeric suffixes from variable names. Adjust pretty-printing parameters. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half of the original size. 2012-03-03 Mark H Weaver <mhw@netris.org> pretty-print: allow max-expr-width to be set; recognize more keywords * module/ice-9/pretty-print.scm (pretty-print): Add new keyword argument '#:max-expr-width'. (generic-write): Add new argument 'max-expr-width'. Previously this was internally defined to the constant value 50. 2012-03-03 Mark H Weaver <mhw@netris.org> Fix typos in psyntax.scm * module/ice-9/psyntax.scm (gen-syntax-case): #'pad --> #'pat (define*): #'x --> #'id * module/ice-9/psyntax-pp.scm: Regenerate 2012-03-02 Andy Wingo <wingo@pobox.com> tweaks to -Wformat's gettext detection * module/language/tree-il/analyze.scm (proc-ref?): Change to use less false-if-exception and more variable-bound?. If a variable is present in the local module but not bound, assume that it is gettext if it has the right name. This is to allow for (define _ gettext). * test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example. 2012-03-02 Andy Wingo <wingo@pobox.com> peval: inline applications of lambda to rest args * module/language/tree-il/peval.scm (peval): Add optimization to hoist the inner procedure out of e.g. (lambda args (apply (lambda ...) args)) This commit restores the ability to detect escape-only prompts at compile-time. * test-suite/tests/tree-il.test: Update test for prompt with a lambda, and add a specific test for lambda application. 2012-03-02 Andy Wingo <wingo@pobox.com> tree-il: fix `canonicalize!' for prompts * module/language/tree-il/canonicalize.scm (canonicalize!): Fix a bug in which the sense of `escape-only?' was reversed. We never saw this though, because for other reasons, no prompts were being identified as escape-only. more general treatment of call-with-prompt * module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't limit the call-with-prompt to <prompt> transition to lambda expressions. Instead we can lexically bind the handler, and rely on peval to propagate a lambda expression. 2012-03-01 Mark H Weaver <mhw@netris.org> pmatch: always wrap with let, even if the expression appears atomic * module/system/base/pmatch.scm (pmatch): Always wrap with 'let', even if the expression appears atomic, because in the presence of 'identifier-syntax', we cannot know what an atomic expression will later expand to. Also use '#:export-syntax' instead of '#:export' to export 'pmatch'. 2012-03-01 Mark H Weaver <mhw@netris.org> Fix <TAG>vector-length when applied to other uniform vector types * module/srfi/srfi-4.scm, module/srfi/srfi-4/gnu.scm (define-bytevector-type): Fix definition of <TAG>vector-length when applied to uniform vectors of different element sizes. Thanks to Tobias Brandt <tob.brandt@googlemail.com> for reporting this bug. * test-suite/tests/srfi-4.test: Add tests. 2012-02-27 Ludovic Courtès <ludo@gnu.org> Avoid failure when `format-analysis' stumbles upon unbound variables. * module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref' in `false-if-exception'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string with forward declaration"): New test. 2012-02-24 Andy Wingo <wingo@pobox.com> srfi-18 test fix * test-suite/tests/srfi-18.test: Enclose the tests in a begin instead of an and. Before, they were not being run, for some reason I don't fully understand. slight cleanup to run-test * test-suite/lib.scm (run-test): Slight cleanup. 2012-02-23 Andy Wingo <wingo@pobox.com> rewrite open-process in C, for robustness * libguile/posix.c (scm_open_process): Rewrite in C, so as to avoid allocations and other calls that are not async-signal-safe. (scm_init_popen, scm_init_posix): Register popen extension. * module/ice-9/popen.scm: Load the popen extension, to get open-process. 2012-02-22 Andy Wingo <wingo@pobox.com> microoptimizations in (web uri) * module/web/uri.scm (valid-host?): Micro-optimizations. add test for recent quick fix * test-suite/tests/web-uri.test ("string->uri"): Add test for string->uri with hosts beginning in digits. 2012-02-21 Andy Wingo <wingo@pobox.com> quick fix the quick fix quick fix to uri parser * module/web/uri.scm: Quick fix to not throw an error on e.g. http://2012.jsconf.us. 2012-02-19 Ludovic Courtès <ludo@gnu.org> Have `-Wformat' recognize `ngettext' calls. * module/language/tree-il/analyze.scm (gettext?): Rename to... (proc-ref?): ... this. Add `proc' and `special-name' parameters. (gettext?): Define in terms of `proc-ref?'. (ngettext?): New procedure. (const-fmt): Recognize `ngettext' calls. (format-analysis)[<down>](check-format-args]: Check constant-but-non-string 2nd argument in the (not (const-fmt ...)) case. [check-simple-format-args]: Use `const-fmt'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using ngettext", "non-literal format string using ngettext as N_"): New tests. ("simple-format")["unsupported, ngettext"]: New test. 2012-02-19 Ludovic Courtès <ludo@gnu.org> Have `-Wformat' better recognize the `gettext' procedure. Fixes <http://bugs.gnu.org/10846>. Reported by Bruno Haible <bruno@clisp.org>. * module/language/tree-il/analyze.scm (gettext?): New procedure. (const-fmt): Add `env' parameter; update callers. Use `gettext?'. (format-analysis)[check-simple-format-args]: Actually support gettextized format strings. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext"): Use `gettext' as the procedure name. ("non-literal format string using gettext as _"): New test. ["simple-format"]("unsupported, gettext"): New test. 2012-02-18 Ludovic Courtès <ludo@gnu.org> Don't fail when locale env. vars specify a dot-less locale name. Fixes <http://bugs.gnu.org/10742>. Reported by Alírio Eyng <alirioeyng@ig.com.br>. * gnulib-local/lib/localcharset.c.diff (environ_locale_charset): Change to set CODESET to "" when LOCALE lacks a dot. Return "ISO-8859-1" when CODESET is the empty string. * lib/localcharset.c: Update. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add `test-command-line-encoding2'. (TESTS): Likewise. * test-suite/standalone/test-command-line-encoding2: New file. 2012-02-15 Mark H Weaver <mhw@netris.org> Add tests to verify that 'read' sets source properties when appropriate * test-suite/tests/srcprop.test (source properties): Add tests. 2012-02-15 Mark H Weaver <mhw@netris.org> Add support for source properties on non-immediate numbers * libguile/read.c (scm_read_number): Set source properties on non-immediate numbers if the 'positions' reader option is set. * doc/ref/api-debug.texi (Source Properties): Update manual. 2012-02-15 Mark H Weaver <mhw@netris.org> psyntax: access source properties for all supported objects * module/ice-9/psyntax.scm (decorate-source): Set source properties on any object that satisfies 'supports-source-properties?'. Previously we used 'pair?' as the predicate. (source-annotation): Apply 'source-properties' to _any_ kind of source expression, where previously only pairs were queried. If the argument is a syntax-object, apply the source-properties to the syntax-object's expression. In the peculiar case of a syntax-object whose expression is also a syntax-object: previously we would iterate, but with this commit we now call 'syntax-object-expression' only once. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-02-15 Mark H Weaver <mhw@netris.org> Add 'supports-source-properties?' predicate * libguile/srcprop.c (scm_supports_source_properties_p): New procedure. (supports_source_props): New static C function. * libguile/srcprop.h (scm_supports_source_properties_p): Add prototype. * doc/ref/api-debug.texi (Source Properties): Add documentation. 2012-02-15 Mark H Weaver <mhw@netris.org> Relax validation of source property accessors * libguile/srcprop.c (scm_source_properties, scm_source_property, scm_i_has_source_properties): Relax validation to allow _any_ object to be queried for source properties. 2012-02-15 Mark H Weaver <mhw@netris.org> syntax-violation: prefer 'subform' for source info, with 'form' as fallback * module/ice-9/psyntax.scm (syntax-violation): Look for source properties of 'subform' first. If 'subform' has none, 'form' is used. Previously, the source information of 'form' was used unless 'form' _itself_ was '#f', in which case 'subform' was used. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-02-15 Mark H Weaver <mhw@netris.org> Fix psyntax bugs that would cause bad source annotations * module/ice-9/psyntax.scm (rebuild-macro-output): Fix two bugs that would cause bogus source properties to be added to vectors and macro-introduced syntax objects. These bugs were masked by the limitation that only pairs can be decorated with source properties. Due to a typo, each vector in the macro output was decorated using the vector itself as its source. Due to accidental variable capture, each syntax-object introduced by the macro had its expression decorated with its own wrap-subst. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-02-15 Mark H Weaver <mhw@netris.org> Fix typo in comment in message.scm: 'know' to 'known' warning types * module/system/base/message.scm (%warning-types): Fix typo. 2012-02-14 Andy Wingo <wingo@pobox.com> web server: fix spurious warning * module/web/server.scm (sanitize-response): Quick fix to the 304-has-no-body sanitizer. 2012-02-12 Mark H Weaver <mhw@netris.org> Fix manual: scm_foreign_to_bytevector to scm_pointer_to_bytevector * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix outdated function name: scm_foreign_to_bytevector to scm_pointer_to_bytevector. 2012-02-12 Andy Wingo <wingo@pobox.com> web server: do not provide a response body where it is not permitted * module/web/response.scm (response-must-not-include-body?): New function. * doc/ref/web.texi: Doc the function. * module/web/server.scm (sanitize-response): Error if we have a body, but the response type does not permit a body. If we are responding to a HEAD request, silently drop the body. 2012-02-11 Andy Wingo <wingo@pobox.com> web server: print backtrace on errors when run in batch mode * module/web/server.scm (read-client, handle-request, write-client): When run in batch mode, give a full backtrace for errors. 2012-02-10 Andy Wingo <wingo@pobox.com> more efficient scm_string_to_utf8, scm_string_to_utf32 * libguile/bytevectors.c (scm_string_to_utf8): More efficient implementation. (scm_string_to_utf32): Likewise. more efficient scm_to_utf8_stringn, scm_to_utf32_stringn * libguile/strings.c (scm_to_utf8_stringn): More efficient implementation than calling scm_to_stringn. (scm_to_utf32_stringn): Likewise. 2012-02-08 Mark H Weaver <mhw@netris.org> Support => within case, and improve error messages for cond and case * module/ice-9/boot-9.scm (cond, case): Reimplement using syntax-case, with improved error messages and support for '=>' within 'case' as mandated by the R7RS. Add warnings for duplicate case datums and case datums that cannot be meaningfully compared using 'eqv?'. * module/system/base/message.scm (%warning-types): Add 'bad-case-datum' and 'duplicate-case-datum' warning types. * test-suite/tests/syntax.test (cond, case): Update tests to reflect improved error reporting. Add tests for '=>' within 'case'. * test-suite/tests/tree-il.test (partial evaluation): Update tests to reflect changes in how 'case' is expanded. * doc/ref/api-control.texi (Conditionals): Document '=>' within 'case'. 2012-02-08 Mark H Weaver <mhw@netris.org> Add source properties to many more types of data * libguile/read.c (scm_read_array): New internal helper that calls scm_i_read_array and sets its source property if the 'positions' reader option is set. (scm_read_string): Set source properties on strings if the 'positions' reader option is set. (scm_read_vector, scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bitvector, scm_read_sharp): Add new arguments for the 'line' and 'column' of the first character of the datum being read. Set source properties if the 'positions' reader option is set. (scm_read_expression): Pass 'line' and 'column' to scm_read_sharp. * doc/ref/api-debug.texi (Source Properties): Update manual. 2012-02-08 Mark H Weaver <mhw@netris.org> Unoptimize 'read' to return freshly allocated empty strings * libguile/read.c (scm_read_string): Return a freshly allocated string every time, even for empty strings. The motivation is to allow source properties to be added to all strings. Previously, the shared global 'scm_nullstr' was returned for empty strings. Note that empty strings still share a common global 'null_stringbuf'. * test-suite/tests/srfi-13.test (substring/shared): Fix tests to reflect the fact that empty string literals are no longer guaranteed to be 'eq?' to each other. 2012-02-08 Mark H Weaver <mhw@netris.org> Optimize empty substring case of scm_i_substring_copy * libguile/strings.c (scm_i_substring_copy): When asked to create an empty substring, use 'scm_i_make_string' to make use of its optimization for empty strings that reuses the global null_stringbuf. Add and use maybe_annotate_source helper in read.c * libguile/read.c (maybe_annotate_source): New static helper function. (scm_read_sexp, scm_read_quote, scm_read_syntax): Use 'maybe_annotate_source'. Remove inline and register attributes from read.c * libguile/read.c: Remove all 'inline' and 'register' attributes. Remove incorrect comment in read.c * libguile/read.c (scm_read_sharp): Remove incorrect comment that claims that scm_read_boolean might return a SRFI-4 vector. 2012-02-08 Andy Wingo <wingo@pobox.com> i18: avoid freelocale (NULL) * libguile/i18n.c (smob_locale_free): Don't freelocale (NULL). 2012-02-05 Andy Wingo <wingo@pobox.com> Fix --enable-debug-malloc * libguile/gc-malloc.c (do_realloc, do_calloc, do_gc_malloc) (do_gc_malloc_atomic, do_gc_realloc, do_gc_free): Wrap the allocators in helper methods. The non-GC allocators call scm_gc_register_allocation, and the GC allocators ensure that gc_malloc returns a nonzero value. (scm_realloc, scm_calloc): Allow NULL return for malloc(0). It is permitted by POSIX. Don't wrap in a SCM_SYSCALL; the only possible errno is ENOMEM. (scm_gc_malloc_pointerless, scm_gc_malloc, scm_gc_calloc): (scm_gc_realloc, scm_gc_free, scm_gc_strndump): Use the wrappers. Don't call the debug-malloc registrations and deregistrations, as it is neither mandatory nor advised to call scm_gc_free. Fixes compilation with debug-malloc. (scm_must_free): Don't scm_malloc_unregister. 2012-02-04 Ludovic Courtès <ludo@gnu.org> i18n: Skips ~h `format' tests when digit grouping info is missing. * test-suite/tests/i18n.test ("format ~h"): Skip tests when `locale-digit-grouping' returns '(). 2012-02-04 Andy Wingo <wingo@pobox.com> fix check for when libc already has clock_gettime / clock_getcpuclockid * acinclude.m4 (gl_CLOCK_TIME): If both clock_gettime and clock_getcpuclockid are present without -lrt and -lposix4, don't add any libs to LIB_CLOCK_GETTIME. Thanks to taylanbarirli@gmail.com. 2012-02-04 Bake Timmons <b3timmons@speedymail.org> Improve consistency of definitions of C functions in manual. * doc/ref/api-compound.texi * doc/ref/api-evaluation.texi * doc/ref/api-foreign.texi * doc/ref/api-io.texi * doc/ref/posix.texi * doc/ref/srfi-modules.texi: Add missing parentheses and commas to definitions of C functions. * doc/ref/api-data.texi: Change from @deffn to @deftypefn for C function with arguments not of SCM type. 2012-02-04 Andy Wingo <wingo@pobox.com> fix compilation of control.c, continuations.c when SCM_ALIGNED is not defined * libguile/control.c: * libguile/continuations.c: Fix for the case in which SCM_ALIGNED is not defined. Though I wonder, perhaps we should just error out in those cases. 2012-02-04 Bake Timmons <b3timmons@speedymail.org> Make notation for Scheme repeated arguments more consistent in manual. * doc/ref/api-compound.texi * doc/ref/api-control.texi * doc/ref/api-data.texi * doc/ref/api-debug.texi * doc/ref/api-evaluation.texi * doc/ref/api-macros.texi * doc/ref/api-memory.texi * doc/ref/api-modules.texi * doc/ref/api-procedures.texi * doc/ref/api-regex.texi * doc/ref/api-scheduling.texi * doc/ref/api-utility.texi * doc/ref/goops.texi * doc/ref/match.texi * doc/ref/misc-modules.texi * doc/ref/posix.texi * doc/ref/r6rs.texi * doc/ref/scheme-using.texi * doc/ref/srfi-modules.texi * doc/ref/sxml-match.texi: Make notation for Scheme repeated arguments more consistent in manual. 2012-02-03 Ludovic Courtès <ludo@gnu.org> i18n: Provide default values for when Gnulib has no replacement. This reverts parts of a0919aefee7512686c3374876df2c549fd47e071 ("i18n: Use Gnulib's `nl_langinfo' module."). * module/ice-9/i18n.scm (define-simple-langinfo-mapping): Re-add `default' parameter, and update users accordingly. 2012-02-03 Ludovic Courtès <ludo@gnu.org> Augment `-Wformat' analysis with support for `~:h'. * module/language/tree-il/analyze.scm (format-string-argument-count): Add support for ~h. * test-suite/tests/tree-il.test ("warnings")["format"]("~h", "~:h with locale object", "~:h without locale object"): New tests. 2012-02-03 Ludovic Courtès <ludo@gnu.org> format: Add specifier ~h for localized number output. * doc/ref/misc-modules.texi (Formatted Output): Document ~h. Recommend use of ~h instead of ~:d. * module/ice-9/format.scm (format): Add support for ~h. * test-suite/tests/format.test ("~h localized number"): New test prefix. * test-suite/tests/i18n.test (%american-english-locale-name, %american-english-locale): New variables. (under-american-english-locale-or-unresolved): New procedure. ("format ~h"): New test prefix. 2012-02-03 Ludovic Courtès <ludo@gnu.org> i18n: Add a couple of tests for `monetary-amount->locale-string'. * test-suite/tests/i18n.test ("monetary-amount->locale-string"): New test prefix. 2012-02-03 Ludovic Courtès <ludo@gnu.org> i18n: Use Gnulib's `nl_langinfo' module. * configure.ac: Remove checks for <langinfo.h> and <nl_types.h>, and `nl_langinfo'. * libguile/i18n.c: Remove #ifdefs for HAVE_LANGINFO_H, HAVE_NL_TYPES_H, HAVE_NL_ITEM, and HAVE_LANGINFO_CODESET. (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): Use `SCM_UNBNDP'. * m4/gnulib-cache.m4 (gl_MODULES): Add `nl_langinfo'. * module/ice-9/i18n.scm (define-vector-langinfo-mapping): Remove `defaults' parameter; assume (provided? 'nl-langinfo) is always true. Update users accordingly. (define-simple-langinfo-mapping): Likewise. (define-monetary-langinfo-mapping): Likewise, but do not assume LOCAL-ITEM and INTL-ITEM are always defined. 2012-02-03 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `regex' module. This should help with regex portability, as reported in <http://bugs.gnu.org/10684> for Darwin 8.11. * m4/gnulib-cache.m4 (gl_MODULES): Add `regex'. * configure.ac: Remove header checks for regex.h, rxposix.h, and rx/rxposix.h. Remove check for the `regcomp' function. Remove definition of `HAVE_REGCOMP'. Define `ENABLE_REGEX'. * libguile/init.c: Check for `ENABLE_REGEX' instead of `HAVE_REGCOMP'. * libguile/regex-posix.c: Always include <regex.h>. Remove #ifdefs for rxposix.h and co. 2012-02-03 Ludovic Courtès <ludo@gnu.org> tests: Have `getaddrinfo' test work for Darwin 8. * doc/ref/posix.texi (Network Databases): Update description of `EAI_NODATA' to mention that Darwin provides it. * libguile/net_db.c (scm_getaddrinfo): Likewise. * test-suite/tests/net-db.test ("getaddrinfo")["wrong service name"]: Accept `EAI_NODATA' too. Reported by David Fang <fang@csl.cornell.edu>, see <http://bugs.gnu.org/10684>. 2012-02-03 Ludovic Courtès <ludo@gnu.org> tests: Work around erroneous tr_TR locale in Darwin 8. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Add exception for Darwin 8. Reported by David Fang <fang@csl.cornell.edu>, see <http://bugs.gnu.org/10684>. 2012-02-03 Mike Gran <spk121@yahoo.com> Update srfi-14 test for Unicode 6.1 Some Latin-1 symbols have been reclassified as punctuation * test-suite/tests/srfi-14.test: updated 2012-02-03 Mark H Weaver <mhw@netris.org> Implement scm_to_pointer * libguile/foreign.c, libguile/foreign.h (scm_to_pointer): New C function. * test-suite/standalone/test-loose-ends.c: Add test. 2012-02-02 Andy Wingo <wingo@pobox.com> revert r5rs changes * doc/r5rs/r5rs.texi: Reverts the recent changes to r5rs.texi. 2012-02-02 Ludovic Courtès <ludo@gnu.org> Fix `SCM_I_ERROR' definition for MinGW without networking. * libguile/error.c (SCM_I_ERROR)[__MINGW32__]: Conditionalize on `HAVE_NETWORKING'. 2012-02-02 Bake Timmons <b3timmons@speedymail.org> Fix case in identifiers starting sentences in doc/r5rs/r5rs.texi * doc/r5rs/r5rs.texi: Use proper case of characters in identifiers starting sentences. Improve the usage of variable names in Scheme docstrings. * module/ice-9/boot-9.scm: * module/ice-9/popen.scm: * module/ice-9/pretty-print.scm: * module/ice-9/r4rs.scm: * module/rnrs/io/ports.scm: * module/texinfo/string-utils.scm: * module/web/http.scm: * module/web/request.scm: * module/web/response.scm: * test-suite/vm/run-vm-tests.scm: Make the variable names in Scheme docstrings more consistent. Replace a few instances of @var with @code when appropriate. Improve the usage of variable names in C docstrings. * libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate. 2012-02-02 Andy Wingo <wingo@pobox.com> Remove unused doc/sources/ * doc/sources: Remove. It is not used at all, presumably because all it had to offer was already incorporated in the manual. 2012-02-02 Bake Timmons <b3timmons@speedymail.org> Make consistent the usage of variable names in the function definitions found in the Texinfo docs. * doc/r5rs/r5rs.texi: * doc/ref/api-compound.texi: * doc/ref/api-data.texi: * doc/ref/api-debug.texi: * doc/ref/api-evaluation.texi: * doc/ref/api-io.texi: * doc/ref/api-modules.texi: * doc/ref/api-procedures.texi: * doc/ref/api-scheduling.texi: * doc/ref/api-smobs.texi: * doc/ref/compiler.texi: * doc/ref/misc-modules.texi: * doc/ref/posix.texi: * doc/ref/scheme-using.texi: * doc/ref/srfi-modules.texi: * doc/ref/vm.texi: * doc/ref/web.texi: * doc/sources/env.texi: Make usage of variable names of function definitions more consistent. Fix unbalanced parentheses in docs. * doc/ref/sxml-match.texi (sxml-match-let, sxml-match-let*): Remove extraneous parenthesis at end of Texinfo function definition header. 2012-02-02 Mike Gran <spk121@yahoo.com> Update srfi-14 character sets to Unicode 6.1 * libguile/srfi-14.i.c (cs_lower_case_ranges, cs_lower_case) (cs_upper_case_ranges, cs_upper_case, cs_letter_ranges, cs_letter) (cs_digit_ranges, cs_digit, cs_letter_plus_digit_ranges, cs_letter_plus_digit) (cs_graphic_ranges, cs_graphic, cs_printing_ranges, cs_printing) (cs_punctuation_ranges, cs_punctuation, cs_symbol_ranges, cs_symbol) (cs_designated_ranges, cs_designated): modified * doc/ref/api-data.texi: modified 2012-02-02 Mark H Weaver <mhw@netris.org> Fix search_path to fill stat_buf when given an absolute pathname * libguile/load.c (search_path): When the provided 'filename' is an absolute pathname, perform a 'stat' on that pathname to fill the 'stat_buf'. Previously, 'stat_buf' was left uninitialized in this case, even though 'scm_primitive_load_path' assumes that 'stat_buf' will be filled. Update the header comment to explicitly specify that 'stat_buf' will be filled. Also 'goto end' in a few failure cases instead of replicating its code. 2012-02-02 Andy Wingo <wingo@pobox.com> leniency in the "unused modules are removed" gc.test * libguile/foreign.h: Remove comment about the finalizer bit, as I don't think that is the case any more. * test-suite/tests/gc.test: Ignore flakiness in the gc-modules test. 2012-01-31 Ludovic Courtès <ludo@gnu.org> Augment `Libs.private' in `guile-2.0-uninstalled.pc'. Followup to 58f86505d658359508732c8f187bc37d010074d0 ("Augment `Libs.private' with for non-GNU platforms."). Reported by Eli Zaretskii <eliz@gnu.org>. * meta/guile-2.0-uninstalled.pc.in (Libs): Add all the optional libraries, as done in commit 58f86505d658359508732c8f187bc37d010074d0. 2012-01-31 Andy Wingo <wingo@pobox.com> an experiment: clearing the C stack in gc tests * test-suite/lib.scm (clear-stale-stack-references): New helper. * test-suite/tests/gc.test: * test-suite/tests/threads.test: Use the new helper. I removed the "unresolved" throw, as I'd like to see what the bots do with this. 2012-01-30 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. 2012-01-30 Ludovic Courtès <ludo@gnu.org> Bump version number for 2.0.4/2.0.5. Version 2.0.4 was pushed with the version info of 2.0.3, which is incorrect. Version 2.0.5 fixes that. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions `scm_c_value_ref', `scm_call', etc. (LIBGUILE_INTERFACE_AGE): Increment. 2012-01-30 Ludovic Courtès <ludo@gnu.org> Amend `NEWS'. * NEWS: Mention `-Wformat' change. Remove intermediate/minor bug fixes. Remove stale test file. * test-suite/tests/srfi-42.test: Delete "tmp1" at the end. doc: Add "warnings" to the concept index. * doc/ref/api-evaluation.texi (Compilation): Add "warnings" to the concept index. 2012-01-30 Andy Wingo <wingo@pobox.com> fix hook invocation during thread guilification * libguile/gc.c (run_before_gc_c_hook): Don't run pre-GC hooks from a thread that is in the process of guilification. 2012-01-30 Mark H Weaver <mhw@netris.org> Rename scm_call_varargs -> scm_call * libguile/eval.c, libguile/eval.h, doc/ref/api-evaluation.texi, test-suite/standalone/test-loose-ends.c, NEWS: Rename scm_call_varargs -> scm_call Suggested by Ludovic Courtès <ludo@gnu.org> 2012-01-30 Mark H Weaver <mhw@netris.org> Implement scm_call_varargs and scm_call_{7,8,9} * libguile/eval.c (scm_call_7, scm_call_8, scm_call_9, scm_call_varargs): New functions. * libguile/eval.h: Add prototypes. * doc/ref/api-evaluation.texi: Add documentation. * test-suite/standalone/test-loose-ends.c: Add tests. * NEWS: Add news entry. 2012-01-30 Mark H Weaver <mhw@netris.org> Fix primitive-eval to return #<unspecified> for definitions * module/ice-9/eval.scm (primitive-eval): Return #<unspecified> for definitions. Previously the variable object was returned. * test-suite/tests/eval.test (evaluator): Add test. * NEWS: Add news entry. 2012-01-30 Mark H Weaver <mhw@netris.org> Fix 'local-eval' when the specified environment is a module * module/ice-9/local-eval.scm (local-wrap): Fix the (module? e) case, to reference the expression 'x' instead of the non-existent variable 'exp', as was previously done. Also use quasisyntax instead of quasiquote, so that the introduced 'lambda' is an identifier instead of a bare symbol, so that this will work in modules that have rebound 'lambda' to something else. * test-suite/tests/eval.test (local-eval): Make sure to test both 'local-eval' and 'local-compile' when the specified environment is a module. 2012-01-30 Mark H Weaver <mhw@netris.org> Update user-visible copyright dates in manual and REPL to 2012 * doc/ref/guile.texi, module/system/repl/common.scm: Update user-visible copyright dates to 2012. 2012-01-30 Ludovic Courtès <ludo@gnu.org> Augment `Libs.private' with for non-GNU platforms. Reported by Eli Zaretskii <eliz@gnu.org>. * meta/guile-2.0.pc.in (Libs.private): Add all the optional libraries that may be pulled via Gnulib on non-GNU platforms. 2012-01-29 Andy Wingo <wingo@pobox.com> paper over some "lexical vars are collectable" flakiness * test-suite/tests/gc.test ("gc"): Hack around flakiness in "lexical vars are collectable" on some architectures. 2012-01-29 Andy Wingo <wingo@pobox.com> Revert "vm-i-scheme.c slight refactor" This reverts commit c0e4449908eee84bcb293ec21c10fec646bde45d. This refactor was needed for the introduction of DEAD(), which does not appear to have been necessary. 2012-01-29 Andy Wingo <wingo@pobox.com> Revert "attempt to clear stale references on VM C stack" This reverts commit 04b2d773548c57b6eadd1808a8d15cce47af9630. Since it wasn't fixing the "lexical vars are collectable" test, it added complexity with no benefit. 2012-01-29 Ludovic Courtès <ludo@gnu.org> Revert "Work around instruction reordering on SPARC and HPPA in the VM." This reverts commit 2b264d7e4fb649955ade1814527b6eb6f34f4e18, which is unnecessary after commit f5ea0499a411309014475dc7f7983e827f431af2 ("Build with `-fno-strict-aliasing' when available."). 2012-01-28 Chris K. Jester-Young <cky944@gmail.com> Fix double-free error on non-GNU systems. * libguile/i18n.c (scm_make_locale): Null out c_locale_name after it's freed, so it doesn't get freed again. While this only has effect if USE_GNU_LOCALE_API is unset, the nulling out happens in both cases, to be consistent and robust. (scm_nl_langinfo): Free c_result in all switch cases, in particular P_SIGN_POSN, N_SIGN_POSN, INT_P_SIGN_POSN, and INT_N_SIGN_POSN. 2012-01-28 Andy Wingo <wingo@pobox.com> mention new manual sections in NEWS * NEWS: Mention new sections. 2012-01-27 Ludovic Courtès <ludo@gnu.org> Build with `-fno-strict-aliasing' when available. * configure.ac (POTENTIAL_GCC_CFLAGS): Add `-fno-strict-aliasing'. Suggested by Mark H. Weaver. 2012-01-27 Andy Wingo <wingo@pobox.com> attempt to clear stale references on VM C stack * libguile/vm-engine.h (DEAD): New macro, nulls out a value. * libguile/vm-i-system.c: * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: Use DEAD when variables become dead. Later we can #ifdef this out, but I want to give the buildbots a try with this patch to make sure it's correct. 2012-01-27 Andy Wingo <wingo@pobox.com> vm-i-scheme.c slight refactor * libguile/vm-i-scheme.c: Refactor the RETURN macro to not include NEXT. Adapt all uses to NEXT on their own. document `include', `include-from-path' * doc/ref/api-evaluation.texi (Local Inclusion): New section. 2012-01-27 Andy Wingo <wingo@pobox.com> more documentation on the process of loading source and compiled files * doc/ref/api-evaluation.texi (Load Paths): Move documentation of %load-path and related procedures here, from Build Config. Add docs for %load-compiled-path. * doc/ref/api-foreign.texi: * doc/ref/api-modules.texi: * doc/ref/api-options.texi: * doc/ref/scheme-using.texi: Update xrefs. 2012-01-27 Mark H Weaver <mhw@netris.org> Fix error messages involving definition forms * module/ice-9/psyntax.scm (syntax-type): Return an additional value that contains the entire form in _all_ cases, including for definition forms. Previously, the entire form was not returned for definition forms. (expand-expr): Add an additional argument that contains the entire form in _all_ cases, including for definition forms. Use it to include the entire form in error messages, notably for definitions in expression context. Include the source location information, which was previously missing from these errors when the rhs expression was an atom. Improve the "definition in expression context" error message to be more comprehensible for Scheme beginners. (expand-top-sequence, expand, expand-body): Adjust as needed to handle the additional return value from 'syntax-type' and the additional argument to 'expand-expr'. * module/ice-9/psyntax-pp.scm: Regenerate. * NEWS: Update. 2012-01-26 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update. fix test-loose-ends * test-suite/standalone/test-loose-ends.c (test_scm_local_eval): Use ice-9 local-eval to get (the-environment). update local-eval docs * doc/ref/api-evaluation.texi (Local Evaluation): Update docs, add some examples. 2012-01-26 Andy Wingo <wingo@pobox.com> more readable gensyms * module/language/tree-il/peval.scm (peval): * module/language/tree-il/primitives.scm (dynamic-wind): When you make a gensym that just has to be compared against other gensyms, it will be unique if the prefix doesn't end in something that can be interpreted as a number. There's no reason to make that character something difficult like " ". So change to use a dash in that case. * module/ice-9/psyntax-pp.scm: Regenerate. More readable now. 2012-01-26 Andy Wingo <wingo@pobox.com> globally unique marks and labels using syntax-session-id * libguile/macros.c (scm_init_macros): Add definition of new syntax-session-id helper. * module/ice-9/psyntax.scm: Capture a reference to syntax-session-id at boot time. Uniquify marks and labels using the session id. * module/ice-9/boot-9.scm: Shunt syntax-session-id off to (system syntax) once we finished booting. * module/ice-9/compile-psyntax.scm: Override syntax-session-id when remaking psyntax to avoid spurious diffs. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-01-26 Andy Wingo <wingo@pobox.com> Revert "Universally-unique gensyms" This reverts commit ad432bc8317c33899efc29854550b67f3d7babf7. Not all gensyms need to be universally-unique: most of them just need to be unique within some portion of a Guile session. We'll take a different tack on this problem in the next commit. 2012-01-26 Andy Wingo <wingo@pobox.com> Implement `local-eval', `local-compile', and `the-environment' * module/ice-9/local-eval.scm: New module (ice-9 local-eval) which exports `the-environment', `local-eval', and `local-compile'. * libguile/debug.c (scm_local_eval): New C function that calls the Scheme implementation of `local-eval' in (ice-9 local-eval). * libguile/debug.h (scm_local_eval): Add prototype. * doc/ref/api-evaluation.texi (Local Evaluation): Add documentation. * test-suite/tests/eval.test (local evaluation): Add tests. * test-suite/standalone/test-loose-ends.c (test_scm_local_eval): Add test. * module/Makefile.am: Add ice-9/local-eval.scm. Based on a patch by Mark H Weaver <mhw@netris.org>. 2012-01-26 Ludovic Courtès <ludo@gnu.org> Fix a couple of warnings. * module/scripts/list.scm: Use SRFI-1. * module/system/repl/error-handling.scm: Use (ice-9 format). Fix typo in `-Wformat'. * module/language/tree-il/analyze.scm (format-analysis): Call `warning', not `warn'. 2012-01-26 Ludovic Courtès <ludo@gnu.org> Add warnings for unsupported `simple-format' options. * module/language/tree-il/analyze.scm (format-analysis)[check-simple-format-args]: New procedure. Use it. Add support for applications of <module-ref>. * module/system/base/message.scm (%warning-types): Handle the `format simple-format' warning. * module/language/scheme/spec.scm (scheme)[make-default-environment]: Use `simple-format' as the default `format'. * test-suite/tests/tree-il.test ("warnings")["format"]: Explicitly use (@ (ice-9 format) format) where needed. ("simple-format"): New test prefix. 2012-01-25 Ludovic Courtès <ludo@gnu.org> Import Gnulib's `setenv' module, for MinGW. Reported by Eli Zaretskii <eliz@gnu.org>. * m4/gnulib-cache.m4 (gl_MODULES): Add `setenv'. 2012-01-25 Andy Wingo <wingo@pobox.com> new syntax procedures to (system syntax) * module/ice-9/boot-9.scm: * module/ice-9/psyntax.scm (syntax-module, syntax-local-binding) (syntax-locally-bound-identifiers): After boot, move these definitions to a new (system syntax) module. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-macros.texi: Add some words about syntax-module and friends being in (system syntax). 2012-01-25 Andy Wingo <wingo@pobox.com> add syntax-module * module/ice-9/psyntax.scm (syntax-module): New accessor for syntax objects. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm: Declare syntax-module. * doc/ref/api-macros.texi: Document it. 2012-01-25 Andy Wingo <wingo@pobox.com> add syntax-locally-bound-identifiers * module/ice-9/boot-9.scm (syntax-locally-bound-identifiers): Declare variable. * module/ice-9/psyntax.scm: Add locally-bound-identifiers helper, and define syntax-locally-bound-identifiers. * module/ice-9/psyntax-pp.scm: Regenerated. * doc/ref/api-macros.texi: Document the new procedure. fix "lexical vars are collectable" test * test-suite/tests/gc.test ("gc"): Fix "lexical vars are collectable" test. (Previously, the binding was getting inlined, so we weren't testing what we meant to test. Besides that, the value was a constant, not a closure, so it wasn't collectable in the first place!) better function prologue disassembly * module/language/assembly/disassemble.scm (code-annotation): Add an annotation for assert-nargs-ee/locals and assert-nargs-ge/locals. add another case in which to fold (values FOO) to FOO, for some FOO * module/language/tree-il/peval.scm (peval): Fold (values 'singly-valued-expression) to 'singly-valued-expression in contexts that expect multiple values, in addition to those that expect single values. fix values miscompilation in push context with RA * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Fix miscompilation of `values' in a push context with RA. * test-suite/tests/tree-il.test: Add low-level test for this miscompilation. 2012-01-24 Ludovic Courtès <ludo@gnu.org> Work around instruction reordering on SPARC and HPPA in the VM. Fixes part of <http://bugs.gnu.org/10520>. Reported by Bruno Haible <bruno@clisp.org>. * libguile/vm-i-system.c (COMPILER_BARRIER): New macro. (halt, return, return_values): Insert compiler barrier after each assignment to `fp'. 2012-01-24 Ludovic Courtès <ludo@gnu.org> vlist: Use (ice-9 format). * module/ice-9/vlist.scm: Use (ice-9 format). 2012-01-23 Ludovic Courtès <ludo@gnu.org> FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged. This is a followup to 690a0112e55823aa8b862daeddcf44cea97e7917 ("Remove the "has finalizer?" bit from pointer objects.") * libguile/foreign.c (scm_set_pointer_finalizer_x): Leave the type cell unchanged. Before, `equal?' would break on pointers on which `set-pointer-finalizer!' had been called. * test-suite/tests/foreign.test ("make-pointer")["equal? modulo finalizer (set-pointer-finalizer!)"]: New test. 2012-01-23 Ludovic Courtès <ludo@gnu.org> guile-readline: Clean `.go' files. * guile-readline/Makefile.am (CLEANFILES): Add *.go. 2012-01-23 Andy Wingo <wingo@pobox.com> current-filename canonicalizes path, remove add-to-path * module/ice-9/boot-9.scm (current-filename): Canonicalize the path, so that the result is independent of the current directory, and so that `dirname' can traverse up the file system, as in the add-to-load-path example. (add-to-path): Remove. The eval-when semantics make this macro too tricky to explain -- people will start using it on other path-like things, in lexical contours, whereas it only really makes sense with load-like paths at the toplevel. * doc/ref/api-evaluation.texi (Loading): Fix link to load-with-path docs, and remove add-to-path docs. 2012-01-23 Ludovic Courtès <ludo@gnu.org> Adjust tests that relied on the output of the hash table printer. * libguile/hashtab.c (scm_i_hashtable_print): Use `SCM_UNPACK', not `SCM2PTR'. * test-suite/tests/hash.test: Adjust tests that rely on the output of the printer to just check for the suffix of the hash table's external representation. 2012-01-23 Ludovic Courtès <ludo@gnu.org> Print the address of hash tables. * libguile/hashtab.c (scm_i_hashtable_print): Print the address of EXP. 2012-01-22 Ludovic Courtès <ludo@gnu.org> Augment `release.org'. * doc/release.org: Mention debbugs and `platform-testers@gnu.org'. 2012-01-22 Ludovic Courtès <ludo@gnu.org> Parenthesize and type `SCM_FRAME' macros; check layout of `scm_vm_frame'. * libguile/frames.c: Add compile-time assertions on the layout of `struct scm_vm_frame'. (RELOC): Parenthesize and type VAL. * libguile/frames.h (SCM_FRAME_STRUCT): Write in terms of `SCM_FRAME_DATA_ADDRESS'. (SCM_FRAME_DATA_ADDRESS): Parenthesize and type FP. (SCM_FRAME_SET_DYNAMIC_LINK): Write in terms of `SCM_FRAME_DYNAMIC_LINK'. * libguile/vm.c (RELOC): Parenthesize and type SCM_P. 2012-01-22 Ludovic Courtès <ludo@gnu.org> Relax `asm-to-bytecode.test' for when target CPU == native CPU. * test-suite/tests/asm-to-bytecode.test (native-cpu, native-word-size): New procedures. (test-target): When the target is the native CPU, use the native word size instead of WORD-SIZE. 2012-01-21 Mark H Weaver <mhw@netris.org> Universally-unique gensyms * libguile/symbols.c (scm_gensym): Make the gensym counter a 128-bit thread-local, initialized to a random number upon the first call to `gensym' within a given thread. This counter is rendered as a 22 byte suffix of mostly base64 digits. * libguile/threads.h (scm_i_thread): Add a thread-local gensym_counter. * libguile/threads.c (guilify_self_1): Initialize gensym_counter to NULL. 2012-01-21 Mark H Weaver <mhw@netris.org> Add `random-state-from-platform' and `scm_i_random_bytes_from_platform' * libguile/random.c (scm_random_state_from_platform): New procedure. (scm_i_random_bytes_from_platform): New internal function. * libguile/random.h (scm_random_state_from_platform, scm_i_random_bytes_from_platform): Add prototypes. * doc/ref/api-data.texi (Random): Add documentation. 2012-01-21 Andy Wingo <wingo@pobox.com> add current-filename, add-to-path, add-to-load-path * module/ice-9/boot-9.scm (current-filename, add-to-path) (add-to-load-path): New syntaxen. * doc/ref/api-evaluation.texi (Loading): Move load-path related procedures to a new section: (Load Paths): Hither. Document add-to-path and add-to-load-path. * doc/ref/api-debug.texi (Source Properties): Document current-source-location and current-filename. * doc/ref/api-modules.texi: * doc/ref/guile-invoke.texi: * doc/ref/scheme-using.texi: Update @ref for Load Paths change. 2012-01-20 Andy Wingo <wingo@pobox.com> remove duplicate when/unless definitions * module/rnrs/control.scm: * module/sxml/ssax.scm: * test-suite/lalr/common-test.scm: Remove local `when'/`unless' definitions. 2012-01-20 Andy Wingo <wingo@pobox.com> add when, unless * module/ice-9/boot-9.scm (when, unless): New forms. * doc/ref/api-control.texi (Conditionals): Add docs. Rename this node from "if cond case". * doc/ref/r6rs.texi: * doc/ref/scheme-ideas.texi: * doc/ref/srfi-modules.texi: Update referrers. 2012-01-19 Andy Wingo <wingo@pobox.com> avoid gensym when making labels in psyntax * module/ice-9/psyntax.scm (gen-label): Avoid gensym, as we don't need to make symbols. * module/ice-9/psyntax-pp.scm: Regenerate. 2012-01-19 Andy Wingo <wingo@pobox.com> add syntax-local-binding * module/ice-9/boot-9.scm (syntax-local-binding): New binding. * module/ice-9/psyntax.scm: Locally define a fluid that holds the "transformer environment". with-transformer-environment calls a procedure with the transformer environment, or raises an error if called outside the extent of a transformer. Bind transformer-environment in expand-macro. (resolve-identifier): Backport this helper from master. (syntax-local-binding): New procedure to return binding information of a bound identifier (a lexical, macro, a pattern variable, a displaced lexical, a global, or some other form). * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-macros.texi (Syntax Transformer Helpers): Add docs for syntax-local-binding, and syntax-source, and move some other descriptions to this new section. 2012-01-19 Mark H Weaver <mhw@netris.org> Add `scm_c_value_ref' to allow access to multiple returned values from C Based on a patch by Julian Graham <julian@member.fsf.org> * libguile/values.c, libguile/values.h (scm_c_value_ref): New function. * doc/ref/api-control.texi (Multiple Values): Add documentation. * test-suite/standalone/test-scm-values.c: New test program. * test-suite/standalone/Makefile.am: Add test-scm-values test. 2012-01-16 Ludovic Courtès <ludo@gnu.org> Update Gnulib to v0.0-6827-g39c3009; use the `dirfd' module. * m4/gnulib-cache.m4: Use `dirfd'. * libguile/filesys.c: Include Gnulib's <dirent.h> directly. (dirfd): Remove. Suggested by Bruno Haible <bruno@clisp.org>. 2012-01-16 Ludovic Courtès <ludo@gnu.org> Improve wording in README regarding `pkg-config'. * README: Mention $PKG_CONFIG_PATH, and make it clear that $BDW_GC_LIBS, etc. aren't normally needed. Fix typo in threads.c on IA64. * libguile/threads.c (guilify_self_1)[__ia64__]: Fix typo. Reported by Bruno Haible <bruno@clisp.org>. Skip `tr_TR' tests on Solaris 2.10. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Special-case Solaris 2.10. 2012-01-15 Chris K. Jester-Young <cky944@gmail.com> Add #ifdefs for langinfo items that don't exist on OpenBSD. * libguile/i18n.c (define_langinfo_items): Add #ifdefs for ERA_* and ALT_DIGITS, as those constants don't exist on OpenBSD. Call scm-error with the correct argument order. * module/ice-9/boot-9.scm (catch, with-throw-handler): Switch the order of the error key and function name arguments. 2012-01-14 Ludovic Courtès <ludo@gnu.org> Have `statprof.test' fail gracefully when samples could not be collected. * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Throw unresolved when one of A-DATA, B-DATA, and C-DATA is #f, which means samples were not collected for this one. Avoid non-portable `tail' argument in `test-guile-snarf'. * test-suite/standalone/test-guile-snarf (strip_first_line): New function. (snarf): Use it. Fix signed/unsigned pointer mismatches. * libguile/foreign.c (scm_pointer_to_bytevector, scm_bytevector_to_pointer): Use pointers of the same signedness. 2012-01-14 Mark H Weaver <mhw@netris.org> Don't diverge when serializing cyclic lists during compilation * module/language/glil/compile-assembly.scm (scheme-list?): Don't diverge when serializing cyclic lists. 2012-01-14 Mark H Weaver <mhw@netris.org> Fix serialization of #nil-terminated lists during compilation * module/language/glil/compile-assembly.scm (scheme-list?): New predicate, like `list?' but requires that the last cdr must be '(), not #nil. (dump-object, dump-constants): Use `list' opcode to create a list only if it is terminated by '(). If it's terminated by #nil, we must use the more general `cons' opcode. 2012-01-12 Andy Wingo <wingo@pobox.com> fix array printing * libguile/print.c (iprin1): Fix unmatched ENTER_NESTED_DATA. Fixes http://debbugs.gnu.org/10482. Thanks to Daniel Llorens for the report. update NEWS * NEWS: Minor edits. Remove a THANKS; we need to assemble a larger THANKS for this release. 2012-01-12 Ludovic Courtès <ludo@gnu.org> Make sure `scm_spawn_thread' returns a thread. * libguile/threads.c (scm_spawn_thread): Add an assertion that DATA.thread is a thread. This assertion is sometimes hit on x86_64-freebsd8.2. Disable statprof tests on platforms that lack `ITIMER_PROF' support. * test-suite/tests/statprof.test (when-implemented): New macro. ("statistical sample counts within expected range", "accurate call counting"): Use it. 2012-01-12 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update. print-options doc update * doc/ref/api-evaluation.texi (Scheme Write): Update print-options. fluids.c docstring * libguile/fluids.c (scm_make_fluid_with_default): Update docstring. Move parameters documentation to core * doc/ref/api-scheduling.texi (Fluids and Dynamic States): Update for default values. (Parameters): Move here from srfi-39, and adapt. add docs for scm_gc_register_allocation * doc/ref/api-memory.texi: Update for scm_gc_register_allocation. Remove docs for scm_gc_{un,}register_collectable_memory. 2012-01-10 Mark H Weaver <mhw@netris.org> Remove docs `procedure-environment', which no longer exists * doc/ref/api-procedures.texi (Procedure Properties): Remove the entry for `procedure-environment', which no longer exists. Use a common null stringbuf in `scm_i_make_string' * libguile/strings.c (scm_i_make_string): Use a common null stringbuf for newly-allocated empty strings. Empty substrings no longer reference the original stringbuf * libguile/strings.c (scm_i_substring, scm_i_substring_read_only, scm_i_substring_shared): When asked to create an empty substring, return a freshly allocated null string. Previously, an empty substring needlessly held a reference to the original stringbuf. scm_i_substring_copy tries to narrow the substring * libguile/strings.c (scm_i_substring_copy): Try to narrow the substring if it came from a wide string. Avoid calling `u32_conv_from_encoding' on the null string * libguile/strings.c (scm_from_stringn): Avoid calling `u32_conv_from_encoding' on the null string, by using the same fast-path code used if (encoding == NULL). This is an optimization, and also avoids any possible encoding errors. 2012-01-10 Mike Gran <spk121@yahoo.com> Typo in documentation of local-boxed-set * doc/ref/vm.texi: modified 2012-01-10 Mark H Weaver <mhw@netris.org> Remove null string optimization from scm_from_stringn * libguile/strings.c (scm_from_stringn): Always return a freshly allocated string from scm_from_stringn, even when asked to construct the null string, in accordance with the R5RS. Previously, we optimized the null string case by returning a reference to a global null string object (scm_nullstr). 2012-01-09 Daniel Hartwig <mandyke@gmail.com> permit non-date values for Expires header * module/web/http.scm ("Expires"): Permit (some) non-date values. 2012-01-09 Ludovic Courtès <ludo@gnu.org> Have `cpu-word-size' error out on unknown CPUs; add support for MIPSEL. * module/system/base/target.scm (cpu-word-size): Add support for `mipsel'. Call `error' when CPU is unknown. Make sure `regexp-quote' tests use Unicode-capable string ports. * test-suite/tests/regexp.test (with-unicode): New macro. ("regexp-quote"): Wrap all `regexp-quote' calls in it. This fixes tests on machines where the default port encoding is US-ASCII. Fix incorrect use of `SCM_UNPACK'. * libguile/arrays.c (scm_i_make_array): Cast the result of `scm_gc_malloc' directly to `scm_t_bits'. i18n: Fix gc_malloc/free mismatch on non-GNU systems. * libguile/i18n.c (scm_i_locale_free): Remove. (smob_locale_free): Define only when USE_GNU_LOCALE_API. (scm_make_locale)[!USE_GNU_LOCALE_API]: Allocate `c_locale->locale_name' with `scm_gc_strdup', not `malloc'. i18n: Disable Turkish locale tests on FreeBSD 8. * test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved): Check %HOST-TYPE and throw `unresolved' on FreeBSD 8. Fix loose typing in `test-scm-spawn-thread.c'. * test-suite/standalone/test-scm-spawn-thread.c (inner_main): Use `SCM2PTR' instead of a cast. 2012-01-09 Andy Wingo <wingo@pobox.com> allocate a tc7 to bitvectors * libguile/tags.h (scm_tc7_bitvector): Allocate a tc7 to bitvectors. * libguile/print.c (iprin1): * libguile/goops.c: * libguile/evalext.c (scm_self_evaluating_p): * libguile/eq.c (scm_equal_p): Add cases for bitvectors. * libguile/bitvectors.h: Declare internal print and equal? helpers. * libguile/bitvectors.c: Use a tc7 instead of a smob type. 2012-01-09 Andy Wingo <wingo@pobox.com> allocate a tc7 to arrays * libguile/tags.h (scm_tc7_array): Allocate a tag for arrays. * libguile/arrays.h (SCM_I_ARRAYP): Change to use scm_tc7_array. The previous definition was not externally usable because scm_i_tc16_array was internal. (scm_i_print_array): Declare, though internally. * libguile/arrays.c (scm_i_make_array): Use scm_cell with the tc7 instead of NEWSMOB. (scm_i_print_array): Make not static. (SCM_ARRAY_IMPLEMENTATION): Adapt. (scm_init_arrays): Remove array smob declaration. * libguile/eq.c (scm_equal_p): Refactor to put the string, pointer, and bytevector cases in the switch. Add a case for arrays. * libguile/goops.c: Add <array> declarations. * libguile/print.c (iprin1): Call scm_i_print_array as needed. * libguile/evalext.c (scm_self_evaluating_p): Add a case for arrays. 2012-01-09 Andy Wingo <wingo@pobox.com> primitive-load returns the value(s) of the last expression * libguile/load.c (scm_primitive_load): Return the values yielded from evaluating the last expression in the file. * test-suite/tests/load.test ("return value of `load'"): Add tests. 2012-01-09 Rob Browning <rlb@defaultvalue.org> Define _GNU_SOURCE to fix the GNU/kFreeBSD build. Author: Petr Salinger <Petr.Salinger@seznam.cz> Closes: #401168 Fix the SRFI 60 copy-bit documentation. 2012-01-09 Andy Wingo <wingo@pobox.com> test-pthread-create-secondary: gc/gc.h, not gc/gc_version.h * test-suite/standalone/test-pthread-create-secondary.c: Include gc/gc.h. It works on libgc from git, and on 7.1. 2012-01-09 Mark H Weaver <mhw@netris.org> Avoid calling scm_i_string_start_writing if no chars will be mutated * libguile/srfi-13.c (scm_string_copy_x, scm_substring_fill_x, string_upcase_x, string_downcase_x, string_titlecase_x, string_reverse_x, scm_string_xcopy_x): Avoid calling `scm_i_string_start_writing' if the range of indices to be modified is empty. This avoids the error that would be raised by `scm_i_string_start_writing' if the string is not mutable. Thanks to Bruce Korb <bkorb@gnu.org> for reporting this problem and suggesting the fix. 2012-01-08 Andy Wingo <wingo@pobox.com> no need to warn people off of s_FOO generated by SCM_DEFINE * doc/ref/libguile-snarf.texi (Function Snarfing): The s_FOO binding isn't deprecated; no need to warn people to stop using it. Thanks to Peter Brett for the hint. allow scm_display_error to use a stack as the first argument * libguile/backtrace.c (scm_display_error): Allow a deprecated use of this function to pass a stack as the first argument. Thanks to Peter Brett for pointing it out, in http://lists.gnu.org/archive/html/guile-user/2011-06/msg00000.html. 2012-01-08 Ludovic Courtès <ludo@gnu.org> Fix typo in `test-num2integral.c'. * test-suite/standalone/test-num2integral.c (out_of_range_handler): Use `scm_is_eq' when comparing KEY. 2012-01-08 Ludovic Courtès <ludo@gnu.org> ftw: Add an `error' parameter to `file-system-fold'. * module/ice-9/ftw.scm (errno-if-exception): New macro. (file-system-fold): Add an `error' parameter. Wrap `opendir' and STAT calls in `errno-if-exception' and call ERROR when appropriate. (file-system-tree): Provide an `error' procedure. Return #f when FILE-NAME is unreadable. (scandir): Provide an `error' procedure. * test-suite/tests/ftw.test (%top-builddir): New variable. (make-file-tree, delete-file-tree): New procedures. (with-file-tree): New macro. ("file-system-fold"): Update tests to add an `error' procedure. ["ENOENT", "EACCES", "dangling symlink and lstat", "dangling symlink and stat"]: New tests. ("file-system-tree")["ENOENT"]: New test. ("scandir")["EACCES"]: New test. * doc/ref/misc-modules.texi (File Tree Walk): Update `file-system-fold' documentation. 2012-01-08 Andy Wingo <wingo@pobox.com> fix SCM_ASRTGO deprecation * libguile/__scm.h (SCM_ASRTGO): Whoops, actually remove the ASRTGO definitions here. * libguile/deprecated.h: Fix type of scm_i_deprecated_asrtgo. syntax parameters doc formatting * doc/ref/api-macros.texi (Syntax Parameters): Some copy-editing on Ian's lovely syntax-parameters documentation. 2012-01-08 Andy Wingo <wingo@pobox.com> deprecate SCM_ASRTGO * libguile/deprecated.h: Mark scm_immutable_cell and scm_immutable_double_cell as being SCM_DEPRECATED, not SCM_API. Deprecate SCM_ASRTGO. * libguile/deprecated.c (scm_i_deprecated_asrtgo): New support procedure. * doc/ref/api-control.texi (Handling Errors): Remove ASRTGO docs. 2012-01-08 Ian Price <ianprice90@googlemail.com> document syntax parameters * doc/ref/api-macros.texi (Macros): Add subsection for "Syntax Parameters" 2012-01-07 Mark H Weaver <mhw@netris.org> Fix bugs related to mutation-sharing substrings * libguile/strings.c (scm_i_is_narrow_string, scm_i_try_narrow_string, scm_i_string_set_x): Check to see if the provided string is a mutation-sharing substring, and do the right thing in that case. Previously, if such a string was passed to these functions, they would behave very badly: while trying to fetch and/or mutate the cell containing the stringbuf, they were actually fetching or mutating the cell containing the original shared string. That's because mutation-sharing substrings store the original string in CELL_1, whereas all other strings store the stringbuf there. Make scm_nullstr mutable * libguile/strings.c (scm_init_strings): Make scm_nullstr mutable. It is still usable as a common object, because of course it contains no characters to mutate anyway. It is returned by several procedures that are specified to return mutable strings, and string mutators raise errors when passed an immutable string, even if it is the null string. 2012-01-07 Andy Wingo <wingo@pobox.com> don't leak file descriptors when mmaping objcode * libguile/objcodes.c (make_objcode_from_file): Close the mmap'd file, so that we don't leak the descriptor. I was previously under the mistaken impression that closing the fd unmapped the memory, which is not the case. Thanks to Cedric Cellier for the tip! 2012-01-07 Ian Price <ianprice90@googlemail.com> `write-request-line' writes absolute paths, not absolute URIs. * module/web/http.scm (write-request-line): RFC 2616 says that absolute paths are used to identify resources on an origin server. 2012-01-07 Andy Wingo <wingo@pobox.com> remove duplicate write-uri definition * module/web/http.scm: Remove duplicate write-uri definition. update api-modules.texi * doc/ref/api-modules.texi (Modules): Add subsection for "Modules and the File System". Move "Included Guile Modules" to the end. Move "Module System Reflection" after "Variables", as we need to know about variables. Flesh out "Module System Reflection" a bit, with docs on module-ref, module-variable, and other bindings. General editing. 2012-01-06 Andy Wingo <wingo@pobox.com> deprecate fluid-let-syntax in favor of syntax-parameterize * module/ice-9/psyntax.scm (syntax-parameterize): Rename from fluid-let-syntax. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm (define-inlinable): Use syntax-parameterize (and define-syntax-parameter). * module/ice-9/deprecated.scm (fluid-let-syntax): Add deprecated shim. 2012-01-06 Andy Wingo <wingo@pobox.com> add define-syntax-parameter, same as define-syntax * module/ice-9/psyntax.scm (define-syntax-parameter): New toplevel form. Will be used to implement syntax parameters, following Barzilay, Culpepper, and Flatt's 2011 SFP workshop paper, "Keeping it Clean with syntax-parameterize". Adds a new binding type and definition form. Conflicts: module/ice-9/psyntax.scm 2012-01-05 Ludovic Courtès <ludo@gnu.org> Fix the exception type of the (begin) test. * test-suite/tests/syntax.test (exception:zero-expression-sequence): New variable. ("begin")["legal (begin)"]: Rename to "valid (begin)". ["illegal (begin)"]: Ditto. Expect `exception:zero-expression-sequence'. Placate a number of `syntax-check' verifications. - "filesystem" -> "file system" - remove doubled words - use EXIT_* macros instead of literal numbers - update `syntax-check' exclusion files Regenerate `psyntax-pp.scm'. * module/ice-9/psyntax-pp.scm: Regenerate. Fix erroneous check in `set-procedure-properties!'. * libguile/procprop.c (scm_set_procedure_properties_x)[SCM_ENABLE_DEPRECATED == 1]: Pass arguments to `scm_assq' in the right order, and check its return value with `scm_is_true'. Reported by Mike Gran <spk121@yahoo.com>. 2012-01-05 Ludovic Courtès <ludo@gnu.org> Raise an error for (begin) when `--disable-deprecated'. * module/ice-9/psyntax.scm (define-expansion-constructors)[begin-form]: Emit a syntax-violation error for empty sequences when --disable-deprecated. * test-suite/tests/syntax.test (pass-if-syntax-error): Fix typo in error message. 2012-01-04 Mark H Weaver <mhw@netris.org> Fix docs of string mutators to do so on a mutable string * doc/ref/api-data.texi (String Modification): Change (define y "abcdefg") => (define y (string-copy "abcdefg")) before mutating the string bound to y in the example code. 2012-01-04 Mike Gran <spk121@yahoo.com> Rework c-api.test to use test lib The failure path for the c-api.test had been to call the undefined function 'fail', instead of logging the error like the other tests. * test-suite/tests/c-api.test: modified 2012-01-03 Ludovic Courtès <ludo@gnu.org> doc: Fix typo in `define-wrapped-pointer-type' example. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Fix typo in `define-wrapped-pointer-type' example. 2011-12-31 Mark H Weaver <mhw@netris.org> Fix documentation for vhash-fold and vhash-fold-right * doc/ref/api-compound.texi (VHashes): Add missing `init' parameter in documentation for vhash-fold and vhash-fold-right, and also improve description. * module/ice-9/vlist.scm (vhash-fold, vhash-fold-right): Rename formal parameter `seed' to `init', to match documentation. Improve docstrings. 2011-12-31 Mark H Weaver <mhw@netris.org> Fix comment summarizing allocation table * module/language/tree-il/analyze.scm (analyze-lexicals): Fix comment, which describes the compiler's allocation table, to match reality. Update comment: ~/.guile-ccache => ~/.cache/guile/ccache * module/system/base/compile.scm: Update comment to match where the ccache dir now lives: ~/.cache/guile/ccache 2011-12-22 Daniel Llorens <daniel.llorens@bluewin.ch> New array-map! and array-for-each tests * ramap.test: New tests. - array-map! with noncompact arrays and more than one argument. - array-for-each with noncompact arrays and more than two arguments. 2011-12-22 Andy Wingo <wingo@pobox.com> fix generalized-vector-{ref,set!} for slices * libguile/generalized-vectors.c (scm_c_generalized_vector_ref): (scm_c_generalized_vector_set_x): Fix for the case in which base was not 1, lbnd was not 0, or inc was not 1. * test-suite/tests/arrays.test (array): Add a test. Thanks to Daniel Llorens for the report. 2011-12-22 Andy Wingo <wingo@pobox.com> freebsd itanium support * libguile/threads.c (scm_ia64_register_backing_store_base) (scm_ia64_ar_bsp): Provide implementation of these itanium helpers on freebsd. Thanks to Jim Pryor. freebsd implementation of get_thread_stack_base * configure.ac: Check for pthread_np.h and pthread_attr_get_np. Patch by Jim Pryor. * libguile/threads.c (get_thread_stack_base): Provide an implementation for FreeBSD. 2011-12-22 Andy Wingo <wingo@pobox.com> stdlib.h, not malloc.h * configure.ac: Remove check for malloc.h. * libguile/gc-malloc.c: * libguile/gc.c: * libguile/mallocs.c: * libguile/smob.c: Use stdlib instead of malloc.h. 2011-12-22 Andy Wingo <wingo@pobox.com> Make the "Dia Primitives" section of the manual more clear. * doc/ref/libguile-program.texi (Dia Primitives): Use scm_assert_smob_type, and update the text. 2011-12-22 Andy Wingo <wingo@pobox.com> HTTP: Fix qstring writing of cache-extension values * module/web/http.scm ("Cache-Control"): Write string values using the default val writer, to get quoting correct. * test-suite/tests/web-http.test (pass-if-round-trip): New helper. ("general headers"): Check that cache-extensions round trip properly. 2011-12-22 Daniel Hartwig <mandyke@gmail.com> Extend handling of "Cache-Control" header. * module/web/http.scm ("Cache-Control"): Value for `max-stale' is optional. Strict validation for value-less directives (`no-store', etc.). String values optional for "cache-extension" directives. * test-suite/tests/web-http.test: Value for `max-stale' is optional. 2011-12-22 Andy Wingo <wingo@pobox.com> peval fix: (cons 1 #nil) is not (list 1) * module/language/tree-il/peval.scm (peval): (cons FOO #nil) is not (cons FOO '()). * test-suite/tests/tree-il.test ("partial evaluation"): Add a test. 2011-12-22 Andy Wingo <wingo@pobox.com> peval minor tweak * module/language/tree-il/peval.scm (peval): Record residual values in both value and values contexts. No test cases, it just seemed like a good idea. 2011-12-22 Andy Wingo <wingo@pobox.com> document invalidity of (begin) as expression; add back-compat shim * doc/ref/api-control.texi (begin): Update to distinguish between splicing begin and sequencing begin. * module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim for `(begin)'. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Update to run illegal (begin) test only if we are not including deprecated features. 2011-12-19 Ludovic Courtès <ludo@gnu.org> ftw: Include sub-directories in the result of `scandir'. * module/ice-9/ftw.scm (scandir)[skip]: Keep NAME in the resulting list. * test-suite/tests/ftw.test ("scandir")["top-srcdir"]: New test. 2011-12-19 Andy Wingo <wingo@pobox.com> fix scm_protects deprecation warning * libguile/gc.c: Fix warning about scm_protects being deprecated. fix peval to preserve effects when folding (values) forms * module/language/tree-il/peval.scm (singly-valued-expression?): New helper. (truncate-values): Use the helper. (make-operand): Minor refactor. (set-operand-residual-value!): Try to undo the effects of (values FOO), if the continuation will check itself for the correct number of values. (peval): Fold helpers into fold-constant. Add a constant-expression? case for (values FOO). Add a new context: "values", for contexts in which multiple values are allowed, either because of being in a tail context relative to a function, or because of let-values. "value" is now for single values. Don't visit operands for "values", as their binding form truncates to one value. Add a case to fold (values ...) forms. Fix folding of (lambda), to process the cases in values context instead of tail context (which could have been "value", which would cause the procedure to truncate). 2011-12-19 Ludovic Courtès <ludo@gnu.org> ftw: Fix typos/thinkos in `file-system-fold' and `scandir'. * module/ice-9/ftw.scm (file-system-fold): Fix reference to STAT instead of ST. (scandir)[enter?]: Change the argument name to `dir', to avoid confusion. [skip]: Return RESULT, not #f. 2011-12-19 Ludovic Courtès <ludo@gnu.org> ftw: Clarify the behavior of `scandir' for flat files and unreadable dirs. * module/ice-9/ftw.scm (scandir)[leaf]: Only add NAME when RESULT is a pair. [down]: Ignore RESULT. Start with #f instead of the empty list. * test-suite/tests/ftw.test ("scandir")["flat file"]: New test. * doc/ref/misc-modules.texi (File Tree Walk): Update `scandir' documentation accordingly. 2011-12-19 Christian Persch <chpe@gnome.org> Add a deprecated alias for $expt * module/ice-9/deprecated.scm: Add alias for $expt. $expt was removed in commit 6fc4d0124d633d1b3ddc5af82967f23bd17556f8 but no deprecated alias was added in ad79736c68a803a59814fbfc0cb4b092c2b4cddf like for all the other deprecated $sin, $cos, ... functions. 2011-12-19 Andreas Schwab <schwab@linux-m68k.org> FFI: Properly unpack small integer return values in closure call. Fixes <http://debbugs.gnu.org/10203>. * libguile/foreign.c (unpack): Add parameter return_value_p. Properly store integer return values smaller than int. (scm_i_foreign_call): Update call to unpack. (invoke_closure): Likewise. 2011-12-18 Ludovic Courtès <ludo@gnu.org> doc: Add link from `opendir' to (ice-9 ftw). * doc/ref/posix.texi (File System): Add link to "File Tree Walk". doc: Use `@deffn {Scheme Procedure}' in `misc-modules.texi'. * doc/ref/misc-modules.texi: Use `@deffn {Scheme Procedure}' instead of `@defun'. 2011-12-18 Ludovic Courtès <ludo@gnu.org> ftw: Add `scandir'. Suggested by Nala Ginrut <nalaginrut@gmail.com>. * module/ice-9/ftw.scm (scandir): New procedure. * test-suite/tests/ftw.test ("scandir"): New test prefix. * doc/ref/misc-modules.texi (File Tree Walk): Document `scandir'. 2011-12-18 Ludovic Courtès <ludo@gnu.org> ftw: Add an optional `stat' parameter to `file-system-fold' and `-tree'. * module/ice-9/ftw.scm (file-system-fold): Add an optional `stat' parameter. Use it instead of `lstat'. Handle the case where (STAT child) fails. (file-system-tree): Likewise, and pass it to `file-system-fold'. * doc/ref/misc-modules.texi (File Tree Walk): Update the documentation of these functions. 2011-12-15 Ludovic Courtès <ludo@gnu.org> Arrange to convert command-line arguments from the right encoding. This is a temporary workaround for the 2.0 stable series. The next stable series should have an implicit `setlocale (LC_ALL, "")' call, which will make this unnecessary. * libguile/feature.c (progargs_fluid): Rename to... (scm_program_arguments_fluid): ... this. Update users. * libguile/feature.h (scm_program_arguments_fluid): New internal declaration. * libguile/init.c (invoke_main_func): Call `scm_i_set_boot_program_arguments' instead of `scm_set_program_arguments'. * libguile/script.c (locale_arguments_to_string_list, scm_i_set_boot_program_arguments): New functions. (scm_compile_shell_switches): Use `locale_arguments_to_string_list'. * libguile/script.h (scm_i_set_boot_program_arguments): New internal declaration. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add `test-command-line-encoding'. * test-suite/standalone/test-command-line-encoding: New file. 2011-12-15 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `localcharset', with local patches. This follows Bruno Haible's suggestion at <http://lists.gnu.org/archive/html/guile-devel/2011-11/msg00055.html>. * m4/gnulib-cache.m4: Add `gl_LOCAL_DIR'; use `localcharset'. * Makefile.am (EXTRA_DIST): Add gnulib-local/lib/localcharset.[ch].diff. (TESTS_ENVIRONMENT): New variable. * gnulib-local/lib/localcharset.c.diff, gnulib-local/lib/localcharset.h.diff: New files. * test-suite/Makefile.am (TESTS_ENVIRONMENT): Add @LOCALCHARSET_TESTS_ENVIRONMENT@. * test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Likewise. 2011-12-14 Ludovic Courtès <ludo@gnu.org> Augment `.gitignore'. Update Gnulib to v0.0-6703-g4e0358a. Use `alignof_type' instead of `alignof'. * libguile/foreign.c: Use `alignof_type' instead of `alignof'; the latter was removed from Gnulib's <alignof.h> in 408e170e3ae81f73fb65686c5834693d89a96594 (Nov. 1 2011). * libguile/vm-i-scheme.c: Likewise. doc: Set document encoding to UTF-8; typeset my surname correctly. * doc/ref/guile.texi: Add @documentencoding. * doc/ref/history.texi: Always write "Court@`es". * doc/ref/preface.texi (Contributors): Likewise. 2011-12-13 Ludovic Courtès <ludo@gnu.org> Add `file-system-fold' and `file-system-tree' to (ice-9 ftw). * module/ice-9/ftw.scm (file-system-fold, file-system-tree): New procedures. * test-suite/tests/ftw.test (%top-srcdir, %test-dir): New variables. ("file-system-fold", "file-system-tree"): New test prefixes. * doc/ref/misc-modules.texi (File Tree Walk): Document `file-system-tree' and `file-system-fold'. 2011-12-12 Andy Wingo <wingo@pobox.com> add an apropos-hook to ice-9 session * module/ice-9/session.scm: #:keyword-ify the define-module form, and export apropos-hook. (apropos-hook): New hook. (apropos, apropos-fold): Run the apropos-hook. 2011-12-10 Andy Wingo <wingo@pobox.com> current-input-port et al are srfi-39 parameters * libguile/ports.c (scm_init_ports): Export the port fluids to Scheme, temporarily. * module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port' et al into srfi-39 parameters, backed by the exported fluids, then remove the fluids from the guile module. (%cond-expand-features): Add srfi-39. * module/srfi/srfi-39.scm: Re-export features from boot-9. * test-suite/tests/parameters.test: Add tests. 2011-12-08 Chris K. Jester-Young <cky944@gmail.com> fix compilation with gc 7.1 * configure.ac: Add checks for GC_gcollect_and_unmap and GC_get_unmapped_bytes. * libguile/gc-malloc.c (scm_realloc): GC_gcollect() if we don't have GC_gcollect_and_unmap. * libguile/gc.c (GC_get_heap_usage_safe): Likewise, don't GC_get_unmapped_bytes if the function doesn't exist. 2011-12-06 Ludovic Courtès <ludo@gnu.org> Add an exception printer for `getaddrinfo-error'. * module/ice-9/boot-9.scm (getaddrinfo-error-printer): New procedure. Use it as the `getaddrinfo-error' exception printer. 2011-12-06 Ludovic Courtès <ludo@gnu.org> peval: Truncate multiple values when extending the environment. Reported by Cédric Cellier <rixed@happyleptic.org>. * module/language/tree-il/peval.scm (truncate-values): New procedure. (make-operand): Call `truncate-values' SOURCE. * test-suite/tests/tree-il.test ("partial evaluation"): New tests for multiple value truncation. 2011-12-06 Andy Wingo <wingo@pobox.com> allow URIs of the form file:///etc/hosts * module/web/uri.scm (parse-authority): Allow empty authorities, so that we accept URIs of the form, file:///etc/hosts. * test-suite/tests/web-uri.test ("string->uri"): Add tests. Update a comment in (web client) * module/web/client.scm: Update a comment. 2011-12-05 Andy Wingo <wingo@pobox.com> warnings written to warning port * libguile/deprecation.c (scm_c_issue_deprecation_warning): * libguile/load.c (auto_compile_catch_handler): (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path): * module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers) (load-in-vicinity): * module/system/base/message.scm (warning): Write to the warning port. (*current-warning-port*): Alias the warning port. 2011-12-05 Andy Wingo <wingo@pobox.com> add current-warning-port * libguile/ports.h: * libguile/ports.c (scm_current_warning_port) (scm_set_current_warning_port): New functions, wrapping the Scheme parameter. * module/ice-9/boot-9.scm (current-warning-port): New parameter, defining a port for warnings. 2011-12-05 Andy Wingo <wingo@pobox.com> setting a parameter returns the previous value * module/ice-9/boot-9.scm (make-parameter): Setting a parameter by invoking it with an argument now returns the previous value. 2011-12-05 Andy Wingo <wingo@pobox.com> add srfi-39 parameters to boot-9 * module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?) (parameter-fluid, parameter-converter, parameterize): New top-level bindings, implementing SRFI-39 parameters. Currently, current-input-port and similar procedures are not yet parameters. * test-suite/Makefile.am: * test-suite/tests/parameters.test: Add tests, taken from srfi-39 tests. 2011-12-04 Andy Wingo <wingo@pobox.com> ice-9/poll: verify sizeof(struct pollfd) * libguile/poll.c (scm_init_poll): Define %sizeof-struct-pollfd. * module/ice-9/poll.scm: Check %sizeof-struct-pollfd. new print option escape-newlines, defaults to #t * libguile/private-options.h (SCM_PRINT_ESCAPE_NEWLINES_P): * libguile/print.c: Add new escape-newlines print option, defaulting to on. (write_character): For newlines, if SCM_PRINT_ESCAPE_NEWLINES_P, then print them as \n. (scm_init_print): Refactor print options initialization. ,language at REPL sets current-language * module/system/repl/command.scm (language): Set the *current-language*. * module/system/repl/repl.scm (start-repl): Create a new dynamic scope for *current-language*. 2011-12-02 Andy Wingo <wingo@pobox.com> fix `free' of mpz_to_str * libguile/numbers.c (scm_number_to_string): Don't `free' the result of mpz_get_str; use the mp free function. scm_gc_register_collectable_memory calls scm_gc_register_allocation * libguile/gc-malloc.c (scm_gc_register_collectable_memory): Call scm_gc_register_allocation. 2011-12-02 Andy Wingo <wingo@pobox.com> install gmp memory functions that let libgc know about allocations * libguile/numbers.c (custom_gmp_malloc, custom_gmp_realloc, custom_gmp_free): New static functions used by GMP for allocation. These are just wrappers for scm_malloc, scm_realloc, and free. (scm_init_numbers): If scm_install_gmp_memory_functions is nonzero, use mp_set_memory_functions to configure GMP to use custom_gmp_{malloc,realloc,free} for memory allocation. (scm_bigprint): Ask gmp for the function used to deallocate the string returned by mpz_get_str. * libguile/numbers.h: Declare scm_install_gmp_memory_functions. * libguile/guile.c: When running the Guile binary, install the gmp_memory_functions. Based on a patch by Mark H Weaver <mhw@netris.org>. 2011-12-01 Andy Wingo <wingo@pobox.com> fix deadlock in before-gc-hook on certain 7.2alpha gc versions * libguile/gc.c (scm_init_gc): Only adjust gc frequency in the gc start hook if we know that it won't take a lock. 2011-11-29 Andy Wingo <wingo@pobox.com> attempt to handle steady-state mallocations better * libguile/gc-malloc.c (scm_realloc): Call the new scm_gc_register_allocation() here. If we have to collect, do a GC_gcollect_and_unmap. * libguile/gc.c (scm_gc_register_allocation): Add a routine to track steady-state mallocation, and cause gc to run if there is a high mallocation rate. (adjust_gc_frequency): Reset the bytes-until-GC countdown timer. 2011-11-29 Andy Wingo <wingo@pobox.com> collect a little in call-with-new-thread * libguile/threads.c (scm_call_with_new_thread): Collect a little before making a new thread. Our adjust_gc_frequency hack doesn't work well if the main allocation load is thread creation, as in https://savannah.gnu.org/bugs/?34140. This does not appreciably affect the speed of the test in that bug, but does effectively limit the image size. adjust_gc_frequency before gc, for more precision * libguile/gc.c (scm_init_gc): Run the adjust_gc_frequency from the before-gc-hook, not the after-gc-hook. More precise, this way. fix uninitialized variable in gc.c * libguile/gc.c (get_image_size): Fix use of uninitialized variable. switch off debugging flag that was mistakenly left on * libguile/gc.c (HEURISTICS_DEBUG): Whoops, switch this off. increase garbage collection rate if the process is growing * configure.ac: Check for GC_get_free_space_divisor. * libguile/gc.c (GC_get_free_space_divisor): Define an implementation, if needed. (accumulate_gc_timer): Fix indentation. (get_image_size): New terrible hack. Needs implementations on other platforms. (adjust_gc_frequency): Attempt to adjust the GC frequency based on process image growth. Needs more comments. (scm_init_gc): Add the adjust_gc_frequency to the after_gc_c_hook. 2011-11-28 Andy Wingo <wingo@pobox.com> get heap stats with GC_get_heap_usage_safe, if available. * configure.ac: Check for GC_get_heap_usage_safe. * libguile/gc.c (SCM_DEFINE): Use GC_get_heap_usage_safe. 2011-11-26 Ludovic Courtès <ludo@gnu.org> FFI: Hold a weak reference to the procedure passed to `procedure->pointer'. * libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference to PROC. * test-suite/tests/foreign.test ("procedure->pointer")["procedure is retained"]: New test. 2011-11-23 Daniel Hartwig <mandyke@gmail.com> web-http.test validates headers * test-suite/tests/web-http.test (pass-if-parse): Validate header values as well. fix validators for various list-style headers * module/web/http.scm (default-val-validator): Valid with no value. (key-value-list?): Keys are always symbols, do not accept strings. (validate-param-list): Apply `valid?' to list elements. (validate-credentials): Validate param for Basic scheme, which is parsed as a string. (declare-symbol-list-header!): `list-of?' args were in wrong order. ("Cache-Control"): Replace `default-val-validator' with more specific procedure. ("Accept"): Validate on first param which has no value. 2011-11-23 Ludovic Courtès <ludo@gnu.org> Update cross-compilation instructions. * README (Cross building Guile): Update. 2011-11-23 Ludovic Courtès <ludo@gnu.org> configure: Make sure $GUILE_FOR_BUILD is suitable. * acinclude.m4 (GUILE_CHECK_VERSION, GUILE_CHECK_GUILE_FOR_BUILD): New macros. * configure.ac: Remove $GUILE_FOR_BUILD tests. Use `GUILE_CHECK_GUILE_FOR_BUILD'. 2011-11-23 Ludovic Courtès <ludo@gnu.org> Allow $GUILE_FOR_BUILD to use its own environment when cross-compiling. * am/guilec (.scm.go): Use `-L' to specify the search path. * module/Makefile.am (ice-9/psyntax-pp.go): Likewise. * meta/uninstalled-env.in (top_builddir): Leave $GUILE_LOAD_PATH, $GUILE_SYSTEM_PATH, and $GUILE_SYSTEM_EXTENSIONS_PATH unchanged when cross-compiling. 2011-11-23 Andy Wingo <wingo@pobox.com> Use default value for make-fluid in Scheme files * module/ice-9/boot-9.scm (%exception-handler) (%running-exception-handlers, read-eval?, *repl-stack*) (make-mutable-parameter): * module/ice-9/getopt-long.scm (%program-name): * module/language/elisp/runtime.scm (built-in-macro, defspecial): * module/srfi/srfi-39.scm (make-parameter/helper): * module/system/base/language.scm (*current-language*): * module/system/base/message.scm (*current-warning-port*): (*current-warning-prefix*): * module/system/base/target.scm (%target-type, %target-endianness) (%target-word-size): * module/texinfo/plain-text.scm (*indent*, *itemizer*): * benchmark-suite/lib.scm (prefix-fluid): * test-suite/lib.scm (prefix-fluid): Give fluids a useful default value. use new scm_make_fluid_with_default * libguile/load.c (scm_init_load): * libguile/ports.c (scm_init_ports): * libguile/read.c (scm_init_read): Use scm_make_fluid_with_default. 2011-11-23 Andy Wingo <wingo@pobox.com> optional default-value arg to make-fluid * libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the default value in the dynamic-state vector to be SCM_UNDEFINED instead of SCM_BOOL_F. If the value in the dynamic-state is #f, default to a value attached to the fluid instead. This allows useful default values. (scm_make_fluid_with_default): New function, allows the user to specify a default value for the fluid. Defaults to #f. Bound to `make-fluid' on the Scheme side. (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all threads. (scm_fluid_unset_x): Also unset the default value. Not sure if this is the right thing. (fluid_ref): Update to the new default-value strategy. * libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED. * libguile/threads.h: Remove extra arg to scm_i_reset_fluid. * libguile/vm-i-system.c (fluid-ref): Update to new default-value strategy. * module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all threads. Fixes http://debbugs.gnu.org/10093. 2011-11-22 Ludovic Courtès <ludo@gnu.org> Leave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling. * meta/uninstalled-env.in: Don't define $GUILE_LOAD_COMPILED_PATH when cross-compiling. Build `psyntax-pp.go' with `--target=$(host)'. * module/Makefile.am (ice-9/psyntax-pp.go): Pass `--target=$(host)'. Run `guild compile' with `--target=$(host)'. * am/guilec (.scm.go): Run `guild compile' with `--target=$(host)'. 2011-11-22 Ludovic Courtès <ludo@gnu.org> Add a `--target' option to `guild compile'. * module/scripts/compile.scm (%options)["--target"]: New option. (show-version): Update copyright year. (compile): Use `with-target' to install the target. * doc/ref/api-evaluation.texi (Compilation): Mention `--target' option. 2011-11-22 Ludovic Courtès <ludo@gnu.org> Add missing implicit `SCM_API' for `scm_c_make_objcode_slice'. * libguile/objcodes.h (scm_c_make_objcode_slice): Add implicit `SCM_API'. 2011-11-22 Ludovic Courtès <ludo@gnu.org> Complete cross-compilation support. * module/system/base/target.scm (%target-endianness, %target-word-size): New fluids. (%native-word-size): New variable. (with-target): Set these fluids. (cpu-endianness, cpu-word-size, triplet-cpu, triplet-vendor, triplet-os): New procedures. (target-cpu, target-vendor, target-os): Use them. (target-endianness, target-word-size): Refer to the corresponding fluid. * libguile/objcodes.c (target_endianness_var, target_word_size_var): New global variables. (NATIVE_ENDIANNESS): New macro. (target_endianness, target_word_size, to_native_order): New functions. (make_objcode_from_file): Use `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'. (bytecode_to_objcode): New function, based on `scm_bytecode_to_objcode', with the addition of an `endianness' and `word_size' parameters. (scm_bytecode_to_objcode): Use it. (scm_bytecode_to_native_objcode): New function. (scm_write_objcode): Use `target_word_size' and `target_endianness'. Convert OBJCODE's len and meta-len to native byte order. (scm_init_objcodes): Initialize `target_endianness_var' and `target_word_size_var'. * libguile/objcodes.h (scm_bytecode_to_native_objcode): New declaration. * libguile/vm.c (really_make_boot_program): Use `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'. * test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size): New variable. (test-target): New procedure. ("cross-compilation"): Add `test-target' calls and the "unknown target" test. 2011-11-22 Ludovic Courtès <ludo@gnu.org> Fix `validate-target' in (system base target). * module/system/base/target.scm (validate-target): Accept any tuple with at least 3 parts. * test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure. ("cross-compilation"): New test prefix. 2011-11-21 Andy Wingo <wingo@pobox.com> deprecate direct scm_protects access * libguile/gc.h: * libguile/gc.c: Deprecate direct access to scm_protects. 2011-11-20 Ludovic Courtès <ludo@gnu.org> Allow overlapping regions to be passed to `bytevector-copy!'. Reported by Dmitry Chestnykh <dmitry@codingrobots.com>. Fixes <http://debbugs.gnu.org/10070>. * libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not `memcpy'. * test-suite/tests/bytevectors.test ("2.2 General Operations")["bytevector-copy! overlapping"]: New test. * doc/ref/api-data.texi (Bytevector Manipulation): Mention possible overlapping. 2011-11-17 Andy Wingo <wingo@pobox.com> eval.test work * test-suite/tests/eval.test ("stacks"): Enable another test, fix to use with-throw-handler, and remove a duplicate test, now that there is no difference between subrs and gsubrs. 2011-11-16 Ludovic Courtès <ludo@gnu.org> FFI: Hold a weak reference to the CIF made by `procedure->pointer'. * libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference to CIF so that it is not reclaimed before POINTER. Before that it could be reclaimed and typically reused to store the CIF of another procedure with the same arity, leading to obscure wrong-type-arg errors. FFI: Add a `procedure->pointer' test. * test-suite/tests/foreign.test ("procedure->pointer")["procedures returning a pointer"]: New test. 2011-11-16 Andy Wingo <wingo@pobox.com> fix urls in docs * doc/ref/intro.texi (Introduction): * doc/ref/scheme-reading.texi (Further Reading): * doc/ref/srfi-modules.texi (SRFI Support): Fix some urls. Thanks to Henrik Sandklef for the report. fix web.texi typo * doc/ref/web.texi (HTTP Headers): Fix a typo. Thanks to Brian Gough for the report. hack the port-column of current-output-port after printing a prompt * module/ice-9/boot-9.scm (repl-reader): Reset the output-column to 0 after printing the prompt. Fixes bug 9664. eval-when tidying up * module/ice-9/psyntax.scm: Rename expand-when-list to parse-when-list, and simplify to compare literal values. * module/ice-9/psyntax-pp.scm: Regenerate. psyntax: s/chi/expand/g * module/ice-9/psyntax.scm: Rename all instances of "chi" to "expand". Addded a hack to expand-eval-when that will be fixed later. * module/ice-9/psyntax-pp.scm: Regenerated. fix bug in make-repl when lang is actually a language * module/system/repl/common.scm (make-repl): Fix to accept language objects in addition to symbols. Fixes http://debbugs.gnu.org/9857. Thanks to Tristan Colgate for the report. 2011-11-16 Ludovic Courtès <ludo@gnu.org> Re-enable a couple of evaluator tests. These tests had been disabled as part of b7742c6b7132544b9d6cd9cb32c09e2084ad9e52 ("new evaluator, y'all"). * test-suite/tests/eval.test ("define set procedure-name")["closure"]: Change to `pass-if' since it now works, as a result of ee15aa46e3fb29e609bd7c431e8f2676f6573d57 ("set names of functions defined at the toplevel from `eval'"). ("stacks")["arguments of a gsubr stack frame"]: Remove (throw 'unresolved). 2011-11-16 Andy Wingo <wingo@pobox.com> memoize: booleanify the rest arg * libguile/memoize.c (memoize): Turn the rest arg into a boolean. Fixes an error when rest gets passed to set-procedure-minimum-arity!. 2011-11-15 Andy Wingo <wingo@pobox.com> set names of functions defined at the toplevel from `eval' * module/ice-9/eval.scm (primitive-eval): Set the name of toplevel-defined functions. 2011-11-15 Andy Wingo <wingo@pobox.com> better debuggability for interpreted procedures * libguile/procprop.c (scm_set_procedure_minimum_arity_x): New function, allows a user to override a function's arity. (scm_i_procedure_arity): Look up in the overrides table first. * libguile/procprop.h: Add scm_set_procedure_minimum_arity_x. * module/ice-9/eval.scm (primitive-eval): Override arity of "general closures". * test-suite/tests/procprop.test ("procedure-arity"): Add tests. Based on a patch from Stefan Israelsson Tampe. Test based on work by Patrick Bernaud. 2011-11-11 Andy Wingo <wingo@pobox.com> update letrec compilation test * test-suite/tests/tree-il.test ("letrec"): Update to clear the temporary `let' bindings. 2011-11-10 Andy Wingo <wingo@pobox.com> fix bit-set*! bug (!) * libguile/bitvectors.c (scm_bit_set_star_x): Fix a long-standing (since 2005) bug in which instead of using the kv bitvector, we actually use the `v' bitvector. Also, change to allow `kv' being shorter than `v'. * test-suite/tests/bitvectors.test ("bit-set*!"): Add tests. 2011-11-09 Andy Wingo <wingo@pobox.com> when leaving a non-tail let, allow bound vals to be collected * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Clear lexical stack slots at the end of a non-tail let, letrec, or fix. Fixes http://debbugs.gnu.org/9900. * test-suite/tests/gc.test ("gc"): Add test. 2011-11-09 Andy Wingo <wingo@pobox.com> simplify primitives.scm for dynwind * module/language/tree-il/primitives.scm (*primitive-expand-table*): Remove a dynwind hack, as we have a good inliner now. 2011-11-09 Andy Wingo <wingo@pobox.com> peval: fix dynwind bug. * module/language/tree-il/peval.scm (peval): The <dynwind> compiler will copy the winder and unwinder values, so make sure that they are constant, and if not, create lexical bindings. Fixes http://debbugs.gnu.org/9844. * test-suite/tests/tree-il.test ("partial evaluation"): Add a couple <dynwind> tests. 2011-11-09 Andy Wingo <wingo@pobox.com> fix <dynwind> serialization. * module/language/tree-il.scm (unparse-tree-il): Fix <dynwind> serialization. peval: don't copy assigned lexical bindings * module/language/tree-il/peval.scm (peval): Since constant-expression? is used to determine whether to copy values, return #f if any lexical is assigned. 2011-11-01 Ian Price <ianprice90@googlemail.com> Fix R6RS `fold-left' so the accumulator is the first argument. * module/rnrs/lists.scm (fold-left): New procedure. * module/rnrs/records/syntactic.scm (define-record-type): Fix to use corrected `fold-left'. * test-suite/tests/r6rs-lists.test: Add tests. 2011-10-22 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. Fix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2. * libguile/deprecated.c (init_module_stuff, scm_primitive_make_property): Use `scm_is_false' instead of direct comparison to SCM_BOOL_F'. (maybe_close_port, scm_close_all_ports_except): Use `SCM2PTR' and `PTR2SCM' instead of wild casts. Bump version number for 2.0.3. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions `scm_is_exact' etc. (LIBGUILE_INTERFACE_AGE): Increment. Update Gnulib to v0.0-6523-gb3609c1. doc: Document the `sitedir' and `extensiondir' pkg-config variables. * doc/ref/libguile-parallel.texi (Parallel Installations): Document the `sitedir' and `extensiondir' pkg-config variables. This fixes <https://savannah.gnu.org/bugs/index.php?32515>, reported by Dale. P. Smith. 2011-10-22 Bake Timmons <b3timmons@speedymail.org> Fix compilation with `--enable-debug-malloc'. * libguile/gc-malloc.c (scm_gc_register_collectable_memory): Add the missing second argument in the call to scm_malloc_register. 2011-10-22 Ludovic Courtès <ludo@gnu.org> Initialize `get_internal_run_time' before it is used. * libguile/init.c (scm_i_init_guile): Call `scm_init_stime' before `scm_init_gc'. Fixes <https://savannah.gnu.org/bugs/?34616> reported by Bake Timmons. 2011-10-22 BT Templeton <bpt@hcoop.net> set width for `,trace' command * module/system/repl/command.scm (trace): Set trace width to terminal width by default. 2011-10-21 Andy Wingo <wingo@pobox.com> fix segfault in goops if class fields are redefined * libguile/goops.c (map, filter_cpl, remove_duplicate_slots): Use scm_is_pair instead of !scm_is_null, given that we use accessor macros. (check_cpl, build_slots_list): Check that descendents of <class> can't redefine slots of <class>. * test-suite/tests/goops.test ("defining classes"): Add a test. Patch originally by Stefan Israelsson Tampe. 2011-10-20 Andy Wingo <wingo@pobox.com> fix misallocation of some <fix> procedures * module/language/tree-il/analyze.scm (analyze-lexicals): When stepping into a non-tail form, we know that labels allocation will be invalid, so use an empty labels set. Fixes http://debbugs.gnu.org/9769. * test-suite/tests/tree-il.test ("labels allocation"): Add a test. 2011-10-19 Andy Wingo <wingo@pobox.com> slight frames.h refactor * libguile/frames.h: Instead of doing a lot of nasty pointer match and casts here, simply define a struct that aliases the contents of a stack frame. There are some naming issues here, that the SCM_FRAME macros access the scm_vm_frame structure, but SCM_VM_FRAME macros access scm_frame; oh well. 2011-10-18 Ludovic Courtès <ludo@gnu.org> doc: Add `libguile-parallel.texi' to the distribution. This is a followup to d32df1325dfe5f550cf1262dc7e90ba86b526a7c ("manual: reorganize autoconf, pkg-config info"). * doc/ref/Makefile.am (guile_TEXINFOS): Add `libguile-parallel.texi'. 2011-10-17 Andy Wingo <wingo@pobox.com> fix (web http) write-date for mondays * module/web/http.scm (write-date): Fix bug on Mondays. Jeez! 2011-10-16 Ludovic Courtès <ludo@gnu.org> doc: Complete renaming of `autoconf.texi'. This is a followup to d32df1325dfe5f550cf1262dc7e90ba86b526a7c ("manual: reorganize autoconf, pkg-config info"). * doc/ref/Makefile.am: Replace references to `autoconf.texi' by `libguile-autoconf.texi'. 2011-10-16 Ludovic Courtès <ludo@gnu.org> Update (ice-9 match) from Chibi-Scheme. * module/ice-9/match.scm (match): Remove macro. * module/ice-9/match.upstream.scm: Update from Chibi-Scheme, which fixes <http://debbugs.gnu.org/9567>. * test-suite/tests/match.test.upstream: Likewise. 2011-10-15 Ludovic Courtès <ludo@gnu.org> coverage: Add tests for `case-lambda'. * test-suite/tests/coverage.test ("line-execution-counts")["case-lambda"]: New test. ("procedure-execution-count")["case-lambda"]: New test. doc: Mention the partial evaluator next to `define-inlinable'. * doc/ref/api-procedures.texi (Inlinable Procedures): Mention inlining performed by the partial evaluator. coverage: Add test with `eval'. * test-suite/tests/coverage.test (test-procedure): New procedure. ("procedure-execution-count")["called from eval"]: New test. 2011-10-15 Cedric Cellier <cedric.cellier@securactive.net> Default to using poll(2) in `fport_input_waiting'. * libguile/fports.c (fport_input_waiting): Use poll(2) instead of select(2) when possible. Cosmetic changes by Ludovic Courtès. 2011-10-12 Andy Wingo <wingo@pobox.com> update NEWS for 2.0.3 * NEWS: Update. 2011-10-12 Andy Wingo <wingo@pobox.com> add "Installing Site Packages" * doc/ref/scheme-using.texi (Installing Site Packages): Add a new section about where to install .scm, .go, and .so files. * doc/ref/tour.texi: Reference it here. * doc/ref/guile.texi: Add new section. 2011-10-12 Andy Wingo <wingo@pobox.com> update tour.texi for site modules and extensions * doc/ref/tour.texi (Putting Extensions into Modules) (Writing new Modules): In the examples, show the files as being in the "site" dirs. 2011-10-12 Andy Wingo <wingo@pobox.com> manual: reorganize autoconf, pkg-config info * doc/ref/libguile-parallel.texi: New file, documenting parallel installation and the use of pkg-config. * doc/ref/libguile-linking.texi: Adapt. * doc/ref/libguile-autoconf.texi: Rename from autoconf.texi. Lower sections, and integrate in the "Programming in C" chapter. * doc/ref/guile.texi: Adapt. 2011-10-12 Andy Wingo <wingo@pobox.com> remove documentation on autofrisk foo * doc/ref/autoconf.texi: Remove documentation on autofrisk facility, given that we do not ship those macros, and to my knowledge, never have. add (web client) docs * doc/ref/web.texi (Web Client): New doc section. 2011-10-10 Andy Wingo <wingo@pobox.com> fold constants with accessors * module/language/tree-il/peval.scm (peval): Factor constant folding out to a helper. Use it in the accessor case in addition to the normal effect-free-primitive case. * test-suite/tests/tree-il.test: Add a test. 2011-10-10 Andy Wingo <wingo@pobox.com> recognize string primitives * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add string?, string-length, and ref and set. (*primitive-accessors*): Add string-ref. (*effect-free-primitives*): Add string-length and string? (*effect+exception-free-primitives*): Add string?. (*singly-valued-primitives*): Add string-length and ref and set. 2011-10-10 Andy Wingo <wingo@pobox.com> add ,expand and ,optimize * module/system/repl/command.scm (*command-table*, expand, optimize): New meta-commands. * module/system/repl/common.scm (repl-expand, repl-optimize): New helpers. * doc/ref/scheme-using.texi (Compile Commands): Document. 2011-10-10 Andy Wingo <wingo@pobox.com> regenerate psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate, now with inlined letrec bindings. Whee!! 2011-10-10 Andy Wingo <wingo@pobox.com> peval support for memq and memv * module/language/tree-il/peval.scm (peval): Add special handlers for memq and memv, as inline.scm used to have. This is important for `case' clauses. It is very ugly, though. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests. 2011-10-10 Andy Wingo <wingo@pobox.com> add accessor-primitive?, peval uses it * module/language/tree-il/primitives.scm (*primitive-accessors*): New set of primitives: those that access mutable memory, but are otherwise pure. Include bytevector references here. (accessor-primitive?): New public predicate. * module/language/tree-il/peval.scm (peval): Refactor to distinguish constructor-primitive? from accessor-primitive?. 2011-10-10 Andy Wingo <wingo@pobox.com> peval: visit operands on-demand, to inline mutually recursive bindings This commit changes to use <operand> structures to hold the context needed to visit lexical bindings lazily, in context, instead of eagerly visiting them for value. This laziness enables inlining of mutually recursive bindings. * module/language/tree-il/peval.scm (<var>): Remove comment about copy propagation having to run build-var-table; things don't work like that any more. (build-var-table): Build <var> entries for all variables, even unreferenced variables. (alpha-rename): Remove. We will rename bindings on-demand now. (peval lookup-var): New helper, to fetch the <var> of a gensym. (peval fresh-gensyms): Fold here, under peval, and in it, handle updating the store to record a mapping between new names and <var> entries from the source program. (peval record-source-expression): Don't call build-var-table on the new expression, as alpha-renaming happens on-demand now. (peval prune-bindings): Rewrite to work with mutually-recursive bindings, while optionally preserving binding order. (peval extend-env): New helper. (peval loop): OK, here goes... Remove the `operand' context, as now we visit operands lazily. Add a `call' context, which does not copy-propagate lambda expressions, used to residualize a call after aborting an inlining attempt. Change the `env' to be a mapping of gensym to <operand>. Instead of looking up the operand's binding then alpha-renaming it, just rely on the fact that visiting the operand will rename it if necessary. If we residualize a lexical, do so with the fresh name from the environment. If we visit an operand and it doesn't turn out to be constant, we will never be able to copy it, and so cache that fact in the operand. If we residualize a binding and we know what the value should be, record that binding so that prune-bindings won't have to visit it again. If the operand folds to a constant, cache that too, to save effort when unrolling loops. For let, letrec, fix, and lambda-case, instead of visiting the bindings eagerly for value, simply record the source expressions and environments in an <operand> and rely on copy-propagation to visit them later in the right context. In the case of letrec and fix, this allows mutually-recursive bindings to be inlined. Refactor folding of "constructors" (which still need renaming) to avoid visiting operands twice in some contexts. For applications, if we have to abort, process the procedure in call context, which allows some folding but avoids copying lambdas. If we find a recursive procedure, mark intervening counters as recursive too, to allow for mutual recursion at the top level. For lambdas, if we are processing for value, record the source expression so we can detect recursion. This was previously done in the lexical-ref copy propagator. * test-suite/tests/tree-il.test ("partial evaluation"): Remove unused recursive lexicals in a couple of cases. Add a couple test cases for pruning. Add a few recursive binding cases. 2011-10-10 Andy Wingo <wingo@pobox.com> peval: add operand structure * module/language/tree-il/peval.scm (<operand>): Add operand structure, to be used by peval. peval: refactor logging * module/language/tree-il/peval.scm: Make it easier to turn on logging. 2011-10-10 Mike Gran <spk121@yahoo.com> New functions scm_is_exact and scm_is_inexact * doc/ref/api-data.texi (Exact and Inexact Numbers): doc for scm_is_exact and scm_is_inexact * libguile/numbers.c (scm_is_exact, scm_is_inexact): new functions * libguile/numbers.h: declarations for scm_is_exact and scm_is_inexact * test/suite/standalone/test-conversion.c (test_is_exact, test_is_inexact): new tests 2011-10-09 Mike Gran <spk121@yahoo.com> Document SCM_ASSERT_TYPE and SCM_ASRTGO macros * doc/ref/api-control.texi (Signalling Type Errors): document macros 2011-10-08 Andy Wingo <wingo@pobox.com> peval: logging * module/language/tree-il/peval.scm: Define a quick and dirty infrastructure for logging. Use it in peval. 2011-10-07 Andy Wingo <wingo@pobox.com> peval: bugfix in constant-expression? * module/language/tree-il/peval.scm (constant-expression?): Correctly handle lambda-case alternates. optimizer verifies its output * module/language/tree-il/optimize.scm: Verify the result of partial evaluation. add tree-il verifier * module/Makefile.am: Add debug.scm. * module/language/tree-il/debug.scm: New file, a verifier for tree-il. 2011-10-06 Andy Wingo <wingo@pobox.com> peval refactor * module/language/tree-il/peval.scm (peval): Refactor the for-value, etc helpers. comment peval.scm * module/language/tree-il/peval.scm: Add comments. Move alpha-rename later in the file. 2011-10-05 Andy Wingo <wingo@pobox.com> fix reading of #||||# * libguile/read.c (scm_read_r6rs_block_comment): * test-suite/tests/reader.test ("reading"): Fix reading of #||||#, originally reported in bug debbugs.gnu.org/9672, by Bruno Haible. Thanks, Bruno! 2011-09-30 Ludovic Courtès <ludo@gnu.org> peval: Add test for possible infinite recursion. * test-suite/tests/tree-il.test ("partial evaluation"): Add test. Add link to the (ice-9 match) bug. * module/ice-9/match.scm: Add comment. 2011-09-30 Ludovic Courtès <ludo@gnu.org> peval: Recognize module-refs to primitives. * module/language/tree-il/optimize.scm (peval): Handle module-refs to primitives. * test-suite/tests/tree-il.test ("partial evaluation"): Add test, using `pmatch'. 2011-09-28 Andy Wingo <wingo@pobox.com> generate psyntax-pp in canonical form * module/ice-9/compile-psyntax.scm (source): Canonicalize after optimizing. The optimizer should be a little more clever, but currently fix-letrec outputs some non-canonical forms. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-09-28 Andy Wingo <wingo@pobox.com> separate peval and a new canonicalization pass into their own modules * module/language/tree-il/peval.scm: Move to its own file. Remove the bits about <prompt> thunk-application bodies, as they are not optimizations, simply expectations of the compiler. `canonicalize' handles that now. * module/language/tree-il/optimize.scm: Use peval from its module. Don't call `inline!', as that's useless now. * module/language/tree-il/canonicalize.scm: New file, implementing a pass that `compile-tree-il' runs on the result from the optimizer. The compiler currently expects a <let> form to have bindings, for example, and this pass turns a <let> without bindings into its body. * module/language/tree-il/inline.scm: Deprecate, as `peval' does everything this function ever did. * module/language/tree-il/compile-glil.scm: Canonicalize after optimizing. This should allow us to skip the optimizer entirely, if we want. * module/Makefile.am: Update and reorder a little bit. 2011-09-28 Andy Wingo <wingo@pobox.com> regenerate psyntax-pp.scm, with optimizations * module/ice-9/psyntax-pp.scm: Regenerate. ((lambda ...) ...) fix * module/language/tree-il/optimize.scm (peval): If it's a lambda in the operator position, inline without a nested counter, as it's not possible to increase code size. peval: more effective binding pruning * module/language/tree-il/optimize.scm (peval): Factor prune-bindings out of `let' and company. Have it process unreferenced bindings in effect context instead of always residualizing non-constant expressions. don't propagate pure primcalls that might not type-check * module/language/tree-il/optimize.scm (types-check?): New helper, to determine if a primcall will apply without throwing an exception. (peval): constant-expression? returns #f for expressions that don't types-check?. Effect-free primitives that type-check are void. fix unparse-tree-il of <dynset> * module/language/tree-il.scm (unparse-tree-il): Fix printing of `dynset'. peval works on all expressions * module/language/tree-il/optimize.scm (alpha-rename, peval): Add <dynset> cases. Allow any kind of <application>. Remove the `catch' wrapper as now peval handles all kinds of expressions. 2011-09-28 Andy Wingo <wingo@pobox.com> peval: elide make-prompt-tag in effect context * module/language/tree-il/optimize.scm (peval): Fix a duplicate traversal for constructors in effect or test context. Add support for eliding make-prompt-tag. * test-suite/tests/tree-il.test ("partial evaluation"): Update the test for make-prompt-tag elision. 2011-09-28 Andy Wingo <wingo@pobox.com> peval: add support for <prompt> and <abort> * module/language/tree-il/optimize.scm (alpha-rename, peval): Handle <prompt> and <abort>. Attempt to remove the prompt if the tag is otherwise unreferenced. * module/language/tree-il/primitives.scm (*primitive-constructors*): Add make-prompt-tag as a constructor. * test-suite/tests/tree-il.test ("partial evaluation"): Add a test that an prompt whose tag is unreferenced is removed. 2011-09-28 Andy Wingo <wingo@pobox.com> peval: fix algorithmic behavior of `cons' * module/language/tree-il/optimize.scm (peval): Fix treatment of `cons' to not process the value twice, leading to n^2 work. This prevented primitives.scm from compiling in a reasonable amount of time, because it contained a `(foo ... ,@bar) form that resulted in a long sequence of nested conses, and no effort counter was in place as it was not within an inlining attempt. 2011-09-27 Ludovic Courtès <ludo@gnu.org> doc: (ice-9 match) doesn't have `__1'. * doc/ref/match.texi (Pattern Matching): Remove `__1', which doesn't exist. Thanks to Chris K. Jester-Young. doc: Update (ice-9 match) reference. * doc/ref/match.texi (Pattern Matching): Document `***', `..1', and `__1'; remove `..k' and `__k'. Reported by Chris K. Jester-Young. doc: Fix typesetting of function definitions in "Accessing Modules from C". * doc/ref/api-modules.texi (Accessing Modules from C): Use the phrase "C Function" instead of "C Procedure". Enclose multiple-word type names in braces. Reported by Dale P. Smith. 2011-09-27 Andy Wingo <wingo@pobox.com> peval: more strict accounting * module/language/tree-il/optimize.scm (transfer!, make-nested-counter): (make-recursive-counter, peval): Limit the algorithm's time to be strictly O(N) by transferring effort and size counters of recursive inlining attempts from containing counters. * test-suite/tests/tree-il.test ("partial evaluation"): Update expectations for the ((lambda (x) (x x)) (lambda (x) (x x))) case, as the new accounting policy will cause the entire inlining attempt to abort. 2011-09-26 Andy Wingo <wingo@pobox.com> peval: fix inlining of lambda* with #:optional * module/language/tree-il/optimize.scm (peval): Fix calculation of how many init expressions to drop when inlining lambdas. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests. 2011-09-26 Andy Wingo <wingo@pobox.com> remove unused peval helpers * module/language/tree-il/optimize.scm (peval): Remove a couple unused helpers. 2011-09-25 Andy Wingo <wingo@pobox.com> peval: simpler and more precise treatment of mutability * module/language/tree-il/optimize.scm (peval): The old approach of optimistically producing constants and then de-constifying them at their uses was not only cumbersome but incorrect: it both failed to preserve identity in some cases and failed to retain immutable constant values. Instead, now we only produce constants if they really are constant and immutable. The constant folder has to have a few more algebraic cases to be as effective as it was, to destructure (car (cons _ _)) appropriately. On the plus side, now constructors and deconstructors can handle impure cases more generally. * test-suite/tests/tree-il.test ("partial evaluation"): Add constructor and destructuring tests. Adapt other tests to new expectations. 2011-09-25 Andy Wingo <wingo@pobox.com> peval: add a bunch of missing maybe-unconst calls * module/language/tree-il/optimize.scm (peval): Add missing maybe-unconst calls. Things are getting ugly. They will get better in the next commit though. 2011-09-25 Andy Wingo <wingo@pobox.com> peval uses effort counters, propagates lambdas more effectively * module/language/tree-il/optimize.scm (code-contains-calls?): Remove this helper, we will deal with recursion when it happens, not after the fact. (peval): Add keyword args for various size and effort limits. Instead of keeping a call stack, keep a chain of <counter> records, each with an abort continuation. If ever an inlining attempt is taking too long, measured in terms of number of trips through the main loop, the counter will abort. Add new contexts, `operator' and `operand'. They have different default size limits. In the future we should actually use the size counter, instead of these heuristics. The <lexical-ref> case is smarter now, and tries to avoid propagating too much data. Perhaps it should be dumber though, and use a counter. That would require changes to the environment structure. Inline <lambda> applications to <let>, so that we allow residual lexical references to have bindings. Add a `for-operand' helper, and use it for the RHS of `let' expressions. A `let' is an inlined `lambda'. `Let' and company no longer elide bindings if the result is a constant, as the arguments could have effects. Peval will still do as much as it can, though. * test-suite/tests/tree-il.test ("partial evaluation"): Update the tests for the new expectations. They are uniformly awesomer, with the exception of two cases in which pure but not constant data is not propagated. 2011-09-24 Andy Wingo <wingo@pobox.com> prune unused letrec bindings * module/language/tree-il/optimize.scm (peval): Prune unused `letrec' bindings. more peval refactoring * module/language/tree-il/optimize.scm (peval): Rename `var-table' to `store', as we're going to put some more things in it. Rename `record-lexical-bindings' to `record-source-expression', which also takes the original, pre-renaming expression. Keep a mapping from new expressions to original expressions, available using the `source-expression' helper. add helpers for effort counters * module/language/tree-il/optimize.scm (<counter>, abort-counter) (record-effort!, record-size!, find-counter, make-top-counter) (make-nested-counter, make-recursive-counter): New helpers, as yet unused, but which will implement fixed effort bounds on the inlining algorithm. peval refactor * module/language/tree-il/optimize.scm (peval): Add for-value, for-test, for-effect, and for-tail helpers. Use them. 2011-09-24 Andy Wingo <wingo@pobox.com> attempt to prune unreferenced bindings * module/language/tree-il/optimize.scm (peval): Rename `record-lexicals' to `record-lexical-bindings'. Record residualized lexical references. Record lexical references in maybe-unlambda. Unfortunately this has the disadvantage that the speculative mapping of lambda expressions to lexical references records that reference, even if we are not going to residualize it. After processing a `let', prune pure unreferenced bindings. (We can do better than this in the future: we can simply process them for effect.) * test-suite/tests/tree-il.test (pass-if-peval): More debugging. ("partial evaluation"): Update to reflect the fact that the `y' binding won't be emitted. 2011-09-24 Andy Wingo <wingo@pobox.com> peval handles lexical-set * module/language/tree-il/optimize.scm (alpha-rename, peval): Add support for lexical-set, while avoiding copy propagation and pruning of assigned variables. peval: pre-analyze mutated or reffed-once lexicals * module/language/tree-il/optimize.scm (<var>, build-var-table, peval): Before going into peval, build a table indicating refcounts and a set? flag for all lexicals. Add to the table when introducing new bindings (via alpha-renaming). 2011-09-24 Andy Wingo <wingo@pobox.com> peval: don't propagate expressions that access memory * module/language/tree-il/optimize.scm (peval): Rename `pure-expression?' to `constant-expression?', in the sense of GCC's `pure' and `const'. A <toplevel-ref> is not constant, because it can be mutated. A <dynref> isn't constant either, for the same reason. * test-suite/tests/tree-il.test ("partial evaluation"): Add a test, and update existing tests that assumed that toplevel-ref would propagate. 2011-09-24 Andy Wingo <wingo@pobox.com> context-specific folding for peval in test and effect contexts * module/language/tree-il/optimize.scm (peval): Add a "test" context, which folds statically decidable values to <const>. Fold pure expressions to <void> in "effect" contexts. Adapt the <conditional> and <sequence> tests to simply look for <const> or <void> expressions, respectively. thread a context through peval * module/language/tree-il/optimize.scm (peval): Thread a "context" through the evaluator. 2011-09-24 Andy Wingo <wingo@pobox.com> paper around `match' bug * module/ice-9/match.scm (match): Always introduce a lexical binding, to avoid http://debbugs.gnu.org/9567. Real fix ongoing. Patch and original report by Stefan Israelsson Tampe. * test-suite/tests/match.test: Add test. 2011-09-24 Andy Wingo <wingo@pobox.com> peval: various bugfixes * module/language/tree-il/optimize.scm (alpha-rename): Rename the init expressions of a <lambda-case>. (peval): Coalesce the <let-values> clauses. Fix pure-expression? matching of <lambda> clauses. Loop over and maybe-unconst the inits of a <lambda-case>. tree-il-any bugfix * module/language/tree-il/optimize.scm (tree-il-any): Fix to be called on all values, including leaves. It didn't matter for the use case, though. minor peval style tweak * module/language/tree-il/optimize.scm (peval): Minor refactor to <lexical-ref> copy propagation. fix alpha-rename for kwargs * module/language/tree-il/optimize.scm (alpha-rename): Fix alpha-renaming of keyword arguments. 2011-09-23 Ludovic Courtès <ludo@gnu.org> peval: Add test for multiple-value returns. * test-suite/tests/tree-il.test (pass-if-peval): Support the `resolve-primitives' keyword. ("partial evaluation"): Add test for `call-with-values'. peval: Rectify style. * module/language/tree-il/optimize.scm (peval): Rename `src' to `lv-src', and `src2' to `src'; pass `make-let-values' the right source locations. Reindent `let*'. 2011-09-23 Andy Wingo <wingo@pobox.com> prevent propagation for memory-dependent operations like `car' * module/language/tree-il/primitives.scm (*primitive-constructors*): Record car, cdr, vector-ref, and struct-ref as "constructors". Comment to come later. (*effect-free-primitives*): Update. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests. 2011-09-21 Andy Wingo <wingo@pobox.com> peval comment & reindentation * module/language/tree-il/optimize.scm (peval): Add a comment regarding failure modes, and reindent one clause. fix comment regarding alpha-renaming * module/language/tree-il/optimize.scm (peval): Fix comment regarding alpha-renaming: it's not simply the allocator that needs unique names; rather, all transformations depend on it. better pure-expression? * module/language/tree-il/optimize.scm (peval): Allow dynref, fix, and let-values to be pure expressions. more alpha-rename robustness * module/language/tree-il/optimize.scm (alpha-rename): Handle all kinds of tree-il, with the current exceptions of lexical set!, prompt, and abort. more robust alpha-renaming * module/language/tree-il/optimize.scm (fresh-gensyms): New helper. (alpha-rename): Name the new gensyms using the old names as templates, not the old gensyms. This prevents accidental collisions between gensyms, if #{x 1}# becomes #{x 12}# instead of #{x 2}#. peval: inlining of let-values * module/language/tree-il/optimize.scm (peval): Add support for let-values. Try to inline the consumer into the body of the producer, if there is only one return point, and we can figure out how many values are being returned, and that number is compatible with the consumer. peval support for more forms * module/language/tree-il/optimize.scm (peval): Add support for fix, dynwind, dynlet, dynref, module-set, and toplevel-set. (Mutating a variable directly is similar to calling a function that does so behind our backs, so this presents no additional problem.) add singly-valued-primitive? * module/language/tree-il/primitives.scm (singly-valued-primitive?): New predicate, for primitives that return exactly one value. more optimize.scm factoring * module/language/tree-il/optimize.scm (vlist-any): New helper. (peval): Use it here. optimize.scm refactor * module/language/tree-il/optimize.scm (let/ec, tree-il-any): New helpers. (code-contains-calls?): Use them here. 2011-09-21 Daniel Llorens <daniel.llorens@bluewin.ch> Fix compilation of untyped arrays of rank not 1 * module/language/glil/compile-assembly.scm: vector-fold2 expects vector. 2011-09-19 Julian Graham <julian@navigator.(none)> Remove extraneous semicolon from `SCM_STATIC_SUBR_OBJVECT' to prevent ISO C90 warning. * snarf.h (SCM_STATIC_SUBR_OBJVECT): Remove semicolon at end of macro definition. 2011-09-18 Ludovic Courtès <ludo@gnu.org> peval: Abort inlining when the residual code contains recursive calls. * module/language/tree-il/optimize.scm (code-contains-calls?): New procedure. (peval): Use it and abort inlining if the residual code of a procedure application contains recursive calls. Suggested by Wingo, Waddell, and Dybvig. Fixes <http://debbugs.gnu.org/9542>. * test-suite/tests/tree-il.test ("partial evaluation"): Update 2 tests that relied on the previous behavior. Add 1 another test. 2011-09-18 Ludovic Courtès <ludo@gnu.org> peval: Improve alpha-renaming test. * test-suite/tests/tree-il.test ("partial evaluation")["inlined lambdas are alpha-renamed"]: Rewrite. 2011-09-18 Ludovic Courtès <ludo@gnu.org> Arrange so that stack-cleaning loops in GC tests are not optimized out. * test-suite/tests/gc.test (stack-cleanup): New procedure. ("Unused modules are removed"): Use it. * test-suite/tests/threads.test (stack-cleanup): Likewise. ("mutex with owner not retained (bug #27450)"): Use it. 2011-09-17 Ludovic Courtès <ludo@gnu.org> peval: Typo. * module/language/tree-il/optimize.scm (peval)[maybe-unlambda]: Fix typo in comment. 2011-09-17 Ludovic Courtès <ludo@gnu.org> peval: Alpha-rename anonymous lambdas that are duplicated. * module/language/tree-il/optimize.scm (alpha-rename): New procedure. (peval)[maybe-unlambda]: Use it. * test-suite/tests/tree-il.test ("partial evaluation"): Add two test cases for <https://lists.gnu.org/archive/html/bug-guile/2011-09/msg00019.html>. 2011-09-13 Ludovic Courtès <ludo@gnu.org> peval: Use `resolve-primitives!'. * module/language/tree-il/optimize.scm (peval): Add `cenv' optional argument; caller updated. Use `resolve-primitives!' to resolve <primitive-ref> expressions. peval: Clarify `pure-expression?'. * module/language/tree-il/optimize.scm (peval)[pure-expression?]: Clarify the comment. 2011-09-13 Ludovic Courtès <ludo@gnu.org> peval: Inline thunks. * module/language/tree-il/optimize.scm (peval): Inline thunks. * test-suite/tests/tree-il.test ("partial evaluation"): Add test. 2011-09-13 Ludovic Courtès <ludo@gnu.org> peval: Use the right scope when replacing a lambda by a lexical-ref. * module/language/tree-il/optimize.scm (peval)[maybe-unlambda]: New procedures. Use it to de-duplicate named lambdas. This fixes the scoping bug described at <https://lists.gnu.org/archive/html/bug-guile/2011-09/msg00019.html>. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests to reproduce the bug. 2011-09-13 Ludovic Courtès <ludo@gnu.org> peval: Add tests for inlining with both static & dynamic arguments. * module/language/tree-il/optimize.scm (peval): Improve comment on the inlining heuristics. * test-suite/tests/tree-il.test ("partial evaluation"): Add two tests. 2011-09-11 Ludovic Courtès <ludo@gnu.org> peval: Propagate only pure expressions to lambdas. * module/language/tree-il/optimize.scm (peval): Propagate ARGS to BODY only when all of ARGS are pure. Change APP to use `maybe-unconst' for its arguments. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests for mutability preservation and non-propagation of non-constant arguments to lambdas. 2011-09-11 Ludovic Courtès <ludo@gnu.org> peval: Try hard to preserve mutability. * module/language/tree-il/optimize.scm (peval)[make-values]: Distinguish between 1 or another number of values. [mutable?, make-value-construction, maybe-unconst]: New procedures. Use it in <let>, <letrec>, <toplevel-define>, and <lambda-case>. * test-suite/tests/tree-il.test ("partial evaluation"): Add tests for mutability preservation. 2011-09-11 Ludovic Courtès <ludo@gnu.org> doc: Fix typo regarding vhashes. * doc/ref/api-compound.texi (VHashes): s/vlist-/alist-/. 2011-09-10 Andy Wingo <wingo@pobox.com> fix scm_to_latin1_stringn for substrings * libguile/strings.c (scm_to_latin1_stringn): Fix for substrings. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-scm-to-latin1-string.c: Add test case. Thanks to David Hansen for the bug report and test case, and Stefan Israelsson Tampe for the fix. 2011-09-10 Ian Price <ianprice90@googlemail.com> RFC 822 allows single digit days of the month * module/web/http.scm (parse-rfc-822-date): Add single digit day conditional. * test-suite/tests/web-http.test("general headers"): Add test. Fix --listen option to allow other ports * module/ice-9/command-line.scm (compile-shell-switches): Fix off-by-one error in 'substring', and swap branches of conditional. 2011-09-09 Ludovic Courtès <ludo@gnu.org> Unoptimize the busy loop of `statprof.test'. This is a followup to f9c1b8278dbf1992d83f91f91391ee39e714d364 ("Tweak `statprof.test' for faster machines."). * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Compile with `#:partial-eval? #f'. 2011-09-09 Ludovic Courtès <ludo@gnu.org> Remove unused macro in `tree-il.test'. * test-suite/tests/tree-il.test (assert-scheme->glil): Remove. doc: Use fashionable terminology for macros. * doc/ref/api-macros.texi (Macros): Mention EDSLs. 2011-09-09 Ludovic Courtès <ludo@gnu.org> Clarify `--debug' vs. `--no-debug'. * module/ice-9/command-line.scm (*usage*): Attempt to suggest that `--no-debug' doesn't inhibit debugging support. * doc/ref/guile-invoke.texi (Command-line Options): Make it clear that `--no-debug' doesn't inhibit debugging support. Reported by Manuel Serrano. 2011-09-09 Ludovic Courtès <ludo@gnu.org> Tweak `statprof.test' for faster machines. * test-suite/tests/statprof.test ("statistical sample counts within expected range"): Increase NUM-CALLS and the frequency so that they are at least a few samples on my new 2.6 GHz laptop. 2011-09-09 Ludovic Courtès <ludo@gnu.org> Add a partial evaluator for use in the compiler. Thanks to William R. Cook for his excellent tutorial, <http://softlang.uni-koblenz.de/dsl11/>. * module/language/tree-il/optimize.scm (optimize!): Call `peval' unless the #:partial-eval? option asks otherwise. (peval): New procedure. * module/language/tree-il/inline.scm: Add comment. * module/language/tree-il/primitives.scm (*primitive-constructors*): New variable. (*effect-free-primitives*): Use it. (constructor-primitive?): New primitive. * test-suite/tests/tree-il.test (assert-tree-il->glil): Extend to support `with-partial-evaluation', `without-partial-evaluation', and `with-options'. (peval): New binding. (pass-if-peval): New macro. ("lexical refs"): Run tests without partial evaluation. ("letrec"): Likewise. ("the or hack"): Likewise. ("conditional"): Likewise, for some tests. ("sequence"): Adjust to new generated code. ("partial evaluation"): New test prefix. 2011-09-06 Ludovic Courtès <ludo@gnu.org> Use (ice-9 match) instead of `record-case' where it improves readability. * module/language/tree-il/analyze.scm (goops-toplevel-definition, const-fmt): Replace `record-case' by `match'. (format-analysis): Likewise, partially. 2011-09-03 Ludovic Courtès <ludo@gnu.org> Fix misdiagnoses of deprecated `+nan.[^0]' forms. * libguile/numbers.c (mem2ureal): Check the result of `mem2uinteger' against `SCM_INUM0', not 0. (mem2uinteger): Add comment. doc: Augment "Pattern Matching" section. * doc/ref/match.texi (Pattern Matching): Mention records. Add an example showing record matching and the `=' pattern. Point users to `match.upstream.scm'. 2011-09-03 Ludovic Courtès <ludo@gnu.org> Update (ice-9 match) from Chibi-Scheme. * module/ice-9/match.scm (slot-ref, slot-set!, is-a?): New macros. * module/ice-9/match.upstream.scm: Update from Chibi-Scheme. * test-suite/Makefile.am (SCM_TESTS): Add `tests/match.test.upstream'. * test-suite/tests/match.test (rtd-2-slots, rtd-3-slots): New record types. ("matches")["records"]: New test prefix. ("doesn't match")["records"]: New test prefix. Include `match.test.upstream'. * test-suite/vm/t-match.scm (matches?): Fix `$' example. 2011-09-03 Ludovic Courtès <ludo@gnu.org> Remove Front-Cover and Back-Cover text from the manual. * doc/ref/guile.texi: Remove Front-Cover and Back-Cover text. 2011-09-03 Andy Wingo <wingo@pobox.com> deprecate +nan.1 * libguile/numbers.c (mem2ureal): Deprecate nan values that are not "+nan.0". 2011-09-02 Andy Wingo <wingo@pobox.com> fix srfi-67 compilation * module/srfi/srfi-67/compare.scm: Fix define-syntax-rule conversion. fix some cache consistency issues with goops and extended generics * module/oop/goops.scm (extended-by!, not-extended-by!) (upgrade-accessor, merge-generics): Invalidate the method cache after munging "extends" or "methods" fields. (invalidate-method-cache!): A new wrapper around %invalidate-method-cache!, that will also invalidate the caches of "extended-by" generics. (internal-add-method!, remove-class-accessors!): Use the new invalidate-method-cache!. document define-syntax-rule * doc/ref/api-macros.texi (Syntax Rules): Add define-syntax-rule. more define-syntax-rule usage * module/ice-9/boot-9.scm: * module/ice-9/control.scm: * module/ice-9/futures.scm: * module/ice-9/optargs.scm: * module/ice-9/poll.scm: * module/ice-9/receive.scm: * module/ice-9/threads.scm: * module/ice-9/vlist.scm: * module/language/assembly/compile-bytecode.scm: * module/language/ecmascript/compile-tree-il.scm: * module/language/tree-il.scm: * module/oop/goops.scm: * module/oop/goops/simple.scm: * module/oop/goops/stklos.scm: * module/srfi/srfi-1.scm: * module/srfi/srfi-35.scm: * module/srfi/srfi-39.scm: * module/srfi/srfi-45.scm: * module/srfi/srfi-67/compare.scm: * module/sxml/match.scm: * module/system/repl/error-handling.scm: * module/system/repl/repl.scm: * module/system/vm/inspect.scm: * module/texinfo.scm: * module/web/server.scm: Use define-syntax-rule, where it makes sense. 2011-09-02 Andy Wingo <wingo@pobox.com> psyntax uses define-syntax-rule * module/ice-9/psyntax.scm: Use define-syntax-rule. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-09-02 Andy Wingo <wingo@pobox.com> add define-syntax-rule * module/ice-9/psyntax.scm (define-syntax-rule): Add this new helper macro, to define a syntax-rules macro with one clause. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-08-29 Andy Wingo <wingo@pobox.com> fix scm_gc_strdup invocation * libguile/i18n.c (get_current_locale): Fix scm_gc_strdup invocation. texinfo: add paragraphindent * module/texinfo.scm (texi-command-specs): Add paragraphindent. 2011-08-23 Andy Wingo <wingo@pobox.com> module-stexi-documentation #:docs-resolver keyword arg * module/texinfo/reflection.scm (module-stexi-documentation): Make #:docs-resolver a keyword argument. Provide back compat with docs-resolver as an optional argument, though. 2011-08-23 Andy Wingo <wingo@pobox.com> texinfo: alias `url' to `uref'. * module/texinfo.scm (texi-command-specs, complete-start-command): Upstream texinfo has aliased `url' to `uref'. Let's do the same. * test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test. 2011-08-19 Andy Wingo <wingo@pobox.com> better guild help FOO * module/scripts/help.scm (show-help, show-summary, show-usage): Grovel for %synopsis and %help variables as well, and show them appropriately. Export these routines for other script modules to use. Needs documentation. 2011-08-18 Andy Wingo <wingo@pobox.com> fix order of importing modules and resolving duplicates handlers * module/ice-9/boot-9.scm (define-module*): Resolve duplicates handlers only after importing modules. Fixes a bug in which a module with #:use-module (oop goops) but whose merge-generics handler got resolved to noop instead of the real merge-generics handler. I can't think of an easy way to test this, though. Thanks to David Pirotte for the report! 2011-08-18 Andy Wingo <wingo@pobox.com> fix a couple of leaks * libguile/bytevectors.h: * libguile/bytevectors.c (scm_c_take_gc_bytevector): Rename this internal function, from scm_c_take_bytevector. This indicates that unlike the other scm_take_* functions, this one takes GC-managed memory. * libguile/objcodes.c (scm_objcode_to_bytecode): * libguile/vm.c (really_make_boot_program): Use scm_gc_malloc_pointerless, not scm_malloc. Thanks to Stefan Israelsson Tampe! * libguile/r6rs-ports.c: * libguile/strings.c: Adapt to renames. 2011-08-18 Andy Wingo <wingo@pobox.com> reword open-file docs * doc/ref/api-io.texi (File Ports): Refactor open-file docs. Thanks to Bake Timmons for the report. 2011-08-17 Andy Wingo <wingo@pobox.com> fix scm_tmpfile leak * libguile/posix.c (scm_tmpfile): Fix to actually close the new tmpfile, causing its deletion, while keeping an fd to the file open. Fixes a leak both in memory and disk space on POSIX systems; MINGW systems will leak however. A FIXME for later. fix r6rs `map' * module/rnrs/base.scm (map): Define a version of map that is safe for multiple returns, though slower. check that srfi-1 procedure arguments are procedures * module/srfi/srfi-1.scm (check-arg, wrong-type-arg): Refactor arg type checkers to be macros, and do the minimal amount of work in the functions themselves. Use these checkers consistently for all procedure arguments in this module. This catches user errors early; see bug 33628. fix recursive define-inlinable expansions * module/ice-9/boot-9.scm (define-inlinable): Prevent expansion from diverging by using fluid-let-syntax, as Dybvig suggests. srfi-9 record compatibility with boot-9 records * module/srfi/srfi-9.scm (define-record-type): Instead of defining the RTD using make-vtable, use make-struct with the record-type-vtable, and record the type name and fields names in the vtable. This way SRFI-9 records are compatible with boot-9 records. Also we use a generic printer, instead of generating one anew. 2011-08-16 Andy Wingo <wingo@pobox.com> fix leak in get_current_locale() * libguile/i18n.c (get_current_locale): Hold the locale name in a GC-managed string, not a mallocated string. Thanks to Stefan Israelsson Tampe for the report. 2011-08-12 Andy Wingo <wingo@pobox.com> fix take-right and drop-right for improper lists * libguile/srfi-1.h: * libguile/srfi-1.c (scm_srfi1_drop_right, scm_srfi1_take_right): Remove these internal functions, replacing with Scheme implementations. * module/srfi/srfi-1.scm (take-right, drop-right): Add these impls from the reference code. They do the right thing for improper lists, according to the spec, but they diverge for circular lists. Oh well. * test-suite/tests/srfi-1.test ("drop-right", "take-right"): Add more tests. 2011-08-04 Andy Wingo <wingo@pobox.com> fix tree-il->scheme test * module/language/tree-il.scm (tree-il->scheme): Fix incorporation of `lambda' in a `case-lambda'. * test-suite/tests/tree-il.test ("tree-il->scheme"): Add a test. 2011-08-04 Andy Wingo <wingo@pobox.com> (web http): locale-independent parsing and serialization of dates * module/web/http.scm (parse-month, parse-rfc-822-date): (parse-rfc-850-date, parse-asctime-date, parse-date): (write-date): Parse and write dates without regard to the current locale, using a custom parser. Also permits parsing of the deprecated RFC 850 and asctime() date formats. 2011-08-04 Andy Wingo <wingo@pobox.com> srfi-19 refactor * module/srfi/srfi-19.scm (priv:locale-number-separator, priv:locale-am) (priv:locale-am): Inline definitions. Strip priv: prefix from module vars, as it's unnecessary, except for in a couple cases. 2011-08-03 Andy Wingo <wingo@pobox.com> avoid duplicate stats when searching for files in a path * libguile/load.c (search_path): Extract from scm_search_path, to give the caller the stat buffer of the found path. (scm_search_path, scm_sys_search_load_path): Adapt accordingly. (compiled_is_fresh): Take the stat buffers directly. (scm_primitive_load_path, scm_init_eval_in_scheme): Adapt to search_path / compiled_is_fresh changes to avoid duplicate states in search-path. fix unnecessary call to canonicalize_path in load-path fast case * libguile/load.c (scm_primitive_load_path): Don't canonicalize the filename unless we need to look in the fallback path. Fixes a stat explosion; see http://savannah.gnu.org/bugs/?33815. 2011-07-29 Andy Wingo <wingo@pobox.com> simplify narrow_stack. * libguile/stacks.c (narrow_stack): Simplify outer narrowing by a number of frames. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. style fix in read.c * libguile/read.c (scm_read_sexp): No need to assign to tmp here. minor style fix in bytevectors.c * libguile/bytevectors.c (SCM_BYTEVECTOR_HEADER_BYTES): Use sizeof scm_t_bits, not sizeof SCM. It's the same, but it seems like the right thing. fix a leak on startup from script.c * libguile/script.c (scm_get_meta_args): Free nargv. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. We leak narg though. 2011-07-28 Andy Wingo <wingo@pobox.com> fix read beyond end of hashtable size array in hashtab.c * libguile/hashtab.c (make_hash_table): Fix read beyond end of hashtable_size array. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. fix write beyond array end in arrays.c * libguile/arrays.c (scm_i_read_array): Fix write past end of array while reading array type tag. Fix non-ascii type tag elements. Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685. fix list validation bug in @abort * libguile/control.c (scm_at_abort): Fix to ensure that we store the return of scm_ilength in a signed integer, even if later we copy it to an unsigned. See http://article.gmane.org/gmane.lisp.guile.devel/12685. remove dead code in scm_ceiling_quotient * libguile/numbers.c (scm_ceiling_quotient): Remove dead code. See http://article.gmane.org/gmane.lisp.guile.devel/12685. fix scm_i_tag_name * libguile/gc.c (scm_i_tag_name): Fix to work as intended, though it was not called. See http://article.gmane.org/gmane.lisp.guile.devel/12685. 2011-07-23 Ludovic Courtès <ludo@gnu.org> guild: Close over `$bindir/guile'. * configure.ac: Substitute `guile_program_name'. * meta/guild.in: Use `@bindir@/@guile_program_name@' by default. * meta/uninstalled-env.in: Define $GUILE. 2011-07-23 Ludovic Courtès <ludo@gnu.org> Change `guild --help' and `--version' output to be more GNUish. * meta/guild.in (display-version): Display the version, not the effective version. * module/scripts/help.scm (list-commands)[help]: Add proper footer, as per the GCS. 2011-07-23 Ludovic Courtès <ludo@gnu.org> doc: Remove redundant footnote about the former name of `guild'. * doc/ref/scheme-using.texi (Using Guile Tools): Remove redundant footnote introduced in e108c961fed2ffdedddcd10bad9c6aae44491b1e. Mention the version where the new name was introduced. Export `main' from (scripts help). * module/scripts/help.scm: Export `main'. 2011-07-23 Andy Wingo <wingo@pobox.com> add support for guild help FOO * module/scripts/help.scm (main): Add support for guild help FOO. 2011-07-23 Andy Wingo <wingo@pobox.com> add (scripts help) * meta/guild.in (display-version): Use (ice-9 command-line)'s version-etc. (main): Dispatch --help to guild help. * module/scripts/help.scm: New file, a copy of list.scm, but with a better name. * module/Makefile.am: Add help.scm to the list. * module/scripts/list.scm: Change to be an alias to "help". (list-scripts): Restore this API. 2011-07-23 Andy Wingo <wingo@pobox.com> more work on "guild list" * module/scripts/: Add %summary entries, and in many cases, %include-in-guild-list entries to inhibit a script from appearing in "guild list". Update list.scm to respect this new variable. 2011-07-23 Andy Wingo <wingo@pobox.com> remove scripts PROGRAM * module/scripts/PROGRAM.scm: Remove this useless template, which was cluttering `guild list'. We'll perhaps cull the list a bit more in 2.2. * module/Makefile.am: Adapt. 2011-07-23 Andy Wingo <wingo@pobox.com> a prettier `guild list' * module/scripts/list.scm (strip-extensions): Don't list programs without extensions. (main): Be prettier. Parse out a %summary from modules, for a brief synopsis. 2011-07-21 Andy Wingo <wingo@pobox.com> add a site dir to %load-compiled-path * libguile/Makefile.am (libpath.h): Define SCM_SITE_CCACHE_DIR. Defined as site-ccache/ instead of site/ccache/ to indicate that we don't expect further subdirectories, and also to avoid confusion about whether extensions/ is a site-specific or not. * libguile/load.c (scm_init_load_path): Add SCM_SITE_CCACHE_DIR to the default load-compiled path. 2011-07-21 Andy Wingo <wingo@pobox.com> open-socket-for-url returns port in latin1 encoding * module/web/client.scm (open-socket-for-uri): Set port encoding to latin1, to see if this fixes Nalin Garut's problems. 2011-07-18 Andy Wingo <wingo@pobox.com> fix web-request.test * test-suite/tests/web-request.test ("example-1"): Fix expected format of `host' header. 2011-07-15 Andy Wingo <wingo@pobox.com> ensure presence of Host header in HTTP/1.1 requests * module/web/request.scm (build-request): Make sure that HTTP/1.1 requests have the Host header set, per RFC 2616 section 9. * test-suite/tests/web-request.test ("example-1"): Add test. 2011-07-15 Andy Wingo <wingo@pobox.com> add (web client) * module/web/client.scm: New module, a simple synchronous web client. * module/Makefile.am (WEB_SOURCES): Add to the build. 2011-07-13 Ludovic Courtès <ludo@gnu.org> Fix `open' mode bits on GNU/Hurd. * libguile/filesys.c (scm_open): Fix check for read-write flags for systems such as GNU/Hurd, where O_RDWR == (O_WRONLY | O_RDONLY) and O_RDONLY != 0. Define `O_NOTRANS' on GNU/Hurd. * libguile/filesys.c (scm_init_filesys): Define `O_NOTRANS' when available. Disable TLS on NetBSD up to 5.x included. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Disable TLS on `x86_64-unknown-netbsd5.1' too. Add document describing the release process. * doc/release.org: New file. 2011-07-07 Andy Wingo <wingo@pobox.com> fix CPL of <extended-generic-with-setter> and <extended-accessor> * libguile/goops.c (fix_cpl): Fix bug in placement of debug assertion. (create_standard_classes): Put <extended-generic> before <generic-with-setter> in <extended-generic-with-setter>'s direct supers, so that the slot allocation is a superset of <generic-with-setter>, which results in the `setter' being allocated in the same place. Likewise fix <extended-accessor> to place <extended-generic> before <generic-with-setter>, not just <generic>. 2011-07-07 Andy Wingo <wingo@pobox.com> fix invocation of duplicate handlers for merge-generics * libguile/modules.c (resolve_duplicate_binding): Fix unbound -> #f conversion for the imported bindings. Pass the existing entry in the import obarray as the resolved var (7th arg), and properly pass #f as the value (8th arg) if there is no such binding. Fixes merge-generics; before, the <boolean> type test (indicating no previous value) was not being triggered. This bug has been present since 2007 at least, though it was not in 1.8. * test-suite/tests/modules.test ("duplicate bindings"): Add a test that the var and val are both #f. These types are used by GOOPS. 2011-07-07 Andy Wingo <wingo@pobox.com> goops.scm cleanups * module/oop/goops.scm (make-generic, make-extended-generic): (ensure-generic, make-accessor, ensure-accessor): Use optional arguments for #:name. `make-extended-generic' also accepts empty extension lists. more precision for ,time * module/system/repl/command.scm (time): Use the high-precision timers instead of stime(2). Changes the output format of `,time' too; perhaps there is a better way. 2011-07-06 Ludovic Courtès <ludo@gnu.org> doc: Fix `merge-generics' example. * doc/ref/goops.texi (Merging Generics): Change (my-module) example to use (oop goops) and use the right syntax for #:duplicates. Reported by David Pirotte <david@altosw.be>. configure: Build a `tar.xz' in addition to `tar.gz'. * configure.ac: Explicitly require Automake 1.11. Add Automake option `dist-xz'. 2011-07-06 Ludovic Courtès <ludo@gnu.org> VM: Keep jump table address in a register. * libguile/vm-engine.c (VM_NAME)[HAVE_LABELS_AS_VALUES]: Rename `jump_table' to `jump_table_pointer'. Add `jump_table' as a local variable, initialize it. * libguile/vm-engine.h (JT_REG): New macro. 2011-07-01 Ludovic Courtès <ludo@gnu.org> Bump version number for 2.0.2. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C function `scm_peek_byte_or_eof'. (LIBGUILE_INTERFACE_AGE): Increment. Update `NEWS'. Revert "Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'." This reverts commit ccb80964cd7cd112e300c34d32f67125a6d6da9a, which introduced a race condition, with a small window during which a mutex could be held by a thread without being part of its `mutexes' list, thereby violating the invariant tested at line 667. Update Gnulib to v0.0-5874-g7170ee0. Type-check the OWNER argument of `lock-mutex'. * libguile/threads.c (scm_lock_mutex_timed): Type-check OWNER. 2011-07-01 Ludovic Courtès <ludo@gnu.org> Add type and range checks to the complex generalized vector accessors. * libguile/bytevectors.c (COMPLEX_ACCESSOR_PROLOGUE, COMPLEX_NATIVE_REF, COMPLEX_NATIVE_SET): New macros. (bytevector_ref_c32, bytevector_ref_c64): Defined in terms of `COMPLEX_NATIVE_REF'. (bytevector_set_c32, bytevector_set_c64): Defined in terms of `COMPLEX_NATIVE_SET'. (bytevector_ref_fns): Make `static'. * test-suite/tests/srfi-4.test ("c32 vectors")["generalized-vector-ref", "generalized-vector-set!", "generalized-vector-ref, out-of-range", "generalized-vector-set!, out-of-range"]: New tests. ("c64 vectors")["generalized-vector-ref", "generalized-vector-set!", "generalized-vector-ref, out-of-range", "generalized-vector-set!, out-of-range"]: New tests. 2011-07-01 Ludovic Courtès <ludo@gnu.org> Fix unaligned accesses for bytevectors of complex numbers. * libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64, bytevector_set_c32, bytevector_set_c64): Use `memcpy' to avoid unaligned accesses. This fixes SIGBUS on SPARC and possibly other alignment-sensitive platforms. i18n: Don't use `!=' to compare SCMs. * libguile/i18n.c (install_locale)[!USE_GNU_LOCALE_API]: Use `SCM_UNBNDP' instead of `!='. 2011-07-01 Andy Wingo <wingo@pobox.com> fix '(a #{.} b) * libguile/read.c (scm_read_sexp): Don't confuse `#{.}#' with `.' for the purpose of reading dotted pairs. Thanks to CRLF0710 for the report. * test-suite/tests/reader.test ("#{}#"): Add test. 2011-06-30 Ludovic Courtès <ludo@gnu.org> Fix `on_thread_exit' for canceled threads. * libguile/threads.c (on_thread_exit): Clear `t->guile_mode' upon entry. This fixes a bug whereby `t->base' would be incorrect for canceled threads, leading to a misdiagnosed VM stack overflow. See <http://lists.gnu.org/archive/html/bug-guile/2011-06/msg00068.html> for details. (scm_leave_guile_cleanup): Remove because it's unused. Add `guile-invoke.texi' to the distribution. * doc/ref/Makefile.am (guile_TEXINFOS): Add `guile-invoke.texi'. 2011-06-30 Andy Wingo <wingo@pobox.com> fix generation of auto-compiled file names on mingw systems * libguile/load.c (canonical_to_suffix, scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): * module/system/base/compile.scm (compiled-file-name): If the canonical path of a file is a DOS-style path with a drive letter, turn it into a path suffix it by removing the colon and prefixing a "/". Inspired by a patch from Jan Nieuwenhuizen. 2011-06-30 Mark Harig <idirectscm@aim.com> better invocation documentation * doc/ref/guile.texi (Programming in Scheme): * doc/ref/scheme-scripts.texi (Guile Scripting): Moved "Invoking Guile" to its own file. * doc/ref/guile-invoke.texi (Invoking Guile): Initial revision. This file contains the former section "Invoking Guile" that was included in the chapter "Programming in Scheme" as a subsection named "Command-line Options." It also includes a new subsection "Environment Variables," which describes those variables that can be set in the operating system before Guile is started and which affect Guile's run-time behavior. 2011-06-30 Andy Wingo <wingo@pobox.com> %load-hook not just for primitive-load * libguile/load.c (scm_primitive_load_path): * module/ice-9/boot-9.scm (load-in-vicinity): Call %load-hook as needed. 2011-06-30 Andy Wingo <wingo@pobox.com> fix --disable-modules build * configure.ac (HAVE_MODULES): Define HAVE_MODULES iff --enable-modules. * libguile/deprecated.c (scm_dynamic_args_call) * libguile/extensions.c (load_extension): * libguile/init.c (scm_i_init_guile): Use HAVE_MODULES in a few places. 2011-06-30 Andy Wingo <wingo@pobox.com> HAVE_POSIX warning fix * libguile/filesys.c (scm_dir_free, scm_dir_print): Don't compile when not HAVE_POSIX. 2011-06-28 Ludovic Courtès <ludo@gnu.org> Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'. Original Helgrind report: ==14160== Thread #57: lock order "0x47F6B90 before 0x7C25A28" violated ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4EFF87E: do_thread_exit (threads.c:664) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x51CA3AF: GC_call_with_gc_active (pthread_support.c:1128) ==14160== by 0x4EFF2E0: with_guile_and_parent (threads.c:206) ==14160== by 0x51C46B4: GC_call_with_stack_base (misc.c:1505) ==14160== by 0x4EFF447: scm_with_guile (threads.c:917) ==14160== by 0x51C46B4: GC_call_with_stack_base (misc.c:1505) ==14160== Required order was established by acquisition of lock at 0x47F6B90 ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4F00262: fat_mutex_lock (threads.c:1362) ==14160== by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462) ==14160== by 0x4F16C09: vm_regular_engine (vm-i-system.c:898) ==14160== by 0x4E90F4D: scm_call_3 (eval.c:499) ==14160== by 0x4EFFA4C: really_launch (threads.c:975) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x4EFF289: with_guile_and_parent (threads.c:874) ==14160== followed by a later acquisition of lock at 0x7C25A28 ==14160== at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so) ==14160== by 0x4F00352: fat_mutex_lock (threads.c:1374) ==14160== by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462) ==14160== by 0x4F16C09: vm_regular_engine (vm-i-system.c:898) ==14160== by 0x4E90F4D: scm_call_3 (eval.c:499) ==14160== by 0x4EFFA4C: really_launch (threads.c:975) ==14160== by 0x4E87B89: c_body (continuations.c:512) ==14160== by 0x4F16C21: vm_regular_engine (vm-i-system.c:960) ==14160== by 0x4E90F92: scm_call_4 (eval.c:506) ==14160== by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450) ==14160== by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546) ==14160== by 0x4EFF289: with_guile_and_parent (threads.c:874) * libguile/threads.c (fat_mutex_lock): In the `m->level == 0' case, release M's lock before taking T's `admin_mutex'. 2011-06-21 Stefan Israelsson Tampe <stefan.itampe@gmail.com> psyntax: enable dotted tail patterns * module/ice-9/psyntax.scm (syntax-case): enabled the use of a general last cdr instead of just '() in matching with both a ellipsis (p ...) and a last rest pattern (. q) * module/ice-9/psyntax-pp.scm: Regenerated. 2011-06-20 Andy Wingo <wingo@pobox.com> update stack growth direction check * configure.ac: Pull stack growth direction check from upstream autoconf. See http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00035.html for a discussion. 2011-06-20 Ludovic Courtès <ludo@gnu.org> Placate GCC in `test-ffi-lib.c'. This fixes warnings saying "this decimal constant is unsigned only in ISO C90". * test-suite/standalone/test-ffi-lib.c (test_ffi_u32_, test_ffi_u32_u8, test_ffi_u32_s64, test_ffi_s64_s64, test_ffi_u64_u8, test_ffi_u64_s64): Mark constants as unsigned. 2011-06-19 Ian Price <ianprice90@googlemail.com> Fix hygiene issues with `define-record-type' * module/rnrs/records/syntactic.scm (define-record-type0, process-fields): Preserve hygiene of record clauses. * test-suite/tests/r6rs-records-syntactic.test ("record hygiene"): Add tests. 2011-06-19 Ludovic Courtès <ludo@gnu.org> Comment on the Gnulib `clock-gettime' workaround. * acinclude.m4: Remove `clock_time.m4' serial. * configure.ac: Add URL of the discussion about `clock-gettime'. 2011-06-19 Ludovic Courtès <ludo@gnu.org> configure: Factorize code checking for `iconveh_' constants; use the cache. * configure.ac: Remove code that determines the values of the `iconveh_' constants. Use `GUILE_UNISTRING_ICONVEH_VALUES'. instead. * acinclude.m4 (GUILE_UNISTRING_CONSTANT, GUILE_UNISTRING_ICONVEH_VALUES): New macros. 2011-06-17 Andy Wingo <wingo@pobox.com> current-language really defaults to Scheme. * module/system/base/language.scm (current-language): Default to 'scheme here, rather than relying on *current-language* always being bound. Thanks to 亚光唐 <texnician@gmail.com> for the report. 2011-06-17 Andy Wingo <wingo@pobox.com> fix invalid transformation of (values x) -> x, (+ x) -> x, etc * module/language/tree-il/primitives.scm (+, *, cons*): In the case of just one argument (the identity case), expand to (values x) instead of just x. Fixes values truncation in that case. (values): Likewise remove (values x) -> x translation, as the compiler will do it for us, and this fixes (values (values 1 2)). * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Handle `values' in a push context here. * test-suite/tests/tree-il.test ("values"): Add some tests. 2011-06-17 Andy Wingo <wingo@pobox.com> add -Wformat to %auto-compilation-options * module/ice-9/boot-9.scm (%auto-compilation-options): Add -Wformat to the default warning set. better messages on failed autocompilation * libguile/load.c (auto_compile_catch_handler): * module/ice-9/boot-9.scm (load-in-vicinity): Nicer messages when autocompilation fails. 2011-06-17 Andy Wingo <wingo@pobox.com> fix self tail recursion to different case-lambda clauses http://savannah.gnu.org/bugs/?33362 * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Rename from flatten, as it really just takes a particular case. Instead of iteratively compiling lambda cases through `comp', tail-call through flatten-lambda-case. This allows code to see which case it's being compiled in. Take advantage of that to limit the self-tail-call optimization to self-calls to the same case -- otherwise we might be jumping to a label without having reserved the right number of locals. (flatten-lambda): Adapt the caller. * test-suite/tests/compiler.test ("case-lambda"): Add a test. 2011-06-17 Andy Wingo <wingo@pobox.com> fix AC_LANG_SOURCE warnings * configure.ac: Fix annoying AC_LANG_SOURCE warnings. check for clock_getcpuclockid in gl_CLOCK_TIME * acinclude.m4 (gl_CLOCK_TIME): It could be that clock_gettime is in libc but clock_getcpuclockid is not, so check for that explicitly. 2011-06-17 Andreas Rottmann <a.rottmann@gmx.at> Silence warnings for variables created by `generate-temporaries' * module/ice-9/psyntax.scm (generate-temporaries): Give temporaries the current module, so that they may be bound at the top level. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-06-17 Andy Wingo <wingo@pobox.com> remove win32-dirent.[ch] * libguile/win32-dirent.c: * libguile/win32-dirent.h: Remove these files. MinGW has opendir and readdir support, I hear. * configure.ac: * libguile/filesys.c: * libguile/Makefile.am: Adapt. 2011-06-17 Jan Nieuwenhuizen <janneke@gnu.org> mingw: use $APPDATA as a possible root for cachedir. * libguile/load.c (scm_init_load_path) [MINGW32]: Fall back to using $LOCALAPPDATA or $APPDATA if $XDG_CACHE_HOME and $HOME aren't set. 2011-06-16 Andy Wingo <wingo@pobox.com> add `rename' gnulib module This should fix `rename' on mingw32. 2011-06-16 Mark H Weaver <mhw@netris.org> Fix several POSIX functions to use the locale encoding * libguile/strings.c (scm_i_allocate_string_pointers): Encode strings using the current locale. Previously, Latin-1 was used. Indirectly, this affects the encoding of strings in `system*', `execl', `execlp', `execle', `environ', and `dynamic-args-call'. (scm_makfromstrs): In header comment, clarify that the C strings are interpreted according to the current locale encoding. * NEWS: Add NEWS entry. 2011-06-16 Andy Wingo <wingo@pobox.com> O_CLOEXEC usage * libguile/objcodes.c (scm_load_objcode): * libguile/scmsigs.c (start_signal_delivery_thread): * libguile/threads.c (guilify_self_1): Use O_CLOEXEC. 2011-06-16 Andy Wingo <wingo@pobox.com> gnulib update Added pipe2 and open modules, to get O_CLOEXEC. * libguile/Makefile.am (guile_filter_doc_snarfage$(EXEEXT)): Add gnulib here, in the native build case, for rpl_fflush if needed. foo 2011-06-16 Andy Wingo <wingo@pobox.com> fix initial values of reallocated fluids * libguile/threads.h: * libguile/threads.c (scm_i_reset_fluid): New internal function, resets the binding of a fluid for all threads. Needed for fluid GC. * libguile/fluids.c (new_fluid): Call scm_i_reset_fluid here. 2011-06-16 Andy Wingo <wingo@pobox.com> more NEWS * NEWS: More updates. update NEWS * NEWS: Update for 2.0.2. add docs for shift and reset * doc/ref/api-control.texi (Prompt Primitives): Break call-with-prompt and abort-to-prompt out into a subsubsection. (Shift and Reset): New subsubsection. fix hash-set! on weak tables * test-suite/tests/weaks.test: Add tests. * libguile/hashtab.c (scm_hash_fn_set_x): Fix updates to weak-value hash tables to not deadlock inside the alloc lock. 2011-06-09 Andreas Rottmann <a.rottmann@gmx.at> Fix likely crash in `stable-sort!' * libguile/sort.c (scm_stable_sort_x): Properly handle zero-length vectors. * test-suite/tests/sort.test ("stable-sort"): Add test for this case. 2011-06-08 Ludovic Courtès <ludo@gnu.org> doc: Mention the former name of `guild'. * doc/ref/scheme-using.texi (Using Guile Tools): Add a footnote mentioning that `guild' used to be `guile-tools'. * doc/ref/tools.texi (Executable Modules): Nitpicks. 2011-05-31 Andy Wingo <wingo@pobox.com> add guild docs * doc/ref/scheme-using.texi (Using Guile Tools): Add some optimistic guild docs. 2011-05-31 Andy Wingo <wingo@pobox.com> rename `guile-tools' to `guild' * configure.ac: Look for ln -s. Write out `guild' instead of `guile-tools'. * meta/Makefile.am (install-data-hook): Link the installed `guild' to the backward-compatible `guile-tools' name. (bin_SCRIPTS, EXTRA_DIST): Fix up for guild change. * meta/guild.in: Moved here from `guile-tools.in'. * doc/ref/Makefile.am (autoconf-macros.texi): * doc/ref/api-evaluation.texi (Compilation): * doc/ref/autoconf.texi (Autofrisk, Using Autofrisk): * doc/ref/mod-getopt-long.texi (getopt-long Reference): * doc/ref/tools.texi (Miscellaneous Tools, Executable Modules): Minimal doc update. * .gitignore: * am/guilec (.scm.go): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.go): Update makefiles, etc. * module/scripts/README: * module/scripts/lint.scm: * module/scripts/list.scm: Update commentaries. 2011-05-31 Andy Wingo <wingo@pobox.com> write-objcode uses target-endianness, target-word-size * libguile/_scm.h (SCM_OBJCODE_ENDIANNESS_OFFSET): (SCM_OBJCODE_WORD_SIZE_OFFSET): New defines. * libguile/objcodes.c (scm_write_objcode): Use target-endianness and target-word-size when writing the objcode cookie. compile-bytecode uses target-endianness * module/language/assembly/compile-bytecode.scm (compile-bytecode): Use target-endianness, from (system base target). add (system base target) * module/Makefile.am: * module/system/base/target.scm: Add a minimal module to parameterize the target system type and inspect properties on it like cpu, vendor, os, endianness, and word size. 2011-05-30 Andy Wingo <wingo@pobox.com> fix subtle and bad scm_internal_hash_fold bug for weak tables * libguile/hashtab.c (scm_internal_hash_fold): Don't try to unlink deleted weak pairs. Our previous code was buggy (`prev' should have only been updated in the case of a successful traversal), but more than that, we're not in the alloc lock. Thanks very much to Michael Wells for the report, and the debugging! 2011-05-27 Andreas Rottmann <a.rottmann@gmx.at> Tweak R6RS transcoded ports flushing * libguile/r6rs-ports.c (tp_flush): Only operate on the underlying port when it is open. 2011-05-27 Andreas Rottmann <a.rottmann@gmx.at> rnrs io ports: fix port encoding when opening file ports * module/rnrs/io/ports.scm (open-file-input-port) (open-file-output-port): Ensure the resulting ports are binary when no transcoder is specified. * test-suite/tests/r6rs-ports.test: Remove superfluous global change of `%default-port-encoding' and accompanying comment. ("7.2.7 Input Ports"): Add test ensuring `open-file-input-port' opens a binary port when no transcoder is specified. ("8.2.10 Output ports"): Strengthen existing `open-file-output-port' binary-ness test by setting `%default-port-encoding' to "UTF-8". 2011-05-27 Andreas Rottmann <a.rottmann@gmx.at> Add some tests for the R6RS I/O libraries * test-suite/tests/r6rs-ports.test (call-with-bytevector-output-port/transcoded): New helper procedure. ("8.2.6 Input and output ports"): Use that helper procedure. (encoding-error-predicate): New helper procedure. ("8.2.12 Textual Output"): Add tests for `put-char' and `put-string' exception behavior on encoding errors. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Doc for getopt-long's new stop-at-first-non-option option * doc/ref/mod-getopt-long.texi (getopt-long): Mention optional keyword parameters. (getopt-long Reference): Document #:stop-at-first-non-option. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Remove unused script-getopt.texi * doc/ref/Makefile.am (guile_TEXINFOS): Remove script-getopt.texi. * doc/ref/script-getopt.texi: Deleted. This file wasn't included in the manual, and its content is now duplicated identically in scheme-scripts.texi. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Emit a 1-based line number in error messages * module/ice-9/boot-9.scm (exception-printers): Add 1 to the 0-based line number. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Reveal guile-tools's inner simplicity... ...by not using its own-rolled getopt, and moving the `list' function to a separate script * meta/guile-tools.in: Use (ice-9 getopt-long). (directory-files, strip-extensions, unique, find-submodules, list-scripts): Deleted (and moved to new `list.scm' file). (getopt): Deleted. (main): Use getopt-long. Default to calling the `list' script if no script is specified. * module/scripts/list.scm: New script. * module/Makefile.am (SCRIPTS_SOURCES): Add list.scm. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Implement #:stop-at-first-non-option option for getopt-long (For use by guile-tools) * module/ice-9/getopt-long.scm: Use (ice-9 optargs) so we can use define*. (process-options): Add stop-at-first-non-option parameter. When this is true, stop processing when we hit a non-option (so long as that non-option isn't something that resulted from the unclumping of a short option group). (getopt-long): Add #:stop-at-first-non-option keyword; pass it on to process-options. * test-suite/tests/getopt-long.test ("stop-at-first-non-option"): New test (for the above). 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Handle short option unclumping progressively, instead of all upfront This is needed as a prerequisite for the following change that introduces the stop-at-first-non-option option, because when that option is used we don't know upfront how far through the command line we should proceed with unclumping. * module/ice-9/getopt-long.scm (expand-clumped-singles): Delete. (process-options): Add a loop variable to indicate how many elements at the start of `argument-ls' are known not to be clumped. When we see a short option and this variable is <= 0, perform unclumping (using code that used to be in expand-clumped-singles) and loop with the variable > 0. (getopt-long): Don't call expand-clumped-singles upfront here. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Simplify getopt-long handling of option values, esp with multiple occurrences Basically, accumulate values in the `process-options' loop variables, instead of using set-option-spec-value! * module/ice-9/getopt-long.scm (option-spec): Delete the `value' slot. (process-options): Delete `val!loop' and just use `loop' everywhere instead. When adding an option spec to `found', add the corresponding value too; hence `found' becomes an alist, where it was previously a list of specs. (getopt-long): Use assq-ref to get values out of `found'. Remove unhittable error condition for detecting an option that requires an explicit value, where a value wasn't supplied. This condition is actually caught and handled in `process-options'. Rewrite the end of the procedure much more simply. 2011-05-26 Neil Jerram <neil@ossau.uklinux.net> Fix "occurrances" typos in getopt-long code and test * module/ice-9/getopt-long.scm (process-options, getopt-long): Change to "occurrences". * test-suite/tests/getopt-long.test ("multiple occurrences"): Same again. 2011-05-26 Andy Wingo <wingo@pobox.com> leave guile when reading signal pipe * libguile/scmsigs.c (read_signal_pipe_data, signal_delivery_thread): Leave guile when reading from the signal pipe. Hopefully that lets GC know not to wake up this thread. lazily init futures worker pool * module/ice-9/futures.scm (%workers, %create-workers!) (create-workers!): Define a mechanism to spawn off the future threads only when the first future is created. (make-future): Call create-workers! here. remove scm_newcell_count, scm_newcell2_count * libguile/inline.h: * libguile/gc.c: Remove declaration and definition of unused "scm_newcell_count" and "scm_newcell2_count". Since SCM_INTERNAL is "extern", these symbols were not externally visible anyway, at least under Linux or Windows. 2011-05-26 Andy Wingo <wingo@pobox.com> deprecate scm_immutable_{double_,}cell * libguile/inline.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_immutable_cell, scm_immutable_double_cell): Deprecate these, as the GC_STUBBORN API doesn't do anything any more. * libguile/strings.c (scm_i_c_make_symbol): Change the one use of scm_immutable_double_cell to scm_double_cell. 2011-05-25 Mark H Weaver <mhw@netris.org> Clarify docs for SCM_UNSPECIFIED: used sometimes but not always * doc/ref/data-rep.texi (Immediate objects): Clarify the description of SCM_UNSPECIFIED. It is returned by some (but not all) expressions whose value is unspecified by the Scheme standard. 2011-05-25 Andy Wingo <wingo@pobox.com> out-of-tree build fix * test-suite/standalone/Makefile.am (GUILE_AUTO_COMPILE): Add srcdir to the environment. * test-suite/standalone/test-import-order: Look for the modules in the srcdir. Fixes out-of-tree builds. 2011-05-24 Andy Wingo <wingo@pobox.com> threadsafe addition to the goops vtable_class_map * libguile/goops.c (scm_i_define_class_for_vtable): Lock around additions to the vtable_class_map. Use is unlocked though; solving GOOPS parallel-initialization would be a good thing. threadsafe access to source properties weak hash table * libguile/srcprop.c: Add a lock around scm_source_whash, and use it. 2011-05-24 Andy Wingo <wingo@pobox.com> read + source properties simplification * libguile/srcprop.h: Remove internal scm_source_whash declaration. * libguile/srcprop.c (scm_i_set_source_properties_x) (scm_i_has_source_properties): New helpers. (scm_source_whash): Make static. * libguile/read.c (scm_read_sexp): Remove register declarations here; let's trust the compiler. Remove code to incrementally build up a copy; instead let's let scm_i_set_source_properties_x handle copying the expression if needed. (scm_read_quote, scm_read_syntax): Use scm_i_set_source_properties_x. (recsexpr): Remove this helper from 1996. (scm_read_sharp_extension): Instead of trying to recursively label sharp-read subforms with source properties, just label the outside form and rely on the macro-expander to propagate it down. 2011-05-24 Andy Wingo <wingo@pobox.com> safely access the trampoline weak map * libguile/smob.c (scm_i_smob_apply_trampoline): Protect the trampoline weak map with a mutex. 2011-05-23 Andy Wingo <wingo@pobox.com> set-procedure-property! threadsafety issue * libguile/procprop.c (scm_set_procedure_property_x): Fix a threadsafety bug pointed out by Ken Raeburn. really threadsafe access to symbol table * libguile/symbols.c (symbols_lock): Rename from intern_lock. (lookup_interned_symbol, lookup_interned_latin1_symbol): Instead of faith-based programming, just use the mutex. Though I haven't seen this break, Ken is right! 2011-05-22 Mark H Weaver <mhw@netris.org> Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type * libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void): New static functions that simply call scm_lock_mutex and scm_unlock_mutex, respectively, but return void instead of SCM. (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to scm_dynwind_rewind_handler_with_scm. Previously, we passed scm_unlock_mutex and scm_lock_mutex (which return SCM), but the scm_dynwind_* functions expect pointers to functions which return void. When SCM is of type union, this changes the calling conventions of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86). 2011-05-21 Andy Wingo <wingo@pobox.com> fix define-module ordering * module/ice-9/boot-9.scm (define-module): Fix to load the #:use-module clauses in the order in which they appear in the define-module form. Thanks to Jan Nieuwenhuizen for the report. * test-suite/standalone/test-import-order: Add new test that define-module and use-modules resolve the interface in the right order. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-import-order-a.scm: * test-suite/standalone/test-import-order-b.scm: * test-suite/standalone/test-import-order-c.scm: * test-suite/standalone/test-import-order-d.scm: Aux files. 2011-05-21 Andy Wingo <wingo@pobox.com> (syntax foo) -> #'foo in goops * module/oop/goops.scm: Change instances of (syntax foo) to #'foo. 2011-05-20 Andy Wingo <wingo@pobox.com> clocktime freebsd portability * libguile/stime.c (HAVE_POSIX_CPUTIME): Hack around buggy FreeBSD implementation of _POSIX_CPUTIME. fix compile error in mingw fstat socket detection * libguile/filesys.c (fstat_Win32) [__MINGW32__]: Apparently there is no _S_IFSOCK on mingw32. Thanks to Volker Grabsch for the report. gen-scmconfig cross-compilation fix * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Fix cross-compilation. Thanks to Volker Grabsch for the report! 2011-05-20 Andy Wingo <wingo@pobox.com> fix documentation for option-set! syntaxen * doc/ref/api-evaluation.texi (Scheme Read): Note that read-set! is syntax. (Scheme Write): Likewise for print-set!. * doc/ref/api-io.texi (Writing): Remove reference to print-options-interface. * doc/ref/repl-modules.texi (Readline Options): Update, and add entries for readline-options, readline-set! et al. 2011-05-14 Andreas Rottmann <a.rottmann@gmx.at> Improve R6RS conformance wrt. conditions in the I/O libraries * module/rnrs/io/ports.scm (open-file-output-port): Handle `no-fail' file option. (with-i/o-filename-conditions): Use `with-throw-handler' instead of `catch'. (with-i/o-port-error, with-textual-output-conditions. with-textual-input-conditions): New exception-conversion helpers. (put-char, put-datum, put-string, display): Use `with-textual-output-conditions' instead of `with-i/o-encoding-error' to get proper conditions in case of write errors. (get-char, get-datum, get-line, get-string-all, lookahead-char): Likewise, for the input case. * test-suite/tests/r6rs-ports.test (pass-if-condition, test-file, make-failing-port): New helpers. ("8.2.10 Output ports"): Add some tests for `open-file-output-port'. ("8.2.9 Textual Input"): Add tests read error conditions. ("8.2.12 Textual Output"): Add tests for write error conditions. ("8.3 Simple I/O"): Add tests for conditions, `call-with-input-file' and `call-with-output-file'. 2011-05-13 Andy Wingo <wingo@pobox.com> refactor do_thread_exit cleanup handler invocation * libguile/threads.c (do_thread_exit): Redo cleanup handler call so as not to shove a SCM into a pointer. i18n error return type fix * libguile/i18n.c (chr_to_case, str_to_case): Return #f in error case instead of 0. PTR2SCM and SCM2PTR in inline.h * libguile/inline.h (scm_cell, scm_immutable_cell): (scm_double_cell, scm_immutable_double_cell): (scm_words): Be more consistent in use of PTR2SCM and SCM2PTR. compile-time assertion in net_db uses constant expressions * libguile/net_db.c: Use constant expressions for EAI_BADFLAGS and AI_ALL representations. ports.c uninitialized static SCM values are #f, not 0 * libguile/ports.c: (scm_current_input_port, scm_current_output_port) (scm_current_error_port): Use #f as the uninitialized value instead of 0. scm_port_for_each fix * libguile/ports.c (scm_port_for_each): Inline the call to scm_c_port_for_each, to avoid type errors. weak_bucket_assoc tweak * libguile/hashtab.c (weak_bucket_assoc): Change assertion to be a check and abort, and so that only calls GC_is_visible if the check fails. vm_make_boot_program initializer fix * libguile/vm.c (vm_make_boot_program): Use #f as the "I don't have a program" value. correct use of SCM2PTR in SCM_I_REGISTER_DISAPPEARING_LINK forms * libguile/hashtab.c (set_weak_cdr): * libguile/vectors.c (scm_c_vector_set_x): * libguile/weaks.c (scm_weak_car_pair, scm_weak_cdr_pair): (scm_doubly_weak_pair): Use SCM2PTR for the target of SCM_I_REGISTER_DISAPPEARING_LINK calls. scm_is_false instead of == SCM_BOOL_F; also is_null, is_true, etc * libguile/deprecation.c (scm_issue_deprecation_warning) * libguile/eval.c (CAPTURE_ENV): * libguile/goops.c (make_dispatch_procedure, make_class_from_symbol): (create_smob_classes): * libguile/guardians.c (finalize_guarded, scm_i_get_one_zombie): * libguile/hashtab.c (scm_fixup_weak_alist, scm_internal_hash_fold): * libguile/i18n.c (scm_nl_langinfo) * libguile/load.c (scm_primitive_load) * libguile/posix.c (scm_setrlimit) * libguile/socket.c (scm_to_sockaddr): * libguile/srcprop.c (scm_make_srcprops): Use scm_is_false / scm_is_true / scm_is_null instead of comparing against SCM_BOOL_F et al. more care regarding SCM_PACK and SCM_UNPACK * libguile/control.c (reify_partial_continuation): * libguile/eval.c (RETURN_BOOT_CLOSURE): * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x) * libguile/frames.h (SCM_FRAME_SET_RETURN_ADDRESS): (SCM_FRAME_SET_MV_RETURN_ADDRESS, SCM_FRAME_SET_DYNAMIC_LINK): * libguile/goops.c (scm_class_of, scm_primitive_generic_generic) (scm_c_extend_primitive_generic, compute_getters_n_setters) (scm_sys_initialize_object): * libguile/guardians.c (finalize_guarded): * libguile/list.c (SCM_I_CONS): * libguile/macros.c (scm_i_make_primitive_macro) (scm_make_syntax_transformer): * libguile/memoize.c (MAKMEMO, SCM_MAKE_MEMOIZER) (SCM_MAKE_REST_MEMOIZER): * libguile/modules.c (scm_module_reverse_lookup) * libguile/print.c (iprin1): * libguile/promises.c (scm_make_promise) * libguile/srcprop.c (scm_make_srcprops): * libguile/vectors.c (scm_c_vector_ref): * libguile/vm-engine.c (vm_engine) * libguile/vm-i-scheme.c (REL, add1, sub1): * libguile/vm-i-system.c (new_frame, call_cc) * libguile/weaks.h (SCM_WEAK_PAIR_WORD_DELETED_P): Be more careful about SCM_PACK / SCM_UNPACK. scm_is_eq for SCM vals, not == or != * libguile/bytevectors.c (scm_make_bytevector, STRING_TO_UTF) (UTF_TO_STRING): * libguile/continuations.c (scm_i_check_continuation): * libguile/expand.h (SCM_EXPANDED_P): * libguile/fluids.c (scm_i_make_with_fluids): * libguile/generalized-vectors.c (scm_make_generalized_vector): * libguile/goops.c (SCM_GOOPS_UNBOUNDP, slot_definition_using_name): (scm_c_extend_primitive_generic, more_specificp, scm_make) * libguile/i18n.c (SCM_VALIDATE_OPTIONAL_LOCALE_COPY): (scm_locale_string_to_integer) * libguile/modules.c (resolve_duplicate_binding): (scm_module_reverse_lookup) * libguile/posix.c (scm_to_resource): * libguile/r6rs-ports.c (scm_put_bytevector): * libguile/socket.c (scm_connect, scm_bind, scm_sendto * libguile/stacks.c (find_prompt): * libguile/variable.c (scm_variable_ref, scm_variable_bound_p): * libguile/vm-engine.h (ASSERT_BOUND_VARIABLE, ASSERT_BOUND) * libguile/vm-i-system.c (VARIABLE_BOUNDP, local_bound) (long_local_bound, fluid_ref): Use scm_is_eq to compare, not == / !=. 2011-05-13 Andy Wingo <wingo@pobox.com> deprecate scm_internal_dynamic_wind * libguile/dynwind.c: * libguile/dynwind.h: * libguile/deprecated.h (scm_t_inner): * libguile/deprecated.c (scm_internal_dynamic_wind): Deprecate, as the scm_dynwind API is better, and this API encourages users to stuff SCM values into pointers. 2011-05-13 Andy Wingo <wingo@pobox.com> excise scm_internal_dynamic_wind from goops.c * libguile/goops.c (go_to_hell, go_to_heaven, purgatory): (scm_change_object_class): Rewrite to use scm_dynwind_begin instead of scm_dynamic_wind. async.c refactor * libguile/async.c (increase_block, decrease_block): Write more clearly. (scm_dynwind_block_asyncs, scm_dynwind_unblock_asyncs): Move definitions up. (scm_call_with_blocked_asyncs, scm_c_call_with_blocked_asyncs) (scm_call_with_unblocked_asyncs, scm_c_call_with_unblocked_asyncs): Implement in terms of scm_dynwind_{un,}block_asyncs, so that we don't stuff SCM values into pointers. 2011-05-13 Andy Wingo <wingo@pobox.com> fix type errors * libguile/numbers.c (scm_logand): Fix a type error (comparing a SCM against an int, when we really wanted to compare the unpacked fixnum). * libguile/ports.c (scm_i_set_conversion_strategy_x): Check scm_conversion_strategy_init, not scm_conversion_strategy. * libguile/read.c (recsexpr): Fix loops to avoid strange test of SCM values. 2011-05-13 Andy Wingo <wingo@pobox.com> allow iflags to be constant expressions with typing-strictness==2 * libguile/tags.h (SCM_MAKE_ITAG8_BITS): New helper, produces a scm_t_bits instead of a SCM, because SCM_UNPACK is not a constant expression with SCM_DEBUG_TYPING_STRICTNESS==2. (SCM_MAKIFLAG_BITS): Remove SCM_MAKIFLAG, and replace with this, which returns bits. (SCM_BOOL_F_BITS, SCM_ELISP_NIL_BITS, SCM_EOL_BITS, SCM_BOOL_T_BITS): (SCM_UNSPECIFIED_BITS, SCM_UNDEFINED_BITS, SCM_EOF_VAL_BITS): (SCM_UNBOUND_BITS): New definitions. Defined SCM_BOOL_F, etc in terms of them. (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0): (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_1): (SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_2): (SCM_XXX_ANOTHER_LISP_FALSE_DONT_USE): Be bits instead of SCM values. (SCM_BITS_DIFFER_IN_EXACTLY_ONE_BIT_POSITION): (SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS): Rename from SCM_VALUES_DIFFER_..., and take unpacked bits as the args. * libguile/boolean.c: Update verify block to use SCM_BITS_DIFFER_IN_EXACTLY_TWO_BIT_POSITIONS et al. * libguile/debug.c (scm_debug_opts): * libguile/print.c (scm_print_opts): * libguile/read.c (scm_read_opts): Use iflags bits for initializers. * libguile/hash.c (scm_hasher): Use _BITS for iflags as case labels. * libguile/pairs.c: Nil/null compile-time check uses SCM_ELISP_NIL_BITS. 2011-05-13 Andy Wingo <wingo@pobox.com> fix static allocation with debug_typing_strictness==2 * libguile/tags.h (SCM): For SCM_DEBUG_TYPING_STRICTNESS==2, give the union a tag, and use C99 compound literals to construct the value. This allows SCM_PACK to be a constant expression. * libguile/snarf.h: Allow SCM_SUPPORT_STATIC_ALLOCATION for SCM_DEBUG_TYPING_STRICTNESS==2. (SCM_IMMUTABLE_STRING): Properly parenthesize the string length. (SCM_STATIC_PROGRAM): Fix for SCM_DEBUG_TYPING_STRICTNESS==2. 2011-05-12 Andy Wingo <wingo@pobox.com> add missing SCM_DEPRECATED annotation * libguile/deprecated.h: Use SCM_DEPRECATED instead of SCM_API for the asinh, acosh, atanh, and atan2 wrappers. all deprecated routines emit warnings * module/ice-9/deprecated.scm (substring-move-left!) (substring-move-right!, dynamic-maybe-call, dynamic-maybe-link) (try-module-linked, try-module-dynamic-link) ($asinh, $acosh, $atanh, $sqrt, $abs, $exp, $log, $sin, $cos) ($tan, $asin, $acos, $atan, $sinh, $cosh, $tanh) (process-define-module): Add deprecation warnings. 2011-05-08 Andy Wingo <wingo@pobox.com> fix some duplication in object tables * module/language/glil/compile-assembly.scm (build-object-table): Don't add the same value to an object table twice. 2011-05-08 Ludovic Courtès <ludo@gnu.org> Add `vhash-fold-right'. * module/ice-9/vlist.scm (vhash-fold-right): New procedure. * test-suite/tests/vlist.test ("vhash")["vhash-fold-right"]: New test. * doc/ref/api-compound.texi (VHashes): Document `vhash-fold-right'. 2011-05-08 Ludovic Courtès <ludo@gnu.org> Optimize `vlist-fold-right'. * module/ice-9/vlist.scm (vlist-fold-right): Avoid `vlist-reverse' and instead `vlist-ref' individual elements. The result is about twice faster. Thanks Andy for suggesting it indirectly. :-) 2011-05-08 Andy Wingo <wingo@pobox.com> add map and for-each benchmarks * benchmark-suite/benchmarks/srfi-1.bm ("map", "for-each"): Add benchmarks. 2011-05-08 Ludovic Courtès <ludo@gnu.org> Fix small integer return value packing on big endian machines. * libguile/foreign.c (pack): Add `return_value_p' parameter. Update callers. When RETURN_VALUE_P is true, assume LOC points to an `ffi_arg', and cast its results to the relevant type. This fixes packing of integer return values smaller than `int' on SPARC64 and PowerPC64. Reported by Nelson H. F. Beebe <beebe@math.utah.edu>. Make the definition of `scm_read_shebang' match its declaration. * libguile/read.c (scm_read_shebang): Remove the `inline' keyword. 2011-05-08 Andy Wingo <wingo@pobox.com> compile-assembly: cleanup * module/language/glil/compile-assembly.scm: Clean up code for subprograms (not needed, we just cache the glil) and object alists (replaced by constants tables). 2011-05-08 Andy Wingo <wingo@pobox.com> compile-assembly: use file-level constants table * module/language/glil/compile-assembly.scm (compile-assembly): Rework to handle toplevel-specific code generation here, instead of in glil->assembly. Specifically, here we build a global constant table, and arrange for it to be the objtable of the toplevel thunk. (compile-program): New helper, compiles a <glil-program> and returns just the (load-program ...) form. (compile-objtable): New helper, generates assembly to build an object table, using some other constants table, and possibly recursing to `compile-program' for cached GLIL programs. (glil->assembly): Simplify, removing the toplevel? argument, and replacing the object alist with an objtable computed in a previous pass. Adapt to the new form of the objtable, and to use compile-program and compile-objtable. 2011-05-08 Andy Wingo <wingo@pobox.com> compile-assembly: add dump-constants, a new helper * module/language/glil/compile-assembly.scm (dump-constants): New helper. Generates bytecode that will result in a vector for the global object table being pushed on the stack. The items in the global object table will share state as much as possible. compile-assembly: add build-constant-store, build-object-table * module/language/glil/compile-assembly.scm (immediate?): New helper. (build-constant-store): New helper. Walks the GLIL tree and builds up a constant table, as a vhash. (build-object-table): Another helper, builds a constant table for a given GLIL program. compile-assembly: make-meta refactor * module/language/glil/compile-assembly.scm (make-meta): Avoid going through the compiler. compile-assembly: add traversal helpers * module/language/glil/compile-assembly.scm (vhash-fold-right2): (fold2, vector-fold2): Add some traversal helpers that we'll use in the next commit. fix `hash' for inf and nan * libguile/hash.c (scm_hasher): Fix to work on inf and nan. * test-suite/tests/hash.test ("hash"): Add tests. 2011-05-07 Andreas Rottmann <a.rottmann@gmx.at> Make the R6RS simple I/O library use conditions * module/rnrs/io/ports.scm (display): Implement as an exception-converting wrapper around Guile's core display. * module/rnrs/io/simple.scm: Don't export Guile's corresponding core procedures, but use `(rnrs io ports)' instead. This way, we get the conditions required by R6RS raised. * doc/ref/r6rs.texi (rnrs io simple): Mention that these procedures are supposed to raise R6RS conditions. 2011-05-07 Ludovic Courtès <ludo@gnu.org> Fix `get_utf8_codepoint' to not consume valid starting bytes. Thanks to Mark H. Weaver for pointing this out. * libguile/ports.c (CONSUME_PEEKED_BYTE): New macro. (get_utf8_codepoint): New variable `pt'. Use `scm_peek_byte_or_eof'/`CONSUME_PEEKED_BYTE' pairs instead of `scm_get_byte_or_eof'. * test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42, #xe0 #xa0 #x41 #x42, #xf0 #x88 #x88 #x88]: Fix to conform to Unicode 6.0.0. [#xe0 #x88 #x88]: Remove test. [#xf0 #x80 #x80 #x41]: New test. 2011-05-07 Ludovic Courtès <ludo@gnu.org> Add `scm_peek_byte_or_eof'. * libguile/inline.h (scm_get_byte_or_eof): Add `SCM_UNLIKELY' for EOF. (scm_peek_byte_or_eof): New function. * libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_peek_byte_or_eof'. 2011-05-07 Andreas Rottmann <a.rottmann@gmx.at> More completely document the `(rnrs io ports)' library * doc/ref/api-io.texi (R6RS I/O Ports): Transcribe missing parts from the R6RS document. 2011-05-07 Andy Wingo <wingo@pobox.com> fix srfi-1 map-in-order definition * module/srfi/srfi-1.scm (map-in-order): As we are not extending the core `map' binding, actually make a new `map-in-order' alias here. Fixes fresh builds. 2011-05-06 Ludovic Courtès <ludo@gnu.org> Special-case UTF-8 ports to bypass `iconv' entirely. * libguile/ports.c (update_port_lf): Handle EOF. (get_utf8_codepoint, get_iconv_codepoint): New functions. (get_codepoint): Use them. (scm_i_set_port_encoding_x): Don't open conversion descriptors when ENCODING is "UTF-8". * libguile/print.c (display_string_as_utf8, display_string_using_iconv): New functions. (display_string): Use them. * test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42]: Add a note that this is not the wrong behavior per Unicode 6.0.0. 2011-05-06 Ludovic Courtès <ludo@gnu.org> Fix `foreign.test' for big endian machines. * test-suite/tests/foreign.test ("pointer<->bytevector")["pointer from bits", "dereference-pointer"]: Fix iteration order for big endian machines. 2011-05-06 Andy Wingo <wingo@pobox.com> avoid tls gets when handling interrupts in the vm * libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a scm_i_thread* as well. OK to do because it's within a BUILDING_LIBGUILE block. * libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of the dynstate, so we can use the thread for ticks. * libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the scm_i_thread* local var, to avoid excessive tls calls. * libguile/vm-i-system.c: Fix dynstate users to use current_thread->dynamic_state. 2011-05-05 Andy Wingo <wingo@pobox.com> map and for-each in scheme * module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead of C. There are boot versions before `cond' is defined. (map-in-order): Define this alias here instead of in evalext.h. * libguile/eval.c: Stub out the map and for-each definitions to just call into Scheme. * libguile/evalext.c: Remove map-in-order definition. * module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map. (map, for-each): Define implementations here, in Scheme, instead of in C. * test-suite/tests/eval.test (exception:wrong-length, "map"): Update the expected exception for mapping over lists of different lengths. * libguile/srfi-1.h: * libguile/srfi-1.c: Remove map and for-each definitions. Remove the bit that extended the core `map' primitive with another method: the right way to do that is with modules. 2011-05-05 Andy Wingo <wingo@pobox.com> psyntax simplification * module/ice-9/psyntax.scm (strip): Inline the and-map* definition to its one call site. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-05-05 Andy Wingo <wingo@pobox.com> scm_mem[qv] optimization * libguile/list.c (scm_memq, scm_memv): Inline the tortoise/hare check that scm_ilength does, via SCM_VALIDATE_LIST, into the memq/memv bodies. Avoids traversing these lists twice. 2011-05-05 Ludovic Courtès <ludo@gnu.org> Generate `escape' and `substitute' port decoding tests. 2011-05-05 Andy Wingo <wingo@pobox.com> VM tweaks * libguile/vm-engine.c (VM_CHECK_OBJECT, VM_CHECK_FREE_VARIABLES): Set to 0 for both engines. These are really internal debugging variables, which don't affect user-visible features, provided that the compiler is correct of course. (VM_CHECK_UNDERFLOW): New var, also off by default: whether to check for stack underflow when popping values. (vm_engine): Don't declare object_count if we are not checking object table accesses. * libguile/vm-engine.h (CACHE_PROGRAM): Don't muck with object_count if we are not checking object table accesses. (CHECK_UNDERFLOW, PRE_CHECK_UNDERFLOW): Nop out if we are not checking underflow. (POP2, POP3): New macros which check for underflow before popping more than one value. * libguile/vm-i-loader.c (load_array): * libguile/vm-i-scheme.c (set_car, set_cdr, vector_set, slot_set) (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET, BV_INT_SET) (BV_FLOAT_SET): * libguile/vm-i-system.c (partial_cont_call, fix_closure, prompt) (fluid_set): Use POP2 / POP3. (local_set, long_local_set): Pop to locals instead of using values on the stack then dropping; allows for underflow to be checked before the value is accessed. (BR): Don't NULLSTACK or DROP after the operation. (br_if, br_if_not, br_if_eq, br_if_not_eq, br_if_null) (br_if_not_null): Pop to locals before doing the compare and jump. 2011-05-05 Andy Wingo <wingo@pobox.com> srfi-1 `member' in scheme, inlines to memq / memv in some cases * libguile/srfi-1.c: * libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme. * module/srfi/srfi-1.scm (member): Implement here, with the inlining cases for eq? and eqv?. Speeds up a compiled bootstrap of psyntax.scm, because lset-adjoin inlines to the memq case. (lset<=): Reindent. (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass it through to `member', so we inline to memq / memv. Use something closer to the reference implementations. 2011-05-05 Andy Wingo <wingo@pobox.com> speed up compile-bytecode * module/language/assembly/compile-bytecode.scm (compile-bytecode): Rewrite to fill a bytevector directly, instead of using bytevector ports. `write-bytecode' itself is still present and almost the same as before; it's just that `write-byte' et al now inline the effect of writing a byte to a binary port. * test-suite/tests/asm-to-bytecode.test (comp-test): Refactor to use public interfaces. 2011-05-05 Andy Wingo <wingo@pobox.com> silly "optimization" in (language assembly) * module/language/assembly.scm (byte-length): Silly, minor tweak: put the fixed-length instruction case first. Seems to shave some 10% off the time compiling psyntax.scm (when the whole rest of the system is compiled, of course). add gcprof * module/statprof.scm (gcprof): New variant of statprof; instead of being driven by setitimer, this one is driven by the after-gc-hook. minor statprof tweaks * module/statprof.scm (statprof-reset): Make full-stacks? into an optional arg instead of doing the rest arg dance. (statprof-display): Format gc-time-taken appropriately. 2011-05-04 Ludovic Courtès <ludo@gnu.org> Automatically generate `peek-char' decoding error tests. * test-suite/tests/ports.test ("string ports")[make-peek+read-checks]: New macro. [test-decoding-error]: Change to take a list of expected characters or conditions. Use `make-peek+read-checks' to generate a `peek-char' test. [(#xc2 #x41 #x42), (#xe0 #xa0 #x41 #x42)]: New tests. 2011-05-04 Andy Wingo <wingo@pobox.com> measure time spent in gc * libguile/gc.c (scm_gc_stats): Set the gc-time-taken entry to our recorded value. (start_gc_timer, accumulate_gc_timer, scm_init_gc): Arrange to record a conservative estimate of time spent in GC. 2011-05-04 Andy Wingo <wingo@pobox.com> scm_c_get_internal_run_time is more precise * libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C variable instead of being a pure preprocessor thing. This has the possibility to break existing compiled C extensions' interpretation of the internal-time-units-per-second, but hopefully there's no too much of that code out there, and in the worst case they can just recompile. Scheme code will get it right without the need to recompile. * libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and increase to nanosecond resolution if we are on a system in which this is useful and practical. (time_from_seconds_and_nanoseconds): New helper. (get_internal_real_time, get_internal_run_time): New global vars: function pointers. (get_internal_real_time_posix_timer): (get_internal_run_time_posix_timer): (get_internal_real_time_gettimeofday): (get_internal_run_time_times): (get_internal_real_time_fallback): Various implementations. (scm_get_internal_real_time): Return the get_internal_real_time() result. (scm_c_get_internal_run_time): Likewise. (scm_gettimeofday): No need for a critical section, and remove obsolete ftime block. (scm_init_stime): Init all of the new time bases, and decide on implementations of real time and run time accessors. 2011-05-04 Andy Wingo <wingo@pobox.com> build support for detecting clock_gettime, with -lrt if needed * acinclude.m4 (gl_CLOCK_TIME): * configure.ac: Locally include gl_CLOCK_TIME. To be fixed properly when gnulib updates their license to reflect the actual BSD state of things. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Add -lrt for clock_gettime, if needed. * meta/guile-2.0-uninstalled.pc.in: * meta/guile-2.0.pc.in: Likewise, in Libs.private. 2011-05-02 Daniel Llorens <daniel.llorens@bluewin.ch> Fix call-with-input-file & relatives for multiple values * module/ice-9/r4rs.scm (call-with-input-file, call-with-output-file): Rewrite with call-with-values. (with-input-from-file): use call-with-input-file. (with-output-to-file, with-error-to-file): use call-with-output-file. Update docstrings to make clear that multiple values may be yielded. 2011-05-01 Andy Wingo <wingo@pobox.com> deprecate scm_struct_table * libguile/goops.h: * libguile/goops.c (scm_i_define_class_for_vtable): New internal helper, defines a class for a vtable, relying on the name slot being set correctly. (scm_class_of, create_struct_classes): Use the local vtable-to-class map instead of scm_struct_table. * libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME) (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table) (scm_struct_create_handle): Deprecate these internals of the map between structs and classes. * libguile/deprecated.h: * libguile/deprecated.c (scm_struct_create_handle): Deprecated code over here now. 2011-05-01 Andy Wingo <wingo@pobox.com> disallow get-handle / create-handle! of weak hash tables * libguile/hashtab.c (scm_hashq_get_handle, scm_hashq_create_handle_x) (scm_hashv_get_handle, scm_hashv_create_handle_x) (scm_hash_get_handle, scm_hash_create_handle_x) (scm_hashx_get_handle, scm_hashx_create_handle_x): Don't allow these functions to be called on weak hash tables, as we have no idea when the GC will null out fields of the handle, and set-cdr! won't register disappearing links, and set-car! would never work of course. (ice-9 poe) does not get handles from weak hash tables * module/ice-9/poe.scm (pure-funcq, perfect-funcq): Reimplement to not use get-handle. boot-9 fixme note * module/ice-9/boot-9.scm (module-replace!): Add a fixme about using something other than object properties here. fix scm_object_property_set_x for handles and weak tables * libguile/objprop.c (scm_object_property_set_x): Use ref and set! instead of create-handle and set-cdr!, as it is a weak hash table. (scm_set_object_properties_x): Likewise. deprecated primitive-properties don't get handles from weak hash tables * libguile/deprecated.c (scm_primitive_property_ref) (scm_primitive_property_set_x): Avoid getting handles to elements in a weak hash table, as that's not going to work very well. 2011-05-01 Andy Wingo <wingo@pobox.com> deprecate scm_whash API * libguile/deprecated.h: * libguile/deprecated.c (scm_whash_get_handle, SCM_WHASHFOUNDP) (SCM_WHASHREF, SCM_WHASHSET, scm_whash_create_handle) (scm_whash_lookup, scm_whash_insert): Deprecate this API. * libguile/srcprop.c: * libguile/srcprop.h: * libguile/read.c (scm_read_sexp): Use the hashq API instead of the whash API. 2011-05-01 Andy Wingo <wingo@pobox.com> fix hash-set! in weak-value table from non-immediate to immediate * libguile/hashtab.c (set_weak_cdr, scm_hash_fn_set_x): If we have a weak-value hash table with a previous non-immediate value for a given key, and we are setting an immediate as the new value, we were not unregistering the disappearing link. Fixed. 2011-04-29 Andy Wingo <wingo@pobox.com> psyntax simplification * module/ice-9/psyntax.scm (id-var-name): Just rely on multiple-values truncation. 2011-04-29 Andy Wingo <wingo@pobox.com> MV truncation in the boot evaluator * libguile/eval.c (truncate_values): New helper. (EVAL1): New macro, does an eval then truncates the values. (eval, prepare_boot_closure_env_for_apply) (prepare_boot_closure_env_for_eval): Use EVAL1 in appropriate places to get multiple-values truncation even here in the boot evaluator. eval.c fixen 2011-04-29 Andy Wingo <wingo@pobox.com> latin1 strings in vm error messages * libguile/vm-engine.c: Use latin1 strings here for the string literals. 2011-04-28 Andy Wingo <wingo@pobox.com> check for iconveh values at configure-time * configure.ac: Check for the iconveh values here, instead of relying on gen-scmconfig to know them. That doesn't work in general because gen-scmconfig runs on the build machine, not the target machine. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the revision before 533d8212. * libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR): (SCM_I_GSC_ICONVEH_QUESTION_MARK): (SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE): * libguile/gen-scmconfig.c: Use configure-time substitutions to set SCM_ICONVEH_ERROR_HANDLER et al. 2011-04-28 Andy Wingo <wingo@pobox.com> -x error message fix * module/ice-9/command-line.scm (compile-shell-switches): Fix error message for -x switch. fix double-loading of script in -ds case * module/ice-9/command-line.scm (compile-shell-switches): In the -ds case, we were erroneously loading the script twice. Fix that. fix break example * doc/ref/api-control.texi (while do): Fix a break example. allow while as an expression * module/ice-9/boot-9.scm (while): Specify the return value as #f under normal conditions, #t under (break), and arg... under (break arg...). * test-suite/tests/syntax.test ("while"): Test. * doc/ref/api-control.texi (while do): Document. 2011-04-28 Andy Wingo <wingo@pobox.com> add reset and shift * module/ice-9/control.scm (reset, shift): Add implementations of these operators from Wolfgang J Moeller, derived from implementations by Oleg Kiselyov. (reset*, shift*): Procedural variants. * test-suite/tests/control.test ("shift and reset"): Add tests, originally from Oleg Kiselyov. 2011-04-27 Ludovic Courtès <ludo@gnu.org> Fix typo in `NEWS'. Bump version number for 2.0.1. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions such as `scm_c_public_ref' and `scm_from_latin1_keyword'. (LIBGUILE_INTERFACE_AGE): Increment. Update `NEWS'. 2011-04-27 Ludovic Courtès <ludo@gnu.org> Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9). Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and 531c9f1dc51c4801c4d031ee80a31f15285a6b85. * module/srfi/srfi-9.scm (define-inlinable): New macro. 2011-04-27 Ludovic Courtès <ludo@gnu.org> Document `(ice-9 binary-ports)'. * doc/ref/api-io.texi (R6RS I/O Ports): Mention `(ice-9 binary-ports)'. * NEWS: Update. 2011-04-27 Ludovic Courtès <ludo@gnu.org> Add tests for UTF-8 ill-formed sequence handling. * test-suite/tests/ports.test ("string ports"): Add for `test-decoding-error' tests for ill-formed UTF-8 sequences. Thanks to Mark H Weaver <mhw@netris.org> for pointing this out. 2011-04-27 Ludovic Courtès <ludo@gnu.org> Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'. * libguile/ports.c (get_codepoint): Return EILSEQ when OUTPUT_SIZE == 0. * test-suite/tests/ports.test ("string ports"): Add 2 tests for unterminated sequences. 2011-04-27 Ludovic Courtès <ludo@gnu.org> Add a couple more Unicode I/O tests. * test-suite/tests/ports.test ("string ports")["%default-port-encoding is honored"]: Make sure `(port-encoding p)' is as expected. ["peek-char [utf-16]"]: New test. Rewrite port decoding error tests using a mini DSL. * test-suite/tests/ports.test ("string ports")[test-decoding-error]: New macro. ["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute", "peek-char, wrong encoding, error"]: Rewrite using `test-decoding-error'. Gracefully handle `setlocale' errors at the REPL. * module/ice-9/top-repl.scm (top-repl): Catch exceptions from `setlocale'. Reported by CRLF0710 <crlf0710@gmail.com>. 2011-04-26 Ludovic Courtès <ludo@gnu.org> Remove the `sizeof (mpz_t)' check. * libguile/numbers.c: Remove `sizeof (mpz_t)' check, which wasn't need anymore since `make_bignum' doesn't make any such assumption. 2011-04-25 Ludovic Courtès <ludo@gnu.org> Use `scm_with_guile' in `test-pthread-create'. * test-suite/standalone/test-pthread-create.c (inner_main): New function. (main): Call it within `scm_with_guile', instead of using `scm_init_guile'. This improves portability--e.g., `GC_get_stack_base', used by `scm_init_guile', failed on Darwin up to BDW-GC 7.1alpha4 included (thanks, Mark, for the hint.) 2011-04-25 Ludovic Courtès <ludo@gnu.org> Update Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'. * m4/gnulib-cache.m4: Remove `strcase' and `version-etc-fsf'. * configure.ac (POTENTIAL_GCC_CFLAGS): Remove `-Wundef'. * libguile/script.c: Don't include <version-etc.h>. 2011-04-25 Ludovic Courtès <ludo@gnu.org> Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests. * test-suite/standalone/test-asmobs-lib.c, test-suite/standalone/test-extensions-lib.c, test-suite/standalone/test-ffi-lib.c, test-suite/standalone/test-list.c, test-suite/standalone/test-num2integral.c, test-suite/standalone/test-with-guile-module.c: Change `#ifndef HAVE_CONFIG_H' to `#ifdef HAVE_CONFIG_H' (!). Compile more file system related procedures when `--disable-posix'. * libguile/filesys.c (scm_tc16_dir, scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print, scm_dir_free, scm_lstat): Compile unconditionally. 2011-04-25 Ludovic Courtès <ludo@gnu.org> Move `{total,current}-processor-count' outside of `posix.c'. * libguile/posix.c (scm_total_processor_count, scm_current_processor_count): Move to... * libguile/threads.c: ... here. * libguile/posix.h (scm_total_processor_count, scm_current_processor_count): Move declarations to... * libguile/threads.h: ... here. * test-suite/tests/posix.test ("nproc"): Move tests to... * test-suite/tests/threads.test: ... here. 2011-04-25 Ludovic Courtès <ludo@gnu.org> Make the `sizeof (mpz_t)' check at compile-time. * libguile/init.c (scm_i_init_guile): Remove the `sizeof (mpz_t)' run-time check. * libguile/numbers.c: Add a compile-time check for `sizeof (mpz_t)'. 2011-04-25 Ludovic Courtès <ludo@gnu.org> Add pthread-related tests. * test-suite/standalone/Makefile.am (test_scm_spawn_thread_CFLAGS, test_scm_spawn_thread_LDADD, test_pthread_create_CFLAGS, test_pthread_create_LDADD, test_pthread_create_secondary_CFLAGS, test_pthread_create_secondary_LDADD): New variables. (check_PROGRAMS)[BUILD_PTHREAD_SUPPORT]: Add `test-scm-spawn-thread', `test-pthread_create', `test-pthread_create-secondary'. (TESTS)[BUILD_PTHREAD_SUPPORT]: Likewise. * test-suite/standalone/test-scm-spawn-thread.c, test-suite/standalone/test-pthread-create.c, test-suite/standalone/test-pthread-create-secondary.c: New files. 2011-04-25 Ludovic Courtès <ludo@gnu.org> Make `scm_i_ensure_signal_delivery_thread' call in Guile mode. * libguile/threads.c (on_thread_exit): Move `scm_i_ensure_signal_delivery_thread' call... (do_thread_exit): ... here. 2011-04-22 Ludovic Courtès <ludo@gnu.org> Make sure binary ports pass `binary-port?' regardless of the locale. * libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Set `c_port->encoding' to NULL. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["bytevector-input-port is binary"]: New test. ("7.2.7 Input Ports")["make-custom-binary-input-port"]: Make sure PORT passes `binary-port?' and `input-port?'. ("8.2.10 Output ports")["bytevector-output-port is binary"]: New test. ["make-custom-binary-output"]: Rename to... ["make-custom-binary-output-port"]: ... this. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute", "peek-char, wrong encoding, error"]: Use `set-port-encoding!' instead of `%default-port-encoding' to set the encoding of bytevector input ports. * test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding error, substitute"]: Likewise. * doc/ref/api-io.texi (R6RS Port Manipulation): Document `binary-port?' and `textual-port?'. * doc/ref/r6rs.texi (R6RS Incompatibilities): Mention the soft distinction between textual and binary ports. 2011-04-22 Ludovic Courtès <ludo@gnu.org> Turn the libunistring/iconv configure check into a macro. * acinclude.m4 (GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT): New macro. * configure.ac: Use it. 2011-04-22 Ludovic Courtès <ludo@gnu.org> Fix typo in `configure.ac'. * configure.ac: Add missing comma in `AC_RUN_IFELSE' invocation. Increase the timeout of timing-sensitive thread tests. * test-suite/tests/threads.test ("timed locking succeeds if mutex unlocked within timeout", "timed unlocking returns #t if condition signaled", "timed joining succeeds if thread exits within timeout"): Increase the timeout. Reported by Dale P. Smith <dsmich@roadrunner.com>. 2011-04-21 Andy Wingo <wingo@pobox.com> add test that libunistring was built with iconv support * configure.ac: Add check that libunistring was built with iconv support. Thanks to Mark Weaver for the debugging and test program. 2011-04-21 Mark H Weaver <mhw@netris.org> Clarify units of string length in decription of scm_from_stringn * doc/ref/api-data.texi (Conversion to/from C): In description of scm_from_stringn, clarify that the length is specified in bytes. 2011-04-20 Mark H Weaver <mhw@netris.org> Clarify the units of returned lengths in string conversion functions * doc/ref/api-data.texi (Conversion to/from C): In descriptions of scm_to_stringn and scm_to_{latin1,utf8,utf32}, clarify that the returned length is in units of bytes or code points, not characters. Also change NULL to @code{NULL} in a few places. 2011-04-15 Andy Wingo <wingo@pobox.com> fix pre-GC_set_start_callback compilation * libguile/gc.c: Move declaration of run_before_gc_hook up. 2011-04-15 Andy Wingo <wingo@pobox.com> pre-GC_set_start_callback compatibility * configure.ac: Add a check for GC_set_start_callback. * libguile/gc.c (scm_i_gc): If we don't have GC_set_start_callback, run the before-gc hook manually here. (scm_init_gc): Otherwise set it as a start callback. * libguile/hashtab.c (weak_gc_callback, weak_gc_hook) (weak_gc_finalizer, scm_c_register_weak_gc_callback): Fix to work either way, with or without GC_set_start_callback. 2011-04-15 Andy Wingo <wingo@pobox.com> weak hash table vacuum on before-gc C hook * libguile/hashtab.c (weak_gc_callback) (scm_c_register_weak_gc_callback): Change implementation to use the before-gc C hook instead of the after-gc finalizers. use gc_start_callback + asyncs for after-gc-hook, instead of finalizers * libguile/gc.c (run_before_gc_c_hook, scm_storage_prehistory) (after_gc_async_thunk, queue_after_gc_hook, scm_init_gc): Instead of playing our finalizer trick, connect to the GC start callback, and use it to queue an async after-gc-hook. Seems to fix the after-gc-hook on non-threaded builds. Though this does re-enable the before-gc C hook, we don't wire up the Scheme hook because we're in the alloc lock; and indeed, a before-GC scheme hook isn't a great idea... 2011-04-15 Andy Wingo <wingo@pobox.com> add --fresh-auto-compile * doc/ref/api-evaluation.texi (Compilation): Add discussion of --fresh-auto-compile. * doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile option. * NEWS: Add entry. * libguile/load.c: Define %fresh-auto-compile. (scm_primitive_load_path): Use it here. (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env var, with a value of "fresh". * module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is stale if %fresh-auto-compile is true. * module/ice-9/command-line.scm (compile-shell-switches): Parse out --fresh-auto-compile. 2011-04-15 Ludovic Courtès <ludo@gnu.org> Build `filesys.x'. * libguile/Makefile.am (DOT_X_FILES): Add `filesys.x'. 2011-04-15 Ludovic Courtès <ludo@gnu.org> Allow compilation with `--disable-posix'. Reported by Dmitry Dzhus <dima@dzhus.org>. * configure.ac: Remove `AC_LIBOBJ([filesys])'. Document `--disable-posix' as omitting non-essential POSIX interfaces. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Add `filesys.c'. (DOT_DOC_FILES): Add `filesys.doc'. (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove `filesys.c'. * libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'. (scm_init_posix): Move `R_OK' etc. to `filesys.c'. * libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes, scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir, scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd, set_element, fill_select_type, get_element, retrieve_select_type, scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink, scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX. (scm_mkstemp, scm_access): New functions. (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on HAVE_POSIX. Define `R_OK', `W_OK', etc. * libguile/fports.c (fport_print): Use `scm_ttyname' only when HAVE_POSIX. * libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New functions. Update users of `scm_i_locale_mutex' to use them. * libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'. * meta/guile-tools.in (main): Use `setlocale' only when it is defined. * module/ice-9/boot-9.scm: Always load `ice-9/posix'. 2011-04-14 Ludovic Courtès <ludo@gnu.org> Include <sched.h> in `posix.c'. * configure.ac: Check for <sched.h>. * libguile/posix.c [HAVE_SCHED_H]: Include <sched.h>, for `sched_setaffinity' & co. Reported by Marco Maggi <marco.maggi-ipsu@poste.it>. 2011-04-14 Ludovic Courtès <ludo@gnu.org> Add tests for `-Wformat' and gettext. * test-suite/tests/tree-il.test ("warnings")["non-literal format string using gettext", "one missing argument, gettext"]: New tests. 2011-04-14 Andy Wingo <wingo@pobox.com> fix analyze.scm literal string warnings * module/language/tree-il/analyze.scm (const-fmt): Return any literal value, not just strings. The string case is checked later. fix embarrassing bugs in (ice-9 command-line) * module/ice-9/command-line.scm (compile-shell-switches): Whoops, fix a few cases that forgot to loop back to the beginning. guile -v prints LGPLv3+. * module/ice-9/command-line.scm (compile-shell-switches): Though Guile may be distributed under the GPLv3, Guile is actually LGPLv3+. script.c calls out to (ice-9 command-line) * libguile/script.c (scm_shell_usage): Call (ice-9 command-line)'s shell-usage. (scm_compile_shell_switches): Likewise, call (ice-9 command-line)'s compile-shell-switches. add packager info to %build-info * libguile/load.c (init_build_info): Add packager, packager-version, and packager-bug-reports to %build-info, if they are available. add (ice-9 command-line) * module/ice-9/command-line.scm: New module for parsing Guile's command line, ported from script.c. Includes local eval-string implementation to make `guile -c 1' faster, by not having to load the compiler. * module/Makefile.am: Add to build. don't warn about non-literal fmt strings for e.g. (_ "foo") * module/language/tree-il/analyze.scm (const-fmt, format-analysis): Allow format strings to be gettexted, using the conventional _ name. 2011-04-13 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update for 2.0.1. (rnrs arithmetic fixnums) fixnum? export a procedure again * module/rnrs/arithmetic/fixnums.scm (fixnum?): Restore this export to be a procedure, not syntax. (inline-fixnum?): This is what fixnum? was. Use it internally. revert 4a2ac0623c3dabb2c8b9d38c27b837dcb2c7fe4e * module/ice-9/popen.scm (open-pipe*): No need to pump the pipes guardian here, now that hooks are working again. --disable-threads fix * libguile/threads.c (do_thread_exit_trampoline, on_thread_exit): (scm_i_init_thread_for_guile): Only register and unregister threads with bdw-gc when we are building with threads support. Thanks to Marijn for the report. 2011-04-11 Ian Price <ianprice90@googlemail.com> Fix fencepost error in bip_seek * libguile/r6rs-ports.c (bip_seek): Fix to allow seeking to end of port. * test-suite/tests/r6rs-ports.test ("bytevector input port can seek to very end"): Add tests. 2011-04-11 Ian Price <ianprice90@googlemail.com> fix assert to return true value. * module/rnrs/base.scm (assert): returns value instead of void. * test-suite/tests/r6rs-base.test ("assert"): add test cases. 2011-04-11 Ian Price <ianprice90@googlemail.com> Added optional second arg to R6RS log function * module/rnrs/base.scm (log): now takes a base argument, using the change of base formula for logs. * test-suite/tests/r6rs-base.test ("log (2nd arg)"): Add test cases. 2011-04-11 Andy Wingo <wingo@pobox.com> fix reader.test for --disable-deprecated * test-suite/tests/reader.test: Fix deprecated tests; begin-deprecated was splicing in expression context before, which is a no-no. regen psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate, to take advantage of better #{}# serialization. 2011-04-11 Andy Wingo <wingo@pobox.com> symbols with odd characters print better in #{}# * libguile/print.c (symbol_has_extended_read_syntax): Use a more general, unicode-appropriate algorithm. Hopefully doesn't cause any current #{}# cases to be unescaped. (print_extended_symbol): Use more appropriate unicode algorithm, and emit unicode hex escapes instead of our own lame escapes. * test-suite/tests/symbols.test: Add tests. 2011-04-11 Andy Wingo <wingo@pobox.com> read-extended-symbol handles backslash better, including r6rs hex escapes * libguile/read.c (scm_read_extended_symbol): Interpret '\' as an escape character. Due to some historical oddities we have to support '\' before any character, but since we never emitted '\' in front of "normal" characters like 'x' we can interpret "\x..;" to be an R6RS hex escape. * test-suite/tests/reader.test ("#{}#"): Add tests. 2011-04-11 Andy Wingo <wingo@pobox.com> refactor scm_i_print_symbol_name * libguile/print.c (symbol_has_extended_read_syntax) (print_normal_symbol, print_extended_symbol, scm_i_print_symbol_name): Factor scm_i_print_symbol_name into separate routines. Add comments. There are a number of bugs here. ignore SIGPIPE in (system repl server) * module/system/repl/server.scm (run-server): Ignore SIGPIPE when we run a server, as otherwise a rudely disconnected client could cause the server to quit. Thanks to John Proctor for the report, and Detlev Zundel for the debugging. 2011-04-09 Mark H Weaver <mhw@netris.org> Fix the R6RS exact-integer-sqrt and import into core guile * libguile/numbers.c (scm_exact_integer_sqrt): New C procedure to compute exact integer square root and remainder. (scm_i_exact_integer_sqrt): New Scheme procedure `exact-integer-sqrt' from the R6RS, imported into core guile. * libguile/numbers.h: Add prototypes. * module/rnrs/base.scm: Remove broken stub implementation, which would fail badly when applied to large integers. * doc/ref/api-data.texi: Add documentation. * doc/ref/r6rs.texi: Change documentation for `exact-integer-sqrt' to a stub that xrefs the core docs, as is done for other operations available in core. * test-suite/tests/numbers.test: Add tests. * NEWS: Add news entries. 2011-04-08 Andreas Rottmann <a.rottmann@gmx.at> Implement R6RS' `fixnum?' in a smarter way * module/rnrs/arithmetic/fixnums.scm (fixnum?): Implemented using bit-twiddling, and using `define-inlinable'. 2011-04-07 Mark H Weaver <mhw@netris.org> Fix typo in arithmetic benchmark * benchmark-suite/benchmarks/arithmetic.bm (fixnum): Fix `-' benchmark to actually use `-' operator instead of `+' operator. 2011-04-07 Andreas Rottmann <a.rottmann@gmx.at> Move `define-inlinable' into the default namespace * module/ice-9/boot-9.scm (define-inlineable): Moved here from SRFI-9. * module/srfi/srfi-9 (define-inlinable): Removed here. * doc/ref/api-procedures.texi (Inlinable Procedures): Add subsection about `define-inlinable'. 2011-04-07 Mark H Weaver <mhw@netris.org> Fix parsing of exact numbers with negative exponents * libguile/numbers.c (mem2decimal_from_point): Use scm_divide instead of scm_divide2real when applying a negative exponent, to preserve exactness in case the "#e" forced exactness specifier is present. This fixes a bug where numeric literals such as "#e1e-5" yielded incorrect fractions. 2011-04-06 Mark H Weaver <mhw@netris.org> Doc fix: quotient/remainder/modulo do not require exact arguments * doc/ref/api-data.texi (Arithmetic): `floor-remainder' is equivalent to the R5RS `modulo' when the arguments are integers. Previously, equivalence was claimed only for exact integers. Similarly for `truncate-quotient' and `truncate-remainder' compared with the R5RS `quotient' and `remainder'. Undeprecate read syntax for uniform complex vectors * libguile/read.c (scm_read_sharp): Move the "#c..." case outside of #if SCM_ENABLE_DEPRECATED, and to the same section which handles "#s...", "#u..." and "#f...". Thanks to Andreas Rottmann <a.rottmann@gmx.at> for the bug report. 2011-04-04 Andreas Rottmann <a.rottmann@gmx.at> Several optimizations for R6RS fixnum arithmetic * module/rnrs/arithmetic/fixnums.scm (assert-fixnum): Is now a macro. (assert-fixnums): New procedure checking a the elements of a list for fixnum-ness. All callers applying `assert-fixnum' to a list now changed to use this procedure. * module/rnrs/arithmetic/fixnums.scm (define-fxop*): New for defining n-ary inlinable special-casing the binary case using `case-lambda'. All applicable procedures redefined using this macro. * module/rnrs/arithmetic/fixnums.scm: Alias all predicates to their non-fixnum counterparts. 2011-04-04 Andreas Rottmann <a.rottmann@gmx.at> Add a few benchmarks for R6RS fixnum arithmetic * benchmark-suite/benchmarks/r6rs-arithmetic.bm: New file containing some benchmarks for R6RS fixnum operations. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add benchmarks/r6rs-arithmetic. 2011-04-03 Andy Wingo <wingo@pobox.com> pthread-threads.h: only redirect to GC_pthread_sigmask if it is present * configure.ac: Check for pthread_sigmask. * libguile/gen-scmconfig.c: Create SCM_HAVE_GC_PTHREAD_SIGMASK. * libguile/pthread-threads.h (scm_i_pthread_sigmask): Only redirect to GC_pthread_sigmask if GC_pthread_sigmask is present. 2011-04-01 Andy Wingo <wingo@pobox.com> fix c32vector-set!, c64vector-set! * module/srfi/srfi-4/gnu.scm (bytevector-c32-native-set!): (bytevector-c64-native-set!): Fix to actually allow complex numbers. * test-suite/tests/srfi-4.test: Add tests. 2011-04-01 Andy Wingo <wingo@pobox.com> string->pointer and pointer->string have optional encoding arg * test-suite/tests/foreign.test ("pointer<->string"): Add test cases. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Add optional encoding, and in the pointer->string case, length arguments. * libguile/foreign.h: Update prototypes of internal functions. Shouldn't affect ABI as they are internal. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update docs. 2011-04-01 Andy Wingo <wingo@pobox.com> support loading objcode even if mmap(2) is unavailable * configure.ac: Check for sys/mman.h. * libguile/objcodes.c (verify_cookie): Factor cookie verification out to a helper function. (make_objcode_from_file): Rename from make_objcode_by_mmap. If mmap is unavailable, just read(2) to a bytevector. 2011-04-01 Andy Wingo <wingo@pobox.com> make_objcode_by_mmap uses MAP_PRIVATE, not MAP_SHARED * libguile/objcodes.c (make_objcode_by_mmap): MAP_PRIVATE, not MAP_SHARED -- we don't need to update the underlying file, nor do we need to see updates. latin1 subr and message in internal scm_{encoding,decoding}_error * libguile/strings.c (scm_encoding_error, scm_decoding_error): Use scm_from_latin1_string for the subr and message args, as these are internal functions, and we know their callers. 2011-03-31 Andy Wingo <wingo@pobox.com> fix duplicate path in uninstalled-env * meta/uninstalled-env.in: Our code that checked for paths already being in the load path was not working for the last entry in the load path. This caused the last entry to be re-added to the beginning, which also caused relative filename canonicalization to prepend "module/" to everything. Terrible. 2011-03-31 Kevin Fletcher <kevinjohn.fletcher@gmail.com> fix gc_register_my_thread et al fallback impls * libguile/threads.c (GC_register_my_thread, GC_get_stack_base): Fix fallback impls. 2011-03-31 Andy Wingo <wingo@pobox.com> web.texi: handler return types documentation * doc/ref/web.texi (Web Server): More docs on handler return types. web.texi: fix uri->string invocation * doc/ref/web.texi (Web Examples): Fix uri->string invocation. Thanks to Romel Sandoval for the report. 2011-03-31 Andy Wingo <wingo@pobox.com> fix problems detecting coding: in block comments * libguile/read.c (scm_i_scan_for_encoding): Fix for coding on first line #! and for !# immediately following the coding. * test-suite/Makefile.am: * test-suite/tests/coding.test: Add tests. 2011-03-31 Andy Wingo <wingo@pobox.com> inline fxops in psyntax * module/ice-9/psyntax.scm (fx+, fx-, fx=, fx<): Given our lame lack of an inliner, inline these manually with identifier syntax. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-03-31 Andy Wingo <wingo@pobox.com> allow definitions in with-syntax body * module/ice-9/psyntax.scm (with-syntax): Allow definitions in the body, as seems to be suggested by the R6RS. * test-suite/tests/syncase.test ("with-syntax"): Add test. * module/ice-9/psyntax-pp.scm: Regenerate. 2011-03-31 Michael Gran <spk121@yahoo.com> More descriptive error for dynamic-pointer * libguile/dynl.c (sysdep_dynl_value): Failure to find a symbol is not an error, so raise our own, more appropriate error. * test-suite/tests/foreign.test ("dynamic-pointer"): Add a test. 2011-03-30 Andy Wingo <wingo@pobox.com> with-continuation-barrier calls exit(3) _after_ unwinding * libguile/continuations.c (scm_handler, c_handler) (scm_c_with_continuation_barrier, scm_with_continuation_barrier): Instead of calling scm_handle_by_message_noexit in the pre-unwind handler, roll our own exception printing in the pre-unwind, and do to exit()-on-quit in the post-unwind handler. This lets the stack unwind at exit-time so that pending dynwinds run. * test-suite/tests/continuations.test ("continuations"): Add a test. 2011-03-30 Michael Gran <spk121@yahoo.com> don't GC unregister null thread GC_unregister_my_thread is only supposed to be called from a thread other than the main thread, so, it should never be called when the system is compiled with null threads. * libguile/threads.c (on_thread_exit)[SCM_USE_NULL_THREADS]: don't call GC_unregister_my_thread 2011-03-30 Michael Gran <spk121@yahoo.com> check for GC_allow_register_threads This is not present in earlier versions of BDW-GC * configure.ac: check for GC_allow_register_threads * libguile/threads.c (scm_i_init_thread_for_guile): Only call GC_allow_register_threads if it is present. 2011-03-29 Ludovic Courtès <ludo@gnu.org> Fix `procedure->pointer' for functions returning `void'. * libguile/foreign.c (unpack): Handle `FFI_TYPE_VOID'. * test-suite/tests/foreign.test ("procedure->pointer")["procedures returning void"]: New test. Reported by Tristan Colgate <tcolgate@gmail.com>. 2011-03-29 Andy Wingo <wingo@pobox.com> fix prompt and abort with the boot evaluator * libguile/control.h: * libguile/control.c (scm_i_prompt_pop_abort_args_x): Take a VM instead of a prompt, given that it's the VM's registers that record the abort arguments, not the prompt registers (which actually point right below the abort values). * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Pass the vm instead of a prompt. 2011-03-29 Andy Wingo <wingo@pobox.com> fix compilation with libgc 7.0, 7.1 * configure.ac: Check for GC_pthread_exit and GC_pthread_cancel. * libguile/gen-scmconfig.c: Write HAVE_GC_PTHREAD_CANCEL and HAVE_GC_PTHREAD_EXIT into scmconfig.h. * libguile/pthread-threads.h (scm_i_pthread_exit, scm_i_pthread_cancel): Only redefine to their GC_pthread_* variants if we have those functions, which is not the case in libgc < 7.2. 2011-03-29 Andy Wingo <wingo@pobox.com> fix error message on ,disassemble "non-procedure" * module/language/objcode/spec.scm (decompile-value): Don't assume that `error' will handle format strings appropriately. * module/system/repl/command.scm (disassemble): A more human error when you disassemble a non-procedure. Bug reported by Andrew Horton. 2011-03-29 Andy Wingo <wingo@pobox.com> document -q, repl options * doc/ref/scheme-scripts.texi (Invoking Guile): Document -q. * doc/ref/scheme-using.texi (Init File): New section, on .guile. (Readline): Link to Init File. (System Commands): Document the various REPL options, and repl-default-option-set!. rewrite ensure-writable-dir to not be racy * module/system/base/compile.scm (ensure-writable-dir): Rewrite to not be racy. 2011-03-27 Andy Wingo <wingo@pobox.com> fix prompt in fix in single-value context compilation * module/language/tree-il/compile-glil.scm (flatten): When compiling a <prompt> in push context with an RA, after the body returns normally, jump to that RA instead of to our POST label (which in that case does not need to be emitted). Fixes a tail <prompt> in a push <fix>. * test-suite/tests/control.test ("prompt in different contexts"): Add more test cases. 2011-03-27 Andy Wingo <wingo@pobox.com> tree-il->scheme fix * module/language/tree-il.scm (tree-il->scheme): Fix <prompt> to Scheme serialization. 2011-03-27 Noah Lavine <nlavine@haverford.edu> Document SRFI-23 * doc/ref/srfi-modules.texi: mention that we support SRFI 23 * module/ice-9/boot-9.scm (%cond-expand-features): add srfi-23 2011-03-26 Bruno Haible <bruno@clisp.org> Update comment about uc_locale_language. * libguile/i18n.c (locale_language): Update comment. 2011-03-26 Andy Wingo <wingo@pobox.com> fix stexi->html double translation * module/texinfo/html.scm (entry): Fix to avoid double translation: arg-req already pulls an stexi->shtml on its arg. fix (texinfo reflection) to handle nested structures like syntax patterns * module/texinfo/reflection.scm (process-args): Convert any arg to a string. "Fixes" documentation of syntax-rules patterns. 2011-03-25 Neil Jerram <neil@ossau.uklinux.net> Remove statements about scripts/* that are no longer true * doc/ref/tools.texi (Executable Modules): Say "guile-tools modules" instead of "executable modules". Remove obsolete statements about not ending in .scm, being executable, and beginning with shell script invocation sequence. * module/scripts/README: Ditto. 2011-03-25 Neil Jerram <neil@ossau.uklinux.net> Inline the effect of am/pre-inst-guile It's just one variable definition, and in my opinion it confuses, rather than helps, the overall build picture to have two names (preinstguile and meta/guile) for the same thing. * am/Makefile.am (am_frags): Remove pre-inst-guile. * am/pre-inst-guile: Deleted. * doc/ref/Makefile.am: Don't include am/pre-inst-guile. ($(snarf_doc).am, $(snarf_doc).texi): Expand $(preinstguile). * module/Makefile.am (ice-9/psyntax-pp.scm.gen): Don't include am/pre-inst-guile. (ice-9/psyntax-pp.scm.gen): Expand $(preinstguile). 2011-03-25 Neil Jerram <neil@ossau.uklinux.net> Make explicit that GUILE_FOR_BUILD is only used when cross-compiling * configure.ac (GUILE_FOR_BUILD): Change normal build value to 'this-value-will-never-be-used'. GUILE_FOR_BUILD is only needed by meta/guile.in, not by Makefiles * configure.ac: Use AM_SUBST_NOTMAKE for GUILE_FOR_BUILD instead of AC_SUBST. Remove unused definition of preinstguiletool * am/pre-inst-guile (preinstguiletool): Removed. 2011-03-25 Andy Wingo <wingo@pobox.com> avoid running GC when SCM_I_CURRENT_THREAD is unset * libguile/threads.c (guilify_self_1): Prevent finalizers from running before SCM_I_CURRENT_THREAD is set. (do_thread_exit_trampoline): Leave the thread in the registered state. (on_thread_exit): Always unregister the thread here. 2011-03-25 Andy Wingo <wingo@pobox.com> threading / with_guile refactor to use more GC_stack_base * libguile/init.h: * libguile/init.c (scm_i_init_guile): Change arg to this internal function from SCM_STACKITEM* to void*. Actually it's a struct GC_stack_base*. * libguile/bdw-gc.h: Don't do pthread redirects, because we don't want to affect applications' pthread_* bindings. * libguile/pthread-threads.h (scm_i_pthread_create) (scm_i_pthread_detach, scm_i_pthread_exit, scm_i_pthread_cancel) (scm_i_pthread_sigmask): Do pthread redirects here, in this internal header. * libguile/threads.h: Remove declaration of internal scm_i_with_guile_and_parent. Remove declaration of undefined scm_threads_init_first_thread. Make declaration of internal scm_threads_prehistory actually internal, and take a void* (actually a struct GC_stack_base*). * libguile/threads.c (GC_get_stack_base): Implement a shim if this function is unavailable, and fold in the implementations of get_thread_stack_base. (GC_call_with_stack_base): Actually implement. (guilify_self_1): Take a GC_stack_base* as an arg. (scm_i_init_thread_for_guile): Likewise, and set up libgc for registration of other threads. (scm_init_guile): Use GC_get_stack_base instead of our own guesswork. (with_guile_and_parent, scm_i_with_guile_and_parent): Rework to trampoline through a GC_call_with_stack_base. (scm_threads_prehistory): Pass the "base" arg on to guilify_self_1. 2011-03-25 Andy Wingo <wingo@pobox.com> Revert "with-continuation-barrier carps, calls exit(3) _after_ unwinding" This reverts commit ecba00af6501e082b86c8f2f7730081c733509d7. 2011-03-24 Andy Wingo <wingo@pobox.com> bdw-gc 6.8 compatibility (hopefully) * configure.ac (HAVE_GC_STACK_BASE): New check. * libguile/threads.c (GC_UNIMPLEMENTED, GC_SUCCESS): Define if needed. (GC_register_my_thread, GC_unregister_my_thread) (GC_call_with_stack_base): Define shims if needed. 2011-03-24 Andy Wingo <wingo@pobox.com> with-continuation-barrier carps, calls exit(3) _after_ unwinding * libguile/continuations.c (scm_handler, c_handler) (scm_c_with_continuation_barrier, scm_with_continuation_barrier): Call scm_handle_by_message_noexit in the post-unwind handler, so that dynwinds * test-suite/tests/continuations.test ("continuations"): Add a test. 2011-03-23 Andy Wingo <wingo@pobox.com> fix a failure to sync regs in vm bytevector ops * libguile/vm-i-scheme.c (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET) (BV_INT_SET, BV_FLOAT_SET): Sync registers before dispatching to the C function. 2011-03-22 Mark H Weaver <mhw@netris.org> Do not enter the debugger if the thrown key is in `pass-keys' * module/system/repl/error-handling.scm (call-with-error-handling): Do _not_ enter the debugger if the thrown key is in `pass-keys'. Previously, for example, (throw 'quit) entered the debugger when run from the REPL, despite the fact that 'quit is in `pass-keys'. 2011-03-20 Ludovic Courtès <ludo@gnu.org> Make VM string literals immutable. * libguile/strings.c (scm_i_make_string, scm_i_make_wide_string): Add `read_only_p' parameter. All callers updated. * libguile/vm-i-loader.c (load_string, load_wide_string): Push read-only strings. * test-suite/tests/strings.test ("literals"): New test prefix. 2011-03-20 BT Templeton <bpt@hcoop.net> fix guile-snarf * libguile/snarf.h: New macro `SCM_SNARF_INIT_PREFIX'. (SCM_SNARF_INIT) Use `SCM_SNARF_INIT_PREFIX' instead of including a literal marker. If the preprocessor echoes #define directives to its output, this will prevent `guile-snarf' from snarfing the `SCM_SNARF_INIT' definition itself. Reported by Mike Gran <spk121@yahoo.com>. * libguile/guile-snarf.in (modern_snarf): Don't output anything for lines in which only one of the magic snarfing markers is present. Modify the `sed' program for compatibility with POSIX `sed'. The new `sed' program is based on a version by Wolfgang Jenkner <wjenkner@inode.at>. * test-suite/standalone/test-guile-snarf: New tests. 2011-03-20 Andreas Rottmann <a.rottmann@gmx.at> Add VM test for call/cc in non-tail position * test-suite/vm/t-call-cc.scm: Add test case using call/cc in a non-tail position. Fix syntax error in benchmark-suite/Makefile.am * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Correct position of a trailing backslash. 2011-03-19 Michael Gran <spk121@yahoo.com> Benchmarks for string comparisons * benchmark-suite/benchmarks/strings.bm: new file * benchmark-suite/Makefile.am: add strings.bm 2011-03-19 Andy Wingo <wingo@pobox.com> fix new-frame push in call/cc * libguile/vm-i-system.c (call/cc): Whoops, fix the new-frame push here. A little birdie tells me a test case is coming soon. 2011-03-18 Andy Wingo <wingo@pobox.com> fix thread cleanup * libguile/threads.h: Always declare a scm_i_thread_key, for cleanup purposes, in the BUILDING_LIBGUILE case. * libguile/threads.c (scm_i_thread_key): Init with a cleanup handler, so any guile-specific info for a thread can be cleaned up reliably. (guilify_self_1): Always set the thread key. (do_thread_exit_trampoline, on_thread_exit): Enter guile-mode for the guile-mode cleanup handler, and trampoline through a gc_call_with_stack_base for reasons explained in the code. (init_thread_key, scm_i_init_thread_for_guile): Always init the key. (scm_i_with_guile_and_parent): No need for pthread_cancel cleanup handlers, as the pthread key destructor will take care of that for us. (really_launch): Remove needless pthread_exit call with incorrect comment. 2011-03-18 Ludovic Courtès <ludo@gnu.org> Fix `i18n.test' when the German or Greek locales aren't available. * test-suite/tests/i18n.test (%german-utf8-locale, %greek-utf8-locale): New variables. (under-german-utf8-locale-or-unresolved, under-greek-utf8-locale-or-unresolved): Use them. 2011-03-17 Ludovic Courtès <ludo@gnu.org> i18n: Add case mapping and case-insensitive string comparison tests. Thanks to Mark H Weaver <mhw@netris.org> for coming up with most of the examples. * test-suite/tests/i18n.test (%german-utf8-locale-name, %greek-utf8-locale-name): New variables. (under-german-utf8-locale-or-unresolved, under-greek-utf8-locale-or-unresolved): New procedures. ("text collation (German)", "text collation (Greek)"): New tests prefixes. ("string mapping")["string-locale-upcase German", "string-locale-upcase Greek", "string-locale-upcase Greek (two sigmas)", "string-locale-downcase Greek", "string-locale-downcase Greek (two sigmas)"]: New tests. 2011-03-17 Ludovic Courtès <ludo@gnu.org> i18n: Re-enable tests with the Turkish locale. * test-suite/tests/i18n.test ("character mapping")["char-locale-upcase Turkish", "char-locale-downcase Turkish"]: Re-enable. Passes with GNU libc 2.12.1. ("string mapping")["string-locale-upcase Turkish", "string-locale-downcase Turkish"]: Likewise. 2011-03-17 Andy Wingo <wingo@pobox.com> add multibyte regexp test * test-suite/standalone/Makefile.am: * test-suite/standalone/test-mb-regexp: New test, that the previous patch fixed the abort() on fixup_multibyte_match. 2011-03-17 Andy Wingo <wingo@pobox.com> scm_{to,from}_locale_string use current locale, not current ports * libguile/strings.c (scm_to_locale_stringn, scm_from_locale_stringn): Use the encoding of the current locale, not of the current i/o ports. Also use the current conversion strategy. * doc/ref/api-data.texi (Conversion to/from C): Update docs. 2011-03-17 Andy Wingo <wingo@pobox.com> allow ,option on-error report instead of debug * module/system/repl/command.scm: * module/system/repl/debug.scm (terminal-width): Move terminal-width here, make it thread-local, and export it. (print-locals, print-frame, print-frames): Default width to terminal-width. * module/system/repl/error-handling.scm (call-with-error-handling): Add `report' and `backtrace' on-error handlers. * module/system/repl/common.scm (repl-default-options): Add on-error REPL option, defaulting to `debug', but which may be changed. * module/system/repl/repl.scm (run-repl): Pass the #:on-error REPL option to call-with-error-handling. 2011-03-17 Andy Wingo <wingo@pobox.com> add heap-allocated-since-gc to gc-stats * libguile/gc.c (scm_gc_stats): Use add bytes_since_gc to the alist, under "heap-allocated-since-gc", and remove dead code. 2011-03-17 Andy Wingo <wingo@pobox.com> fix code that causes warnings on gcc 4.6 * libguile/arrays.c (scm_i_read_array): * libguile/backtrace.c (display_backtrace_body): * libguile/filesys.c (scm_readdir) * libguile/i18n.c (chr_to_case): * libguile/ports.c (register_finalizer_for_port): * libguile/posix.c (scm_nice): * libguile/stacks.c (scm_make_stack): Clean up a number of set-but-unused vars. Thanks to Douglas Mencken for the report. * libguile/numbers.c (scm_log, scm_exp): Fix a few #if cases that should be #ifdef. 2011-03-17 Andy Wingo <wingo@pobox.com> add pointer->scm, scm->pointer * libguile/foreign.c (scm_pointer_to_scm, scm_scm_to_pointer): New functions, useful to pass and receive SCM values to and from foreign functions. * module/system/foreign.scm: Export the new functions. * doc/ref/api-foreign.texi (Foreign Variables): Add docs. * test-suite/tests/foreign.test ("pointer<->scm"): Tests. 2011-03-15 Andy Wingo <wingo@pobox.com> add more prompt/abort tests * test-suite/tests/control.test: Use c&e tests for most test blocks. Note that this did not catch the recent bug. ("reified continuations"): Add a new test for capturing partial continuations containing pending call frames. Before these would contain dynamic links pointing out of the continuation segment, which would not be relocated; now, the dynamic links are only made when the frames are activated. Thanks to Wolfgang J Moeller for the bug report and test case. 2011-03-15 Andy Wingo <wingo@pobox.com> fix frame dynamic linkage in the face of partial continuation application * libguile/vm-i-system.c (new-frame): Though it was appealing to set the dynamic link here on the incomplete frame, we no longer do that, for the reasons mentioned in the code. (call, mv-call): Adapt to set the frame's dynamic link. * libguile/vm-engine.c (vm_engine): Don't set dynamic link here, even for boot program. * libguile/frames.c (scm_frame_num_locals, scm_frame_local_ref) (scm_frame_local_set_x): Fix up not-yet-active frame detection. 2011-03-13 Ludovic Courtès <ludo@gnu.org> doc: Remove "lack of support for Unicode I/O and strings". * doc/ref/api-io.texi (R6RS I/O Ports): Remove 1.8ish comment. 2011-03-13 Andreas Rottmann <a.rottmann@gmx.at> Enhance transcoder-related functionality of `(rnrs io ports)' * module/rnrs/io/ports.scm (transcoder-eol-style) (transcoder-error-handling-mode): Export these. (textual-port?): Implement this procedure and export it. * module/rnrs.scm: Export these here as well. * module/rnrs/io/ports.scm (port-transcoder): Implement this procedure. (binary-port?): Treat only ports without an encoding as binary ports, add docstring. (standard-input-port, standard-output-port, standard-error-port): Ensure these are created without an encoding. (eol-style): Add `none' as enumeration member. (native-eol-style): Switch to `none' from `lf'. * test-suite/tests/r6rs-ports.test (7.2.7 Input ports) (8.2.10 Output ports): Test binary-ness of `standard-input-port', `standard-output-port' and `standard-error-port'. (8.2.6 Input and output ports): Add test for `port-transcoder'. 2011-03-13 Andreas Rottmann <a.rottmann@gmx.at> Export `current-*-port' from `(rnrs io ports)' * module/rnrs/io/ports.scm: Export `current-input-port', `current-output-port' and `current-error-port' (see R6RS 8.2.7 "Input ports" and 8.2.10 "Output ports"). 2011-03-13 Andreas Rottmann <a.rottmann@gmx.at> Add `get-string-n' and `get-string-n!' for R6RS ports * libguile/r6rs-ports.c (scm_get_string_n_x): Implement `get-string-n!' in C for efficiency. * libguile/r6rs-ports.h: Add prototype for this function. * module/ice-9/binary-ports.scm: Export `get-string-n!'. * module/rnrs/io/ports.scm (get-string-n): Implement based on `get-string-n!'. Export both `get-string-n!' and `get-string-n'. * module/rnrs.scm: Also export these. * test-suite/tests/r6rs-ports.test (8.2.9 Textual input): Add a few tests for `get-string-n' and `get-string-n!'. 2011-03-13 Ludovic Courtès <ludo@gnu.org> Work around weak-value hash table bug in `define-wrapped-pointer-type'. * module/system/foreign.scm (define-wrapped-pointer-type)[wrap]: Use `hash-ref' and `hash-set!' instead of `hash-create-handle!' and `set-cdr!'. 2011-03-11 Ludovic Courtès <ludo@gnu.org> Fix `define-inlinable' in SRFI-9 so that arguments are evaluated only once. * module/srfi/srfi-9.scm (define-inlinable): When inlining, evaluate the arguments only once. Reported by Andreas Rottmann; thanks to Andy Wingo for the elegant solution. * test-suite/tests/srfi-9.test ("side-effecting arguments"): New test prefix. 2011-03-11 Andy Wingo <wingo@pobox.com> fix port-filename without readline to match the docs * libguile/init.c (stream_body, scm_standard_stream_to_port): Don't name stdin, stdout, and stderr -- at least not as strings. That confuses any code which tries to treat port-filename as a real filename, like the syntax expander, or the `load' procedure/macro. Also this behavior matches the docs now. 2011-03-10 Mark H Weaver <mhw@netris.org> Fix bug to make `string=' much faster * libguile/srfi-13.c (scm_string_eq): Fix a bug which caused the slow general string_compare function to be used for strings of unequal lengths. 2011-03-10 Ludovic Courtès <ludo@gnu.org> Thanks, Aidan. 2011-03-10 Ludovic Courtès <ludo@gnu.org> FFI: Return the right alignment for structures. * libguile/foreign.c (scm_alignof): Fix handling of structure alignment. Reported by Aidan Gauland <aidalgol@no8wireless.co.nz>. * test-suite/tests/foreign.test ("structs")["alignof { int8, double, int8 }", "int8, { int8, double, int8 }, int16"]: New tests. 2011-03-09 Mark H Weaver <mhw@netris.org> Update Gnulib; add new modules; remove `round' module. This updates Gnulib to v0.0-4951-g6ff7b70. * m4/gnulib-cache.m4: Add floor, ceil, frexp, and ldexp. Add wchar as an explicit dependency; it had been present as an indirect dependency before, but no longer. Remove round, which I had requested earlier, but turned out to be unnecessary. 2011-03-09 Andy Wingo <wingo@pobox.com> fix-letrec tweaks * module/language/tree-il/fix-letrec.scm (partition-vars): Previously, for letrec* we treated all unreferenced vars as complex, because of orderings of effects that could arise in their definitions. But we can actually keep simple and lambda vars as unreferenced, as their initializers cannot cause side effects. (fix-letrec!): Remove letrec* -> letrec code, as it's unneeded. 2011-03-09 Andreas Rottmann <a.rottmann@gmx.at> Don't mix definitions and expressions in SRFI-9 The expansion of `define-inlinable' contained an expression, which made SRFI-9's `define-record-type' fail in non-toplevel contexts ("definition used in expression context"). * module/srfi/srfi-9.scm (define-inlinable): Get rid of apparently useless expression in the expansion, so the expansion yields only definitions. At the same time, use a space in the generated names to lessen the chances of name conflicts, also avoiding -Wunused-toplevel warnings. * test-suite/tests/srfi-9.test (non-toplevel): New test verifying that `define-record-type' works in non-toplevel context as well. * doc/ref/srfi-modules.texi (SRFI-9 - define-record-type): Add subsubsection noting that Guile does not enforce top-levelness. 2011-03-09 Mark H Weaver <mhw@netris.org> Add scm_from_latin1_keyword and scm_from_utf8_keyword * libguile/keywords.c (scm_from_latin1_keyword, scm_from_utf8_keyword): New functions appropriate for use when keyword name is a constant. (scm_from_locale_keyword, scm_from_locale_keywordn): Change formal parameter from `str' to `name'. * libguile/keywords.h: Add prototypes for new functions. Change formal parameter of scm_from_locale_keyword* from `str' to `name'. * doc/ref/api-data.texi: Document new functions. Remind users that scm_from_locale_keyword should not be used when the name is a C string constant. Change formal parameter from `str' to `name'. 2011-03-09 Mark H Weaver <mhw@netris.org> Improve docs of string and symbol conversions from C strings * doc/ref/api-data.texi (Conversion to/from C): Document scm_from_latin1_string, scm_from_utf8_string, and scm_from_utf32_string. Remind readers that these functions should be used to convert C string constants, and that scm_from_locale_string is _not_ appropriate for that purpose. (Symbol Primitives): Document scm_from_latin1_symbol and scm_from_utf8_symbol. Remind readers that these functions should be used when the specified names are C string constants, and that scm_from_locale_symbol is _not_ appropriate for that purpose. 2011-03-09 Mark H Weaver <mhw@netris.org> Within `while', `continue' takes zero arguments * module/ice-9/boot-9.scm (while): Report an error if `continue' is passed one or more arguments. Previously, it would report an error if `(continue arg rest ...)' was found within the `while', but not if `continue' was found bare and later applied to one or more arguments, e.g. `(apply continue (list arg rest ...))'. 2011-03-09 Mark H Weaver <mhw@netris.org> Quotient, remainder and modulo accept inexact integers * libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo): Accept inexact integers as well as exact ones, as required by the R5RS. * test-suite/tests/numbers.test (quotient, remainder, modulo): Add tests. 2011-03-08 Mark H Weaver <mhw@netris.org> Remove incorrect footnote from GOOPS manual * doc/ref/goops.texi (Inheritance): Remove footnote which incorrectly stated that <complex> was not shown in the class hierarchy figure. Update comments regarding GMP earlier than 4.2. * libguile/numbers.c: Update comments regarding GMP earlier than 4.2. Remove speculations about versions of GMP that had not yet been released when the comments were written. Replace them with facts that are now known about the changes made in GMP 4.2. Fix description of the R6RS `finite?' in manual * doc/ref/r6rs.texi (rnrs base): `(finite? x)' returns true iff x is neither infinite nor a NaN. Previously, it stated that `finite?' was the negation of `infinite?', which was incorrect because NaNs are neither finite nor infinite. Combine description of 'nan?' with those of `finite?' and `infinite?'. 2011-03-08 Mark H Weaver <mhw@netris.org> Fix bytevectors VALIDATE_REAL to test for reals, not rationals Reported and fixed by Daniel Llorens <dll@bluewin.ch>. * libguile/bytevectors.c (VALIDATE_REAL): Test for reals, not rationals. * test-suite/tests/srfi-4.test (f32 vectors, f64 vectors): Add tests. 2011-03-08 Andy Wingo <wingo@pobox.com> scm_public_ref et al docs * doc/ref/api-modules.texi (Accessing Modules from C): Add docs for the new C procedures. eval-string docs * doc/ref/api-evaluation.texi (Fly Evaluation): Update eval-string documentation. document scm_call_{5,6,n} * doc/ref/api-evaluation.texi (Fly Evaluation): Document scm_call_{5,6,n}. add scm_call_{5,6} * libguile/eval.h: * libguile/eval.c (scm_call_5, scm_call_6): New scm_call functions; why not. 2011-03-08 Andy Wingo <wingo@pobox.com> fix scm_setter * libguile/procs.c (scm_setter): Only get at the setter slot if the pure generic actually has a setter. Needs test. * test-suite/tests/goops.test ("defining generics"): ("defining accessors"): Add `setter' tests. 2011-03-08 Andy Wingo <wingo@pobox.com> core eval-string uses (ice-9 eval-string) * libguile/strports.c (scm_eval_string_in_module): Use eval-string from (ice-9 eval-string). add scm_c_public_ref et al * libguile/modules.h: * libguile/modules.c (scm_public_lookup, scm_private_lookup) (scm_c_public_lookup, scm_c_private_lookup, scm_public_ref) (scm_private_ref, scm_c_public_ref, scm_c_private_ref) (scm_public_variable, scm_private_variable, scm_c_public_variable) (scm_c_private_variable): New helpers to get at variables and values in modules. 2011-03-06 Ludovic Courtès <ludo@gnu.org> Handle `letrec*' like `letrec' in simple cases. * module/language/tree-il/fix-letrec.scm (fix-letrec!): When X is a `letrec*' with only lambdas and simple expressions, analyze it as if it were a `letrec'. * test-suite/tests/tree-il.test ("letrec"): Add test for `(letrec* (x y) (xx yy) ((const 1) (const 2)) (lexical y yy))'. Have `gc-profile.scm' make sure it's on a Linux-based system. * gc-benchmarks/gc-profile.scm (memory-mappings): Check %HOST-TYPE for "-linux-". 2011-03-06 Ludovic Courtès <ludo@gnu.org> Add `gc-benchmarks/' to the distribution. * gc-benchmarks/Makefile.am: New file. * configure.ac: Produce it. * Makefile.am (SUBDIRS): Add `gc-benchmarks'. 2011-03-06 Ludovic Courtès <ludo@gnu.org> Make `object->string' explicitly close its string output port. * libguile/strports.c (scm_object_to_string): Close PORT before returning the resulting string. Slightly optimize `gensym'. * libguile/symbols.c (default_gensym_prefix): New variable. (scm_gensym): Use it. Use `scm_from_latin1_stringn' instead of `scm_from_locale_stringn'. (scm_init_symbols): Initialize DEFAULT_GENSYM_PREFIX. Simply grow string port buffers geometrically. * libguile/strports.c (SCM_WRITE_BLOCK): Remove. (st_flush): Multiply `pt->write_buf_size' by 2. (st_seek): Likewise when TARGET == PT->write_buf_size. 2011-03-06 Ludovic Courtès <ludo@gnu.org> Let `scm_mkstrport' allocate buffers on the caller's behalf. * libguile/strports.c (INITIAL_BUFFER_SIZE): New macro. (scm_mkstrport): If STR is false, allocate a bytevector on the caller's behalf. (scm_object_to_string, scm_call_with_output_string, scm_open_output_string): Pass SCM_BOOL_F as the STR argument of `scm_mkstrport'. * libguile/backtrace.c (scm_display_application, display_backtrace_body): Likewise. * libguile/gdbint.c (scm_init_gdbint): Likewise. * libguile/print.c (scm_simple_format): Likewise. 2011-03-06 Ludovic Courtès <ludo@gnu.org> Use a bytevector as the backing buffer of string ports. * libguile/strports.c (st_resize_port): Adjust to deal with OLD_STREAM and NEW_STREAM as bytevectors. (scm_mkstrport): Store a bytevector in the port's stream rather than a string. 2011-03-05 Andy Wingo <wingo@pobox.com> add ice-9 eval-string * module/Makefile.am: * module/ice-9/eval-string.scm: New module, for use in implementing the scm_c_eval_string_from_file_line suggestion. * test-suite/Makefile.am: * test-suite/tests/eval-string.test: New tests. 2011-03-05 Andy Wingo <wingo@pobox.com> remove obsolete comments * libguile/eval.c (scm_nconc2last): * libguile/strports.c (scm_c_read_string): Remove some obsolete comments. 2011-03-05 Mark Harig <idirectscm@aim.com> Updated Guile manual page. * doc/guile.1: Added the current month and year, Guile version descriptive text, and the text GNU to the title. Updated the nroff formatting commands for the SYNOPSIS and OPTIONS sections to what 'man' prescribes. See 'man(1)', 'man(7)', and 'man-pages(7)'. Corrected grammar, spelling, and capitalization (for example, 'scheme' to 'Scheme'). Vertical white-space was non-standard (two lines between some sections, one space between others). Changed this to the standard one empty line before each section heading, and added dots (a single period on a line) before every section heading (.SH) so that maintainers will find the readability unchanged. Added white space to follow the 'groff' recommendation of starting every sentence on its own line, and breaking sentences at punctuation. Corrected an error in description of the info command. Added the missing option '--no-debug', and the short switches '-h' and '-v'. Changed the description of the environment variable GUILE_LOAD_COMPILED_PATH so that it references the Guile variable `%load-compiled-path' instead of the variable `%load-path'. Updated the copyright to include 2011. 2011-03-04 BT Templeton <bpt@hcoop.net> guile-snarf: allow multiple init actions on one line * libguile/guile-snarf.in (modern_snarf): Allow programs to specify multiple initialization actions on a single line. This makes it possible for C programs to define multiple subrs with a single macro invocation. * test-suite/standalone/test-guile-snarf: Enable more tests. 2011-03-04 BT Templeton <bpt@hcoop.net> add guile-snarf tests * test-suite/standalone/test-guile-snarf: New file. * test-suite/standalone/Makefile.am: Add `test-guile-snarf'. 2011-03-04 Andy Wingo <wingo@pobox.com> repl: terminal-width by default * module/system/repl/command.scm (terminal-width): New parameter that will use the true terminal width if unset. (backtrace, locals): Default to (terminal-width). (width): Simplify. 2011-03-04 Michael Gran <spk121@yahoo.com> Add ,width meta-command to set screen width in debug output This meta-command allows one to set the default number of columns that output from ,backtrace and ,locals shall occupy. * doc/ref/scheme-using.texi (Debug Commands): document ,width * module/system/repl/command.scm (*width*): new var (backtrace, locals): use *width* in optarg (width): new meta-command 2011-03-04 Andy Wingo <wingo@pobox.com> fix ,stat * module/system/repl/command.scm (statistics): Fix for BDW-GC. Unfortunately we still don't have mallocation or time taken. 2011-03-03 Andy Wingo <wingo@pobox.com> repl.scm understands comments * module/system/repl/repl.scm (read-comment, read-scheme-line-comment) (read-scheme-datum-comment): New helpers. (meta-reader): Take a language instead of a reader. If we have a nonwhitespace char, first check to see that it's a comment, and if so, read it off and loop. (prompting-meta-read): Call meta-reader with the lang. repl.scm refactor * module/system/repl/repl.scm (flush-leading-whitespace): Rename from next-char. (meta-reader): Use flush-leading-whitespace. (run-repl): Use flush-to-newline after the evaluation, which seems to be the same as what we did before. fix encoding scanning for non-seekable ports * libguile/read.c (scm_i_scan_for_encoding): If possible, just use the read buffer for the encoding scan, and avoid seeking. Fixes `(open-input-file "/dev/urandom")', because /dev/urandom can't be seeked backwards. 2011-03-03 Andy Wingo <wingo@pobox.com> more module-use-interfaces! tweaks * module/ice-9/boot-9.scm (module-use-interfaces!): Fix up to prevent duplication in the use list of multiple incoming interfaces. * test-suite/tests/modules.test ("module-use"): Add tests. 2011-03-03 Andreas Rottmann <a.rottmann@gmx.at> Use module identity to filter for existing modules This fixes a problem with R6RS's `import' in particuliar: when importing a subset of a library/module, the interface created for that purpose inherits the name of the module it is derived from. The low-level primitives that are used for importing would then disregard earlier imports from the same module. An example for this bug can be seen with the following library definition: (library (test-guile2) (export foo) (import (only (rnrs base) define) (only (rnrs base) error)) (define (foo . args) #t)) In the above, the import of `define' would be disregarded when `error' is imported, thus leading to a syntax error, since `(foo . args)' is treated as an application, since the binding of `define' would be not present. * module/ice-9/boot-9.scm (module-use!): Remove the filtering of the existing imports of the module by name; a check for identity is already done beforehand. (module-use-interfaces!): Filter the existing imports by identity instead of filtering them by their names. 2011-03-03 Ludovic Courtès <ludo@gnu.org> Remove extra comma after `SCM_ARRAY_ELEMENT_TYPE_LAST'. * libguile/array-handle.h (scm_t_array_element_type): Remove extra comma after last element. Reported by David Fang <fang@csl.cornell.edu>. Indent. 2011-03-02 Ludovic Courtès <ludo@gnu.org> Improve the documentation for `dynamic-link'. * doc/ref/api-foreign.texi (Foreign Libraries): Make it clear that the LIBRARY argument of `dynamic-link' should not contain an extension. (Foreign Functions): Add cross-reference from `load-extension' to `dynamic-link'. Typeset file names and module names correctly. 2011-03-02 Mark H Weaver <mhw@netris.org> Portability fixes for popen.test (for when /bin/sh is not bash) * test-suite/tests/popen.test (open-input-pipe no-duplicate): Pass "read REPLY" command instead of "read" to the subshell, for improved portability. In particular, it is needed when /bin/sh is dash. (open-output-pipe no-duplicate): Pass "exec guile [...]" instead of "guile [...]" to the subshell, to ensure that the subshell will not run guile as a subprocess while holding a duplicate of STDIN, which would cause this test to fail. This is needed when /bin/sh is dash. 2011-02-28 Ludovic Courtès <ludo@gnu.org> Have `read' update line/column numbers when reading SCSH block comments. * libguile/read.c (scm_read_scsh_block_comment): Use `scm_getc' instead of `scm_get_byte_or_eof'. * test-suite/tests/reader.test ("read-options")["position of SCSH block comment"]: New test. 2011-02-28 Andy Wingo <wingo@pobox.com> update port-filename docs * doc/ref/api-io.texi (File Ports): * libguile/ports.c (scm_port_filename): Fix docs to match implementation. 2011-02-28 Ludovic Courtès <ludo@gnu.org> Link stand-alone tests against libgc. Reported by Andreas Rottmann <a.rottmann@gmx.at>. * test-suite/standalone/Makefile.am (LIBGUILE_LDADD): New variable. (test_num2integral_LDADD, test_round_LDADD, libtest_asmobs_la_LIBADD, libtest_ffi_la_LIBADD, test_list_LDADD, test_unwind_LDADD, test_conversion_LDADD, test_loose_ends_LDADD, test_scm_c_read_LDADD, test_scm_take_locale_symbol_LDADD, test_scm_take_u8vector_LDADD, libtest_extensions_la_LIBADD, test_with_guile_module_LDADD, test_scm_with_guile_LDADD): Use it. 2011-02-28 Ludovic Courtès <ludo@gnu.org> Strip any CPPFLAGS other than `-I' from `guile-2.0.pc'. * configure.ac: Strip anything beyond `-I' from $GUILE_CFLAGS so that `guile-2.0.pc' does not export them to the user. Reported and fixed by Bruno Haible <bruno@clisp.org>. 2011-02-27 Andy Wingo <wingo@pobox.com> flush all input on a read error * module/system/repl/repl.scm (flush-all-input): New helper. (prompting-meta-read): Flush all input on a read error, as we could be within some expression or a string or something. 2011-02-27 Andy Wingo <wingo@pobox.com> scm-error-printer resilience * module/ice-9/boot-9.scm (scm-error-printer): Allow #f for rest args, interpreting it as '(). Fixes regexp throws, which are of the form: (regular-expression-syntax "make-regexp" "Invalid preceding regular expression" #f ("?.*")) 2011-02-27 Andy Wingo <wingo@pobox.com> update R6RS incompatibilities * doc/ref/r6rs.texi (R6RS Incompatibilities): Update. regenerate psyntax-pp * module/ice-9/psyntax-pp.scm: Regenerate. add syncase test * test-suite/tests/syncase.test ("top-level expansions"): New test. chi-top-sequence defines macros before expanding other exps * module/ice-9/psyntax.scm (chi-top-sequence): Manually inline eval-if-c&e into its two call sites; I found it hard to understand otherwise. If the mode is just 'e, defer expansion of definitions and expressions until the end, so that they can be expanded in a context of all syntax expanders defined in the sequence. psyntax: fold chi-top-sequence into chi-top * module/ice-9/psyntax.scm (chi-top-sequence): Pull chi-top into the body of this toplevel begin expander. This will let us do r6rs toplevel expansion correctly. (chi-top): Remove. (macroexpand): Dispatch to chi-top-sequence directly. 2011-02-25 Ludovic Courtès <ludo@gnu.org> Fix `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (memory-mappings)[mapping-line-rx]: Fix and give an example. (total-heap-size): Fix docstring. 2011-02-25 Andy Wingo <wingo@pobox.com> make-weak-key-hash-table vacuuming * libguile/hashtab.c (scm_make_weak_key_hash_table): Whoops, fix the case I actually cared about. 2011-02-24 Ludovic Courtès <ludo@gnu.org> Revert ""latin1" -> "Latin-1"." This reverts commit c2c550ca9d2442d070f79ed8bacb8db173c72df3. The name "latin1" is standardized by IANA, unlike the other one. Reported by Bruno Haible. 2011-02-24 Ludovic Courtès <ludo@gnu.org> Make `locale-digit-grouping' more robust. * libguile/i18n.c (scm_nl_langinfo)[GROUPING]: Consider negative numbers like `CHAR_MAX'. Reported by David Fang <fang@csl.cornell.edu>. Fix suggested by Bruno Haible <bruno@clisp.org>. Fix README. * README: Remove mention of an alpha release. Reported by Mark H. Weaver. 2011-02-24 Andy Wingo <wingo@pobox.com> weak hash tables vacuum stale entries after a gc * libguile/hashtab.c (scm_c_register_weak_gc_callback): New private helper, arranges for a C function to be called with a SCM as an argument, as long as the argument is reachable by GC. (scm_make_weak_key_hash_table) (scm_make_weak_value_hash_table) (scm_make_doubly_weak_hash_table): Register a weak GC callback to vacuum_weak_hash_table. re-enable the after-gc-hook * libguile/gc.c (scm_gc): No need to take a mutex here. Don't run the hook, the hook will run itself. (scm_c_register_gc_callback): New private helper, registers a callback the next time GC happens. (system_gc_callback): Guile's internal callback that runs scm_after_gc_c_hook, which itself queues a call to the after-gc-hook. (scm_storage_prehistory): Queue up a call to system_gc_callback. pointerless backing buffers for string ports * libguile/strports.c (scm_mkstrport): String port string buffer allocated atomically. errno saving in display_string * libguile/print.c (display_string): Fix a case in which perhaps `errno' could have been stompled. 2011-02-24 Andy Wingo <wingo@pobox.com> web server more assiduous about closing ports * module/web/uri.scm: * module/web/server.scm (call-with-output-string*): (call-with-output-bytevector*): Local procs to output to strings or bytevectors, *and then close the port*. We can't make this change in call-with-output-string because it would be incompatible. * module/web/uri.scm (call-with-encoded-output-string, decode-string) (uri-decode) * module/web/server.scm (call-with-encoded-output-string): Use the new helpers. 2011-02-23 Andy Wingo <wingo@pobox.com> open-pipe* pumps pipes guardian * module/ice-9/popen.scm (open-pipe*): Hack around the lack of an after-gc hook, and pump the pipes guardian here in the procedure that adds to the guardian. 2011-02-23 Andy Wingo <wingo@pobox.com> GC dead links in weak hash tables before a possible rehash * libguile/hashtab.c (vacuum_weak_hash_table): New helper, goes through the entirety of a weak hash table, vacuuming dead entries. (scm_hash_fn_create_handle_x): If when adding to a weak hash table, we would trigger a rehash, vacuum the table first. The weak_bucket_assoc would have only caught dead entries within one bucket. Without this patch, the following code leaks: (let lp () (call-with-output-string (lambda (port) (display "foo" port))) (lp)) 2011-02-23 Mark H Weaver <mhw@netris.org> Portability fix for new log and log10 * libguile/numbers.c: Define M_LN2 if it's not already defined. Fix error in comment. 2011-02-22 Ludovic Courtès <ludo@gnu.org> Fix a bug in `vhash-delete'. * module/ice-9/vlist.scm (vhash-delete): Honor HASH. * test-suite/tests/vlist.test ("vhash")["vhash-delete honors HASH"]: New test. Use `vhash-delq' in `(language tree-il analyze)'. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use `vhash-delq' instead of `vhash-delete'. Optimize `vhash-delete'. * module/ice-9/vlist.scm (vhash-delete): Check whether KEY is in VHASH and return VHASH if it's not. Add omitted exports from `(ice-9 vlist)'. * module/ice-9/vlist.scm: Export `vhash-delq' and `vhash-delv'. Compile `(rnrs)' after all other RNRS modules, potentially. * module/Makefile.am (RNRS_SOURCES): Move `rnrs.scm' last. Make `(rnrs base)' independent of other rnrs modules. * module/rnrs/base.scm (define-proxy): New macro. (raise, condition, make-error, make-assertion-violation, make-who-condition, make-message-condition, make-irritants-condition): Use it. 2011-02-20 Andy Wingo <wingo@pobox.com> update examples in manual to use PKG_CHECK_MODULES * doc/ref/autoconf.texi (Using Autoconf Macros): Switch example to use PKG_CHECK_MODULES. * doc/ref/libguile-linking.texi (A Sample Guile Main Program): Likewise, and change from configure.in to configure.ac, and recommend autoreconf. pkg-config instead of guile-config in manuals * doc/ref/api-options.texi (Build Config): * doc/ref/libguile-linking.texi (Linking Programs With Guile): (A Sample Guile Main Program): * doc/ref/libguile-smobs.texi (The Complete Example): Use pkg-config in the examples instead of guile-config. tour.texi compilation fix * doc/ref/tour.texi (Writing Guile Extensions): Fix compilation example. 2011-02-20 Andy Wingo <wingo@pobox.com> @value{EFFECTIVE-VERSION} instead of 2.0 in some places in the manual * doc/ref/history.texi (A Timeline of Selected Guile Releases): Update the 2.0 release blurb. * doc/ref/api-foreign.texi (Modules and Extensions): * doc/ref/libguile-extensions.texi (A Sample Guile Extension): * doc/ref/tour.texi (Linking Guile into Programs): Use @value{EFFECTIVE-VERSION} instead of 2.0. Also fix sample extension compilation line to include the Guile CFLAGS. 2011-02-20 Bruno Haible <bruno@clisp.org> guile.m4: Add support for linking against guile with rpath. * guile.m4 (GUILE_FLAGS): Also set GUILE_LIBS and GUILE_LTLIBS. Fix documentation. 2011-02-19 Neil Jerram <neil@ossau.uklinux.net> Fix typos in (web ...) doc * doc/ref/web.texi (Types and the Web): "help" -> "helpful". (HTTP): Add closing paren. Remove code that looks like a leftover. Last (for a little while) GOOPs doc fix * doc/ref/goops.texi (GOOPS Object Miscellany): Clarify that it would be instances being printed, not classes. 2011-02-18 Neil Jerram <neil@ossau.uklinux.net> Remove unneeded fixme * doc/ref/goops.texi (Class Definition Protocol): Removed `*fixme Need to insert something here about checking that the value is not unbound'. It's a fine detail, and also I imagine there could be a valid application that would choose to allow SCM_GOOPS_UNBOUND values to escape through here. Tidy up remaining bits of the MOP section * doc/ref/goops.texi (Method Definition): Unindent text about define-method invoking add-method!. (Method Definition Internals): Add @noindent's. (Generic Function Invocation): Add intro text, and tidy up the tree. Clean up doc on class redefinition and instance class changing * doc/ref/goops.texi (Class Redefinition): Deleted, with its material all merged into later `Redefining a Class' and `Changing the Class of an Instance' sections. Merge orphan Class Options section into Class Definition * doc/ref/goops.texi (Class Definition): Move material from later `Class Options' section to here. 2011-02-18 Neil Jerram <neil@ossau.uklinux.net> Doc of MOP for instance and class creation * doc/ref/goops.texi (Instance Creation Protocol): Rename from `Customizing Instance Creation', and move before the more complicated class definition stuff. Couple of very minor edits. (Class Definition Protocol): Remove ensure-metaclass-with-supers (too internal) and repeated material. Move class-redefinition stuff to (existing) later section on that. Merge reference-like material from `Customizing Class Definition' to here. 2011-02-18 Neil Jerram <neil@ossau.uklinux.net> Summarize class definition protocol * doc/ref/goops.texi (Class Definition Protocol): Add tree summary diagram. Work on GOOPS MOP documentation * doc/ref/goops.texi (The Metaobject Protocol): Simplify intro text. Minor edits and simplifications throughout this section. (Metaobjects and the Metaobject Protocol): Insert "default". (Metaclasses): Renamed from `Terminology', and deleted the material on CPL and accessors, which just duplicated what has already been covered earlier in the chapter. Remove statements that confuse whether "metaclass of" means "class of class of" or "class of (something that is itself a class)". (I think it's actually the latter.) (Class Definition Protocol): Renamed from `Class Definition Internals'. Rewording for "make an intervention". * doc/ref/compiler.texi (Extending the Compiler): Rephrase first sentence. No sublimated desires * doc/ref/compiler.texi: Delete "subliminated". 2011-02-18 Andy Wingo <wingo@pobox.com> fix a couple leaks in ports.c. thanks valgrind! * libguile/ports.c (scm_i_remove_port): Fix a case in which ports explictly closed via close-port would leak their iconv_t data. (scm_set_port_encoding_x): scm_i_set_port_encoding_x strdups its argument, so we need to free the locale encoding of the incoming str. core modules use (ice-9 binary-ports) instead of (rnrs io ports) * module/language/assembly/compile-bytecode.scm: * module/language/elisp/lexer.scm: * module/web/request.scm: * module/web/response.scm: * module/web/server.scm: * module/web/uri.scm: Use ice-9 binary-ports. 2011-02-18 Andy Wingo <wingo@pobox.com> add (ice-9 binary-ports) * module/ice-9/binary-ports.scm: New module. * module/Makefile.am: Add to makefile. * module/rnrs/io/ports.scm: Re-export bindings from (ice-9 binary ports). This will allow the compiler to not pull (rnrs) into its included module set. 2011-02-18 Andy Wingo <wingo@pobox.com> update extension example in manual * doc/ref/libguile-extensions.texi (A Sample Guile Extension): Fix use of deprecated functions. 2011-02-16 Ludovic Courtès <ludo@gnu.org> Change tag naming convention to `vX.Y.Z'. * configure.ac: Tell `git-version-gen' that we're switching to a `vX.Y.Z' scheme for release tags. 2011-02-16 Mark H Weaver <mhw@netris.org> Improvements to `log' and `log10' * libguile/numbers.c (log_of_shifted_double, log_of_exact_integer, log_of_exact_integer_with_size, log_of_fraction): New internal static functions used by scm_log and scm_log10. (scm_log, scm_log10): Robustly handle large integers, large and small fractions, and fractions close to 1. Previously, computing logarithms of fractions close to 1 yielded grossly inaccurate results, and the other cases yielded infinities even though the answer could easily fit in a double. (log -0.0) now returns -inf.0+<PI>i, where previously it returned -inf.0. (log 0) now throws a numerical overflow exception, where previously it returned -inf.0. (log 0.0) still returns -inf.0. Analogous changes made to `log10'. * test-suite/tests/numbers.test (log, log10): Add tests. 2011-02-16 Mark H Weaver <mhw@netris.org> Fix comment above number-theoretic division tests * test-suite/tests/numbers.test: Fix comment. 2011-02-15 Ludovic Courtès <ludo@gnu.org> Switch to 2.0.0. * GUILE-VERSION (GUILE_MAJOR_VERSION, GUILE_MINOR_VERSION, GUILE_MINOR_VERSION): 2.0.0! Increment `LIBGUILE_INTERFACE_CURRENT'. * GUILE-VERSION (LIBGUILE_INTERFACE_CURRENT): Set to 22, i.e., Guile 1.8.8 + 1. 2011-02-15 Ludovic Courtès <ludo@gnu.org> Update `doc/example-smob'. * doc/example-smob/Makefile (CFLAGS, LIBS): Use `pkg-config' instead of `guile-config'. * doc/example-smob/image-type.c (mark_image, free_image): Remove. (init_image_type): Don't call `scm_set_smob_mark' and `scm_set_smob_free'. 2011-02-15 Mark H Weaver <mhw@netris.org> Use trunc in scm_i_inexact_truncate_divide * libguile/numbers.c (scm_i_inexact_truncate_divide): Use trunc instead of floor and ceil. Important for consistency with scm_truncate_quotient and scm_truncate_remainder. 2011-02-15 Ludovic Courtès <ludo@gnu.org> Document `%auto-compilation-options'. * doc/ref/api-evaluation.texi (Compilation): Emphasize auto-compilation. Document `%auto-compilation-options'. Fix compilation of `c-tokenize.c' in a cross-compile setup. * libguile/Makefile.am (c-tokenize.$(OBJEXT)): When cross-compiling, don't include any CPPFLAGS since we could end up seeing Gnulib's replacements, e.g., `rpl_malloc', which we can't use. Use all the LDFLAGS from Gnulib. * libguile/Makefile.am (version_info): New variable. (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): Remove `$(LTLIBUNISTRING) $(LTLIBICONV) $(LTLIBINTL)'. (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Add all the flags from Gnulib, one per line as in the `gnulib-tool' output, including those above. Remove Gnulib's `sockets' module from the import list. * m4/gnulib-cache.m4: Remove `sockets', which we don't directly depend on. 2011-02-15 Ludovic Courtès <ludo@gnu.org> Import Gnulib's `log1p' and `round' modules. From Gnulib v0.0-4889-ge375fe3. * m4/gnulib-cache.m4: Add `log1p' and `round', requested by Mark H Weaver <mhw@netris.org>. Use `malloc-gnu' instead of `malloc', the latter being obsolete. 2011-02-15 Andy Wingo <wingo@pobox.com> remove 1.9 changes from NEWS (leaving only 2.0) * NEWS: Compress year range (as allowed by standards and note in README). Remove 1.9.15->2.0 changes, leaving only 2.0 changes. 2011-02-15 Mark H Weaver <mhw@netris.org> Use trunc instead of scm_c_truncate * libguile/numbers.c (scm_c_truncate, scm_truncate_number, scm_i_inexact_truncate_quotient, scm_i_inexact_truncate_remainder): Use trunc directly, now that we have its gnulib module. Fix minor errors in docs of division operators * doc/ref/api-data.texi (Arithmetic): The R5RS `quotient', `remainder', and `modulo' operators are exact-integer-only operators. `modulo' is equivalent to `floor-remainder', not `floor-quotient'. 2011-02-14 Andy Wingo <wingo@pobox.com> news tweak * NEWS: Tweak add more NEWS * NEWS: Add new NEWS and fold into main text. fold new NEWS items into main text * NEWS: Fold all items into main text, while keeping a list of things that are new in 1.9.15. update THANKS * THANKS: Update, adding all people who have their name on a patch in Git. Add a section on authors of other free software libraries. tweak to internal scm_i_extract_values_2 * libguile/values.c (scm_i_extract_values_2): Make nvalues check more robust. 2011-02-14 Mark H Weaver <mhw@netris.org> Allow GOOPS getters to add methods to primitive generics * module/oop/goops.scm (ensure-generic): If the old definition of a desired getter is a primitive generic, let the new method be added to it instead of creating a fresh new generic. (ensure-accessor): Modify as necessary to keep the old behavior. Maybe something more optimal can be done here, but it's not yet obvious to me how to do it. 2011-02-14 Mark H Weaver <mhw@netris.org> Make SCM_NUMP and SCM_NUMBERP more extensible * libguile/numbers.h (SCM_NUMP, SCM_NUMBERP): Mask out more bits in the cell type field when doing the comparison, in order to accept future numeric types that have not yet been implemented. This should allow us to add more core numeric types without breaking ABI compatibility. As a bonus, these macros are now more efficient. Slight optimization for scm_equal_p * libguile/eq.c (scm_equal_p): Move SCM_STRUCTP check within the default case of the SCM_TYP7 switch statement, for optimization. 2011-02-14 Mark H Weaver <mhw@netris.org> Reduce code size of division operators * libguile/numbers.c (scm_quotient): Reimplement in terms of scm_truncate_quotient. (scm_remainder): Reimplement in terms of scm_truncate_remainder. (scm_modulo): Reimplement in terms of scm_floor_remainder. (scm_euclidean_quotient, scm_euclidean_remainder, scm_euclidean_divide): Reimplement in terms of floor and ceiling. Make them non-extensible, because there is no need; they will work with any objects that implement the floor and ceiling division operators, and that can be tested using `negative?'. 2011-02-14 Mark H Weaver <mhw@netris.org> Optimize truncate, round, floor, and ceiling * libguile/numbers.c (scm_c_truncate): Use ceil (x) instead of -floor (-x). (scm_truncate_number): Implement directly instead of by checking the sign and using scm_floor or scm_ceiling. Use scm_truncate_quotient for fractions. Make extensible, so that new number types implemented in GOOPS will be able to do the job more efficiently, since it is often easier to implement truncate than floor or ceiling. (scm_round_number): Optimize fractions case by using scm_round_quotient. Make extensible, so that new number types implemented in GOOPS will be able to do the job efficiently. (scm_floor, scm_ceiling): Optimize fractions case by using scm_floor_quotient and scm_ceiling_quotient, respectively. * test-suite/tests/numbers.test: Add test cases. 2011-02-14 Mark H Weaver <mhw@netris.org> Add four new sets of fast quotient and remainder operators * libguile/numbers.c (scm_floor_divide, scm_floor_quotient, scm_floor_remainder, scm_ceiling_divide, scm_ceiling_quotient, scm_ceiling_remainder, scm_truncate_divide, scm_truncate_quotient, scm_truncate_remainder, scm_round_divide, scm_round_quotient, scm_round_remainder): New extensible procedures `floor/', `floor-quotient', `floor-remainder', `ceiling/', `ceiling-quotient', `ceiling-remainder', `truncate/', `truncate-quotient', `truncate-remainder', `round/', `round-quotient', and `round-remainder'. * libguile/numbers.h: Add function prototypes. * test-suite/tests/numbers.test: Add tests. * doc/ref/api-data.texi (Arithmetic): Add documentation. * NEWS: Add NEWS entry. 2011-02-14 Mark H Weaver <mhw@netris.org> Optimize division operators handling of fractions * libguile/numbers.c: (scm_euclidean_quotient, scm_euclidean_remainder, scm_euclidean_divide, scm_centered_quotient, scm_centered_remainder, scm_centered_divide): Optimize case where both arguments are exact and at least one is a fraction, by reducing to a subproblem involving only integers, and then adjusting the resulting remainder as needed. 2011-02-14 Mark H Weaver <mhw@netris.org> Make divide functions return values via (SCM *) output arguments * libguile/numbers.c (scm_euclidean_divide, scm_centered_divide): Change API to return two values via output arguments of type (SCM *), instead of packing into a values object. (scm_i_euclidean_divide, scm_i_centered_divide): New internal wrappers that call the above functions and pack the result into a values object. * libguile/numbers.h: Change prototypes to reflect new API. * doc/ref/api-data.h (Arithmetic): Update manual. 2011-02-14 Mark H Weaver <mhw@netris.org> Added internal C function to extract from values object * libguile/values.c (scm_i_extract_values_2): New internal function that extracts two values from a values object. * libguile/values.h: Added prototype. 2011-02-14 Andy Wingo <wingo@pobox.com> update thanks * THANKS: Add Ian Price add vector-move test cases * test-suite/tests/vectors.test ("vector-move-left!") ("vector-move-right!"): Add test cases for recent bug. 2011-02-14 Ian Price <ianprice90@googlemail.com> fix fencepost error in vector-move-left! and -right! * libguile/vectors.c (scm_vector_move_right_x, scm_vector_move_left_x): Fix edge case. 2011-02-14 Ludovic Courtès <ludo@gnu.org> Pass all the flags when building `gen-scmconfig' in a cross-compile setup. * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): When cross-compiling, pass all the CPPFLAGS and CFLAGS. Leave the default `*current-warning-prefix*' at the REPL. * module/system/repl/common.scm (repl-compile): Leave the default `*current-warning-prefix*'. 2011-02-14 Ludovic Courtès <ludo@gnu.org> Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'. See <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24225> for details. * lib/unistr.in.h: Change #if's into #ifdef's. 2011-02-14 Ludovic Courtès <ludo@gnu.org> Update Gnulib; add new modules. This updates Gnulib to v0.0-4889-ge375fe3. * m4/gnulib-cache.m4: Add `accept', `bind', `close', `connect', `getpeername', `getsockname', `getsockopt', `listen', `malloc', `malloca', `recv', `recvfrom', `send', `sendto', `setsockopt', `shutdown', `socket', and `sockets', requested by Jan Nieuwenhuizen <janneke-list@xs4all.nl> for cross-MinGW32 builds. Add `trunc', requested by Mark H Weaver <mhw@netris.org>. 2011-02-14 Neil Jerram <neil@ossau.uklinux.net> Thank Ralf * THANKS: Thank Ralf. 2011-02-13 Neil Jerram <neil@ossau.uklinux.net> Typo fix * doc/ref/api-modules.texi (R6RS Libraries): "libraries implementation" -> "library implementation". Procedure/macro index includes Autoconf macros * doc/ref/indices.texi (Procedure Index): Make explicit that the procedure/macro index includes Autoconf macros. 2011-02-13 Neil Jerram <neil@ossau.uklinux.net> Misc textual editing * doc/ref/api-scheduling.texi (Asyncs): "queueing" -> "queuing". * benchmark-suite/lib.scm, doc/sources/unix.texi (Unix conventions), test-suite/lib.scm: "postpend" -> "append". * doc/ref/api-compound.texi (Array Syntax, Dictionary Types), doc/ref/api-control.texi (Catch), doc/ref/api-data.texi (Complex Numbers, Conversion, Random, Symbol Props, Symbol Uninterned), doc/ref/api-options.texi (Build Config, Common Feature Symbols), doc/ref/api-regex.texi (Match Structures), doc/ref/api-undocumented.texi, doc/ref/compiler.texi (Tree-IL, GLIL), doc/ref/data-rep.texi (Immediate objects), doc/ref/goops.texi (Slot Description Example), doc/ref/history.texi (A Scheme of Many Maintainers, Status), doc/ref/libguile-program.texi (Available Functionality), doc/ref/misc-modules.texi (Formatted Output), doc/ref/mod-getopt-long.texi (getopt-long Reference), doc/ref/posix.texi (Network Socket Address, Network Sockets and Communication), doc/ref/srfi-modules.texi (SRFI-1 Association Lists, SRFI-10, SRFI-19 String to date, SRFI-27 Random Sources), doc/ref/vm.texi (Instruction Set, Top-Level Environment Instructions, Procedure Call and Return Instructions), doc/sources/unix.texi (Unix conventions): Correct spacing after "i.e." and "e.g.". 2011-02-13 Neil Jerram <neil@ossau.uklinux.net> Avoid uses of "resp. signed" * doc/ref/api-data.texi (Bytevectors as Integers, Bytevectors and Integer Lists): Split signed and unsigned deffns. Reword intro of `Accessing Arrays from C' * doc/ref/api-compound.texi (Accessing Arrays from C): Reword to avoid awkward "rectangularily organized". 2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> docs: fix typos in manual, and a couple in code comments. * doc/ref/api-data.texi: Use \sqrt{2} consistently rather than \sqrt2. Add @: for correct spacing after "i.e.". docs: fix markup in api-options.texi. * doc/ref/api-options.texi (Build Config): Use @var for metasyntactic variable. Add newline after @noindent. Use @env for GUILE_LOAD_PATH. 2011-02-13 Noah Lavine <nlavine@haverford.edu> Set sockaddr_in.sin_len field when it exists. * configure.ac: Detect when struct sockaddr_in has a sin_len field. Remove obsolete comment. * libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Set the sin_len field in our struct sockaddr_in when it exists. 2011-02-13 Andy Wingo <wingo@pobox.com> bump objcode version to 2.0; introduce minor-version compatibility * libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump to 2. (SCM_OBJCODE_MINOR_VERSION): Reset to 0. (SCM_OBJCODE_MACHINE_VERSION_STRING, SCM_OBJCODE_COOKIE): Reorder so the minor version is the last byte. * libguile/objcodes.c (make_objcode_by_mmap): Accept objcodes whose minor version is less than SCM_OBJCODE_MINOR_VERSION, not just equal to. 2011-02-13 Noah Lavine <nlavine@haverford.edu> zero newly allocated sockaddrs * libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Zero the sockaddrs, so we do not pass uninitialized memory to the kernel. 2011-02-13 Ludovic Courtès <ludo@gnu.org> Add `%auto-compilation-options', used by `compile-file' when auto-compiling. * module/ice-9/boot-9.scm (%auto-compilation-options): New variable. (load-in-vicinity): Honor it. * libguile/load.c (kw_opts, sym_compile_file, sym_auto_compilation_options): New variables. (do_try_auto_compile): Honor %AUTO-COMPILATION-OPTIONS. * module/system/repl/common.scm (repl-default-options): Have `compile-options' default to %AUTO-COMPILATION-OPTIONS. 2011-02-13 Ludovic Courtès <ludo@gnu.org> Add `*current-warning-prefix*'. * module/system/base/message.scm (*current-warning-prefix*): New variable. (%warning-types): Honor `*current-warning-prefix*'. * module/scripts/compile.scm (compile): Use an empty `*current-warning-prefix*'. * module/system/repl/common.scm (repl-compile): Likewise. * test-suite/tests/tree-il.test (call-with-warnings): Likewise. 2011-02-13 Andy Wingo <wingo@pobox.com> primitive-load defaults to utf-8, not latin-1 * libguile/load.c (scm_primitive_load): Default to utf-8. 2011-02-13 Ludovic Courtès <ludo@gnu.org> Have `the-scm-module' be its own public interface (bug #30623). * module/ice-9/boot-9.scm (the-scm-module): Make it its own public interface. * test-suite/tests/modules.test ("foundations")["the-root-module", "the-scm-module"]: New tests. 2011-02-13 Andy Wingo <wingo@pobox.com> autocompile -> auto-compile * NEWS: * check-guile.in: * doc/guile.1: * doc/ref/scheme-scripts.texi: * libguile/init.c: * libguile/load.c: * libguile/load.h: * libguile/script.c: * module/Makefile.am: * module/ice-9/boot-9.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * test-suite/Makefile.am: * test-suite/tests/popen.test: Change "autocompile" to "auto-compile" or "auto_compile", as appropriate, in variable names, function names, command line arguments, and the documentation. `load' is a macro (!) that resolves paths relative to source file dir * module/ice-9/boot-9.scm (load-in-vicinity): New helper, loads a file relative to a path. (load): Turn into a macro that captures the name of the source file being expanded, and dispatches to load-in-vicinity. Referencing `load' by bare name returns a closure that embeds the current source file name. 2011-02-13 Andy Wingo <wingo@pobox.com> read-enable 'positions by default * libguile/read.c (scm_read_opts): Default "positions" to #t. The compiler was already turning it on anyway, and this allows primitive-load without --auto-compile to also propagate source information through the expander, for better errors and to let macros know their source. * module/language/scheme/spec.scm: No need to enable positions here now. 2011-02-13 Andy Wingo <wingo@pobox.com> use scm_c_make_struct in scm_values * libguile/values.c (scm_values): Micro-optimization. 2011-02-13 Ludovic Courtès <ludo@gnu.org> Add `scm_t_subr' typedef (fix bug #23681). * libguile/__scm.h (scm_t_subr): New typedef. * libguile/deprecated.h (scm_make_gsubr, scm_make_gsubr_with_generic, scm_call_catching_errors): Use it. * libguile/gsubr.h (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_define_gsubr_with_generic): Likewise. * libguile/smob.h (scm_smob_descriptor)[apply]: Likewise. (scm_set_smob_apply): Likewise. * libguile/snarf.h (SCM_FUNC_CAST_ARBITRARY_ARGS): Likewise. 2011-02-13 Ludovic Courtès <ludo@gnu.org> Change `scm_ramapc' prototype to avoid empty declarators (bug #23681). * libguile/array-map.h (scm_ramapc): Change `cproc' to `void *' instead of using empty declarators. * libguile/array-map.c (scm_ramapc): Adjust accordingly. 2011-02-13 Ludovic Courtès <ludo@gnu.org> Fix prototype of `scm_the_vm'. * libguile/vm.h (scm_the_vm): Use `(void)' instead of `()'. 2011-02-12 Andy Wingo <wingo@pobox.com> fix syntax-error printing * module/ice-9/boot-9.scm: Fix to make "extra" a rest arg. fix scm-error invocation on SIGINT in top-repl.scm * module/ice-9/top-repl.scm (call-with-sigint): Pass '() as the format args when invoking scm-error, to ensure that the error is printable. 2011-02-12 Mark H Weaver <mhw@netris.org> Fixes and improvements to number-theoretic division operators * libguile/numbers.c (scm_euclidean_quotient, scm_euclidean_divide, scm_centered_quotient, scm_centered_divide): Fix bug in inum/inum case, where (quotient most-negative-fixnum -1) would not be converted to a bignum. (scm_euclidean_quotient): Be more anal-retentive about calling scm_remember_upto_here_1 after mpz_sgn, (even though mpz_sgn is documented as being implemented as a macro and certainly won't do any allocation). It's better to be safe than sorry here. (scm_euclidean_quotient, scm_centered_quotient): In the bignum/inum case, check if the divisor is 1, since this will allow us to avoid allocating a new bignum. (scm_euclidean_divide, scm_centered_quotient, scm_centered_divide): When computing the intermediate truncated quotient (xx / yy) and remainder, use (xx % yy) instead of (xx - qq * yy), on the theory that the compiler is more likely to handle this case intelligently and maybe combine the operations. (scm_euclidean_divide): In the bignum/inum case, we know that the remainder will fit in an fixnum, so don't bother allocating a bignum for it. (scm_euclidean_quotient, scm_euclidean_remainder, scm_euclidean_divide, scm_centered_quotient, scm_centered_remainder, scm_centered_divide): Minor stylistic changes. * test-suite/tests/numbers.test: Rework testing framework for number-theoretic division operators to be more efficient and comprehensive in its testing of code paths and problem cases. 2011-02-12 Mark H Weaver <mhw@netris.org> Add comment about handling of exactness specifiers * libguile/numbers.c: Add discussion on the handling of exactness specifiers to the comment above the string-to-number conversion functions. Fix extensibility of 1-argument atan * libguile/numbers.c (scm_atan): Call SCM_WTA_DISPATCH_1 instead of SCM_WTA_DISPATCH_2 if the second argument is unbound. Arguably, SCM_WTA_DISPATCH_* should handle that case gracefully, but currently it doesn't. Fix mistake in comment in tags.h * libguile/tags.h: Fix comment in discussion of data representation. tc3-code #0b110 indicates a small integer and #0b100 indicates a non-integer immediate. Previously, these were reversed. Bump copyright date in REPL version string * module/system/repl/common.scm (*version*): Add 2011 to copyright date range. 2011-02-12 Ludovic Courtès <ludo@gnu.org> Make sure we don't override the user's extension search path. * libguile/dynl.c (augment_env): New function. (sysdep_dynl_init): Use it instead of `lt_dladdsearchdir'. * configure.ac: Define `SHARED_LIBRARY_PATH_VARIABLE'. 2011-02-12 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Save config.cache before tests which are likely to fail. Guile's configure script takes fairly long. On a system without automatic build dependency installation, it is amplified by the fact that your user might be both impatient and not read the build instructions, thus needs to rerun configure several times only to find out there is another dependency to install. Still, there is help even for such kinds of misguided figures such as me: save the temporary config.cache file (if one is used anyway) before embarking upon the set of tests that are likely to error out. That way, the second and further reruns are much faster. The downside of this patch is that, when fixing the errors requires changing to precious variables (such as CPPFLAGS or so), the user will need to 'rm -f config.cache' to keep configure happy. * configure.ac: Call AC_CACHE_SAVE before the gmp tests. 2011-02-11 Andreas Rottmann <a.rottmann@gmx.at> install r6rs exception printer * module/rnrs/exceptions.scm: Install an exception printer for R6RS exceptions. 2011-02-11 Andy Wingo <wingo@pobox.com> better narrowing in catch-all handlers in throw.c * libguile/throw.c (handler_message): Narrow away the catch-closure and throw frames. 2011-02-11 Andy Wingo <wingo@pobox.com> pre-boot lookup of print-exception works * libguile/backtrace.c (scm_print_exception): Use scm_module_variable to look up print-exception so that it works before boot-9 is loaded. * libguile/throw.c (CACHE_VAR): Tweak to use scm_from_latin1_symbol. 2011-02-11 Andy Wingo <wingo@pobox.com> scm_handle_by_message uses scm_print_exception * libguile/throw.c (handler_message, should_print_backtrace): Use scm_print_exception. Add a helper function to determine when to print a backtrace; don't do so on read or syntax errors. scm_display_error_message, display-error use print-exception * libguile/backtrace.c (scm_display_error_message) (scm_i_display_error): Use scm_print_exception. 2011-02-11 Andy Wingo <wingo@pobox.com> print-exception gets a c binding * libguile/backtrace.c (scm_print_exception): Add C binding for print-exception, which dispatches to whatever is defined in Scheme. (boot_print_exception): Add initial binding, replaced later in Scheme. * module/ice-9/boot-9.scm: Expect there to already be a print-exception binding. 2011-02-11 Andy Wingo <wingo@pobox.com> repl.scm: use print-exception * module/system/repl/repl.scm: Remove custom exception printers in favor of print-exception. (system repl error-handling) uses print-exception * module/system/repl/error-handling.scm (error-string): Just use print-exception instead of rolling our own printer. (call-with-error-handling): Simplify. add set-exception-printer!, print-exception to boot-9 * module/ice-9/boot-9.scm (set-exception-printer!, print-exception): Define an extensible exception-printing mechanism. Also register printers for all keys thrown by Guile. Inspired by a patch by Andreas Rottmann. 2011-02-11 Andy Wingo <wingo@pobox.com> frame-source available in default environment * libguile/frames.c (scm_frame_source): Don't call out to (system vm frames), as this routine is used when printing exceptions. Make available in the default environment (ugh). * module/system/vm/frame.scm: Remove frame-source definition and export. 2011-02-10 Andy Wingo <wingo@pobox.com> deprecate primitive properties * libguile.h: * libguile/Makefile.am: * libguile/deprecated.h: * libguile/deprecated.c: * libguile/init.c: * libguile/properties.c: * libguile/properties.h: Deprecate the "primitive properties" interface. It was only used to implement object properties, and that is no longer the case. * module/ice-9/boot-9.scm (make-object-property): Reimplement just in terms of weak hash tables, and make threadsafe. * NEWS: * doc/ref/api-utility.texi: Update. 2011-02-10 Andy Wingo <wingo@pobox.com> ports.c safely accesses the port weak hash table * libguile/ports.h (scm_i_remove_port): Remove declaration, as it was SCM_INTERNAL. * libguile/ports.c (scm_add_to_port_table): Issue a deprecation warning if this function is called. Remove needless SCM_API declaration, it was already declared as such in ports.h. Safely access the port table. (scm_i_remove_port): Remove bogus comment about lack of need for threadsafety. Take the port table mutex. (scm_close_port): No need to take port table mutex around calling scm_i_remove_port. pre-deprecate scm_ptobs * libguile/ports.h (scm_t_ptob_descriptor): Add comment about impending ptob deprecation. fix potential concurrency bugs in port-for-each * libguile/ports.c (scm_c_port_for_each): Simplify to avoid concurrency- and gc-related bugs. comment on scm_pre_modules_obarray re threadsafety * libguile/modules.c (scm_pre_modules_obarray): Add comment to the effect that this global variable does not need a lock around it. instructions.c: threadsafe static var * libguile/instructions.c (fetch_instruction_table): Lock access to the static, lazily-generated table. make static hash table access thread-safe in foreign.c * libguile/foreign.c (register_weak_reference): Wrap static hash table access in a mutex. fix potential deadlock in issue-deprecation-warning * libguile/deprecation.c (scm_c_issue_deprecation_warning): Avoid printing to a Scheme port while in a mutex. 2011-02-10 Ludovic Courtès <ludo@gnu.org> "latin1" -> "Latin-1". Reported by Ralf Wildenhues. * doc/ref/vm.texi (Loading Instructions): Use "Latin-1", not "latin1". 2011-02-10 Ludovic Courtès <ludo@gnu.org> Add `scm_i_set_default_port_encoding' and `scm_i_default_port_encoding'. * libguile/ports.c (scm_i_set_default_port_encoding, scm_i_default_port_encoding): New function. Replace `scm_i_set_port_encoding_x' and `scm_i_get_port_encoding' with PORT == SCM_BOOL_F. (scm_i_set_port_encoding_x): Assume PORT is a port. (scm_i_get_port_encoding): Remove. (scm_port_encoding): Adjust accordingly. (scm_new_port_table_entry): Use `scm_i_default_port_encoding'. * libguile/ports.h (scm_i_get_port_encoding): Remove declarations. (scm_i_default_port_encoding, scm_i_set_default_port_encoding): New declarations. * libguile/posix.c (setlocale): Use `scm_i_set_default_port_encoding'. 2011-02-10 Ludovic Courtès <ludo@gnu.org> Simplify `scm_i_set_port_encoding_x'. * libguile/ports.c (find_valid_encoding): Remove. (scm_i_set_port_encoding_x): Remove call to `find_valid_encoding'. Remove `valid_enc'. Rename `enc' to `encoding'. * test-suite/tests/ports.test ("port-encoding"): New test prefix. 2011-02-10 Ludovic Courtès <ludo@gnu.org> Add `read-delimited' tests. * test-suite/tests/rdelim.test ("read-delimited", "read-delimited!"): New test prefixes. 2011-02-10 Andy Wingo <wingo@pobox.com> getopt-long: arg parsing errors cause print and exit, not backtrace * module/ice-9/getopt-long.scm (fatal-error): New helper. For errors that come from the user -- i.e., not the grammar -- we will handle our own error printing and call `exit' rather than relying on the root catch handler. This is more friendly to the user than a Scheme backtrace. (parse-option-spec, process-options, getopt-long): Call `fatal-error' as appropriate. * test-suite/tests/getopt-long.test (pass-if-fatal-exception): New helper, checks that a certain key was thrown to, and that suitable output has been printed on an error port. (deferr): Change to expect a 'quit key instead of 'misc-error. Update exceptions to not match the beginning of the string, as that will be the program name. Update tests to use pass-if-fatal-exception. 2011-02-10 Andy Wingo <wingo@pobox.com> getopt-long cleanups * module/ice-9/getopt-long.scm (process-options): Use `match' in the loop. Clean up `eat' to not take the option being processed. getopt-long cleanup * module/ice-9/getopt-long.scm (process-options): Use more internal definitions instead of let-bound functions to decrease the nesting depth. getopt-long cleanup * module/ice-9/getopt-long.scm (looks-like-an-option): Remove obtuse use of "some". getopt-long uses match:substring from (ice-9 regex) * module/ice-9/getopt-long.scm: Import (ice-9 regex), and use its match:substring instead of our own. match-lambda in getopt-long * module/ice-9/getopt-long.scm (parse-option-spec): Use match-lambda to parse the grammar. getopt-long uses srfi-9 records internally * module/ice-9/getopt-long.scm: #:keywords in the define-module block. (option-spec): Define as a srfi-9 record instead of playing macro games with boot-9 records. volatile locals in bootstrap evaluator * libguile/eval.c (eval): For SCM_M_PROMPT, mark the locals needed after a longjmp as volatile. Perhaps related to bug 32340. 2011-02-09 Andy Wingo <wingo@pobox.com> more robust fallback error printer * libguile/throw.c (pre_init_throw): Deal with errors printing the exception. 2011-02-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> docs: add missing parentheses in asin formula. * doc/r5rs/r5rs.texi (Numerical operations): Add parentheses around argument to sqrt. docs: fix markup in api-options.texi. * doc/ref/api-options.texi (Build Config): Use @env for GUILE_LOAD_PATH. fix typos in the manual bits generated from source comments. * libguile/bitvectors.c, libguile/chars.c, libguile/deprecated.c, libguile/numbers.c, libguile/random.c, libguile/read.c, libguile/root.c, libguile/srfi-1.c, libguile/srfi-13.c, libguile/srfi-14.c, libguile/uniform.c: Fix typos, add missing newlines. docs: fix typos in manual, and a couple in code comments. * doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-debug.texi, doc/ref/api-io.texi, doc/ref/api-macros.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-undocumented.texi, doc/ref/api-utility.texi, doc/ref/compiler.texi, doc/ref/goops.texi, doc/ref/libguile-concepts.texi, doc/ref/misc-modules.texi, doc/ref/posix.texi, doc/ref/r6rs.texi, doc/ref/slib.texi, doc/ref/srfi-modules.texi, doc/ref/sxml-match.texi, doc/ref/tools.texi, doc/ref/vm.texi, doc/ref/web.texi, doc/sources/env.texi, doc/sources/jimb-org.texi, doc/sources/scheme-concepts.texi, doc/sources/unix.texi, module/ice-9/optargs.scm: Fix typos. * doc/r4rs/r5rs.texi: Likewise. Do not capitalize code symbols even at the start of a sentence. * doc/ref/api-data.texi: Likewise. Also, remove executable bit. 2011-02-09 Andy Wingo <wingo@pobox.com> abort on pre-boot throw without catch * libguile/throw.c (pre_init_throw): Abort instead of exit in the error case. Print out a message. 2011-02-09 Andy Wingo <wingo@pobox.com> fix a couple of (system vm frame) accesses on boot errors * libguile/backtrace.c (display_error_body): Don't look up the frame-source if Guile isn't initialized yet. Fixes display-error before boot has finished. * libguile/throw.c (handler_message): Likewise, don't backtrace before boot has finished, because we can't load (system vm frame). 2011-02-09 Andy Wingo <wingo@pobox.com> fix recursive throws if an error occurs at boot-time * libguile/throw.c (find_pre_init_catch): New internal helper. (pre_init_throw): If we don't find a catch, print out a message and abort. (scm_init_throw): Declare pre-init-throw as taking at least one arg. remove dead code in init.c * libguile/init.c: Remove some dead code. 2011-02-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> docs: remove non-ASCII space from docs. * doc/ref/api-compound.texi (Vector Accessing from C): Replace 0xa0 character with space. 2011-02-09 Andy Wingo <wingo@pobox.com> readline uses define-once * guile-readline/ice-9/readline.scm: Use define-once. 2011-02-09 Andy Wingo <wingo@pobox.com> add define-once * module/ice-9/boot-9.scm (define-once): New syntax. * doc/ref/api-binding.texi (Top Level): * NEWS: Add notes about define-once. 2011-02-09 Ludovic Courtès <ludo@gnu.org> Improve type checking when invoking foreign functions. * libguile/foreign.c (unpack): Make sure X is a pointer before using `SCM_POINTER_VALUE'. * test-suite/tests/foreign.test ("pointer->procedure"): New test prefix. 2011-02-08 Andy Wingo <wingo@pobox.com> uninstalled-env ordering tweaks to fix readline's file name * meta/uninstalled-env.in (subdirs_with_ltlibs): Remove "srfi". Reorder the load-path and load-compiled-path to put the root dir after guile-readline, so that relative canonicalization computes the correct path for ice-9/readline.scm. module-use-interfaces! handles duplicate interfaces * module/ice-9/boot-9.scm (module-use-interfaces!): Fix to have the same interface de-duplication characteristics as module-use!. remove readline-activator.scm * guile-readline/readline-activator.scm: Remove this file that was deprecated in Guile 1.4. 2011-02-08 Ludovic Courtès <ludo@gnu.org> Make `(format #f ...)' always Unicode-capable. * module/ice-9/format.scm (format): When DESTINATION is #f, use a Unicode-capable output string port. * test-suite/tests/format.test ("format basic output")["default to Unicode-capable port"]: New test. 2011-02-08 Andy Wingo <wingo@pobox.com> fix scm_procedure on non-structs * libguile/procs.c (scm_procedure): Fix argument type check. 2011-02-08 Ludovic Courtès <ludo@gnu.org> Have `define-wrapped-pointer-type' take a type name. * module/system/foreign.scm (define-wrapped-pointer-type): Add a `type-name' argument instead of non-hygienically generating one. * test-suite/tests/foreign.test (foo): Update. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Update accordingly. 2011-02-08 Andy Wingo <wingo@pobox.com> fix quasiquote test * test-suite/tests/syntax.test ("quasiquote"): Fix unquote-splicing extra args test to update for current behavior. hackily fix another case where display-exception would be apropos * module/system/repl/error-handling.scm (display-syntax-error) (error-string): Until we get the exception-printing patch merged in, copy display-syntax-error into error-handling so that we avoid display-error. Fixes bug 32365. 2011-02-08 Andy Wingo <wingo@pobox.com> unquote and unquote-splicing can split multiple expressions * module/ice-9/psyntax.scm (quasiquote): Import new definition from upstream psyntax, to allow unquote and unquote-splicing to take multiple arguments. (unquote, unquote-splicing): Adapt to not require a particular syntax form. * module/ice-9/psyntax-pp.scm: Regenerated. 2011-02-07 Ludovic Courtès <ludo@gnu.org> Hack around a defect in `define-wrapped-pointer-type'. * module/system/foreign.scm (define-wrapped-pointer-type): Choose TYPE-NAME deterministically. 2011-02-07 Ludovic Courtès <ludo@gnu.org> Add tests for `memq' and `memv'. This is a follow-up to a75ea6589642270adf933b85a15d96a74ff59225 ("fix memq/memv inlining"). * test-suite/tests/list.test ("memq", "memv"): New test prefixes. 2011-02-07 Andy Wingo <wingo@pobox.com> fix memq/memv inlining * module/language/tree-il/inline.scm (boolean-value): Add a case for applications of primitives, and move the memq/memv->bool code here. (inline!): We were inlining (memq 'a '(a b c)) => #t, and not the list tail, which was an embarrassing bug. Fixed by moving this code to the boolean-value function. Thanks to Mark Harig for the report. hack around bug in port-filename * module/ice-9/boot-9.scm (define-module): Until the port-filename bug is fixed, hack around it. 2011-02-03 Mark H Weaver <mhw@netris.org> Improved exactness handling for complex number parsing When parsing non-real complex numbers, apply exactness specifiers on per-component basis, as is done in PLT Scheme. For complex numbers written in rectangular form, exactness specifiers are applied to the real and imaginary parts before calling scm_make_rectangular. For complex numbers written in polar form, exactness specifiers are applied to the magnitude and angle before calling scm_make_polar. There are two kinds of exactness specifiers: forced and implicit. A forced exactness specifier is a "#e" or "#i" prefix at the beginning of the entire number, and applies to both components of a complex number. "#e" causes each component to be made exact, and "#i" causes each component to be made inexact. If no forced exactness specifier is present, then the exactness of each component is determined independently by the presence or absence of a decimal point or hash mark within that component. If a decimal point or hash mark is present, the component is made inexact, otherwise it is made exact. After the exactness specifiers have been applied to each component, they are passed to either scm_make_rectangular or scm_make_polar to produce the final result. Note that this will result in a real number if the imaginary part, magnitude, or angle is an exact 0. Previously, both forced and implicit exactness specifiers applied to the number as a whole _after_ calling scm_make_rectangular or scm_make_polar. For example, (string->number "#i5.0+0i") now does the equivalent of: (make-rectangular (exact->inexact 5.0) (exact->inexact 0)) which yields 5.0+0.0i. Previously it did the equivalent of: (exact->inexact (make-rectangular 5.0 0)) which yielded 5.0. * libguile/numbers.c (mem2ureal): Receive a forced exactness specifier (forced_x), create and maintain our own implicit exactness specifier flag local to this component (implicit_x), and apply these exactness specifiers within this function. Previously, we received a pointer to an implicit exactness specifier flag from above, and the exactness specifiers were applied from within scm_i_string_length. (mem2complex): Receive a forced exactness specifier parameter and pass it down to mem2ureal. Previously, we passed down a pointer to an implicit exactness specifier flag instead. (scm_i_string_to_number): No longer create an implicit exactness specifier flag here, and do not apply exactness specifiers here. All we do here now regarding exactness is to parse the "#e" or "#i" prefix (if any) and pass this information down to mem2ureal via mem2complex in the form of an explicit exactness specifier (forced_x). (scm_c_make_polar): If the cosine and sine of the angle are both NaNs and the magnitude is zero, return 0.0+0.0i instead of +nan.0+nan.0i. This case happens when the angle is not finite. * test-suite/tests/numbers.test (string->number): Move the test cases for non-real complex numbers into a separate table in which the expected real and imaginary parts are separate entries. Add several new test cases. 2011-02-03 Mark H Weaver <mhw@netris.org> Fix non-portable usage of `isinf' in `max' and `min' * numbers.c: Add new macros DOUBLE_IS_POSITIVE_INFINITY and DOUBLE_IS_NEGATIVE_INFINITY. (scm_max, scm_min): Use the new macros to detect particular infinities. Previously we checked the return value of `isinf' to determine the sign of the infinity, but that is not portable. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.15. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Fix `GUILE_THREAD_LOCAL_STORAGE'. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Fix M4 quotation. Enclose SRFI-13 deprecation handling in `#if SCM_ENABLE_DEPRECATED == 1'. * libguile/srfi-13.c (scm_string_filter, scm_string_delete): Enclose deprecated call convention handling in `#if SCM_ENABLE_DEPRECATED == 1'. 2011-02-02 Andy Wingo <wingo@pobox.com> fix srfi-13 test argument orders * test-suite/tests/srfi-13.test ("string-filter", "string-delete"): Fix argument order in tests. 2011-02-02 Mark H Weaver <mhw@netris.org> Support non-real complex numbers with inexact zero imaginary part Add the ability to represent non-real complex numbers whose imaginary part is an _inexact_ zero (0.0 or -0.0), per R6RS. Previously, such numbers were immediately changed into inexact reals. * libguile/numbers.c: Remove from the list of `General assumptions' in numbers.c that objects satisfying SCM_COMPLEXP() have a non-zero complex component. This is no longer true. Also add a warning about another unrelated assumption that is not entirely correct (that floor(r) == r implies that mpz_set_d will DTRT; it won't if r is infinite). (icmplx2str): Always print the imaginary part, even if it is zero. Also handle a negative zero imaginary part more gracefully. It now prints 0.0-0.0i, where previously it would print 0.0+-0.0i. (mem2ureal): Replace scm_from_double (0.0) with flo0. (scm_c_make_rectangular): Always create non-real complex numbers. Previously it would create inexact reals if the specified imaginary part was zero. (scm_make_rectangular): If the imaginary part is an _exact_ 0, return the real part unchanged (possibly exact), otherwise return a non-real complex number (possibly with an inexact zero imaginary part). Previously, it would return an inexact real number whenever the imaginary part was any kind of zero. (scm_make_polar): If the magnitude is an exact 0, return an exact 0. If the angle is an exact 0, return the magnitude unchanged (possibly exact). Otherwise return a non-real complex number (possibly with an inexact zero imaginary part). Previously, it would return a real number whenever the imaginary part was any kind of zero. (scm_imag_part): Return an exact 0 if applied to a real number. Previously it would return an inexact zero if applied to an inexact real number. (scm_inexact_to_exact): Accept complex numbers with inexact zero imaginary part. In that case, simply use the real part and ignore the imaginary part. Essentially we coerce the inexact zero imaginary part to an exact 0. * test-suite/tests/numbers.test: Add many test cases, and modify existing tests as needed to reflect these changes. Also add a new internal predicate: `almost-real-nan?' which tests for a non-real complex number with zero imaginary part whose real part is a NaN. * doc/ref/api-data.texi (Complex Numbers): Update description of complex numbers to reflect these changes: non-real complex numbers in Guile need not have non-zero imaginary part. Also, each part of a complex number may be any inexact real, not just rationals as was previously stated. Explicitly mention that each part may be an infinity, a NaN, or a signed zero. (Complex Number Operations): Change the formal parameter names of `make-polar' from `x' and `y' to `mag' and `ang'. * NEWS: Add news entries. 2011-02-02 Mark H Weaver <mhw@netris.org> Improve handling of signed zeroes * libguile/numbers.c (scm_abs): (abs -0.0) now returns 0.0. Previously it returned -0.0. Also move the REALP case above the BIGP case, and consider it SCM_LIKELY to be REALP if not INUMP. (scm_difference): (- 0 0.0) now returns -0.0. Previously it returned 0.0. Also make sure that (- 0 0.0+0.0i) will return -0.0-0.0i. * test-suite/tests/numbers.test (abs, -): Add test cases, and change some tests to use `eqv?' instead of `=', in order to test exactness and distinguish signed zeroes. 2011-02-02 Mark H Weaver <mhw@netris.org> Trigonometric functions return exact numbers in some cases * libguile/numbers.c (scm_sin, scm_cos, scm_tan, scm_asin, scm_acos, scm_atan, scm_sinh, scm_cosh, scm_tanh, scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): Return an exact result in some cases. * test-suite/tests/numbers.test: Add test cases. * NEWS: Add NEWS entry 2011-02-02 Mark H Weaver <mhw@netris.org> Fix `min' and `max' handling of NaNs, infinities, and signed zeroes * libguile/numbers.c (scm_min, scm_max): Properly order the real infinities and NaNs, per R6RS, and also take care to handle signed zeroes properly. Note that this ordering is different than that of `<', `>', `<=', and `>=', which return #f if any argument is a real NaN, and consider the real zeroes to be equal. The relevant real infinity (-inf.0 for min, +inf.0 for max) beats everything, including NaNs, and NaNs beat everything else. Previously these were handled improperly in some cases, e.g.: (min 1/2 +nan.0) now returns +nan.0 (previously returned 0.5), (max 1/2 +nan.0) now returns +nan.0 (previously returned 0.5), (min -inf.0 +nan.0) now returns -inf.0 (previously returned +nan.0), (max +inf.0 +nan.0) now returns +inf.0 (previously returned +nan.0), (min -0.0 0.0) now returns -0.0 (previously returned 0.0), (max 0.0 -0.0) now returns 0.0 (previously returned -0.0), (max 0 -0.0) now returns 0.0 (previously returned -0.0), (max -0.0 0 ) now returns 0.0 (previously returned -0.0). * test-suite/tests/numbers.test (min, max): Add many more test cases relating to NaNs, infinities, and signed zeroes. Change most existing test cases to use `eqv?' instead of `=', in order to check exactness. 2011-02-02 Noah Lavine <nlavine@haverford.edu> macro documentation fixup * doc/ref/api-macros.texi: make the difference between pattern variables and lexical variables a bit clearer. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Disable use of thread-local storage on FreeBSD. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Explicitly require `AC_CANONICAL_HOST'. Disable on FreeBSD. Update `NEWS'. * NEWS: Update. 2011-02-02 Ludovic Courtès <ludo@gnu.org> R6RS: Have `put-char', `put-string', etc. raise an `&i/o-encoding-error'. * module/rnrs/io/ports.scm (&i/o-encoding): New error condition type. (with-i/o-encoding-error): New macro. (put-char, put-datum, put-string): Use it. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port, output [error handling mode = raise]"]: New test. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Change `scm_encoding_error' to pass the port and faulty character. * libguile/strings.c (scm_encoding_error): Remove the `from', `to', and `string_or_bv' parameters; add `port' and `chr'. (scm_to_stringn): Update accordingly. * libguile/strings.h (scm_encoding_error): Update accordingly. * libguile/ports.c (scm_ungetc): Update accordingly. * libguile/print.c (iprin1, scm_write_char): Update accordingly. * test-suite/tests/encoding-escapes.test ("display output errors")["ultima", "Rashomon"]: Check the arguments of `encoding-error'. ["tekniko"]: New test. * test-suite/tests/ports.test ("string ports")["wrong encoding"]: Adjust to new `encoding-error' arguments. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Upon port encoding error, always write as much as possible. * libguile/print.c (display_string): Upon error, always write the OUTPUT_LEN bytes of output, regardless of the conversion strategy. 2011-02-02 Ludovic Courtès <ludo@gnu.org> R6RS: Have `get-char', `get-line', etc. raise an `&i/o-decoding-error'. * module/rnrs/io/ports.scm (&i/o-decoding): New error condition type. (with-i/o-decoding-error): New macro. (get-char, get-datum, get-line, get-string-all, lookahead-char): Use it. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Use `guard' and `i/o-decoding-error?'. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Avoid circular dependency between (rnrs base) and (rnrs exceptions). * module/rnrs/base.scm (raise): Define as a macro instead of a procedure. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Have `read-char' & co. throw to `decoding-error'. * libguile/ports.c (scm_read_char): Mention `decoding-error' in the docstring. (get_codepoint): Change to return an error code; add `codepoint' output parameter. Don't raise an error from here. (scm_getc): Raise an error with `scm_decoding_error' if `get_codepoint' returns an error. (scm_peek_char): Likewise. Update docstring. * libguile/strings.c (scm_decoding_error_key): New variable. (scm_decoding_error): New function. (scm_from_stringn): Use `scm_decoding_error' instead of `scm_encoding_error'. * libguile/strings.h (scm_decoding_error): New declaration. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error"]: Change to expect `decoding-error'. Make sure PORT points past the error. ["read-char, wrong encoding, escape"]: Likewise. ["peek-char, wrong encoding, error"]: New test. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Change to expect `decoding-error'. ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Likewise. * test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding error, substitute"]: New tests. * doc/ref/api-io.texi (Reading): Update documentation of `read-char' and `peek-char'. (Line/Delimited): Update documentation of `read-line'. 2011-02-02 Ludovic Courtès <ludo@gnu.org> Use `#ifdef HAVE_...', not `#if'. * test-suite/standalone/test-round.c (test_scm_c_round): Use `#ifdef HAVE_FESETROUND', not `#if'. Fix typo. * libguile/srfi-1.c (scm_srfi1_concatenate_x): Fix `FUNC_NAME'. 2011-02-02 Michael Gran <spk121@yahoo.com> Use 'substring' instead of obsoleted 'make-shared-substring' * module/system/repl/describe.scm (display-description): replace make-shared-substring with substring 2011-02-01 Andreas Rottmann <a.rottmann@gmx.at> Fix `show' REPL meta-command * module/system/repl/command.scm (warranty, copying, version): Use `define-meta-command' to define these procedures, so they are entered into the *command-infos* table. 2011-02-01 Mark H Weaver <mhw@netris.org> Improve discussion of exactness propagation in manual * doc/ref/api-data.texi (Exact and Inexact Numbers): Improve the discussion of exactness propagation. Mention that there are exceptions to the rule that calculations involving inexact numbers must product an inexact result. Move comment about trig functions back where it belongs * libguile/numbers.c: Move a comment about the trigonometric functions next to those functions. At some point they became separated, when scm_expt was placed between them. 2011-02-01 Mark H Weaver <mhw@netris.org> Handle products with exact 0 differently * libguile/numbers.c (scm_product): Handle exact 0 differently. A product containing an exact 0 now returns an exact 0 if and only if the other arguments are all exact. An inexact zero is returned if and only if the other arguments are all finite but not all exact. If an infinite or NaN value is present, a NaN value is returned. Previously, any product containing an exact 0 yielded an exact 0, regardless of the other arguments. A note on the rationale for (* 0 0.0) returning 0.0 and not exact 0: The exactness propagation rules allow us to return an exact result in the presence of inexact arguments only if the values of the inexact arguments do not affect the result. In this case, the value of the inexact argument _does_ affect the result, because an infinite or NaN value causes the result to be a NaN. A note on the rationale for (* 0 +inf.0) being a NaN and not exact 0: The R6RS requires that (/ 0 0.0) return a NaN value, and that (/ 0.0) return +inf.0. We would like (/ x y) to be the same as (* x (/ y)), and in particular, for (/ 0 0.0) to be the same as (* 0 (/ 0.0)), which reduces to (* 0 +inf.0). Therefore (* 0 +inf.0) should return a NaN. * test-suite/tests/numbers.test: Add many multiplication tests. * NEWS: Add NEWS entry. 2011-02-01 Mark H Weaver <mhw@netris.org> More discriminating NaN predicates for numbers.test * test-suite/tests/numbers.test: (real-nan?, complex-nan?, imaginary-nan?): Add more discriminating NaN testing predicates internal to numbers.test, and convert several uses of `nan?' to use these instead: * `real-nan?' checks that its argument is real and a NaN. * `complex-nan?' checks that both the real and imaginary parts of its argument are NaNs. * `imaginary-nan?' checks that its argument's real part is zero and the imaginary part is a NaN. 2011-02-01 Mark H Weaver <mhw@netris.org> Fix bugs in `rationalize' * libguile/numbers.c (scm_rationalize): Fix bugs. Previously, it returned exact integers unmodified, although that was incorrect if the epsilon was at least 1 or inexact, e.g. (rationalize 4 1) should return 3 per R5RS and R6RS, but previously it returned 4. Also handle cases involving infinities and NaNs properly, per R6RS. * test-suite/tests/numbers.test: Add test cases for `rationalize'. * NEWS: Add NEWS entry 2011-02-01 Mark H Weaver <mhw@netris.org> Fix and combine NEWS entries on `infinite?' and `finite?' * NEWS: Fix and combine NEWS entries on `infinite?' and `finite?'. Previous, they stated that these predicates now work on non-real complex numbers, but that is not the case. 2011-02-01 Mark H Weaver <mhw@netris.org> Update copyright date of manual, and a small fix * doc/ref/guile.texi: Update copyright date to 2011. * doc/ref/r6rs.texi (rnrs base): Fix typo: `rem0' -> `div0'. 2011-01-31 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update. 2011-01-31 Mark H Weaver <mhw@netris.org> Improve extensibility of `expt' and `integer-expt' * libguile/numbers.c (scm_integer_expt): No longer require that the first argument be a number, in order to improve extensibility. This allows us to efficiently raise arbitrary objects to an integer power as long as we can multiply those objects. For example, this allows us to efficiently exponentiate matrices if we define only multiplication methods for matrices. Note also that scm_expt calls this procedure whenever the exponent is an integer, regardless of the type of the first argument. Also rearrange the order in which we test special cases. * test-suite/tests/numbers.test (expt, integer-expt): Comment out tests that required `(expt #t 0)' and `(integer-expt #t 0)' to throw exceptions. Add tests for (expt #t 2) and `(integer-expt #t 2) instead. * NEWS: Add NEWS entry 2011-01-31 Andy Wingo <wingo@pobox.com> toplevel vars added by syntax expansion are unbound * module/ice-9/psyntax.scm (chi-top): When adding to the toplevel environment at compile-time, default to undefined variables, not variables defined to #f. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/boot-9.scm (module-add!): Add a new pre-modules version of this function, so we can add variables the environment, not just values. (module-define!): Use module-add!. 2011-01-31 Mark H Weaver <mhw@netris.org> Rename {euclidean,centered}_quo_rem to {euclidean,centered}_divide * libguile/numbers.c (euclidean_quo_rem): Rename to euclidean_divide. (centered_quo_rem): Rename to {euclidean,centered}_divide. * libguile/numbers.h: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide. * doc/ref/api-data.texi: Rename euclidean_quo_rem to euclidean_divide and centered_quo_rem to centered_divide. 2011-01-31 Ludovic Courtès <ludo@gnu.org> Disable stand-alone tests that require `dlopen' when `--disable-shared'. * configure.ac (HAVE_SHARED_LIBRARIES): New Automake conditional. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add `test-asmobs', `test-ffi', and `test-extensions' only when `HAVE_SHARED_LIBRARIES'. 2011-01-31 Mark H Weaver <mhw@netris.org> Rework the testing framework for number-theoretic division operators * test-suite/tests/numbers.test (test-eqv?): Remove special handling of zeroes. Zeroes are now compared like all other numbers. Exact numbers are compared with `eqv?' and inexact numbers are compared to within test-epsilon. Rework the testing framework for number-theoretic division operators: `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', and `centered-remainder'. Previously we compared all test results against a simple scheme implementation of the same operations. However, these operations have discontinuous jumps where a tiny change in the inputs can lead to a large change in the outputs, e.g.: (euclidean/ 130.00000000000 10/7) ==> 91.0 and 0.0 (euclidean/ 129.99999999999 10/7) ==> 90.0 and 1.42857142856141 In the new testing scheme, we compare values against the simple implementations only if the input arguments contain an infinity or a NaN. In the common case of two finite arguments, we simply make sure that the outputs of all three operators (e.g. `euclidean/', `euclidean-quotient', `euclidean-remainder') equal each other, that outputs are exact iff both inputs are exact, and that the required properties of the operator are met: that Q is an integer, that R is within the specified range, and that N = Q*D + R. 2011-01-30 Ludovic Courtès <ludo@gnu.org> Add `pointer?'. * libguile/foreign.c (scm_pointer_p): New function. * libguile/foreign.h (scm_pointer_p): New declaration. * module/system/foreign.scm: Export `pointer?'. * test-suite/tests/foreign.test ("null pointer")["pointer?"]: New test. ("make-pointer")["pointer?"]: New test. * doc/ref/api-foreign.texi (Foreign Variables): Document `pointer?'. 2011-01-30 Ludovic Courtès <ludo@gnu.org> Remove the "has finalizer?" bit from pointer objects. * libguile/foreign.h (SCM_POINTER_HAS_FINALIZER): Remove. * libguile/foreign.c (scm_from_pointer): Store nothing more than `scm_tc7_pointer' in the type slot. 2011-01-30 Ludovic Courtès <ludo@gnu.org> Add `define-wrapped-pointer-type'. * module/system/foreign.scm (define-wrapped-pointer-type): New macro. * doc/ref/api-foreign.texi (Foreign Types): Mention the `*' symbol. (Void Pointers and Byte Access): Document `define-wrapped-pointer-type'. * test-suite/tests/foreign.test ("define-wrapped-pointer-type"): New test prefix. 2011-01-30 Mark H Weaver <mhw@netris.org> Improve extensibility of core numeric procedures * libguile/numbers.c (scm_quotient, scm_remainder, scm_modulo, scm_zero_p, scm_positive_p, scm_negative_p, scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_magnitude, scm_angle, scm_exact_to_inexact): Change from SCM_GPROC to SCM_PRIMITIVE_GENERIC. As a side effect, all of these procedures now have documentation strings. (scm_exact_p, scm_inexact_p, scm_odd_p, scm_even_p, scm_finite_p, scm_inf_p, scm_nan_p, scm_expt, scm_inexact_to_exact, scm_log, scm_log10, scm_exp, scm_sqrt): Change from SCM_DEFINE to SCM_PRIMITIVE_GENERIC, and make sure the code allows these functions to be extended in practice. (scm_real_part, scm_imag_part, scm_numerator, scm_denominator, scm_inexact_to_exact): Simplify type dispatch code. (scm_sqrt): Rename formal argument from x to z, since complex numbers are supported. (scm_abs): Fix empty FUNC_NAME. * libguile/numbers.h (scm_finite_p): Add missing prototype. (scm_inf_p, scm_nan_p): Rename formal parameter from n to x, since the domain is the real numbers. * test-suite/tests/numbers.test: Test for documentation strings. Change from `expect-fail' to `pass-if' for several of these, and add tests for others. Also add other tests for `real-part' and `imag-part', which previously had none. 2011-01-30 Mark H Weaver <mhw@netris.org> Add two new sets of fast quotient and remainder operators * libguile/numbers.c (scm_euclidean_quo_and_rem, scm_euclidean_quotient, scm_euclidean_remainder, scm_centered_quo_and_rem, scm_centered_quotient, scm_centered_remainder): New extensible procedures `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * libguile/numbers.h: Add function prototypes. * module/rnrs/base.scm: Remove incorrect stub implementations of `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Instead do renaming imports of `euclidean-quotient', `euclidean-remainder', `euclidean/', `centered-quotient', `centered-remainder', and `centered/', which are equivalent to the R6RS operators. * module/rnrs/arithmetic/fixnums.scm (fxdiv, fxmod, fxdiv-and-mod, fxdiv0, fxmod0, fxdiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. (fx+/carry): Remove unneeded calls to `inexact->exact'. * module/rnrs/arithmetic/flonums.scm (fldiv, flmod, fldiv-and-mod, fldiv0, flmod0, fldiv0-and-mod0): Remove redundant checks for division by zero and unnecessary complexity. Remove unneeded calls to `inexact->exact' and `exact->inexact' * test-suite/tests/numbers.test: (test-eqv?): New internal predicate for comparing numerical outputs with expected values. Add extensive test code for `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', `centered-remainder'. * test-suite/tests/r6rs-arithmetic-fixnums.test: Fix some broken test cases, and remove `unresolved' test markers for `fxdiv', `fxmod', `fxdiv-and-mod', `fxdiv0', `fxmod0', and `fxdiv0-and-mod0'. * test-suite/tests/r6rs-arithmetic-flonums.test: Remove `unresolved' test markers for `fldiv', `flmod', `fldiv-and-mod', `fldiv0', `flmod0', and `fldiv0-and-mod0'. * doc/ref/api-data.texi (Arithmetic): Document `euclidean/', `euclidean-quotient', `euclidean-remainder', `centered/', `centered-quotient', and `centered-remainder'. (Operations on Integer Values): Add cross-references to `euclidean/' et al, from `quotient', `remainder', and `modulo'. * doc/ref/r6rs.texi (rnrs base): Improve documentation for `div', `mod', `div-and-mod', `div0', `mod0', and `div0-and-mod0'. Add cross-references to `euclidean/' et al. * NEWS: Add NEWS entry. 2011-01-30 Mark H Weaver <mhw@netris.org> Add SCM_LIKELY and SCM_UNLIKELY for optimization * libguile/numbers.c (scm_abs, scm_quotient, scm_remainder, scm_modulo): Add SCM_LIKELY and SCM_UNLIKELY in several places for optimization. (scm_remainder): Add comment about C99 "%" semantics. Strip away a redundant set of braces. 2011-01-30 Mark H Weaver <mhw@netris.org> Fix GOOPS method compilation bug when no next-method exists * module/oop/goops/compile.scm (compute-cmethod): Fix a bug that caused the method compiler to barf while compiling a method that calls (next-method), if there is no applicable next method. 2011-01-30 Mark H Weaver <mhw@netris.org> Implement R6RS `real-valued?', `rational-valued?', `integer-valued?' * module/rnrs/base.scm (real-valued?, rational-valued?, integer-valued?): Implement in compliance with R6RS. * test-suite/tests/r6rs-base.test: Add test cases for `real-valued?', `rational-valued?', and `integer-valued?'. * NEWS: Add NEWS entries. 2011-01-30 Mark H Weaver <mhw@netris.org> Infinities and NaNs are no longer rational * libguile/numbers.c (scm_rational_p): Return #f for infinities and NaNs, per R6RS. Previously it returned #t for real infinities and NaNs. They are still considered real by scm_real `real?' however, per R6RS. Also simplify the code. (scm_real_p): New implementation to reflect the fact that the rationals and reals are no longer the same set. Previously it just called scm_rational_p. (scm_integer_p): Simplify the code. * test-suite/tests/numbers.test: Add test cases for `rational?' and `real?' applied to infinities and NaNs. * doc/ref/api-data.texi (Real and Rational Numbers): Update docs to reflect the fact that infinities and NaNs are no longer rational, and that `real?' no longer implies `rational?'. Improve discussion of infinities and NaNs. * NEWS: Add NEWS entries, and combine with an earlier entry about infinities no longer being integers. 2011-01-30 Mark H Weaver <mhw@netris.org> `equal?' and `eqv?' are now equivalent for numbers Change `equal?' to work like `eqv?' for numbers. Previously they worked differently in some cases, e.g. when comparing signed zeroes or NaNs. For example, (equal? 0.0 -0.0) returned #t but (eqv? 0.0 -0.0) returned #f, and (equal? +nan.0 +nan.0) returned #f but (eqv? +nan.0 +nan.0) returned #t. * libguile/numbers.c (scm_real_equalp, scm_bigequal, scm_complex_equalp, scm_i_fraction_equalp): Move to eq.c. * libguile/eq.c (scm_real_equalp): Compare flonums using real_eqv instead of ==, so that NaNs are now considered equal, and to distinguish signed zeroes. (scm_complex_equalp): Compare real and imaginary components using real_eqv instead of ==, so that NaNs are now considered equal, and to distinguish signed zeroes. (scm_bigequal): Use scm_i_bigcmp instead of duplicating it. (real_eqv): Test for NaNs using isnan(x) instead of (x != x), and use SCM_UNLIKELY for optimization. (scm_eqv_p): Use scm_bigequal, scm_real_equalp, scm_complex_equalp, and scm_i_fraction_equalp to compare numbers, instead of inline code. Those predicates now do what scm_eqv_p formerly did internally. Replace if statements with switch statements, as is done in scm_equal_p. Remove useless code to check equality of fractions with different SCM_CELL_TYPEs; this was for a tentative "lazy reduction bit" which was never developed. (scm_eqv_p, scm_equal_p): Remove useless code to check equality between inexact reals and non-real complex numbers with zero imaginary part. Such numbers do not exist, because the current code is careful to never create them. * test-suite/tests/numbers.test: Add test cases for `eqv?' and `equal?'. Change existing test case for `(equal? +nan.0 +nan.0)' to expect #t instead of #f. * NEWS: Add NEWS entries. 2011-01-30 Mark H Weaver <mhw@netris.org> Remove useless test and fix spelling errors * test-suite/tests/numbers.test: Remove test for lazy reduction bit of fractions, which was never implemented. Fix some spelling errors. 2011-01-29 Ludovic Courtès <ludo@gnu.org> Don't remove `standard-library.texi' upon "make clean". * doc/ref/Makefile.am (CLEANFILES): Rename to... (DISTCLEANFILES): ... this. So that "make clean" doesn't remove `standard-library.texi'. Reported by Hans Åberg <haberg-1@telia.com>. Add missing include for MinGW. * libguile/ports.h: Include <unistd.h>. Make `inet-ntop' and `inet-pton' available even when !HAVE_IPV6. * libguile/socket.c (scm_inet_pton, scm_inet_ntop): Move out of `#ifdef HAVE_IPV6' and conditionalize the IPv6-specific bits. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. 2011-01-29 Jan Nieuwenhuizen <janneke@gnu.org> When cross building, run GUILE_FOR_BUILD instead of just-built guile. * meta/guile.in: Run @GUILE_FOR_BUILD@ when cross-compiling. 2011-01-29 Ludovic Courtès <ludo@gnu.org> Have `srfi-19.test' use the non-deprecated `format' style. * test-suite/tests/srfi-19.test: Fix all uses of `format' to pass a port or Boolean as the first argument. Add a test for `send' and `recv!'. * test-suite/tests/socket.test ("AF_UNIX/SOCK_STREAM")["bind (bis)", "listen (bis)", "recv!", "accept (bis)"]: New tests. 2011-01-29 Ludovic Courtès <ludo@gnu.org> Have `recv!', `send', etc. accept a bytevector. * libguile/socket.c (scm_recv, scm_send, scm_recvfrom, scm_sendto): Expect the buffer to be a bytevector. Move the string-handling code under `#if SCM_ENABLE_DEPRECATED == 1' and issue a deprecation warning. * test-suite/tests/socket.test ("AF_UNIX/SOCK_DGRAM")["sendto", "sendto/sockaddr"]: Adjust accordingly. * doc/ref/posix.texi (Network Sockets and Communication): Update documentation of `recv!', `send', `recvfrom!', and `sendto'. 2011-01-29 Ludovic Courtès <ludo@gnu.org> Add `-lgc' to `Libs' in `guile-2.0.pc'. This accounts for the fact that some public Guile macros and inline functions use libgc functions. * meta/guile-2.0.pc.in (Libs.private): Move @BDW_GC_LIBS@ to... (Libs): ... here. Reported by Hans Aberg <haberg-1@telia.com>. * meta/guile-2.0-uninstalled.pc.in: Likewise. 2011-01-28 Andy Wingo <wingo@pobox.com> update api-evaluation.texi * doc/ref/api-evaluation.texi (Compilation): Update compile-file and compiled-file-name docs. 2011-01-28 Mark H Weaver <mhw@netris.org> Fix bugs when negating SCM_MOST_POSITIVE_FIXNUM+1 * libguile/numbers.c (scm_difference, scm_product): Fix bugs when negating SCM_MOST_POSITIVE_FIXNUM+1, aka -SCM_MOST_NEGATIVE_FIXNUM. Previously, these cases failed to normalize the result to a fixnum, causing `=', `eqv?' and `equal?' to fail, e.g.: (= most-negative-fixnum (- 0 (- most-negative-fixnum))) (= most-negative-fixnum (* -1 (- most-negative-fixnum))) (= most-negative-fixnum (* (- most-negative-fixnum) -1)) * test-suite/test/numbers.test: Add test cases to detect bugs when negating SCM_MOST_POSITIVE_FIXNUM+1 and SCM_MOST_NEGATIVE_FIXNUM by various methods. 2011-01-28 Mark H Weaver <mhw@netris.org> note inf? / nan? domain in NEWS * NEWS: Add NEWS entry. 2011-01-28 Andy Wingo <wingo@pobox.com> domain of inf?, finite?, nan? is the real numbers * libguile/numbers.c (scm_inf_p, scm_finite_p, scm_nan_p): The domain of these functions is the real numbers. Error on other input. * doc/ref/api-data.texi (Reals and Rationals): Update the documentation accordingly. * test-suite/tests/numbers.test ("finite?", "inf?"): Update tests. 2011-01-28 Mark H Weaver <mhw@netris.org> Remove useless code from do_divide * libguile/numbers.c (do_divide): Remove code which handled a case that never occurs: a zero bignum. 2011-01-28 Mark H Weaver <mhw@netris.org> Optimize scm_exact_p by making use of SCM_INEXACTP * libguile/numbers.c (scm_exact_p): Optimize by making use of the SCM_INEXACTP macro. (scm_inexact_p): Move it next to scm_exact_p, and add else's. * test-suite/tests/numbers.test: Add test cases for `exact?' and `inexact?' applied to infinities and NaNs. 2011-01-28 Mark H Weaver <mhw@netris.org> Implement `finite?' in core and fix R6RS `finite?' and `infinite?' * libguile/numbers.c (scm_finite_p): Add new predicate `finite?' from R6RS to guile core, which returns #t if and only if its argument is neither infinite nor a NaN. Note that this is not the same as (not (inf? x)) or (not (infinite? x)), since NaNs are neither finite nor infinite. * test-suite/tests/numbers.test: Add test cases for `finite?'. * module/rnrs/base.scm: Import `inf?' as `infinite?' instead of reimplementing it. Previously, the R6RS implementation of `infinite?' did not detect non-real complex infinities, nor did it throw exceptions for non-numbers. (Note that NaNs _are_ considered numbers by scheme, despite their name). Import `finite?' instead of reimplementing it. Previously, the R6RS implementation of `finite?' returned #t for both NaNs and non-real complex infinities, in violation of R6RS. * NEWS: Add NEWS entries, and reorganize existing numerics-related entries together under one subheading. * doc/ref/api-data.texi (Real and Rational Numbers): Add docs for `finite?' and scm_finite_p. 2011-01-28 Mark H Weaver <mhw@netris.org> Add SCM_INUM1 to numbers.h, and make use of it and SCM_INUM0 in numbers.c * libguile/numbers.h: Add SCM_INUM1, a name for the fixnum 1. This is analogous to SCM_INUM0, a name for 0, which already existed. * libguile/numbers.c: Change occurrences of SCM_I_MAKINUM (0) and SCM_I_MAKINUM (1) to SCM_INUM0 and SCM_INUM1, respectively. 2011-01-28 Mark H Weaver <mhw@netris.org> Fix NEWS entry regarding changes to `expt' for zero base NEWS: Fix NEWS entry regarding changes to `expt' when base is zero Do not apply `inf?' or `nan?' to strings * module/ice-9/format.scm (format): Test to make sure an argument is a number before applying `inf?' and `nan?' to it. Formerly, format would call `inf?' and `nan?' on arguments that might be either a number or a string, although those predicates should ideally throw an exception when applied to non-number objects. Fix incorrect FUNC_NAME for scm_current_processor_count * libguile/posix.c (scm_current_processor_count): Fix incorrect FUNC_NAME (was s_scm_total_processor_count) 2011-01-27 Andy Wingo <wingo@pobox.com> fix guile-tools getopt * meta/guile-tools.in (getopt): Define a local version of getopt that stops parsing options when it sees a non-option. fix THANKS * THANKS: Fix. 2011-01-27 Andy Wingo <wingo@pobox.com> for mmap objcodes, store the fd in the third word, as a scheme int This leaves space for native code. * libguile/objcodes.h (SCM_OBJCODE_NATIVE_CODE) (SCM_SET_OBJCODE_NATIVE_CODE): Reserve the fourth word of objcode for "native code", whatever that means. * libguile/objcodes.c: Update a comment. (make_objcode_by_mmap): Put the fd in the third word. 2011-01-27 Andy Wingo <wingo@pobox.com> objcode type is an enumeration, not flags * libguile/objcodes.h (SCM_OBJCODE_TYPE_MMAP) (SCM_OBJCODE_TYPE_BYTEVECTOR, SCM_OBJCODE_TYPE_SLICE) (SCM_OBJCODE_TYPE_STATIC): Enumerate objcode types instead of expressing them as flags. (SCM_OBJCODE_TYPE): Type is held in bits 8-15. (SCM_OBJCODE_FLAGS): Flags are now shifted by 16 bits, not 8. (SCM_MAKE_OBJCODE_TAG): New helper. * libguile/continuations.c (STATIC_OBJCODE_TAG): * libguile/control.c (STATIC_OBJCODE_TAG): * libguile/foreign.c (STATIC_OBJCODE_TAG): * libguile/gsubr.c (STATIC_OBJCODE_TAG): * libguile/smob.c (STATIC_OBJCODE_TAG): * libguile/objcodes.c (make_objcode_by_mmap, scm_c_make_objcode_slice) (scm_bytecode_to_objcode): : Use SCM_MAKE_OBJCODE_TAG. 2011-01-27 Andy Wingo <wingo@pobox.com> guile-tools gracefully errors for missing scripts * meta/guile-tools.in (find-script): Use the #:ensure arg of resolve-module. (main): Display a comprehensible error message if we don't find a script. guile-tools uses getopt-long * meta/guile-tools.in: Use getopt-long. guile-tools uses srfi-1 * meta/guile-tools.in (guile-tools): Use srfi-1 here, now that we can. 2011-01-27 Andy Wingo <wingo@pobox.com> fix error handling in variable-ref family of instructions * libguile/vm-i-system.c (variable-ref, variable-set, variable-bound?): Check that the argument is actually a variable. Thanks to Kevin Holmes for the report. * libguile/vm-engine.c (vm_engine): Error handling down here. * THANKS: Update. 2011-01-27 Ludovic Courtès <ludo@gnu.org> Use `scm_from_latin1_stringn' in `objcodes.c'. * libguile/objcodes.c (make_objcode_by_mmap): Use `scm_from_latin1_stringn', not `scm_from_locale_stringn', to display the invalid cookie in the error case. Fix buffer overflow in `read-line'. * libguile/rdelim.c (SCM_DEFINE): Compare INDEX to LINE_BUFFER_SIZE, not `sizeof (buf)'. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Add ECMAScript parser tests. * test-suite/tests/ecmascript.test ("parser"): Add parser tests for the previous fixes. 2011-01-26 Noah Lavine <nlavine@haverford.edu> Parse Decimal Numbers * module/language/ecmascript/parse.scm: handle numbers with leading decimals correctly. Fix Hex Constants * module/language/ecmascript/tokenize.scm: hexadecimal constants can now use 'X' in addition to 'x'. Ecmascript Syntax * module/language/ecmascript/tokenize.scm: an unbreakable space counts as whitespace. Ecmascript Syntax Fix * module/language/ecmascript/parse.scm: allow empty function bodies. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Add a `read-line' benchmark. * benchmark-suite/benchmarks/ports.bm ("rdelim"): New benchmark prefix. Tweak `read-line'. * libguile/rdelim.c (LINE_BUFFER_SIZE): Set to 1 KiB instead of 4 KiB. (scm_read_line): Initialize STRING to #f so we actually use the fast path. 2011-01-26 Andy Wingo <wingo@pobox.com> more sensible error if compiled-file-name returns false in compile-file * module/system/base/compile.scm (compile-file): Error if no output-file is given and compiled-file-name returns false. fix THANKS * THANKS: Fix Hans' surname. fix error-handling of apply to non-list * libguile/vm-engine.c (vm_error_apply_to_non_list): Sync registers before erroring. Fix type of finish_args. Thanks to Hans Aberg for the report. update README for copyright year ranges * README: Add note about copyright year ranges. Remove reference to guile-tut.info. 2011-01-26 Andy Wingo <wingo@pobox.com> fix format ~f documentation for width combined with overflowchar * doc/ref/misc-modules.texi (Formatted Output): Adapt ~f documentation to indicate that the output will always have a decimal point. Thanks to Fu-gangqiang for the report. * THANKS: Update. 2011-01-26 Julian Graham <julian.graham@aya.yale.edu> Additional documentation for symbol manipulation functions. * doc/ref/api-data.texi (Symbol Primitives): Document `symbol', `list->symbol', and `symbol-append'. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Rewrite `read-line' in terms of `scm_getc'. As a result `read-line' handles decoding and decoding errors the same way as `scm_getc'. It's also simpler and free of `malloc' calls. * libguile/rdelim.c (scm_do_read_line): Remove. (scm_read_line): Rewrite as a loop that calls `scm_getc'. * test-suite/tests/rdelim.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/rdelim.test'. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Have `scm_getc' honor the port's conversion strategy. * libguile/ports.c (get_codepoint): Reset `pt->input_cd' upon failure. If `pt->ilseq_handler' is `SCM_ICONVEH_QUESTION_MARK', then return a question mark. [failure]: Use `scm_encoding_error' when raising an error. * test-suite/lib.scm (exception:encoding-error): Adjust regexp. * test-suite/tests/ports.test ("string ports")["read-char, wrong encoding, error", "read-char, wrong encoding, escape", "read-char, wrong encoding, substitute"]: New tests. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Test substitution and escaping on port output. * test-suite/tests/ports.test ("string ports")["wrong encoding, substitute", "wrong encoding, escape"]: New tests. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Add `scm_{to,from}_utf32_string'. * libguile/strings.c (scm_from_utf32_string, scm_from_utf32_stringn, scm_to_utf32_string, scm_to_utf32_stringn): New functions. * libguile/strings.h (scm_from_utf32_string, scm_from_utf32_stringn, scm_to_utf32_string, scm_to_utf32_stringn): New declarations. * doc/ref/api-data.texi (Conversion to/from C): Document `scm_{to,from}_{utf8,utf32}_stringn'. 2011-01-26 Ludovic Courtès <ludo@gnu.org> Optimize `scm_{to,from}_latin1_string'. * libguile/strings.c (scm_from_latin1_stringn): Directly return a narrow string instead of going through `scm_from_stringn'. (scm_to_latin1_stringn): Directly return a copy of STR's raw bytes when it's narrow. 2011-01-25 Andy Wingo <wingo@pobox.com> stexi->shtml supports itemx * module/texinfo/html.scm (entry, rules): Allow @itemx, 2011-01-24 Ludovic Courtès <ludo@gnu.org> Install the current locale when starting the REPL. * module/ice-9/top-repl.scm (top-repl): Install the current locale. Remove useless branches in the port code. * libguile/ports.c (scm_i_get_port_encoding): Remove useless `if'. (scm_set_port_encoding_x): Remove redundant `find_valid_encoding' call. Always initialize a port's encoding name. * libguile/ports.c (scm_i_set_port_encoding_x): Always initialize PT->encoding to something non-NULL. This fixes callers of `scm_encoding_error' such that they always pass a non-NULL encoding name. Reported by Matei Conovici. 2011-01-24 Andy Wingo <wingo@pobox.com> update the man page * doc/guile.1: Update a bit. 2011-01-24 Ludovic Courtès <ludo@gnu.org> Choose the input source file encoding in a locale-independent way. This is so that compiling the same code on environments with different locale settings yields the same result. * module/system/base/compile.scm (compile-file): When ENC if #f, default to "UTF-8" instead of `(fluid-ref %default-port-encoding)'. * doc/ref/api-evaluation.texi (Compilation): Document the default output file name and default source file encoding for `compile-file' and `guile-tools compile'. 2011-01-23 Ludovic Courtès <ludo@gnu.org> Remove unexpected non-ASCII character. * module/language/tree-il/fix-letrec.scm: Replace U+2019 with an ASCII quote. The iconv implementation on FreeBSD would immediately notice and bail out when reading it under a US-ASCII locale. Rewrite `scm_lfwrite_substr' in terms of `scm_display'. * libguile/ports.c (scm_lfwrite_substr): Rewrite in terms of `scm_display'. 2011-01-23 Ludovic Courtès <ludo@gnu.org> Remove `scm_lfwrite_str'. * libguile/ports.c (scm_lfwrite_str): Remove. * libguile/ports.h (scm_lfwrite_str): Remove declaration. * libguile/numbers.c (scm_i_print_fraction): Use `scm_display' instead of `scm_lfwrite_str'. 2011-01-23 Ludovic Courtès <ludo@gnu.org> Augment `THANKS'. 2011-01-23 Ludovic Courtès <ludo@gnu.org> Hide the string escaping hacks. * libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes): Rename to... (unistring_escapes_to_guile_escapes): ... this. Make `static'. (scm_i_unistring_escapes_to_r6rs_escapes): Rename to... (unistring_escapes_to_r6rs_escapes): ... this. Make `static'. * libguile/strings.h (scm_i_unistring_escapes_to_guile_escapes, scm_i_unistring_escapes_to_r6rs_escapes): Remove declarations. 2011-01-23 Ludovic Courtès <ludo@gnu.org> Rewrite `read-char', `display', etc. using iconv calls instead of libunistring. Thanks to Bruno Haible for his suggestions. See <http://lists.gnu.org/archive/html/bug-libunistring/2010-09/msg00007.html>, for details. * libguile/ports.c (register_finalizer_for_port): Always register a finalizer for PORT. (finalize_port): Close ENTRY->input_cd and ENTRY->output_cd. (scm_new_port_table_entry): Initialize the `input_cd' and `output_cd' fields. (utf8_to_codepoint): New function. (get_codepoint): Rewrite to use `iconv' instead of libunistring. (scm_i_set_port_encoding_x): Initialize the `input_cd' and `output_cd' fields. (update_port_lf): Move upward. Use `switch' instead of `if's. * libguile/ports.h (scm_t_port)[input_cd, output_cd]: New fields. * libguile/print.c (codepoint_to_utf8, display_string): New functions. (display_character): Use `display_string'. (write_combining_character): Likewise. (iprin1): Use `display_string' instead of `scm_lfwrite_str', and `display_character' instead of `scm_putc'. (write_character): Likewise. (write_character_escaped): New function. * test-suite/tests/encoding-escapes.test ("display output escapes")["Rashomon"]: Use lower-case escapes. ["fake escape"]: New test. 2011-01-23 Andy Wingo <wingo@pobox.com> infinities are no longer integers * libguile/numbers.c (scm_is_integer): Infinities are not integers, per the R6RS. (scm_even_p, scm_odd_p): Passing an infinity to even? or odd? is an error. * test-suite/tests/numbers.test ("integer?"): Adapt test. ("expt"): Add tests for +inf.0 and -inf.0 exponents. * NEWS: Add NEWS entries. 2011-01-22 Andy Wingo <wingo@pobox.com> web.texi fix * doc/ref/web.texi (HTTP Headers): Fix transfer-encoding example. 2011-01-22 Andy Wingo <wingo@pobox.com> scm_with_guile calls GC_call_with_gc_active * configure.ac: Check for GC_call_with_gc_active. * libguile/threads.h (scm_i_thread): Remove "top", as it's not used. * libguile/threads.c (with_gc_inactive, with_gc_active): Define shims to GC_do_blocking and GC_call_with_gc_active. (scm_i_init_thread_for_guile): Don't do thread base adjustment here, do it in scm_i_with_guile_and_parent. The previous logic would never be run. (scm_i_with_guile_and_parent): If we enter Guile mode, leave it too. Take care of adjusting the thread stack base here too. Also, call with_gc_active. (scm_without_guile): Refactor. 2011-01-21 Andy Wingo <wingo@pobox.com> update NEWS for hungry-eol-escapes * NEWS: Update for hungry-eol-escapes. document hungry-eol-escapes * doc/ref/api-data.texi (String Syntax): Document hungry-eol-escapes. * doc/ref/api-evaluation.texi (Scheme Read): * doc/ref/api-options.texi (Runtime Options): Update read-options 'help output. 2011-01-21 Andy Wingo <wingo@pobox.com> implement r6rs hungry escaped EOL * libguile/private-options.h (SCM_HUNGRY_EOL_ESCAPES_P): New private option. * libguile/read.c: Define SCM_HUNGRY_EOL_ESCAPES_P, defaulting to #f. (skip_intraline_whitespace): New helper. (scm_read_string): If SCM_HUNGRY_EOL_ESCAPES_P, skip_intraline_whitespace after an escaped EOL. * test-suite/tests/reader.test ("read-options"): Add test. 2011-01-21 Andy Wingo <wingo@pobox.com> implement port-eof? * module/rnrs/io/ports.scm (port-eof?): Implement. * module/rnrs.scm: Re-export port-eof?. * test-suite/tests/r6rs-ports.test ("7.2.5 End-of-File Object"): Add test. Thanks to Göran Weinholt for the report. 2011-01-20 Andy Wingo <wingo@pobox.com> add NEWS for expt change * NEWS: Update for Mark's expt patch. update NEWS for 1.9.14 * NEWS: Fold 1.9.14 entries into main text. 2011-01-20 Mark H Weaver <mhw@netris.org> Fix bugs in expt and integer-expt * libguile/numbers.c (scm_expt): Fix bug that caused expt to throw an exception whenever the base was exact and the exponent was an inexact integer, e.g. (expt 5 6.0). (scm_expt): Fix bug that caused expt to introduce spurious imaginary parts in the result when the base was an inexact negative real and the exponent was an integer, e.g. (expt -1.0 2) (scm_integer_expt, scm_expt): Change behavior of (integer-expt 0 -1), and therefore also (expt 0 -1), to return NaN, per R6RS (actually, R6RS says we should throw an exception or return an "unspecified number object", but for now we use NaN). Formerly we returned 0, per R5RS. R5RS claims that 0^x=0 for all non-zero x, but that's mathematically incorrect, and probably an oversight. (scm_integer_expt): Consistently throw a wrong-argument-type exception when the exponent is inexact. Formerly, it didn't always check this if the base was 0, 1, or -1. * test-suite/tests/numbers.test ("integer-expt", "expt"): Add tests. 2011-01-17 Noah Lavine <nlavine@haverford.edu> Add ECMAScript Unicode literal support * module/language/ecmascript/tokenize.scm: add unicode literals * test-suite/tests/ecmascript.test ("parser"): Add new tests for Latin-1 and Unicode escapes in string literals. 2011-01-15 Neil Jerram <neil@ossau.uklinux.net> Add "REPORTING BUGS" and "COPYING" sections to Guile man page Thanks to Mark Harig for the suggestion. * doc/guile.1: Added "REPORTING BUGS" and "COPYING" sections, modelled on those in the Emacs man page. 2011-01-15 Neil Jerram <neil@ossau.uklinux.net> Document missing Guile command line options Thanks to Mark Harig for pointing this out and suggesting the text. * doc/ref/scheme-scripts.texi (Invoking Guile): Mention --autocompile and --no-autocompile. 2011-01-15 Neil Jerram <neil@ossau.uklinux.net> Manual page fixes Thanks to Mark Harig for pointing these out. * doc/guile.1: Remove mention of the tutorial, since it no longer exists (as a separate document). Document the -q option. * THANKS: Add Mark Harig. 2011-01-14 Neil Jerram <neil@ossau.uklinux.net> Confront the MOP * doc/ref/goops.texi (The Metaobject Protocol): Bring forward to before `Class Options', and add intro text to explain why. All of the sections now remaining are ones where the MOP is more likely to be relevant than not. Move `GOOPS Error Handling' to after `Introspection' * doc/ref/goops.texi (GOOPS Error Handling): Move to just after `Introspection'. Move `Handling Slot Access Errors' inside `Accessing Slots' * doc/ref/goops.texi (Accessing Slots): Move `Handling Slot Access Errors' here; update relevant references. Merge small sections into `GOOPS Object Miscellany' * doc/ref/goops.texi (GOOPS Object Miscellany): New section, combining previous `Object Comparison', `Cloning Objects' and `Write and Display'. Replace `Object Comparison' text with something that makes sense. Add a snippet to the end of the write/display section. Remove content-free `Generic Functions and Accessors' * doc/ref/goops.texi (GOOPS): Remove `Generic Functions and Accessors'. There was nothing here that wasn't better covered elsewhere. Move `Accessing Slots' inside `Introspection'. * doc/ref/goops.texi (Introspection): Move `Accessing Slots' into here, and flatten it, except for `Handling Slot Access Errors'. (GOOPS Error Handling): Move `Handling Slot Access Errors' here. Reorder `Introspection' * doc/ref/goops.texi (Instances): Move `Instances' before `Slots', as it feels more important. Edit `Introspection' * doc/ref/goops.texi (Introspection): Make a bit snappier. (Classes): Add intro. Remove "the" and "metaobject" everywhere. Remove `class-environment', since I don't know what it's useful for. (Instances): Remove implementation notes. (Built-in classes): Merge with `Instances'. Reorder text points. (Generic Functions): Add intro. Remove "the" and "metaobject" everywhere. (Generic Function Methods): Merge with `Generic Functions'. Move `Introspection' earlier * doc/ref/goops.texi (Introspection): Move to after `Generic Functions and Methods'. The idea is to have all of that sections that make sense without needing to understand the MOP, before sections that really depend on the MOP. 2011-01-13 Neil Jerram <neil@ossau.uklinux.net> Improve doc on generic functions and inheritance * doc/ref/goops.texi (Methods and Generic Functions): More explanation of generic function invocation. Created (or moved) subsections here to cover material on the following that was previously spread elsewhere: accessors; extending primitives; merging generics; generic function examples; handling invocation errors. Edited for clarity throughout. (Generic functions and methods, Example): Nodes deleted, with their material incorporated above. (Class Precedence List): Edited to improve clarity. (Sorting Methods): New subsection. 2011-01-11 Andy Wingo <wingo@pobox.com> web.texi defun -> deffn * doc/ref/web.texi (URIs): Change instances of @defun to @deffn with {Scheme Procedure}. more web.texi foo * doc/ref/web.texi (Web Server, Web Examples): Update. update web.text documentation for requests and responses * doc/ref/web.texi (Requests, Responses): Update, and add a note on character encodings. 2011-01-11 Andy Wingo <wingo@pobox.com> request and response cleanups * module/web/request.scm (build-request): Make URI a positional argument. * module/web/response.scm: Remove extend-response. (read-response): Fix a docstring. * module/web/server.scm (extend-response): Include extend-response here, but not exported. 2011-01-11 Andy Wingo <wingo@pobox.com> (web response) and (web request): bodies are bytevectors * module/web/request.scm (read-request-body, write-request-body): Rename from read-request-body/bytevector and write-request-body/bytevector. Remove the /latin-1 variants, as they were unused and a bad idea. * module/web/response.scm (read-response-body, write-response-body): Likewise. * module/web/server/http.scm (http-read, http-write): Adapt to request/response change. * test-suite/tests/web-request.test: * test-suite/tests/web-response.test: Update tests. 2011-01-10 Andy Wingo <wingo@pobox.com> update web.texi for (web http) changes * doc/ref/web.texi (HTTP Headers): Update to reflect current code, and to reformat. Not sure if it's an improvement... parse credentials and challenges * module/web/http.scm (parse-credentials, validate-credentials) (write-credentials, parse-challenge, parse-challenges) (validate-challenges, write-challenge, write-challenges) (declare-credentials-header!, declare-challenge-list-header!): New helpers. ("Authorization", "Proxy-Authorization"): Parse out credentials. ("Proxy-Authenticate", "WWW-Authenticate"): Parse out challenges. 2011-01-09 Andy Wingo <wingo@pobox.com> more symbols in (web http) * module/web/http.scm (declare-symbol-list-header!): New helper. ("Connection"): Redefine as a header list. ("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol lists. * test-suite/tests/web-http.test: * test-suite/tests/web-response.test: Adapt tests. 2011-01-09 Andy Wingo <wingo@pobox.com> (web http): keys are always symbols * module/web/http.scm (parse-media-type): Parse media types as symbols. (parse-key-value-list, parse-param-component, parse-param-list): Change kons to val-parser. Always parse keys as symbols, and always either cons, if there is a val, or just have the key, if there is no val. Easier to explain and just as correct. (declare-param-list-header!, declare-key-value-list-header!): Adapt to key-list and param-list kons change. ("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect") ("TE"): Likewise, adapt. ("Content-Type"): Param keys are symbols. update (web http) docs * doc/ref/web.texi (HTTP): Update docs to correspond with current code. 2011-01-08 Andy Wingo <wingo@pobox.com> (web http): don't expose header-decl objects * module/web/http.scm: Change to not expose the header-decl objects, instead exposing header-parse, header-validator, header-writer et al. Explaining header decls in the manual was too complicated. (string->header, header->string): New helpers. (<header-decl>): Remove the `sym' field. (declare-header!): Adapt to header-decl change, and use string->header. (known-header?, header-parser, header-validator, header-writer): New procedures. Adapt to use the new procedures internally. 2011-01-08 Andy Wingo <wingo@pobox.com> (web http): header names always represented as symbols * module/web/http.scm (declare-header!): No need to specify `sym', as it can be derived from `name'. Change to take parser, validator, and writer as positional arguments, and multiple? as a keyword. (parse-header): Change to take the header as a symbol already, and just return the parsed value. All headers are symbols now, including unknown headers. I feel OK doing this given that the symbol GC works now. (lookup-header-decl): Only look up headers by symbol. (read-header): Adapt to parse-header change. (valid-header?, write-header): Adapt to all headers being symbols. (split-header-names, list-of-header-names?, write-header-list): Represent all header names as symbols. (declare-opaque-header!, declare-date-header!) (declare-string-list-header!, declare-header-list-header!) (declare-integer-header!, declare-uri-header!) (declare-quality-list-header!, declare-param-list-header!) (declare-key-value-list-header!, declare-entity-tag-list-header!): Change to be functions instead of syntax, and no need to specify the symbolic name. Update all header declarations accordingly. * module/web/request.scm (validate-headers): * module/web/response.scm (validate-headers): Adapt to all headers being symbols. * test-suite/tests/web-http.test (pass-if-parse, pass-if-any-error) (pass-if-parse-error): Update for parse-header change. ("general headers"): Update header list examples to be all symbols. 2011-01-08 Andy Wingo <wingo@pobox.com> fix scm_from_stringn empty string case * libguile/strings.c (scm_from_stringn): Fix empty string case (oops...). fix tab completion in repl (doh) * libguile/hashtab.c: Fix remaining vector hash table support. * module/ice-9/session.scm (apropos-fold): Use a hash table instead of a vector for the completions. 2011-01-07 Andy Wingo <wingo@pobox.com> revert unfinished web.texi changes These were prematurely committed in 17072fd2c6acad1d4f2b5c98eb0d62911ea07406. 2011-01-07 Andy Wingo <wingo@pobox.com> use scm_from_latin1_symboln for string literals and load-symbol * libguile/bytevectors.c: * libguile/eval.c: * libguile/goops.c: * libguile/i18n.c: * libguile/load.c: * libguile/memoize.c: * libguile/modules.c: * libguile/ports.c: * libguile/print.c: * libguile/procs.c: * libguile/programs.c: * libguile/read.c: * libguile/script.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/strings.c: * libguile/throw.c: * libguile/vm.c: Use scm_from_latin1_symboln to make symbols from string literals, because they aren't in the user's locale -- they are in ASCII, and we can optimize this case. * libguile/vm-i-loader.c: Also use scm_from_latin1_symboln when loading narrow symbols. 2011-01-07 Andy Wingo <wingo@pobox.com> optimize scm_from_latin1_symboln * libguile/symbols.c (lookup_interned_latin1_symbol): New helper. (scm_from_latin1_symboln): Use lookup_interned_latin1_symbol, so we avoid allocating a string in that case. lookup_interned_symbol uses get_handle_by_hash * libguile/symbols.c (lookup_interned_symbol): Change to use scm_hash_fn_get_handle_by_hash. add scm_hash_fn_get_handle_by_hash * libguile/hashtab.h: * libguile/hashtab.c (scm_hash_fn_get_handle_by_hash): New internal procedure, which should make symbol table lookup faster. remove vector hash table code * libguile/hashtab.c: Remove deprecated hash-tables-as-vectors support code. hashtab cleanups * libguile/hashtab.c: Update comments. (hashtable_size): Allow bigger vectors on 64-bit machines. fix symbol garbage collection * libguile/symbols.c (lookup_interned_symbol, intern_symbol): Refactor to use hashtab.[ch] interfaces. add hash functions for locale, latin1, and utf8 strings * libguile/hash.c (scm_i_locale_string_hash) (scm_i_latin1_string_hash, scm_i_utf8_string_hash): New functions. multibyte regex error handling fix * libguile/regex-posix.c (fixup_multibyte_match): Fix mbrlen error handling. hash.c cleanup * libguile/hash.c (scm_hasher): Remove needless remember_upto_here. add scm_from_{latin1,utf8}_symbol{n,} * libguile/symbols.c (scm_from_latin1_symbol, scm_from_latin1_symboln) (scm_from_utf8_symbol, scm_from_utf8_symboln): New functions. 2011-01-07 Andy Wingo <wingo@pobox.com> add scm_{to,from}_{utf8,latin1}_string{n,} * libguile/strings.h: * libguile/strings.c (scm_from_latin1_string, scm_to_latin1_string): New functions, in terms of the latin1_stringn variants. (scm_from_utf8_string, scm_from_utf8_stringn) (scm_to_utf8_string, scm_to_utf8_stringn): New functions. (scm_i_from_utf8_string, scm_i_to_utf8_string): Removed these internal functions. (scm_from_stringn): Handle -1 as a length. Unlike the previous behavior of scm_from_locale_string (NULL), which returned the empty string, we now raise an error. The null pointer is not the same as the empty string. * libguile/stime.c (scm_strftime, scm_strptime): Adapt to publishing of utf8 functions. 2011-01-07 Andy Wingo <wingo@pobox.com> read-header returns EOF at end, update (web http) docs * doc/ref/web.texi (HTTP): Add an example for declaring a header, and adapt to read-header change. * module/web/http.scm (read-header): Return EOF for both values if there are no more headers, instead of #f. (read-headers): Adapt. 2011-01-07 Andy Wingo <wingo@pobox.com> update URI documentation * doc/ref/web.texi (Types and the Web): Fix spacing. (URIs): Give default values, and clarify a number of procedure docs. Update "encoding" name, and string->uri name. uri-encode fast path * module/web/uri.scm (uri-encode): Add a fast-path for the common case in which the string does not contain any reserved characters. uri-decode #:encoding, not #:charset * module/web/uri.scm (call-with-encoded-output-string, encode-string) (decode-string, uri-decode, uri-encode): Change all instances of "charset" to "encoding", as variables and arguments. 2011-01-07 Andy Wingo <wingo@pobox.com> rename string->uri and uri->string. * module/web/uri.scm (string->uri, uri->string): Rename from parse-uri and unparse-uri. * test-suite/tests/web-uri.test: * module/web/http.scm: All callers changed. 2011-01-07 Andy Wingo <wingo@pobox.com> clarify uri fragment discussion * doc/ref/web.texi (URIs): Clarify the discussion of URI fragments. rewrite web.texi intro * doc/ref/web.texi (Web): Rewrite the intro. (Types and the Web): New subsection, a mini-rant. 2011-01-05 Ludovic Courtès <ludo@gnu.org> Tiny style improvement in the ECMAScript compiler. Followup to 8891bd1b166b7210c241a0c1a730fc3af7f45b8a ("Fix ECMAScript object creation."). * module/language/ecmascript/compile-tree-il.scm (comp): Use `@implv' for `new-object'. Suggested by Kan-Ru Chen <kanru@kanru.info>. 2011-01-05 Ludovic Courtès <ludo@gnu.org> Change `getaddrinfo' test to handle the GNU-specific `EAI_NODATA'. * doc/ref/posix.texi (Network Databases): Mention `EAI_NODATA'. * libguile/net_db.c (scm_getaddrinfo): Likewise for the docstring. * test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Handle `EAI_NODATA'. 2011-01-04 Noah Lavine <nlavine@haverford.edu> Fix ECMAScript object creation. * module/language/ecmascript/compile-tree-il.scm (compile-tree-il): generate correct tree-il for construction of new objects. * test-suite/tests/ecmascript.test (ecompile): Add pattern with EXPECTED omitted. ("compiler"): test whether we generate new objects correctly. 2011-01-04 Ludovic Courtès <ludo@gnu.org> Document `scm_misc_error' (bug #31969). * doc/ref/api-control.texi (Handling Errors): Add `scm_misc_error'. Suggested by Bake Timmons <b3timmons@speedymail.org> (bug #31969). 2011-01-04 Ludovic Courtès <ludo@gnu.org> Improve doc of `string-index', `string-index-right', and `string-rindex'. Suggested by Noah Lavine <noah.b.lavine@gmail.com>. * doc/ref/api-data.texi (String Searching): Mention the return value of `string-index', `string-index-right', and `string-rindex' when no match is found. * libguile/srfi-13.c (scm_string_index, scm_string_index_right, scm_string_rindex): Adjust docstring accordingly. 2010-12-23 Neil Jerram <neil@ossau.uklinux.net> Manual typo fix * doc/ref/api-overview.texi (API Overview): bot -> but 2010-12-21 Ludovic Courtès <ludo@gnu.org> Have `lookahead-u8' and `get-u8' actually do binary input. * libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_get_byte_or_eof' instead of `scm_peek_char'. (scm_get_u8): Likewise. * test-suite/tests/r6rs-ports.test ("7.2.8 Binary Input")["lookahead-u8"]: Fix typo. ["lookahead-u8 non-ASCII"]: New test. 2010-12-20 Ludovic Courtès <ludo@gnu.org> Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'. See <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24225> for details. * lib/unistr.in.h: Change #if's into #ifdef's. 2010-12-20 Ludovic Courtès <ludo@gnu.org> Update Gnulib to v0.0-4544-gce083ca. 2010-12-18 Andy Wingo <wingo@pobox.com> format handles ~@c better * module/ice-9/format.scm (format): Fix ascii-ism in ~@c. Pull flush-output? into the let*. more format tweaks * module/ice-9/format.scm (format): Strip format: prefix from port and output-col. more format tweaks * module/ice-9/format.scm (format): Move the port and output-col to let* vars, again removing a set!. We will probably move more state vars to the let*, to let the procedures exist in a more fixed-point style. take advantage of letrec* in format * module/ice-9/format.scm (format): Take advantage of letrec* internal expansion, and so have fewer set! invocations. inline format:out into format * module/ice-9/format.scm (format): Inline format:out into the body. more format cleanups * module/ice-9/format.scm (format): Remove the need to save a copy of the incoming arguments, because they are available as local variables. Do the check early for the format-string actually being a string. format's first arg is "destination" * module/ice-9/format.scm: The argument to format is "destination", not "port". Fix this newly reintroduced buglet. inline format:format into format * module/ice-9/format.scm (format): Inline format:format body. 2010-12-18 Andy Wingo <wingo@pobox.com> deprecate omission of port to ice-9 format * module/ice-9/format.scm (format): Add port and format-string as formal arguments. Seems also to have triggered a reindent. Formally deprecate omitting the port, as it's usually an error. * test-suite/tests/format.test ("format basic output") ("format basic output", "~{ iteration"): Fix up tests that omitted the destination port. 2010-12-18 Andy Wingo <wingo@pobox.com> letrec -> internal definitions in format.scm * module/ice-9/format.scm (format): Change from letrec to internal definitions, and use the define (foo ...) .. shorthand. No semantic change. format.scm cleanups * module/ice-9/format.scm (format:symbol-case-conv) (format:iobj-case-conv): Remove these exports, they were not used. (format:expch): Remove this one, though it was used. (format:floats, format:complex-numbers, format:radix-pref): Inline these "configuration variables" into the format body. ice-9 format license update * module/ice-9/format.scm: A more standard copyright header, with LGPLv3+ instead of public domain. Update define-module block. 2010-12-17 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.14. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Tweak `NEWS'. * NEWS: Update. futures: Store pending futures in a queue. * module/ice-9/futures.scm (%futures): Change from a list to a queue. (register-future!, process-futures, touch): Adjust accordingly. (unregister-future!): Remove. Clarify doc regarding threading of `par-map' and `par-for-each'. * doc/ref/api-scheduling.texi (Parallel Forms): Refine wording for `par-map' and `par-for-each'. 2010-12-17 Andy Wingo <wingo@pobox.com> add www-commit rule in doc/ref * doc/ref/Makefile.am (www-commit): Add rule to update docs on web site. 2010-12-17 Ludovic Courtès <ludo@gnu.org> Remove conflicting `scm_is_string' declaration. * libguile/strings.h: Move `scm_is_string' declaration... * libguile/inline.h: ... here. Reported by Noah Lavine <noah.b.lavine@gmail.com>. 2010-12-17 Andy Wingo <wingo@pobox.com> fix unbound fluid tests * test-suite/tests/fluids.test: Fix tests. update NEWS * NEWS: Update. guile-user has no filename * module/ice-9/boot-9.scm (guile-user): Set #:filename to #f for guile-user module, as guile-user isn't really associated with any file. 2010-12-17 Andy Wingo <wingo@pobox.com> add ,reload meta-command and document it and reload-module * module/ice-9/boot-9.scm (reload-module): Add docstring. * module/system/repl/command.scm (reload): New meta-command. * doc/ref/scheme-using.texi (Module Commands): Document the ,reload meta-command. * doc/ref/api-modules.texi (Module System Reflection): Document reload-module. 2010-12-17 Andy Wingo <wingo@pobox.com> document variable-unset! * doc/ref/api-modules.texi (Variables): Document variable-unset!. * NEWS: Update. 2010-12-17 Andy Wingo <wingo@pobox.com> document make-unbound-fluid et al * doc/ref/api-scheduling.texi (Fluids and Dynamic States): Document the new fluid routines. * NEWS: Update. 2010-12-17 Andy Wingo <wingo@pobox.com> rename make-undefined-fluid to make-unbound-fluid * libguile/fluids.c (scm_make_unbound_fluid): Rename from scm_make_undefined_fluid. * libguile/fluids.h: * module/language/elisp/runtime.scm: Update referrers. 2010-12-17 Andy Wingo <wingo@pobox.com> multicast manual updates * doc/ref/posix.texi (Network Sockets and Communication): Add IP_MULTICAST_TTL and IP_MULTICAST_IF docs, from the docstring. * NEWS: Update. 2010-12-17 Andy Wingo <wingo@pobox.com> more web.texi "hacking" * doc/ref/web.texi (Web Server, Web Examples): Finish these sections. build-response validates headers * module/web/response.scm (build-response): Add some validation, like for build-request. 2010-12-16 Ludovic Courtès <ludo@gnu.org> Implement `(ice-9 threads)' high-level constructs in terms of futures. * module/ice-9/threads.scm (parallel, par-mapper): Rewrite in terms of `future' and `touch'. * test-suite/tests/threads.test ("par-map", "par-for-each"): New test prefixes. * doc/ref/api-scheduling.texi (Parallel Forms): Add cross-ref to futures. Recommend against the `n-' variants. 2010-12-16 Ludovic Courtès <ludo@gnu.org> futures: Support multiple-value returns. * module/ice-9/futures.scm (process-future!): Use `call-with-values' when invoking `(future-thunk future)'. * test-suite/tests/future.test ("futures")["multiple values"]: New test. 2010-12-16 Ludovic Courtès <ludo@gnu.org> futures: Fix potential deadlock. * module/ice-9/futures.scm (process-futures): Fix potential deadlock, whereby %FUTURES-MUTEX would be acquired *after* FUTURE's mutex. Rehash weak hash tables less frequently. * libguile/hashtab.c (weak_bucket_assoc): Call `scm_i_rehash' only when REMAINING is below `SCM_HASHTABLE_LOWER (table)'. 2010-12-16 Ludovic Courtès <ludo@gnu.org> Fix `hash' for pointer objects. Previously all pointer objects would hash to the same value. * libguile/hash.c (scm_hasher): Add case for `scm_tc7_pointer'. 2010-12-16 Ludovic Courtès <ludo@gnu.org> Inline `scm_is_string'. * libguile/strings.c (scm_is_string): Move to... * libguile/inline.h (scm_is_string): ... here. Inline. 2010-12-16 Ludovic Courtès <ludo@gnu.org> Add `compose', `negate', and `const'. * module/ice-9/boot-9.scm (compose, negate, const): New procedures. * doc/ref/api-procedures.texi (Higher-Order Functions): New node. * test-suite/Makefile.am (SCM_TESTS): Add `tests/procs.test'. * test-suite/tests/procs.test: New file. 2010-12-16 Andy Wingo <wingo@pobox.com> update web-response tests for http header parsing change * test-suite/tests/web-response.test ("example-1"): Update for change in parsing Vary header. update NEWS * NEWS: Update for Web documentation. more web.texi work * doc/ref/web.texi (Requests, Responses): Flesh out. (Web Examples): New section, replacing "Web Handlers". The only one that's not really written yet. add section on format of parsed http headers * doc/ref/web.texi (HTTP Headers): New section. Needs some examples, though. 2010-12-16 Andy Wingo <wingo@pobox.com> http: lists of header names parse better * module/web/http.scm (list-of-strings?, write-list-of-strings): Move definitions up. (split-header-names, list-of-header-names?, write-header-list): New helpers. (declare-header-list-header): New helper. (cache-control): Use split-header-names for private and no-cache. (trailer): Use declare-header-list-header to parse known headers to symbols. (vary): Likewise, use split-header-names et al. * test-suite/tests/web-http.test ("general headers"): Add a test. 2010-12-16 Andy Wingo <wingo@pobox.com> better cache-control: private, no-cache parsing * module/web/http.scm (cache-control): Parse private and no-cache better. * test-suite/tests/web-http.test ("general headers"): Update. fix web.texi * doc/ref/web.texi: Texinfo syntax fixen! update web.texi * doc/ref/web.texi (URIs, HTTP): Update these sections. 2010-12-16 Andy Wingo <wingo@pobox.com> add web.texi to manual * doc/ref/web.texi: New file, here to document the various (web ...) modules. Quite a rough beginning, but it is a start... * doc/ref/guile.texi: * doc/ref/Makefile.am: Add to manual. 2010-12-16 Andy Wingo <wingo@pobox.com> (web server) docstrings * module/web/server.scm: Docstrings in the house. docstrings in (web request) and (web response) * module/web/request.scm: * module/web/response.scm: Add docstrings. (web http) docstrings * module/web/http.scm: Add docstrings all around. document (web uri), and simplify uri-encode * module/web/uri.scm: Add docstrings. (uri-encode): Simplify. Not sure what I was thinking before. 2010-12-13 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update. fix bugs in primitive-poll * libguile/poll.c (scm_primitive_poll): Only mark POLLOUT for output ports. Don't override results from the syscall, add to them. 2010-12-12 Andy Wingo <wingo@pobox.com> fix testing code in web/server * module/web/server.scm (call-with-encoded-output-string): Fix some code I accidentally left in while testing. Re-tested the difference in speed; pleasantly surprised. * module/web/uri.scm: Make the same change here. 2010-12-12 Andy Wingo <wingo@pobox.com> foreign: c-struct parsing simplification * module/system/foreign.scm: Revert much of fb636a1cce. Short et al are not distinct types -- they are all aliases to e.g. int16. The only case that was not covered before was the pointer case. (bytevector-pointer-ref, bytevector-pointer-set!): Implement these, and use them for pointers. 1.9.13 news to main body * NEWS: Fold 1.9.13 text into the main text. http-read robustness * module/web/server/http.scm (http-read): Record the client index in more cases in which code could throw an error. 2010-12-11 Andy Wingo <wingo@pobox.com> (web uri) can uri-decode non-utf-8 payloads * module/web/uri.scm (call-with-encoded-output-string, encode-string): Copy from server.scm (decode-string): Copy from tekuti. (uri-decode): The #:charset arg is a string, like port-encoding. Support other charsets. (uri-encode): Charset is a string. Other encodings still not nicely supported. Hmm. 2010-12-10 Andy Wingo <wingo@pobox.com> add return/values hack to compile-glil for lua * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add a hack like 'return but for multiple values, for lua. rnrs control only depends on (guile) * module/rnrs/control.scm: Depend only on (guile). 2010-12-10 Andy Wingo <wingo@pobox.com> fix self-tail-calls for lexical procs with optional, rest, or kwargs * module/language/tree-il/compile-glil.scm (flatten-lambda): Don't emit a self-label, because when we can't match the args for a lexical call, we have no space to shuffle args and jump. (flatten): Apply the self-tail-call optimization to optional args too, but only if the procedure is fix-allocated. If we can't apply the optimization, use the normal tail-call sequence. * test-suite/tests/optargs.test ("lambda* inits"): Add tests. 2010-12-09 Andy Wingo <wingo@pobox.com> clarify compile-glil error messages * module/language/tree-il/compile-glil.scm (vars->bind-list, flatten): Make internal self-checking error messages more clear, for implementors of other languages. 2010-12-07 Andreas Rottmann <a.rottmann@gmx.at> Get rid of `define-macro' in the SRFI 26 implementation * module/srfi/srfi-26.scm (cut, cute): Implement using `syntax-case'. The new implementation is mostly just a transcription of the old code; the reference implementation which relies only on `syntax-rules' may (or may not) be considered more elegant :-). 2010-12-07 Ludovic Courtès <ludo@gnu.org> Use `current-processor-count' to determine the number of future-workers. * module/ice-9/futures.scm (%worker-count): Use `current-processor-count'. * doc/ref/api-scheduling.texi (Futures): Add note about side-effects and I/O. Mention `current-processor-count'. 2010-12-07 Ludovic Courtès <ludo@gnu.org> Add `total-processor-count' and `current-processor-count'. * libguile/posix.c (scm_total_processor_count, scm_current_processor_count): New functions. * libguile/posix.h (scm_total_processor_count, scm_current_processor_count): New declarations. * test-suite/tests/posix.test ("nproc"): New test prefix. * doc/ref/posix.texi (Processes): Document `total-processor-count' and `current-processor-count'. 2010-12-07 Ludovic Courtès <ludo@gnu.org> Improve doc of `getaffinity' and `setaffinity'. * doc/ref/posix.texi (Processes): Add cross-reference from `setaffinity' and `getaffinity' to the corresponding node in the glibc manual. * libguile/posix.c (scm_getaffinity, scm_setaffinity): Likewise. 2010-12-07 Ludovic Courtès <ludo@gnu.org> Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'. See <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24225> for details. * lib/unistr.in.h: Change #if's into #ifdef's. 2010-12-07 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `nproc'. This updates Gnulib to v0.0-4496-g6491120. * m4/gnulib-cache.m4: Add `nproc'. 2010-12-07 Ludovic Courtès <ludo@gnu.org> Build dlopenable modules with `-module'. * test-suite/standalone/Makefile.am (libtest_asmobs_la_LDFLAGS, libtest_ffi_la_LDFLAGS, libtest_extensions_la_LDFLAGS): Add `-module'. Add a record type printer for vlists/vhashes. * module/ice-9/vlist.scm (<vlist>): Add a record type printer. 2010-12-07 Brian Templeton <bpt@hcoop.net> lexical function binding for elisp * module/language/elisp/compile-tree-il.scm (access-variable) (reference-variable, set-variable!): Handle globally-bound non-special variables. (bind-lexically?): Create lexical bindings for flet and flet*. * module/language/elisp/runtime.scm (reference-variable, set-variable!): Handle globally-bound non-special variables. (built-in-func): Set the variable directly instead of storing the function in a fluid. * module/language/elisp/runtime/subrs.scm (funcall): Call apply directly. * test-suite/tests/elisp-compiler.test ("Function Definitions")["flet and flet*"]: 2010-12-07 Brian Templeton <bpt@hcoop.net> use unbound fluids instead of `void' sentinel value * module/language/elisp/compile-tree-il.scm (reference-with-check) (compile-without-void-checks, want-void-check?): Remove. (compile-function, compile-pair): Use `reference-variable' instead of `reference-with-check'. (compile-defvar): Only set `sym' if `sym' is not bound to a bound fluid, rather than requiring that its value be `void'. (process-options!): Remove `#:disable-void-check' option handling. * module/language/elisp/runtime.scm (void) (reference-variable-with-check): Remove. (ensure-fluid!): Use an undefined fluid as the initial value for global variables. * module/language/elisp/runtime/function-slot.scm (without-void-checks): Don't import or re-export. * module/language/elisp/runtime/macros.scm (prog1, cond, or, dolist): Don't use `without-void-checks'. * module/language/elisp/runtime/subrs.scm (symbol-value) (symbol-function, apply): Use `reference-variable' instead of `reference-variable-with-check'. (makunbound, fmakunbound, boundp, fboundp): Unset the variable's fluid (or the variable itself, if it isn't bound to a fluid). * test-suite/tests/elisp-compiler.test ("Variable Setting/Referencing")["disabled void check (all)", "disabled void check (symbol list)", "without-void-checks"]: Remove. 2010-12-07 Brian Templeton <bpt@hcoop.net> function's argument can be a symbol * module/language/elisp/compile-tree-il.scm (compile-function): the form `(function SYMBOL)' evaluates to the functional value of SYMBOL allow `(setcar nil nil)' and `(setcdr nil nil)' * module/language/elisp/runtime/subrs.scm (setcar, setcdr): Allow setting the car or cdr of `nil' to `nil'. support "#'" syntax for function expressions * module/language/elisp/lexer.scm (lex): * module/language/elisp/parser.scm (get-expression): Support sharpsign single-quote syntax as an abbreviation for `function' expressions. setq can take any number of arguments * module/language/elisp/compile-tree-il.scm (compile-setq): Return nil if called with no arguments, and set the last variable to nil if its value is omitted. 2010-12-07 Brian Templeton <bpt@hcoop.net> use correct names for quasiquotation operators Use #{`}#, #{,}# and #{,@}# as the quasiquote, unquote and unquote-splicing operators, respectively. Previously they were named escaping. * module/language/elisp/compile-tree-il.scm (unquote?): Change "\," to "#{,}#". (unquote-splicing): Change "\,@" to "#{,@}#". (#{compile-`}#): Rename from #{compile-\`}#. * module/language/elisp/runtime/function-slot.scm: Import #{compile-`}# instead of #{compile-\`}#, and re-export as #{`}# instead of as #{\`}#. * module/language/elisp/parser.scm (quotation-symbols): * test-suite/tests/elisp-compiler.test ("Eval", "Quotation"): * test-suite/tests/elisp-reader.test ("Parser"): Change "\`", "\,", and "\,@" to "#{`}#", "#{,}#" and "#{,@}#", respectively. 2010-12-07 Brian Templeton <bpt@hcoop.net> store special operators in the function slot If the function slot of a symbol contains a pair with `special-operator' in the car and a procedure in the cdr, the procedure is called to compile the form to Tree-IL. This is similar to other Emacs Lisp implementations, in which special operators are subrs. * module/language/elisp/compile-tree-il.scm: Restructured to store special operator definitions in the function slot. Import `(language elisp runtime)' for `defspecial'. Export special operators so that `(language elisp runtime function-slot)' can re-export them. (backquote?): Removed; the backquote symbol is defined as a special operator, so it's no longer used in `compile-pair'. (is-macro?, get-macro): Replaced by `find-operator'. (find-operator): New procedure. (compile-progn, compile-if, compile-defconst, compile-defvar, compile-setq, compile-let, compile-lexical-let, compile-flet, compile-let*, compile-lexical-let*, compile-flet*, compile-without-void-checks, compile-with-always-lexical, compile-guile-ref, compile-guile-primitive, compile-while, compile-function, compile-defmacro, compile-defun, #{compile-`}#, compile-quote): New special operators with definitions taken from the pmatch form in `compile-pair'. There is no special operator `lambda'; it is now a macro, as in other Elisp implementations. (compile-pair): Instead of directly compiling special forms, check for a special operator object in the function slot. * module/language/elisp/runtime.scm: Export `defspecial'. (make-id): New function. (built-in-macro): Prefix macros with `macro-'. (defspecial): New syntax. * module/language/elisp/runtime/function-slot.scm: Import and re-export special operators. Rename imported special operators and macros to remove prefixes. Re-export new macro `lambda'. * module/language/elisp/runtime/macros.scm (macro-lambda): New Elisp macro. 2010-12-07 Brian Templeton <bpt@hcoop.net> update elisp reader tests to handle EOF tokens * test-suite/tests/elisp-reader.test (lex-all, "end-of-input", "lexer/1"): Check for an EOF token instead of the symbol `*eoi*'. make user-defined macros available at runtime * module/language/elisp/compile-tree-il.scm (ensuring-globals): New procedure. (define-macro!): Remove. (compile-pair) <defmacro>: Make macro available at runtime, not only during compilation. (compile-tree-il): Use `ensuring-globals'. allow fluid macro bindings * module/language/elisp/compile-tree-il.scm (define-macro!, get-macro): Allow fluid macro bindings. new `load' subr * module/language/elisp/runtime/subrs.scm: Define new subr `load'. * module/language/elisp/runtime/function-slot.scm: Re-export `load'. Ignore #:warnings compiler option * module/language/elisp/compile-tree-il.scm (process-options!): Ignore #:warnings compiler option. handle EOF correctly in parser and lexer * module/language/elisp/lexer.scm (lex, get-lexer/1): Return a valid token at EOF. * module/language/elisp/parser.scm (get-expression): Raise an error if EOF is reached. (read-elisp): If at EOF, return the EOF object instead of attempting to read an expression. 2010-12-07 Brian Templeton <bpt@hcoop.net> store macro definitions in the function slot Guile Emacs Lisp previously kept macros in a separate macro slot; now macros are stored as macro objects in the function slot for compatibility with other implementations. * module/language/elisp/compile-tree-il.scm (macro-slot): Remove. (is-macro?): Check that the argument is a symbol. Now-unnecessary check removed in `compile-tree-il'. (macro?, define-macro!, get-macro): Store macro definitions in the function slot, not in a separate macro slot. * module/language/elisp/runtime.scm (built-in-macro): Wrap the macro function in a macro object (i.e., cons the symbol `macro' onto it). * module/language/elisp/runtime/function-slot.scm: Move contents to "subrs.scm". Re-export function and macro definitions instead of defining functions directly in this module. * module/language/elisp/runtime/macro-slot.scm: Move contents to "macros.scm" and remove. * module/language/elisp/runtime/macros.scm: New file containing macro definitions from "macro-slot.scm". * module/language/elisp/runtime/subrs.scm: New file containing function definitions from "function-slot.scm". 2010-12-07 Brian Templeton <bpt@hcoop.net> use existing bindings record for defmacro * module/language/elisp/compile-tree-il.scm (compile-pair): Use existing bindings record during macro definition. use tree-il's support for optional arguments * module/language/elisp/compile-tree-il.scm (compile-lambda): Use Tree-IL's support for optional arguments. (process-optionals, process-rest): Remove. make `pass-if-equal' literal in `compile-test' * test-suite/tests/elisp-compiler.test (compile-test): Add `pass-if-equal' to the list of literal identifiers reindent * module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: * module/language/elisp/spec.scm: Reindent. reformat comments * module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: * module/language/elisp/runtime/value-slot.scm: Reformat comments. whitespace changes * module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: Ensure that all top-level forms and comments are separated by exactly one newline. Remove blank lines in most procedure bodies. Delete trailing whitespace. autoload compile-file in (guile-user) * module/ice-9/boot-9.scm (guile-user): Autoload `compile-file'. variable-unset! * libguile/variable.c (scm_variable_unset_x): New function. * libguile/variable.h (scm_variable_unset_x): New prototype. 2010-12-07 Brian Templeton <bpt@hcoop.net> unbound fluids * libguile/fluids.c (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New functions. (fluid_ref): New function; like scm_fluid_ref, but will not throw an error for unbound fluids. (scm_fluid_ref, swap_fluid): Use `fluid_ref'. * libguile/fluids.h (scm_make_undefined_fluid, scm_fluid_unset_x) (scm_fluid_bound_p): New prototypes. * libguile/vm-i-system.c (fluid_ref): If fluid is unbound, jump to `vm_error_unbound_fluid'. * libguile/vm-engine.c (VM_NAME)[vm_error_unbound_fluid]: New error message. * test-suite/tests/fluids.test ("unbound fluids")["fluid-ref of unbound fluid", "fluid-bound? of bound fluid", "fluid-bound? of unbound fluid", "unbound fluids can be set", "bound fluids can be unset"]: New tests. 2010-12-07 Andy Wingo <wingo@pobox.com> better unbound variable errors in the vm * libguile/vm-i-system.c (variable-ref, toplevel-ref) (long-toplevel-ref): Fixup callers. * libguile/vm-engine.c (vm_error_unbound): Don't use vm-error for unbound vars, use misc-error. Don't include VM: in the string. Take the name directly in finish_args, not as a list. 2010-12-07 Brian Templeton <bpt@hcoop.net> make guile-test work without configuration * test-suite/guile-test: Use "../meta/guile" as the interpreter instead of "../libguile/guile". (default-test-suite): New function, replacing the variable of the same name. Look for tests in the same directory as the guile-test script. Throw an error if not invoked as `guile-test'. (test-suite): The old default value of `default-test-suite' could now throw an error, and this already gets initialized in `main', so don't provide an initial value. 2010-12-07 Neil Jerram <neil@ossau.uklinux.net> Put `figures' into standard texinfo form * doc/ref/goops.texi (Example, Inheritance): Remove unnecessary figure references. Use @float and @ref. (Class precedence list): Ditto. 2010-12-06 Neil Jerram <neil@ossau.uklinux.net> Merge `tutorial' and `reference' treatments of the same basic GOOPS material * doc/ref/goops.texi (GOOPS): Move use of (oop goops) here. (Class Definition): Merged with `Defining New Classes' (Instance Creation): Insert before covering slot options. Merge in material from `Creating Instances'. (Slot Options): Merged some better wording and index entries from the tutorial version. (Slot Description Example): New node, containing the <my-complex> material from the tutorial. (Methods and Generic Functions, Inheritance): Tutorial sections moved into main line of the manual. * doc/ref/goops-tutorial.texi: Nothing left here now. 2010-12-06 Neil Jerram <neil@ossau.uklinux.net> Minor textual markups * doc/ref/goops-tutorial.texi (Class definition): No reason to assume particular familiarity with CLOS. (Instance creation and slot access): Remove a couple of words. 2010-12-06 Andy Wingo <wingo@pobox.com> scm_setvbuf doesn't throw away current buffers * libguile/ports.c (scm_drain_input): Slight optimization. * libguile/fports.c (scm_setvbuf): If there is buffered output, flush it. If there is input, drain it, and then unread it after updating the buffers. Much more sensible than dropping it silently... 2010-12-06 Andy Wingo <wingo@pobox.com> http-read calls setvbuf only once * module/web/server/http.scm (http-read): Don't play the setvbuf dance, it was throwing away buffered input. Instead just call setvbuf once before doing any reads or writes. 2010-12-06 Andy Wingo <wingo@pobox.com> ice-9 poll handles buffered io too * libguile/poll.c (scm_primitive_poll): Account for buffered I/O. * module/ice-9/poll.scm (poll): Adapt to call primitive-poll with the port vector too. 2010-12-06 Andy Wingo <wingo@pobox.com> fix name... * module/web/request.scm (read-request-body/latin-1): Fix name... fix read-{request,response}-body/latin-1 * module/web/request.scm (read-response-body/latin-1): * module/web/response.scm (read-response-body/latin-1): Avoid the craziness of the read-delimited! interface and hand-roll our own. Fixes errors if read-delimited returns #f or EOF. update read-delimited! docs * doc/ref/api-io.texi (Line/Delimited): Update the read-delimited! docs. 2010-12-06 Andy Wingo <wingo@pobox.com> leniency regarding quality values in http.scm * module/web/http.scm: Add commentary. (parse-quality): Allow .NNN to be interpreted as 0.NNN. * test-suite/tests/web-http.test ("request headers"): Add a test. 2010-12-06 Andy Wingo <wingo@pobox.com> fix entity tag writing * module/web/http.scm (write-entity-tag): Fix writing of entity tags (strong versus weak). more robustness in http-read * module/web/server/http.scm (http-read): If there was an error reading the request, be sure to close the request port. 2010-12-05 Andy Wingo <wingo@pobox.com> http doesn't keep-alive requests for which there was an error * module/web/server/http.scm (keep-alive?): Don't keep the client around if there is an error. 2010-12-04 Andy Wingo <wingo@pobox.com> (web server http) comment * module/web/server/http.scm: Add comment about charsets. fix error handling in read-{request,response}-body/latin-1 * module/web/request.scm (read-request-body/latin-1): * module/web/response.scm (read-response-body/latin-1): Detect short reads instead of returning a full buffer with the last bits zeroed out. (Before the make-string commit, they contained uninitialized memory, which was a fairly serious error.) 2010-12-04 Andy Wingo <wingo@pobox.com> make-string et al nulls memory if not given an initializer * libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the memory block, so users need to make sure it is initialized. * libguile/bitvectors.c (scm_c_make_bitvector): * libguile/bytevectors.c (scm_make_bytevector): * libguile/strings.c (scm_c_make_string): If no initializer is given, initialize the bytes to 0. Prevents information leakage if an app uses make-string et al without initializers. * libguile/foreign.c (make_cif): Initialize this too, to prevent leakage in the struct holes. Paranoia... 2010-12-03 Andy Wingo <wingo@pobox.com> read-delimited is clearer and conses less * module/ice-9/rdelim.scm (read-delimited): Clarify and somewhat optimize implementation. http server impl reads body as a bytevector by default * module/web/server/http.scm (http-read): Read body as a bytevector by default. That way we punt encoding issues to the app. remove redundant error-handling block * module/web/server/http.scm (http-read): No need for a call-with-error-handling block here, as the read impl is itself within an error-handling block. web server micro-tuning * module/web/server/http.scm (http-open): Allow up to 128 pending connections -- the default value for somaxconn on a number of machines. This is from the HOP paper. (http-read): Set the send buffer to 12 KB, also from the HOP paper. reverse order of poll-set traversal in http-read * module/web/server/http.scm (http-read): Rewrite to iterate down the pollset, so the vector shuffles touch less memory and the end condition of the loop is clearer. 2010-12-03 Andy Wingo <wingo@pobox.com> (web server) punts keep-alive to impls; http server uses (ice-9 poll) * module/web/server.scm: Rewrite to remove the extra "keep-alive" parameter. Instead, since the server is an essentially stateful object, have clients that want to do keep-alive manage that set as part of the server state. Also avoids imposing a particular data structure on the server implementation. * module/web/server/http.scm: Adapt to the new server interface. Also, use a poll set instead of select and lists. Makes handling 1000 clients at a time much more possible. 2010-12-03 Andy Wingo <wingo@pobox.com> ASYNC_TICK after catching EINTR in SCM_SYSCALL * libguile/_scm.h (SCM_SYSCALL): As in scm_syserror, do a SCM_ASYNC_TICK before resuming the syscall after an EINTR. 2010-12-03 Andy Wingo <wingo@pobox.com> add (ice-9 poll), a poll wrapper * libguile/poll.c: * libguile/poll.h: * module/ice-9/poll.scm: New module, (ice-9 poll). * module/Makefile.am: * libguile/init.c: * libguile/Makefile.am: Adapt. * configure.ac: Check for poll.h and poll. 2010-12-03 Ludovic Courtès <ludo@gnu.org> Add `(ice-9 futures)'. * doc/ref/api-scheduling.texi (Threads): Add short introduction. Mention the `threads' feature. Add cross-reference to futures. (Futures): New node. * module/Makefile.am (ICE_9_SOURCES): Add `ice-9/futures.scm'. * module/ice-9/futures.scm: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/future.test'. * test-suite/tests/future.test: New file. 2010-12-03 Ludovic Courtès <ludo@gnu.org> Add bindings to GNU `sched_setaffinity' and `sched_getaffinity'. * configure.ac: Add checks for `sched_setaffinity' and `sched_getaffinity'. * doc/ref/posix.texi (Processes): Document `getaffinity' and `setaffinity'. * libguile/posix.c (cpu_set_to_bitvector, scm_getaffinity)[HAVE_SCHED_GETAFFINITY]: New functions. (scm_setaffinity)[HAVE_SCHED_SETAFFINITY]: New function. * libguile/posix.h (scm_getaffinity, scm_setaffinity): New declarations. * test-suite/tests/posix.test ("affinity"): New test prefix. 2010-12-02 Andy Wingo <wingo@pobox.com> no need for fport_fill_input to select() before read() * libguile/fports.c (fport_fill_input): Likewise to the previous commit, no need to select() before read(). scm_accept no longer leaves guile mode * libguile/socket.c (scm_accept): Revert 7d1fc8721724ab64ccdc44d6f4f84abad43751b4. Now that we don't need to leave guile mode in order for GC to happen, don't do so, as we assume that anyone who cares has already done a select() beforehand. sxml->xml fix * module/sxml/simple.scm (attribute-value->xml): Whoops, fix null case. sxml->xml writes directly to a port * module/sxml/simple.scm: Remove "universal-sxslt-rules" -- it was a bad interface, and I couldn't find any users of it. (sxml->xml): Rewrite so that instead of generating another tree of data, we write the data directly to a port. add some debugging to (web server) * module/web/server.scm: Add some basic elapsed-time debugging, but only if you flip a switch to turn it on at expand-time. better socket buffering on http web server backend * module/web/server/http.scm (http-read, http-write): Line-buffer the port while we're reading the request, and block-buffer it otherwise Use the default block size. indentation fix in ports.c * libguile/ports.c (scm_i_get_conversion_strategy): Indentation fix. (web server) supports non-utf-8 charsets * module/web/server.scm (sanitize-response): Support charsets other than utf-8. Oddly collecting a string and converting it to utf-8 appears to be faster than collecting a utf-8 bytevector directly. 2010-12-02 Andy Wingo <wingo@pobox.com> add simple web app examples * examples/web/hello.scm: * examples/web/debug-sxml.scm: New examples, for simple web applications. * examples/README: * examples/Makefile.am: Add new files. 2010-12-01 Andy Wingo <wingo@pobox.com> http web server impl ignores SIGPIPE * module/web/server/http.scm (http-open): Ignore SIGPIPE. Keeps the server from dying in some circumstances. 2010-12-01 Andy Wingo <wingo@pobox.com> stub fixes to http 1.0 support in the web server * module/web/server.scm (read-client): Fix number of returned values in the case in which there is an error reading the client. (sanitize-response): Add a case to adapt the reponse to the request version. (handle-request): Sanitize the response within an error-handling block. (serve-one-client): Move sanitation out of here. * module/web/server/http.scm (keep-alive?): A more proper detection on whether we should support persistent connections. * module/web/response.scm (adapt-response-version): New routine, to adapt a response to a given version. Currently a stub. 2010-11-25 Andreas Rottmann <a.rottmann@gmx.at> Some tweaks to the R6RS support * module/rnrs/base.scm (error, assert): Define -- they were missing. (assertion-violation): Properly treat a #f `who' argument. * module/rnrs/conditions.scm (condition): Use `assertion-violation' instead of the undefined `raise'. (define-condition-type): Fix for multiple fields. * test-suite/tests/r6rs-conditions.test: Test accessors of a multiple-field condition. Also import `(rnrs base)' to allow stand-alone running of the tests; apparently the `@' references scattered throughout the R6RS modules make the libraries sensitive to their load order -- for instance, trying to load `(rnrs conditions)' before `(rnrs base)' is loaded fails. * module/rnrs/records/inspection.scm: Use `assertion-violation' instead of an explicit `raise'. * module/rnrs/records/syntactic.scm (process-fields): Use `syntax-violation' instead of bogus invocations of `error'. 2010-11-24 Ludovic Courtès <ludo@gnu.org> Fix `regexp.test' when the "en_US.utf8" locale isn't available. * test-suite/tests/regexp.test ("nonascii locales"): Move `with-locale' within the body of `pass-if' so that `unresolved' is caught. 2010-11-24 Ludovic Courtès <ludo@gnu.org> Honor R6RS transcoder error handling modes, when possible. * module/rnrs/io/ports.scm (transcoded-port): Change RESULT's conversion strategy based on TRANSCODER's error-handling mode. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]", "transcoded-port [error handling mode = replace]"]: New tests. 2010-11-24 Andreas Rottmann <a.rottmann@gmx.at> Add implementation of "transcoded ports" * libguile/r6rs-ports.c (make_tp, tp_write, tp_fill_input, tp_flush) (tp_close, initialize_transcoded_ports, scm_i_make_transcoded_port): New functions. (scm_init_r6rs_ports): Call `initialize_transcoded_ports'. * module/rnrs/ports.scm (transcoded-port): Actually implement, using `%make-transcoded-port'. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports"): Added a few tests for `transcoded-port'. 2010-11-24 Andreas Rottmann <a.rottmann@gmx.at> Work towards a more complete implementation of `(rnrs io ports)' * module/rnrs/io/ports.scm: (file-options, buffer-mode, eol-style) (error-handling-mode, make-transcoder, native-transcoder) (latin-1-codec, utf-8-codec, utf-16-codec) (call-with-bytevector-output-port, open-file-input-port) (open-file-output-port, make-custom-textual-output-port) (flush-output-port, put-char, put-datum, put-string, get-char) (get-datum, get-line, get-string-all, lookahead-char) (standard-input-port, standard-output-port, standard-error-port): Define all of these. (call-with-port): Don't use `dynamic-wind', as it is against its specification in R6RS 8.2.6. * module/rnrs.scm: Export procedures added. * module/rnrs/io/simple.scm (call-with-input-file) (call-with-output-file): Define these in terms of R6RS procedures to get correct exception behavior. 2010-11-24 Andreas Rottmann <a.rottmann@gmx.at> Reorganize the R6RS I/O condition types Move the I/O condition types from `(rnrs conditions)', where they were not exported, to `(rnrs files)', where they are. * module/rnrs/conditions.scm: Remove definition of I/O condition types. * module/rnrs/files.scm: Replace references to I/O condition types inside `(rnrs conditions)' with the actual definitions. * module/rnrs/io/simple.scm: Don't `@@'-reference the I/O condition types, just imported them from `(rnrs files)'. 2010-11-24 Andreas Rottmann <a.rottmann@gmx.at> Turn `(rnrs io ports)' into an R6RS library * module/rnrs/io/ports.scm: Change into an R6RS library from a "regular" Guile module, so the bookkeeping for #:re-export and #:replace is done automatically and we gain control over the imports from `(guile)'. 2010-11-23 Andy Wingo <wingo@pobox.com> fix regexp matches to refer to chars, not bytes * libguile/regex-posix.c (fixup_multibyte_match): Fixup the match structure to refer to character offsets, not byte offsets. Fixes bug 31650. * test-suite/tests/regexp.test: Add a test. 2010-11-23 Andy Wingo <wingo@pobox.com> fix web server bugs * module/web/http.scm (valid-quality?): * module/web/server.scm (sanitize-response): Fix a couple bugs. 2010-11-22 Andy Wingo <wingo@pobox.com> fix up a couple content-length issues in web/server.scm:sanitize-response * module/web/server.scm (sanitize-response): Allow body to be #f. Don't require or insert a content-length if there is no body. 2010-11-21 Julian Graham <julian.graham@aya.yale.edu> Enumeration set universe comparisons should be done with `equal?' * module/rnrs/enums.scm (enum-set-union, enum-set-intersection, enum-set-difference): Compare enum-set universes with `equal?' to support sets generated using constructor syntax bound by `define-enumeration'. * test-suite/tests/r6rs-enums.test (enum-set-union, enum-set-intersection, enum-set-difference): New test cases for syntactically-generated sets. 2010-11-20 Andreas Rottmann <a.rottmann@gmx.at> 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. 2010-11-20 Andreas Rottmann <a.rottmann@gmx.at> 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. 2010-11-20 Andy Wingo <wingo@pobox.com> announce flex version in autogen.sh * autogen.sh: Announce flex version. Has the side-effect of checking for flex when building from git. 2010-11-20 Andreas Rottmann <a.rottmann@gmx.at> 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. 2010-11-20 Ludovic Courtès <ludo@gnu.org> Use `define-module*' in (ice-9 history). * module/ice-9/history.scm: Use `define-module*' instead of `process-define-module'. 2010-11-19 Andy Wingo <wingo@pobox.com> 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. 2010-11-19 Andy Wingo <wingo@pobox.com> 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. 2010-11-19 Andy Wingo <wingo@pobox.com> deprecate process-define-module * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (process-define-module): Deprecate. 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. 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*. 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*. 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. 2010-11-19 Andy Wingo <wingo@pobox.com> 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. 2010-11-19 Andy Wingo <wingo@pobox.com> simpos tweak * libguile/simpos.c (scm_system_star): Use scm_from_ulong, as we do cast to ulong. 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. 2010-11-19 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-19 Ludovic Courtès <ludo@gnu.org> 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>. 2010-11-19 Ludovic Courtès <ludo@gnu.org> Optimize fixnum comparison. * libguile/vm-i-scheme.c (REL): Don't untag X and Y since tagging preserves ordering. Add fixnum arithmetic benchmarks. * benchmark-suite/benchmarks/arithmetic.bm ("fixnum")["*", "/"]: New benchmarks. 2010-11-19 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-19 Ludovic Courtès <ludo@gnu.org> 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. 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'. 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. 2010-11-18 Andy Wingo <wingo@pobox.com> 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. numbers.test expects lower-case hexadecimals * test-suite/tests/numbers.test ("number->string"): Expect lower-case hexidecimals. 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). 2010-11-18 Andy Wingo <wingo@pobox.com> 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. 2010-11-18 Andy Wingo <wingo@pobox.com> lower-case hexadecimal digits again * libguile/numbers.c: Default to lower-case hexadecimal digits again. better errors for ecmascript parser too * module/language/ecmascript/parse.scm (syntax-error): Better errors here too. ecmascript tokenization errors report source location * module/language/ecmascript/tokenize.scm (syntax-error): Report source locations. Adapt all callers to pass source locations. 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. more ecmascript testing * test-suite/tests/ecmascript.test (eread/1, parse): Also check read-ecmascript/1, which uses tokenize/1. 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... repl.scm displays syntax errors on read as well * module/system/repl/repl.scm (prompting-meta-read): Use display-syntax-error as appropriate. 2010-11-18 Andy Wingo <wingo@pobox.com> 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. 2010-11-18 Andy Wingo <wingo@pobox.com> 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. 2010-11-17 Julian Graham <julian.graham@aya.yale.edu> 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. 2010-11-16 Andy Wingo <wingo@pobox.com> fix the C syntax-error pretty-printer * libguile/throw.c (handler_message): Fix up a bit. 2010-11-16 Andy Wingo <wingo@pobox.com> 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. 2010-11-16 Andy Wingo <wingo@pobox.com> 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. 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. 2010-11-16 Andy Wingo <wingo@pobox.com> 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. 2010-11-15 Andy Wingo <wingo@pobox.com> 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. 2010-11-14 Neil Jerram <neil@ossau.uklinux.net> 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. 2010-11-13 Andy Wingo <wingo@pobox.com> 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... add extend-response. * module/web/response.scm (extend-response): New utility. 2010-11-13 Andy Wingo <wingo@pobox.com> (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. 2010-11-12 Andy Wingo <wingo@pobox.com> NUL vs NULL fix * libguile/read.c (scm_i_scan_for_encoding): Fix NUL rather than NULL. 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". 2010-11-12 Andy Wingo <wingo@pobox.com> 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. 2010-11-12 Andy Wingo <wingo@pobox.com> 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. 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. 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. unparse-uri avoids serializing e.g. :80 in http:// 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. 2010-11-12 Julian Graham <julian.graham@aya.yale.edu> 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. 2010-11-11 Ludovic Courtès <ludo@gnu.org> Add FFI tests for `sizeof' and structs. * test-suite/tests/foreign.test ("structs")["sizeof { int8, double }", "sizeof { short, int, long, pointer }"]: New tests. 2010-11-11 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-11 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-11 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-09 Michael Gran <spk121@yahoo.com> Use ellipsis character in truncated pretty-print of sequences * module/ice-9/pretty-print.scm (print-sequence): use ellipsis when available 2010-11-08 Mike <mike@joseph.localhost> 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 2010-11-07 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-07 Ludovic Courtès <ludo@gnu.org> 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'. 2010-11-06 Andy Wingo <wingo@pobox.com> 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. 2010-11-05 Michael Gran <spk121@yahoo.com> need read error for extra closing square brackets * libguile/read.c (scm_read_expression): add test 2010-11-05 Ludovic Courtès <ludo@gnu.org> 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. 2010-11-05 Andy Wingo <wingo@pobox.com> add toy web server * module/web/toy-server.scm: New module, a toy web server. * module/Makefile.am: Adapt. 2010-11-05 Andy Wingo <wingo@pobox.com> 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. 2010-11-05 Andy Wingo <wingo@pobox.com> 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. 2010-11-04 Andy Wingo <wingo@pobox.com> 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. 2010-11-04 Andy Wingo <wingo@pobox.com> 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. 2010-11-04 Neil Jerram <neil@ossau.uklinux.net> Finish adding api-regex.texi * doc/ref/Makefile.am (guile_TEXINFOS): Add api-regex.texi, so that it gets into distributions. 2010-11-03 Andreas Rottmann <a.rottmann@gmx.at> 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. 2010-11-03 Andreas Rottmann <a.rottmann@gmx.at> 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. 2010-10-31 Neil Jerram <neil@ossau.uklinux.net> 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. 2010-10-31 Neil Jerram <neil@ossau.uklinux.net> 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. 2010-10-31 Neil Jerram <neil@ossau.uklinux.net> 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. 2010-10-28 Ludovic Courtès <ludo@gnu.org> 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>. 2010-10-27 Andreas Rottmann <a.rottmann@gmx.at> 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. 2010-10-27 Ludovic Courtès <ludo@gnu.org> Have "frisk" recognize `#:use-module' and `#:autoload'. * module/scripts/frisk.scm (grok-proc): Support keywords `#:use-module' and `#:autoload'. Augment `arithmetic.bm'. * benchmark-suite/benchmarks/arithmetic.bm (repeat): Change the syntax. Add support for binary OP. ("fixnum")["1+", "1-"]: Adjust accordingly. ["+", "-"]: New benchmarks. 2010-10-26 Neil Jerram <neil@ossau.uklinux.net> Fix manual typo * doc/ref/api-foreign.texi: "prodedures" -> "procedures". 2010-10-22 Julian Graham <julian.graham@aya.yale.edu> 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. 2010-10-20 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-20 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-20 Ludovic Courtès <ludo@gnu.org> 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). 2010-10-20 Tristan Colgate-McFarlane <tcolgate@gmail.com> Add support for more multicast sockopts. * libguile/socket.c: Add support for IP_MULTICAST_TTL and IP_MILTICAST_IF sockopts. Fix detection of struct ip_mreq * configura.ac: netinet/in.h is required to complete definition of struct ip_mreq. 2010-10-19 Andy Wingo <wingo@pobox.com> rdelim cleanups * module/ice-9/rdelim.scm: Clean up export list. (read-line!, read-delimited!, read-delimited, read-line): Use define*. 2010-10-18 Andy Wingo <wingo@wingomac.bcn.oblong.net> 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. uninitialized var in scm_read_character * libguile/read.c (scm_read_character): Fix error condition where charname could be uninitialized. _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. 2010-10-17 Andy Wingo <wingo@pobox.com> 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. 2010-10-17 Andy Wingo <wingo@pobox.com> import uri.scm from tekuti, from guile-www 2010-10-15 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.13. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Update `cpp-E.syms' and `cpp-SIG.syms'. * libguile/cpp-E.syms, libguile/cpp-SIG.syms: Update on a Glibc 2.11.1 system. 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.) 2010-10-15 Michael Gran <spk121@yahoo.com> Unresolved var errors don't work for top-level vars * libguile/vm-i-system.c (toplevel_ref, long_toplevel_ref): modified Update charsets to Unicode 6.0.0 * libguile/srfi-14.i.c: regenerated 2010-10-14 Andy Wingo <wingo@pobox.com> re-implement srfi-34's guard with syntax-case * module/srfi/srfi-34.scm (guard): Re-implement using syntax-case. 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. 2010-10-14 Neil Jerram <neil@ossau.uklinux.net> 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. 2010-10-13 Andy Wingo <wingo@pobox.com> 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. 2010-10-13 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-13 Neil Jerram <neil@ossau.uklinux.net> 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. Two very small edits * doc/ref/goops.texi (User-defined classes): Remove brackets around `formally', for better flow. (Creating Instances): Lengthen hyphen. 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. 2010-10-13 Ludovic Courtès <ludo@gnu.org> 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'. 2010-10-13 Ludovic Courtès <ludo@gnu.org> Allocate inexact numbers in pointer-less memory. * libguile/numbers.c (scm_from_double): Use `scm_gc_malloc_pointerless' instead of `scm_double_cell'. Placate `-Wformat'. * module/scripts/compile.scm (fail): Use a fancy format string instead of a non-literal one. 2010-10-12 Andy Wingo <wingo@pobox.com> update NEWS for 1.9.13 * NEWS: Update for 1.9.13. 2010-10-12 Neil Jerram <neil@ossau.uklinux.net> Add TeX form of jao's name * doc/ref/scheme-using.texi: Add TeX equivalent for José. 2010-10-12 Andy Wingo <wingo@pobox.com> fold old news items into main news body * NEWS: Fold 1.9.12 items into the main body. 2010-10-12 Andy Wingo <wingo@pobox.com> ,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?. 2010-10-12 Andy Wingo <wingo@pobox.com> 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". 2010-10-12 Andy Wingo <wingo@pobox.com> 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. 2010-10-12 Andy Wingo <wingo@pobox.com> 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. 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. 2010-10-11 Andy Wingo <wingo@pobox.com> add --listen docs * doc/ref/scheme-scripts.texi (Invoking Guile): Add --listen documentation. preface contributors tweaks * doc/ref/preface.texi (Contributors): A couple tweaks update preface.texi contributors * doc/ref/preface.texi (Contributors): Rewrite and update. 2010-10-11 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-11 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-10 Ludovic Courtès <ludo@gnu.org> Fix typo. * module/system/repl/command.scm (repl-pop-continuation-resumer): Remove extraneous argument to `format'. 2010-10-10 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-10 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-10 Ludovic Courtès <ludo@gnu.org> Compile with `-Wformat'. * am/guilec (GUILE_WARNINGS): Add `-Wformat'. 2010-10-10 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-10 Ludovic Courtès <ludo@gnu.org> Escape newlines from format strings in warnings. * module/system/base/message.scm (%warning-types)[format]: Escape newlines from FMT. 2010-10-10 Andy Wingo <wingo@pobox.com> 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. 2010-10-10 Andy Wingo <wingo@pobox.com> 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. 2010-10-10 Andy Wingo <wingo@pobox.com> 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)) 2010-10-10 Andy Wingo <wingo@pobox.com> 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. 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. 2010-10-08 Andy Wingo <wingo@pobox.com> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> Improve pretty-printing of tree-il objects. * module/language/tree-il.scm (print-tree-il): Print the AST with ~S instead of ~A. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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'. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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. 2010-10-08 Ludovic Courtès <ludo@gnu.org> 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'. 2010-10-08 Andy Wingo <wingo@pobox.com> fix a bug in `finish' * module/system/repl/command.scm (repl-pop-continuation-resumer) (finish): Fix a bug printing return values. 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. 2010-10-08 Andy Wingo <wingo@pobox.com> 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. 2010-10-08 Andy Wingo <wingo@pobox.com> fix error in frame-return-values * module/system/vm/frame.scm (frame-return-values): Fix off-by-one error. fix tracing of mv returns * module/system/vm/trace.scm (print-return): Fix multiple-value-return printing. 2010-10-08 Andy Wingo <wingo@pobox.com> 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. 2010-10-08 Andy Wingo <wingo@pobox.com> 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. 2010-10-08 Andy Wingo <wingo@pobox.com> add repl debugging command docs * doc/ref/scheme-using.texi (Debug Commands): Add docs for new debugging commands (break, step, registers, etc). proof-reading fixen in api-debug * doc/ref/api-debug.texi (Trap States, High-Level Traps): A couple of proof-reading fixes. 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. 2010-10-07 Andy Wingo <wingo@pobox.com> 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. 2010-10-07 Andy Wingo <wingo@pobox.com> document trap states * module/system/vm/trap-state.scm: Export add-trap!. * doc/ref/api-debug.texi (Trap States): Document. 2010-10-07 Andy Wingo <wingo@pobox.com> document tracing traps * doc/ref/api-debug.texi (Tracing Traps): Document the traps. 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. 2010-10-07 Andy Wingo <wingo@pobox.com> 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. 2010-10-07 Andy Wingo <wingo@pobox.com> update docs regarding --debug * doc/ref/scheme-scripts.texi (Invoking Guile): Update docs on --debug. 2010-10-07 Andy Wingo <wingo@pobox.com> 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. 2010-10-06 Andy Wingo <wingo@pobox.com> update (system repl debug) todo * module/system/repl/debug.scm: Update todo. 2010-10-06 Andy Wingo <wingo@pobox.com> 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. 2010-10-06 Andy Wingo <wingo@pobox.com> 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. 2010-10-06 Andy Wingo <wingo@pobox.com> build guile-readline/ after module/ * Makefile.am (SUBDIRS): Build module/ before guile-readline/. Reformat. 2010-10-05 Andy Wingo <wingo@pobox.com> add ,finish repl meta-command * module/system/repl/command.scm (finish): New REPL meta command. Uses fancy prompt stuff. 2010-10-05 Andy Wingo <wingo@pobox.com> (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. 2010-10-05 Andy Wingo <wingo@pobox.com> (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. 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. (system repl debug): add frame->stack-vector * module/system/repl/debug.scm (frame->stack-vector): New public function. fix embarrassing error preventing ,del from working * module/system/vm/trap-state.scm (remove-trap-wrapper!): Oops, fix newbie error regarding delq and mutation. system repl repl comments * module/system/repl/repl.scm (meta-reader): Add a comment about peek, read, and the EOF object. bugfixes and simplifications to ice-9 buffered-input. * module/ice-9/buffered-input.scm (make-buffered-input-port): Simplify, and fix one case in which we would buffer the EOF object. 2010-10-05 Andy Wingo <wingo@pobox.com> guile-readline slight modernization * guile-readline/Makefile.am: Update to use am/guilec. * guile-readline/ice-9/readline.scm (activate-readline): Update to use a lambda*. 2010-10-04 Andy Wingo <wingo@pobox.com> Revert "repl.scm next-char needed to read EOF from port" Actually peek-char => EOF does not guarantee that read-char => EOF. I don't know what to do about this. This reverts commit 6e1dccc42f9ec81e04524ccc0956c692ee423576. 2010-10-04 Neil Jerram <neil@ossau.uklinux.net> Edit section on generic functions * doc/ref/goops.texi (Generic Functions and Accessors): Renamed from `Creating Generic Functions'. Explain what an accessor is. (Basic Generic Function Creation): Clarify the point of the text about generics having short names. Edit section on slot access * doc/ref/goops.texi (Instance Slots): Remove a little verbosity. (Class Slots): Correct one `slot-missing' to `slot-unbound'. Typeset Ludo's name correctly * doc/ref/history.texi (A Scheme of Many Maintainers): Add TeX-specific version of `Courtès'. 2010-10-03 Andy Wingo <wingo@pobox.com> avoid some double-breaks in trap-at-procedure-ip-in-range * module/system/vm/traps.scm (trap-at-procedure-ip-in-range): Rework not to call the handler when returning to a frame that was already entered. So now breaking at foo.scm:1234 doesn't break when returning to that line. repl.scm next-char needed to read EOF from port * module/system/repl/repl.scm (next-char): Actually read off the EOF if we got one. Interesting, this. 2010-10-03 Andreas Rottmann <a.rottmann@gmx.at> Add implementation of SRFI 45 * module/srfi/srfi-45.scm: New file, containing the reference implementation of SRFI 45, slightly adapted to use SRFI-9. * module/Makefile.am (SRFI_SOURCES): Added srfi/srfi-45.scm. * test-suite/tests/srfi-45.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-45.test. * doc/ref/srfi-modules.texi (SRFI-45): New node and subsection; essentially a shortended transcript of the SRFI-45 specification. 2010-10-03 Michael Gran <spk121@yahoo.com> Add v1.8.x backward compatiblity to GUILE_SITE_DIR * meta/guile.m4 (GUILE_SITE_DIR): use pkgdatadir if no sitedir 2010-10-03 Andy Wingo <wingo@pobox.com> srfi-67 #:replace work * module/srfi/srfi-67.scm (string-compare, string-compare-ci): #:replace these bindings. 2010-10-03 Andreas Rottmann <a.rottmann@gmx.at> Add implementation of SRFI-67 * module/srfi/srfi-67/compare.scm: New file; reference implementation of SRFI 67. * module/srfi/srfi-67.scm: New module; includes the refernce implementation. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-67.scm. (NOCOMP_SOURCES): Add srfi/srfi-67/compare.scm. * test-suite/tests/srfi-67.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-67.test. 2010-10-03 Andreas Rottmann <a.rottmann@gmx.at> Add implementation of SRFI 42 * module/srfi/srfi-42/ec.scm: New file; reference implementation of SRFI 42. * module/srfi/srfi-42.scm: New file; module for SRFI 42. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-42.scm. (NOCOMP_SOURCES): Add srfi/srfi-42/ec.scm. * test-suite/tests/srfi-42.test: New file; test suite for SRFI 42. * test-suite/Makefile.am: SCM_TESTS: Add tests/srfi-42.test. 2010-10-03 Andreas Rottmann <a.rottmann@gmx.at> Reference original specification in SRFI 27 documentation * doc/ref/srfi-modules.texi (SRFI-27): Link to the original specification of SRFI-27. 2010-10-03 Andy Wingo <wingo@pobox.com> bugfixen in source breakpoints and in-procedure traps * module/system/vm/traps.scm (trap-in-procedure): If we are (re-)entering the procedure from a return, call the enter-proc with the returnee, not the returner. (in-range?): Tighten up a bit. (program-sources-before-retire): New helper, like program-sources but indexed before instructions are retired instead of after. (program-sources-by-line): Use program-sources-before-retire so that we can break on instructions by source line *before* those instructions are executed. 2010-10-02 Neil Jerram <neil@ossau.uklinux.net> Flatten `Miscellaneous Functions' * doc/ref/goops.texi (Miscellaneous Functions): Delete this container section, and promote its subsections. 2010-10-02 Neil Jerram <neil@ossau.uklinux.net> Customizing Instance Creation to metaobject protocol section * doc/ref/goops.texi (Customizing Instance Creation): Moved from `Creating Instances' to `The Metaobject Protocol'. * doc/ref/goops.texi (Basic Instance Creation): Flattened into parent `Creating Instances', refs updated accordingly. 2010-10-02 Neil Jerram <neil@ossau.uklinux.net> Remove goops-version, which is no longer defined * doc/ref/goops.texi (Administrative Functions): Removed. * module/oop/goops.scm (oop): Don't export `goops-version'. 2010-10-02 Neil Jerram <neil@ossau.uklinux.net> Remove doc of STKlos compatibility As module/oop/goops/stklos.scm, the available compatibility is superficial only, so it isn't worth documenting. * doc/ref/goops.texi (STKlos Compatibility): Removed. 2010-10-02 Neil Jerram <neil@ossau.uklinux.net> Continue separating simple and more complex GOOPS doc * doc/ref/goops.texi (Defining New Classes): Move `Class Definition Internals' and `Customizing Class Definition' notes to the metaobject protocol section. 2010-10-01 Andy Wingo <wingo@pobox.com> source breakpoints accept user line numbers * module/system/vm/trap-state.scm (add-trap-at-source-location!): * module/system/vm/traps.scm (trap-at-source-location): Rename "line" argument to "user-line", indicating that the line is one-based instead of zero-based. Decrement the line before handing off to source-closures-or-procedures and source->ip-range. 2010-10-01 Andy Wingo <wingo@pobox.com> add source:line-for-user, returning a 1-indexed line number * module/system/vm/program.scm (source:line-for-user): New exported procedure, returns a 1-indexed line, suitable for presentation to a user. (write-program): Use source:line-for-user when making fallback names. * module/system/vm/coverage.scm (coverage-data->lcov): * module/language/assembly/disassemble.scm (source->string): * module/system/repl/debug.scm (print-frame): Use source:line-for-user. 2010-10-01 Andy Wingo <wingo@pobox.com> api-debug tweak * doc/ref/api-debug.texi (Debug Options): Fix wording. update api-debug.texi discussion of stack overflow * doc/ref/api-debug.texi (Debug Options): Update stack overflow discussion. 2010-10-01 Andy Wingo <wingo@pobox.com> c stack overflow checked for, once more * libguile/stackchk.h: Include private-options.h if we are building guile. * libguile/vm.c (scm_c_vm_run): Check for C stack overflow before entering the engine. 2010-10-01 Andy Wingo <wingo@pobox.com> scm_report_stack_overflow eventually resets scm_stack_checking_enabled_p * libguile/stackchk.c (scm_report_stack_overflow): Surround in a dynwind, so that scm_stack_checking_enabled_p is reset when the error throws. 2010-10-01 Neil Jerram <neil@ossau.uklinux.net> Fix typo in configure.ac Fixes an error when running ./configure: ./configure: line 31873: text: command not found * configure.ac: Change "text" to "test", in libltdl-related code. 2010-10-01 Andy Wingo <wingo@pobox.com> deprecate turn-on-debugging, it is obsolete * libguile/script.c (scm_compile_shell_switches): Don't generate calls to turn-on-debugging. * module/ice-9/boot-9.scm (turn-on-debugging): Remove. * module/ice-9/deprecated.scm (turn-on-debugging): Add deprecated shim. 2010-10-01 Andy Wingo <wingo@pobox.com> scm_debug_opts to debug.c, backtrace on by default, scm_*_opts internal linkage * libguile/eval.c: * libguile/debug.c (scm_debug_opts): Move here, from eval.c. Change SCM_BACKTRACE_P to 1, initially. * libguile/private-options.h: Make all options vars private. 2010-10-01 Andy Wingo <wingo@pobox.com> document call-with-error-handling * doc/ref/api-debug.texi (Pre-Unwind Debugging): Document call-with-error-handling. api-debug.texi refactors * doc/ref/api-debug.texi (Programmatic Error Handling): Rename from "Debug on Error". Reorganize subsections according to when the error is handled. * doc/ref/api-options.texi: Adapt xref. update tour.texi * doc/ref/tour.texi (Using the Guile Module System): Remove "in flux" language. Update examples to use #:export instead of (export ...). 2010-10-01 Andy Wingo <wingo@pobox.com> finish cleaning out api-options.texi * doc/ref/api-debug.texi (Debug on Error): Move debug options here (for now). Leave debug-options-interface undocumented. * doc/ref/api-options.texi (Runtime Options): Remove debug options. Link to the sections where the options documentation is now. Update the options example transcript. 2010-10-01 Andy Wingo <wingo@pobox.com> debug and readline options doc tweak * doc/ref/api-options.texi (Debugger options): * doc/ref/repl-modules.texi (Readline Options): Use 'help instead of 'full (they are entirely equivalent right now). Update output to show options in the right order. 2010-10-01 Andy Wingo <wingo@pobox.com> move read and print options docs to the procedures they parameterize * doc/ref/api-evaluation.texi (Scheme Read): Fold all reader options docs into this section. Undocument read-options-interface. (Scheme Write): New section for `write' and `display', and the print options. print-enable/print-disable are not documented, as there are no boolean print options. print-options-interface is likewise undocumented. * doc/ref/api-options.texi: Remove discussion of options in general. Move read options to Scheme Read, and print options to Scheme Write. * doc/ref/api-io.texi (Reading): Link to Scheme Read. (Writing): Move write and display to Scheme Write, and link there. * doc/ref/srfi-modules.texi: * doc/ref/api-debug.texi: * doc/ref/api-data.texi: Update xrefs. 2010-10-01 Andy Wingo <wingo@pobox.com> remove elisp-strings and elisp-vectors read options * libguile/private-options.h (SCM_ELISP_VECTORS_P, SCM_ESCAPED_PARENS_P): * libguile/read.c (scm_read_opts): Remove unused elisp-vectors option, and the elisp-strings option (which allowed \( and \) escapes in strings). (scm_read_string): Remove the elisp-strings case. * doc/ref/api-options.texi (Reader options): Update, and update wording of the case-insensitive bit. 2010-10-01 Andy Wingo <wingo@pobox.com> (foo-options 'full) displays options doc in correct order * libguile/options.c (get_documented_option_setting): Reverse options interface list before returning, so that they are in the original order. remove unused print-options * libguile/private-options.h (SCM_PRINT_CLOSURE, SCM_PRINT_SOURCE_P): * libguile/print.c (scm_print_opts): * doc/ref/api-options.texi (Printing options): Remove source and closure-hook print options. 2010-09-30 Andy Wingo <wingo@pobox.com> add ,registers * libguile/frames.h: * libguile/frames.c (scm_frame_stack_pointer): New function. * module/system/repl/debug.scm (print-registers): New function, prints out registers. * module/system/repl/command.scm (registers): New debugging meta-command. (inspect): Not a stack-command, a normal meta-command. 2010-09-28 Andy Wingo <wingo@pobox.com> fix check-guile.in for default vm change * check-guile.in: Make the --debug fix in the source file, not the generated file. Grr. 2010-09-28 Andy Wingo <wingo@pobox.com> default to regular vm for noninteractive use * libguile/script.c (scm_compile_shell_switches): Select the debugging VM in the cases that we previously would select deval -- when running interactively without --no-debug, or otherwise with --debug. * libguile/vm.c: Default to the regular engine. (scm_c_set_vm_engine_x): Remove requirement for the VM to have no pending computations. 2010-09-27 Ludovic Courtès <ludo@gnu.org> Fix pattern variable extraction in `match' with `..1'. * module/ice-9/match.upstream.scm (match-extract-vars): Support `..1'. 2010-09-27 Ludovic Courtès <ludo@gnu.org> Add support for `..1' to `match'. Patch accepted upstream: <http://lists.gnu.org/archive/html/guile-devel/2010-09/threads.html#00114>. * module/ice-9/match.upstream.scm (match-two): Add support for `..1'. * test-suite/tests/match.test ("matches")["list ..1", "list ..1, with predicate"]: New tests. ("doesn't match")["list ..1", "list ..1, with predicate"]: New tests. 2010-09-27 Andreas Rottmann <a.rottmann@gmx.at> Add implementation of SRFI 27 * module/srfi/srfi-27.scm: New file; implementation of SRFI 27 in terms of the existing random number generator. * module/Makefile.am (SRFI_SOURCES): Add srfi/srfi-27.scm. * test-suite/tests/srfi-27.test: New file; minimal test suite for SRFI 27. * test-suite/Makefile.am (SCM_TESTS): Add tests/srfi-27.test. * doc/ref/srfi-modules.texi: Add subsection on SRFI-27 based on the specification. 2010-09-27 Andy Wingo <wingo@pobox.com> add call-with-vm; remove thread-vm bits; remove vm-apply; engines settable. * libguile/vm.h (scm_c_vm_run): Make internal. * libguile/vm.c (vm_default_engine): New static global variable. (make_vm): Set vp->engine based on (scm_vm_apply): Remove in favor of call-with-vm. (scm_thread_vm, scm_set_thread_vm_x): Remove these, as they did not have a well-defined meaning, and were dangerous to call on other threads. (scm_the_vm): Reinstate previous definition. (symbol_to_vm_engine, vm_engine_to_symbol) (vm_has_pending_computation): New helpers. (scm_vm_engine, scm_set_vm_engine_x, scm_c_set_vm_engine_x): New accessors for VM engines. (scm_c_set_default_vm_engine_x, scm_set_default_vm_engine_x): New setters for the default VM engine. (scm_call_with_vm): New function, applies a procedure to arguments in a context in which a given VM is current. * libguile/eval.c (eval, scm_apply): VM dispatch goes through scm_call_with_vm. * test-suite/tests/control.test ("the-vm"): * module/system/vm/coverage.scm (with-code-coverage): Use call-with-vm. * module/system/vm/vm.scm: Update exports. * test-suite/vm/run-vm-tests.scm (run-vm-program): * test-suite/tests/compiler.test ("current-reader"): Just rely on the result of make-program being an applicable. * test-suite/tests/eval.test ("stack overflow"): Add a note that this test does not test what it should. 2010-09-27 Ludovic Courtès <ludo@gnu.org> Fix bignum memory leak. The `mpz_t' associated with a bignum would never be freed, so an expression like `(while #t (expt 2 5000))' would quickly lead to memory exhaustion. * libguile/numbers.c (finalize_bignum): New function. (make_bignum): Register it as a finalizer for P. 2010-09-27 Ludovic Courtès <ludo@gnu.org> Allocate bignums in pointer-less memory. * libguile/numbers.c (make_bignum): New function. (scm_i_mkbig, scm_i_long2big, scm_i_ulong2big, scm_i_clonebig, scm_i_dbl2big, scm_i_mpz2num): Use it. Remove `scm_t_aligned_cell'. * libguile/_scm.h (scm_aligned_cell, scm_t_aligned_cell): Remove. The whole approach was misguided as the compiler can't guarantee absolute alignment on the stack. Fix argument passing in VM hooks. * libguile/vm.c (vm_dispatch_hook): Take care of FRAME's alignment explicitly so that it's correct even if the current stack frame isn't 8-byte aligned (as can be the case on i686--the SysV i386 ABI just says that the stack is word-aligned.) 2010-09-27 Ludovic Courtès <ludo@gnu.org> Have `@abort' honor VM changes by winds. * libguile/control.c (scm_c_abort): Update VM after the `scm_dowinds' call. * test-suite/tests/control.test ("the-vm"): New test prefix. 2010-09-26 Michael Gran <spk121@yahoo.com> Favor non-hex string escapes over hex escapes when writing strings The characters U+0007 to U+000D have non-hex forms for their escapes when in written strings. * libguile/print.c (write_character): use non-hex escapes * test-suite/tests/reader.test (write R6RS string escapes): adjust test 2010-09-26 Neil Jerram <neil@ossau.uklinux.net> Edit define-class doc * doc/ref/goops.texi (Defining New Classes): Remove "fixme" text (saying we should have something that we in fact already have). A few minor edits throughout. (Basic Class Definition): Move content up into `Defining New Classes'. (Class Options): Move after `Slot Options' (because slot options are more important). Remove doc of the #:environment option, since I believe it's now fictitious. (Slot Options): Reorder the options so that the most commonly used ones come first. 2010-09-26 Neil Jerram <neil@ossau.uklinux.net> Remove unwarranted para * doc/ref/goops.texi (Metaobjects and the Metaobject Protocol): Remove para about GOOPS classes belonging to the usual Scheme namespace. Interest doesn't justify the space that it takes. Edit text about the MOP * doc/ref/goops.texi (The Metaobject Protocol, Metaobjects and the Metaobject Protocol): Minor edits. Start separating doc of the metaobject protocol from that of basic GOOPS usage * doc/ref/goops.texi (Introductory Remarks): Node deleted, with material moved to... (The Metaobject Protocol): ...here. (MOP Specification): Moved to become a subnode of `The Metaobject Protocol'. 2010-09-26 Neil Jerram <neil@ossau.uklinux.net> Promote subsections inside the GOOPS "Reference Manual" section * doc/ref/goops.texi (Reference Manual): Node deleted, with content promoted up to... * doc/ref/goops.texi (GOOPS): ...here. 2010-09-25 Michael Gran <spk121@yahoo.com> Incorrect parsing of NaN complex numbers * libguile/numbers.c (mem2complex): modified * test-suite/tests/reader.test: new complex NaN reader test 2010-09-25 Andy Wingo <wingo@pobox.com> remove vm-version, vm options * libguile/vm.h (struct scm_vm): Remove "options" member. * libguile/vm.c (scm_vm_version, scm_vm_option, scm_set_vm_option_x): Remove. * module/system/vm/vm.scm (vm-version, vm-option, set-vm-option!): Remove. (vms:time, vms:clock): Remove these unused definitions. (vm-load): Remove. "Load" should be reserved for things that exist on disk, methinks. 2010-09-25 Andy Wingo <wingo@pobox.com> fix up options.test * test-suite/tests/options.test (test-suite): Fix up for removal of maxdepth debug option. statprof test traps fix; re-enable accurate call counting test * test-suite/tests/statprof.test: Remove needless debug-enable / trap-enable calls. ("accurate call counting"): Fix this test. Whee :) fix eval.test for procnames eval option * test-suite/tests/eval.test ("define set procedure-name"): Fix needless use of removed 'procnames eval option. 2010-09-24 Andy Wingo <wingo@pobox.com> remove a number of debug options * libguile/private-options.h (SCM_BREAKPOINTS_P, SCM_TRACE_P) (SCM_REC_PROCNAMES_P, SCM_BACKTRACE_INDENT, SCM_N_FRAMES) (SCM_BACKTRACE_MAXDEPTH, SCM_DEVAL_P): Remove these internal names. * libguile/eval.c (scm_debug_opts): Remove the corresponding debug options -- breakpoints, trace, procnames, indent, frames, maxdepth, and debug. * libguile/debug.c (scm_debug_options): Remove SCM_N_FRAMES check. * test-suite/lib.scm (with-debugging-evaluator*): * module/scripts/summarize-guile-TODO.scm: * module/statprof.scm (statprof-reset): * module/ice-9/boot-9.scm (turn-on-debugging): Remove useless debug-enable 'debug calls. * module/ice-9/deprecated.scm (debug-enable): As it seems that 'debug is a particulatly common option that we just removed, add a deprecation shim. * doc/ref/api-options.texi (Debugger options): Update the set of debug options. 2010-09-24 Andy Wingo <wingo@pobox.com> remove evaluator-traps-interface * libguile/debug.h: * libguile/debug.c (scm_with_traps): * libguile/eval.c (scm_evaluator_traps, scm_evaluator_trap_table): Remove these procedures. Note that scm_evaluator_traps was known in Scheme as `evaluator-traps-interface'. * libguile/private-options.h (SCM_TRAPS_P, SCM_ENTER_FRAME_P) (SCM_APPLY_FRAME_P, SCM_EXIT_FRAME_P, SCM_ENTER_FRAME_HDLR) (SCM_APPLY_FRAME_HDLR, SCM_EXIT_FRAME_HDLR, SCM_MEMOIZE_P) (SCM_MEMOIZE_HDLR): Remove these private interfaces. * module/ice-9/boot-9.scm (traps, trap-enable, trap-disable, trap-set!): Remove. * module/ice-9/scm-style-repl.scm (error-catching-loop): Remove with-traps wrap. * doc/ref/api-options.texi (Low level options interfaces): (User level options interfaces, Evaluator trap options) * doc/ref/api-evaluation.texi (Evaluator Behavior): Remove references to the evaluator traps interface. 2010-09-24 Andy Wingo <wingo@pobox.com> remove GDS It is with a sigh that I do this. Farewell, old friend GDS; your bits will live on, reclaimed and reused in the new debugger. * module/Makefile.am: * module/ice-9/gds-client.scm: * module/ice-9/gds-server.scm: Remove these; we favor Geiser now. * emacs/Makefile.am: * emacs/gds-faq.txt: * emacs/gds-scheme.el: * emacs/gds-server.el: * emacs/gds-test.el: * emacs/gds-test.sh: * emacs/gds-test.stdin: * emacs/gds-tutorial.txt: * emacs/gds.el: Remove GDS files. The docs are still around, as they need to be folded into the docmentation of the new debugger. 2010-09-24 Andy Wingo <wingo@pobox.com> remove (ice-9 debugger) and (ice-9 debugging) * module/ice-9/debugger.scm: * module/ice-9/debugger/command-loop.scm: * module/ice-9/debugger/commands.scm: * module/ice-9/debugger/state.scm: * module/ice-9/debugger/trc.scm: * module/ice-9/debugger/utils.scm: * module/ice-9/debugging/breakpoints.scm: * module/ice-9/debugging/example-fns.scm: * module/ice-9/debugging/ice-9-debugger-extensions.scm: * module/ice-9/debugging/load-hooks.scm: * module/ice-9/debugging/steps.scm: * module/ice-9/debugging/trace.scm: * module/ice-9/debugging/traps.scm: * module/ice-9/debugging/trc.scm: Remove these files, as we will favor the REPL's implementation of a debugger, and (system vm traps) and (system vm trap-state). But these old files will continue to inspire the rest of the new debugger interface. 2010-09-24 Andy Wingo <wingo@pobox.com> remove eval-options * libguile/eval.c: * libguile/private-options.h (scm_eval_opts, scm_eval_options_interface) (SCM_EVAL_STACK): Remove these private interfaces. * module/ice-9/boot-9.scm (eval-options, eval-enable, eval-disable) (eval-set!): Remove these procedures. * doc/ref/api-evaluation.texi: * doc/ref/api-options.texi: Remove references to eval options. 2010-09-24 Andy Wingo <wingo@pobox.com> api-debug.texi updates * doc/ref/api-debug.texi (Debugging, Evaluation Model) (Source Properties): Fixes. fix ,traps REPL command * module/system/repl/command.scm (traps): Fix this REPL meta-command. 2010-09-24 Andy Wingo <wingo@pobox.com> remove srcprop.[ch] things that have to do with breakpoints * libguile/eval.c: Mark "breakpoints", "trace", and "procnames" debug options as obsolete. There is lots of work left to do here, though. * libguile/srcprop.h (scm_sym_breakpoint) (scm_c_source_property_breakpoint_p, SRCBRKP): Remove these definitions, without replacements. * libguile/srcprop.c: Remove all code that has to do with breakpoints. 2010-09-24 Ludovic Courtès <ludo@gnu.org> Make `procedure-execution-count' fail gracefully when no source info is available. * module/system/vm/coverage.scm (procedure-execution-count): Handle the case where (null? (program-sources PROC)). 2010-09-24 Ludovic Courtès <ludo@gnu.org> Fix coverage analysis of procedures called from C. * module/system/vm/coverage.scm (with-code-coverage): Switch current thread to VM, using `set-thread-vm!'. * test-suite/tests/coverage.test ("procedure-execution-count")["called from C"]: New test. 2010-09-24 Ludovic Courtès <ludo@gnu.org> Remove unused declarations. * libguile/vm.h (scm_vm_option_ref, scm_vm_option_set_x): Remove. 2010-09-24 Ludovic Courtès <ludo@gnu.org> Add `thread-vm' and `set-thread-vm!'. * libguile/vm.c (thread_vm, scm_thread_vm, scm_set_thread_vm_x): New functions. (scm_the_vm): Add docstring. Use `thread_vm'. * libguile/vm.h (scm_thread_vm, scm_set_thread_vm_x): New declarations. * module/system/vm/vm.scm: Export `thread-vm' and `set-thread-vm!'. 2010-09-24 Andy Wingo <wingo@pobox.com> procedure traps can fire on nested procedures * module/system/vm/traps.scm (frame-matcher): New helper. (trap-at-procedure-call, trap-in-procedure, trap-in-dynamic-extent) (trap-calls-in-dynamic-extent, trap-instructions-in-dynamic-extent) (trap-instructions-in-procedure, trap-at-procedure-ip-in-range): Add ability to trap on procedures that are closures. (trap-at-source-location): Check source-closures first, to catch source locations that are in nested procedures. 2010-09-24 Andy Wingo <wingo@pobox.com> system xref maintains source mapping for nested procedures too * module/system/xref.scm (*closure-sources-db*): New global, like *sources-db* but for nested procedures. It's a separate map because these procs need to be treated differently in trap handlers -- you match on the bytecode, not on the program object. (add-source, forget-source): Take the db as an argument (the normal db or the closures db). (add-sources, forget-sources): Record sources for nested procedures to in *closures-db*. (untaint-sources, ensure-sources-db): Adapt for new closures db. (lookup-source-procedures): Factored out. (source-closures): New exported procedure, returns closures at the given source location. 2010-09-24 Ludovic Courtès <ludo@gnu.org> Fix typo in `weaks.test'. * test-suite/tests/weaks.test (valid?): Check for `value', not `val'. 2010-09-23 Ludovic Courtès <ludo@gnu.org> Fix bug #31081 (`lookahead-u8' returns an s8.) Reported by Göran Weinholt <goran@weinholt.se>. * libguile/r6rs-ports.c (scm_lookahead_u8): Return an unsigned byte. * test-suite/tests/r6rs-ports.test ("7.2.8 Binary Input")["lookahead-u8: result is unsigned"]: New test. 2010-09-23 Ludovic Courtès <ludo@gnu.org> Fixlet in `coverage.test'. * test-suite/tests/coverage.test ("line-execution-counts")["several times"]: Add missing `else' clause. Strengthen the weak hash table tests. * test-suite/tests/weaks.test: Enclose in a module. (valid?): New procedure. ("weak-hash")["weak-key dies, "weak-value dies", "double-weak dies"]: Check that all the values are `valid?', in addition to checking that at least one of them is #f. 2010-09-23 Ludovic Courtès <ludo@gnu.org> Fix weak-value hash tables. * libguile/hashtab.c (scm_hash_fn_set_x): Register a disappearing link to VAL when TABLE is weak-value. * test-suite/tests/weaks.test ("weak-hash")["weak-key dies", "weak-value dies", "doubly-weak dies"]: Use `hash-set!' and `hash-ref', not `hashq-set!' and `hashq-ref', otherwise these tests would always succeed because (eq? "this" "this") => #f. ["lives"]: Use `hash-ref' and `hash-set!' too for consistency. 2010-09-23 Ludovic Courtès <ludo@gnu.org> Define `equal?' for pointer objects. * libguile/eq.c (scm_equal_p): Handle pointer objects. * test-suite/tests/foreign.test ("make-pointer")["equal?", "equal? modulo finalizer", "not equal?"]: New tests. 2010-09-23 Andy Wingo <wingo@pobox.com> add ,break-at-source * module/system/vm/trap-state.scm (add-trap-at-source-location!): New proc. * module/system/repl/command.scm (break-at-source): New repl meta-command. Doesn't work as well as it could now because it doesn't know about nested functions, but that's coming. another trap printing tweak * module/system/vm/trap-state.scm (add-trap-at-procedure-call!): (add-trace-at-procedure-call!): Breakpoint / tracepoint name tweaks. 2010-09-23 Andy Wingo <wingo@pobox.com> list-traps just returns trap identifiers, not names * module/system/vm/trap-state.scm (list-traps): Just return the integers identifying the traps; people can use trap-name to get the names. * module/system/repl/command.scm (traps): Adapt. 2010-09-23 Andy Wingo <wingo@pobox.com> trace printing tweak * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Tweak to the #:prefix string. more uniform break / tracepoint printing in repl * module/system/repl/command.scm (break, tracepoint): In the message, use the trap-name. add trap-name procedure * module/system/vm/trap-state.scm (trap-name): New proc. 2010-09-23 Andy Wingo <wingo@pobox.com> tracepoints print their trap number * module/system/vm/trace.scm (print-application, print-return): Add a prefix before the printout. (trace-calls-to-procedure, trace-calls-in-procedure): Add prefix keyword args. * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): Give a useful prefix for tracepoint printouts. 2010-09-23 Andy Wingo <wingo@pobox.com> add repl ,tracepoint command * module/system/vm/trace.scm (print-return, print-application) (frame-return-values): Factored out of other things. (trace-calls-to-procedure): New proc, installs a trap tracing only calls to the given proc. (trace-calls-in-procedure): Refactor a bit. * module/system/vm/trap-state.scm (add-trace-at-procedure-call!): New proc. * module/system/repl/command.scm (tracepoint): New command, installs a tracepoint on a procedure. 2010-09-23 Andy Wingo <wingo@pobox.com> avoid traps in repl except when evaluating the expression * module/system/vm/trap-state.scm (with-default-trap-handler): Don't enable traps if we are setting a handler of #f. * module/system/repl/error-handling.scm (call-with-error-handling): Add #:trap-handler arg. * module/system/repl/repl.scm (run-repl): Only have traps enabled while running the thunk. Otherwise we trace on procedures called as part of the repl. 2010-09-23 Andy Wingo <wingo@pobox.com> add trap-calls-to-procedure * module/system/vm/traps.scm (trap-frame-finish): Use frame-address instead of frame-dynamic-link. (trap-calls-to-procedure): New proc, traps on procedure calls and their corresponding returns. add scm_frame_address / frame-address * libguile/frames.h: * libguile/frames.c (scm_frame_address): New accessor, returns a frame's fp. 2010-09-23 Andy Wingo <wingo@pobox.com> tracing in terms of traps * module/system/vm/traps.scm (trap-frame-finish) (trap-in-dynamic-extent, trap-calls-in-dynamic-extent) (trap-instructions-in-dynamic-extent): New traps, for implementing tracing, and the `finish' command. * module/system/vm/trace.scm (trace-calls-in-procedure) (trace-instructions-in-procedure): New tracing traps. (vm-trace): Reimplement in terms of the new traps. * module/system/vm/trap-state.scm (add-trap!): New helper; not used in this commit, though. 2010-09-22 Neil Jerram <neil@ossau.uklinux.net> Explain examples of user-defined classes * doc/ref/goops.texi (User-defined classes): New text added to explain the example code. Explain built-in classes like <string> * doc/ref/goops.texi (Built-in classes): New node. (User-defined classes): Show is-a? v and class-of v here, instead of in next node. (Asking for the class of an object): Deleted, no longer needed. 2010-09-22 Neil Jerram <neil@ossau.uklinux.net> Improve GOOPS `Quick Start' doc * doc/ref/goops.texi (Quick Start): Remove words that only reiterate "quick start". * doc/ref/goops.texi (Methods, User-defined classes, Asking for the class of an object): Say "class" instead of "type". They are called classes elsewhere, and in an object-oriented system, people expect classes! 2010-09-22 Neil Jerram <neil@ossau.uklinux.net> Move GOOPS chapter's Stk copyright notice upfront So as to enable more free refactoring of the rest of the chapter * doc/ref/goops.texi (Copyright Notice): New section containing the Stk copyright. * doc/ref/goops-tutorial.texi (Copyright): Equivalent section here deleted. 2010-09-22 Neil Jerram <neil@ossau.uklinux.net> GOOPS doc simplification * doc/ref/goops.texi (GOOPS): Simplify the introductory blurb. 2010-09-21 Andy Wingo <wingo@pobox.com> (system repl command) cleanups * module/system/repl/command.scm (profile, trace, inspect) (pretty-print): Use repl-prepare-eval-thunk instead of the lower-level compile and make-program. 2010-09-21 Andy Wingo <wingo@pobox.com> breakpoints from recursive prompts work * module/system/vm/traps.scm (new-disabled-trap): Don't manipulate the VM trace level in the enable and disable handlers. Unfortunately, this makes traps not work unless you enable hooks, but given that vm_dispatch_hook has to set trace-level to 0, there needs to be an object with a broader view of what traps are enabled. That object is the hook state. * module/system/vm/trap-state.scm (trap-state->trace-level): New procedure. (with-default-trap-handler): Add an optional trap-state argument. Now makes sure that the vm-trace-level is set appropriately during the execution of the thunk, allowing for breakpoints from recursive prompts. 2010-09-20 Ludovic Courtès <ludo@gnu.org> SRFI-1: Rewrite `alist-copy' in Scheme. This partially reverts commit b1fff4e793619b20342cba0015b9367680d3a0bd (Sat Apr 2 2005). * libguile/srfi-1.c (scm_srfi1_alist_copy): Remove. * libguile/srfi-1.h (scm_srfi1_alist_copy): Remove declaration. * module/srfi/srfi-1.scm (alist-copy): New procedure. 2010-09-20 Ludovic Courtès <ludo@gnu.org> Remove the SRFI-1 C proxies. * libguile/srfi-1.c (srfi1_module, CACHE_VAR): Remove. (scm_srfi1_break, scm_srfi1_break_x, scm_srfi1_car_plus_cdr, scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_eighth, scm_srfi1_fifth, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_lset_adjoin, scm_srfi1_ninth, scm_srfi1_not_pair_p, scm_srfi1_reduce, scm_srfi1_reduce_right, scm_srfi1_seventh, scm_srfi1_sixth, scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x, scm_srfi1_tenth, scm_srfi1_xcons): Remove. * libguile/srfi-1.h: Remove the corresponding declarations. 2010-09-19 Andy Wingo <wingo@pobox.com> default-trap-handler bugfix * module/system/vm/trap-state.scm (default-trap-handler): Fix thinko. 2010-09-19 Göran Weinholt <goran@weinholt.se> Fix make-variable-transformer export * module/rnrs/syntax-case.scm: Add make-variable-transformer to the imports. This was causing an unbound variable error even though (rnrs) had been imported. 2010-09-19 Andy Wingo <wingo@pobox.com> add ,traps ,delete ,disable ,enable * module/system/repl/command.scm (traps, delete, disable, enable): New meta-commands. 2010-09-19 Andy Wingo <wingo@pobox.com> implement breakpoints in the repl * module/system/vm/trap-state.scm: New file, tracks a VM-specific set of traps. * module/Makefile.am: Add trap-state.scm. * module/system/repl/error-handling.scm: While in a with-error-handling block, bind a default trap handler that invokes a recursive prompt. * module/system/repl/command.scm: Add a `break' repl meta-command. 2010-09-17 Andy Wingo <wingo@pobox.com> add (system vm traps) * module/system/vm/traps.scm: New module, implements higher-level traps based on the VM hooks. Inspired by (ice-9 debugging traps). Instead of the ice-9's variety, these traps have a procedural interface instead of a GOOPS interface. * module/Makefile.am: Add the new module. 2010-09-17 Andy Wingo <wingo@pobox.com> vm hooks run without hooks * libguile/vm.c (vm_dispatch_hook): Run hooks with the trace-level set to 0. We really don't want hooks running while hooks are running. 2010-09-16 Andy Wingo <wingo@pobox.com> fix bad Makefile.am addition instruction tracing tweak * module/system/vm/trace.scm (vm-trace): No need to output the opcode number, and display the ip as a decimal, not a hexidecimal. only trace instructions inside the thunk * module/system/vm/trace.scm (vm-trace): Only trace instructions when we're in the dynamic extent of the thunk. update vm hooks doc * doc/ref/api-evaluation.texi (VM Behaviour): Half-hearted doc update. 2010-09-16 Andy Wingo <wingo@pobox.com> add vm-abort-continuation-hook, vm-restore-continuation-hook * libguile/vm-i-system.c (call_cc, tail_call_cc): Call the new RESTORE_CONTINUATION_HOOK when a continuation is restored. (prompt): Call the new ABORT_CONTINUATION_HOOK when entering the abort handler's continuation. * libguile/vm-engine.h (ABORT_CONTINUATION_HOOK) (RESTORE_CONTINUATION_HOOK): * libguile/vm.h (SCM_VM_ABORT_CONTINUATION_HOOK) (SCM_VM_RESTORE_CONTINUATION_HOOK): * libguile/vm.c: (scm_vm_abort_continuation_hook): New hook, called when entering an abort handler. (scm_vm_restore_continuation_hook): New hook, called after returning to a continuation. * module/system/vm/vm.scm: Add hooks to export list. 2010-09-16 Andy Wingo <wingo@pobox.com> trim our set of vm hooks * libguile/vm.h (SCM_VM_PUSH_CONTINUATION_HOOK) (SCM_VM_POP_CONTINUATION_HOOK): New hooks, to replace enter/exit/return. (SCM_VM_BOOT_HOOK, SCM_VM_HALT_HOOK, SCM_VM_BREAK_HOOK): Remove these useless hooks. * libguile/vm.c (scm_vm_push_continuation_hook) (scm_vm_pop_continuation_hook): New accessors. * libguile/vm-i-system.c: Remove boot, halt, break, enter, exit, and return hooks. Also remove the break instruction. Instead now when we push a new continuation onto the stack we call PUSH_CONTINUATION_HOOK, and when we pop via a return we call POP_CONTINUATION_HOOK. APPLY_HOOK is now decoupled from continuation pushes and pops. * libguile/vm-engine.h: * libguile/vm-engine.c: Adapt for hooks. * module/system/vm/trace.scm (vm-trace): Adapt for hooks. Also revive the #:instructions? #t mode. * module/system/vm/vm.scm: Adapt exports for new set of hooks. 2010-09-16 Andy Wingo <wingo@pobox.com> remove unused (system vm profile) * module/Makefile.am: * module/system/vm/profile.scm: Remove (system vm profile). We use statprof. 2010-09-15 Ludovic Courtès <ludo@gnu.org> Fix write-beyond-end-of-string error in the conversion to R6RS string escapes. Reported by Mike Gran <spk121@yahoo.com>. * libguile/strings.c (scm_i_unistring_escapes_to_guile_escapes, scm_i_unistring_escapes_to_r6rs_escapes): Augment comments. (scm_to_stringn): When `handler == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE && SCM_R6RS_ESCAPES_P', realloc BUF so that it's large enough for the worst case. * libguile/print.c (display_character): When `result != NULL && strategy == SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE && SCM_R6RS_ESCAPES_P', make LOCALE_ENCODED large enough to hold an R6RS escape. 2010-09-15 Ludovic Courtès <ludo@gnu.org> Optimize `peek-char'. This makes `peek-char' 40x faster on a port whose encoding is faster on a UTF-8 port containing multi-byte codepoints. The `xml->sxml' procedure is 4x faster on a 2.7 MiB XML file. * libguile/ports.c (get_codepoint): New procedure, moved here from `scm_getc', with the additional BUF and LEN parameters. (scm_getc): Use it. (scm_peek_char): Use it instead of the `scm_getc'/`scm_ungetc' sequence. * test-suite/tests/ports.test ("string ports")["peek-char [latin-1]", "peek-char [utf-8]"]: New tests. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/ports.bm'. * benchmark-suite/benchmarks/ports.bm: New file. 2010-09-15 Ludovic Courtès <ludo@gnu.org> Fix copyright year and module name of `write.bm'. * benchmark-suite/benchmarks/write.bm: Fix copyright year and module name. 2010-09-15 Ludovic Courtès <ludo@gnu.org> Re-introduce pretty-printing of combining characters. This had been removed by commit 07f49ac786e0f1c007eb336e2fb7a572e8405316 ("Factorize and optimize `write' for strings and characters."). Thanks Mike! * libguile/print.c (write_combining_character): New procedure. (write_character): Use it. * test-suite/tests/chars.test ("basic char handling")["combining accent is pretty-printed", "combining X is pretty-printed"]: New tests. * test-suite/tests/encoding-iso88591.test ("characters")["write A followed by combining accent"]: New test. * test-suite/tests/encoding-utf8.test ("characters")["write A followed by combining accent"]: New test. 2010-09-14 Ludovic Courtès <ludo@gnu.org> Remove commented out code from `print.c'. * libguile/print.c (scm_write, scm_display, scm_write_char): Remove `#if 0'-d code. 2010-09-14 Ludovic Courtès <ludo@gnu.org> Factorize and optimize `write' for strings and characters. According to `write.bm', this makes `write' 2.6 times faster for strings. * libguile/print.c (iprin1): Use `write_character' when `SCM_WRITINGP (pstate)' and `SCM_CHARP (exp)' or `scm_is_string (exp)'. (scm_i_charprint): Remove. (display_character, write_character): New functions. (scm_write_char): Use `display_character' instead of `scm_i_charprint'. * libguile/print.h (scm_i_charprint): Remove declaration. * benchmark-suite/benchmarks/write.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/write.bm'. 2010-09-14 Ludovic Courtès <ludo@gnu.org> Internally expose `scm_i_unistring_escapes_to_{guile,r6rs}_escapes'. * libguile/strings.c (unistring_escapes_to_guile_escapes): Rename to... (scm_i_unistring_escapes_to_guile_escapes): ... this. Change `char **bufp' to `char *buf'; leave realloc responsibility to the caller. Update caller. (unistring_escapes_to_r6rs_escapes): Rename to... (scm_i_unistring_escapes_to_r6rs_escapes): ... this. Likewise. 2010-09-12 Andy Wingo <wingo@pobox.com> doc/ref lib-version.texi removal * doc/ref/.gitignore: * doc/ref/Makefile.am: * doc/ref/guile.texi: Remove rules for generating an unused lib-version.texi. libguile gitignore * libguile/.gitignore: Fix for recent cpp-{E,SIG} change. build tweak to remove SRFI version definitions * GUILE-VERSION: Remove SRFI version definitions, as they are no longer needed. 2010-09-12 Andy Wingo <wingo@pobox.com> move srfi-1 and srfi-60 C impl to libguile, without public C api * libguile/srfi-1.c: * libguile/srfi-1.h: * libguile/srfi-60.c: * libguile/srfi-60.h: * libguile/ChangeLog-srfi: Move here, from the srfi/ dir. The C API is internal. Add API to register the extensions, called by init.c. * libguile/init.c: Verily, register srfi extensions. * libguile/Makefile.am: Add srfi files. * module/srfi/srfi-1.scm: * module/srfi/srfi-60.scm: Update load-extension invocation. * Makefile.am: * configure.ac: Remove srfi/ dir. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-srfi-1.c: Remove srfi-1 C test, we don't support this API any more. 2010-09-12 Andy Wingo <wingo@pobox.com> remove empty srfi-4, srfi-13, and srfi-14 shlibs * srfi/srfi-13.c: * srfi/srfi-13.h: * srfi/srfi-14.c: * srfi/srfi-14.h: * srfi/srfi-4.c: * srfi/srfi-4.h: * srfi/Makefile.am: * configure.ac: Remove empty shlibs and headers for srfis 4, 13, and 14. The "version" was never programmatically exported, so there's no possible way people could have used these. 2010-09-12 Neil Jerram <neil@ossau.uklinux.net> Create tags for Scheme source * am/guilec: Set ETAGS_ARGS. * module/Makefile.am: When adding sources to EXTRA_DIST, add them to ETAGS_ARGS too. 2010-09-12 Michael Gran <spk121@yahoo.com> Provide non-locale C/Scheme string conversion functions * doc/ref/api-data.texi: document scm_to_stringn, scm_from_stringn, scm_to_latin1_stringn, and scm_from_latin1_stringn * libguile/strings.h (scm_to_stringn): make public (scm_to_latin1_stringn): new declaration (scm_from_latin1_stringn): new declaration * libguile/strings.c (scm_to_latin1_stringn): new function (scm_from_latin1_stringn): new function 2010-09-11 Neil Jerram <neil@ossau.uklinux.net> Document scm_wrong_type_arg_msg * doc/ref/api-control.texi: New def for scm_wrong_type_arg_msg. Remove non-existent *environment* APIs from api-undocumented.texi * doc/ref/api-undocumented.texi: Remove entries for the never used, and now removed, environment API. Remove unnecessary blank "Indices" page. * doc/ref/guile.texi: Remove `Indices' heading. 2010-09-10 Andy Wingo <wingo@pobox.com> new procedure: source-procedures * module/system/xref.scm (source-procedures): New public procedure, gives the procedures defined at a given source location. (system xref) uses module-submodules * module/system/xref.scm (ensure-callers-db): Fix up to use module-submodules. regenerate psyntax-pp.scm * module/ice-9/psyntax-pp.scm: Regenerate. simplify module/Makefile.am rules to not require touch * module/Makefile.am (ice-9/psyntax-pp.go, ice-9/psyntax-pp.scm.gen) (ice-9/eval.go): Simplify rules to not require `touch', now that .go files are checked for freshness, not for synchronicity. 2010-09-08 Ludovic Courtès <ludo@gnu.org> Clarify feature macro conditionals. * libguile/numbers.c (scm_log10): Check whether `HAVE_COMPLEX_DOUBLE' and `HAVE_CLOG10' are defined instead of checking whether they are non-zero. (scm_sqrt): Likewise for `HAVE_COMPLEX_DOUBLE' and `HAVE_USABLE_CSQRT'. 2010-09-08 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `isnan' and `isinf' modules. This updates Gnulib to v0.0-4219-g84cdd8b. * m4/gnulib-cache.m4: Add `isinf' and `isnan'. * configure.ac: Remove checks for `floatingpoint.h', `ieeefp.h', and `nan.h'. * libguile/gen-scmconfig.c (main): Remove definitions of `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', and `SCM_HAVE_NAN_H'. * libguile/numbers.c (isnan)[SCO && !HAVE_ISNAN]: Remove. (isinf)[SCO && !HAVE_ISINF]: Remove. (xisinf, xisnan): Remove. Change callers to use `isinf' and `isnan'. (guile_ieee_init): Remove the `defined HAVE_ISINF' and `define HAVE_ISNAN' conditions. * libguile/numbers.h: Remove code conditional on `SCM_HAVE_FLOATINGPOINT_H', `SCM_HAVE_IEEEFP_H', or `SCM_HAVE_NAN_H'. 2010-09-06 Ludovic Courtès <ludo@gnu.org> Use `have-lib' when checking for libltdl. Suggested by primus <rprimus@gmail.com>. * configure.ac: Use `AC_LIB_HAVE_LINKFLAGS' when checking for libltdl. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): Add $(LTLIBLTDL). * README: Update to make it clear that libgc and libffi don't have a `--with-XXX-prefix' option. 2010-09-06 Ludovic Courtès <ludo@gnu.org> Rename `make-foreign-function' to `pointer->procedure'. * libguile/foreign.c (scm_make_foreign_function): Rename to... (scm_pointer_to_procedure): ... this. * libguile/foreign.h: Adjust accordingly. * module/system/foreign.scm: Likewise. * test-suite/standalone/test-ffi: Likewise. * test-suite/tests/foreign.test: Likewise. * doc/ref/api-foreign.texi: Likewise. 2010-09-06 Andy Wingo <wingo@pobox.com> fix to program-module * libguile/programs.c (scm_program_module): Fix an edge case in which this function returned non-modules. Thanks to José Antonio Ortega Ruiz, Caballero del Cálculo Lambda for the report. 2010-09-04 Ludovic Courtès <ludo@gnu.org> Add `.version' to the distribution. * Makefile.am (EXTRA_DIST): Add `.version'. Remove `m4/autobuild.m4'. Bump version number for 1.9.12. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2010-09-04 Andy Wingo <wingo@pobox.com> fix guile-tools --help and --version * meta/guile-tools.in: Fix --help and --version. boot-9 refactor * module/ice-9/boot-9.scm (make-root-module, make-scm-module): Remove these functions; they are only called once, so we inline them at their call sites. (the-root-module, the-scm-module): The aforementioned call sites. 2010-09-04 Ludovic Courtès <ludo@gnu.org> Update `NEWS' for 1.9.12. * NEWS: Update. Don't say "source file is newer" when either file is inaccessible. * libguile/load.c (compiled_is_fresh): Don't emit "source file is newer" warning when either FULL_FILENAME or COMPILED_FILENAME could not be stat'd. This is consistent with what load/compiled-file-name do. 2010-09-04 Ludovic Courtès <ludo@gnu.org> Compare source/compiled file timestamps with nano-second resolution. * libguile/load.c (compiled_is_fresh): Rename `res' to `compiled_is_newer'. Use `get_stat_mtime' to compare with nano-second resolution when available. * module/ice-9/boot-9.scm (load)[fresh-compiled-file-name]: Likewise, using `stat:mtimensec'. 2010-09-04 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `stat-time' module; update Gnulib. This updates Gnulib files to v0.0-4207-gc82b481. * m4/gnulib-cache.m4: Add `stat-time'. 2010-09-04 Ludovic Courtès <ludo@gnu.org> Add an entertaining `procedure->pointer' test. * test-suite/tests/foreign.test ("procedure->pointer")["bijection"]: New test. 2010-09-03 Ludovic Courtès <ludo@gnu.org> Fix the `put-bytevector' tests. * libguile/vports.c (sf_write): Add comment about what happens when DATA contains binary data. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector [2 args]", "put-bytevector [3 args]", "put-bytevector [4 args]"]: Require a Latin-1 locale. 2010-09-03 Ludovic Courtès <ludo@gnu.org> Add license header to `test-ffi'. * test-suite/standalone/test-ffi: Add license header. 2010-09-03 Ludovic Courtès <ludo@gnu.org> Add `procedure->pointer' to the FFI. * libguile/foreign.c (make_cif): New procedure, with code formerly in `scm_make_foreign_function'. (scm_make_foreign_function): Use it. (invoke_closure, scm_procedure_to_pointer)[FFI_CLOSURES]: New functions. * libguile/foreign.h (scm_procedure_to_pointer): New declaration. * module/system/foreign.scm: Export `procedure->pointer' when available. * test-suite/standalone/test-ffi (f-callback-1, f-callback-2): New procedures and related tests. * test-suite/standalone/test-ffi-lib.c (test_ffi_callback_1, test_ffi_callback_2): New functions. * test-suite/tests/foreign.test ("procedure->pointer"): New test prefix. * doc/ref/api-foreign.texi (Dynamic FFI): Document `procedure->pointer'. 2010-09-03 Jose A. Ortega Ruiz <jao@gnu.org> Fix for `submodules' in (ice-9 session) (closes #30062) * module/ice-9/session.scm (submodules): replace implementation to use `module-submodules' instead of `module-obarray' (the latter doesn't include submodules anymore). * test-suite/tests/session.test: new test suite for session, checking the exported procedures that use `submodules'. 2010-09-03 Andy Wingo <wingo@pobox.com> module-ref-submodule deprecation fixes * module/ice-9/boot-9.scm (module-ref-submodule) (module-define-submodule!): Pull deprecated shims here, as we need them before loading (ice-9 deprecated). Also bugfix to only define the module if there is no local variable, even if it is unbound. * module/ice-9/deprecated.scm: Remove from here. 2010-09-03 Andy Wingo <wingo@pobox.com> back-compat in (rnrs) for deprecated modules-in-value-namespace * module/rnrs.scm (rnrs): Work around some unavoidable (I think) behavior when back-compatible unified namespaces are enabled; see comments in source. module-local-variable optimization * libguile/modules.c (scm_module_local_variable): An optimization in the common no-module-binder case. 2010-09-02 Ludovic Courtès <ludo@gnu.org> Fix memory leak in `lock-mutex' (aka. `scm_lock_mutex'.) The memory leak is trivially reproducible with: (define m (make-mutex)) (let loop () (lock-mutex m) (unlock-mutex m) (loop)) or similarly with: (define p (delay (+ 1 2))) (let loop () (force p) (loop)) since `force' acquires P's mutex. It could also lead to premature release of a thread waiting in `fat_mutex_lock' when a former owner's `do_thread_exit' is run. * libguile/threads.c (fat_mutex_unlock): When `m->level' becomes 0, remove MUTEX from `t->mutexes'. (fat_mutex_lock): Update comment above the `t->mutexes' assignment. (do_thread_exit): Add an assertion making sure that each mutex in `t->mutexes' is owned by T. 2010-09-02 Ludovic Courtès <ludo@gnu.org> Avoid calls to `scm_current_thread' in `fat_mutex_unlock'. * libguile/threads.c (fat_mutex_unlock): Use `t->handle' instead of calling `scm_current_thread'. 2010-09-02 Ludovic Courtès <ludo@gnu.org> Fix typos. * module/system/repl/repl.scm (run-repl): Fix variable name: `k', not `key'. * module/texinfo/docbook.scm: Use `(srfi srfi-1)' for `fold'. 2010-09-02 Ludovic Courtès <ludo@gnu.org> SRFI-1: Rewrite `drop-right!', `drop-while', `reduce', etc. in Scheme. This partially reverts commit e9508fbb7df0b1ead007637f16d80cf831776307 (May 3 2005). * module/srfi/srfi-1.scm (take!, drop-right!, reduce, reduce-right, take-while, take-while!, drop-while, span, span!, lset-adjoin): New procedures. * srfi/srfi-1.c (scm_srfi1_drop_right_x, scm_srfi1_drop_while, scm_srfi1_lset_adjoin, scm_srfi1_reduce, scm_srfi1_reduce_right, scm_srfi1_span, scm_srfi1_span_x, scm_srfi1_take_x, scm_srfi1_take_while, scm_srfi1_take_while_x): Rewrite as proxies to the corresponding Scheme procedures. * benchmark-suite/benchmarks/srfi-1.bm ("drop-while"): New benchmark prefix. 2010-09-01 Ludovic Courtès <ludo@gnu.org> Rewrite `fport_flush' using Gnulib's `full_write'. * libguile/fports.c (fport_flush): Rewrite using `full_write'. popen.test: Don't auto-compile `popen-child.scm'. * test-suite/tests/popen.test ("open-output-pipe")["no duplicate"]: Disable auto-compilation of `popen-child.scm'. Add `test-suite/tests/popen-child.scm' to the distribution. * test-suite/Makefile.am (SCM_TESTS): Add `tests/popen-child.scm'. 2010-08-31 Jose A. Ortega Ruiz <jao@gnu.org> Add new debug meta-command ,error-message * module/system/repl/error-handling.scm: use the error string to construct the <debug> instance. * module/system/repl/command.scm: new debug command `error-message' that extracts the new <debug> field, available to stack commands as `message'. * doc/ref/scheme-using.texi: documentation for new command. * module/system/repl/debug.scm: <debug> stores the error string in a new field. 2010-08-30 Andy Wingo <wingo@pobox.com> fix #y back-compat shim * module/ice-9/deprecated.scm (#\y): #y was in fact a syntax for s8vectors, not bitvectors. Fix. 2010-08-30 Andy Wingo <wingo@pobox.com> bitvector work * test-suite/Makefile.am: * test-suite/tests/bitvectors.test: Add a new file to test bitvectors. * libguile/uniform.c (scm_c_uniform_vector_length): Don't call scm_uniform_vector_elements, as we don't need to be able to access the elements with pointers to bytes. Fixes uniform-vector-length on bitvectors. 2010-08-30 Andy Wingo <wingo@pobox.com> docstrings in syntax-rules * module/ice-9/psyntax.scm (syntax-rules): Allow a docstring between the literals and the first clause. 2010-08-29 Andy Wingo <wingo@pobox.com> define* usage in boot-9 * module/ice-9/boot-9.scm (make-module, make-mutable-parameter): Use define*. 2010-08-29 Andy Wingo <wingo@pobox.com> add flag to vtables to indicate that their layout is valid * libguile/struct.h (SCM_VTABLE_FLAG_VALIDATED): New flag, indicates that the layout of a vtable has been validated. The other flags have been renumbered. * libguile/struct.c (scm_i_struct_inherit_vtable_magic): Set the VALIDATED flag if everything goes through. (scm_struct_vtable_p): If the struct should be a vtable but isn't validated, throw an error. (scm_make_vtable_vtable): Validate the incoming user_fields layout bit. Set the VALIDATED flag. (scm_c_make_structv): Add a comment about the case in which we delay scm_i_struct_inherit_vtable_magic. 2010-08-28 Andy Wingo <wingo@pobox.com> deprecate passing a number as the destination to `format' * module/ice-9/format.scm (format): Deprecate having a number as the destination. * doc/ref/misc-modules.texi (Formatted Output): Update docs. threadsafety in deprecation, extensions * libguile/deprecation.c (scm_c_issue_deprecation_warning): * libguile/extensions.c (scm_c_register_extension, load_extension): Add locks around global data structures. net-db.test tweak * test-suite/tests/net-db.test: Throw 'unresolved if we have a crap DNS that is returning results for all addresses. threadsafe object properties * libguile/objprop.c: Add locking around the properties weak hash, to avoid corrupting the whash. README fix for PKG_CONFIG=true * README: Add note that if you override pkg-config, you need to set libffi flags as well. Thanks to Mark Weaver. 2010-08-28 Andreas Rottmann <a.rottmann@gmx.at> Several fixes to R6RS libraries * module/rnrs/arithmetic/fixnums.scm (fixnum-width): Make this return an an exact integer instead of an inexact number. * module/rnrs/base.scm (assertion-violation): Implement. * module/rnrs/conditions.scm (simple-conditions): Allow also simple conditions as argument. * module/rnrs/enums.scm (define-enumeration): Properly construct empty enumeration sets. * module/rnrs/exceptions.scm (guard): Don't restrict the body to a single expression. * module/rnrs/records/syntactic.scm (define-record-type0): Expand into a series of definitions only. 2010-08-27 Andy Wingo <wingo@pobox.com> Revert "don't autocompile while snarfing" This reverts commit 176ee5c82a9e6c775722cfe96711f2a02cdb7672, which added autocomp inhibitions in the wrong place. 2010-08-27 Andy Wingo <wingo@pobox.com> Revert "[build] Rewrite guile-func-name-check in Scheme, adding features." This reverts commit 6832604efa0f175a70be700624c365547fb27878. Not only does this fail on a fresh build due to a lack of "guile", but even if it did have its Makefile fixed, it would take too long to run, because the rest of Guile isn't compiled. The right thing is to avoid invoking Guile until after at least psyntax and boot-9 have been compiled. This commit can be reinstated if we move doc snarfing to a phase that happens after module/ is compiled. 2010-08-27 Andy Wingo <wingo@pobox.com> don't autocompile while snarfing * am/snarf (GUILE_SNARF): Don't autocompile while snarfing, as we probably don't have a compiled Guile at this point. 2010-08-27 Ludovic Courtès <ludo@gnu.org> Document (ice-9 match). * doc/ref/Makefile.am (guile_TEXINFOS): Add `match.texi'. * doc/ref/guile.texi (Guile Modules): Include `match.texi'. * doc/ref/match.texi: New file. * doc/ref/sxml-match.texi (sxml-match): Add xref to `match.texi'. * module/ice-9/match.scm: Note lack of support for `(pat => exp)'. 2010-08-27 Ludovic Courtès <ludo@gnu.org> SRFI-1: Choose better benchmark names. * benchmark-suite/benchmarks/srfi-1.bm ("fold"): Rename sub-tests to "big" and "small". 2010-08-27 Ludovic Courtès <ludo@gnu.org> SRFI-1: Rewrite `break' and `break!' in Scheme. This partially reverts commit 6e9f3c2676c0101590d4229653e9c628cb293064 (Tue May 3 2005). * module/srfi/srfi-1.scm (break, break!): New procedures. * srfi/srfi-1.c (scm_srfi1_break, scm_srfi1_break_x): Rewrite as proxies to the corresponding Scheme procedures. * test-suite/standalone/test-srfi-1.c (failure): New function. (tests): Add `scm_srfi1_break' test. Use `failure'. 2010-08-27 Ludovic Courtès <ludo@gnu.org> SRFI-1: Rewrite `fifth', `sixth', etc. in Scheme. This partially reverts commit 03731332d5dc8d650b947f5126427402c2b1d8bb (Tue May 3 2005). * module/srfi/srfi-1.scm (fifth, sixth, seventh, eighth, ninth, tenth): New procedures. * srfi/srfi-1.c (scm_srfi1_fifth, scm_srfi1_sixth, scm_srfi1_seventh, scm_srfi1_eighth, scm_srfi1_ninth, scm_srfi1_tenth): Rewrite as proxies to the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("eighth")["() -1"]: Change exception type to `exception:wrong-type-arg'. ("fifth")["() -1"]: Likewise. ("ninth")["() -1"]: Likewise. ("seventh")["() -1"]: Likewise. ("sixth")["() -1"]: Likewise. ("tenth")["() -1"]: Likewise. 2010-08-27 Ludovic Courtès <ludo@gnu.org> Remove unneeded #:use-module. * module/system/vm/frame.scm: Remove use of (srfi srfi-1). 2010-08-27 Ludovic Courtès <ludo@gnu.org> Assorted `syntax-check' fixes. * doc/ref/Makefile.am ($(snarf_doc).am): Untabify. * libguile/eval.c: Remove unnecessary <assert.h> inclusion. * .x-sc_m4_quote_check: Update. * libguile/error.c (scm_error_scm): Use `EXIT_FAILURE' instead of 1. * libguile/init.c (fixconfig, scm_boot_guile): Likewise. * libguile/null-threads.h (scm_i_pthread_exit): Likewise. * libguile/script.c (scm_compile_shell_switches): Likewise. * test-suite/standalone/test-conversion.c: Likewise. * test-suite/standalone/test-list.c: Likewise. * test-suite/standalone/test-unwind.c: Likewise. * libguile/async.c: Remove unnecessary inclusion of <signal.h>. * NEWS: "filesystem" -> "file system". * doc/ref/r6rs.texi: Ditto. * cfg.mk (local-checks-to-skip): New variable. * .x-sc_m4_quote_check, .x-sc_obsolete_symbols, .x-sc_program_name, .x-sc_prohibit_atoi_atof, .x-sc_prohibit_magic_number_exit: New files. * .gitignore: Update. 2010-08-27 Andy Wingo <wingo@pobox.com> fix <letrec> docs * doc/ref/compiler.texi (Tree-IL): Fix docs for external representation of letrec. Thanks to No Itisnt. 2010-08-26 Thien-Thi Nguyen <ttn@gnuvola.org> [build] Rewrite guile-func-name-check in Scheme, adding features. * libguile/guile-func-name-check: Rewrite in Scheme; add inhibition directives, string-literal handling, failureful exit on error. * libguile/guile-snarf-docs.in: Use ‘@top_builddir@/meta/guile’. * libguile/pairs.c: Add guile-func-name-check inhibition directive. [build] Refine libguile/*.doc snarfing. * libguile/guile-snarf-docs.in: Rewrite to incorporate all three phases of snarfing: func-name check, cpp, tokenization. Also, require/check new command-line syntax. * libguile/Makefile.am (AM_V_FILTER): Delete var. (AM_V_FILTER_, AM_V_FILTER_0): Likewise. (.c.doc): Run ./guile-snarf-docs; use new command-line syntax. 2010-08-25 Andy Wingo <wingo@pobox.com> consolidate sitedir definition * configure.ac (sitedir): Fix definition to point to the version-specific sitedir. * libguile/Makefile.am (libpath.h): Take sitedir definition from configure.ac. 2010-08-25 Andy Wingo <wingo@pobox.com> update download location in manual * doc/ref/intro.texi (Obtaining and Installing Guile): Update download location. 2010-08-19 Thien-Thi Nguyen <ttn@gnuvola.org> [build] Use AM_SILENT_RULES for generating cpp-E.c, cpp-SIG.c. * libguile/Makefile.am (.syms.c): Prefix first command with $(AM_V_GEN); unconditionally silence second command. 2010-08-19 Andy Wingo <wingo@pobox.com> objcodes.c comments * libguile/objcodes.c: Comments from Noah Lavine 2010-08-19 Noah Lavine <nlavine@haverford.edu> Whitespace fix Add a space in libguile/objcodes.c to comply with the GNU Coding Standards. 2010-08-18 Thien-Thi Nguyen <ttn@gnuvola.org> [build] Fix sed portability bug: Don't use '\n' in sed script. Regression introduced 2010-07-22, "[build] Overhaul <errno.h>, <signal.h> cpp symbol extraction/checking". See: <http://autobuild.josefsson.org/guile/log-201008181002653292000.txt> * libguile/Makefile.am (.syms.c): Convert one-liner sed script to while-read-echo loop. 2010-08-18 Thien-Thi Nguyen <ttn@gnuvola.org> [build] Create libguile/version.h using the configure script. * configure.ac (AC_CONFIG_FILES): Add libguile/version.h. * libguile/Makefile.am (version.h): Delete target. (EXTRA_DIST): Remove version.h.in. (BUILT_SOURCES): Remove version.h. (MOSTLYCLEANFILES): Remove version.h, version.h.tmp. * libguile/version.h.in (SCM_MAJOR_VERSION): Use conventional @VAR@ instead of @-VAR-@ for ‘GUILE_MAJOR_VERSION’. (SCM_MINOR_VERSION, SCM_MICRO_VERSION, SCM_EFFECTIVE_VERSION): Likewise for ‘GUILE_MINOR_VERSION’, ‘GUILE_MICRO_VERSION’, ‘GUILE_EFFECTIVE_VERSION’. 2010-08-17 Andy Wingo <wingo@pobox.com> update scsh doc * doc/ref/scsh.texi (The Scheme shell (scsh)): Remove broken link to arglist.com/guile/, and add note about bitrotting. further discouraged excision * libguile/gen-scmconfig.h.in: Remove a DISCOURAGED define. 2010-08-17 Andy Wingo <wingo@pobox.com> a number of doc fixes * doc/ref/api-control.texi (Handling Errors): Update docs for display-error. * libguile/backtrace.h (scm_i_display_error): Change prototype to s/stack/frame/. * libguile/throw.c (handler_message): Change invocation of scm_i_display_error to pass a frame. * doc/ref/api-deprecated.texi (Deprecation): Update wording. * doc/ref/api-evaluation.texi (Local Evaluation): Remove section on local-eval. * doc/ref/api-macros.texi: Fix a couple typos. * doc/ref/api-memory.texi (Objects): Remove terrible section. * doc/ref/api-procedures.texi (Procedure Properties): Remove docs for closure?. (Compiled Procedures): Update wording. * doc/ref/guile.texi (API Reference): Remove reference to "Objects". 2010-08-17 Andy Wingo <wingo@pobox.com> minor NEWS tweaks * NEWS: Minor tweaks. reindent psyntax.scm * module/ice-9/psyntax.scm: Reindent. 2010-08-17 Andy Wingo <wingo@pobox.com> update comments in psyntax.scm * module/ice-9/psyntax.scm: Update comments. Fix a couple of needless conses in and-map. * module/ice-9/psyntax-pp.scm (#{and-map*\ 35}): Regen. 2010-08-17 Andy Wingo <wingo@pobox.com> @apply for multiple args in the boot memoizer * libguile/memoize.c (m_apply): Fix for multiple arguments, as in (@apply proc foo bar baz). 2010-08-16 Ludovic Courtès <ludo@gnu.org> Fix i18n tests when no French locale is available. * test-suite/tests/i18n.test ("number->locale-string")["French"]: Move `under-french-locale-or-unresolved' within each `pass-if'. 2010-08-15 Andreas Rottmann <a.rottmann@gmx.at> Link test-srfi-1 to libguile as well With an installed copy of libguile in place, test-srfi-1 would be run using that instead of the in-tree libguile. * test-suite/standalone/Makefile.am (test_srfi_1_LDADD): Add libguile. 2010-08-15 Ludovic Courtès <ludo@gnu.org> Add `string->pointer' and `pointer->string' to the FFI. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): New functions. * libguile/foreign.h (scm_string_to_pointer, scm_pointer_to_string): New declarations. * module/system/foreign.scm: Export `string->pointer' and `pointer->string'. * test-suite/tests/foreign.test ("pointer<->string"): New test prefix. * doc/ref/api-foreign.texi (Void Pointers and Byte Access): Add `string->pointer' and `pointer->string'. 2010-08-15 Ludovic Courtès <ludo@gnu.org> Add `number->locale-string' tests. * test-suite/tests/i18n.test ("number->locale-string"): New test prefix. 2010-08-09 Julian Graham <julian.graham@aya.yale.edu> Explicit definitions for `memp' and `assp' in `(rnrs list)'; the predicate argument to Guile's `member' and `assoc' functions has a different expected arity. * module/rnrs/lists.scm (memp, assp): Wrap the predicate function with a two-argument wrapper before calling Guile's underlying implemenation. * test-suite/Makefile.am: Add test-suite/tests/r6rs-lists.test to SCM_TESTS. * test-suite/tests/r6rs-lists.test: New file. Explicit definitions for `vector-for-each' and `vector-map'; Guile's SRFI-1 `for-each' and `map' implementations do not operate on lists and vectors interchangeably. * module/rnrs/base.scm (vector-for-each, vector-map): New functions. * test-suite/Makefile.am: Add test-suite/tests/r6rs-base.test to SCM_TESTS. * test-suite/tests/r6rs-base.test: New file. 2010-08-08 Andy Wingo <wingo@pobox.com> further rnrs incompat note * doc/ref/r6rs.texi: Note about rnrs io ports. 2010-08-08 Andy Wingo <wingo@pobox.com> loose ends from "discouraged" removal * README: Remove docs on "discouraged". * configure.ac: Remove one more "discouraged" thing. * doc/ref/api-deprecated.texi: Rename from api-discdepr.texi, and remove sections on "discouraged". * doc/ref/Makefile.am: * doc/ref/guile.texi: Update referrers. 2010-08-08 Andy Wingo <wingo@pobox.com> remove "discouraged" infrastructure * libguile/discouraged.h: Remove. * libguile/deprecated.c (scm_internal_select, scm_thread_sleep) (scm_thread_usleep): Deprecate formerly discouraged names. * libguile/eq.h (SCM_EQ_P): * libguile/pairs.h (SCM_NULLP, SCM_NNULLP, SCM_CONSP, SCM_NCONSP): * libguile/boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOLP, SCM_BOOL): (SCM_NEGATE_BOOL, SCM_BOOL_NOT): Undiscourage these names, because I'm not sure deprecating them will do any good. * libguile.h: * libguile/gen-scmconfig.c: * libguile/numbers.c: * libguile/init.c: * libguile/Makefile.am: * configure.ac: Remove bits that referenced discouraged.h, and dealt with the "discouraging" system. 2010-08-08 Andy Wingo <wingo@pobox.com> deprecated all discouraged functions * libguile/Makefile.am: * libguile/discouraged.c: Remove discouraged.c. * libguile/deprecated.c: * libguile/deprecated.h: * libguile/discouraged.h: All functions and declarations moved from discouraged.[ch] to deprecated.[ch], adding deprecation warnings. * libguile/init.c: Remove discouraged init. * libguile/numbers.c (scm_num2float, scm_num2double): Deprecate. * test-suite/standalone/test-num2integral.c: Port to modern API. 2010-08-08 Andy Wingo <wingo@pobox.com> more r6rs incompat * doc/ref/r6rs.texi (R6RS Incompatibilities): Add section on string syntax. add section on toplevel expansion to r6rs incompatibilities * doc/ref/r6rs.texi (R6RS Incompatibilities): Add a section about toplevel expansion, before taking a look at fixing it... 2010-08-06 Andy Wingo <wingo@pobox.com> more NEWS updates * NEWS: Update some more. fix stack narrowing for tail-call to throw * module/system/repl/debug.scm (narrow-stack->vector): Fix for the tail-call to `throw' case, as in `(quit)'. ,x unbound does not quit repl * module/system/repl/repl.scm (run-repl): Catch errors executing metacommands. Feature on top of feature... update NEWS for 1.9.12 (mostly) * NEWS: Update for 1.9.12. 2010-08-06 Andy Wingo <wingo@pobox.com> add docs for extensiondir; misc other fixes * libguile/foreign.c (scm_i_pointer_print): Print in hexadecimal. * doc/ref/api-foreign.texi (Modules and Extensions): Update for "extensiondir", and a discussion of Guile versions. (Foreign Variables): Fix discussion of types. (Void Pointers and Byte Access): Fix typo. 2010-08-06 Andy Wingo <wingo@pobox.com> remove type discusison from dynamic-pointer docstring * doc/ref/api-foreign.texi: * libguile/dynl.c (scm_dynamic_pointer): Remove discussion of types from the docstring. s/extensionsdir/extensiondir/ * libguile/Makefile.am (libpath.h): Change "extensionsdir" to "extensiondir". * meta/guile-2.0.pc.in (extensiondir): Likewise. 2010-08-06 Andy Wingo <wingo@pobox.com> %site-dir is specific to the effective version * libguile/load.h: * libguile/load.c (scm_sys_global_site_dir): New API, is what %site-dir used to be. (scm_sys_site_dir): Changed to be a version-specific dir. (scm_init_load_path): Search the version-specific sitedir before the global one. * libguile/Makefile.am (libpath.h): Update SCM_SITE_DIR and SCM_GLOBAL_SITE_DIR, as appropriate. 2010-08-06 Andy Wingo <wingo@pobox.com> only one Value History section * doc/ref/repl-modules.texi: Remove section on Value History, it's covered in scheme-using. * doc/ref/scheme-using.texi: Rename "Value Historyx" section to "Value History". * doc/ref/guile.texi: Update xref. add settable identifier syntax docs * doc/ref/api-macros.texi (Identifier Macros): Add documentation for settable identifier syntax. 2010-08-06 Andy Wingo <wingo@pobox.com> letrec* in docs, and some r6rs fixes * doc/ref/api-binding.texi: Add docs for letrec*, and revise some other text. * doc/ref/compiler.texi: Update <letrec> for in-order?. * doc/ref/r6rs.texi: Add letrec* entry. * module/rnrs.scm: * module/rnrs/base.scm: Export letrec*. 2010-08-05 Andy Wingo <wingo@pobox.com> fold 1.9.11 news into main body * NEWS: Update. 2010-08-04 Andy Wingo <wingo@pobox.com> fix vector-move-right! and vector-move-left! * libguile/vectors.c (scm_vector_move_left_x, scm_vector_move_right_x): Fix some bugs reported by Michael Lucy -- both variants would happily write beyond the end, and vector-move-right! didn't increment the counter before copying in the reverse direction. * test-suite/tests/vectors.test ("vector-move-left!"): ("vector-move-right!"): Add tests. 2010-08-04 Yan Li <yan.i.li@intel.com> Compiling DOT_X_FILES requires version.h There was a race condition when building Guile since DOT_X_FILES didn't depend on version.h, which is dynamically generated. Sometimes the DOT_X_FILES are compiled before the version.h is generated and leads to build failure. This patch fixed this problem. 2010-08-01 Andreas Rottmann <a.rottmann@gmx.at> Fix the range of `random' on 64-bit platforms For > 32 bit integers still in the fixnum range, scm_random() would return random numbers with a lower range than specified. * libguile/random.c (scm_i_mask32): New static inline function. (scm_c_random): Use `scm_i_mask32'. (scm_c_random64): New function, 64-bit variant of scm_c_random. (scm_random): Use `scm_c_random64' instead of forming the 64-bit random number in a bogus way. * libguile/random.h: Added `scm_c_random64'. 2010-07-28 Ludovic Courtès <ludo@gnu.org> Fix `parse-c-struct'. * module/system/foreign.scm (parse-c-struct): Update use of `pointer->bytevector' to the new API. * test-suite/tests/foreign.test ("structs"): New test prefix. 2010-07-28 Ludovic Courtès <ludo@gnu.org> Update the FFI doc. * doc/ref/api-foreign.texi (Foreign Types): Remove bits about typed foreign pointers. Add `void'. (Foreign Variables): Update the doc of `dynamic-pointer' and the `numptob' example. Remove `foreign-set!' and `foreign-ref'. Add `pointer-address', `make-pointer', `%null-pointer', and `null-pointer?' (Void Pointers and Byte Access): Make it clear that wrapped pointers are untyped. Remove `void' from here. Replace `foreign->bytevector' and `bytevector->foreign' by `pointer->bytevector' and `bytevector->pointer'. Add `dereference-pointer' and the rest of the `numptob' example. (Dynamic FFI): Update examples. Remove `%null-pointer' from here. * libguile/dynl.c (scm_dynamic_pointer): Update docstring. * libguile/foreign.c (scm_dereference_pointer, scm_pointer_to_bytevector): Likewise. * module/system/foreign.scm (null-pointer?): Add docstring. 2010-07-28 Ludovic Courtès <ludo@gnu.org> Remove unused parameter from `bytevector->pointer'. * libguile/foreign.c (scm_bytevector_to_pointer): Remove unused LEN parameter. Update docstring. Always return `%null-pointer' when creating a NULL pointer with no finalizer. * libguile/foreign.c (scm_make_pointer): Always call out to `scm_from_pointer'. (scm_from_pointer): Return NULL_POINTER when PTR and FINALIZER are NULL. 2010-07-28 Ludovic Courtès <ludo@gnu.org> Use "pointer" instead of "foreign" when dealing with wrapped pointers. * libguile/foreign.h (scm_t_foreign_finalizer): Rename to... (scm_t_pointer_finalizer): ... this. (SCM_FOREIGN_P): Rename to... (SCM_POINTER_P): this. (SCM_VALIDATE_FOREIGN): Rename to... (SCM_VALIDATE_POINTER): ... this. (SCM_FOREIGN_HAS_FINALIZER): Rename to... (SCM_POINTER_HAS_FINALIZER): ... this. (scm_take_foreign_pointer): Rename to... (scm_from_pointer): ... this. (scm_foreign_address): Rename to... (scm_pointer_address): ... this. (scm_foreign_to_bytevector): Rename to... (scm_pointer_to_bytevector): ... this. (scm_foreign_set_finalizer_x): Rename to... (scm_set_pointer_finalizer_x): ... this. (scm_bytevector_to_foreign): Rename to... (scm_bytevector_to_pointer): ... this. (scm_i_foreign_print): Rename to... (scm_i_pointer_print): ... this. * libguile/foreign.c: Update accordingly. * libguile/tags.h (scm_tc7_foreign): Rename to... (scm_tc7_pointer): ... this. * libguile/foreign.c, libguile/deprecated.c, libguile/dynl.c, libguile/evalext.c, libguile/gc.c, libguile/goops.c, libguile/gsubr.c, libguile/gsubr.h, libguile/print.c, libguile/snarf.h, libguile/vm-i-system.c, module/system/foreign.scm, test-suite/standalone/test-ffi, test-suite/tests/foreign.test: Update accordingly. 2010-07-27 Andy Wingo <wingo@pobox.com> 64-bit random fixes * libguile/random.c (scm_random): Fix generation of inum randoms with more than 32 bits. * libguile/random.h (scm_t_rstate): Fix a comment. 2010-07-26 Ludovic Courtès <ludo@gnu.org> Add `dereference-pointer' to `(system foreign)'. * libguile/foreign.c (scm_dereference_pointer): New function. * libguile/foreign.h (scm_dereference_pointer): New declaration. * module/system/foreign.scm (dereference-pointer): Likewise. * test-suite/tests/foreign.test ("foreign<->bytevector")["dereference-pointer"]: New test. 2010-07-26 Ludovic Courtès <ludo@gnu.org> Simplify the (system foreign) API. Suggested by Neil Jerram. * libguile/foreign.h (SCM_FOREIGN_TYPE, SCM_FOREIGN_VALUE_REF, SCM_FOREIGN_VALUE_SET, SCM_FOREIGN_LEN, SCM_FOREIGN_TYPED_P, SCM_FOREIGN_VALUE_P, SCM_VALIDATE_FOREIGN_VALUE, scm_foreign_set_x, scm_foreign_type): Remove. (scm_foreign_ref): Rename to... (scm_foreign_address): ... this. (scm_take_foreign_pointer): Update. (SCM_FOREIGN_POINTER): Remove CTYPE argument. Update callers. (scm_make_pointer): New declaration. * libguile/foreign.c (scm_to_uintptr, scm_from_uintptr): New macros. (scm_make_pointer): New function. (scm_take_foreign_pointer): Remove TYPE and LEN arguments. Update callers. (scm_foreign_ref): Remove to... (scm_foreign_address): ... this. Remove type-related code. (scm_foreign_set_x): Remove. (scm_foreign_to_bytevector): Change argument order; make LEN argument compulsory. (scm_i_foreign_print): Remove type printing. (unpack): Remove foreign-type checking. * libguile/deprecated.c (scm_dynamic_args_call): Update accordingly. * libguile/dynl.c (scm_dynamic_pointer): Remove the TYPE and LEN arguments; update callers. Update to the new foreign API. * libguile/dynl.h (scm_dynamic_pointer): Update. * libguile/gsubr.c (create_gsubr): Update to the new foreign API. * libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Ditto. * libguile/snarf.h (SCM_IMMUTABLE_FOREIGN): Ditto. * libguile/vm-i-system.c (subr_call): Ditto. * module/system/foreign.scm (null-pointer?): New procedure. * test-suite/standalone/test-ffi: Update to the new `bytevector->foreign' signature. * test-suite/tests/foreign.test ("null pointer")["null pointer identity", "null-pointer? %null-pointer"]: New tests. ["foreign-set! other-null-pointer", "foreign->bytevector other-null-pointer"]: Remove. ("make-pointer", "foreign<->bytevector"): New test prefixes. 2010-07-26 Ludovic Courtès <ludo@gnu.org> Import unbound variable reports in the VM. * libguile/vm-engine.c (VM_NAME)[vm_error_unbound]: Add comment. * libguile/vm-i-system.c (variable_ref): Attempt provide the name of X in FINISH_ARGS. 2010-07-26 Ludovic Courtès <ludo@gnu.org> Check for go/scm mtime ordering rather than equality. * am/guilec (install-data-hook): Remove. (guile_install_go_files): New variable. ($(guile_install_go_files)): New dependency. * libguile/load.c (compiled_is_fresh): Check for ordering of STAT_SOURCE and STAT_COMPILED, not equality. * module/ice-9/boot-9.scm (load): Ditto. * module/system/base/compile.scm (call-with-output-file/atomic): Don't set the timestamp of TEMPLATE. 2010-07-26 Andy Wingo <wingo@pobox.com> rstates point to rngs * libguile/random.h (scm_t_rstate): Include the rng in the rstate, so we can actually have multiple rngs. Instead of reserved0 / reserved1, reserve a double explicitly for scm_c_normal01. (scm_c_uniform32): Change to call the rstate's rng. * libguile/random.c: Change to access an rstate's rng through its rng pointer. (scm_c_normal01): Instead of a flag and a next double, just check that the double is equal to 0.0. Excluding one value shouldn't affect the distribution, right? 2010-07-26 Andy Wingo <wingo@pobox.com> update docs * doc/ref/api-data.texi: * libguile/random.c: Update datum->random-state and random-state->datum docs. 2010-07-26 Andy Wingo <wingo@pobox.com> refactor datum->random-state / random-state->datum * libguile/random.c (scm_t_i_rstate): Move here from random.h, along with prototypes for functions (scm_i_uniform32, scm_i_init_rstate, scm_i_copy_rstate): Change to take a stock scm_t_rstate as an arg, and cast it. This way we don't cast the pointers below. (scm_i_rstate_from_datum, scm_i_rstate_from_datum): Same and rename from scm_i_init_rstate_scm / scm_i_expose_rstate. (scm_c_rstate_from_datum): Rename from scm_c_make_rstate_scm. (scm_datum_to_random_state, scm_random_state_to_datum): Rename from scm_external_to_random_state and scm_random_state_to_external. (scm_init_random): Remove casts. * libguile/random.h (scm_t_rng): Rename init_rstate_scm, expose_rstate vmethods to from_datum, to_datum. Remove internal definitions. Rename to scm_c_rstate_from_datum, and provide scm_random_state_to_datum and scm_datum_to_random_state. 2010-07-26 Andy Wingo <wingo@pobox.com> low-level RNG interfaces deal in scm_t_uint32, not unsigned long * libguile/random.h (scm_t_rng): random_bits returns a scm_t_uint32. (scm_i_uniform32, scm_t_i_rstate): Internal RNG returns a scm_t_uint32, as advertised, instead of unsigned long. (scm_c_random): Return a scm_t_uint32 instead of an unsigned long. * libguile/random.c (scm_i_uniform32, scm_i_init_rstate_scm): (scm_i_expose_rstate, scm_c_random, scm_c_random_bignum, scm_random) (scm_init_random): Adapt types to match implementation. 2010-07-26 Andy Wingo <wingo@pobox.com> remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64 * libguile/__scm.h: * libguile/numbers.h: * libguile/random.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/numbers.c: * test-suite/standalone/test-conversion.c: * libguile/gen-scmconfig.c: As we require 64-bit integers in configure.ac, remove conditional definition of 64-bit types. 2010-07-26 Andreas Rottmann <a.rottmann@gmx.at> Allow exposing of random number generator state Now the random number generator state can be obtained in external (i.e. `read'/`write'-able) form via the new procedure `random-state->external'. An externalized state can be reinstantiated by calling `external->random-state'. * libguile/random.c (scm_i_init_rstate_scm, scm_i_expose_rstate): New internal functions. * libguile/random.c (scm_c_make_rstate_scm, scm_external_to_random_state, scm_random_state_to_external): New public functions. * libguile/random.h: Add prototypes for the above functions. * libguile/random.h (scm_t_rng): Add new fields `init_rstate_scm' and `expose_rstate'. * libguile/random.c (scm_init_random): Initialize the new fields in `scm_the_rng'. 2010-07-24 Thien-Thi Nguyen <ttn@gnuvola.org> Fix "make dist" regression: Distribute guile-func-name-check. Regression introduced 2010-07-22, "Avoid no-op config-subst for libguile/guile-func-name-check". * libguile/Makefile.am (noinst_SCRIPTS): Move guile-func-name-check from here... (EXTRA_DIST): ...to here. 2010-07-22 Thien-Thi Nguyen <ttn@gnuvola.org> Update AUTHORS to reflect now-removed guile-snarf-docs-texi; nfc. 2010-07-22 Thien-Thi Nguyen <ttn@gnuvola.org> [maint] Remove unused script guile-doc-snarf. * doc/ref/tools.texi (Doc Snarfing): Don't mention guile-doc-snarf. * configure.ac (libguile/guile-doc-snarf): Delete ‘GUILE_CONFIG_SCRIPT’. * libguile/Makefile.am (noinst_SCRIPTS): Remove guile-doc-snarf. * libguile/.gitignore: Remove guile-doc-snarf. * libguile/guile-doc-snarf.in: Delete file. * module/scripts/doc-snarf.scm: Comment munging; nfc. * AUTHORS: Update. 2010-07-22 Thien-Thi Nguyen <ttn@gnuvola.org> Add copyright notice to acinclude.m4. * acinclude.m4: Add copyright notice, with years derived from "git log" output. [build] Move GUILE_CONFIG_SCRIPT to acinclude.m4. * configure.ac (GUILE_CONFIG_SCRIPT): Move from here... * acinclude.m4 (GUILE_CONFIG_SCRIPT): ...to here. [maint] Avoid no-op config-subst for libguile/guile-func-name-check. * configure.ac (libguile/guile-func-name-check): Remove ‘GUILE_CONFIG_SCRIPT’. * libguile/Makefile.am (.c.doc): Look in $(srcdir) for awk script. * libguile/guile-func-name-check: Rename from guile-func-name-check.in. [build] Overhaul <errno.h>, <signal.h> cpp symbol extraction/checking. * libguile/Makefile.am (BUILT_SOURCES): Delete cpp_err_symbols.c, cpp_sig_symbols.c; add cpp-E.c, cpp-SIG.c. (EXTRA_DIST): Delete cpp_signal.c, cpp_errno.c, cpp_err_symbols.in, cpp_err_symbols.c, cpp_sig_symbols.c, cpp_sig_symbols.in, cpp_cnvt.awk; add cpp-E.syms, cpp-E.c, cpp-SIG.syms, cpp-SIG.c. (error.x, posix.x): Update prereq list. (cpp_err_symbols.c, cpp_sig_symbols.c): Delete targets. (check_signals, check_errnos): Likewise. (.syms.c): New pattern rule. (chknew-E, chknew-SIG): New targets. (MOSTLYCLEANFILES): Delete cpp_err_symbols_here, cpp_err_symbols_diff, cpp_err_symbols_new, cpp_sig_symbols_here, cpp_sig_symbols_diff, cpp_sig_symbols_new. * libguile/cpp-E.syms: Rename from libguile/cpp_err_symbols.in. * libguile/cpp-SIG.syms: Rename from libguile/cpp_sig_symbols.in. * libguile/error.c (scm_init_error): #include "libguile/cpp-E.c". * libguile/posix.c (scm_init_posix): #include "libguile/cpp-SIG.c". * libguile/cpp_cnvt.awk: Delete file. * libguile/cpp_errno.c: Delete file. * libguile/cpp_signal.c: Delete file. 2010-07-21 Andy Wingo <wingo@pobox.com> fix git-version-gen to work with bsd sed and obsolete regexps * configure.ac: Avoid + in git-version-gen sed script, as it doesn't work on BSD sed with obsolete regexps. 2010-07-21 Ludovic Courtès <ludo@gnu.org> Start rewriting SRFI-1 in Scheme. This partially reverts commit e556f8c3c6b74ee6596e8dcbe829109d7745da2c (Fri May 6 2005). * module/srfi/srfi-1.scm (xcons, list-tabulate, not-pair?, car+cdr, last, fold, list-index): New procedures. * srfi/srfi-1.c (srfi1_module): New variable. (CACHE_VAR): New macro. (scm_srfi1_car_plus_cdr, scm_srfi1_fold, scm_srfi1_last, scm_srfi1_list_index, scm_srfi1_list_tabulate, scm_srfi1_not_pair_p, scm_srfi1_xcons): Rewrite as proxies of the corresponding Scheme procedure. * test-suite/tests/srfi-1.test ("list-tabulate")["-1"]: Change exception type to `exception:wrong-type-arg'. * benchmark-suite/benchmarks/srfi-1.bm: New file. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/srfi-1.bm'. * test-suite/standalone/Makefile.am (test_srfi_1_SOURCES, test_srfi_1_CFLAGS, test_srfi_1_LDADD): New variables. (check_PROGRAMS): Add `test-srfi-1'. (TESTS): Ditto. * test-suite/standalone/test-srfi-1.c: New file. 2010-07-21 Ludovic Courtès <ludo@gnu.org> Add `vhash-fold*' in `(ice-9 vlist)'. * module/ice-9/vlist.scm (%vhash-fold*): New inline procedure. (vhash-fold*, vhash-foldq*, vhash-foldv*): New procedures. * test-suite/tests/vlist.test ("vhash")["vhash-fold*", "vhash-fold* tail", "vhash-fold* interleaved", "vhash-foldq* degenerate"]: New tests. * doc/ref/api-compound.texi (VHashes): Add `vhash-fold*' & co. 2010-07-19 Andreas Rottmann <a.rottmann@gmx.at> Fix random number generator on 64-bit platforms * libguile/random.c (scm_c_random): On platforms where `unsigned long' has 64 bit, generate up to 64 bit of randomness. This is expected by scm_c_random_bignum(), and hence was a serious distortion of the random value distribution for values exceeding 2^32. This change also fixes a crash when the `m' argument is a value above 2^32. 2010-07-17 Andy Wingo <wingo@pobox.com> recommend #:replace * doc/ref/api-modules.texi (Creating Guile Modules): Update text to recommend #:replace. * module/srfi/srfi-19.scm (current-time): #:replace. use scm_malloc_pointerless to alloc aligned blocks in fallback * libguile/continuations.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY) (SCM_STATIC_ALIGNED_ARRAY) * libguile/control.c (SCM_DECLARE_STATIC_ALIGNED_ARRAY) (SCM_STATIC_ALIGNED_ARRAY): Tweak backslashes. Use scm_malloc_pointerless to ensure alignment. SCM_I_FLUID_P -> SCM_FLUID_P * libguile/fluids.h (SCM_FLUID_P): Change from SCM_I_FLUID_P. (SCM_I_FLUID_NUM, SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Wrap in BUILDING_LIBGUILE ifdef. 2010-07-17 Michael Gran <spk121@yahoo.com> Enable character hex escapes by default R6RS character hex escapes do not conflict with legacy Guile octal character escapes, so they can be enabled by default. * libguile/read.c (scm_read_character): modified * test-suite/tests/reader.test: modify character escape tests * doc/ref/api-data.texi: modified * doc/ref/api-options.texi: modified 2010-07-17 Michael Gran <spk121@yahoo.com> open-file should handle binary mode and coding declarations The open-file port should use the 8-bit ISO-8859-1 encoding when a file is opened using mode "b". Also, it should honor a "coding:" declaration at the top of a file when reading files where it is present. * libguile/fports.c (scm_open_file): modified * test-suite/tests/ports.test: more tests for open-file * doc/ref/api-io.texi (File Ports): more documentation for open-file 2010-07-16 Andy Wingo <wingo@pobox.com> remove (system vm debug) * module/system/vm/debug.scm: Remove. * module/Makefile.am: Update. * module/system/repl/debug.scm: Add some TODOs and a commented-out function here. 2010-07-16 Andy Wingo <wingo@pobox.com> remove (ice-9 emacs) * module/ice-9/emacs.scm: Remove. * module/ice-9/deprecated.scm (load-emacs-interface): Remove wrapper with no callers. * module/Makefile.am: update. 2010-07-16 Andy Wingo <wingo@pobox.com> gut ice-9 debug * module/ice-9/debug.scm: Gut, though we keep the module around for code Out There that uses it. * module/ice-9/top-repl.scm (top-repl): Don't import (ice-9 debug) * module/ice-9/debugger/commands.scm: * module/ice-9/debugging/trace.scm: * module/ice-9/emacs.scm: Remove ice-9 debug includes. 2010-07-16 Andy Wingo <wingo@pobox.com> update tour.texi examples * doc/ref/tour.texi (Running Guile Interactively): Update examples for formatting. tour.texi updates * doc/ref/tour.texi: Update Guile prompts for scheme@(guile-user)>. Update output to assume value-history is on. Lop and crop the bug reporting section -- it was too long. update debugger docs * doc/ref/api-debug.texi (Debug on Error): Update xref. * doc/ref/scheme-using.texi (REPL Commands): New subsection. (Interactive Debugging): Rename from Interactive Debugger, to indicate that debugging is just part of the REPL. Update docs. updates to system repl command * module/system/repl/command.scm (help): Update docs on how to get help on a particular command. (load): Remove #:f flag. lower fill-column in .dir-locals.el * .dir-locals.el: Fill-columns back down to 72. 2010-07-16 Michael Gran <spk121@yahoo.com> read-line should use port's encoding, not locale's encoding * libguile/rdelim.c (scm_read_line): modified, use port's encoding * test-suite/test/ports.test: new test 2010-07-16 Michael Gran <spk121@yahoo.com> More explicit variable names in scm_i_scan_for_encoding Note especially that the variable 'i' has two different uses in this function, and they get confused. * libguile/read.c (scm_i_scan_for_encoding): cleanup 2010-07-15 Ludovic Courtès <ludo@gnu.org> Remove heap allocations in `scm_getc', `scm_ungetc', and `find_valid_encoding'. * libguile/ports.c (scm_getc): Provide `u32_conv_from_encoding' with the RESULT_BUF stack-allocated buffer to avoid heap allocation. (find_valid_encoding): Likewise. (scm_ungetc): Ditto with `u32_conv_to_encoding'. 2010-07-15 Ludovic Courtès <ludo@gnu.org> Expose `scm_encoding_error'. * libguile/strings.c (scm_encoding_error): Make public. * libguile/strings.h (scm_encoding_error): New internal declaration. 2010-07-15 Ludovic Courtès <ludo@gnu.org> sxml-match: Always use the same prompt tag. * module/sxml/match.scm (%call/ec-prompt): New variable. (call/ec): Use it instead of creating a new prompt tag. Declare `ice-9/psyntax-pp.scm.gen' as a phony target. * module/Makefile.am (.PHONY): Add `ice-9/psyntax-pp.scm.gen'. 2010-07-15 Andy Wingo <wingo@pobox.com> don't re-print the error by default in call-with-error-handling * module/system/repl/error-handling.scm (call-with-error-handling): Previous post-error changed to "report"; now "catch", the default, doesn't re-print the error. error-handling tweak * module/system/repl/error-handling.scm (call-with-error-handling): Remove extra newline. 2010-07-15 Andy Wingo <wingo@pobox.com> better error reporting from the vm * libguile/vm-engine.c: Add func_name local, for error reporting. (vm_error_apply_to_non_list): New error case. (vm_error_wrong_type_arg): Remove this generic error case. (vm_error_wrong_type_apply): Remove FUNC_NAME -- no sense in seeing "vm-debug-engine" in the error report. (vm_error_not_a_pair, vm_error_not_a_bytevector) (vm_error_not_a_struct, vm_error_not_a_thunk): Use func_name instead of FUNC_NAME, so we can indicate what caused the error. * libguile/vm-i-scheme.c (VM_VALIDATE_CONS, car, cdr, set-car!) (set-cdr!): Indicate provenance of errors. (VM_VALIDATE_STRUCT, struct-vtable): (VM_VALIDATE_BYTEVECTOR, BV_FIXABLE_INT_REF, BV_INT_REF) (BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Same. * libguile/vm-i-system.c (apply, tail-apply): Use vm_error_apply_to_non_list. 2010-07-15 Andy Wingo <wingo@pobox.com> pass a frame to display-error in system repl error-handling * module/system/repl/error-handling.scm (call-with-error-handling): Pass a frame to display-error. display-error takes a frame, shows source if possible * libguile/backtrace.h: * libguile/backtrace.c (scm_display_error): Change "stack" arg to "frame". Still accept stacks for backward compatibility. (display_header, display_error_body): Show the source of the error, if possible. 2010-07-14 Andy Wingo <wingo@pobox.com> fix boostrapping error with srfi-1 (for the third time!) * module/ice-9/deprecated.scm (set-repl-prompt!): Avoid @, so as to avoid a bootstrapping error. Horrible. 2010-07-14 Julian Graham <julian.graham@aya.yale.edu> Fix argument passing for external hash functions in `(rnrs hashtables)'. Guile implements this library in terms of SRFI-69, which is a bit vague on the arity of hash functions, whereas `(rnrs hashtables)' explicitly specifies unary ones. * module/rnrs/hashtables.scm (wrap-hash-function): Assume SRFI-69 will pass the table capacity as the second argument; return the result of proc modulo the capacity. * test-suite/tests/r6rs-hashtables.test (make-hashtable): New test case for hash functions that return large values. 2010-07-13 Andy Wingo <wingo@pobox.com> fix '(] infinite loop * libguile/read.c (scm_read_sexp): Fix reader infinite loop. Thanks to Bill Schottstaedt for the report. * test-suite/tests/reader.test: Add test. fix psyntax-pp.go dependency * module/Makefile.am (ice-9/psyntax-pp.go): Fix dep. ctrl-d with readline exits one recursive repl instance * module/ice-9/buffered-input.scm (make-buffered-input-port): Instead of always returning EOF once EOF is seen once, call the producer again. Allows Ctrl-D to cause one EOF at the REPL, returning once from a recursive edit, but input continues normally. Thanks to Andrew Bagdanov for a clue that led to the fix. don't automatically generate psyntax-pp.scm any more * module/Makefile.am (ice-9/psyntax-pp.scm.gen): No longer automatically regenerate psyntax-pp.scm, as the gensym dance is getting too complicated. Instead when you change psyntax.scm now you should make ice-9/psyntax-pp.scm.gen. 2010-07-13 Ludovic Courtès <ludo@gnu.org> Have `benchmark-guile' honor the current $GUILE_LOAD_PATH. * benchmark-guile.in (GUILE_LOAD_PATH): Extend the current value instead of overwriting it completely. Add missing benchmark files to the distribution. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmarks/chars.bm' and `benchmarks/srfi-13.bm'. 2010-07-13 Ludovic Courtès <ludo@gnu.org> Fix type-checking in the optimized path of `string=?'. * libguile/srfi-13.c (scm_string_eq): Properly type-check S1 and S2. * test-suite/tests/strings.test ("string=?")["1st argument EOF", "2nd argument EOF"]: New tests exposing the problem. 2010-07-10 Andy Wingo <wingo@pobox.com> print column numbers in backtraces * module/system/repl/debug.scm (print-frame): Print column numbers too. 2010-07-10 Andy Wingo <wingo@pobox.com> finally, backtraces only showing frames for the computation * module/system/repl/repl.scm (run-repl): Run the thunk in a stack in a prompt, similar to the default prompt. Gives proper backtraces. * module/system/repl/error-handling.scm (call-with-error-handling): Narrow one more outer frame, for the %start-stack thunk invocation. * module/ice-9/boot-9.scm (%start-stack): Reindent. 2010-07-10 Andy Wingo <wingo@pobox.com> update manual for value history on by default * doc/ref/compiler.texi: Update for new ,pp meta-command. * doc/ref/scheme-using.texi (Using Guile Interactively): Show value history in examples. (Value Historyx): Update docs to mention the repl option and the programmatic interface. 2010-07-10 Andy Wingo <wingo@pobox.com> validating repl options; value-history on by default * module/system/repl/common.scm: Use (ice-9 history). Turns on value history by default. (repl-default-options): Expand the format of options to include an optional value transformer, run when setting a value. Add prompt and value-history options. (repl-prepare-eval-thunk): Use repl-option-ref. (repl-option-ref): Error if the option is unknown. (repl-option-set!, repl-default-option-set!): Error if the option is unknown. Pass the val through the transformer procedure. (repl-default-prompt-set!): Just use repl-default-option-set!. * module/system/repl/command.scm (option): Update for the new options format. 2010-07-10 Andy Wingo <wingo@pobox.com> value-history-enabled? accessor * module/ice-9/history.scm (value-history-enabled?): Add accessor. (enable-value-history!, disable-value-history!): Adapt. heap/literal fixes for repl-default-options * module/system/repl/common.scm (repl-default-options): Heap-allocate the repl-default-options, to avoid mutating a literal. (make-repl): Copy repl-default-options. add utils to turn value history on and off, and to clear it * module/ice-9/history.scm (enable-value-history!) (disable-value-history!, clear-value-history!): New exports. capture default dynamic state in (guile-user) * libguile/init.c (scm_i_init_guile): Move the call to scm_init_threads_default_dynamic_state after the call to scm_load_startup_files, so that the default dynamic state is in the (guile-user) module, not (guile). 2010-07-10 No Itisnt <theseaisinhere+git@gmail.com> Remove trailing whitespace * module/language/tree-il.scm: Remove trailing whitespace 2010-07-09 Andy Wingo <wingo@pobox.com> avoid running the debugger during parsing or compilation at the repl * module/system/repl/repl.scm (abort-on-error): New helper. (run-repl): Don't enter the debugger during parsing or compilation of a repl expression. If you want to debug compilation, run compilation from the repl, not as part of the repl. fix up a repl command docstring * module/system/repl/command.scm (procedure): Fix up docstring. tweaks to print-locals * module/system/repl/debug.scm (print-locals): Run the before-print-hook on the values, so we can hook into (ice-9 history) if available. Don't bother printing binding indices. Give a little per-line-prefix. tweaks to new repl * module/system/repl/command.scm (read-command): Remove a pk. * module/system/repl/repl.scm (run-repl): Export. Use % and abort to implement the prompt. 2010-07-09 Andy Wingo <wingo@pobox.com> integrate the debugger into the repl * module/system/repl/debug.scm: New file, defines a data type to hold state for a debugger stack, and some helper procedures to print the stack or print a frame. Most pieces are from (system vm debug). * module/system/repl/error-handling.scm: New file, implements call-with-error-handling and with-error-handling, and instead of going into a debugger, we go into a recursive repl that happens to have debugging information. Will be removing the old debugger from (system vm debug) shortly. * module/Makefile.am (SYSTEM_SOURCES): Add error-handling and debug scm files. * module/system/repl/repl.scm (prompting-meta-read): Better error handling -- we don't want to go into a debugger when reading a command. (start-repl): Add #:debug keyword argument, and just dispatch to run-repl. (run-repl): New function, with the guts of the old start-repl. Added a prompt, to which a throw to 'quit will abort. * module/system/repl/common.scm (repl-prepare-eval-thunk): New helper. In the future we will use this to not enter the debugger on errors that happen at compile time. (repl-eval): Use repl-prepare-eval-thunk. (repl-print): Run the before-print-hook when printing a value. * module/system/repl/command.scm (*command-table*): Move `option' to the `system' group. Move `trace' to the `profile' group. Add `debug' and `inspect' groups. (command-abbrevs): Rename from command-abbrev, and allow multiple abbreviations. (display-group): Fix the case where abbrev? was #f. (display-summary): Fix alignment of the command and abbreviations. Allow multiple abbreviations. (read-command): Rename from read-datum, and have better error handling. (meta-command): Better error handling. (define-meta-command): Better error handling. (help, show, import, compile, disassemble, time, profile, trace): Fix docstrings and error messages. (define-stack-command): New helper, for commands that operate on a saved stack. (backtrace, up, down, frame, procedure, locals): New debugger commands, in the REPL now. (inspect, pretty-print): New "inspect" commands. 2010-07-09 Andy Wingo <wingo@pobox.com> readline only handles SIGWINCH * acinclude.m4 (GUILE_READLINE): Check for rl_catch_signals and rl_catch_sigwinch. * guile-readline/readline.c (scm_init_readline): If we can, turn off readline's signal handling, because we can do our own. (scm_readline): Use dynwinds to handle resetting readline's state on nonlocal exit, not catches. (unwind_readline): Rename from handle_error. 2010-07-09 Andy Wingo <wingo@pobox.com> remove use-emacs-interface check from ice-9 readline * guile-readline/ice-9/readline.scm (activate-readline): Remove check for use-emacs-interface in guile-user, an interface that was removed. define* in ice-9 regex * module/ice-9/regex.scm (match:start, match:end, match:substring) (fold-matches, list-matches): Reimplement using define*. untabify (ice-9 regex) * module/ice-9/regex.scm: Untabify. 2010-07-09 Andy Wingo <wingo@pobox.com> fix (set! MACRO exp) hygiene * module/ice-9/psyntax.scm (lookup): Reflow comment. (chi-top, syntax): Add comments about mod for lookup. (set!): Lookup the identifier in the module attached to its syntax object. In the (set! MACRO foo) case, after expanding the macro, chi the resulting expression with the empty wrap, as syntax-type does. Seems to fix the case where the expansion references lexically-bound variables. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test: Add a bunch of tests. 2010-07-04 Neil Jerram <neil@ossau.uklinux.net> Fix TeXing of doc/ref/r6rs.texi * doc/ref/r6rs.texi (rnrs conditions): Add "{Condition Type}" to @deffn line for each condition type. Add one missing "{Scheme Procedure}". 2010-07-04 Ludovic Courtès <ludo@gnu.org> Optimize `string=' for the common case. * libguile/srfi-13.c (scm_string_eq): Add a fast path for the common case. 2010-07-04 Ludovic Courtès <ludo@gnu.org> Add `scm_i_string_data'. * libguile/strings.c (STRINGBUF_CONTENTS): New macro. (STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Use it. (scm_i_string_data): New function. * libguile/strings.h (scm_i_string_data): New declaration. 2010-07-01 Neil Jerram <neil@ossau.uklinux.net> Fix hanging of popen.test The "open-output-pipe":"no duplicate" test has been hanging, on and off, and not completely reliably, for a few years. It's now doing so fairly reliably for me, and investigation shows that - the child shell process is in a tight loop (99% CPU) - the parent Guile process is stuck calling waitpid(). The problem is that the child hasn't got the SIGPIPE that the test intends, and so is continuing to echo "closed" forever; and Guile is waiting for it to terminate, forever. I haven't fully debugged the SIGPIPE problem, but it sounds very like what Chet Ramey describes here: http://old.nabble.com/Re%3A-SIGPIPE-not-properly-reset-with-%27trap---PIPE%27-p20985595.html. (And my version of bash is 3.2.39.) So, a fix should be to use something other than shell to implement the child; and it appears that this works. * check-guile.in (TEST_SUITE_DIR): Export. * test-suite/tests/popen-child.scm: New script file. * test-suite/tests/popen.test ("open-output-pipe", "no duplicate"): Use Guile for the child process, instead of shell. 2010-06-29 Andy Wingo <wingo@pobox.com> fix repl level printing * module/system/repl/common.scm (repl-prompt): Fix repl level printing. 2010-06-29 Tristan Colgate <tcolgate@gmail.com> Update #:procedure method for <applicable-struct> * modules/oop/goop.scm (initialize-object-procedure): Use slot-set! instead of set-object-procedure!. 2010-06-28 Andy Wingo <wingo@pobox.com> * module/srfi/srfi-60.scm (bit-count): #:replace core definition. 2010-06-26 Andy Wingo <wingo@pobox.com> use *repl-stack* instead of *repl-level* * module/ice-9/boot-9.scm (*repl-stack*): Instead of repl-level, have a stack. (batch-mode?): Change to poke the stack. * module/ice-9/deprecated.scm (set-batch-mode?!): Update deprecation method. * module/system/repl/common.scm (repl-prompt): Update to poke *repl-stack* to get the level. * module/system/repl/repl.scm (start-repl): Bind *repl-stack* appropriately. 2010-06-26 Andy Wingo <wingo@pobox.com> tweak to ensure-batch-mode! * module/ice-9/boot-9.scm (ensure-batch-mode!): Fix to be correct regarding dynamic extent (so far as this hack goes). 2010-06-26 Andy Wingo <wingo@pobox.com> add repl inport and outport fields and accessors * module/system/repl/common.scm (<repl>): Add inport and outport fields and accessors. (make-repl): Add optional "debug" argument. Bind inport and outport to the current inport and output ports at the time of repl creation. (repl-read): Read from the repl inport. (repl-print): Write to the repl outport. * module/system/repl/command.scm (read-datum, read-line, meta-command): Respect repl-inport, and bind the outport of meta-commands to the repl outport. 2010-06-26 Andy Wingo <wingo@pobox.com> allow kwargs to repl metacommands * module/system/repl/command.scm (define-meta-command): Allow repl meta-commands to have optional or keyword arguments. 2010-06-25 Thien-Thi Nguyen <ttn@gnuvola.org> HACKING: Mention (add-hook 'before-save-hook 'delete-trailing-whitespace) * HACKING (Coding standards): Mention ‘(add-hook 'before-save-hook 'delete-trailing-whitespace)’. 2010-06-24 Julian Graham <julian.graham@aya.yale.edu> Edits to R6RS standard libraries documentation proposed by Ludovic Courtès. * doc/ref/r6rs.texi: Fix erroneous usage of @pxref; add pointers from `(rnrs conditions)' and `(rnrs arithmetic bitwise)' to SRFI-35 and SRFI-60 sections; remove reference to `fold'. 2010-06-22 Andy Wingo <wingo@pobox.com> top-repl out to its own module * module/ice-9/boot-9.scm: * module/ice-9/top-repl.scm: Move top-repl out here. * module/Makefile.am: Add new file. * module/ice-9/deprecated.scm (top-repl): Deprecated shim. * libguile/script.c (scm_compile_shell_switches): Invoke top-repl from its new location. 2010-06-22 Andy Wingo <wingo@pobox.com> simplify top-repl * module/ice-9/boot-9.scm (top-repl): Simplify. don't bother catching SIGSEGV et al in top-repl * module/ice-9/boot-9.scm (exit-hook): Move up with the other hooks. (top-repl): Don't install handlers for SIGFPE, SIGILL, SIGSEGV, or SIGBUS, as they will have no effect. 2010-06-22 Andy Wingo <wingo@pobox.com> deprecate named-module-use!, load-emacs-interface, and remove --emacs * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (named-module-use!) (load-emacs-interface): Deprecate these. * module/ice-9/gds-client.scm (run-utility): Redefine to not use named-module-use!. * libguile/script.c (scm_shell_usage): Remove --emacs option. (scm_compile_shell_switches): Remove support for --emacs. * module/ice-9/boot-9.scm (top-repl): Don't muck with --emacs. * doc/ref/scheme-scripts.texi (Invoking Guile): Remove note about --emacs. 2010-06-22 Andy Wingo <wingo@pobox.com> require-extension using syntax-case * module/ice-9/boot-9.scm (require-extension): Implement using syntax-case. cond-expand in syntax-case * module/ice-9/boot-9.scm: Some spacing improvements. (cond-expand): Reimplement in syntax-case. more aspiration in boot-9 * module/ice-9/boot-9.scm: Spacing fixes for local-ref et al. begin-deprecated using syntax-case * module/ice-9/boot-9.scm (begin-deprecated): In terms of syntax-case. 2010-06-22 Julian Graham <julian.graham@aya.yale.edu> Integrate complete R6RS standard libraries documentation. * doc/ref/r6rs.texi: Reshuffle Andy Wingo's introductory notes; add more detailed @subsubsections for each library. 2010-06-21 Andy Wingo <wingo@pobox.com> relax restriction on _ in literals * module/ice-9/psyntax.scm: Relax restriction on _ in literals. * module/ice-9/psyntax-pp.scm: Regen. 2010-06-21 Andy Wingo <wingo@pobox.com> fix matches? test * test-suite/tests/syntax.test (matches?): Unfortunately this relatively recent macro fails due to the underscore-in-literals-list prohibition. But, it seems I was in the minority wanting _ for a literal. 2010-06-21 Andy Wingo <wingo@pobox.com> syntax-case treats _ as placeholder * module/ice-9/psyntax.scm (underscore?): New helper, like ellipsis?. (syntax-case): Treat the _ pattern as a matches-all pattern, disallowing it from the keyword list. Another well-thought part of the R6RS. ($sc-dispatch): Dispatch _ patterns. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("_ is a placeholder"): Add a test. 2010-06-21 Andy Wingo <wingo@pobox.com> fix compilation with automake < 1.11 * configure.ac: On automake < 1.11, define AM_DEFAULT_VERBOSITY so that our custom silent rules work. freshly regenerate psyntax-pp * module/ice-9/psyntax-pp.scm: A fresh regen to get the lowest gensyms we can. Needs a better solution in the end. fix rnrs duplicate bindings warnings * module/rnrs.scm: Fix i/o duplicate bindings warnings by excluding some bindings. 2010-06-20 Andy Wingo <wingo@pobox.com> rnrs modules #:replace as appropriate * module/ice-9/boot-9.scm (export!): New syntax, as export is to module-export!, export! is to module-replace!. I thought that taking up the name `replace' would be presumptuous, hence the name mismatch. * module/ice-9/r6rs-libraries.scm (library): Calculate not only re-exports, but replacements as well. 2010-06-20 Andy Wingo <wingo@pobox.com> ensure unicode-capable rnrs string ports * module/rnrs/io/ports.scm (open-string-input-port): (open-string-output-port): Ensure that the ports are unicode-capable by binding %default-port-encoding to "UTF-8". 2010-06-20 Ludovic Courtès <ludo@gnu.org> Canonicalize source file names in `primitive-load-path' (fix bug #30170). * libguile/load.c (scm_primitive_load_path): Canonicalize FULL_FILENAME. Fixes bug #30170 ("Auto-compilation erroneously recompiles dependencies"). 2010-06-19 Andy Wingo <wingo@pobox.com> repl compiles with warnings by default * module/system/repl/command.scm (compile): Remove the bitrotten options. * module/system/repl/common.scm (repl-default-options): Add 'compile-options option. (repl-compile-options): Accessor for compile-options. (repl-compile): Use repl-compile-options. (repl-eval): Adapt to repl-compile interface change. 2010-06-19 Andy Wingo <wingo@pobox.com> scheme-mode in syntactic records test * test-suite/tests/r6rs-records-syntactic.test: Add -*- scheme -*-. typo in mutable-strings * module/rnrs/mutable-strings.scm: Fix typo. *unspecified* in rnrs exceptions * module/rnrs/exceptions.scm (rnrs): Import *unspecified*. don't unconditionally restore signals in ensure-batch-mode! * module/ice-9/boot-9.scm (ensure-batch-mode!): Remove comment about restoring signals, and that behavior, as it was making popen.test hang. I should investigate further, but instead I'm just going to hope that this fixes it. 2010-06-19 Andreas Rottmann <a.rottmann@gmx.at> Fix SRFI-9 for records without fields * module/srfi/srfi-9.scm (define-record-type): Deal with fieldless records. * test-suite/tests/srfi-9.test: Add a fieldless record definition. Ignore the SRFI name component(s) in R6RS imports * module/ice-9/r6rs-libraries.scm (resolve-r6rs-interface): To avoid having to create alias libraries for all the SRFIs, we simply ignore the name components, so (srfi :n foo bar) will resolve to (srfi :n). ice-9 receive without define-macro * module/ice-9/receive.scm: Replace define-macro usage with syntax-rules. add rnrs unicode to the compound rnrs module * module/rnrs.scm: import rnrs unicode and export all of its procedures. 2010-06-19 Andy Wingo <wingo@pobox.com> fix ^L typo * module/rnrs/mutable-pairs.scm: Fix ^L typo. 2010-06-19 Andy Wingo <wingo@pobox.com> set! name (lambda ...) names the lambda * module/ice-9/psyntax.scm (build-lexical-assignment) (build-global-assignment): Maybe name the RHS. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/boot-9.scm (catch, with-throw-handler, throw): Rework to use set! instead of define! so that we get names. 2010-06-19 Andy Wingo <wingo@pobox.com> deprecate the-last-stack * libguile/backtrace.h (scm_the_last_stack_fluid_var) * libguile/backtrace.c (scm_init_backtrace): No more scm_the_last_stack_fluid_var. The replacement is to resolve `the-last-stack' in (ice-9 stack-catch). (scm_backtrace_with_highlights): Accordingly, instead of backtracing the last stack, backtrace the current stack. * libguile/throw.h: * libguile/throw.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_stack_catch): Deprecate this function. * module/ice-9/save-stack.scm (the-last-stack): Move here from boot-9. * module/ice-9/debug.scm: * module/ice-9/debugger.scm: Use (ice-9 save-stack) for the-last-stack. * module/ice-9/deprecated.scm (the-last-stack): Add deprecated shim. 2010-06-19 Andy Wingo <wingo@pobox.com> don't bind the-last-stack in repl.scm * module/system/repl/repl.scm (start-repl): Don't bind the-last-stack. no the-last-stack in ice-9 threads * module/ice-9/threads.scm (thread-handler): Don't muck with the-last-stack. remove the-last-stack from boot-9 * module/ice-9/boot-9.scm (false-if-exception): Use syntax-rules. Don't muck with the-last-stack, it is going away. Remove a later comment about the-last-stack. 2010-06-19 Andy Wingo <wingo@pobox.com> deprecate save-stack, stack-saved? * module/Makefile.am: * module/ice-9/boot-9.scm: * module/ice-9/save-stack.scm (stack-saved?, save-stack): Move these bindings to their own module. * module/oop/goops.scm (goops-error): * module/ice-9/boot-9.scm (error, top-repl): Remove calls to save-stack. * module/ice-9/deprecated.scm (stack-saved?, save-stack): Add deprecated shims. * module/ice-9/emacs.scm: * module/ice-9/stack-catch.scm: * module/ice-9/debugger/command-loop.scm: * module/ice-9/scm-style-repl.scm: Import (ice-9 save-stack). 2010-06-19 Andy Wingo <wingo@pobox.com> add support for variable transformers: settable identifier syntax * module/ice-9/psyntax.scm (set!): Handle variable transformers; though, they cannot produce definitions. (make-variable-transformer): New procedure. (identifier-syntax): Allow the R6RS form that makes variable transformers. * module/ice-9/psyntax-pp.scm: Regenerated. * doc/ref/r6rs.texi (R6RS Incompatibilities): Remove letrec* item, and add set! restriction. 2010-06-19 Andy Wingo <wingo@pobox.com> handle-system-error to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (handle-system-error): Move here from boot-9. * module/ice-9/deprecated.scm (handle-system-error): Keep a deprecated wrapper in the root environment. 2010-06-18 Thien-Thi Nguyen <ttn@gnuvola.org> [build] Use UTC, precise format for ‘buildstamp’ value. * libguile/Makefile.am (libpath.h): For ‘buildstamp’, specify date(1) output format precisely, and in UTC. * doc/ref/api-options.texi (Build Config): Update ‘buildstamp’ doc. 2010-06-18 Andy Wingo <wingo@pobox.com> add open-string-{input,output}-port to rnrs io ports * module/rnrs/io/ports.scm (open-string-input-port) (open-string-output-port): New procedures. * module/rnrs.scm (rnrs): Export the new (rnrs io ports) procedures. 2010-06-18 Julian Graham <julian.graham@aya.yale.edu> Fix `define-condition-type' to use condition-accessors, not record accessors. * module/rnrs/conditions.scm (define-condition-type): The generated accessors should be condition accessors, which know how to unpack a compound condition; these can then delegate to the appropriate record accessors. * test-suite/tests/r6rs-conditions.test: New test case to verify above. 2010-06-18 Andy Wingo <wingo@pobox.com> `(debug)' debugs the current stack. * module/system/vm/debug.scm (debug): Change to debug the current stack instead of the last stack. 2010-06-18 Andy Wingo <wingo@pobox.com> remove before-signal-stack * module/ice-9/boot-9.scm (before-signal-stack): Remove. We're moving away from using the-last-stack, so this backup copy is not much use. (top-repl): Don't bother saving a before-signal-stack. * module/ice-9/debugger/command-loop.scm (debugger-handler): No need to restore here either. 2010-06-18 Andy Wingo <wingo@pobox.com> has-shown-debugger-hint? to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (has-shown-debugger-hint?): Move to scm-style-repl. reorder hooks in boot-9 * module/ice-9/boot-9.scm: Reorder hooks. 2010-06-18 Andy Wingo <wingo@pobox.com> default-pre-unwind-handler to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (default-pre-unwind-handler): Deprecate root-module definition. * module/ice-9/scm-style-repl.scm (default-pre-unwind-handler): Move here. * module/ice-9/debugging/traps.scm: * module/ice-9/debugger.scm: * module/ice-9/stack-catch.scm: Use default-pre-unwind-handler from scm-style-repl. 2010-06-18 Andy Wingo <wingo@pobox.com> finish deprecating pre-unwind-handler-dispatch * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (pre-unwind-handler-dispatch): Properly deprecate. * module/ice-9/debugger.scm (debug-on-error): * module/ice-9/debugging/traps.scm (on-pre-unwind-handler-dispatch): Update remaining pre-unwind-handler-dispatch uses. 2010-06-18 Andy Wingo <wingo@pobox.com> deprecate `repl' * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (repl): Deprecate. 2010-06-18 Andy Wingo <wingo@pobox.com> batch-mode? in terms of *repl-level* * module/ice-9/boot-9.scm (*repl-level*): New global fluid, moved here from (system repl common). (batch-mode?): Reimplement in terms of *repl-level*. (ensure-batch-mode!): A replacement for set-batch-mode?!. * module/ice-9/deprecated.scm (set-batch-mode?!): Deprecate. * module/ice-9/popen.scm (open-process): Use ensure-batch-mode!. * module/ice-9/scm-style-repl.scm (error-catching-loop): Override ensure-batch-mode!. * module/system/repl/common.scm: Remove *repl-level*. 2010-06-18 Andy Wingo <wingo@pobox.com> *unspecified* is identifier syntax * module/ice-9/boot-9.scm (*unspecified*): Define using identifier-syntax. Should also prevent it from being set!. (unspecified?): Move up. repl whitespace fix * module/system/repl/repl.scm: Fix whitespace. deprecate set-repl-prompt! * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (set-repl-prompt!): Deprecate, but wrap the (system repl common) implementation instead of the scm-style-repl. add repl-default-option-set! in (system repl common) * module/system/repl/common.scm (repl-default-option-set!): New interface. (repl-default-prompt-set!): New procedure, sets the 'prompt property in the default env. (repl-prompt): Use the 'prompt repl option if available. 2010-06-18 Andy Wingo <wingo@pobox.com> assert-repl-* and associated state variables to scm-style-repl * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (scm-repl-silent, assert-repl-silence) (scm-repl-print-unspecified, assert-repl-print-unspecified) (scm-repl-verbose, assert-repl-verbosity) (scm-repl-prompt): Move these definitions here from boot-9.scm. * module/ice-9/deprecated.scm (assert-repl-silence): (assert-repl-print-unspecified, assert-repl-verbosity): Deprecated wrappers for the functions. I'm not sure if the variables can be helped though. 2010-06-18 No Itisnt <theseaisinhere+git@gmail.com> Use AM_SILENT_RULES to pare down build output, ignore auto-generated files * .gitignore: Ignore extra gnulib headers. * am/snarf: Silent SNARF command * am/guilec: Silent GUILEC command * configure.ac: Use AM_SILENT_RULES when available * guile-readline/Makefile.am: * libguile/Makefile.am: * srfi/Makefile.am: * test-suite/standalone/Makefile.am: Silence snarf output 2010-06-17 U-Cain\Mike <Mike@Cain.(none)> DAY_1 nl_langinfo constants don't require <nl_types.h> There is an incorrect conditional compilation requirement that <nl_types.h> be present for DAY_1 to be defined. This doesn't agree with the LSB and causes make check to fail on Cygwin. * libguile/i18n.c [HAVE_NL_TYPES_H]: modify conditional compilatiion 2010-06-17 Andy Wingo <wingo@pobox.com> build psyntax-pp.go from psyntax.scm * module/Makefile.am (ice-9/psyntax-pp.go): Build from psyntax.scm, so we get proper debugging information and variable names. 2010-06-17 Andy Wingo <wingo@pobox.com> fix order of internal definitions * module/ice-9/psyntax.scm (chi-body): Whoops, actually render internal definitions into a letrec* in the right order. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add some letrec* tests. 2010-06-17 Andy Wingo <wingo@pobox.com> compile-psyntax "optimizes" psyntax-pp * module/ice-9/compile-psyntax.scm (source): "Optimize" psyntax-pp before writing it out. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-17 Andy Wingo <wingo@pobox.com> tree-il->scheme renders fix as letrec* * module/language/tree-il.scm (tree-il->scheme): Expand out to letrec*, as it doesn't matter, and this avoids a let when running through the evaluator. 2010-06-17 Andy Wingo <wingo@pobox.com> resolve-primitives tweaks * module/ice-9/boot-9.scm (make-struct/no-tail): Define a version of this function. Because during optimization we resolve make-struct to make-struct/no-tail, we need an implemented make-struct/no-tail if we are to be able to run scheme made from tree-il->scheme. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Remove variable-set case, as there is no "variable-set!" primitive. (flatten): Add a special hack for variable-set!. Ugly, I know. * module/language/tree-il/primitives.scm (*effect-free-primitives*): Add make-struct/no-tail. (*effect+exception-free-primitives*): Remove make-struct, as it could raise an exception. (variable-set!): Remove expansion to variable-set. 2010-06-17 Andy Wingo <wingo@pobox.com> internal definitions expand out to letrec* instead of letrec * module/ice-9/psyntax.scm (chi-body): Internal definitions are now letrec* instead of letrec, following the R6RS. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-17 Andy Wingo <wingo@pobox.com> compiler support for letrec* * test-suite/tests/tree-il.test ("letrec"): Add some tests. * module/language/tree-il/compile-glil.scm (flatten): Add support for compiling letrec* in its unoptimized form. * module/language/tree-il/fix-letrec.scm (simple-expression?): Parameterize, so that letrec* will not treat `(car x)' as primitive (because it could raise an exception). (partition-vars): Lump unreferenced vars in with complex vars, when compiling letrec*. (fix-letrec!): No need to evaluate inits within a let for letrec*. 2010-06-17 Andy Wingo <wingo@pobox.com> add effect+exception-free-primitive? predicate * module/language/tree-il/primitives.scm (effect+exception-free-primitive?): New predicate, like effect-free-primitive?, but excludes accessors that could raise exceptions. 2010-06-17 Andy Wingo <wingo@pobox.com> psyntax, primitive expander, and memoizer support for letrec* * libguile/expand.c (expand_letrec_helper): Factor out common code. (expand_letrec): Use expand_letrec_helper. (expand_letrec_star): New primitive syntax: letrec*. * libguile/memoize.c (memoize): Add memoizer support for in-order letrec (letrec*). * module/ice-9/psyntax.scm (build-letrec): Another arg, `in-order?'. (chi-body): Adapt to build-letrec change. We don't yet use letrec* for internal definitions. (letrec): Adapt to build-letrec change. (letrec*): New expander. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-17 Andy Wingo <wingo@pobox.com> beginnings of letrec* support in the expander * libguile/expand.h (SCM_EXPANDED_LETREC_IN_ORDER_P) (SCM_MAKE_EXPANDED_LETREC): Add a new field to letrec, in-order?. Will be used to support letrec*. * libguile/expand.c (LETREC, expand_named_let, expand_letrec): Adapt code. * module/language/elisp/compile-tree-il.scm (compile-pair): * module/ice-9/psyntax.scm (build-named-let, build-letrec): Pass #f for in-order? to `make-letrec'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il.scm: Add letrec-in-order? accessor. (parse-tree-il, unparse-tree-il): Parse and unparse an in-order? letrec as `letrec*'. (tree-il->scheme): Serialize letrec*. 2010-06-17 Andy Wingo <wingo@pobox.com> fix bug in memoize * libguile/memoize.c (memoize): Fix a bug where LETREC was being accessed as LET, and it just happened to coincide. 2010-06-17 Ludovic Courtès <ludo@gnu.org> Remove outdated sponsorship info from `THANKS'. Update `THANKS'. 2010-06-17 Ludovic Courtès <ludo@gnu.org> Use Alex Shinn's pattern matcher for (ice-9 match). * module/ice-9/match.scm: Rewrite to simply load `match.upstream.scm'. * module/ice-9/match.upstream.scm: New file. * module/Makefile.am (NOCOMP_SOURCES): Add `ice-9/match.upstream.scm'. * test-suite/Makefile.am (SCM_TESTS): Add `tests/match.test'. * test-suite/tests/match.test: New file. 2010-06-16 Andy Wingo <wingo@pobox.com> remove encoding of versions into the file system (for now?) * module/ice-9/boot-9.scm (find-versioned-module): Remove. Still had some bugs (e.g. for "." in the path and in finding compiled files), did too much computation and statting, and we don't really want to promote versioning. Nor do we want to hard-code a particular encoding of versions in the file-system. Perhaps the real way to do this is to be extensible somehow. (try-module-autoload): Just dispatch to primitive-load-path in all cases. * module/rnrs * module/rnrs.scm: * module/rnrs/arithmetic/bitwise.scm: * module/rnrs/arithmetic/fixnums.scm: * module/rnrs/arithmetic/flonums.scm: * module/rnrs/base.scm: * module/rnrs/conditions.scm: * module/rnrs/control.scm: * module/rnrs/enums.scm: * module/rnrs/eval.scm: * module/rnrs/exceptions.scm: * module/rnrs/files.scm: * module/rnrs/hashtables.scm: * module/rnrs/io/simple.scm: * module/rnrs/lists.scm: * module/rnrs/mutable-pairs.scm: * module/rnrs/mutable-strings.scm: * module/rnrs/programs.scm: * module/rnrs/r5rs.scm: * module/rnrs/records/inspection.scm: * module/rnrs/records/procedural.scm: * module/rnrs/records/syntactic.scm: * module/rnrs/sorting.scm: * module/rnrs/syntax-case.scm: * module/rnrs/unicode.scm: Move these files, eliding the "6/" infix, so that they are in the normal (unversioned) module path. 2010-06-16 Andy Wingo <wingo@pobox.com> set module version in module-export-all! * module/ice-9/boot-9.scm (module-export-all!): Set the interface version as well. load modules from within a known environment * module/ice-9/boot-9.scm (try-module-autoload): Init the module excursion with a fresh user module. 2010-06-15 Thien-Thi Nguyen <ttn@gnuvola.org> [maint] Add configure.ac abstraction: GUILE_CONFIG_SCRIPT * configure.ac (GUILE_CONFIG_SCRIPT): New ‘AC_DEFUN’; use it for: check-guile, benchmark-guile, meta/guile, meta/uninstalled-env, meta/gdb-uninstalled-guile, meta/guile-tools, libguile/guile-snarf, libguile/guile-doc-snarf, libguile/guile-func-name-check, libguile/guile-snarf-docs test-suite/standalone/test-use-srfi, test-suite/standalone/test-fast-slot-ref. Init shell var properly in git-version-gen. * build-aux/git-version-gen: Ensure shell var is not influenced by an env var of the same name. 2010-06-15 Thien-Thi Nguyen <ttn@gnuvola.org> Add tmpfile(3) to libguile. * libguile/posix.c (scm_tmpfile): New primitive. * libguile/posix.h (scm_tmpfile): New func decl. * doc/ref/posix.texi (File System): Document `tmpfile'. 2010-06-14 Andy Wingo <wingo@pobox.com> fix bug in collect * module/ice-9/deprecated.scm (collect): Fix bug. 2010-06-13 Andy Wingo <wingo@pobox.com> attempted microoptimization in eval.scm. * module/ice-9/eval.scm (primitive-eval): Try using list-ref instead of cdring in the vm. We'll check the hydra build times to see if this has any actual merit. Surely the best solution is another representation of environments, though. 2010-06-11 Andy Wingo <wingo@pobox.com> compile (ice-9 deprecated) earlier * module/Makefile.am (ICE_9_SOURCES): Reorder placement of (ice-9 deprecated), as it's getting bigger, so we should compile it earlier. handler of a prompt is in tail context * module/language/tree-il/analyze.scm (analyze-lexicals): The handler of a prompt is in tail context. 2010-06-11 Andy Wingo <wingo@pobox.com> while in terms of syntax-case * module/ice-9/boot-9.scm (while): Reimplement in terms of syntax-case. Prompt inlining is coming later. * test-suite/tests/syntax.test ("while"): Update the expected syntax errors. 2010-06-11 Andy Wingo <wingo@pobox.com> comment in fix-letrec * module/language/tree-il/fix-letrec.scm (simple-expression?): Add a small FIXME. fix lexical call naming bug * module/ice-9/psyntax.scm: Fix bug in which the whole syntax object was being recorded as the name of the operator in a lexical call, instead of just the symbolic name. * module/ice-9/psyntax-pp.scm: Regenerated. unparse the tag of a prompt * module/language/tree-il.scm (unparse-tree-il): Properly unparse the tag of a prompt. make-prompt-tag is an effect-free primitive * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Recognize make-prompt-tag as interesting and effect-free. 2010-06-11 Andy Wingo <wingo@pobox.com> add inliner cases for conditionals * module/language/tree-il/inline.scm (boolean-value, inline!): Add a case for inlining conditional expressions. * test-suite/tests/tree-il.test: Fix conditional tests to have a non-inlinable condition. 2010-06-11 Andy Wingo <wingo@pobox.com> deprecate `collect' * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (collect): Deprecate, and fix to ensure sequential collection. define-option-interface in terms of syntax-rules * module/ice-9/boot-9.scm (define-option-interface): Rewrite using syntax-rules. a failed resolve-interface does not leave behind an empty module * module/ice-9/boot-9.scm (resolve-interface): Pass #:ensure #f to resolve-module, so that in the case of module-not-found we don't leave behind an empty module without an interface. cleanups to version-matches? * module/ice-9/boot-9.scm (version-matches?): Some cleanups: use and-map, or-map; prefer case to cond; abbreviate and scope helper functions. deprecate get-option, for-next-option, display-usage-report, transform-usage-lambda * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (get-option, for-next-option) (display-usage-report, transform-usage-lambda): Deprecate these option-parsing utils. We can revive them in a non-deprecated module if there is interest, but I suspect there will be no interest. deprecate `scheme-file-suffix' * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (scheme-file-suffix): Deprecate. comments in boot-9 * module/ice-9/boot-9.scm: Add comments. 2010-06-11 Andy Wingo <wingo@pobox.com> deprecate `bad-throw' * module/ice-9/boot-9.scm: * module/ice-9/scm-style-repl.scm (bad-throw): Move here. This function was never documented, but has been around since guile-ii. It's not used with current code though. * module/ice-9/deprecated.scm: Provide bad-throw in default env. * module/ice-9/debugger/commands.scm: Import bad-throw from scm-style-repl. 2010-06-11 Andy Wingo <wingo@pobox.com> error in terms of case-lambda * module/ice-9/boot-9.scm (error): Redefine using case-lambda. 2010-06-11 Andy Wingo <wingo@pobox.com> deprecate has-suffix? * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (has-suffix?): Deprecate. * test-suite/guile-test: * benchmark-suite/guile-benchmark: Fix uses of deprecated has-suffix?. 2010-06-11 Andy Wingo <wingo@pobox.com> comments in boot-9 * module/ice-9/boot-9.scm: Add some comments about the nature of properties. 2010-06-10 Andy Wingo <wingo@pobox.com> deprecate apply-to-args * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (apply-to-args): Deprecate. remove annotation? * module/ice-9/boot-9.scm (annotation?): Remove unused new definition. 2010-06-10 Andy Wingo <wingo@pobox.com> scm-style-repl -> (ice-9 scm-style-repl) * module/Makefile.am: * module/ice-9/scm-style-repl.scm: New file, to hold the old scm-style-repl. * module/ice-9/deprecated.scm: Provide scm-style-repl and error-catching-loop and error-catching-repl in the default env, but with deprecation warnings. 2010-06-10 Andy Wingo <wingo@pobox.com> resolve-module #:ensure argument * module/ice-9/boot-9.scm (resolve-module): Add #:ensure kwarg, defaulting to true. If true we make an empty module if none was found (the old behavior). Otherwise we return false. * test-suite/tests/modules.test ("resolve-module"): Add tests for old and new behavior. 2010-06-10 Andy Wingo <wingo@pobox.com> expt / integer-expt fixes * libguile/numbers.c (scm_integer_expt): Validate the first arg as a number. (scm_expt): Delegate to scm_integer_expt iff x is exact. Fixes fractions.test, which I broke recently * test-suite/tests/numbers.test ("integer-expt"): Add test for (integer-expt #t 0). 2010-06-10 Andy Wingo <wingo@pobox.com> Fix build bug, manifested as failure to find libguile-srfi-srfi-1-v-4 * module/ice-9/boot-9.scm (top-repl): This use of @ is not safe, because it will cause (system repl repl) to be loaded at expand time, which will eventually cause (srfi srfi-1) to be loaded, which won't work with a fresh build tree because the helper lib isn't compiled. Gross. (load): Add a note about why this use of @ is safe. brown-paper-bag to uninstalled-env * meta/uninstalled-env.in: Fix lack of test. more uninstalled-env fixen * meta/uninstalled-env.in: Don't implicitly add . to LTDL search paths if no LTDL_LIBRARY_PATH was set. Avoid a duplicate to PATH. uninstalled-env cleanups * meta/uninstalled-env.in: Clean up setting of GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH. don't forget to set GUILE_SYSTEM_PATH in uninstalled mode * meta/uninstalled-env.in (GUILE_SYSTEM_PATH): Set this var too in uninstalled mode. deprecate error-catching-loop, error-catching-repl * module/ice-9/deprecated.scm (error-catching-loop) (error-catching-repl): Deprecate. remove commented-out code from boot-9 * module/ice-9/boot-9.scm: Remove commented-out code. deprecate scm-style-repl * module/ice-9/deprecated.scm (scm-style-repl): Deprecate. fix error handling when reading debugger args * module/system/vm/debug.scm (debugger-repl): Errors reading debugger args no longer drop us out of the debugger. bind debugging i/o ports in start-repl * module/system/repl/repl.scm (start-repl): If the debugging ports are unbound, bind them to the current i/o ports. Allows errors within with-output-to-foo / with-input-from-foo to be sensibly debugged. 2010-06-10 Andy Wingo <wingo@pobox.com> repl.scm simplifications * module/system/repl/repl.scm (prompting-meta-read): Use call-with-error-handling. * module/system/vm/debug.scm (call-with-error-handling): Add case for #:on-error 'pass. Have the catch handler return the unspecified value. 2010-06-10 Andy Wingo <wingo@pobox.com> start cleaning up repl/debugger error handling * module/system/repl/repl.scm (prompting-meta-read): Catch and print read errors here, returning unspecified in that case. (start-repl): Don't enable the debugger while reading expressions. Adapt with-backtrace to with-error-handling. * module/system/vm/debug.scm (run-debugger, debugger-repl): No need to take a stack, the frames vector is sufficient. (call-with-error-handling, with-error-handling): New public utilities. Notably they do not poke the-last-stack. 2010-06-10 Andy Wingo <wingo@pobox.com> hygienic with-backtrace * module/system/repl/repl.scm (with-backtrace): Make a syntax-rules macro. 2010-06-10 Julian Graham <julian.graham@aya.yale.edu> Resolve issues in `find-versioned-module'. * module/ice-9/boot-9.scm (find-versioned-module): Perform a stable sort on version numbers of matched libraries; eliminate extra path separator in library file path. 2010-06-09 Andy Wingo <wingo@pobox.com> fix build error with Compaq C V6.3-025 * libguile/hashtab.c: Re-arrange functions to avoid the need for pre-declaring character arrays with no length. Fixes compilation on Compaq C V6.3-025. Thanks to Jay Krell for the report. 2010-06-09 Andy Wingo <wingo@pobox.com> r6rs `import' accepts multiple clauses * module/ice-9/r6rs-libraries.scm (import): Accept multiple clauses. * test-suite/tests/rnrs-libraries.test: Add test. 2010-06-07 Andy Wingo <wingo@pobox.com> fix (expt #t 0) * libguile/numbers.c (scm_expt): Fix check regarding when to dispatch to integer-expt. * test-suite/tests/numbers.test ("expt"): Add test. 2010-06-07 Andy Wingo <wingo@pobox.com> modules have field for their filenames, for debugging * module/ice-9/boot-9.scm (module-filename, set-module-filename!): Add a new field to modules, the filename that is associated with the module. For debugging purposes. (process-define-module): Parse out a #:filename argument. (make-module, make-autoload-interface): Adapt to module-constructor change. (define-module): Init module-filename from (current-source-location). 2010-06-06 Andy Wingo <wingo@pobox.com> add current-source-location * module/ice-9/boot-9.scm (current-source-location): New macro, returns the, um, current source location. add syntax-source accessor * module/ice-9/psyntax.scm: Add syntax-source accessor. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/boot-9.scm: Declare syntax-source. srfi-34 #:replace raise fix * module/srfi/srfi-34.scm: #:replace the binding for `raise' 2010-06-06 Ludovic Courtès <ludo@gnu.org> Add tests for `program-sources' (bug #29817). * test-suite/tests/compiler.test ("program-sources"): New test prefix. 2010-06-06 Ludovic Courtès <ludo@gnu.org> Don't build any generated source file at "make dist" time. * srfi/Makefile.am (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_SOURCES, libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_SOURCES, libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_SOURCES, libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_SOURCES): Remove `.x' files so that they're not built by "make dist". * test-suite/standalone/Makefile.am (libtest_asmobs_la_SOURCES): Remove `test-asmobs-lib.x'. (libtest_ffi_la_SOURCES): Remove `test-ffi-lib.x'. (BUILT_SOURCES): Likewise. 2010-06-06 Ludovic Courtès <ludo@gnu.org> Add tests for `procedure-name'. This is a followup to 22cf27c815b756cac6893b5b239898767e6cb498 ("fix procedure naming"). * test-suite/tests/compiler.test ("procedure-name"): New test prefix. 2010-06-06 Andy Wingo <wingo@pobox.com> fix `format' with %f and exact rationals * module/ice-9/format.scm (format:parse-float): Accept a number, and when stringifying the number, first convert to inexact. * test-suite/tests/format.test ("~f fixed-point"): Add exact rational test. 2010-06-06 Andy Wingo <wingo@pobox.com> simplify macro representation in the wake of module hygiene changes * module/ice-9/psyntax.scm (chi-install-global, chi-macro) (eval-local-transformer): Now that we handle module hygiene through syntax objects, there is no more need to record the current module when installing syntax transformers. * module/ice-9/psyntax-pp.scm: Regenerated (trickily). * libguile/_scm.h: Bump objcode version for macro representation change. * libguile/macros.c (scm_macro_transformer): Adapt to change in macro representation. 2010-06-06 Andy Wingo <wingo@pobox.com> fix module-hygiene corner case by relying more on syntax objects * module/ice-9/psyntax.scm (chi-macro): Instead of assuming that output of a macro should be scoped relative to the module that was current when the macro was defined, allow the module information associated with the syntax object itself to pass through unmolested. Fixes bug 29860. (datum->syntax): Propagate the module of the identifier through to the new syntax object, so that datum->syntax preserves module hygiene in addition to lexical hygiene. (include, include-from-path): Refactor to plumb though the hygiene information from the filename instead of the `include', allowing hygiene from the original caller of include-from-path to propagate through. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("macro-generating macro"): Add test for bug 29860. 2010-06-05 Andy Wingo <wingo@pobox.com> source location propagation fixes in psyntax * module/ice-9/psyntax.scm (syntax-type): Add some comments about source locations. In calls to chi-macro, pass the source location information. Propagate source location information when unpacking syntax objects. (chi-macro): Add a comment about source locations. Decorate output introduced by the macro with the source location of macro use. * module/ice-9/psyntax-pp.scm: Regenerate. Fixes bug #29817. 2010-06-05 Ludovic Courtès <ludo@gnu.org> Update `.gitignore' for new Gnulib-generated files. Update Gnulib to v0.0-3966-g9f737c8 for `libunistring' m4 fixes. 2010-06-02 Andy Wingo <wingo@pobox.com> brown-paper-bag commit * module/system/vm/debug.scm (frame->module): In which our author misunderstands git's index. flesh out recursive repl module with local vars * module/system/vm/debug.scm (frame->module): Actually bind frame-local variables to values in the new anonymous module. Setting settable vars should work too :) 2010-06-02 Andy Wingo <wingo@pobox.com> recursive repl support * module/system/repl/common.scm (*repl-level*): New public fluid. (repl-prompt): If *repl-level* is a positive integer, add it to the prompt. * module/system/repl/repl.scm (start-repl): The `lang' argument is now optional, and defaults to (current-language). New kwargs level and welcome; level defaults to 0, or 1+ the existing level, and the welcome is a boolean, true if level is 0. Parameterize *repl-level* during the dynamic extent of this repl. Also, parameterize the-last-stack to #f for the duration of this repl. * module/system/vm/debug.scm (frame->module, debugger-repl): Stubs of a recursive repl implementation. The idea is to be a repl in the lexical context of the error; but it would be nice to be able to operate in the module of the proc too, for example to export bindings. Hmm. 2010-06-02 Andy Wingo <wingo@pobox.com> current-language fluid refactoring * module/system/base/compile.scm: * module/system/base/language.scm (*current-language*, current-language): Move this fluid and thunk down to (system base language). boot-9 top-repl tweak * module/ice-9/boot-9.scm (top-repl): More concisely drill down to start-repl. 2010-06-02 Andy Wingo <wingo@pobox.com> some repl doc updates * doc/ref/tour.texi (Reporting Bugs): Update instructions for generating a backtrace. * doc/ref/scheme-using.texi: Update examples of Guile prompts, and add an explanation of the prompt format. 2010-06-02 Andy Wingo <wingo@pobox.com> minor NEWS tweaks * NEWS: Fix wordings. 2010-06-02 Andy Wingo <wingo@pobox.com> add #:version (6) to rnrs bytevectors and ports * module/rnrs/bytevectors.scm: * module/rnrs/io/ports.scm: Add #:version (6) to these modules. * module/6/rnrs.scm: Add versions to the import specs for bytevectors and ports. 2010-06-02 Andy Wingo <wingo@pobox.com> fix argument tab-completion * guile-readline/readline.c (scm_init_readline): Space is a word-breaking char too. Fixes tab-completion for args; thanks to Jao for the patch! 2010-06-02 Andy Wingo <wingo@pobox.com> fix procedure naming * module/ice-9/psyntax.scm (define-expansion-accessors): New helper, to define accesors for a particular expansion data structure. Use it later to define lambda?, lambda-meta, and set-lambda-meta!. (maybe-name-value): Update to work with the newly defined accessors. (build-global-reference, build-let, build-named-let, build-letrec): Re-enable naming of procedures. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-06-01 Ludovic Courtès <ludo@gnu.org> Fix `git-version-gen' sed script. * cfg.mk (git-version-gen-tag-sed-script): Remove trailing dash in regexp. * configure.ac: Likewise in the second argument to `AC_INIT'. 2010-06-01 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.11. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Make `@' visible in the sxml-match documentation. * doc/ref/sxml-match.texi (sxml-match): Quote `@' in the examples. Remove unused symbols. * libguile/debug.c (scm_sym_procname, scm_sym_dots): Remove. 2010-06-01 Andy Wingo <wingo@pobox.com> NEWS is ready * NEWS: Finalize. remove docs for removed procedures * doc/ref/api-procedures.texi (Compiled Procedures): Remove docs for removed procedures. more NEWS * NEWS: More updates. small NEWS updates * NEWS: Some updates. 2010-06-01 Andy Wingo <wingo@pobox.com> r6rs docs in the manual * doc/ref/r6rs.texi (R6RS Support): Skeleton of docs on our R6RS support. * doc/ref/guile.texi: * doc/ref/Makefile.am: Add r6rs.texi. * doc/ref/intro.texi: Add a link to r6rs.texi. 2010-06-01 Andy Wingo <wingo@pobox.com> (rnrs bytevectors) fallout * module/Makefile.am (RNRS_SOURCES): Fix for (rnrs bytevectors) rename. 2010-06-01 Andy Wingo <wingo@pobox.com> rename (rnrs bytevector) to (rnrs bytevectors) * module/rnrs/bytevectors.scm: Rename to (rnrs bytevectors), from (rnrs bytevector), to match the name from the R6RS. * benchmark-suite/benchmarks/bytevectors.bm: * doc/ref/api-data.texi: * doc/ref/api-foreign.texi: * libguile/bytevectors.c: * module/6/rnrs.scm: * module/language/assembly.scm: * module/language/assembly/compile-bytecode.scm: * module/language/assembly/decompile-bytecode.scm: * module/language/glil/compile-assembly.scm: * module/language/tree-il/primitives.scm: * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: * module/system/foreign.scm: * test-suite/standalone/test-ffi: * test-suite/tests/asm-to-bytecode.test: * test-suite/tests/bytevectors.test: * test-suite/tests/foreign.test: * test-suite/tests/r6rs-ports.test: Update all referrers. 2010-06-01 Andy Wingo <wingo@pobox.com> more 1.9.11 NEWS updates * NEWS: More updates. 2010-06-01 Ludovic Courtès <ludo@gnu.org> Fix `VM_VALIDATE_BYTEVECTOR' macro wrt. trailing semicolons. * libguile/vm-i-scheme.c (VM_VALIDATE_BYTEVECTOR): Enclose in "do { } while (0)". 2010-06-01 Ludovic Courtès <ludo@gnu.org> Fix unaligned accesses by the bytevector instructions. * libguile/vm-i-scheme.c (ALIGNED_P): New macro. (BV_FIXABLE_INT_REF, BV_INT_REF, BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Check the alignment of the pointer instead of checking "i % size == 0". This fixes bus errors on `sparc64-linux-gnu'. * libguile/vm.c: Include <alignof.h>. 2010-06-01 Ludovic Courtès <ludo@gnu.org> Upgrade manual to GFDLv1.3+. * doc/ref/fdl.texi: Upgrade to GFDLv1.3. * doc/ref/guile.texi: Change copying notice to "Version 1.3 or any later version". (GNU Free Documentation License): New node, formerly in `fdl.texi'. 2010-05-30 Ludovic Courtès <ludo@gnu.org> Ignore `.version'. Have `test-ffi' run all the tests even after a failure. * test-suite/standalone/test-ffi (failed?): New variable. (test): Set `failed?' to #t upon error and display an error message. Have the exit code depend on FAILED?. Fix argument and return value alignment in `scm_i_foreign_call'. * libguile/foreign.c (scm_i_foreign_call): Fix the computation of ARG_SIZE wrt. alignment. Arrange so that the address ARGS[i] is aligned, rather than checking whether OFF is aligned. Have the RVALUE be at least word-aligned, which fixes calls to `char'-returning functions on `armv5tel-*-linux-gnueabi'. 2010-05-30 Ludovic Courtès <ludo@gnu.org> Fix parenthesizing of the `ROUND_UP' macro; factorize. * libguile/_scm.h (ROUND_UP): New macro. * libguile/continuations.c (ROUND_UP): Remove. * libguile/control.c (ROUND_UP): Remove. * libguile/foreign.c (ROUND_UP): Remove. 2010-05-30 Ludovic Courtès <ludo@gnu.org> Relax the `(version)' test. * test-suite/tests/version.test ("version reporting works"): Test whether `(version)' contains MAJOR.MINOR.MICRO, rather than being equal to it. 2010-05-30 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `git-version-gen'. * GUILE-VERSION (GUILE_VERSION): Remove. * Makefile.am (dist-hook): Depend on `gen-tarball-version'. (BUILT_SOURCES): New variable. ($(top_srcdir)/.version, gen-tarball-version): New targets. * cfg.mk (git-version-gen-tag-sed-script): New variable. * configure.ac: Use `build-aux/git-version-gen' to generate the VERSION argument of `AC_INIT'. Initialize Automake without `check-news'. Define $GUILE_VERSION as an alias for $PACKAGE_VERSION. 2010-05-30 Ludovic Courtès <ludo@gnu.org> Import Gnulib's `git-version-gen' module. * m4/gnulib-cache.m4: Add `git-version-gen'. 2010-05-29 Ludovic Courtès <ludo@gnu.org> Update Gnulib to v0.0-3955-g8ab5996. 2010-05-28 Ludovic Courtès <ludo@gnu.org> Update `THANKS'. 2010-05-28 Ludovic Courtès <ludo@gnu.org> Remove dead code related to `scm_i_terminating'. * libguile/fports.c (scm_i_terminating): Remove declaration. (fport_flush): Remove code conditional of `scm_i_terminating'. * libguile/gc.c (scm_i_terminating): Remove. 2010-05-28 Ludovic Courtès <ludo@gnu.org> Fix the visibility of a few of internal symbols. * libguile/gc.h (scm_i_gc): Make internal. * libguile/posix.h (scm_i_locale_mutex): Likewise. * libguile/arrays.h (scm_i_tc16_array): Likewise. * libguile/numbers.c (scm_i_num_less_p): Likewise. * libguile/discouraged.h (scm_i_init_discouraged): Likewise. * libguile/continuations.c (scm_i_dummy): Made static. * libguile/gc.c (scm_i_cell_validation_already_running): Likewise. * libguile/discouraged.h (scm_i_init_discouraged): Likewise. Quote the first argument to `AC_DEFINE_UNQUOTED'. * configure.ac: Quote the first argument to `AC_DEFINE_UNQUOTED'. 2010-05-28 Ludovic Courtès <ludo@gnu.org> Change occurrences of "filesystem" to "file system". * doc/ref/posix.texi (File System): Change "filesystem" to "file system". * libguile/posix.c (scm_utime): Ditto. 2010-05-28 Ludovic Courtès <ludo@gnu.org> Use GCC's `malloc' attribute for malloc-like routines. * libguile/__scm.h (SCM_MALLOC): New macro. * libguile/gc.h (scm_malloc, scm_calloc, scm_strdup, scm_strndup, scm_gc_malloc_pointerless, scm_gc_calloc, scm_gc_malloc, scm_gc_strdup, scm_gc_strndup): Mark as `SCM_MALLOC'. 2010-05-28 Volker Grabsch <vog@notjusthosting.com> don't fail when HAVE_STAT64 is undefined * libguile/_scm.h: Check whether `HAVE_STAT64' is defined instead of checking its value. don't run the `pthread_attr_getstack' check when cross compiling * configure.ac: Run the `pthread_attr_getstack' test only when building natively. add pdcurses to the list of termlibs * acinclude.m4 (GUILE_READLINE): Look for pdcurses as found on MinGW. 2010-05-28 Ludovic Courtès <ludo@gnu.org> Add `scm_t_aligned_cell' internal type. * libguile/_scm.h (struct scm_aligned_cell)[__GNUC__]: New type. (union scm_aligned_cell)[!__GNUC__]: New type. (scm_t_aligned_cell): New type. * libguile/vm.c (vm_dispatch_hook): Use it. 2010-05-28 Julian Graham <julian.graham@aya.yale.edu> Ignore explicit phase specification for imports in `library' form. * module/ice-9/r6rs-libraries.scm (library): Unwrap the `for' sub-form during export resolution the same way that `import' does. * test-suite/tests/rnrs-libraries.test ("implicit phasing"): New test prefix and tests. 2010-05-27 No Itisnt <theseaisinhere+git@gmail.com> Two spaces. Rename set-record-printer! * doc/ref/srfi-modules.texi: set-record-printer! -> set-record-type-printer! Add sources to module/Makefile.am * module/Makefile.am: add srfi/srfi-9/gnu.scm to SRFI_SOURCES 2010-05-27 No Itisnt <theseaisinhere+git@gmail.com> Record printer fixes * doc/ref/srfi-modules.texi: Fix style * module/srfi/srfi-9/gnu.scm (set-record-type-printer!): renamed from set-record-printer! 2010-05-27 Julian Graham <julian.graham@aya.yale.edu> Support for the #!r6rs lexeme. * libguile/read.c (scm_read_shebang): New function; (scm_read_sharp): Call scm_read_shebang on '!', which delegates to scm_read_scsh_block_comment as necessary. * test-suite/tests/reader.test ("R6RS lexeme comment", "partial R6RS lexeme comment"): New tests. 2010-05-27 Andy Wingo <wingo@pobox.com> partial 1.9.11 NEWS * NEWS: Add some 1.9.11 news -- unfinished, though. remove scm_memoizer_p and scm_memoizer declarations * libguile/memoize.h (scm_memoizer_p, scm_memoizer): Remove these declarations. 2010-05-26 Ludovic Courtès <ludo@gnu.org> Clean up `test-suite/vm'. * test-suite/vm/Makefile.am: Add copyright/license header. * test-suite/vm/the-bug.txt: Remove. 2010-05-26 Ludovic Courtès <ludo@gnu.org> Rename the `testsuite' directory to `test-suite/vm'. * testsuite: Move to... * test-suite/vm: ... here. * Makefile.am (SUBDIRS): Remove `testsuite'. * configure.ac: Output `test-suite/vm/Makefile' instead of `testsuite/Makefile'. * test-suite/Makefile.am (SUBDIRS): Add `vm'. 2010-05-26 Ludovic Courtès <ludo@gnu.org> Raise an exception upon VM stack overflows (fixes bug #29574). * libguile/vm-engine.c (VM_NAME)[vm_error_stack_overflow]: Increase `vp->stack_limit' when possible. * libguile/vm.c (VM_STACK_RESERVE_SIZE): New macro. * test-suite/lib.scm (exception:vm-error): New variable. * test-suite/tests/eval.test ("stack overflow"): New test prefix. 2010-05-26 Ludovic Courtès <ludo@gnu.org> sxml-match: Handle multiple-value returns. * module/sxml/sxml-match.ss (sxml-match1): Invoke ESCAPE via `call-with-values'. * test-suite/tests/sxml-match-tests.ss ("test multiple value returns"): New test. * module/sxml/match.scm: Mention the modification. 2010-05-26 No Itisnt <theseaisinhere+git@gmail.com> Merge branch 'master' of git.sv.gnu.org:/srv/git/guile 2010-05-25 Ludovic Courtès <ludo@gnu.org> Add (sxml match). * module/Makefile.am (LIB_SOURCES): Add `sxml/match.scm'. (NOCOMP_SOURCES): Add `sxml/sxml-match.ss'. * module/sxml/match.scm, module/sxml/sxml-match.ss: New files. * test-suite/Makefile.am (SCM_TESTS): Add `tests/sxml.match.test'. (EXTRA_DIST): Add `tests/sxml-match-tests.ss'. * test-suite/tests/sxml-match-tests.ss, test-suite/tests/sxml.match.test: New files. * doc/ref/guile.texi (Guile Modules): Include `sxml-match.texi'. * doc/ref/sxml-match.texi: New file. * doc/ref/Makefile.am (guile_TEXINFOS): Add `sxml-match.texi'. 2010-05-25 Ludovic Courtès <ludo@gnu.org> Add copyight/license header in `compile-psyntax.scm'. 2010-05-25 No Itisnt <theseaisinhere+git@gmail.com> * doc/ref/srfi-modules.texi: * module/srfi/srfi-9/gnu.scm: rename `define-record-printer' to `set-record-printer!' to reflect the fact that the printer is set at runtime add custom record printers * doc/ref/srfi-modules.texi: update documentation * module/srfi/srfi-9/gnu.scm: add `define-record-printer' 2010-05-24 Andy Wingo <wingo@pobox.com> update NEWS for things that were true and aren't, or vice versa * NEWS: Misc updates. pre-prepare NEWS * NEWS: Integrate 1.9.10 entries into the main text. 2010-05-23 Julian Graham <julian.graham@aya.yale.edu> Edits for R6RS library implementation documentation, as suggested by Ludovic Courtès. * doc/ref/api-module.texi (R6RS Libraries): Wrap keywords variously in @code and @dfn forms; rewrite pointer to implicit phasing paper; add "Scheme Syntax" specification to @deffns. 2010-05-22 Ludovic Courtès <ludo@gnu.org> Fix disassembly of free variable lists. * module/language/assembly/disassemble.scm (disassemble-free-vars): Handle FREE-VARS as a list, not a vector. 2010-05-21 Andy Wingo <wingo@pobox.com> boot-9 comment cleanup * module/ice-9/boot-9.scm: Remove needless comment. lambda* in make-mutable-parameter * module/ice-9/boot-9.scm (make-mutable-parameter): Use lambda*. define* in repl-reader * module/ice-9/boot-9.scm (repl-reader): Use define*. define* in try-module-autoload * module/ice-9/boot-9.scm (try-module-autoload): Use define*. define* in resolve-interface * module/ice-9/boot-9.scm (resolve-interface): Use define* with proper keyword arguments, for great justice. lambda* in resolve-module * module/ice-9/boot-9.scm (resolve-module): Use lambda*. define* in load-module * module/ice-9/boot-9.scm (load-module): Use define*. define* in module-observe-weak * module/ice-9/boot-9.scm (module-observe-weak): Use define*. define* in load * module/ice-9/boot-9.scm (load): Use define*. case-lambda in dup->{in,out,}port, dup * module/ice-9/boot-9.scm (dup->port, dup->inport, dup->outport, dup): Use case-lambda. Not particularly elegant. define* in file-set-position * module/ice-9/boot-9.scm (file-set-position): Use define*. define* in record-constructor * module/ice-9/boot-9.scm (record-constructor): Use define*. define* in make-record-type * module/ice-9/boot-9.scm (make-record-type): Use define*. lambda* in string-any, string-every * module/ice-9/boot-9.scm (string-any, string-every): Use lambda*. lambda* in catch * module/ice-9/boot-9.scm (catch): Use lambda*. lambda* in make-prompt-tag * module/ice-9/boot-9.scm (make-prompt-tag): Use lambda*. 2010-05-21 Julian Graham <julian.graham@aya.yale.edu> Explicitly import `*unspecified*' to support R6RS library purification enhancements. * module/rnrs/6/hashtables.scm: Add explicit import for `*unspecified*'. Explicitly import `@@' to support R6RS library purification enhancements on `master'. * module/rnrs/6/conditions.scm: * module/rnrs/6/exceptions.scm: * module/rnrs/6/files.scm: * module/rnrs/6/hashtables.scm: * module/rnrs/io/6/simple.scm: * module/rnrs/records/6/inspection.scm: Add explicit import for `@@'. Fix broken imports in `(rnrs r5rs)'. * module/rnrs/6/r5rs.scm (imports): Import `null-environment' from `(ice-9 safe-r5rs)'; import `scheme-report-environment' from `(ice-9 r5rs)'. Fix incorrect export names in `(rnrs io simple)'. * module/rnrs/io/6/simple.scm: with-input-file => with-input-from-file, with-output-file => with-output-to-file. Implementation for R6RS (rnrs) composite library. (Can't be loaded yet because of conflict between `syntax-case' transformer binding and `(rnrs syntax-case)' hierarchical namespace module binding.) * module/6/rnrs.scm: New file. * module/Makefile.am: Add 6/rnrs.scm to RNRS_SOURCES. Test suite and fixes for R6RS (rnrs arithmetic fixnums). * module/rnrs/arithmetic/6/fixnums.scm: Fix missing imports; (fixnum-width, greatest-fixnum, least-fixnum): Redefine these as zero-argument procedures; Fix argument mismatches in several functions. * test-suite/Makefile.am: Add tests/r6rs-arithmetic-fixnums.test to SCM_TESTS. * test-suite/tests/r6rs-arithmetic-fixnums.test: New file. Fix typo in license comment. * test-suite/tests/r6rs-eval.test: Lice6nse => License. Implementation and test cases for the R6RS (rnrs arithmetic flonums) library. * module/Makefile.am: Add rnrs/arithmetic/6/fixnums.scm and rnrs/arithmetic/6/flonums.scm to RNRS_SOURCES. * module/rnrs/6/base.scm: (div-and-mod, div0, mod0, div0-and-mod0): New functions; this `div' implementation is not quite right, but we'll come back to it later. * module/rnrs/arithmetic/6/fixnums.scm: New file. * module/rnrs/arithmetic/6/flonums.scm: New file. * test-suite/Makefile.am: Add tests/r6rs-arithmetic-flonums.test to SCM_TESTS. * test-suite/tests/r6rs-arithmetic-flonums.test: New file. Implementation and test case for R6RS (rnrs eval) library. * module/Makefile.am: Add rnrs/6/eval.scm to RNRS_SOURCES. * module/rnrs/6/eval.scm: New file * test-suite/Makefile.am: Add tests/r6rs-eval.test to SCM_TESTS. * test-suite/tests/r6rs-eval.test: New file. Fix syntax and consolidate imports for (rnrs lists). * module/rnrs/6/lists.scm: Import syntax is `(only (import-set) id-1 ...)', not `(only (import-set) (id-1 ...))'; use `rename' form as wrapper instead of creating separate custom interface on SRFI-1. Implementation and test cases for the R6RS (rnrs enums) library. * module/Makefile.am: Add rnrs/6/enums.scm to RNRS_SOURCES. * module/rnrs/6/conditions.scm: Fix define-condition-type binding for syntax-violation? predicate. * module/rnrs/6/enums.scm: New file. * test-suite/Makefile.am: Add tests/r6rs-enums.test to SCM_TESTS. * test-suite/tests/r6rs-enums.test: New file. Add R6RS `syntax-violation' to (rnrs syntax-case). * module/rnrs/6/exceptions.scm: Remove dependency on (rnrs syntax-case); rewrite guard and guard0 in using syntax-rules in terms of syntax-case. * module/rnrs/6/syntax-case.scm: Add syntax-violation implementation. Test suite and fixes for R6RS (rnrs conditions) and (rnrs records procedural). * module/rnrs/6/conditions.scm: Fix export of make-implementation-restriction-violation; remove dependency on (rnrs syntax-case); remove redundant function compound-condition-components; rewrite define-condition-type using syntax-rules instead of syntax-case. * module/rnrs/records/6/procedural.scm: Remove serious-condition?, violation? and assertion-violation? predicates, since they're not true condition predicates. * test-suite/Makefile.am: Add tests/r6rs-conditions.test to SCM_TESTS. * test-suite/tests/r6rs-conditions.test: New file. Implementation for the (rnrs mutable-pairs) and (rnrs mutable-strings) libraries. * module/Makefile.am: Add rnrs/6/mutable-pairs.scm and rnrs/6/mutable-strings.scm to RNRS_SOURCES. * module/rnrs/6/mutable-pairs.scm: New file. * module/rnrs/6/mutable-strings.scm: New file. Implementation for the R6RS (rnrs r5rs) library. * module/Makefile.am: Add rnrs/6/r5rs.scm to RNRS_SOURCES. * module/rnrs/6/r5rs.scm: New file. Add `guard' form and test cases to R6RS (rnrs exceptions) library. * module/rnrs/6/exceptions.scm: (guard0, guard): New syntax. * module/rnrs/records/6/procedural.scm: (r6rs-raise-continuable): Can't use `raise' here because it's exported by (rnrs exceptions); use plain old `throw' instead. * test-suite/Makefile.am: Add tests/r6rs-exceptions.test to SCM_TESTS. * test-suite/tests/r6rs-exceptions.test: New file. Fix test suite title in comment * test-suite/tests/r6rs-records-procedural.test: `(rnrs control)' => `(rnrs records procedural)' Implementation and test cases for R6RS (rnrs files) library. * module/Makefile.am: Add rnrs/6/files.scm to RNRS_SOURCES. * module/rnrs/6/conditions.scm (define-condition-type): Use specified accessor name to create accessor binding. Add internally-visible &i/o-* condition types. * module/rnrs/6/files.scm: New file. * module/rnrs/io/6/simple.scm: Export &i/o-* condition types clandestinely imported from (rnrs conditions). * test-suite/Makefile.am: Add tests/r6rs-files.test to SCM_TESTS. * test-suite/test/r6rs-files.test: New file. Implementation for the R6RS (rnrs sorting) library. * module/Makefile.am: Add rnrs/6/sorting.scm to RNRS_SOURCES. * module/rnrs/6/sorting.scm: New file. Implementation for the R6RS (rnrs programs) library. * module/Makefile.am: Add rnrs/6/programs.scm to RNRS_SOURCES. * module/rnrs/6/programs.scm: New file. Implementation and test cases for the R6RS (rnrs unicode) library. * module/Makefile.am: Add rnrs/6/unicode.scm to RNRS_SOURCES. * module/rnrs/6/unicode.scm: New file. * test-suite/Makefile.am: Add tests/r6rs-unicode.test to SCM_TESTS. * test-suite/tests/r6rs-unicode.test Fixes and test cases for R6RS (rnrs hashtables) library. * module/rnrs/6/hashtables.scm: Assorted bugfixes, esp. for wrapping single-argument hash functions. * test-suite/Makefile.am: Add tests/r6rs-hashtables.test to SCM_TESTS. * test-suite/tests/r6rs-hashtables.test: New file. Add test cases for record constructor protocols and parent protocol delegation. * test-suite/tests/r6rs-records-procedural.test ("simple protocol", "protocol delegates to parent with protocol"): New tests. Implementation for the R6RS (rnrs hashtables) library; Implementation and test cases for the R6RS (rnrs record syntactic) library. * module/Makefile.am: Add rnrs/6/hashtables.scm to RNRS_SOURCES. * module/rnrs/6/hashtables.scm: New file. * module/rnrs/records/6/inspection.scm: (record-type-generative?) Record types are generative iff they have no uid, not vice-versa. * module/rnrs/records/6/syntactic.scm: Finish `define-record-type' implementation; add `record-type-descriptor' and `record-constructor-descriptor' forms. * test-suite/Makefile.am: Add tests/r6rs-records-syntactic.test to SCM_TESTS. * test-suite/tests/r6rs-records-inspection.test: Update tests for `record-type-generative?' to reflect corrected behavior. * test-suite/tests/r6rs-records-syntactic.test: New file. (rnrs conditions) should not depend on (rnrs records syntactic). * module/rnrs/6/conditions.scm: (define-condition-type) Re-implement `define-condition-type' in terms of (rnrs records procedural). Fix missing export of string->symbol in (rnrs base). * module/rnrs/6/base.scm: Add string->symbol to library exports. Implementation for the R6RS (rnrs lists) library. * module/Makefile.am: Add module/rnrs/6/lists.scm to RNRS_SOURCES. * module/rnrs/6/lists.scm: New file. Implementation and test cases for the R6RS (rnrs records inspection) library. * module/Makefile.am: Add module/rnrs/records/6/inspection.scm to RNRS_SOURCES. * module/rnrs/records/6/inspection.scm: New file. * module/rnrs/records/6/procedural.scm: Assorted refactoring: Create index constants for record, rtd, and rcd field indexes; record-type-vtable, record-constructor-vtable: More informative display names; (make-record-type-descriptor): fold left, not right when creating vtable; store field names as vector, not list; detect opaque parents * test-suite/Makefile.am: Add test-suite/tests/r6rs-records-inspection.test to SCM_TESTS. * test-suite/tests/r6rs-records-inspection.test: New file. Remove needless import of (rnrs io simple). * module/rnrs/6/conditions.scm: Remove (rnrs io simple (6)) from imports. Implementation and test cases for the R6RS (rnrs records procedural) library, along with its dependencies. * module/Makefile.am: Add new R6RS libraries below to RNRS_SOURCES. * module/rnrs/6/conditions.scm, exceptions.scm, syntax-case.scm: New files. * module/rnrs/io/6/simple.scm: New file. * module/rnrs/records/6/procedural.scm, syntactic.scm: New files. * test-suite/Makefile.am: Add tests/r6rs-records-procedural.test to SCM_TESTS. * test-suite/tests/r6rs-records-procedural.test: New file. Fix missing imports for `(rnrs arithmetic bitwise)'. * module/Makefile.am: Add module/rnrs/arithmetic/6/bitwise.scm to RNRS_SOURCES. * module/rnrs/arithmetic/6/bitwise.scm: Import `(rnrs control)' and `modulo' from `(guile)'. * test-suite/Makefile.am: Add r6rs-arithmetic-bitwise.test to SCM_TESTS. Implementation and test cases for the R6RS (rnrs control) library. * module/Makefile.am: Add rnrs/6/base.scm and rnrs/6/control.scm to RNRS_SOURCES. * module/rnrs/6/base.scm, control.scm: New files. * test-suite/Makefile.am: Add tests/r6rs-control.test to SCM_TESTS. * test-suite/tests/r6rs-control.test: New file. Implementation and test cases for the R6RS (rnrs arithmetic bitwise) library. * module/rnrs/arithmetic/6/bitwise.scm: New file. * test-suite/tests/r6rs-arithmetic-bitwise.test: New file. 2010-05-21 Julian Graham <julian@spiderstacy.(none)> Documentation for the R6RS `library' and `import' forms. * doc/ref/api-modules.texi (R6RS Libraries): New section, documents `library' and `import'. 2010-05-20 Andy Wingo <wingo@pobox.com> eval-when expand for use-modules and export * module/ice-9/boot-9.scm (use-modules, use-syntax) (export, re-export): Add `expand' to the eval-when list, as we did for R6RS. pure r6rs modules * module/ice-9/r6rs-libraries.scm (library): Make pure modules. (import): Also process imports at expand time, for the `eval' case. macroexpanded pretty-printer * module/language/tree-il.scm (print-tree-il): (borrow-core-vtables, <tree-il>): When tree-il loads, override the printers for macroexpanded structures. lambda* usage in psyntax.scm * module/ice-9/psyntax.scm (macroexpand): Use lambda*. * module/ice-9/psyntax-pp.scm: Regenerated. tree-il->scheme for lambda* et al * module/language/tree-il.scm (tree-il->scheme): Fix lambda* / case-lambda / case-lambda* transformation. 2010-05-20 Andy Wingo <wingo@pobox.com> remove *mode* fluid from psyntax * module/ice-9/psyntax.scm: Remove the *mode* fluid. Whee :) (macroexpand): No need to bind aa *mode* fluid. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-20 Andy Wingo <wingo@pobox.com> iron out inconsistency between eval and compile expansion * libguile/expand.c (expand_lambda_star_case): Harmonize with tree-il, expanding keywords to (aok? (kw name gensym) ...), not (aok? (kw . index) ...). * libguile/memoize.c (memoize): Process the (kw name gensym) format into (kw . index). * module/ice-9/psyntax.scm (build-lambda-case): Remove a compile-versus-eval special case. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-20 Andy Wingo <wingo@pobox.com> primitive-eval takes expanded, not memoized, source * module/ice-9/eval.scm (primitive-eval): * libguile/eval.c (scm_c_primitive_eval): Don't expect a memoized expression -- expect either raw source or an *expanded* expression. We handle memoization ourselves. * libguile/expand.c (scm_macroexpand): Settle down into its proper name, "macroexpand", even as we comment that it is but a fleeting boot expander. (scm_macroexpanded_p): New predicate for expanded code. * libguile/expand.h: Add scm_macroexpanded_p. * libguile/memoize.c (scm_memoize_expression): Require that the expression be expanded. (scm_init_memoize): Don't alias memoize-expression to macroexpand. * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: Always produce macroexpanded expressions, and hand them to primitive-eval. No more calls to memoize-expression here. * test-suite/tests/optargs.test: Remove some tests, as unfortunately we have no way to invoke the boot expander after boot. 2010-05-20 Andy Wingo <wingo@pobox.com> %null-pointer properly aligned * libguile/foreign.c: Allocate %null-pointer on the heap, to assure proper alignment. 2010-05-20 Andy Wingo <wingo@pobox.com> psyntax produces "expanded" structures directly * module/ice-9/psyntax.scm: Remove a number of eval-versus-compile cases, instead producing "expanded" structures directly, which happen to coincide with tree-il. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-19 Andy Wingo <wingo@pobox.com> expanded type constructors in psyntax * module/ice-9/psyntax.scm (define-expansion-constructors): Define constructors for expanded types. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-19 Andy Wingo <wingo@pobox.com> tree-il on expanded-vtables * module/language/tree-il.scm: In a somewhat daring move, inherit the "core" tree-il constructs from %expanded-vtables. fix a couple expander naming bugs * libguile/expand.h: * libguile/memoize.c: Fix a couple bugs: it's application-args, not application-exps, and public?, not public. %expanded-vtables is a vector * libguile/expand.c (scm_init_expand): %expanded-vtables is a vector. 2010-05-19 Andy Wingo <wingo@pobox.com> separate boot expansion from memoization * libguile/Makefile.am: * libguile/init.c: * libguile/expand.c: * libguile/expand.h: Add new expander. The idea is that macroexpansion is one thing, and whether to compile or interpret the result of that is another thing. * libguile/memoize.c: Adapt to expand as necessary, and then memoize expanded source without worrying about syntax errors. * module/ice-9/eval.scm (make-general-closure): Allow alt clauses to not possess the full make-general-closure arity. 2010-05-18 Andy Wingo <wingo@pobox.com> remove the new scm_memoize_begin, etc * libguile/memoize.h: * libguile/memoize.c: Remove the recently-added scm_memoize_begin, scm_memoize_lambda, et al. We'll take a different tack. 2010-05-16 Andy Wingo <wingo@pobox.com> scm_memoize_lambda update * libguile/memoize.h: * libguile/memoize.c (scm_memoize_lambda): Update to memoize "full-arity" lambdas. 2010-05-14 Andy Wingo <wingo@pobox.com> psyntax builds case-lambda expressions * module/ice-9/psyntax.scm (build-case-lambda, build-lambda-case): Actually build case-lambda expressions, knowing that the memoizer will do the right thing. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-14 Andy Wingo <wingo@pobox.com> evaluator support for case-lambda * libguile/memoize.c (patch_case_lambda, scm_m_case_lambda) (scm_m_case_lambda_star): Add memoizers for case-lambda and case-lambda*. (unmemoize): Unmemoize lambdas with multiple arities. * libguile/eval.c (prepare_boot_closure_env_for_apply): (prepare_boot_closure_env_for_eval): Adapt to return both body and env, so that case-lambda clauses can be selected appropriately. (eval, boot_closure_apply): Adapt callers. * module/ice-9/eval.scm (make-general-closure): Support multiple arities. 2010-05-14 Andy Wingo <wingo@pobox.com> primitive support for lambda* * libguile/memoize.c (scm_m_lambda_star): Define lambda* in the pre-psyntax env, and make it memoize lambda* expressions. * libguile/eval.c (BOOT_CLOSURE_PARSE_FULL): New helper. (error_invalid_keyword, error_unrecognized_keyword): New helpers. (prepare_boot_closure_env_for_apply): Flesh out application of boot closures with "full" arity. (prepare_boot_closure_env_for_eval): Punt to prepare_boot_closure_env_for_eval for the full-arity case. * module/ice-9/eval.scm (make-fixed-closure): Rename from `closure', and just handle fixed arities, where there is no rest argument.. (make-general-closure): New helper, a procedure, that returns a closure that can take rest, optional, and keyword arguments. (eval): Adapt to call make-fixed-closure or make-general-closure as appropriate. * test-suite/tests/optargs.test ("lambda* inits"): Test the memoizer as well. 2010-05-13 Andy Wingo <wingo@pobox.com> tweak to lambda* memoization format * libguile/memoize.c (FULL_ARITY): Change the form to more closely approximate <lambda-case>. (unmemoize): Unmemoize lambda* expressions. change to format of memoization lambda expressions * libguile/memoize.c (scm_m_lambda, memoize_named_let) (scm_memoize_lambda, unmemoize) * libguile/eval.c (eval, prepare_boot_closure_env_for_apply) (prepare_boot_closure_env_for_eval, boot_closure_apply): * module/ice-9/eval.scm (primitive-eval): Change the format for memoized lambda expressions, so as to allow, in the future, case-lambda* to be supported by the evaluator. scm_badargsp is deprecated * libguile/eval.h: * libguile/eval.c: * libguile/deprecated.h * libguile/deprecated.c (scm_badargsp): Deprecate scm_badargsp. 2010-05-11 Ludovic Courtès <ludo@gnu.org> Have `sxml->xml' handle `*TOP*' nodes (bug #29260). * module/sxml/simple.scm (universal-sxslt-rules): Add handler for `*TOP*'. Suggested by Stefan Israelsson Tampe at <https://savannah.gnu.org/bugs/index.php?29260>. * test-suite/Makefile.am (SCM_TESTS): Add `sxml.simple.test'. * test-suite/tests/sxml.simple.test: New file. * THANKS: Add Stefan. 2010-05-07 Andy Wingo <wingo@pobox.com> add memoize-begin, memoize-let, etc functions * libguile/memoize.h: * libguile/memoize.c (scm_memoize_begin, scm_memoize_if, scm_memoize_lambda, scm_memoize_let, scm_memoize_quote, scm_memoize_define, scm_memoize_with_fluids, scm_memoize_call, scm_memoize_lexical_ref, scm_memoize_lexical_set, scm_memoize_toplevel_ref, scm_memoize_toplevel_set, scm_memoize_module_ref, scm_memoize_module_set): New functions, public to Scheme but private to C. For use by psyntax, in the future. 2010-05-07 Andy Wingo <wingo@pobox.com> add "memoizer" data type * libguile/memoize.h: * libguile/memoize.c (MAKMEMO_APPLY): Take the proc and args separately. (scm_tc16_memoizer, SCM_MEMOIZER_P, SCM_MEMOIZER): New smob type, for "syntax" like @apply that have normal evaluation order. (memoize_env_ref_macro, memoize): Refactor to handle "memoizers" generically. Reorganize the list of SCM_SYNTAX forms. Move @apply, @dynamic-wind, @call-with-current-continuation, @call-with-values, @prompt handling down to be generic "memoizer" data types. (scm_memoizer_p, scm_memoizer): New functions, exposed to Scheme. Will be used by psyntax. 2010-05-07 Andy Wingo <wingo@pobox.com> macro expanders return memoized expressions * libguile/eval.c (scm_c_primitive_eval): * module/ice-9/eval.scm (primitive-eval): Rely on the expander to produce a memoized expression. If the expression is already memoized, just pass it through (the equivalent of the old "noexpand" hack). * libguile/memoize.c (scm_init_memoize): Initialize `memoize-expression' as the initial binding of `macroexpand'. * libguile/modules.c (scm_module_transformer): Before modules are booted, look for `macroexpand', not `%pre-modules-transformer'. * module/ice-9/boot-9.scm: No more %pre-modules-transformer. Loading psyntax extends `macroexpand'. (make-module): `macroexpand' is the default transformer. * module/ice-9/psyntax.scm: No more `noexpand'. (top-level-eval-hook, local-eval-hook): Instead of annotating with noexpand, memoize the expression before handing it to primitive-eval. (macroexpand): No more noexpand hack -- in its place we have another hack, to memoize the result when running in eval mode. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-07 Ludovic Courtès <ludo@gnu.org> Attempt to guarantee 8-byte alignment of on-stack frame objects. * libguile/vm.c (vm_dispatch_hook): Make FRAME a union with a `double' member. 2010-05-07 Ludovic Courtès <ludo@gnu.org> Add (system vm coverage). * module/system/vm/coverage.scm: New file. * module/Makefile.am (SYSTEM_SOURCES): Add `system/vm/coverage.scm'. * test-suite/guile-test (main): Use (system vm coverage). Handle `--coverage' and `-c'. * test-suite/tests/coverage.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/coverage.test'. * doc/ref/Makefile.am (guile_TEXINFOS): Add `api-coverage.texi'. * doc/ref/api-coverage.texi: New file. * doc/ref/guile.texi (API Reference): Include it. 2010-05-07 Ludovic Courtès <ludo@gnu.org> Allocate frame objects on the stack when invoking VM hooks. * libguile/vm.c (vm_dispatch_hook): Don't call `scm_c_make_frame ()'. Instead, allocate FRAME on the stack. 2010-05-07 Ludovic Courtès <ludo@gnu.org> Add `program-free-variables' to `(system vm program)'. * module/system/vm/program.scm (program-free-variables): New procedure. * module/language/objcode/spec.scm (program-free-variables): Remove. 2010-05-07 Ludovic Courtès <ludo@gnu.org> Fix the type tag produced by `SCM_STATIC_PROGRAM'. * libguile/snarf.h (SCM_STATIC_PROGRAM): Fix typo. When printing a VM, show the type of engine being used. * libguile/vm.c (scm_i_vm_print): Print the engine type. 2010-05-06 Andy Wingo <wingo@pobox.com> fix macros that expand into (begin (define-module ...) ...) * module/ice-9/boot-9.scm (define-module): Add `expand' to the situations, so that we ensure the current module changes at expand time. * module/ice-9/r6rs-libraries.scm (library): Expand the body within @@ expressions. 2010-05-06 Andy Wingo <wingo@pobox.com> psyntax no longer attempts to track (current-module) * module/ice-9/psyntax.scm: Revert tracking of the current module while expanding toplevel sequences. Better to preserve lexical scoping (relative to the module of the original expression) and allow for @@ to override it. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test: Test module-changing with @@. 2010-05-06 Andy Wingo <wingo@pobox.com> @@ generalized to arbitrary expressions. * module/ice-9/psyntax.scm (@@): The RHS of an @@ is no longer restricted to be an identifier, it can be an arbitrary expression. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-05-06 Andy Wingo <wingo@pobox.com> change form of @ and @@ psyntax handlers * module/ice-9/psyntax.scm (@, @@): Take r and w args, and also return r, w, and s. Adapt callers. 2010-05-06 Andy Wingo <wingo@pobox.com> add `expand' eval-when situation * module/ice-9/psyntax.scm (chi-when-list, chi-top): Add an undocumented `expand' situation to eval-when, which will trigger at expand-time for toplevel expressions. Useful when you are expanding for eval, but need to do some side effect to affect the expander -- like defining a module. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-04 Andy Wingo <wingo@pobox.com> add explanatory comment to chi-macro * module/ice-9/psyntax.scm (chi-macro): Add comment. check layout when making vtables * libguile/struct.c (scm_is_valid_vtable_layout): New private layout validating function. (scm_i_struct_inherit_vtable_magic): Do a more proper layout validation, and don't abort. 2010-05-03 Andy Wingo <wingo@pobox.com> add rnrs libraries test suite * test-suite/Makefile.am: * test-suite/tests/rnrs-libraries.test: * test-suite/tests/rnrs-test-a.scm: Add rnrs libraries test suite. 2010-05-03 Julian Graham <julian.graham@aya.yale.edu> add support for r6rs libraries * module/ice-9/boot-9.scm: Include ice-9/r6rs-libraries.scm. * module/ice-9/r6rs-libraries.scm: New file. * module/Makefile.am (NOCOMP_SOURCES): Add r6rs-libraries.scm. 2010-05-03 Andy Wingo <wingo@pobox.com> only ensure local vars for definitions during expansion when compiling * module/ice-9/psyntax.scm (chi-top): Only modify the compile-time environment to indicate that there is a local binding if we are running in compile mode. Otherwise some eval-when things might not have gotten executed, and our current-module could be wrong. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-05-03 Andy Wingo <wingo@pobox.com> export, re-export etc as syntax-rules macros * module/ice-9/boot-9.scm (export, re-export, export-syntax) (re-export-syntax): Rewrite as syntax-rules macros. rewrite use-modules and use-syntax using syntax-case * module/ice-9/boot-9.scm (use-modules): Rewrite as a syntax-case macro. (use-syntax): Likewise. (compile-interface-spec): Remove unused function rewrite define-module as a syntax-case macro * module/ice-9/boot-9.scm (define-module): Rewrite as a syntax-case macro, so that the expansion has proper module hygiene. Otherwise process-define-module isn't properly resolved against the root module -- a bytecode file that starts with a define-module would just try to look up process-define-module from the current module. (compile-define-module-args): Remove. Internal, and no one else used it. remove duplicate quasisyntax.scm EXTRA_DIST * module/Makefile.am (EXTRA_DIST): Remove quasisyntax.scm, as the NOCOMP_SOURCES handles that case. 2010-05-02 Julian Graham <julian.graham@aya.yale.edu> Test cases for `version-matches?'. * test-suite/tests/modules.test ("module versions"): New tests for `version-matches?'. 2010-05-02 Andy Wingo <wingo@pobox.com> add tour.texi to guile_TEXINFOS * doc/ref/Makefile.am (guile_TEXINFOS): Add tour.texi. Update example disassemblies * doc/ref/compiler.texi: * doc/ref/vm.texi: Update example disassemblies for current compiler, which uses assert-nargs-ee/locals. 2010-05-02 Andy Wingo <wingo@pobox.com> add assert-nargs-ee/locals instruction * libguile/vm-i-system.c (assert-nargs-ee/locals): New instruction, a combination of assert-nargs-ee and reserve-locals in the case in which nreq and nlocs can both be represented in 8 bits. * module/language/glil/compile-assembly.scm (glil->assembly): Add compiler case. * doc/ref/vm.texi (Function Prologue Instructions): Update docs. 2010-05-02 Andy Wingo <wingo@pobox.com> add underflow check in make-array * libguile/vm-i-scheme.c (make-array): Check for underflow before making the array. add SCM_UNLIKELY to CHECK_UNDERFLOW * libguile/vm-engine.h (CHECK_OVERFLOW, CHECK_UNDERFLOW): Add SCM_UNLIKELY blocks. Fix off-by-one error in CHECK_UNDERFLOW. (PRE_CHECK_UNDERFLOW): New macro, for checking underflow before accessing the current sp. (POP): Use PRE_CHECK_UNDERFLOW. update compiler.texi * doc/ref/compiler.texi (Compiler Tower): Update for removal of version from <language>, and add joiner and make-default-environment fields. Update examples. (The Scheme Compiler): Update for `macroexpand' instead of `sc-expand', and that the environment must be a module. (Tree-IL): Update for new Tree-IL, and change from "vars" to "gensyms". (GLIL): Update for new GLIL, including preludes and prompts. (Assembly): Update for current output (which seems quite verbose). (Bytecode and Objcode): Update for current output, and some procedure name changes. 2010-05-02 Andy Wingo <wingo@pobox.com> rename `vars' field in tree-il binding constructs to `gensyms' * module/language/tree-il.scm (<tree-il>): Rename `vars' fields of <let>, <letrec>, <fix>, and <lambda-case> to `gensyms'. For clarity, and to match <lexical-ref>. * module/language/tree-il.scm: * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/fix-letrec.scm: * module/language/tree-il/inline.scm: Update all callers. 2010-05-02 Andy Wingo <wingo@pobox.com> fix a comment about environments and the scheme compiler * module/language/scheme/compile-tree-il.scm: Fix a comment about the format of environments. 2010-05-02 Andy Wingo <wingo@pobox.com> remove `version' field from <language> * module/system/base/language.scm (<language>): Remove the `version' field from languages. It just wasn't useful. * module/language/assembly/spec.scm: * module/language/brainfuck/spec.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/spec.scm: * module/language/elisp/spec.scm: * module/language/glil/spec.scm: * module/language/objcode/spec.scm: * module/language/scheme/spec.scm: * module/language/tree-il/spec.scm: * module/language/value/spec.scm: Remove #:version from all language definitions. Shorten some language names (e.g. "Guile Scheme" -> "Scheme"). 2010-05-01 Andy Wingo <wingo@pobox.com> update documentation for vm instructions * doc/ref/vm.texi: Update with documentation for new-ish instructions, and reorganize the sections a bit. * doc/ref/compiler.texi (GLIL): Fix up a couple xrefs. 2010-05-01 Andy Wingo <wingo@pobox.com> simplify make-struct * libguile/vm-i-scheme.c: Use DROPN idiom. 2010-05-01 Andy Wingo <wingo@pobox.com> optimize and bugfix make-struct VM opcode * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump for make-struct change. * libguile/struct.c (scm_i_alloc_struct): Use scm_words instead of scm_gc_malloc to simplify the code and inline the call to GC_MALLOC. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile make-struct/no-tail to make-struct. * module/language/tree-il/primitives.scm (define-primitive-expander): Allow a conditional branch of #f to aboirt inlining. (make-struct): Expand into make-struct/no-tail in the case that tail-size is 0. * libguile/vm-i-scheme.c (make-struct): Adapt to always assume tail-size is 0. Inline allocation if possible. Don't decrement the SP past live objects on the stack, which could cause GC to miss references. Use the NULLSTACK macro. 2010-04-27 Andy Wingo <wingo@pobox.com> fix bug in compile-glil.scm for return opcode-hack * module/language/tree-il/compile-glil.scm (*primcall-ops*): Fix entry for `return'. Thanks to Jon Herron for the report. add module-export-all! * module/ice-9/boot-9.scm (module-export-all!): New function, exports all current and future local variables from a module. Merge branch 'wip-module-namespaces' comment some global variables in modules.c * libguile/modules.c: Comment some global variables. 2010-04-26 Neil Jerram <neil@ossau.uklinux.net> Fix inconsistent sectioning, causing make to fail * doc/ref/guile.texi (Top): Remove @raisesections and @lowersections around scheme-ideas.texi. * doc/ref/scheme-ideas.texi (About Data, ...): Instead remove one "sub" from every node here apart from the chapter node. * doc/ref/scheme-ideas.texi (Evaluating, Eval Variable, Eval Procedure, Eval Special, Lexical Scope, Scoping Example): Turn subheadings back into subsubsections, and reinstate corresponding menus. (These had to become headings, rather than (sub)*sections, when the top level item in scheme-ideas.texi was a section. Now it's a chapter again, they can go back to being (sub)*sections.) 2010-04-26 Neil Jerram <neiljerram@googlemail.com> Bring the manual organisation section a little closer to reality FWIW I'm not sure I like this bullety presentation - but for now this just aligns the descriptions a bit closer to the actual chapters and chapter contents. * doc/ref/intro.texi (Organisation of this Manual): Cover `Hello Guile!' and `Hello Scheme!' chapters. Thin out text for `Programming in Scheme'. Renumber other chapters. 2010-04-26 Neil Jerram <neiljerram@googlemail.com> Assorted minor manual changes * doc/ref/guile.texi (Programming in Scheme): Remove "awful" and add "as opposed to having to dive into C code", to explain what we really mean here. Remove incorrect para about the `Hello Scheme!' material. * doc/ref/intro.texi (Interactive Programming): Change "allows" to "is designed for" - sounds less accidental! * doc/ref/scheme-ideas.texi (Hello Scheme!): Remove unnecessary "reference", and inappropriate "randomness". 2010-04-26 Neil Jerram <neiljerram@googlemail.com> More `Guile and the GNU Project' text * doc/ref/intro.texi (Guile and the GNU Project): More text about extensibility and software freedom. 2010-04-25 Neil Jerram <neiljerram@googlemail.com> Move description of manual organisation from Preface to Introduction This material isn't "meta-" enough to be in the Preface, and it supports (by its structure) some of the points that the Introduction makes about Guile, so I think it belongs here. * doc/ref/intro.texi (Introduction): Add `Organisation of this Manual' menu item and material to here... * doc/ref/preface.texi (Preface): ...from here. 2010-04-25 Neil Jerram <neiljerram@googlemail.com> Remove weird instruction * doc/ref/intro.texi: Remove `Do not confuse the two.' (Or else what?) Fix typo * doc/ref/compiler.texi (Bytecode and Objcode): Remove extraneous comma. 2010-04-25 Neil Jerram <neiljerram@googlemail.com> Move `Reporting Bugs' section out of Introduction I think it's too detailed, when compared with the other Introduction sections. It probably also refers to concepts that haven't been mentioned yet, but are mentioned in the following quick tour chapter; so let's move it there. * doc/ref/guile.texi: Move @raisesections and @lowersections for tour.texi material from here to inside tour.texi. * doc/ref/intro.texi (Introduction): Don't mention reporting problems in first para. Move menu item and material for `Reporting Bugs' from here... * doc/ref/tour.texi (Hello Guile!): ...to here. Also mention reporting problems in the introductory para. 2010-04-25 Neil Jerram <neiljerram@googlemail.com> Move whirlwind tour material to its own chapter * doc/ref/guile.texi (Top): New top level `Hello Guile!' menu item; include new file tour.texi. * doc/ref/intro.texi (Introduction): Remove whirlwind tour menu item and material from here... * doc/ref/tour.texi: ...to new file here. 2010-04-25 Neil Jerram <neiljerram@googlemail.com> Move Scheme introduction (Guile-independent) to its own chapter This magically fixes all the internal wordings that say "chapter" rather than "section", and separates Guile-independent and skippable material from material that is Guile-specific and probably-not-skippable - which I think is helpful. * doc/ref/guile.texi (Top): New `Hello Scheme!' menu item, and removed `Basic Ideas' item. Move include of scheme-ideas.texi before `Programming in Scheme' chapter, using @raisesections and @lowersections. Also move scheme-reading.texi to same place. * doc/ref/scheme-ideas.texi: Change name from `Basic Ideas' (which is a bit boring) to `Hello Scheme!'. Move `Further Reading' menu item here. 2010-04-24 Andy Wingo <wingo@pobox.com> module-public-interface is a field in the module record * module/ice-9/boot-9.scm (module-public-interface) (set-module-public-interface!): Instead of using '%module-public-interface, use a field in the module instead. (make-module, make-autoload-interface): Adapt. * module/ice-9/deprecated.scm (module-public-interface): (set-module-public-interface!): Add shims so that manually munging %module-public-interface should continue to work. 2010-04-24 Andy Wingo <wingo@pobox.com> fix some uses of %module-public-interface * module/ice-9/r5rs.scm: * module/ice-9/safe-r5rs.scm: * module/oop/goops/save.scm: * module/oop/goops/simple.scm: * module/oop/goops/stklos.scm: Fix some uses of %module-public-interface. 2010-04-24 Andy Wingo <wingo@pobox.com> module-public-interface in Scheme * libguile/modules.c: Consolidate all variables to the top of the file. (scm_module_public_interface): Dispatch to Scheme. (scm_post_boot_init_modules): Resolve module-public-interface. * module/ice-9/boot-9.scm (module-public-interface): Implement in Scheme. 2010-04-24 Andy Wingo <wingo@pobox.com> add submodule binders * module/ice-9/boot-9.scm (module-submodule-binder) (set-module-submodule-binder!): New field on modules. (make-module, make-autoload-interface): Adapt. (module-ref-submodule): If we miss the submodules table, call the submodules binder, if any. * module/ice-9/deprecated.scm (module-ref-submodule): Check the submodule binder before the deprecated look into the obarray. 2010-04-24 Andy Wingo <wingo@pobox.com> module-{ref,define}-submodule use the submodules table * module/ice-9/boot-9.scm (module-ref-submodule) (module-define-submodule!): Implement in terms of the module-submodules table, instead of looking for bindings in the value namespace. * module/ice-9/deprecated.scm (module-ref-submodule): (module-define-submodule!): Define deprecated versions of these that duplicate the submodules table in the normal values namespace, for back compatibility. 2010-04-24 Andy Wingo <wingo@pobox.com> add submodules field to modules * module/ice-9/boot-9.scm (module-type, module-constructor): Add a field to modules, a table that will hold submodules. (make-module, make-autoload-interface): Adapt. use nested-ref-module in (system xref) * module/system/xref.scm (program-callee-rev-vars): Use nested-ref-module instead of nested-ref. nested module fixen to (ice-9 ls) * module/ice-9/ls.scm (local-definitions-in, definitions-in): Use nested module procedures, as appropriate. (recursive-local-define): Fix attempt to treat null as false. Whoops.. deprecated %app shims use module-define-submodule! * module/ice-9/deprecated.scm (%app, app, modules): Don't use the module interface to provide %app shims, use module-define-submodule! directly to side-effect the root module. resolve-module uses -module variants * module/ice-9/boot-9.scm (resolve-module): Use module-define-submodule! when binding the root, and nested-ref-module for the hot lookup, which is guaranteed to return a module or #f. use the define-module variants in module-name and make-modules-in * module/ice-9/boot-9.scm (module-name): Use module-define-submodule! instead of nested-define!. (make-modules-in): Rewrite in terms of nested-define-module!. nested-ref et al use module-ref-submodule; add -module nested variants * module/ice-9/boot-9.scm: Update comments above nested-ref to include ref-module and define-module!. (nested-ref, nested-set!, nested-define!, nested-remove!): Use module-ref-submodule to traverse the module hierarchy. (nested-ref-module, nested-define-module!): New functions, like nested-ref and nested-define!, but operate on namespaces instead of values. (local-ref-module, local-define-module): New analogs of local-ref and local-define, but for namespaces. 2010-04-23 Andy Wingo <wingo@pobox.com> add module-ref-submodule, module-define-submodule! * module/ice-9/boot-9.scm (module-ref-submodule): (module-define-submodule!): New stubs, will be used to separate traversing the module tree from accessing values. tweak to resolve-module * module/ice-9/boot-9.scm (resolve-module): If we found a module but it didn't have a public interface and we're not autoloading, just return the module directly instead of dispatching to make-modules-in. fix (app modules) usage in (ice-9 session) * module/ice-9/session.scm (root-modules): Fix '(app modules) usage. 2010-04-22 Andy Wingo <wingo@pobox.com> deprecate %app * module/ice-9/boot-9.scm (module-name): Don't rely on (%app modules), use other tricks to name anonymous modules. (resolve-module): Instead of relying on %app, close over the root of the module hierarchy -- the module that was '(%app modules). * module/ice-9/deprecated.scm (%app): Provide a compatible %app shim. 2010-04-22 Andy Wingo <wingo@pobox.com> refactorings for the module boot process * module/ice-9/boot-9.scm (%app): Bind %app and (%app modules) within the nested hierarchy before making (guile). (the-root-module): Define to '(%app modules guile) together with the-root-module's definition. (resolve-module): Define a "phase 2" resolve-module that only works on the root module. (try-module-autoload): No need for stub definition, as modules.c does not reference this binding. (resolve-module): Redefine, after modules have been loaded, to actually do its job, without any hacks for the pre-boot phase. Move up the boot code before the definition of resolve-module's helpers. 2010-04-22 Andy Wingo <wingo@pobox.com> add comments to resolve-module * module/ice-9/boot-9.scm (resolve-module): Add comments. formally deprecate `app' * module/ice-9/deprecated.scm (app): Deprecate. * module/ice-9/boot-9.scm: Remove app definition. (app modules) -> (%app modules) * module/ice-9/debugging/breakpoints.scm (module-if-already-loaded): (all-loaded-modules): * module/oop/goops/stklos.scm: Fix instances of (app modules) to be (%app modules). 2010-04-20 Andy Wingo <wingo@pobox.com> fix comment about "local-define" and "local-remove". * module/ice-9/boot-9.scm: Fix comment about "local-define!", whereas it's "local-define". Same for "local-remove". 2010-04-20 Andy Wingo <wingo@pobox.com> module-type defined programmatically * module/ice-9/boot-9.scm (make-record-type): Add an explanatory comment. (%print-module): Remove a hacky comment about redefinitions being difficult, because now the module-printer is called by name from module-type's printer. (module-type): Define the module type, its constructor, predicate, and accessors programmatically, at expansion time. Should reduce any errors in transcription, between adding fields and adding accessors. * libguile/modules.c (scm_lookup_closure_module): Move an explanatory comment here from boot-9.scm. 2010-04-19 Andy Wingo <wingo@pobox.com> avoid primitive-eval in record-constructor * module/ice-9/boot-9.scm (record-type-vtable): Add a third field, a precomputed constructor. There is an unfortunate circularity here, though. (make-record-type): If the record has fewer than 20 fields, return a constructor pre-generated to suit. Otherwise just check the length, and dispatch to `apply' and not `primitive-eval'. FWIW the current module record has something like 12 fields. (record-constructor): If we're asking for the standard constructor, return the precomputed constructor. 2010-04-19 Andy Wingo <wingo@pobox.com> make-record-type slight refactor * test-suite/tests/records.test ("records"): Add tests for printers. * module/ice-9/boot-9.scm (make-record-type): Refactor the code that makes the default printer. 2010-04-19 Andy Wingo <wingo@pobox.com> filesystem trickery to scm_i_relativize_path in filesys.c; bugfix. * libguile/filesys.h: * libguile/filesys.c (scm_i_relativize_path): New function, moved here from fports.c. Internal for now; we can make it external though if people like its interface. * libguile/fports.c (fport_canonicalize_filename): Move all of the tricky bits to filesys.c. Also fixes a bug in which a delimiter wasn't stripped. 2010-04-19 Andy Wingo <wingo@pobox.com> deprecate @bind * module/ice-9/boot-9.scm: * module/ice-9/deprecated.scm (@bind): Deprecate @bind, which was a thread-unsafe dynamic scoping mechanism, used in the old elisp support. Fluids are more correct, and are probably faster, given the VM support for with-fluids. * test-suite/tests/dynamic-scope.test: Remove. * test-suite/tests/fluids.test: Move relevant tests from dynamic-scope.test here, recast in terms of with-fluids. 2010-04-19 Andy Wingo <wingo@pobox.com> compile-file gets #:canonicalization arg, defaults to 'relative * module/system/base/compile.scm (compile-file, compile-and-load): Add a keyword arg #:canonicalization, which defaults to 'relative. In this way, one might compile "../module/ice-9/boot-9.scm", but the path that gets residualized into the .go is "ice-9/boot-9.scm". %file-port-name-canonicalization is a fluid * libguile/fports.c (fport_canonicalize_filename): (scm_init_fports): Change %file-port-name-canonicalization to be a fluid. add %file-port-name-canonicalization option * libguile/fports.c (%file-port-name-canonicalization): New global var. (fport_canonicalize_filename): New helper. If %file-port-name-canonicalization is 'absolute, then run file port names through canonicalize_path; if it's 'relative, then canonicalize the name, but strip off load paths; otherwise leave the port name alone. (scm_open_file): Use fport_canonicalize_filename. (scm_init_fports): Define %file-port-name-canonicalization. formatting fix * libguile/filesys.c (scm_canonicalize_path): Format fix. use procedure-minimum-arity in tests * test-suite/tests/procprop.test ("procedure-arity"): Fix tests to use procedure-minimum-arity. 2010-04-17 Andy Wingo <wingo@pobox.com> deprecate arity access via (procedure-properties proc 'arity) * libguile/procprop.h (scm_sym_arity): Deprecate. I didn't move it to deprecated.h though, because that might have some boot implications -- though I didn't check. * libguile/procprop.c (scm_procedure_properties) (scm_set_procedure_properties_x, scm_procedure_property) (scm_set_procedure_property_x): Deprecate access to a procedure's arity via procedure-properties. Users should use procedure-minimum-arity. * module/ice-9/channel.scm (eval): * module/ice-9/session.scm (arity): * module/language/tree-il/analyze.scm (validate-arity): Fix up instances of (procedure-property x 'arity) to use procedure-minimum-arity. 2010-04-17 Andy Wingo <wingo@pobox.com> add procedure_minimum_arity * libguile/procprop.h: * libguile/procprop.c (scm_procedure_minimum_arity): New public function, will replace (procedure-property foo 'arity). * libguile/programs.c (scm_i_program_arity): Rework to always provide the most permissive arity. 2010-04-17 Andy Wingo <wingo@pobox.com> remove program-name, program-documentation * libguile/programs.h: * libguile/programs.c (scm_program_name): Remove. procedure-name is sufficient. * module/system/vm/program.scm (program-name): Remove from exports list. (program-documentation): Remove; procedure-documentation is sufficient. * libguile/debug.c (scm_procedure_name): Remove special case for programs. * module/language/tree-il/analyze.scm (validate-arity): Use procedure-name. * module/ice-9/documentation.scm (object-documentation): Just use procedure-documentation, without special cases for programs. 2010-04-17 Andy Wingo <wingo@pobox.com> scm_i_program_properties is internal; just use procedure-properties * libguile/programs.h: * libguile/programs.c (scm_i_program_properties): Make internal. (scm_program_name): Use scm_i_program_properties. * libguile/procprop.c (scm_procedure_properties): Use scm_i_program_properties, for programs. * libguile/procs.c (scm_procedure_documentation): Use procedure-property to get to 'documentation, not program-property. * module/system/vm/program.scm (program-properties, program-property): Remove from the exports list. (program-documentation): Use procedure-property. * module/texinfo/reflection.scm (macro-arguments) (macro-additional-stexi) (object-stexi-documentation): Use procedure-property, not program-property. 2010-04-17 Andy Wingo <wingo@pobox.com> tweaks to procprop.c * libguile/procprop.c (scm_procedure_property) (scm_set_procedure_property_x): Fix up some variable naming. procedure-properties incorporates program-properties * libguile/procprop.c (overrides, overrides_lock): Rename from props and props_lock. (scm_procedure_properties): If no overrides have been set, default to scm_program_properties (if it's a program). (scm_set_procedure_properties_x): Error if 'arity is in the alist. (scm_procedure_property): Just do a lookup in the scm_procedure_properties. (scm_set_procedure_properties_x): Init the overrides to scm_procedure_properties. fix read.bm * benchmark-suite/benchmarks/read.bm (%files-to-load): psyntax-pp.scm, not psyntax.scm. 2010-04-16 Neil Jerram <neil@ossau.uklinux.net> Merge branch 'wip-manual-2' Conflicts: doc/ref/api-translation.texi 2010-04-16 Andy Wingo <wingo@pobox.com> fold in feedback to api-languages * doc/ref/api-languages.texi: Fold in feedback. NEWS tweaks for nil * NEWS: Some nil-related news fixes; after 1.9.10, I know, but hey ;-) more nil docs * doc/ref/api-languages.texi (Nil): Be a bit more thorough, and positive. add docs on `nil' * doc/ref/api-languages.texi (Nil): Write about `nil'. fix bugs in ice-9 i18n demo (invalid input) * doc/ref/api-i18n.texi (Accessing Locale Information): Crucial bugfixes. fixes to api-i18n.texi * doc/ref/api-i18n.texi (Character Case Mapping): Remove note about lack of support for multibute characters. flesh out docs on multiple languages a bit more * doc/ref/api-languages.texi: Move here from api-translation. Still stubbed in parts, but it's getting better. * doc/ref/Makefile.am: Adapt to api-languages.texi name change. * doc/ref/guile.texi: Likewise. 2010-04-15 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.10. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2010-04-11 Neil Jerram <neil@ossau.uklinux.net> Improvements to Introduction chapter * doc/ref/intro.texi (Introduction): Change "some" to "the". (Guile and Scheme): "multithreading" -> "multithreaded". (Combining with C): Mention "libguile" as library name. (Guile and the GNU Project): New text. (Interactive Programming): New text. (Supporting Multiple Languages): New text, reflecting currently supported languages. (Obtaining and Installing Guile): Use @var for version placeholder. Remove mention of separate tutorial. 2010-04-10 Neil Jerram <neil@ossau.uklinux.net> Merge branch 'master' into wip-manual-2 Conflicts: doc/ref/api-procedures.texi doc/ref/misc-modules.texi (Caused by me removing `@page' from a couple of sections that have been modified by others.) 2010-04-09 Andy Wingo <wingo@pobox.com> elisp.test cleanups * test-suite/tests/elisp.test: Use quote and #nil instead of quasiquote and ,#nil. re-enable elisp test * test-suite/tests/elisp.test: Rework for #nil, to actually be enabled, to always run, and to use the new compiler. Comment out some failing tests, to be dealt with in the future. change remaining %nil -> #nil * doc/ref/vm.texi: * libguile/boolean.h: * libguile/pairs.h: * module/language/elisp/README: * test-suite/tests/elisp-compiler.test: * test-suite/tests/load.test: Change remaining mentions of %nil to #nil. 2010-04-09 Andy Wingo <wingo@pobox.com> elisp fixes for nil, and, or * module/language/elisp/runtime/macro-slot.scm (or, and): Fix one-arg case to return the arg as-is. * module/language/elisp/runtime.scm (nil-value): Fix to be #nil. 2010-04-09 Andy Wingo <wingo@pobox.com> remove libguile/lang.h, deprecate %nil (in favor of #nil) * libguile/Makefile.am: * libguile/init.c: * libguile/lang.c: * libguile/lang.h: Remove lang.c and lang.h. * libguile/pairs.h (SCM_NIL_P, SCM_NULL_OR_NIL_P): Moved here. * module/ice-9/deprecated.scm (%nil): %nil definition moved here. * libguile/alist.c: * libguile/async.c: * libguile/backtrace.c: * libguile/boolean.c: * libguile/dynl.c: * libguile/eval.c: * libguile/filesys.c: * libguile/fluids.c: * libguile/list.c: * libguile/load.c: * libguile/options.c: * libguile/posix.c: * libguile/print.c: * libguile/promises.c: * libguile/sort.c: * libguile/throw.c: * libguile/trees.c: * libguile/vectors.c: * libguile/vm.c: * libguile/weaks.c: * srfi/srfi-1.c: <libguile/lang.h> references removed. 2010-04-09 Andy Wingo <wingo@pobox.com> %nil -> #nil * module/language/assembly.scm (object->assembly, assembly->object): * module/language/elisp/compile-tree-il.scm (compile-pair): * module/language/glil/decompile-assembly.scm (decompile-load-program): Change instances of %nil to #nil. 2010-04-09 Andy Wingo <wingo@pobox.com> add read syntax for #nil * libguile/evalext.c (scm_self_evaluating_p): #nil is self-evaluating. * libguile/read.c (scm_read_nil, scm_read_sharp): Add read syntax for #nil. 2010-04-09 Andy Wingo <wingo@pobox.com> lisp nil always enabled * configure.ac: Remove --disable-elisp option. Lisp nil is always enabled. * libguile/boolean.h: * libguile/gen-scmconfig.c: * libguile/gen-scmconfig.h.in: * libguile/init.c: * libguile/lang.c: * libguile/lang.h: * libguile/pairs.h: * libguile/private-options.h: * libguile/read.c: Remove conditionals for disabling elisp. 2010-04-09 Andy Wingo <wingo@pobox.com> add debugging input and output ports * module/system/vm/debug.scm (*debug-input-port*): (*debug-output-port*): New public fluids. (run-debugger): Add some kwargs for input and output ports, defaulting to the debug input and output ports. (debug-pre-unwind-handler): Print to debug output port. (debug): Untabify. repl-reader only prompts if no input is available * module/ice-9/boot-9.scm (repl-reader): For the default (non-readline) repl reader, only display the prompt if input isn't already available. Fixes spurious prompts in the debugger. 2010-04-09 Ludovic Courtès <ludo@gnu.org> Raise an error when attempting to modify the value of `%null-pointer'. * libguile/foreign.c (sym_null_pointer_error): New variable. (null_pointer_error): New function. (scm_foreign_set_x): Raise an error if attempting to modify NULL_POINTER. (scm_foreign_to_bytevector): Use `null_pointer_error ()' instead of `scm_misc_error ()'. * test-suite/tests/foreign.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add tests/foreign.test. * test-suite/lib.scm (exception:null-pointer-error): New variable. 2010-04-09 Ludovic Courtès <ludo@gnu.org> Allocate foreign pointer objects in GC-scanned memory. * libguile/foreign.c (scm_take_foreign_pointer): Allocate RET in GC-scanned memory. This fixes a bug where the object pointed to by SCM_CIF in the pair returned by `cif_to_procedure ()' would be reclaimed (as a consequence of commit 087aa6aa312a8d0af51fa9b2f7bfc1332ad97338). Avoid obsolescent C declarator with empty parentheses. * libguile/foreign.c (scm_i_foreign_call): Don't declare FUNC with a declarator with empty parentheses (bug #23681). 2010-04-09 Ludovic Courtès <ludo@gnu.org> Fix `module-reverse-lookup'. * libguile/modules.c (scm_module_reverse_lookup): Type-check VARIABLE. Don't traverse the `uses' list when MODULE is #f. * test-suite/tests/modules.test ("foundations")["module-reverse-lookup [pre-module-obarray]", "module-reverse-lookup [wrong-type-arg]"]: New tests. 2010-04-09 Ludovic Courtès <ludo@gnu.org> Remove `fold' from (sxml fold). * module/sxml/fold.scm: Use (srfi srfi-1). (fold): Remove. (fold-values): Update docstring accordingly. * test-suite/tests/sxml.fold.test: Use (srfi srfi-1). 2010-04-08 Andy Wingo <wingo@pobox.com> fix curried definitions for value defines * module/ice-9/curried-definitions.scm: Allow definitions of values with define and define*. * test-suite/tests/curried-definitions.test: Add tests. sync regs before calling scm_class_of * libguile/vm-i-scheme.c (class-of): Sync registers before calling scm_class_of. 2010-04-08 Andy Wingo <wingo@pobox.com> add (ice-9 curried definitions) * module/Makefile.am: * module/ice-9/curried-definitions.scm: New module, implementing SICM-style currying. * test-suite/Makefile.am: * test-suite/tests/curried-definitions.test: A test. 2010-04-08 Andy Wingo <wingo@pobox.com> fix bug when importing bindings that were already imported and used * module/ice-9/boot-9.scm (module-use!, module-use-interfaces!): When adding the module or interface to the use list, clear the cached imports obarray. The test case is coming next. 2010-04-07 Andy Wingo <wingo@pobox.com> update licenses on tests imported from guile-lib * test-suite/tests/sxml.fold.test: * test-suite/tests/sxml.ssax.test: * test-suite/tests/sxml.transform.test: * test-suite/tests/sxml.xpath.test: * test-suite/tests/texinfo.docbook.test: * test-suite/tests/texinfo.serialize.test: * test-suite/tests/texinfo.string-utils.test: * test-suite/tests/texinfo.test: Update licenses to GPL or LGPL 3+, and update copyright holders to be FSF (where that is the case). Copyright holders who are not FSF have their code in GPL/LGPL-compatible licesnse. add docs and tests for array->list * libguile/generalized-arrays.c (scm_array_to_list): Add docs. * test-suite/tests/arrays.test ("array->list"): Add tests. update NEWS for 1.9.10 * NEWS: Update for new 1.9.10 entries. very important fix to (system repl command) * module/system/repl/command.scm (language): s/Have fun/Happy hacking/. Heh. deprecated sc-expand in deprecated (ice-9 syncase) * module/ice-9/syncase.scm: Export sc-expand as macroexpand. Update NEWS to reflect the current state * NEWS: Update a number of old entries. 2010-04-06 Andy Wingo <wingo@pobox.com> remove transient 1.9.9 entries from the NEWS * NEWS: Cull 1.9.9 entries. finish ffi docs * libguile/foreign.c: Some doc tweaks. * doc/ref/api-foreign.texi: Finish FFI docs. more ffi docs * libguile/foreign.c (scm_make_foreign_function): Doc a little. * doc/ref/api-foreign.texi (Foreign Function Interface): Document some more. 2010-04-03 Michael Gran <spk121@yahoo.com> copyright dates * libguile/unidata_to_charset.pl: change copyright date * test-suite/tests/srfi-14.test: change copyright date 2010-04-03 Michael Gran <spk121@yahoo.com> Remove obsolete docs for multi-byte text These describe the initial, unimplemented plan for Unicode support. These have been overcome by events. * doc/mbapi.texi: removed * doc/mltext.texi: removed 2010-04-03 Michael Gran <spk121@yahoo.com> Update standard character sets to Unicode 5.2 * srfi-14.i.c: all character ranges updated to Unicode 5.2 2010-04-03 Michael Gran <spk121@yahoo.com> Unicode data parsing script incorrect for char-set:ascii char-set:ascii is the only char-set consisting of a single contiguous range, and there was an off-by-one error for that case. * libguile/unidata_to_charset.pl (compute): fix off-by-one 2010-04-02 Andy Wingo <wingo@pobox.com> deprecate dynamic-args-call, and update docs some more * libguile/deprecated.h (scm_dynamic_args_call): Deprecate. * libguile/deprecated.c: * libguile/dynl.h: * libguile/dynl.c: * doc/ref/api-foreign.texi: More doc updates. 2010-04-02 Andy Wingo <wingo@pobox.com> add api-foreign.texi * doc/ref/api-foreign.texi: New file. * doc/ref/api-modules.texi: Reorganize bits about dynamic linking into api-foreign. * doc/ref/guile.texi: * doc/ref/Makefile.am: Adapt to api-foreign.texi. 2010-04-01 Andy Wingo <wingo@pobox.com> fix vector-ref and vector-set opcodes for weak vectors * libguile/vectors.h (SCM_I_IS_NONWEAK_VECTOR): New internal predicate. * libguile/vm-i-scheme.c (vector-ref, vector-set): Only inline access to nonweak vectors. 2010-04-01 Andy Wingo <wingo@pobox.com> more fixes to equal? for arrays * libguile/array-map.c (array_compare, scm_array_equal_p): Rewrite as something that operates on the generic array handle infrastructure. Based on array->list. (scm_i_array_equal_p): Change the docs, as array-equal? is now the same as equal?, except that it typechecks its args. * doc/ref/api-compound.texi (Array Procedures): Update array-equal? docs. * libguile/deprecated.h: * libguile/deprecated.c (scm_raequal): Deprecate. * libguile/bytevectors.c (scm_bytevector_eq_p): Bugfix: bytevectors are bytevector=? only if their element type is the same. * libguile/eq.c (scm_equal_p): Only dispatch to scm_array_equal_p if both args are arrays (generically). * test-suite/tests/arrays.test ("equal?"): Add some more tests. 2010-03-31 Andy Wingo <wingo@pobox.com> fix array bugs in ecmascript * module/language/ecmascript/array.scm (pput, *array-prototype*): Fix bugs in ecmascript array runtime. fix bug in ash opcode * libguile/vm-i-scheme.c (ash): Fix embarrassing bug in (ash 1 32). * test-suite/tests/bit-operations.test ("bitshifts on word boundaries"): Add tests. 2010-03-31 Andy Wingo <wingo@pobox.com> rename unif.test to arrays.test * test-suite/tests/arrays.test: Move all unif.test here. Unif.test was mostly testing arrays anyway. Incorporate the existing arrays.test. * test-suite/tests/unif.test: Deleted. * test-suite/Makefile.am: Update. 2010-03-31 Ludovic Courtès <ludo@gnu.org> Move another GOOPS-less test at the beginning. * test-suite/tests/eval.test ("promises")["extended promise behaviour"]("implicit forcing is not supported"): Move... * test-suite/tests/00-initial-env.test ("goopsless"): ... here. 2010-03-31 Ludovic Courtès <ludo@gnu.org> Add separate test file for GOOPS-less tests. * test-suite/tests/00-initial-env.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add `tests/00-initial-env.test'. * test-suite/tests/numbers.test ("+")["wrong type argument"]: Move to `00-initial-env.test'. 2010-03-31 Ludovic Courtès <ludo@gnu.org> Adapt ECMAScript parser and lexer to `(system base lalr)'. * module/language/ecmascript/tokenize.scm: Use `make-lexical-token' and related procedures instead of pairs as tokens passed to the parser. Pass source location information in the form of `source-location' objects. * module/language/ecmascript/parse.scm (read-ecmascript, read-ecmascript/1): Instantiate a new parser at each call. (parse-ecmascript): Rename to... (make-parser): ... this. Change `->' to `:' in the grammar syntax. * module/language/ecmascript/parse-lalr.scm: Remove. * module/Makefile.am (ECMASCRIPT_LANG_SOURCES): Remove `language/ecmascript/parse-lalr.scm'. 2010-03-31 Ludovic Courtès <ludo@gnu.org> Add rudimentary ECMAScript tests. * test-suite/Makefile.am (SCM_TESTS): Add `tests/ecmascript.test'. * test-suite/tests/ecmascript.test: New file. 2010-03-31 Ludovic Courtès <ludo@gnu.org> Mention `(system base lalr)' in the manual. * doc/ref/Makefile.am (guile_TEXINFOS): Add `api-lalr.texi'. * doc/ref/api-lalr.texi: New file. * doc/ref/guile.texi (API Reference): Include it. 2010-03-31 Ludovic Courtès <ludo@gnu.org> Add Boucher's `lalr-scm' as the `(system base lalr)' module. Taken from r51 of <http://lalr-scm.googlecode.com/svn/trunk>. * module/Makefile.am (SYSTEM_BASE_SOURCES): Add `system/base/lalr.scm'. (NOCOMP_SOURCES): Add `system/base/lalr.upstream.scm'. * module/system/base/lalr.scm, module/system/base/lalr.upstream.scm: New files. * test-suite/Makefile.am (LALR_TESTS, LALR_EXTRA, TESTS, TESTS_ENVIRONMENT): New variables. (EXTRA_DIST): Add $(LALR_EXTRA). * test-suite/lalr/common-test.scm, test-suite/lalr/glr-test.scm, test-suite/lalr/test-glr-associativity.scm, test-suite/lalr/test-glr-basics-01.scm, test-suite/lalr/test-glr-basics-02.scm, test-suite/lalr/test-glr-basics-03.scm, test-suite/lalr/test-glr-basics-04.scm, test-suite/lalr/test-glr-basics-05.scm, test-suite/lalr/test-glr-script-expression.scm, test-suite/lalr/test-glr-single-expressions.scm, test-suite/lalr/test-lr-associativity-01.scm, test-suite/lalr/test-lr-associativity-02.scm, test-suite/lalr/test-lr-associativity-03.scm, test-suite/lalr/test-lr-associativity-04.scm, test-suite/lalr/test-lr-basics-01.scm, test-suite/lalr/test-lr-basics-02.scm, test-suite/lalr/test-lr-basics-03.scm, test-suite/lalr/test-lr-basics-04.scm, test-suite/lalr/test-lr-basics-05.scm, test-suite/lalr/test-lr-error-recovery-01.scm, test-suite/lalr/test-lr-error-recovery-02.scm, test-suite/lalr/test-lr-no-clause.scm, test-suite/lalr/test-lr-script-expression.scm, test-suite/lalr/test-lr-single-expressions.scm: New files. 2010-03-31 Andy Wingo <wingo@pobox.com> fix equal? between an array and a non-array OK let's try again. While the thanks go to Daniel Llorens del Río for the tip, the blame continues going to me :) * test-suite/Makefile.am: * test-suite/tests/arrays.test: Add a test. * libguile/array-map.c (raeql): Handle a few 0-dimensional cases. If the shapes of the arrays don't match, just return #f instead of raising an error. 2010-03-30 Andy Wingo <wingo@pobox.com> Revert "fix equal? between an array and a non-array" This reverts commit 9d031d4d575ac8f343a5d984cb02cd374577c5a9. 2010-03-30 Andy Wingo <wingo@pobox.com> fix equal? between an array and a non-array * libguile/eq.c (scm_equal_p): Only call scm_array_equal_p if both arguments are generalized arrays; otherwise they are not equal. Thanks to Daniel Llorens del Río for the tip. * test-suite/Makefile.am: * test-suite/tests/arrays.test: Add a test. 2010-03-30 Andy Wingo <wingo@pobox.com> correctly handle --no-autocompile (fixed broken previous patch) * libguile/load.c (scm_init_load): Initialize %load-should-autocompile to false. * libguile/init.c (scm_i_init_guile): * libguile/load.h: * libguile/load.c (scm_init_load_should_autocompile): At the end of init, check GUILE_AUTO_COMPILE. * libguile/script.c (scm_compile_shell_switches): Instead of making --autocompile / --no-autocompile render into the s-expression, just handle them immediately, so that --no-autocompile takes effect for the expander. 2010-03-30 Andy Wingo <wingo@pobox.com> nil is null, whee * libguile/pairs.h (scm_is_null): Nil is also null. * libguile/vm-i-scheme.c (not, not-not, null?, not-null?): * libguile/vm-i-system.c (br-if-null, br-if-not-null): Remove some more nil special cases. 2010-03-30 Andy Wingo <wingo@pobox.com> nil is false, whee * libguile/boolean.h (scm_is_false): Recognize nil as false, by default. (scm_is_bool): Recognize nil as a boolean. * libguile/boolean.c (scm_not, scm_boolean, scm_to_bool, scm_is_bool): Adapt to treat nil as false. * libguile/vm-i-system.c (br-if, br-if-not): Just use scm_is_false instead of specifically mentioning nil. 2010-03-30 Andy Wingo <wingo@pobox.com> going through scm_shell not necessary to get autocompilation * libguile/load.c (scm_init_load): Initialize %load-should-autocompile from the environment variable here, so that apps that don't go through scm_shell get autocompilation. * libguile/script.c (scm_compile_shell_switches): Explicitly enable or disable autocompilation here, if told to do so. 2010-03-29 Andy Wingo <wingo@pobox.com> fix bug in scm_must_free * libguile/gc-malloc.c: Update a comment. (scm_must_free): Must be able to free memory allocated with scm_must_malloc, and thus must be GC_FREE, not free. remove out-of-date comment in scm_gc_malloc * libguile/gc-malloc.c (scm_gc_malloc): Remove out-of-date comment. (texinfo reflection) parses out macro metadata * module/texinfo/reflection.scm (macro-arguments): (macro-additional-stexi, object-stexi-documentation): Parse out the metadata in macros, if it is available, so we can show defmacros' arguments, syntax-rules' patterns, etc. 2010-03-29 Andy Wingo <wingo@pobox.com> metadata for syntax-rules, identifier-syntax, and define-macro macros * module/ice-9/psyntax.scm (syntax-rules, identifier-syntax): * module/ice-9/boot-9.scm (define-macro): Embed metadata into the macro transformer for use by documentation tools and the like. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-03-28 Mark H Weaver <mhw@netris.org> Renumber IFLAGSs so the first 8 are reserved for lisp booleans. This enables more efficient implementations of several operations, e.g. scm_is_lisp_bool, canonicalize_boolean, fast_boolean_not, converting SCM booleans to C booleans, etc. * libguile/tags.h: Renumber IFLAGs. * libguile/print.c: Renumber iflagnames to match. * libguile/boolean.c: * libguile/boolean.h: SCM_XXX_ANOTHER_BOOLEAN_DONT_USE --> SCM_XXX_ANOTHER_BOOLEAN_DONT_USE_0 2010-03-28 Andy Wingo <wingo@pobox.com> Fix inlining of lambda-apply-lambda. * module/language/tree-il/inline.scm (inline!): Only inline (lambda args (apply (lambda ...) args)) if the outer lambda has rest args. Thanks to Mark Weaver for the note. 2010-03-26 Andy Wingo <wingo@pobox.com> remove spurious declarations in c-tokenize.lex * libguile/c-tokenize.lex: Remove spurious declarations of flex-internal functions, as their prototypes are changing in upstream flex. 2010-03-25 Andy Wingo <wingo@pobox.com> vectors of pairs in docstring position are metadata * module/ice-9/psyntax.scm (chi-lambda-case, lambda): If we find a vector of pairs in the docstring position, interpret those pairs as additional metadata. * module/ice-9/psytntax-pp.scm: Regenerated. 2010-03-25 Andy Wingo <wingo@pobox.com> psyntax supports multiple docstrings, merging lambda-case metadata * module/ice-9/psyntax.scm (build-simple-lambda, build-case-lambda): Don't take a docstring, take a metadata alist. Don't bother annotating interpreted expressions with docstrings. (chi-simple-lambda): Take already-parsed metadata. (lambda): Parse out multiple docstrings as separate "documentation" entries in the "meta". (chi-lambda-case): Merge multiple "meta" entries among the various cases. (lambda*, case-lambda, case-lambda*): Receive "meta" clauses, not docstrings. * module/ice-9/psyntax-pp.scm: Regenerated. 2010-03-23 Andy Wingo <wingo@pobox.com> make guile's welcome more gnu-conventional; also warranty and copying info * module/system/repl/command.scm: Add support for ,show with topics "warranty", "copying", and "version". (language): Don't re-print the welcome; print sometime more terse. * module/system/repl/common.scm (*version*, *warranty*, *copying*): New public globals. (repl-welcome): Display *version*. 2010-03-22 Andy Wingo <wingo@pobox.com> Update manual examples of how to link with Guile * doc/ref/intro.texi (Linking Guile into Programs): * doc/ref/libguile-linking.texi (A Sample Guile Main Program): Update examples of how to link with guile. 2010-03-20 Ludovic Courtès <ludo@gnu.org> Make `include' tail-recursive. * module/ice-9/psyntax.scm (include)[read-file]: Make tail-recursive. * module/ice-9/psyntax-pp.scm: Regenerate. 2010-03-20 Ludovic Courtès <ludo@gnu.org> Cosmetic changes in `foreign.c'. * libguile/foreign.c (unpack, pack): Add `const' qualifier for `type'. Comment. Indent. (scm_i_foreign_call): Add `const' qualifier for `argv'. Punctuate comments. Clarify argument unpacking loop. Fix argument passing to foreign functions. * libguile/foreign.c (scm_i_foreign_call): When allocating room for DATA, use the sum of all the argument sizes, not `cif->bytes'. 2010-03-19 Andy Wingo <wingo@pobox.com> fix srfi-31 check after macroexpand rename * test-suite/tests/srfi-31.test: ("rec special form"): Fix check. rename sc-expand to macroexpand * module/ice-9/boot-9.scm (macroexpand): Rename from sc-expand. (%pre-modules-transformer): Adapt to name change. * module/ice-9/compile-psyntax.scm: Adapt to name change. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Rename sc-expand to macroexpand. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Adapt to name change. finish macro docs * doc/ref/api-macros.texi: Finish macro docs. 2010-03-19 Andy Wingo <wingo@pobox.com> document syntax-case * doc/ref/api-macros.texi: Document syntax-case, and tweak defmacro docs. * doc/ref/api-debug.texi: Move cons-source here. 2010-03-19 Andy Wingo <wingo@pobox.com> add GUILE-VERSION to CONFIG_STATUS_DEPENDENCIES * Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add GUILE-VERSION, so that a change in GUILE-VERSION causes a reconfigure. 2010-03-18 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.9. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Update `NEWS'. 2010-03-18 Andy Wingo <wingo@pobox.com> A start at syntax-rules docs * doc/ref/api-macros.texi: New file, documenting macros. Removed some old cruft, and started documenting hygienic macros. * doc/ref/api-procedures.texi: Moved macro things out of here. * doc/ref/guile.texi: Separate macros from procedures. * doc/ref/api-data.texi: Update some xrefs. * doc/ref/Makefile.am: Add api-macros.texi. 2010-03-18 Ludovic Courtès <ludo@gnu.org> Improve encoding error reporting. * libguile/strings.c (scm_encoding_error): Change arguments to convey more information. Raise the error with `scm_throw ()', passing all the information to the handler. (scm_from_stringn, scm_to_stringn): Update accordingly. * test-suite/tests/ports.test ("string ports")["wrong encoding"]: Check the arguments passed to the `throw' handler. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with wrong-encoding string port"]: Likewise. 2010-03-18 Ludovic Courtès <ludo@gnu.org> Update Gnulib; use the `func' module. Update Gnulib to v0.0-3575-g128e4b8. * m4/gnulib-cache.m4: Add `func'. 2010-03-18 Ludovic Courtès <ludo@gnu.org> Add `%null-pointer' to `(system foreign)'. * libguile/foreign.c (sym_null, null_pointer): New variables. (scm_foreign_to_bytevector): Raise an error when PTR is NULL. (scm_init_foreign): Define SYM_NULL. * module/system/foreign.scm (%null-pointer): New exported binding. 2010-03-17 Ludovic Courtès <ludo@gnu.org> Remove obsolete test directory. * test-suite/tests/c-api: Remove. 2010-03-17 Ludovic Courtès <ludo@gnu.org> Change `dynamic-link' to return a global handle when the argument is omitted. * libguile/dynl.c (sysdep_dynl_link): Handle FNAME == NULL. (scm_dynamic_link): Make argument optional. Adjust body accordingly. * test-suite/standalone/test-ffi (global, strerror, strlen): New bindings. Add test for these bindings. * doc/ref/api-modules.texi (Low level dynamic linking): Update description of `dynamic-link'. 2010-03-17 Ludovic Courtès <ludo@gnu.org> Provide `int', `long', `size_t', etc. in `(system foreign)'. * libguile/foreign.c (sym_int, sym_long, sym_unsigned_int, sym_unsigned_long, sym_size_t): New variables. (scm_init_foreign): Define them at the Scheme level. * module/system/foreign.scm (int, unsigned-int, long, unsigned-long, size_t): New exported bindings. 2010-03-17 Ludovic Courtès <ludo@gnu.org> Fix doc string of `dynamic-pointer'. * libguile/dynl.c (scm_dynamic_pointer): Fix doc string. Reformat body. Use GC-managed pointerless memory in the FFI. * libguile/foreign.c (scm_make_foreign_function): Use `scm_gc_malloc_pointerless ()' when allocating memory for CIF. (pack): Likewise for the `FFI_TYPE_STRUCT' case. 2010-03-16 Andy Wingo <wingo@pobox.com> update NEWS for 1.9.9 * NEWS: Update. cull 1.9.8 NEWS items * NEWS: Remove 1.9.8 items; they have been folded in already. add a section to the manual on prompts * doc/ref/api-control.texi (Prompts): Add a section on prompts. 2010-03-16 Andy Wingo <wingo@pobox.com> parallel installability for libguile*.h * Makefile.am: * libguile/Makefile.am (modincludedir): Install into $pkgincludedir/$GUILE_EFFECTIVE_VERSION. This allows multiple Guile development packages to be installed at once. * guile-readline/Makefile.am (modincludedir): * srfi/Makefile.am (srfiincludedir): Likewise. * meta/guile-2.0.pc.in (Cflags): Add the appropriate -I line so that user code picks up the new location transparently. 2010-03-16 Andy Wingo <wingo@pobox.com> rename libguile to libguile-@EFFECTIVE_VERSION@, currently libguile-2.0 * libguile/Makefile.am (lib_LTLIBRARIES): Instead of just "libguile.la", make "libguile-@EFFECTIVE_VERSION@.la". This allows multiple versions of Guile to be installed at once. See http://www106.pair.com/rhp/parallel.html for a rationale. (libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS): (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD): (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS): Fixup automake vars to include the effective version. (guile_LDADD): Fix up the spelling of libguile. * libguile/bytevectors.c (scm_bootstrap_bytevectors): * libguile/foreign.c (scm_register_foreign): * libguile/i18n.c (scm_bootstrap_i18n): * libguile/instructions.c (scm_bootstrap_instructions): * libguile/objcodes.c (scm_bootstrap_objcodes): * libguile/programs.c (scm_bootstrap_programs): * libguile/vm.c (scm_bootstrap_vm): Register extensions using e.g. "libguile-2.0" as the libname -- i.e., including the effective version in the libname. * module/ice-9/i18n.scm: * module/rnrs/bytevector.scm: * module/rnrs/io/ports.scm: * module/system/foreign.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: When doing a load-extension for something in Guile, use the effective version also. * meta/guile-2.0-uninstalled.pc.in (Libs): * meta/guile-2.0.pc.in (Libs): Use -lguile-@EFFECTIVE_VERSION@. This change should mean that code built against Guile should not be affected by the libguile rename. * guile-readline/Makefile.am (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): * srfi/Makefile.am (libguile_srfi_srfi_1_v_@LIBGUILE_SRFI_SRFI_1_MAJOR@_la_LIBADD): (libguile_srfi_srfi_4_v_@LIBGUILE_SRFI_SRFI_4_MAJOR@_la_LIBADD): (libguile_srfi_srfi_13_14_v_@LIBGUILE_SRFI_SRFI_13_14_MAJOR@_la_LIBADD): (libguile_srfi_srfi_60_v_@LIBGUILE_SRFI_SRFI_60_MAJOR@_la_LIBADD): * test-suite/standalone/Makefile.am (test_num2integral_LDADD): (test_round_LDADD): (libtest_asmobs_la_LIBADD): (libtest_ffi_la_LIBADD): (test_list_LDADD): (test_unwind_LDADD): (test_conversion_LDADD): (test_loose_ends_LDADD): (test_scm_c_read_LDADD): (test_scm_take_locale_symbol_LDADD): (test_scm_take_u8vector_LDADD): (libtest_extensions_la_LIBADD): (test_with_guile_module_LDADD): (test_scm_with_guile_LDADD): Fix up the spelling of libguile.la. 2010-03-16 Andy Wingo <wingo@pobox.com> version.h has SCM_EFFECTIVE_VERSION; effective-version uses that * libguile/version.c (scm_effective_version): Use SCM_EFFECTIVE_VERSION. * libguile/version.h.in (SCM_EFFECTIVE_VERSION): Define from GUILE_EFFECTIVE_VERSION. * libguile/Makefile.am (version.h): Subst in GUILE_EFFECTIVE_VERSION. * test-suite/tests/version.test ("version reporting works"): The effective version is not necessarily MAJOR.MINOR. Remove check. 2010-03-16 Andy Wingo <wingo@pobox.com> Bump GUILE_EFFECTIVE_VERSION to 2.0 * GUILE-VERSION (GUILE_EFFECTIVE_VERSION): Bump to 2.0. decouple GUILE_VERSION from GUILE_EFFECTIVE_VERSION. * GUILE-VERSION (GUILE_VERSION): Decouple from GUILE_EFFECTIVE_VERSION. This allows us to bumpt the effective version to 2.0 before reaching 2.0. 2010-03-16 Andy Wingo <wingo@oblong.net> more vm gc fixen * libguile/vm-i-system.c (continuation_call): Sync before calling a continuation. Shouldn't much matter, but it seems like a good idea. (wind-fluids): More importantly, sync before allocating a with-fluids object. 2010-03-15 Ludovic Courtès <ludo@gnu.org> configure: Abort when GMP is not found. * configure.ac: Fix erroneous `AC_LIB_HAVE_LINKFLAGS' invocation. Above when $HAVE_LIBGMP is not "yes". 2010-03-15 Ludovic Courtès <ludo@gnu.org> Make sure the whole VM stack is always scanned by the GC. Thanks to Andy for noticing this. * libguile/vm-engine.h (SYNC_REGISTER, CACHE_REGISTER): Add comment. * libguile/vm-i-scheme.c (make_struct): Call `SYNC_REGISTER ()' in all cases since the GC is going to run. (struct_ref, struct_set): Call `SYNC_REGISTER ()' on the slow path. (BV_REF_WITH_ENDIANNESS, BV_FIXABLE_INT_REF, BV_INT_REF): Likewise. (BV_FLOAT_REF): Always `SYNC_REGISTER ()'. 2010-03-14 Ludovic Courtès <ludo@gnu.org> doc: Update "Multi-Threading" node. * doc/ref/libguile-concepts.texi (Multi-Threading): Remove bits about the requirement not to block in guile mode. 2010-03-14 Ludovic Courtès <ludo@gnu.org> doc: Remove obsolete reference to the lack of Unicode support. * doc/ref/api-data.texi (Bytevectors as Strings): Remove obsolete footnote on the lack of Unicode support. * test-suite/tests/bytevectors.test ("2.9 Operations on Strings")["string->utf8 [latin-1]", "utf8->string [latin-1]"]: Remove use of `with-latin1-locale'. ["string->utf32 [Greek]"]: New tests. 2010-03-14 Andy Wingo <wingo@pobox.com> small vm.texi updates * doc/ref/vm.texi (A Virtual Machine for Guile): (VM Concepts, Variables and the VM, Branch Instructions): Small updates. add some vm hook docs * doc/ref/api-evaluation.texi (VM Behaviour): Add docs for vm-trace-level and set-vm-trace-level!. 2010-03-14 Andy Wingo <wingo@pobox.com> (debug) at the repl invokes the vm debugger * module/ice-9/boot-9.scm (top-repl): Map (debug) at the repl to (system vm debug). * module/system/vm/debug.scm (run-debugger, debugger-repl): Don't take the index as an arg, for now anyway. (debug): New wrapper. 2010-03-14 Andy Wingo <wingo@pobox.com> Update api-debug.texi; there is a ways to go. * doc/ref/api-debug.texi: Update a bit. pmatch license clarification clarifications * module/system/base/pmatch.scm: Clarify the clarifications (somehow didn't make it into my last commit). clarify pmatch licensing * module/system/base/pmatch.scm: Clarify licensing. fix critical bug in history.texi * doc/ref/history.texi (A Timeline of Selected Guile Releases): Ahem :) 2010-03-14 Andy Wingo <wingo@pobox.com> update "data representation" part of guile internals doc * doc/ref/api-control.texi (Handling Errors): Move the "Signalling Type Errors" section here. * doc/ref/data-rep.texi (Data Representation): Refactor, lopping and cropping and stitching. * doc/ref/libguile-concepts.texi (Dynamic Types): * doc/ref/libguile-smobs.texi (Describing a New Type, Double Smobs): * doc/ref/guile.texi (Guile Implementation, Programming in C): Adapt to refactorings. * doc/ref/history.texi (A Scheme of Many Maintainers): (A Timeline of Selected Guile Releases, Status): Update. 2010-03-13 Andy Wingo <wingo@pobox.com> narrowing stacks to prompts; backtrace shows frames from start-stack * libguile/stacks.c (scm_sys_stacks): New global variable, moved here from boot-9.scm. (scm_init_stacks): Define scm_sys_stacks to %stacks. (stack_depth): Remove narrowing by frame pointer. (find_prompt): New helper. (narrow_stack): Clean up a bit, and allow narrowing by prompt tag. (scm_make_stack): Update docs, and use scm_stack_id to get the stack id. (scm_stack_id): The current stack id may be fetched as the cdar of %stacks. (stack_id_with_fp): Remove helper. * module/ice-9/boot-9.scm (%start-stack): Fix indentation. (%stacks): Remove definition, it's in stacks.c now. (default-pre-unwind-handler): Narrow by another frame. (save-stack): Remove special handling for certain stack ids, as it is often possible that the function isn't on the stack -- in the interpreter, or after a tail call. Better to narrow by prompt ids. * module/system/vm/debug.scm (print-frames): Change to operate on a vector of frames. (run-debugger): Change to receive a vector of frames. The debugger also has the full stack, so it can re-narrow (or widen) to get the whole stack, if the user wants. (stack->vector): New helper. (debug-pre-unwind-handler): Narrow by more frames, and to the most recent start-stack invocation. Adapt to run-debugger change. 2010-03-12 Andy Wingo <wingo@pobox.com> remove repl-vm; repl evaluation does not cause recursive vm invocation * module/system/repl/common.scm (<repl>): Remove "vm" field and repl-vm accessor. I think the correct model is to just use the-vm. This change was prompted by the need to have the REPL itself not cause a recursive VM invocation, so that captured prompts at the REPL are rewindable. (make-repl): Remove treatment of #:vm. (repl-eval): Load a compiled expression as a simple thunk, avoiding a recursive VM call. * module/system/repl/command.scm (profile, trace): Remove repl-vm treatment. (backtrace, debugger, step): Remove, as they were not implemented. 2010-03-12 Andy Wingo <wingo@pobox.com> prompt around REPL evaluations, and around `guile' program invocation * module/ice-9/control.scm (%): Add a single-argument case, which instates a default prompt with a default handler. * libguile/script.c (scm_compile_shell_switches): Wrap user programs in a default prompt. * module/system/repl/common.scm (repl-eval): REPL expressions are user programs too; wrap each one in a default prompt. 2010-03-11 Andy Wingo <wingo@pobox.com> add abort to unknown prompt test * libguile/control.c (scm_c_abort): Change error string if a prompt isn't found. * test-suite/tests/control.test ("abort to unknown prompt"): New test. 2010-03-11 Andy Wingo <wingo@pobox.com> remove internal treatment of default prompt tag, it seems there was no need * libguile/control.h (scm_sys_default_prompt_tag): * libguile/control.c (scm_init_control): Remove the logic that defined %default-prompt-tag. (scm_c_abort): Remove check for default prompt tag, it wasn't useful. * libguile/throw.c (sym_pre_init_catch_tag): Define as the pre-init prompt tag. (pre_init_catch, pre_init_throw): Use sym_pre_init_catch_tag. * module/ice-9/boot-9.scm (default-prompt-tag): Define as a simple value, not a fluid. Perhaps we can expose it as a fluid later. 2010-03-09 Andy Wingo <wingo@pobox.com> prompt, abort -> call-with-prompt, abort-to-prompt * module/ice-9/boot-9.scm (default-prompt-tag, make-prompt-tag): New functions. (call-with-prompt, abort-to-prompt): Rename from `prompt' and `abort', respectively. These names are more clear, and allow `prompt' and `abort' to have more convenient, less general bindings. (default-throw-handler, custom-throw-handler, catch, %start-stack): Adapt callers. * module/ice-9/control.scm: Adapt re-export list. (control): Remove binding, until we're sure that it is Sitaram's control. (abort): New binding, aborts to the nearest prompt with the default tag. (%): Use call-with-prompt. * module/language/tree-il/primitives.scm (*primitive-expand-table*): (*interesting-primitive-names*): Adapt for prompt/abort changes. * test-suite/tests/control.test: Take advantage of the defaults for % and abort. 2010-03-09 Andy Wingo <wingo@pobox.com> %start-stack in Scheme, in terms of prompts * libguile/debug.h: * libguile/debug.c (scm_sys_start_stack): Removed, we implement this in Scheme now. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): Likewise removed. * module/ice-9/boot-9.scm (%start-stack): Implement in terms of prompts. (%stacks): New fluid, for tracking active stacks. (start-stack): Implement using syntax-rules. 2010-03-09 Andy Wingo <wingo@pobox.com> fix continuation printing bug * libguile/programs.c (scm_i_program_print): Fix bug printing continuations. 2010-03-07 Ludovic Courtès <ludo@gnu.org> Don't export `write-bytecode' from `(language assembly compile-bytecode)'. * module/language/assembly/compile-bytecode.scm: Don't export `write-bytecode'. * test-suite/tests/asm-to-bytecode.test (write-bytecode): New global variable. 2010-03-07 Ludovic Courtès <ludo@gnu.org> Add wide-string compilation test. * test-suite/tests/asm-to-bytecode.test ("compiler")[load-wide-string "λ"]: New test. 2010-03-07 Ludovic Courtès <ludo@gnu.org> Fix miscompilation of non-ASCII Latin-1 strings. The bug was introduced dad6817f ("Use the R6RS I/O API in `write-bytecode'."). * module/language/assembly/compile-bytecode.scm (write-bytecode)[write-string]: Rename to... [write-latin1-string]: ... this. Add the `write-loader-len' call. Write each character individually instead of using `string->utf8'. [write-loader]: Remove. * test-suite/tests/asm-to-bytecode.test ("compiler")[load-string "æ"]: New test. 2010-03-05 Ludovic Courtès <ludo@gnu.org> Recycle fluid numbers. * libguile/fluids.c: Remove outdated comment on the complexity of fluid GC. (FLUID_GROW): Increase to 128. (allocated_fluids): Change to `void **'. (allocated_fluids_num): Remove. (grow_dynamic_state): Remove race-condition checker. Grow to ALLOCATED_FLUIDS_LEN. (next_fluid_num): Rename to... (new_fluid): ... this. Return a fluid instead of a fluid number. Assume ALLOCATED_FLUIDS is sparse and search for a free number in it. Make ALLOCATED_FLUIDS point to pointerless memory and initialize individual elements with a pointer to the new fluid. Register a disappearing link from there to the fluid. (scm_make_fluid): Use `new_fluid ()'. (scm_fluid_ref, scm_fluid_set_x, scm_i_swap_with_fluids): Remove assertion that wasn't checked in a thread-safe way. Add new fluid tests. * test-suite/tests/fluids.test ("initial fluid values")["initial value is inherited from parent thread"]: New test. ("fluid values are thread-local"): New test. Don't gratuitously over-engineer things... * libguile/eval.c (eval)[SCM_M_CALL]: Always use `alloca' for ARGV. 2010-03-05 Ludovic Courtès <ludo@gnu.org> Slightly optimize the memoizer, bootstrap evaluator, and `(ice-9 eval)'. * libguile/eval.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR): Use the macro variants, not the functions. (eval)[SCM_M_CALL]: When invoking a VM program, accumulate its arguments on the stack rather than on the heap. * libguile/memoize.c (CAR, CDR, CAAR, CADR, CDAR, CDDR, CADDR, CDDDR, CADDR): Use the macro variants, not the functions. (scm_memoized_expression_typecode): Use `SCM_I_MAKINUM' instead of `scm_from_uint16'. 2010-03-05 Ludovic Courtès <ludo@gnu.org> Remove obsolete compile-time option for freelist debugging. * configure.ac: Remove `--enable-debug-freelist' option and `SCM_I_GSC_GUILE_DEBUG_FREELIST' substitution variable. * libguile/gen-scmconfig.c (main): Remove references to `SCM_I_GSC_GUILE_DEBUG_FREELIST' and `GUILE_DEBUG_FREELIST'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_GUILE_DEBUG_FREELIST): Remove. 2010-03-04 Andy Wingo <wingo@pobox.com> some with-fluid* -> with-fluids * module/ice-9/boot-9.scm (false-if-exception, load) (try-module-autoload): * module/language/tree-il/compile-glil.scm (compile-glil): Turn some with-fluid* invocations into with-fluids. partial continuations print as #<partial-continuation ...> * libguile/control.c (reify_partial_continuation): * libguile/programs.c (scm_i_program_print): * libguile/programs.h (SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION) (SCM_PROGRAM_IS_PARTIAL_CONTINUATION): Distinguish partial continuations from full continuations. tighten up scm_i_dowinds, fixing invalid SCM_CAR (prompt) * libguile/dynwind.c: Update comment regarding what can be on the wind stack. (scm_i_dowinds): Clean up to remove @bind and catch/throw-handler cases, to add a case for prompts, and to be more strict in general regarding the set of things that can be on the wind stack. Fixes a bug whereby prompts were accessed via SCM_CAR; thanks to Ken Raeburn for the report. add printers for prompts and with-fluids objects * libguile/control.c: * libguile/control.h (scm_i_prompt_print): * libguile/fluids.c: * libguile/fluids.h (scm_i_with_fluids_print): * libguile/print.c (iprin1): Add printers for prompts and with-fluids objects. 2010-03-04 Ludovic Courtès <ludo@gnu.org> Try to avoid `guile-test' failures when it can't display the name of a test. This can happen, e.g., when printing "UNRESOLVED: regexp.test: TEST-NAME", where TEST-NAME contains characters that cannot be converted to the encoding of the current output or error port. * test-suite/guile-test (main): Set the conversion strategy for the output and error ports to `escape'. * test-suite/tests/regexp.test (current-output-port): Likewise. 2010-03-04 Ken Raeburn <raeburn@raeburn.org> The load-module routine tries to interpret relative paths relative to the module currently being loaded (i.e., make-texinfo.scm itself), resulting in confusing behavior for offset builds. So, don't use them. * doc/ref/Makefile.am ($(snarf_doc).texi): Use an absolute path for the input file. 2010-03-04 Ludovic Courtès <ludo@gnu.org> Write the test suite log file in UTF-8. * test-suite/guile-test (main): Set LOG-PORT's encoding to UTF-8. 2010-03-04 Ludovic Courtès <ludo@gnu.org> Use `with-latin1-locale' in `regexp.test'. As a side effect, it fixes tests on platforms with no 8-bit locale and where executing regexps on characters >= 128 can lead to errors such as `cannot convert to output locale "US-ASCII": ""\x80""'. This commit partially reverts 7583976b ("More setlocale robustness in regexp tests"). * test-suite/tests/regexp.test (mysetlocale, set-latin-1): Remove. ("regexp-quote"): Use `with-latin1-locale' instead of the above procedures. 2010-03-04 Ludovic Courtès <ludo@gnu.org> Move Latin-1 locale fiddling to `(test-suite lib)'. * test-suite/lib.scm (with-latin1-locale*): New procedure. (with-latin1-locale): New macro. * test-suite/tests/bytevectors.test (with-locale, with-latin1-locale): Remove. Adjust users. 2010-03-03 Ludovic Courtès <ludo@gnu.org> Fix `with-locale*' in `(test-suite lib)'. * test-suite/lib.scm (with-locale*): Set LOC to the previous locale name, not to the new locale name. Only restore LOC when it's not #f. (with-locale): Use `syntax-rules'. 2010-03-03 Andy Wingo <wingo@pobox.com> psyntax expander tracks changes to current module in top-level begin * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm (chi-top-sequence): Track changes to the current module. Allows e.g. top-level `define-module' within a begin to work. * test-suite/tests/syncase.test ("changes to expansion environment"): Enable test. 2010-03-03 Andy Wingo <wingo@pobox.com> use anonymous mv-bind in compile-glil.scm; fix abort compilation bug * module/language/tree-il/compile-glil.scm (flatten): Change to use the anonymous <glil-mv-bind> form when truncating to 0 or 1 values. In those cases, remove the <glil-unbind> statements. As a side effect, fixes compilation of abort in a "values" context. Thanks to Tristan Colgate for the bug report. * test-suite/tests/tree-il.test: Update to expect anonymous mv-bind. 2010-03-03 Andy Wingo <wingo@pobox.com> <glil-mv-bind> can truncate values anonymously * module/language/glil/compile-assembly.scm (glil->assembly): Allow an integer for `vars', which means simply to truncate the values, and not pass binding metadata to the compiler. add more tests to control.test * test-suite/tests/control.test ("restarting partial continuations"): Add more tests, for `abort' in different positions. All succeed in the evaluator but fail with the compiler. 2010-03-03 Ludovic Courtès <ludo@gnu.org> Fix off-by-one error in the off-by-one fix of `make-srfi-4-vector'. This is a followup to d900a8557db21641413db8995a7cdc1453adbe1f ("Fix off-by-one error when initializing vectors in `make-srfi-4-vector'."). * libguile/srfi-4.c (scm_make_srfi_4_vector): Don't initialize RET when LEN is zero. 2010-03-03 Ludovic Courtès <ludo@gnu.org> Add test checking whether fluids are GC'd. * test-suite/tests/fluids.test ("fluids are GC'd"): New test. 2010-03-02 Ludovic Courtès <ludo@gnu.org> Fix "coding:" cookies in the test suite. * test-suite/tests/bytevectors.test, test-suite/tests/keywords.test, test-suite/tests/procprop.test, test-suite/tests/srfi-35.test, test-suite/tests/srfi-88.test: Add "coding:" cookie on the first line. 2010-03-02 Ludovic Courtès <ludo@gnu.org> Fix off-by-one error when initializing vectors in `make-srfi-4-vector'. * libguile/srfi-4.c (scm_make_srfi_4_vector): When FILL is bound and non-zero, initialize the last element. * test-suite/tests/srfi-4.test ("TAG vectors")["make-TAGvector"]: New tests. 2010-03-02 Ken Raeburn <raeburn@raeburn.org> Use libguile/control.x explicitly. 2010-03-02 Julian Graham <julian.graham@aya.yale.edu> Change failing syncase test case to UNRESOLVED. * test-suite/tests/syncase.test: ("expander detects changes to current-module"): Throw 'unresolved instead of returning #f. 2010-02-27 Julian Graham <julian.graham@aya.yale.edu> add (currently failing) test case for changing the current module inside `begin' form * test-suite/tests/syncase.scm: ("expander detects changes to current-module"): New test case. 2010-02-26 Andy Wingo <wingo@pobox.com> rewinding prompts works * libguile/control.h (SCM_PROMPT_HANDLER): Remove, it was unused. (SCM_PROMPT_DYNWINDS): Rename from SCM_PROMPT_DYNENV. * libguile/control.c: (scm_c_make_prompt): Take another arg, the winds that are to be in place for the prompt. Fix allocation to be 4 words instead of 5 (the handler was never used). * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Adapt to scm_c_make_prompt change. * libguile/vm-i-system.c (partial-cont-call): Grovel the new elements of the wind list in order to call setjmp() on the new prompts. Pass cookie to vm_reinstate_partial_continuation. (prompt): Adapt to scm_c_make_prompt change. * libguile/vm.c (vm_reinstate_partial_continuation): Take a cookie arg, used when winding captured prompts onto the stack. Winding a prompt implies making a new prompt, actually -- with new registers, a new jump buffer, new winds, etc. * test-suite/tests/control.test ("rewinding prompts"): Add a test for rewinding prompts. 2010-02-26 Andy Wingo <wingo@pobox.com> catch, throw, with-throw-handler implemented in Scheme * libguile/throw.c (tc16_jmpbuffer, tc16_pre_unwind_data): Remove these smob types, and associated constructors and accessors (all internal). (scm_catch, scm_catch_with_pre_unwind_handler): (scm_with_throw_handler, scm_throw): Simply dispatch to scheme. Lovely. (tc16_catch_closure): Introduce a new applicable smob type, for use by the C catch interface. All constructors and accessors are internal. (scm_c_catch, scm_internal_catch, scm_c_with_throw_handler): Build applicable smobs out of the C procedure arguments, so we can then dispatch through scm_catch et al. (scm_ithrow): Dispatch to scm_throw. (pre_init_catch, pre_init_throw): Restricted catch/throw implementation for use before boot-9 runs. (scm_init_throw): Bind the pre-init catch and throw definitions. * module/ice-9/boot-9.scm (prompt, abort): Move these definitions up in the file. (catch, throw, with-throw-handler): Implement in Scheme. Whee! 2010-02-26 Andy Wingo <wingo@pobox.com> deprecate lazy-catch * libguile/deprecated.h: * libguile/deprecated.c (scm_internal_lazy_catch, scm_lazy_catch): Deprecate, and print out a nasty warning that people should change to with-throw-handler. * libguile/throw.h: * libguile/throw.c (scm_c_with_throw_handler): Deprecate the use of the lazy_catch_p argument, printing out a nasty warning if someone actually passes 1 as that argument. The combination of the pre-unwind and post-unwind handlers should be sufficient. * test-suite/tests/exceptions.test: Remove lazy-catch tests, as they are deprecated. Two of them fail: * throw/catch: effect of lazy-catch unwinding on throw to another key * throw/catch: repeat of previous test but with lazy-catch Hopefully people are not depending on this behavior, and the warning is sufficiently nasty for people to switch. We will see. * test-suite/tests/eval.test ("promises"): Use with-throw-handler instead of lazy-catch. * doc/ref/api-debug.texi: * doc/ref/api-control.texi: Update to remove references to lazy-catch, folding in the useful bits to with-throw-handler. 2010-02-26 Andy Wingo <wingo@pobox.com> fix a prompt bug * libguile/control.h: * libguile/control.c (scm_c_make_prompt): Instead of taking a VM arg, take the registers directly. (scm_c_abort): Declare as returning void. In fact it will never return. * libguile/eval.c (eval): * libguile/throw.c (pre_init_catch): Adapt to prompt API change. * libguile/vm-i-system.c (prompt): Pass the abort ip as the ip to scm_c_make_prompt. This fixes a bug in which we used the "offset" local var, but it wasn't guaranteed to be around after a longjmp. 2010-02-25 Andy Wingo <wingo@pobox.com> simplify handling of nonlocal prompt returns from c * libguile/control.h: * libguile/control.c (scm_i_prompt_pop_abort_args_x): New helper. * libguile/eval.c (eval): Use the new helper. 2010-02-25 Andy Wingo <wingo@pobox.com> more substance to control.test * test-suite/tests/control.test ("suspend/resume with fluids"): ("restarting partial continuations"): ("reified continuations", "escape-only continuations"): More tests. eval.scm's handling of with-fluids doesn't leave the VM * module/ice-9/eval.scm (primitive-eval): Implement with-fluids in terms of with-fluids, to avoid recursively calling the VM via with-fluids*. 2010-02-25 Andy Wingo <wingo@pobox.com> eval.scm's handling of with-fluids doesn't leave the VM * module/ice-9/eval.scm (primitive-eval): Implement with-fluids in terms of with-fluids, to avoid recursively calling the VM via with-fluids*. error if given an unrewindable partial continuation * libguile/vm-engine.c (vm_error_continuation_not_rewindable): * libguile/vm-i-system.c (partial-cont-call): * libguile/vm.h (SCM_VM_CONT_PARTIAL_P): (SCM_VM_CONT_REWINDABLE_P): Fix a bug in which we weren't checking if a partial continuation was actually rewindable. fix embarrassing bug * libguile/vm.c: Fix embarrassing error regarding the symbolitude of vm-error and friends. 2010-02-24 Andy Wingo <wingo@pobox.com> start of tests for (ice-9 control) * test-suite/Makefile.am: * test-suite/tests/control.test: Add the beginnings of a delimited continuations test suite. fix symbol initialization in vm.c * libguile/vm.c (scm_bootstrap_vm): Fix case in which some symbols wouldn't be initialized by the time they were needed. (ice-9 control) fixes * module/ice-9/control.scm (%): Fix to allow tagged and default-tagged prompts. (abort): Re-export. fix escape-only prompts * libguile/control.c (scm_c_make_prompt): Whoops, set the escape-only flag properly here. add %default-prompt-tag, and error (not abort()) on an abort to bad tag * libguile/init.c (scm_i_init_guile): Call scm_init_control after initing fluids. * libguile/control.h (scm_sys_default_prompt_tag): New internal var. * libguile/control.c (scm_c_abort): If abort is called for an unknown tag, raise an exception, except if the tag was the default prompt tag, in which case really abort -- to prevent recursion when some other patches land. (scm_init_control): Define %default-prompt-tag in the default environment. turn abort() calls in vm.c into exceptions * libguile/vm.c (vm_return_to_continuation, vm_abort): (vm_reinstate_partial_continuation, really_make_boot_program): Turn some abort()s into scm_misc_errors. rewind the dynamic state when entering a partial continuation * libguile/control.c (cont_objcode): * libguile/vm-i-system.c (partial-cont-call): * libguile/vm.c (vm_reinstate_partial_continuation): Don't keep the "external winds" in a partial continuation, as they aren't logically part of the continuation. Reinstate the "internal winds" when entering a partial continuation. Things seem to work! 2010-02-24 Andy Wingo <wingo@pobox.com> partial-cont-call works * libguile/vm-i-system.c (partial-cont-call): Sync registers before splatting a partial continuation, and cache them back afterwards. * libguile/vm.c (vm_reinstate_partial_continuation): Actually implement, except dynamic-wind. 2010-02-24 Andy Wingo <wingo@pobox.com> record IP in partial continuations * libguile/control.c (reify_partial_continuation): Assert some invariants, and record the IP as the MVRA of the continuation. ensure non-escape-only prompts have a thunk application as their body * module/language/tree-il/inline.scm (inline!): Fix indenting for lambda-case. In an amusing turn of events, use the inliner to de-inline prompt bodies, if the prompt is not escape-only. 2010-02-22 Andy Wingo <wingo@pobox.com> actually capture partial continuations * libguile/control.c (cont_objcode): Along with a bunch of boilerplate that certainly needs to go in some central place, define this continuation-calling trampoline. (reify_partial_continuation): New function, returns a procedure that when called will reinstate a partial continuation. (scm_c_abort): Take an extra arg, the cookie. Actually reify a continuation. (scm_at_abort): Adapt to scm_c_abort change. * libguile/control.h: Declare scm_c_abort change. * libguile/vm-i-system.c (partial_cont_call): New instruction. (call/cc, tail-call/cc): Adapt to scm_i_vm_capture_stack change. (abort): Pass vm_cookie to abort. * libguile/vm.h (SCM_F_VM_CONT_PARTIAL, SCM_F_VM_CONT_REWINDABLE): New flags. (struct scm_vm_cont): Add flags field. (SCM_VM_CONT_PARTIAL_P, SCM_VM_CONT_REWINDABLE_P): New predicates. * libguile/vm.c (scm_i_vm_capture_stack): Rename from vm_capture_continuation, and make internal instead of static. Take a flags argument. (scm_i_vm_capture_continuation): Adapt to scm_i_vm_capture_stack change. (vm_abort): Plumb cookie to scm_c_abort. (vm_reinstate_partial_continuation): New stub. 2010-02-22 Andy Wingo <wingo@pobox.com> tweaks to default program printer * libguile/programs.c (scm_i_program_print): Instead of printing the address of the objcode, print the address of the program itself. Also for continuations. 2010-02-22 Andy Wingo <wingo@pobox.com> abort always dispatches to VM bytecode, to detect same-invocation aborts * libguile/control.h: * libguile/control.c (scm_c_make_prompt): Take an extra arg, a cookie. Continuations will be rewindable only if the abort has the same cookie as the prompt. (scm_at_abort): Redefine from scm_abort, and instead of taking rest args, take the abort values as a list directly. Also, don't allow rewinding, because we won't support rewinding the C stack with delimited continuations. * libguile/eval.c (eval): Adapt to scm_c_make_prompt change. * libguile/vm-engine.c (vm_engine): Use vp->cookie to get a unique value corresponding to this VM invocation. * libguile/vm-i-system.c (prompt): Pass the cookie to scm_c_make_prompt. (abort): Take an additional tail arg. * libguile/vm.c (vm_abort): Parse out the abort tail arg. This is for the @abort case, or the (apply abort ...) case. (make_vm): Initialize the cookie to 0. * libguile/vm.h (struct scm_vm): Add cookie. * module/ice-9/boot-9.scm (abort): Define here as a trampoline to @abort. Needed to make sure that a call to abort dispatches to a VM opcode, so the cookie will be the same. * module/language/tree-il.scm (<tree-il>): Add a "tail" field to <abort>, for the (apply abort ...) case, or (@abort tag args). Should be #<const ()> in the normal case. Add support throughout. * module/language/tree-il/analyze.scm (analyze-lexicals): Add abort-tail support here too. * module/language/tree-il/compile-glil.scm (flatten): Compile the tail argument appropriately. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Fix @abort and abort cases to pass the tail arg to make-abort. 2010-02-22 Andy Wingo <wingo@pobox.com> prompt and abort inlining * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add abort. (*primitive-expand-table*): Fix so that we inline `prompt' and `abort', and remove obsolete code dealing in `control'. fix <prompt> compilation bug * module/language/tree-il/analyze.scm (analyze-lexicals): Fix bug analysing <prompt> expressions. 2010-02-19 Andy Wingo <wingo@pobox.com> prompt as part of guile's primitive language * libguile/control.h: * libguile/control.c: Remove scm_atcontrol and scm_atprompt. (scm_c_make_prompt): Remove handler arg, as the handler is inline. (scm_abort): New primitive, exported to Scheme as `abort'. The compiler will also recognize calls to `abort', but this is the base case. (scm_init_control): Remove scm_register_control, just have this function, which adds `abort' to the `(guile)' module. * libguile/eval.c (eval): Add SCM_M_PROMPT case. * libguile/init.c (scm_i_init_guile): Change scm_register_control call into a nice orderly scm_init_control call. * libguile/memoize.h: (scm_sym_at_prompt, SCM_M_PROMPT): * libguile/memoize.c (MAKMEMO_PROMPT, scm_m_at_prompt, unmemoize): Add prompt support to the memoizer. * libguile/vm-i-system.c (prompt): Fix to not expect a handler on the stack. * module/ice-9/boot-9.scm (prompt): Add definition in terms of @prompt. * module/ice-9/control.scm: Simplify, and don't play with the compiler here, now that prompt and abort are primitive. * module/ice-9/eval.scm (primitive-eval): Add a prompt case. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add @prompt and prompt. 2010-02-19 Andy Wingo <wingo@pobox.com> fix prompt disassembly bug * module/language/assembly/disassemble.scm (code-annotation): Fix a bug disassembling `prompt'. 2010-02-19 Andy Wingo <wingo@pobox.com> add scm_c_abort, wire it up to the abort opcode * libguile/control.h: * libguile/control.c (scm_c_abort): Add an implementation of `abort', but it doesn't reify the continuation yet. * libguile/vm-i-system.c (abort): * libguile/vm.c (vm_abort): Wire up the call to `abort', avoiding consing the args into a list. * module/language/tree-il/compile-glil.scm (flatten): Add some compily bits that can allow the abort to be resumed. 2010-02-19 Andy Wingo <wingo@pobox.com> prompt handlers are always inline * libguile/control.h (SCM_F_PROMPT_INLINE, SCM_PROMPT_INLINE_P): Remove; prompts always have "inline" handlers now. * libguile/control.c (scm_c_make_prompt): Remove inline_handler_p arg. * libguile/vm-i-system.c (prompt): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt to prompt changes. * module/language/glil.scm (make-glil-prompt, glil-prompt-inline?): Remove inline? flag. (parse-glil, unparse-glil): * module/language/glil/compile-assembly.scm (glil->assembly): Adapt to <glil-prompt> change. * module/language/tree-il/compile-glil.scm (flatten): Require the handler of a <prompt> to be a lambda-case. * module/language/tree-il/primitives.scm (*primitive-expand-table*): Ensure that the handler of a <prompt> is a lambda-case. * module/language/tree-il/inline.scm (inline!): Simplify a degenerate case: (lambda args (apply (lambda ...) args)) => (lambda ...). 2010-02-19 Andy Wingo <wingo@pobox.com> fluid-ref / fluid-set! compile to dynref/dynset * module/language/tree-il/primitives.scm: Resolve fluid-ref and fluid-set! as primitives, and thence to dynref/dynset. add <dynref> and <dynset> to tree-il * module/language/tree-il.scm (<dynref>, <dynset>): New tree-il language elements, corresponding to fluid-ref and fluid-set. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: Wire them up in the usual manner. new VM operations: fluid-ref, fluid-set * libguile/vm-i-system.c (fluid-ref, fluid-set): New VM ops. fluids.h exposes more of its interface, internally at least * libguile/fluids.h (SCM_I_FLUID_P, SCM_I_FLUID_NUM) (SCM_I_DYNAMIC_STATE_P, SCM_I_DYNAMIC_STATE_FLUIDS): Expose these predicates and accessors, internally at least. * libguile/fluids.c (IS_FLUID, FLUID_NUM, IS_DYNAMIC_STATE) (DYNAMIC_STATE_FLUIDS): Implement in terms of the exposed macros. vm caches the dynamic state in a local var * libguile/vm-engine.c (vm_engine): Cache the dynamic state in a local var when we enter the VM. * libguile/vm-i-system.c (wind-fluids, unwind-fluids): Use the cached dynamic state instead of going through SCM_I_CURRENT_THREAD. 2010-02-19 Andy Wingo <wingo@pobox.com> rename <control> to <abort> * libguile/vm-i-system.c (abort): Rename instruction from `throw'. * libguile/vm.c (vm_abort): Rename from vm_throw. * module/language/tree-il.scm (<abort>, make-abort, abort-src, abort-tag, abort-args: Rename from <control> & company. * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/primitives.scm: Fix all callers. 2010-02-19 Andy Wingo <wingo@pobox.com> <prompt> has no pre-unwind-handler, it's unnecessary * libguile/control.h: * libguile/control.c (scm_c_make_prompt, SCM_PROMPT_PRE_UNWIND_HANDLER): * libguile/vm-i-system.c (prompt) * module/language/tree-il.scm (<prompt> prompt-pre-unwind-handler): * module/language/tree-il/analyze.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/inline.scm: * module/language/tree-il/primitives.scm: Remove the "pre-unwind" handler from prompt; it turns out not to be necessary. Adapt all references. re-expand psyntax-pp * module/ice-9/psyntax-pp.scm: Expand again so we actually use with-fluids. fix tree-il->scheme bug for <dynlet> * module/language/tree-il.scm (tree-il->scheme): Bugfix for dynlet. 2010-02-18 Andy Wingo <wingo@pobox.com> psyntax support for with-fluids * module/ice-9/psyntax.scm (build-dynlet, with-fluids): Use psyntax to recognize `with-fluids' as a core form, producing <dynlet> if we are compiling. (sc-expand): To spice up the mix, use with-fluids here in the implementation. * module/ice-9/psyntax-pp.scm: Bootstrapped twice (!). * module/ice-9/boot-9.scm: Remove with-fluids definition, it's in the core now. 2010-02-18 Andy Wingo <wingo@pobox.com> add tree-il->glil compilation for dynlet * module/language/tree-il/compile-glil.scm (flatten): Compile <dynlet>. add wind-fluids, unwind-fluids VM ops * libguile/vm-i-system.c (wind-fluids, unwind-fluids): New instructions, for dynamic binding. add dynlet to tree-il * module/language/tree-il.scm (<dynlet>, dynlet?, make-dynlet) (dynlet-src, dynlet-fluids, dynlet-vals, dynlet-body): New tree-il construct, mapping to `with-fluids'. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold): (make-tree-il-folder, post-order!, pre-order!): Wire it up. * module/language/tree-il/analyze.scm (analyze-lexicals): Add dynlet support. 2010-02-18 Andy Wingo <wingo@pobox.com> 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. 2010-02-18 Andy Wingo <wingo@pobox.com> add fluid tests * test-suite/Makefile.am: * test-suite/tests/fluids.test: Add some fluid tests. One is an XFAIL right now. 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. fix unmemoization bug * libguile/memoize.c (unmemoize): Fix unmemoization of memoized toplevel-ref and module-ref forms. eval.c tweaks * libguile/eval.c (eval): Fix a couple of uses of scm_cdr that should use CDR. fix comment in continuations.c * libguile/continuations.c: Fix a comment. memoize (begin foo) to foo * libguile/memoize.c (memoize_sequence): Don't make a `begin' if there's only one form. 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. 2010-02-18 Andy Wingo <wingo@pobox.com> 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. 2010-02-17 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.8. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2010-02-17 Ludovic Courtès <ludo@gnu.org> 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>. 2010-02-17 Andy Wingo <wingo@oblong.net> slight NEWS tweaks * NEWS: Slight tweaks. 2010-02-17 Ludovic Courtès <ludo@gnu.org> getaddrinfo: Define macros lacking in NetBSD 5.0. * libguile/net_db.c (AI_ALL, AI_V4MAPPED, AI_ADDRCONFIG): New macros, when not already defined. Update `NEWS'. Mention libffi dependency in `README'. Include <libguile/__scm.h> in "foreign.h". * libguile/foreign.h: Include <libguile/__scm.h>. 2010-02-17 Ludovic Courtès <ludo@gnu.org> 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'. 2010-02-16 Andy Wingo <wingo@pobox.com> a start at NEWS * NEWS: A start at NEWS; now to sleep. 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! 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... 2010-02-16 Andy Wingo <wingo@pobox.com> `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. 2010-02-16 Ludovic Courtès <ludo@gnu.org> Add missing $(LTLIBINTL), suggested by Gnulib. * libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBINTL). 2010-02-16 Ludovic Courtès <ludo@gnu.org> 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'. 2010-02-16 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-16 Michael Gran <spk121@yahoo.com> 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 2010-02-15 Ludovic Courtès <ludo@gnu.org> 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. Add `getaddrinfo' test. * test-suite/tests/net-db.test ("getaddrinfo")["port 80 with family and socket type"]: New test. 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. 2010-02-15 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-15 Ludovic Courtès <ludo@gnu.org> Make the `getaddrinfo' "no name" test more robust. * test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Check for `EAI_EAGAIN' too. 2010-02-14 Ludovic Courtès <ludo@gnu.org> Add missing Gnulib files; update `.gitignore'. This files were missing from commit 61cd9dc907b8a09990b14e9aeac7e20fe77cecc6 ("Use Gnulib's `getaddrinfo' module."). 2010-02-14 Ludovic Courtès <ludo@gnu.org> 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'. 2010-02-14 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `getaddrinfo' module. * m4/gnulib-cache.m4: Add `getaddrinfo'. * libguile/Makefile.am (libguile_la_LDFLAGS): Add `$(GETADDRINFO_LIB) $(HOSTENT_LIB) $(SERVENT_LIB)'. 2010-02-13 Thien-Thi Nguyen <ttn@gnuvola.org> Document trailing whitespace policy. * HACKING (Coding standards): Delete trailing whitespace. Add blurb documenting trailing whitespace policy. 2010-02-13 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-13 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-10 Ludovic Courtès <ludo@gnu.org> 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'. 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. 2010-02-10 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-10 Ludovic Courtès <ludo@gnu.org> 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'. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-08 Andy Wingo <wingo@pobox.com> 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. 2010-02-03 Michael Gran <spk121@yahoo.com> 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. 2010-02-03 Ludovic Courtès <ludo@gnu.org> Use vhashes in `unused-variable-analysis'. * module/language/tree-il/analyze.scm (unused-variable-analysis): Use vhashes instead of alists/lists. Use vhashes in `arity-analysis'. * module/language/tree-il/analyze.scm (arity-analysis): Use vhashes instead of alists. Use vhashes in `unbound-variable-analysis'. * module/language/tree-il/analyze.scm (unbound-variable-analysis): Use vhashes instead of alists/lists. 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. 2010-02-03 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-01 Ludovic Courtès <ludo@gnu.org> 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. 2010-02-01 Ludovic Courtès <ludo@gnu.org> SRFI-9: Fix `define-inlinable'. * module/srfi/srfi-9.scm (define-inlinable): Fix the catch-all case of the generated macro. 2010-01-31 Andy Wingo <wingo@pobox.com> 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. 2010-01-31 Andy Wingo <wingo@pobox.com> 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). 2010-01-31 Andy Wingo <wingo@pobox.com> 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. 2010-01-31 Andy Wingo <wingo@pobox.com> tree-il -> glil compilation of prompt, dynamic-wind, control * module/language/tree-il/compile-glil.scm (flatten): Compile <prompt>, <dynamic-wind>, and <control>. add return/nvalues * libguile/vm-i-system.c (return/nvalues): New instruction, like call/nargs. GLIL support for <prompt> * module/language/glil.scm (<glil>): Add <glil-prompt>, with handler-label and escape-only? fields. 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. 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. new tree-il for prompt, control, and dynamic-wind * module/language/tree-il.scm: Initial tree-il support for <prompt>, <control>, and <dynamic-wind>. 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. 2010-01-27 Andy Wingo <wingo@pobox.com> add a test for ffi and pointers * test-suite/standalone/test-ffi: * test-suite/standalone/test-ffi-lib.c: Add a pointer test. 2010-01-27 Andy Wingo <wingo@pobox.com> 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!. 2010-01-27 Andy Wingo <wingo@pobox.com> 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. 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. fix to variable-bound? instruction prototype * libguile/vm-i-system.c (variable-bound?): Correctly declare as popping one item. remove incremental NEWS entries in preparation for 1.9.8 * NEWS 2010-01-26 Andy Wingo <wingo@pobox.com> 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.... 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. add make-c-struct, parse-c-struct * module/system/foreign.scm: Export alignof and sizeof. (make-c-struct, parse-c-struct): New public functions. add `alignof' and `sizeof' Scheme functions * libguile/foreign.h: * libguile/foreign.c (scm_alignof, scm_sizeof): New functions. 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. 2010-01-26 Andy Wingo <wingo@pobox.com> 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. 2010-01-26 Andy Wingo <wingo@pobox.com> 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'. 2010-01-26 Andy Wingo <wingo@pobox.com> 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 2010-01-26 Andy Wingo <wingo@pobox.com> 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. 2010-01-26 Andy Wingo <wingo@pobox.com> 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. 2010-01-26 Andy Wingo <wingo@pobox.com> 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. 2010-01-26 Andy Wingo <wingo@pobox.com> add libffi dependency * configure.ac: * libguile/Makefile.am (AM_CFLAGS, libguile_la_LDFLAGS): Add a libffi dependency, for making a dynamic FFI. 2010-01-26 Ludovic Courtès <ludo@gnu.org> 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. 2010-01-25 Ludovic Courtès <ludo@gnu.org> 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. Reinstate 2-word displacement for structs. * libguile/struct.c (scm_init_struct): Reinstate 2-word displacement removed by 01e74380f6170b5cb1105e5df9a368ab257420ef. 2010-01-23 Michael Gran <spk121@yahoo.com> 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 2010-01-23 Ludovic Courtès <ludo@gnu.org> Revert "Install `standard-library.info'." This reverts commit 0e64cbea3d22411564af302a63b670fe0617ccf3. 2010-01-23 Ludovic Courtès <ludo@gnu.org> 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'. 2010-01-23 Ludovic Courtès <ludo@gnu.org> 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. Clarify GC-registered displacements for structs. * libguile/struct.c (scm_init_struct): Remove unneeded `GC_REGISTER_DISPLACEMENT ()' call. Comment the remaining one. 2010-01-23 Ludovic Courtès <ludo@gnu.org> 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. 2010-01-22 Ludovic Courtès <ludo@gnu.org> Install `standard-library.info'. * doc/ref/Makefile.am (BUILT_SOURCES): Move `standard-library.texi' to... (nodist_info_TEXINFOS): ... here. New variable. 2010-01-20 Ludovic Courtès <ludo@gnu.org> 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'. 2010-01-19 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.7. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Update `NEWS'. Document `guile-tools compile'. * doc/ref/api-evaluation.texi (Compilation): Document `guile-tools compile'. 2010-01-19 Ludovic Courtès <ludo@gnu.org> Reinstate `scm_is_bool ()' as a function. * libguile/boolean.c (scm_is_bool): New function. * libguile/boolean.h (scm_is_bool): New function declaration. 2010-01-19 Ludovic Courtès <ludo@gnu.org> Make `sockets.test' more robust. * test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): Gracefully handle cases where this combination is not supported. 2010-01-19 Michael Gran <spk121@yahoo.com> Document modal encodings problem in ref doc * doc/ref/api-io.texi (Ports): note that modal encodings are not supported 2010-01-19 Ludovic Courtès <ludo@gnu.org> Fix use of utimensat(2). * libguile/posix.c (scm_utime): Use "#ifdef HAVE_UTIMENSAT", not "#if HAVE_UTIMENSAT". Fix GCC warning around call to utimensat(2): "passing argument 3 of 'utimensat' from incompatible pointer type". * test-suite/tests/posix.test ("utime"): New test prefix. 2010-01-18 Michael Gran <spk121@yahoo.com> Move string internals description in ref doc * doc/ref/api-data.texi: move string internals section String ref doc updates for case and conversion * doc/ref/api-data.texi: clarifications on Alphabetic Case Mapping and Conversion To/From C. Document string-bytes-per-char and %string-dump * doc/ref/api-data.texi (String Internals): new subsubsection. Document string-bytes-per-char and %string-dump. 2010-01-17 Michael Gran <spk121@yahoo.com> object->assembly shouldn't presume existence of %nil The %nil constant only exists if SCM_ENABLE_ELISP is defined. * module/language/assembly (object->assembly): check for existence of %nil 2010-01-17 Michael Gran <spk121@yahoo.com> reader options macros incorrect when SCM_ENABLE_ELISP undefined When compiled with SCM_ENABLE_ELISP undefined, the reader options macros SCM_R6RS_ESCAPES_P and SCM_SQUARE_BRACKETS_P point past the end of the scm_read_opts struct. *libguile/private-options.h (SCM_R6RS_ESCAPES_P) [!SCM_ENABLE_ELISP]: modified (SCM_SQUARE_BRACKETS_P) [!SCM_ENABLE_ELISP]: modified (SCM_N_READ_OPTIONS): modified 2010-01-17 Andy Wingo <wingo@oblong.net> fix doc snarfing with fedora 12 * module/scripts/snarf-check-and-output-texi.scm (process-multiline-directive): Be more accepting of source location markers in the preprocessed source, by adding a couple cases in which they can appear. Not foolproof, but it does adapt to what new GCCs are putting out (e.g. cpp (GCC) 4.4.2 20091222 (Red Hat 4.4.2-20)). 2010-01-17 Andy Wingo <wingo@oblong.net> nanosecond timestamp support in stat and utime * libguile/posix.h: * libguile/posix.c (scm_utime): Add optional nanosecond arguments. This is an incompatible change on the C level, but it's unlikely people are using this POSIX wrapper function, because they would just use the POSIX function directly. Hopefully, anyway. * module/system/base/compile.scm (call-with-output-file/atomic): Propagate source timestamps to targets with nanosecond precision, if available. Fixes build on systems with ext4 filesystems. * libguile/filesys.c (scm_stat2scm): * module/ice-9/posix.scm (stat:atimensec, stat:mtimensec) (stat:ctimensec): Add three new elements to Scheme stat structures, for nanosecond-level timestamps. * configure.ac: Add checks for utimensat, and for nanosecond fields in struct stat. We should switch to using Gnulib things for these, though. * doc/ref/posix.texi (File System): Add documentation for utime's additional arguments, and nanosecond stat timestamp accessors. 2010-01-15 Andy Wingo <wingo@pobox.com> fix (class-of #u32()) * libguile/goops.c (scm_class_of, create_standard_classes): Return <bytevector> or <uvec> for bytevectors, as appropriate. add reader option for parsing [] as (). * libguile/private-options.h: * libguile/read.c (scm_read_opts, SCM_SQUARE_BRACKETS_P): Add an option for treating [ and ] as parentheses, on by default. Note that this makes them delimiters also, so [ and ] cannot appear in a symbol name, with this read option on. (scm_read_sexp): If we start with [, we end with ]. (scm_read_expression): Add case for [. 2010-01-14 Andy Wingo <wingo@pobox.com> fix call counting in statprof, enhance repl support * module/statprof.scm: Use VM modules, instead of using @ hacks. (statprof): New public export, a functional interface to the profiler. (profile-signal-handler, count-call, statprof-start, statprof-stop): Fix call counting with the VM. (statprof-call-data->stats): Hack around a case in which a call could be sampled but not counted, if you get my drift. (procedure=?): Update for current API. (with-statprof): Use `statprof'. * module/system/repl/command.scm (profile): Use the `statprof' procedural interface. 2010-01-14 Andy Wingo <wingo@oblong.net> vm.c uses scm_c_take_bytevector instead of scm_take_u8vector * libguile/vm.c (really_make_boot_program): Use scm_c_take_bytevector to avoid loading srfi-4 at boot time. 2010-01-14 Andy Wingo <wingo@pobox.com> 1.8 compat in ice-9 syncase * module/ice-9/syncase.scm: Export datum->syntax-object and syntax-object->datum as aliases of datum->syntax and syntax->datum. Thanks to Daniel Llorens del Río for the suggestion. vm-trace prints return values * module/system/vm/trace.scm (vm-trace): Add a #:width argument. Print return values, as Chez Scheme does. 2010-01-13 Andy Wingo <wingo@pobox.com> RETURN_HOOK communicates the number of returned values * libguile/vm-engine.h (RUN_HOOK1): Add some machinery whereby a hook can push an arg on the stack, run the hook, then drop the value. (RETURN_HOOK): Use it here, so we push the number of returned values. * libguile/vm-i-system.c (return, return-values): Adapt to RETURN_HOOK changes. 2010-01-13 Andy Wingo <wingo@pobox.com> vm-trace only traces execution of its thunk * module/system/vm/trace.scm (vm-trace): Change to just export the one procedure, vm-trace. This way it's threadsafe and more robust. Also refactor to not print any of Guile's internal bits. Hopefully Neil will be happier :) * module/system/repl/command.scm (option): Adapt to removal of vm-trace-on! and vm-trace-off!, as those are unlikely to DTRT. 2010-01-13 Andy Wingo <wingo@pobox.com> remove unused var in read.c * libguile/read.c (scm_read_character): Remove unused var. 2010-01-13 Thien-Thi Nguyen <ttn@gnuvola.org> Use `mkstemp' instead of `mktemp'. * test-suite/standalone/test-unwind.c (check_ports): Use `mkstemp' instead of `mktemp'. Update configure script hints wrt precious env vars. * README: Don't suggest setting vars before running configure. Instead, suggest specifying them on the configure command-line. 2010-01-13 Michael Gran <spk121@yahoo.com> Document R6RS hex escapes * doc/ref/api-data.texi (Characters, String Syntax): document r6rs hex escapes * doc/ref/api-options.texi (Reader Options): document r6rs-hex-escapes reader option 2010-01-13 Michael Gran <spk121@yahoo.com> Disable \u and \U escapes when r6rs-hex-escapes enabled When the reader option 'r6rs-hex-escapes is enabled, the \uNNNN and \UNNNNNN string escape sequences should be disabled. * libguile/read.c (scm_read_string): added checks for SCM_R6RS_ESCAPES_P 2010-01-13 Michael Gran <spk121@yahoo.com> Move r6rs-hex-escape tests into reader.test * test-suite/tests/reader.test (r6rs-hex-escapes): new tests * test-suite/tests/chars.test (R6RS Hex escapes): remove tests by reverting to previous version * test-suite/tests/strings.test (R6RS Hex escapes): remove tests by reverting to previous version 2010-01-13 Michael Gran <spk121@yahoo.com> Reader option for R6RS hex escapes This adds a reader option 'r6rs-hex-escapes that modifies the behavior of numeric escapes in characters and strings. When enabled, variable-length character hex escapes (#\xNNN) are allowed and become the default output format for numerically-escaped characters. Also, string hex escapes switch to a semicolon terminated hex escape (\xNNNN;). * libguile/print.c (PRINT_CHAR_ESCAPE): new macro (iprin1): use new macro PRINT_CHAR_ESCAPE * libguile/private-options.h (SCM_R6RS_ESCAPES_P): new #define * libguile/read.c (scm_read_opts): add new option r6rs-hex-escapes (SCM_READ_HEX_ESCAPE): modify to take a terminator parameter (scm_read_string): parse R6RS hex string escapes (scm_read_character): parse R6RS hex character escapes * test-suite/tests/chars.test (with-read-options): new procedure (R6RS hex escapes): new tests * test-suite/tests/strings.test (with-read-options): new procedure (R6RS hex escapes): new tests 2010-01-12 Andy Wingo <wingo@pobox.com> fix texinfo reflection for procedures * module/system/vm/program.scm (program-arguments-alist): Rename from program-arguments, a name shadowed by features.c (arglist->arguments-alist, arity->arguments-alist) (arguments-alist->lambda-list, program-lambda-list, write-program): Adapt callers. * module/system/vm/frame.scm (frame-lookup-binding): Return #f if the binding is not found, not an error. (frame-binding-set!, frame-binding-ref): Adapt to error appropriately. (frame-arguments): Dispatch to frame-call-representation. (frame-call-representation): Refactor a bit. * module/ice-9/session.scm (procedure-arguments): Adapt to program-arguments name change. * module/texinfo/reflection.scm (get-proc-args): Refactor to actually work with VM procedures. 2010-01-12 Andy Wingo <wingo@pobox.com> allow simple value definitions with define*-public * module/ice-9/optargs.scm (define*-public): Allow (define*-public ID VAL). hopefully fix shared c32 / c64 uniform arrays * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Add a width parameter, indicating the number of sizeof(ctype) entries comprised by one element of the uniform; normally 1, but 2 for c32 and c64. make-array bugfix * libguile/vm-i-scheme.c (make-array): Fix terrible stack corruption bug. inspector integration in debugger * module/system/vm/debug.scm: Integrate with the inspector. Add a "procedure" command. fix srfi-4 shared vector access from c * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix elements/writable_elements for shared vectors. Thanks to Daniel Llorens del Río for the info. 2010-01-12 Andy Wingo <wingo@pobox.com> programs print as #<procedure ...> * module/system/vm/program.scm (write-program): Print as #<procedure ...>. Fix stdin printing. * doc/ref/vm.texi: Update a little bit. 2010-01-12 Andy Wingo <wingo@pobox.com> add a silly inspector * module/Makefile.am: * module/system/vm/inspect.scm: Add a very simple and stupid inspector. 2010-01-11 Andy Wingo <wingo@pobox.com> remove section on enclose-array * doc/ref/api-compound.texi (Array Procedures): Remove section on `enclose-array', as it doesn't exist any more. fix compilation of #2((1 2 3) (4 5 6)) * module/language/glil/compile-assembly.scm (dump-object): Whoops, really fix for multidimensional arrays. allow (define* SYM VAL) * module/ice-9/psyntax.scm (define*): Allow (define* SYM VAL), as 1.8 did. Thanks to Patrick McCarty for the report. 2010-01-11 Andy Wingo <wingo@pobox.com> allow compilation of #@2(1 2 3) * libguile/arrays.h: * libguile/arrays.c (scm_from_contiguous_array): New public function, like scm_from_contiguous_typed_array but for arrays of generic Scheme values. * libguile/vm-i-scheme.c (make-struct): Sync regs before making the struct, so if we get a GC the regs are on the heap. (make-array): New instruction, makes an generic (untyped) Scheme array. * module/language/glil/compile-assembly.scm (dump-object): Correctly compile arrays. 2010-01-11 Andy Wingo <wingo@pobox.com> fix erroneous compilation of #@2(1 2 3) as #(1 2 3) * module/language/glil/compile-assembly.scm (dump-object): Fix the vector case to only match 0-indexed, vectors, not arrays like #@2(1 2 3). 2010-01-11 Ludovic Courtès <ludo@gnu.org> Evaluate the `export' and `re-export' forms at compile-time. * module/ice-9/boot-9.scm (export, re-export): Evaluate at compile-time in addition to load/eval. * test-suite/tests/tree-il.test ("warnings")["unused-toplevel"]("unused but define-public"): Remove throw to `unresolved'. 2010-01-11 Ludovic Courtès <ludo@gnu.org> The reference graph in `-Wunused-toplevel' may contain cycles. * module/language/tree-il/analyze.scm (<reference-graph>, dag-reachable-nodes, dag-reachable-nodes*, unused-toplevel-analysis): Replace occurrences of "dag" by "graph". 2010-01-11 Michael Gran <spk121@yahoo.com> Refactor repeated code in scm_read_string * libguile/read.c (SCM_READ_HEX_ESCAPE): new macro (scm_read_string): use new macro SCM_READ_HEX_ESCAPE 2010-01-11 Ludovic Courtès <ludo@gnu.org> Move `feature?' to `deprecated.scm'. * module/ice-9/boot-9.scm (feature?): Move to... * module/ice-9/deprecated.scm (feature?): ... here. 2010-01-11 Ludovic Courtès <ludo@gnu.org> Make `(ice-9 deprecated)' a module of its own. * module/ice-9/boot-9.scm: Load `deprecated.scm' with `resolve-interface' instead of `primitive-load-path'. * module/ice-9/deprecated.scm: Turned into a module, `(ice-9 deprecated)'. 2010-01-11 Ludovic Courtès <ludo@gnu.org> Make `boot-9.scm' more friendly with `-Wunused-toplevel'. * module/ice-9/boot-9.scm: Switch back to the `(guile)' modules at the end when compiling. Fix SRFI-19 exports. * module/srfi/srfi-19.scm: Export `time-monotonic->julian-day' and `time-monotonic->modified-julian-day'. Remove obscure `current-time' hack. Use `(define-module :export ...)' instead of `(export ...)'. 2010-01-11 Ludovic Courtès <ludo@gnu.org> Remove unused top-level variables. * module/ice-9/runq.scm (fork-strips): Remove. * module/language/assembly.scm (*block-alignment*): Remove. * module/language/assembly/disassemble.scm (disassemble-objects, simplify): Remove. * module/srfi/srfi-18.scm (mutex-owners): Remove. * module/srfi/srfi-19.scm (leap-year?): Remove. * module/system/base/compile.scm (dsu-sort): Remove. * module/texinfo.scm (ascii->char): Remove. * module/texinfo/html.scm (ignored?): Remove. * module/texinfo/indexing.scm (def-name): Remove. * module/texinfo/plain-text.scm (ignore): Remove. 2010-01-11 Ludovic Courtès <ludo@gnu.org> Have "guile-tools compile" use the current locale. * meta/guile-tools.in (main): Install the user's locale. Provide Guile-friendly `coding:' meta-data. * module/ice-9/i18n.scm, module/rnrs/bytevector.scm, module/rnrs/io/ports.scm, module/scripts/compile.scm, module/srfi/srfi-35.scm, module/srfi/srfi-88.scm: Write `coding:' comment at the top. 2010-01-11 Ludovic Courtès <ludo@gnu.org> Add `-Wunused-toplevel' compiler warning. * module/language/tree-il/analyze.scm (<reference-dag>): New record type. (dag-reachable-nodes, dag-reachable-nodes*, unused-variable-analysis): New variables. (unbound-variable-analysis): Slightly simplify the `up' procedure. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `unused-toplevel'. * module/system/base/message.scm (%warning-types): Likewise. * test-suite/tests/tree-il.test (%opts-w-unused-toplevel): New variable. ("warnings")["unused-toplevel"]: New test prefix. 2010-01-11 Michael Gran <spk121@yahoo.com> Merge branch 'master' of git.sv.gnu.org:/srv/git/guile 2010-01-11 Michael Gran <spk121@yahoo.com> Add R6RS backspace string escape R6RS suggests that '\b' should be a string escape for the backspace character. * libguile/read.c (scm_read_string): parse backspace escape * test-suite/tests/strings.test (R6RS backslash escapes): new test (Guile extensions backslash escapes): remove R6RS escapes from test. * doc/ref/api-data.texi (Strings): document new string escape 2010-01-11 Michael Gran <spk121@yahoo.com> Add R6RS backslash string escape R6RS suggests that '\b' should be a string escape for the backslash character. * libguile/read.c (scm_read_string): parse backspace escape * test-suite/tests/strings.test (R6RS backslash escapes): new test (Guile extensions backslash escapes): remove R6RS escapes from test. * doc/ref/api-data.texi (Strings): document new string escape 2010-01-11 Michael Gran <spk121@yahoo.com> Add R6RS character names R6RS adds new names for some of the control characters. * libguile/chars.c (scm_r6rs_charnames, scm_r6rs_charnums) (SCM_N_R6RS_CHARNAMES): new character name constants (scm_alt_charnames, scm_alt_charnums): modified to remove duplicates (scm_i_charname, scm_i_charname_to_char): use new constants * test-suite/tests/chars.test (R5RS character names, R6RS character names): new tests * doc/ref/api-data.texi (Characters): updated 2010-01-10 Andy Wingo <wingo@pobox.com> fix properties disassembly * module/language/assembly/disassemble.scm (disassemble-meta): Properties start with the fourth element, not the third. (The third is the set of arities.) show args to subr calls in backtraces * module/system/vm/frame.scm (frame-arguments): For subrs, we don't get names in the lambda-list, we get #f instead. But still, parse out the args in that case, assuming they are on the stack in that order. update NEWS * NEWS: Update for 1.9.7, and fold new entries into the main text. fold 1.9.6 NEWS into the main text * NEWS: Incorporate 1.9.6 NEWS items into the main text. 2010-01-09 Thien-Thi Nguyen <ttn@gnuvola.org> Fix bug: Use correct `FUNC_NAME' for `scm_macro_binding'. * libguile/macros.c (scm_macro_binding): Use correct FUNC_NAME. Add cast in `make_vm' to silence compiler warning. * libguile/vm.c (make_vm): Add cast for .stack_base assignment. Fix bug: Init auto var to unrandomize `stack_depth' rv. * libguile/stacks.c (stack_depth): Init `n'. 2010-01-09 Andy Wingo <wingo@pobox.com> fix SCM_STACK_OVERFLOW_P bug * libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Fix a potential overflow, depending on the absolute values of the thread base and the stack limit. Thanks to Ivan Shcherbakov for the report. slight tweak to stack narrowing in the debugger * module/system/vm/debug.scm: Really narrow two frames and not by function, so it works in the evaluator. fix bug in subr-call and smob-call * libguile/vm-i-system.c (subr-call, smob-call): Unlike the previous situation, in which a call to a subr or a smob didn't actually build a frame, we no longer need to explicitly pop the procedure and its arguments. Indeed the procedure and its arguments must remain on the stack, for hooks and ticks and such always to see frames with valid procedures. Two lines out, two bugs less, and faster to boot. Narrow one more frame in debug.scm:debug-pre-unwind-handler * module/system/vm/debug.scm (debug-pre-unwind-handler): Narrow two frames instead of stack-reffing past one. The second frame is necessary, now that make-stack itself is on the stack. print the error more nicely when we enter the debugger * module/system/vm/debug.scm (debug-pre-unwind-handler): Nicer printing of the error. 2010-01-09 Andy Wingo <wingo@pobox.com> make backtraces prettier * module/system/vm/debug.scm (print-frames): Clean up a bit, reverting part of the previous change. (The problem was that in the else branch of the conditional, it didn't consume an arg.) In the future I would like to preserve the clean look of the backtraces. It's easier to read that way. 2010-01-09 Andy Wingo <wingo@pobox.com> port-encoding returns #f if port encoding not set * libguile/ports.c (scm_port_encoding): Instead of returning "NONE" if we don't know the encoding, return #f. Allows truncated-print to work if you don't have a locale set. 2010-01-09 Andy Wingo <wingo@pobox.com> allocate free variables inline to closures * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/programs.h (SCM_PROGRAM_FREE_VARIABLES) (SCM_PROGRAM_FREE_VARIABLE_REF, SCM_PROGRAM_FREE_VARIABLE_SET) (SCM_PROGRAM_NUM_FREE_VARIABLES): * libguile/programs.c (scm_make_program, scm_program_num_free_variables) (scm_program_free_variable_ref, scm_program_free_variable_set_x): Allocate free variables inline with programs, instead of being in a vect. Should improve locality, and require fewer local variables in the VM. * libguile/vm-engine.c (vm_engine): Remove free_vars and free_vars_count variables. * libguile/vm-engine.h (CACHE_PROGRAM): No need to muck with free_vars and free_vars_count. (CHECK_FREE_VARIABLE): Update for inline free vars. * libguile/vm-i-system.c (FREE_VARIABLE_REF): Update for inline free vars. (make-closure, fix-closure): Take the closure vals as separate stack args, and copy or fix them inline into the appropriate closure. * module/language/objcode/spec.scm (program-free-variables): Define a local version of this removed function. * module/language/tree-il/compile-glil.scm (flatten): Adjust to not make a vector when making closures. * module/system/vm/program.scm: Export program-num-free-variables, program-free-variable-ref, program-free-variable-set!, and remove program-free-variables. * test-suite/tests/tree-il.test ("lambda"): Update to not make vectors when making closures. 2010-01-09 Andy Wingo <wingo@pobox.com> smobs are applied with vm trampoline procedures * libguile/smob.c: Instead of having special evaluator support for applying smobs, we use the same strategy that gsubr uses, that smob application should happen via a trampoline VM procedure, which uses a special opcode (smob-apply). So statically allocate all of the desired trampoline procedures here. (scm_i_smob_apply_trampoline): Unfortunately there's no real place to put the trampoline, so instead use a weak-key hash. It's nasty, but I think the benefits of speeding up procedure calls in the general case are worth it. * libguile/smob.h (scm_smob_descriptor): Remove fields apply_0, apply_1, apply_2, and apply_3; these were never public. Also remove the gsubr_type field. Instead cache the trampoline objcode here. (SCM_SMOB_APPLY_0, SCM_SMOB_APPLY_1, SCM_SMOB_APPLY_2, SCM_SMOB_APPLY_3): Just go through scm_call_0, etc here. * libguile/vm-i-system.c (call, tail-call, mv-call): Simplify. All procedure calls are VM calls now. (smob-call): New instruction, used in smob trampoline procedures. * libguile/vm.c (apply_foreign): Remove. Yay! * libguile/procprop.c (scm_i_procedure_arity): Refactor a bit for the smob changes. 2010-01-09 Andy Wingo <wingo@pobox.com> re-add SCM_GSUBR_MAX * libguile/gsubr.h (SCM_GSUBR_MAX): Restore this define, which specifies the max number of args to a gsubr. * libguile/smob.c: Remove local SCM_GSUBR_MAX define. 2010-01-08 Ludovic Courtès <ludo@gnu.org> Fix frame printing in the debugger. * module/system/vm/debug.scm (location-string): New procedure. (print-frames): Use it. This fixes cases where LINE is #f and makes a distinction between FILE = stdin and FILE is unknown. Factorize the location stack handling in warning analyses. * module/language/tree-il/analyze.scm (analyze-tree)[traverse]: New argument UPDATE-LOCS. Update users. [keep-locs, extend-locs, shrink-locs]: New procedures. (<binding-info>, <toplevel-info>): Remove `locs' field. (unused-variable-analysis, unbound-variable-analysis): Update accordingly. 2010-01-08 Ludovic Courtès <ludo@gnu.org> Use `HORIZONTAL ELLIPSIS' when available in `truncated-print'. * module/ice-9/pretty-print.scm (truncated-print): Set `%default-port-encoding' to the encoding of PORT. Choose either U+2026 or "..." depending on PORT's encoding. * test-suite/tests/print.test ("truncated-print")[tprint]: New ENCODING argument. Update existing tests accordingly. Add UTF-8 tests. * doc/ref/misc-modules.texi (Pretty Printing): Mention the possible use of U+2026. 2010-01-07 Andy Wingo <wingo@pobox.com> remove scm_tc7_gsubr * libguile/tags.h (scm_tc7_gsubr): Return to the pool of unused tc7s, as there are no more gsubrs. Yay :) * libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE): (SCM_PROGRAM_IS_PRIMITIVE): New flag and accessor. * libguile/gsubr.c (create_gsubr): * libguile/snarf.h (SCM_STATIC_PROGRAM): Give subrs a PRIMITIVE flag. * libguile/smob.h: * libguile/smob.c (scm_i_smob_arity): New internal procedure. Uses the old GSUBR type macros, local to the file. * libguile/procprop.c (scm_i_procedure_arity): Call out to scm_i_smob_arity, and remove a gsubr case. * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): * libguile/vm.c (apply_foreign): * libguile/hash.c (scm_hasher): * libguile/debug.c (scm_procedure_name): * libguile/print.c (iprin1): Remove gsubr cases. * libguile/gsubr.h (SCM_PRIMITIVE_P): Fix to work with the new VM program regimen. (SCM_GSUBR_TYPE, SCM_GSUBR_MAKTYPE, SCM_GSUBR_MAX, SCM_GSUBR_REQ) (SCM_GSUBR_OPT, SCM_GSUBR_REST): Remove these macros, that are no longer useful. * libguile/gsubr.c (scm_i_gsubr_apply, scm_i_gsubr_apply_list) (scm_i_gsubr_apply_array): Remove internal gsubr application functions. 2010-01-07 Andy Wingo <wingo@pobox.com> fix procedure-name on applicable structs * libguile/debug.c (scm_procedure_name): Fix for applicable structs. 2010-01-07 Andy Wingo <wingo@pobox.com> subrs are now VM trampoline procedures * libguile/_scm.h: Add foreign.h and programs.h to the private include list, as snarfing subrs with static allocation now needs access to some of their enums and macros. * libguile/gsubr.c (create_gsubr): Instead of creating a tc7_gsubr object, create a VM program with the call-subr opcode, so that the representation of subrs is now gsubrs. CPP and elisp, together at last. (scm_subr_objcode_trampoline): New function, used by the SCM_DEFINE snarf macro. * libguile/gsubr.h (SCM_SUBR_META_INFO, SCM_SUBR_PROPS) (SCM_SET_SUBR_GENERIC_LOC, SCM_SUBR_ARITY_TO_TYPE): Remove these macros. They were never deprecated, but hopefully people aren't using them. (SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC): Update to work on the new subr representation. * libguile/objcodes.h (SCM_F_OBJCODE_IS_STATIC): New flag, indicates that the "backing store" of the objcode is statically allocated. * libguile/procprop.c (scm_sym_name): Define here instead of in gsubr.c. * libguile/snarf.h (SCM_DEFINE): If we are doing static allocation, statically allocate the foreign object, the object table, and the program, and use some SCM_SNARF_INITtery to fix things up. Unfortunately I have not been able to make this immutable. It might be possible, though. (SCM_IMMUTABLE_CELL, SCM_STATIC_DOUBLE_CELL, SCM_IMMUTABLE_FOREIGN): (SCM_STATIC_SUBR_OBJVECT, SCM_STATIC_PROGRAM): New helper macros. 2010-01-07 Andy Wingo <wingo@pobox.com> better scm_subr_p deprecation * libguile/deprecated.h (scm_subr_p): Dispatch instead to scm_i_subr_p so we get link-time and run-time warnings. * libguile/deprecated.c (scm_i_subr_p): Here we call SCM_PRIMITIVE_P. provide missing prototypes * libguile/array-map.c: * libguile/chars.c: * libguile/eq.c: * libguile/strorder.c: Provide declarations missing after the asubrs/rpsubrs -> gsubr conversion. boot the VM very early in init.c * libguile/init.c (scm_i_init_guile): Now that the VM doesn't depend on smobs, we can boot it before anything. 2010-01-07 Andy Wingo <wingo@pobox.com> tc7 tags for vm-related data * libguile/tags.h (scm_tc7_frame, scm_tc7_objcode, scm_tc7_vm) (scm_tc7_vm_cont): Take more tc7s for VM-related data structures. * libguile/evalext.c (scm_self_evaluating_p): * libguile/gc.c (scm_i_tag_name): * libguile/goops.c (scm_class_of, create_standard_classes): * libguile/print.c (iprin1): Add cases for the new tc7s. * libguile/frames.c: * libguile/frames.h: * libguile/objcodes.c: * libguile/objcodes.h: * libguile/vm.c: * libguile/vm.h: Desmobify. * libguile/vm.c (scm_vm_apply): Export to Scheme, because VM objects are no longer applicable. * module/system/repl/command.scm (profile): * module/system/vm/trace.scm (vm-trace): * module/system/vm/vm.scm (vm-load): Call vm-apply to run a program in a VM instead of treating the VM as applicable. 2010-01-07 Andy Wingo <wingo@pobox.com> properly integrate vm bootstrapping into init.c * libguile/Makefile.am (modinclude_HEADERS): * libguile/vm-bootstrap.h: Remove vm-bootstrap.h. * libguile/frames.c: No more vm-bootstrap.h. * libguile/instructions.c (scm_init_instructions): * libguile/objcodes.c (scm_init_objcodes): * libguile/programs.c (scm_init_programs): No need to call scm_bootstrap_vm, init.c does that for us. * libguile/vm.c (scm_bootstrap_vm): No need call e.g. scm_bootstrap_frames, init.c does that. Remove a twice-calling guard, should be unnecessary. Don't define the load-compiled subr here. * libguile/load.c (scm_init_load): Define the load-compiled subr here. * libguile/vm.h: Declare scm_bootstrap_vm here. * libguile/init.c (scm_i_init_guile): Properly integrate VM bootstrapping into this file. 2010-01-07 Andy Wingo <wingo@pobox.com> boot bytevectors earlier * libguile/init.c (scm_i_init_guile): It turns out generalized-vectors and generalized-arrays don't actually block anyone in the dependency graph, so punt those back to the end. Bootstrap bytevectors earlier, though, which don't actually depend on smobs. inline srfi-4 vector accessors * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Inline srfi-4 vector accessors. 2010-01-07 Andy Wingo <wingo@pobox.com> update uniform vector docs * doc/ref/api-compound.texi (Uniform Numeric Vectors): Make a subsection of "Vectors", and link out to SRFI-4, where the main text has been moved. * doc/ref/api-data.texi (Bytevectors as Uniform Vectors): New section. * doc/ref/srfi-modules.texi (SRFI-4): Move body of uniform vector docs here. Discuss new module separation. Discuss relation to bytevectors. 2010-01-07 Andy Wingo <wingo@pobox.com> reimplement srfi-4 vectors on top of bytevectors * libguile/srfi-4.h: * libguile/srfi-4.c (scm_make_srfi_4_vector): New function, exported by (srfi srfi-4 gnu). * libguile/srfi-4.i.c: Removed. * module/srfi/srfi-4.scm: * module/srfi/srfi-4/gnu.scm: Reimplement srfi-4 vectors on top of bytevectors. The implementation is mostly in Scheme now. * test-suite/tests/unif.test: Update to use (srfi srfi-4 gnu). * libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64) (bytevector_set_c32, bytevector_set_c64): Fix some embarrassing bugs. Still need to do an upper bounds check. * libguile/deprecated.h: Remove deprecated array functions: scm_i_arrayp, scm_i_array_ndim, scm_i_array_mem, scm_i_array_v, scm_i_array_base, scm_i_array_dims, and the deprecated macros: SCM_ARRAYP, SCM_ARRAY_NDIM, SCM_ARRAY_CONTP, SCM_ARRAY_MEM, SCM_ARRAY_V, SCM_ARRAY_BASE, SCM_ARRAY_DIMS. * libguile/deprecated.c (scm_uniform_vector_read_x) (scm_uniform_vector_write, scm_uniform_array_read_x) (scm_uniform_array_write): Newly deprecated functions. * libguile/generalized-arrays.c (scm_array_type): Remove the bytevector hack. * libguile/objcodes.c (scm_bytecode_to_objcode, scm_objcode_to_bytecode): Rework to operate on bytevectors, as scm_make_u8vector now causes a module lookup, which can't be done e.g. when loading the VM boot program for psyntax-pp.go on a fresh bootstrap. * libguile/objcodes.h (SCM_F_OBJCODE_IS_BYTEVECTOR): (SCM_OBJCODE_IS_BYTEVECTOR): s/U8VECTOR/BYTEVECTOR/. * module/ice-9/boot-9.scm (the-scm-module): A terrible hack to pull in (srfi srfi-4), as the bindings are primarily there now. We'll worry about this later. 2010-01-07 Andy Wingo <wingo@pobox.com> Revert "Remove unused internal bytevector functions." This reverts commit c4daa519107798d06ae96d2f69dc211fc57cc8a3. clean up includes in vectors.[ch] * libguile/vectors.h: * libguile/vectors.c: Clean up the includes... mostly. fix array->list * libguile/generalized-arrays.c (array_to_list): Fix buggy implementation. Thanks to Daniel Llorens del Río for the bug repor. 2010-01-07 Ludovic Courtès <ludo@gnu.org> Enclose hooks tests in their own module. * test-suite/tests/hooks.test: Enclose in `(test-suite test-hooks)' module. Fix 1.8-compatibility of `scm_search_path ()'. * libguile/load.c (scm_search_path): Handle the 1.8-compatibility case where REST is `SCM_UNDEFINED'. Reported by Dale P. Smith. Use Gnulib's `full-write' instead of custom code. * libguile/fports.c (write_all): Remove. (fport_write): Use `full_write ()' instead of `write_all ()'. 2010-01-07 Ludovic Courtès <ludo@gnu.org> Use `encoding-error' instead of `misc-error' for string encoding errors. * libguile/strings.c (scm_encoding_error): New function. (scm_from_stringn, scm_to_stringn): Use it instead of `scm_misc_error ()'. * test-suite/lib.scm (exception:encoding-error): Adjust accordingly. * test-suite/tests/encoding-escapes.test (exception:conversion): Remove. Use `exception:encoding-error' instead. * test-suite/tests/encoding-iso88591.test: Likewise. * test-suite/tests/encoding-iso88597.test: Likewise. * test-suite/tests/encoding-utf8.test: Likewise. 2010-01-07 Ludovic Courtès <ludo@gnu.org> Have string ports honor `%default-port-encoding'. * libguile/strports.c (scm_i_mkstrport): Remove. (scm_mkstrport): Don't change the port's encoding to UTF-8; convert STR to the default port encoding. (scm_strport_to_string): Fix documentation & indentation. * libguile/strports.h (scm_i_mkstrport): Remove. * test-suite/lib.scm (exception:encoding-error): New variable. (format-test-name): Set `%default-port-encoding' to "UTF-8". * test-suite/tests/ports.test ("string ports")["%default-port-encoding is honored", "suitable encoding [latin-1]", "suitable encoding [latin-3]", "wrong encoding"]: New tests. * test-suite/tests/r6rs-ports.test ("7.2.11 Binary Output")["put-bytevector with UTF-16 string port", "put-bytevector with wrong-encoding string port"]: New tests. * test-suite/tests/reader.test (read-string): Set `%default-port-encoding' to `#f'. ("reading")["unprintable symbol"]: Use a string that doesn't contain zeros. * doc/ref/api-io.texi (String Ports): Document encoding issues with `call-with-output-string' and `with-output-to-string'. 2010-01-07 Ludovic Courtès <ludo@gnu.org> Add in-source documentation of `scm_to_stringn ()'. * libguile/strings.c (scm_to_stringn): Add documentation comment. 2010-01-07 Andy Wingo <wingo@pobox.com> fix compiler warnings in foreign.c * libguile/foreign.c (scm_c_from_foreign, scm_c_take_foreign): Fix compiler warnings on 64-bit machines. add subr-call VM op * libguile/vm-i-system.c (subr_call): Add subr-call VM op. add SCM_PROGRAM_IS_PRIMITIVE_GENERIC flag and checker * libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC) (SCM_PROGRAM_IS_PRIMITIVE_GENERIC): Add a primitive-generic flag and accessor, for when we switch primitives to be implemented using VM trampolines. program-meta procedures get their program's objtable * libguile/programs.c (scm_program_meta): Give the program meta procedure the same object table as the main procedure. Will allow for easier hand-crafting of meta programs. Of course when compiling a metadata procedure from Scheme, one still wants to avoid preallocating the heap objects needed by the metadata... 2010-01-07 Julian Graham <julian.graham@aya.yale.edu> Attempt to narrow normalized strings. * libguile/strings.c (normalize_str): Clean up indentation. Add call to scm_i_try_narrow_string. 2010-01-05 Andy Wingo <wingo@pobox.com> remove unused snarf macros * libguile/snarf.h (SCM_DEFINE1, SCM_PRIMITIVE_GENERIC_1, SCM_PROC1) (SCM_GPROC1): Remove, as these deal in the removed typed subr constructors. * libguile/tags.h (scm_tcs_subrs): Remove this. Use scm_tc7_gsubr instead, though hopefully that will go too, soon. 2010-01-05 Andy Wingo <wingo@pobox.com> move subr implementation details to gsubr.[ch] * libguile/procs.h: Move subr macros to gsubr.h. * libguile/procs.c (scm_c_make_subr, scm_c_make_subr_with_generic) (scm_c_define_subr, scm_c_define_subr_with_generic): Remove these, because they deal in subr types, and now there is only one subr type. The body of this code is now in gsubr.c. * libguile/deprecated.h (scm_subr_p): Remove from procs.[ch] and define as a deprecated macro. Only used internally, but who knows who's out there. * libguile/goops.c (scm_generic_capability_p) (scm_enable_primitive_generic_x, scm_set_primitive_generic_x) (scm_primitive_generic_generic): Use the new SCM_PRIMITIVE_GENERIC_P macro instead of calling scm_subr_p. * libguile/gsubr.h (SCM_PRIMITIVE_P, SCM_PRIMITIVE_GENERIC_P): New macros, to replace scm_subr_p and hacky checking for generic capability. (SCM_SUBR_META_INFO, SCM_SUBR_NAME, SCM_SUBRF, SCM_SUBR_PROPS) (SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC) (SCM_SUBR_ARITY_TO_TYPE): Moved here from procs.h. * libguile/gsubr.c (create_gsubr): Inline the scm_c_make_subr definition here, and work for generics too. Removed a scm_remember_upto_here_1 that was added earlier in the year when meta_info was not being traced by the GC. Adapt callers. 2010-01-05 Andy Wingo <wingo@pobox.com> clean up macros.[ch] There are some incompatible changes here, but only to interfaces that were introduced earlier in 1.9, or interfaces which have been broken since early in 1.9. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the macro changes affect the interface that is called by psyntax-generated macro definitions. * libguile/inline.h (scm_words): New function, allocates a variable number of contiguous scm_t_bits locations, with a given value in the 0th word, and 0 in the rest of the words. * libguile/macros.h: Rework interface to correspond more closely, and minimally, to the needs of memoize.c and psyntax. (SCM_ASSYNT, SCM_MACRO_TYPE_BITS, SCM_MACRO_TYPE_MASK) (SCM_F_MACRO_EXTENDED, SCM_MACROP, SCM_MACRO_TYPE) (SCM_MACRO_IS_EXTENDED, SCM_BUILTIN_MACRO_P, SCM_SYNCASE_MACRO_P) (SCM_MACRO_CODE, scm_tc16_macro): Remove CPP macros related to the representation of Scheme macros. (scm_i_make_primitive_macro): Renamed from scm_i_makbimacro. (scm_i_macro_primitive): New accessor so that memoize.c can get to the primitive syntax transformer. (scm_make_syncase_macro, scm_make_extended_syncase_macro) (scm_syncase_macro_type, scm_syncase_macro_binding): Removed these functions, replaced by make-syntax-transformer and its accessors. (scm_macro_binding): New accessor, the same as what scm_syncase_macro_binding was. * libguile/macros.c: All representation details of syntax transformers are private to this file now. (macro_print): Print macros as #<syntax-transformer ...>, or #<primitive-syntax-transformer ...> if psyntax has not attached a transformer of its own. (scm_i_make_primitive_macro): Represent macros as 5-word smobs. (scm_make_syntax_transformer): New constructor for syntax transformers (macros), exported to scheme. Takes a name, and looks it up in the current module to determine the previous primitive transformer, if any. (scm_macro_type): Instead of returning 'builtin-macro!, etc, return the type as set by psyntax, or #f if it's a primitive. (scm_macro_name): Return the stored macro name. (scm_macro_transformer): Return the psyntax-set syntax transformer. Hacky, but should help introspection somewhat. * libguile/memoize.c (memoize_env_ref_transformer): Use the new scm_i_macro_primitive, and adapt to other macro API changes. * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook, chi-install-global): Call (and generate calls to) the new macro constructors and accessors. * module/ice-9/psyntax-pp.scm: Doubly regenerated. * module/ice-9/debugging/traps.scm (trap-here): Comment out this definition and export, while it's not working. 2010-01-05 Andy Wingo <wingo@pobox.com> remove mmacros, SCM_SYNTAX snarf macro * libguile/snarf.h (SCM_SYNTAX): Remove snarf macro, users can't define primitive syntax any more. * libguile/memoize.c (SCM_SYNTAX): Define locally, and just call scm_i_makbimacro as there's no difference between that and scm_makmmacro. Alter invocations to suit. * libguile/macros.h: * libguile/macros.c (scm_i_makmmacro): Remove; users can't define primitive syntax any more. Use define-syntax instead. (scm_make_synt): Remove, this was only used by the SCM_SYNTAX snarf macro. (scm_i_makbimacro): Change prototype of this internal function to make the gsubr on behalf of the caller. (macro_print, scm_macro_type): Remove cases for mmacros. 2010-01-05 Andy Wingo <wingo@pobox.com> remove scm_makacro and scm_makmacro * libguile/macros.h: * libguile/macros.c (scm_makacro): Remove this function for making "acros", as it is unused and won't work with the compiler. (scm_makmacro): Remove this deprecated function for making non-memoizing macros, as they won't work with the compiler. (macro_print, scm_macro_type): Remove a couple of cases for macros that can't be created any more. fix include paths in foreign.c * libguile/foreign.c: Fix include paths. remove the deprecatd scm_make_subr_* * libguile/deprecated.h: * libguile/deprecated.c (scm_make_subr, scm_make_subr_with_generic) (scm_make_subr_opt): Remove these functions that were deprecated in 2003, as they explicitly reference subr types. 2010-01-04 Andy Wingo <wingo@pobox.com> dynamic-func returns foreign objects, not bignums * libguile/dynl.c (scm_dynamic_func, scm_dynamic_call) (scm_dynamic_args_call): Change the representation of dynamic functions to be foreign objects. Shouldn't affect any users, as people should be treating the return value of dynamic-func as an opaque object. 2010-01-04 Andy Wingo <wingo@pobox.com> add foreign value wrapper * libguile/foreign.h: * libguile/foreign.c: New files, implementing simple wrappers around foreign values, such as those that one might link in dynamically from a library. * libguile/tags.h (scm_tc7_foreign): Take a tc7 for foreign values. * libguile.h: * libguile/init.c: Add foreign.h to headers and init. * libguile/print.c (iprin1): Add printer for foreign values. * libguile/gc.c (scm_i_tag_name): Case for foreign values. * libguile/goops.c (scm_class_of, create_standard_classes): Add a class for foreign values. * libguile/evalext.c (scm_self_evaluating_p): Add case for foreign values. * libguile/Makefile.am: Add foreign.[ch] to the build. 2010-01-03 Ludovic Courtès <ludo@gnu.org> Update `.gitignore'. Add per-directory Emacs local variables. 2010-01-03 Ludovic Courtès <ludo@gnu.org> Remove dependency on GNU Make and reliance on /usr/bin/env. Both were introduced in commit c55cb58a ("integrate guile-lib docs"). * doc/ref/Makefile.am ($(snarf_doc)scmfiles): Rename target to... ($(snarf_doc)-scmfiles): ... this. Change to generate a makefile snippet containing a variable definition. Automake-include the generated snippet, `standard-library.am'. (EXTRA_DIST): Add `$(snarf_doc).am'. (CLEANFILES): Remove `$(snarf_doc)scmfiles'. * doc/ref/make-texinfo.scm: Remove executable bit and "#!/usr/bin/env". * doc/ref/standard-library.am: New file. 2010-01-03 Andy Wingo <wingo@pobox.com> rename goto/args and friends to tail-call, tail-apply, etc * libguile/vm-i-system.c (tail-call, tail-call/nargs, tail-apply) (tail-call/cc): Rename these back to tail-* from goto/*. We should reserve the rename-then-goto name for when you actually do a rename and goto, not when you shuffle the stack. * doc/ref/vm.texi: * module/language/glil/decompile-assembly.scm: * module/language/tree-il/compile-glil.scm: * test-suite/tests/tree-il.test: Adapt all callers and documentation. 2010-01-03 Andy Wingo <wingo@pobox.com> add truncated-print tests * doc/ref/misc-modules.texi (Pretty Printing): Fix an error in truncated-print example. * test-suite/Makefile.am: * test-suite/tests/print.test: Add truncated-print tests. 2010-01-03 Andy Wingo <wingo@pobox.com> fix bug in generalized-vector->list * libguile/generalized-vectors.c (scm_generalized_vector_to_list): Fix bug iterating over indices of array. Thanks to Tristan Colgate for the report. * test-suite/tests/srfi-4.test: Add tests that uniform-vector->list works for all kinds of uniform vectors. 2010-01-03 Julian Graham <julian.graham@aya.yale.edu> Support for Unicode string normalization functions * libguile/strings.c, libguile/strings.h (normalize_str, scm_string_normalize_nfc, scm_string_normalize_nfd, scm_normalize_nfkc, scm_string_normalize_nfkd): New functions. * test-suite/tests/strings.test: Unit tests for `string-normalize-nfc', `string-normalize-nfd', `string-normalize-nfkc', and `string-normalize-nfkd'. * doc/ref/api-data.texi (String Comparison): Documentation for normalization functions. 2009-12-29 Andy Wingo <wingo@pobox.com> cleanups to debugger * module/system/vm/debug.scm (debugger-repl): Remove the `bindings' command, it is superseded by `locals'. Update the TODO. (debug-pre-unwind-handler): Remove scary "beta" warning. Already being able to bt #:width 1000 #:full? #t is quite useful... debugger's backtrace implemented in scheme * module/system/vm/debug.scm (print-locals): Factor out to a function. (collect-frames, print-frames): Implement the guts of `backtrace' in Scheme. (debugger-repl): Add #:width and #:full? options to `backtrace'. Backtrace uses the backtrace code implemented in scheme. frames.c no longer exports frame-source -- frame.scm does so already * libguile/frames.c (scm_frame_source): No longer exported to Scheme via init's call to scm_init_frames; in fact just calls the Scheme version. Perhaps this function is on its way out, though :) ~:@y allows for truncation to an absolute maximum width * module/ice-9/format.scm (format): Allow ~:@y to interpret the width as the maximum width, inclusive of whatever else has already been output. * doc/ref/misc-modules.texi (Formatted Output): Document this. integers at debugger select frames * module/system/vm/debug.scm (debugger-repl): Fix implementation of frame-at-index. Allow integers as commands, as a shorthand for "frame N". 2009-12-29 Andy Wingo <wingo@pobox.com> clean up (system vm frames), add locals command to debugger * libguile/frames.c (scm_init_frames): No need to bootstrap the VM here, it should be already bootstrapped by init.c. (scm_bootstrap_frames): No need to register an extension, as scm_init_frames is called by init.c. * module/system/vm/frame.scm: Don't load the scm_init_frames extension, as the primitives from frames.c are loaded by Guile's init. (frame-bindings): Change to return bindings, as can be accessed by the binding: accessors from program.scm. (frame-lookup-binding): Revive and make this one work with current code. (frame-binding-set!): (frame-binding-ref): Use the new frame-lookup-binding. Perhaps these should handle boxing and unboxing, though. (frame-source): New accessor, returns a source object. (frame-call-representation): Change to return a full list, as truncated-print can truncate for us. (frame-environment, frame-object-binding, frame-object-name): Update not to take an address, as the address is part of the frame. (frame-variable-exists?, frame-variable-ref, frame-variable-set!) (frame-local-variables, frame-program-name, print-frame) (print-frame-chain-as-backtrace, frame-file, frame-line-number) (make-frame-chain, bootstrap-frame?, frame-number, frame-address): Remove these outdated functions. * module/system/vm/debug.scm (debugger-repl): Use frame-call-representation, and ~@y. (locals): New command, prints local variables in a frame. 2009-12-29 Andy Wingo <wingo@pobox.com> add ~@y truncated printing directive to format * doc/ref/misc-modules.texi (Formatted Output): Add documentation for the new ~@y format directive. (Pretty Printing): Add documentation for truncated-write. * module/ice-9/format.scm (format): Add ~@y, for doing a truncated print. Also, allow both ~y variants to take a width parameter. 2009-12-29 Andy Wingo <wingo@pobox.com> add truncated-print to (ice-9 pretty-print) * module/ice-9/pretty-print.scm (pretty-print): Rework so "port" is the kwarg, and "port*" is the optional arg. #:port is still the keyword. (truncated-print): Add a printer that will ensure that the output stays within a certain width. It could use genwrite but it doesn't because it seems nice to allow breadth-first allocation of screen space, and it's also nice to balance some delimiters (e.g. #< and >). 2009-12-29 Andy Wingo <wingo@pobox.com> fix bug in string array implementation type mask * libguile/strings.c (SCM_ARRAY_IMPLEMENTATION): The mask for the string array implementation should be 0x7f, without masking out 0x2. Otherwise numbers were being thought to be vectors! * test-suite/tests/unif.test: Add test. * libguile/vectors.c (SCM_ARRAY_IMPLEMENTATION): Only register one implementation, because weak vectors can be checked with the mask & ~2, and the functions are the same. 2009-12-29 Michael Gran <spk121@yahoo.com> Add documentation for scm_c_upcase et al * doc/ref/api-data.texi: document scm_c_upcase, scm_c_downcase, scm_c_titlecase, and scm_t_wchar 2009-12-28 Andy Wingo <wingo@pobox.com> pretty-print is a lambda* * module/ice-9/pretty-print.scm (pretty-print): Fix to always be a define*. Shouldn't change behavior, but it will be more introspectible. fix bug bindings lexical vars within optargs initializers * module/language/tree-il/analyze.scm (analyze-lexicals): Fix bug in which variables bound within inits were being improperly allocated. * module/language/tree-il/compile-glil.scm (vars->bind-list): More detail in terrible debugging clause. * test-suite/tests/optargs.test ("lambda* inits"): Add tests for binding vars within inits. Merge branch 'read-fix' 2009-12-28 Andy Wingo <wingo@pobox.com> Fix bugs reading long tokens The commit "don't take string-write mutex in read.c:read_token", from 8b0d7b9d94b9f142dc4f08ce12b345321359b3cd, had a number of bugs. Not sure how I missed these before. * libguile/read.c (read_token): Remove a couple of bogus scm_i_string_stop_writing () calls, now that we no longer take the string-write mutex. (read_complete_token): read_token really needs a fresh buffer, which was not the case when we are reading long tokens and thus hit the overflow case. Fixes fractions.test. 2009-12-28 Andy Wingo <wingo@pobox.com> fix defmacro* * module/ice-9/optargs.scm (defmacro*): Fix implementation -- defmacro* takes Lisp-like arguments. (defmacro*-public): Fix also, expanding into defmacro*. * THANKS: Thanks to Tristan Colgate for the report. * test-suite/tests/optargs.test: Add defmacro* tests. 2009-12-28 Andy Wingo <wingo@pobox.com> (syntax foo) -> #'foo in boot-9 * module/ice-9/boot-9.scm: Change instances of (syntax foo) to use the reader macro #'. 2009-12-28 Michael Gran <spk121@yahoo.com> Incorrect indexing into character name list When converting a character into a character name, an incorrect character name could theoretically have been returned. * libguile/chars.c (scm_i_charname): used wrong index into scm_alt_charnames 2009-12-28 Neil Jerram <neil@ossau.uklinux.net> Automatic manual updates following libguile docstring changes Affecting the following procedures: * doc/ref/api-compound.texi (Uniform Numeric Vectors): uniform-array-read! * doc/ref/api-data.texi (Complex): make-rectangular, string=?, string<?, string<=?, string>?, string>=?, string-ci=?, string-ci<?, string-ci<=?, string-ci>?, string-ci>=?, string-append/shared * doc/ref/api-evaluation.texi (Reader Extensions): read-hash-extend * doc/ref/api-procedures.texi (Procedures with Setters): procedure, macro?, macro-type * doc/ref/api-undocumented.texi: module-import-interface, %method-more-specific? * doc/ref/new-docstrings.texi: uniform-array->bytevector, %start-stack, guardian-destroyed?, guardian-greedy?, destroy-guardian!, gc-dump, gc-disable, gc-enable, make-generalized-vector, set-primitive-generic!, nl-langinfo, %warn-autocompilation-enabled, make-syncase-macro, make-extended-syncase-macro, syncase-macro-type, syncase-macro-binding, memoize-expression, unmemoize-expression, memoized-expression-typecode, memoized-expression-data, memoized-typecode, memoize-variable-access!, module-local-variable, module-variable, eval-closure-module, module-transformer, module-public-interface, define!, module-reverse-lookup, cddr, make-promise, %get-stack-size, %string-dump, %symbol-dump, string-bytes-per-char, uniform-vector-element-type, uniform-vector-element-size, canonicalize-path, getrlimit, setrlimit * doc/maint/guile.texi: Corresponding tracking updates. 2009-12-27 Neil Jerram <neil@ossau.uklinux.net> Doc for getsid * NEWS: Note new getsid primitive. * doc/ref/posix.texi (Processes): Document getsid. 2009-12-27 Neil Jerram <neil@ossau.uklinux.net> Add support for getsid * configure.ac: Check availability of getsid() C library call. * libguile/posix.c (scm_getsid): New primitive. * libguile/posix.h: Declaration for new primitive. 2009-12-24 Julian Graham <julian.graham@aya.yale.edu> Support for Unicode general categories * libguile/chars.c, libguile/chars.h (scm_char_general_category): New function. * test-suite/tests/chars.test: Unit tests for `char-general-category'. * doc/ref/api-data.texi (Characters): Documentation for `char-general-category'. 2009-12-24 Andy Wingo <wingo@pobox.com> implement up, down, frame, and bindings in the repl * module/system/vm/debug.scm (debugger-repl): Implement up, down, frame, and bindings using the new command infrastructure. rewrite debugger command loop * module/system/vm/debug.scm: Rewrite the command loop to have better introspection and argument handling. 2009-12-23 Andy Wingo <wingo@pobox.com> keyword arg errors throw to 'keyword-argument-error * libguile/vm-engine.c (VM_NAME): Keyword arg errors are now thrown to 'keyword-argument-error. * libguile/vm.c: Define sym_keyword_argument_error, and statically allocate some other symbols. * module/ice-9/optargs.scm (parse-lambda-case): Throw to 'keyword-argument-error in kwarg error cases. * module/ice-9/psyntax.scm (build-lambda-case): Remove a couple workarounds for the old memoizer. Throw to 'wrong-number-of-args if the lambda-case fails to parse. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/optargs.test: Update expected exceptions. 2009-12-22 Andy Wingo <wingo@pobox.com> implement a silly debugger * module/system/vm/debug.scm: Implement the skeleton of a debugger. Not very useful yet. * module/system/repl/repl.scm (call-with-backtrace): Have the pre-unwind hook drop the user into the debugger. Hopefully we can have something better within a couple weeks. 2009-12-22 Andy Wingo <wingo@pobox.com> fix warning-caught bug in boot-9 * module/ice-9/boot-9.scm: Fix bug caught by warnings. 2009-12-22 Julian Graham <julian.graham@aya.yale.edu> Complete support for version information in Guile's `module' form. * module/ice-9/boot-9.scm (try-load-module, try-module-autoload): Check for version argument and use `find-versioned-module' if present. * module/ice-9/boot-9.scm (find-versioned-module, version-matches?) (module-version, set-module-version!, version-matches?): New functions. * module/ice-9/boot-9.scm (module-type, make-module, resolve-module) (try-load-module, process-define-module, make-autoload-interface) (compile-interface-spec): Add awareness and checking of version information. * doc/ref/api-modules.texi (R6RS Version References): New subsubsection. (General Information about Modules): Explain differences in search process when version references are used. (Using Guile Modules) (Creating Guile Modules): Document `#:version' keyword. 2009-12-22 Julian Graham <julian.graham@aya.yale.edu> Support for renaming bindings on module export. * module/ice-9/boot-9.scm (module-export!, module-replace!) (module-re-export!): Allow members of export list to be pairs, mapping internal names to external ones. * doc/ref/api-modules.texi (Creating Guile Modules): Update documentation for `#:export', `#:export-syntax', `#:replace', `#:re-export', `#:re-export-syntax', `export', and `re-export' to reflect new format for arguments. 2009-12-22 Julian Graham <julian.graham@aya.yale.edu> Improved support for Unicode title case in Guile's string and character APIs. * doc/ref/api-data.texi (Characters): Documentation for `char-titlecase'. * doc/ref/api-i18n.texi (Character Case Mapping): Documentation for `char-locale-titlecase' and `string-locale-titlecase'. * libguile/chars.c, libguile/chars.h (scm_char_titlecase, scm_c_titlecase): New functions. * libguile/i18n.c, libguile/i18n.h (chr_to_case, scm_char_locale_titlecase, str_to_case, scm_string_locale_titlecase): New functions. * libguile/i18n.c (scm_char_locale_downcase, scm_char_locale_upcase, scm_string_locale_downcase, scm_string_locale_upcase): Refactor to share code via chr_to_case and str_to_case, as appropriate. * module/ice-9/i18n.scm (char-locale-title-case, string-locale-titlecase): New functions. * libguile/srfi-13.c (string_titlecase_x): Use uc_totitle instead of uc_toupper. * test-suite/tests/chars.test: Tests for `char-titlecase'. * test-suite/tests/i18n.test: Tests for `char-locale-titlecase' and `string-locale-titlecase'. * test-suite/tests/srfi-13.test: Tests for `string-titlecase'. 2009-12-22 Andy Wingo <wingo@pobox.com> untabify boot-9.scm * module/ice-9/boot-9.scm: Untabify. 2009-12-21 Andy Wingo <wingo@pobox.com> tracing at repl * module/system/repl/command.scm (option, trace): Integrate tracing (via ,trace or ,tr). (system vm trace) sorta working * module/system/vm/trace.scm: Update to work with the current VM and its tracing infrastructure. don't take string-write mutex in read.c:read_token * libguile/read.c (read_token): Don't take the string-write mutex when reading a token into a buffer, because it's assumed that the buffer is fresh (not seen by other threads), and a soft port can call a procedure that needs the string-write mutex. 2009-12-21 Andy Wingo <wingo@pobox.com> rework vm tracing * libguile/vm-engine.c (VM_NAME): Engines take the VM itself (not the vp), so they can pass the VM to hooks. No more hook args, we dispatch without them. * libguile/vm-engine.h (RUN_HOOK): Dispatch the hook if the trace level is positive (instead of if the hook is there). Don't cache registers on return from the dispatch. * libguile/vm.h: * libguile/vm.c (vm_dispatch_hook): Don't bother with a dynwind; instead decrement the trace level when going into a hook, and if we have a nonlocal exit, the trace level never gets incremented again. Worse is better. (make_vm, scm_vm_trace_level, scm_set_vm_trace_level_x): New concept, trace level. If positive, we run the hooks, otherwise we don't. Should work. Removed scm_vm_trace_frame, I don't think that was the right way to do it. * module/system/vm/vm.scm: Replace vm-trace-frame with vm-trace-level and set-vm-trace-level!; the hooks actually get the frame as an argument now. 2009-12-21 Andy Wingo <wingo@pobox.com> add scm_call_n, scm_c_run_hookn * libguile/eval.h: * libguile/eval.c (scm_call_n): New function, applies a function to an array of args. * libguile/hooks.h: * libguile/hooks.c (scm_c_run_hookn): New function, runs a hook with an array of args. 2009-12-21 Andy Wingo <wingo@pobox.com> remove "module system quirks" from the manual * doc/ref/api-modules.texi (Module System Quirks): Remove this outdated section. 2009-12-21 Neil Jerram <neil@ossau.uklinux.net> Placeholders for expected remaining Intro sections * doc/ref/intro.texi (Introduction): Add menu entries and sections for `Guile and the GNU Project', `Interactive Programming' and `Supporting Multiple Languages'. More intro text on combining with C code * doc/ref/intro.texi (Combining with C): New paragraph. 2009-12-21 Andy Wingo <wingo@pobox.com> poor man's statprof integration with the repl: ,pr * module/system/repl/command.scm (profile): Add a very poor integration of statprof with the repl. add test suites integrate guile-lib docs texinfo fixes * module/texinfo.scm (parser-error): Throw to 'parser-error, as ssax's input-parse does. (texi-command-depth): Fix docstring so as not to confuse emacs. (parse-table-args): Fix parser-error call to include port. tweaks to statprof * module/statprof.scm (make-call-data): Change so that call-data holds the proc, not its name. Remove set-call-data-name!. (get-call-data): Adapt caller. (sample-stack-procs): Always sample procedures on the stack, even anonymous ones. (profile-signal-handler): Fix stack cutting to work with compiled statprof.scm. (count-call): Always count calls, even to anonymous procedures. (statprof-call-data->stats): Use call-data-printable for printing the call data. (statprof-display-anomolies): Fix a couple longstanding bugs caught by compiler warnings. 2009-12-21 Andy Wingo <wingo@pobox.com> import statprof, sxml, and texinfo from guile-lib * module/Makefile.am (LIB_SOURCES): Add statprof, sxml, and texinfo to the build. (NOCOMP_SOURCES): Reindent, and add the upstream SSAX files. * module/statprof.scm: * module/sxml/apply-templates.scm: * module/sxml/fold.scm: * module/sxml/simple.scm: * module/sxml/ssax.scm: * module/sxml/ssax/input-parse.scm: * module/sxml/transform.scm: * module/sxml/upstream/COPYING.SSAX: * module/sxml/upstream/SSAX.scm: * module/sxml/upstream/SXML-tree-trans.scm: * module/sxml/upstream/SXPath-old.scm: * module/sxml/upstream/assert.scm: * module/sxml/upstream/input-parse.scm: * module/sxml/xpath.scm: * module/texinfo.scm: * module/texinfo/docbook.scm: * module/texinfo/html.scm: * module/texinfo/indexing.scm: * module/texinfo/plain-text.scm: * module/texinfo/reflection.scm: * module/texinfo/serialize.scm: * module/texinfo/string-utils.scm: Add files from guile-lib to Guile. It's only Richard, Andreas, Rob, and myself that have copyright on these, and we have all assigned to the FSF. SSAX itself is in the public domain. 2009-12-20 Andy Wingo <wingo@pobox.com> version.h depends on config.status * libguile/Makefile.am (version.h): Depend on config.status, so if we reconfigure we make sure to regenerate the version. handle interrupts in mv-call, return/values * libguile/vm-i-system.c (mv-call, return/values): Interrupt before entering and leaving MV frames as well as normal frames. remove scm_add_method * libguile/goops.h: * libguile/goops.c (scm_add_method): Remove this function. It didn't work, and even if we fixed it to work it wouldn't be as good as using Scheme's `add-method!'. guile-config depends on config.status * meta/Makefile.am (guile-config): Depend on config.status, so that if $prefix changes, guile-config gets rebuilt. in the load path, look in library-dir before site-dir * libguile/load.c (scm_init_load_path): Search first in Guile's version-specific path (the library path), *then* in the site dir. This should allow us to import some of Guile-lib's modules into Guile, perhaps customizing them with Guile-version-specific foo, without accidentally falling back to system-installed guile-lib in the sitedir. Also should reduce the number of stats by half, in the common case. 2009-12-20 Andy Wingo <wingo@pobox.com> psyntax's labels and marks now unique over a read/write boundary * module/ice-9/psyntax.scm (gen-label, new-mark): Labels and marks need to be unique across read/write boundaries -- it's not sufficient for them to simply be unique within a process by virtue of (string #\i) constructing a new object. This used to mostly work before, because the collapsing of duplicate constants didn't catch many syntax-object cases -- but for some reason the attached test case brings out the problem. So switch to use gensyms. Potentially more costly, but it's what upstream psyntax does now. This bug took me fully two days to figure out. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("serializable labels and marks"): Add test case. 2009-12-20 Neil Jerram <neil@ossau.uklinux.net> Typo and formatting * doc/ref/intro.texi (Introduction): "onScheme" -> "on Scheme". Add blank lines around @itemize block - looks better in Info. 2009-12-20 Neil Jerram <neil@ossau.uklinux.net> Remove obsolete and empty Tcl/Tk file * doc/ref/Makefile.am (guile_TEXINFOS): Remove tcltk.texi. * doc/ref/tcltk.texi: Deleted. 2009-12-20 Neil Jerram <neil@ossau.uklinux.net> More about Guile's relationship to Scheme standards Also continue adding a bit more structure to the introductory "what is Guile" material. * doc/ref/intro.texi (Introduction): Split `What is Guile?' (which is a bad heading, since we've already answered that...) into `Guile and Scheme' and `Combining with C'. Further splits will follow, to cover the other toplevel bullet points. (Guile and Scheme): Remove `packaged for use in a wide variety of environments', as I don't see what this can mean to the reader at this point. Add text about R6RS and SRFIs. 2009-12-20 Neil Jerram <neil@ossau.uklinux.net> Format `Revised^n' more nicely in TeX * doc/ref/intro.texi (Introduction): Format Revised^n differently for TeX. 2009-12-19 Neil Jerram <neil@ossau.uklinux.net> Document need for pkg-config to build Guile * README: Say that ./configure needs pkg-config; why; and how to work around it. 2009-12-19 Neil Jerram <neil@ossau.uklinux.net> New introductory text about Guile * doc/ref/guile.texi (Top): Rename `Introduction to Guile' as just `Introduction'. * doc/ref/intro.texi: Add new introductory text. [Not yet complete] * doc/ref/preface.texi (Preface): Update for chapter renaming. 2009-12-19 Neil Jerram <neil@ossau.uklinux.net> Move Conventions section to after `Reporting Bugs' (Reporting Bugs fits better immediately after the tour of how to use Guile) * doc/ref/intro.texi: Move `Manual Conventions' to after `Reporting Bugs', and rename to `Typographical Conventions'. 2009-12-19 Neil Jerram <neil@ossau.uklinux.net> Move "Discouraged and Deprecated" from Introduction to API chapter * doc/ref/intro.texi (Discouraged and Deprecated): Move from here... * doc/ref/api-discdepr.texi: ...to new file here. * doc/ref/guile.texi: Include api-discdepr.texi, and include `Discouraged and Deprecated' in API chapter menu. * doc/ref/Makefile.am (guile_TEXINFOS): Add api-discdepr.texi. 2009-12-19 Neil Jerram <neil@ossau.uklinux.net> Remove page breaks except before new chapters and indices * doc/ref/api-binding.texi, doc/ref/api-compound.texi, doc/ref/api-control.texi, doc/ref/api-data.texi, doc/ref/api-debug.texi, doc/ref/api-evaluation.texi, doc/ref/api-i18n.texi, doc/ref/api-io.texi, doc/ref/api-memory.texi, doc/ref/api-modules.texi, doc/ref/api-options.texi, doc/ref/api-overview.texi, doc/ref/api-procedures.texi, doc/ref/api-scheduling.texi, doc/ref/api-smobs.texi, doc/ref/api-translation.texi, doc/ref/api-utility.texi, doc/ref/expect.texi, doc/ref/libguile-concepts.texi, doc/ref/libguile-program.texi, doc/ref/misc-modules.texi, doc/ref/repl-modules.texi, doc/ref/scheme-debugging.texi, doc/ref/scheme-reading.texi, doc/ref/scheme-scripts.texi, doc/ref/script-getopt.texi, doc/ref/scsh.texi, doc/ref/srfi-modules.texi: Remove @page before @section. Remove obsolete material about GH * doc/ref/extend.texi: Delete. 2009-12-19 Neil Jerram <neil@ossau.uklinux.net> Streamline the manual's Preface material (The principle here is that Preface should only contain meta-information about the manual, such as how to use it and who wrote it; plus any political points that we want to draw attention to.) * doc/ref/preface.texi (Preface): Make unnumbered, for consistency with other GNU manuals (e.g. Emacs, GSL). Merge layout text into top level. Simplify first sentence. Move section on conventions away... * doc/ref/intro.texi (Introduction to Guile): ...to here. 2009-12-18 Neil Jerram <neil@ossau.uklinux.net> Update and simplify statement about RnRS support * doc/ref/scheme-intro.texi (Guile Scheme): Mention R6RS as well as R5RS. Simplify text. 2009-12-18 Brian Gough <bjg@network-theory.co.uk> make the use of the 5-argument @xref command consistent A few of the @xref references to external manuals in the documentation are using an old 4-argument form that produces an undefined reference in the printed manual. The following patch makes them consistent with the 5-argument @xrefs used elsewhere in the manual. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 6ca0417830dc5a98699a15808591dc1f2a90dfac Mon Sep 17 00:00:00 2001 From: Brian Gough <bjg@gnu.org> Date: Mon, 14 Dec 2009 21:34:59 +0000 Subject: [PATCH] make the use of the 5-argument @xref command consistent when referring to other manuals. 2009-12-18 Ken Raeburn <raeburn@raeburn.org> Allow more characters in coding system names in Emacs-style declarations. * libguile/read.c (scm_i_scan_for_encoding): Allow more punctuation symbols in coding system names. 2009-12-18 Brian Gough <bjg@network-theory.co.uk> more typo fixes More spelling corrections and fixes for doubled words (e.g. "the the") -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 7be02beedc739c32cce2c8ec8f4ac814c994a13f Mon Sep 17 00:00:00 2001 From: Brian Gough <bjg@gnu.org> Date: Mon, 14 Dec 2009 22:06:22 +0000 Subject: [PATCH] fix various documentation typos (spelling & doubled words) 2009-12-18 Brian Gough <bjg@network-theory.co.uk> typo fix Correction for garbled sentence. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From f819b597a46ad4ed23597e5a81d1acab46f15147 Mon Sep 17 00:00:00 2001 From: Brian Gough <bjg@gnu.org> Date: Mon, 14 Dec 2009 20:04:34 +0000 Subject: [PATCH] typo fix 2009-12-18 Brian Gough <bjg@network-theory.co.uk> added brief introduction about SLIB This patch adds a short introduction to the SLIB section of the manual with a link to the SLIB homepage. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From 60548b6e039bf57694b7841996cfda011cb8a4bf Mon Sep 17 00:00:00 2001 From: Brian Gough <bjg@gnu.org> Date: Mon, 14 Dec 2009 20:49:27 +0000 Subject: [PATCH] added brief introduction about SLIB 2009-12-18 Brian Gough <bjg@network-theory.co.uk> Hash Table examples - hashq takes different number of arguments In the "Hash Tables Example" in the manual, hashq needs 2 arguments instead of 1 (patch below). I've updated the hash table output as well to match the current version. -- Brian Gough Network Theory Ltd, Publishing Free Software Manuals --- http://www.network-theory.co.uk/ >From fdb6101d2e064620746ebfc9f9cd28bbdd2470e8 Mon Sep 17 00:00:00 2001 From: Brian Gough <bjg@gnu.org> Date: Mon, 14 Dec 2009 19:59:32 +0000 Subject: [PATCH] update docs for Hash Table Examples hashq now takes two arguments order of elements in hash table is different now 2009-12-18 Brian Gough <bjg@gnu.org> replace ascii figures with scalable ps/pdf versions. use ascii figures in HTML output, to work around deficiency in makeinfo where images are not copied to target directory. use explicit ./scriptname to help novice users use correct url to ftp.gnu.org 2009-12-15 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.6. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Remove unneeded #include <assert.h>. * libguile/backtrace.c, libguile/eval.c, libguile/gc.c, libguile/goops.c, libguile/memoize.c, libguile/threads.c, libguile/uniform.c, libguile/vm.c, test-suite/standalone/test-conversion.c, test-suite/standalone/test-list.c: Don't include <assert.h>. 2009-12-15 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `sys_stat' module; update Gnulib. * .x-sc_prohibit_S_IS_definition: New file. * m4/gnulib-cache.m4: Add `sys_stat'. * libguile/filesys.c: Remove `S_IS*' macro definitions for Ultrix and MinGW. 2009-12-15 Ludovic Courtès <ludo@gnu.org> Remove obsolete test-suite makefile snippets. * test-suite/Makefile.am (SCM_TESTS_DIRS): Remove. (dist-hook): Remove target. Disable thread-local storage on Solaris 8. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Special-case `*solaris2.8'. Change the Elisp compiler from GPLv2+ to LGPLv3+. * module/language/elisp/bindings.scm, module/language/elisp/lexer.scm, module/language/elisp/parser.scm, module/language/elisp/runtime.scm, module/language/elisp/runtime/function-slot.scm, module/language/elisp/runtime/macro-slot.scm, module/language/elisp/runtime/value-slot.scm: Switch from GPLv2+ to LGPLv3+; fix copyright year. Use portable shell in `meta/uninstalled-env'. * meta/uninstalled-env.in: Don't use the `-q' and `-E' options, which are specific to GNU grep. Don't set-and-export environment variables at once since this is a GNU Bash extension. Use the right `grep' command. * libguile/Makefile.am (.c.i): Use $(GREP), not `grep'. (check_signals, check_errnos): Use $(EGREP), not `egrep'. Remove GNU Make-specific function call. * libguile/Makefile.am (c-tokenize.$(OBJEXT)): Remove use of GNU Make's `filter-out' function. Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' & co. * libguile/bitvectors.c, libguile/srfi-4.c, libguile/strings.c, libguile/vectors.c: Remove extraneous semicolon after `SCM_ARRAY_IMPLEMENTATION' and `SCM_VECTOR_IMPLEMENTATION' invocations. Remove extraneous functions from `AC_REPLACE_FUNCS'. * configure.ac: Remove `inet_aton' and `putenv' from `AC_REPLACE_FUNCS'. 2009-12-15 Ludovic Courtès <ludo@gnu.org> Avoid `SCM_UNPACK ()' in constant expressions. They made Sun C 5.8 emit a warning such as: line 71: warning: dead part of constant expression is nonconstant * libguile/print.c (scm_print_opts): Don't use `SCM_UNPACK ()' here. * libguile/read.c (scm_read_opts): Likewise. 2009-12-15 Ludovic Courtès <ludo@gnu.org> Remove `return' from `void' function. * libguile/print.c (scm_print_symbol_name): Remove `return' statement. 2009-12-15 Ludovic Courtès <ludo@gnu.org> Don't use GCC zero-length arrays. * libguile/frames.c, libguile/objcodes.c, libguile/programs.c, libguile/vm-engine.c, libguile/vm-i-system.c, libguile/vm.c: Use `SCM_C_OBJCODE_BASE ()' instead of accessing the `base' field of `struct scm_objcode'. * libguile/objcodes.h (struct scm_objcode)[base]: Remove. 2009-12-15 Ludovic Courtès <ludo@gnu.org> Remove uses of the non-standard `__FUNCTION__'. * libguile/gc.c (scm_gc_sweep): Replace `__FUNCTION__' by `FUNC_NAME'. * libguile/read.c (scm_read_r6rs_block_comment): Likewise. 2009-12-15 Andy Wingo <wingo@pobox.com> expose frame-previous, once again * libguile/frames.h: * libguile/frames.c (scm_frame_previous): Rename from scm_c_frame_prev, and expose to Scheme. Skip boot frames. * libguile/stacks.c (stack_depth, narrow_stack, scm_make_stack) (scm_stack_ref): Adjust for scm_frame_previous skipping boot frames. 2009-12-14 Ludovic Courtès <ludo@gnu.org> Fix test environment issue with ltdl from Libtool 2.2.6b. Earlier versions of ltdl would look for extensions under $PWD; this behavior changed in 2.2.6b. * test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Define $builddir. * test-suite/standalone/test-asmobs: Specify the full path to `libtest-asmobs', using $builddir. * test-suite/standalone/test-extensions: Likewise. 2009-12-13 Andy Wingo <wingo@pobox.com> more NEWS updates * NEWS: Update some more. 2009-12-13 Andy Wingo <wingo@pobox.com> primitive-eval passes first N args on stack directly, not via apply * libguile/memoize.c (MAKMEMO_CALL): Memoize in the number of arguments at the call site. (memoize, scm_m_cond, memoize_named_let, unmemoize): * libguile/eval.c (eval): Adapt to changes in call memoization. * module/ice-9/eval.scm (primitive-eval): For calls, pass the first N arguments directly on the stack, and only the rest as a consed argument list to apply. Currently N is 4. 2009-12-13 Andy Wingo <wingo@pobox.com> interpreted closures cons less. * module/ice-9/eval.scm (primitive-eval): When making a closure with N formals, actuall return a closure with N formals, if N is less than *max-static-argument-count*, which currently is 8. If N is greater than 8, do the arg-parsing loop as we did before. Requires some macrology, but should reduce unnecessary consing for interpreted closures. * test-suite/tests/goops.test: * test-suite/tests/hooks.test: Now that checks like (thunk? foo) are going to work as a for interpreted code, remove some (throw 'unresolved). 2009-12-12 Andy Wingo <wingo@pobox.com> commit draft of NEWS lame tweak to the inliner * module/language/tree-il/inline.scm: Tweak to avoid a (if #t #t #f). Yes, it's lame. prepare NEWS for 1.9.6 * NEWS: Prepare NEWS for 1.9.6. 2009-12-11 Ludovic Courtès <ludo@gnu.org> Tweak the "unused modules are removed" test. * test-suite/tests/gc.test ("gc")["unused modules are removed"]: Add loop to clean up stale references from the stack. SRFI-1: Use the built-in optional argument support. * module/srfi/srfi-1.scm (iota, unfold, unfold-right, alist-delete, alist-delete!): Use `define*' and optional arguments instead of rest arguments. Fix expansion of `(+ 1 x)'. * module/language/tree-il/primitives.scm (+): Fix typo. Typo. * test-suite/Makefile.am (SCM_TESTS): Fix typos: `.text' -> `.test'. SRFI-9: Make accessors inlinable. * module/srfi/srfi-9.scm (define-inlinable): New macro. (define-record-type): Use it. SRFI-9: Reimplement in terms of structs, using `syntax-case'. * module/srfi/srfi-9.scm (define-record-type): Rewrite to use raw structs instead of records. Use `syntax-case' instead of `define-macro'. 2009-12-11 Ludovic Courtès <ludo@gnu.org> Add struct & vector benchmarks. * benchmark-suite/benchmarks/structs.bm, benchmark-suite/benchmarks/vectors.bm: New files. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add. * benchmark-suite/benchmarks/bytevectors.bm: Fix copyright. 2009-12-11 Ludovic Courtès <ludo@gnu.org> Add opcodes for `struct?', `struct-vtable', and `make-struct'. * libguile/vm-engine.c (VM_NAME)[vm_error_not_a_struct]: New label. * libguile/vm-i-scheme.c (VM_VALIDATE_STRUCT): New macro. (struct_p, struct_vtable, make_struct): New instructions. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add `struct?', `struct-vtable', and `make-struct'. * module/language/tree-il/primitives.scm (*interesting-primitive-names*, *effect-free-primitives*): Likewise. 2009-12-11 Andy Wingo <wingo@pobox.com> vm no longer measures bogoclock or times, relies on os for that * libguile/vm.h (struct scm_vm): Remove "time" and "clock" members. The time was bogusly measured, and the "clock" measured instructions retired, which is not a very useful measurement, and it was causing lots of memory accesses. Not that I have done a proper profile, though... (scm_vm_stats): Remove this procedure, which provided access to "time" and "clock". * libguile/vm.c: * libguile/vm-engine.h: * libguile/vm-engine.c: * libguile/vm-i-system.c: Adapt to scm_vm changes and scm_vm_stats removal. * module/system/repl/command.scm: * module/system/vm/vm.scm: Adapt to vm-stats removal by removing vm-stats from <repl>. 2009-12-11 Andy Wingo <wingo@pobox.com> inline calls to (memv foo CONSTANT-LIST) * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Recognize memv and memq as well. * module/language/tree-il/inline.scm (inline!): Inline calls to memq and memv where the list is a constant. 2009-12-11 Andy Wingo <wingo@pobox.com> rename <conditional> then and else to consequent and alternate * module/language/tree-il.scm (<tree-il>): Rename the "then" and "else" clauses of <conditional> to "consequent" and "alternate". More verbose, yes, but that way we avoid unexpected behavior with "else". (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold): (make-tree-il-folder, post-order!, pre-order!) * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (flatten): * module/language/tree-il/fix-letrec.scm (simple-expression?): Update callers. 2009-12-11 Andy Wingo <wingo@pobox.com> rename lambda-case-else to lambda-case-alternate * module/language/tree-il.scm (<tree-il>): Rename the "else" field of <lambda-case> to "alternate". Conflicts less with the "else" keyword as used by case, cond, record-case, pmatch, etc. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold) (make-tree-il-folder, post-order!, pre-order!): Adapt traversal operators for <lambda-case> change. * module/language/tree-il/analyze.scm (analyze-lexicals) (validate-arity): * module/language/tree-il/compile-glil.scm (flatten): * module/language/tree-il/inline.scm (inline!): Adapt for <lambda-case> change. 2009-12-11 Andy Wingo <wingo@pobox.com> vm: handle interrupts on backwards jumps * libguile/vm-i-system.c (BR, br): Handle interrupts on backwards jumps, so we can Ctrl-C an endless loop. less overhead for handling interrupts in the vm * libguile/__scm.h (SCM_ASYNC_TICK): Add some branch prediction. (SCM_ASYNC_TICK_WITH_CODE): New helper for when BUILDING_LIBGUILE, runs code only if we're going to call async_click(). * libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): New helper, uses SCM_ASYNC_TICK_WITH_CODE to only save regs if we'll handle an interrupt. * libguile/vm-i-system.c (call, goto/args, return): use VM_HANDLE_INTERRUPTS. 2009-12-11 Andreas Rottmann <a.rottmann@gmx.at> add partial support for tail patterns in syntax-rules/syntax-case I've prepared a patch that adds partial support for tail patterns. Things like the the SRFI-34 `guard' macro from [0] are supported, but you still can't combine dotted patterns with tail patterns, e.g. (syntax-rules (else) ((foo bar ... (else something) . rest) <TEMPLATE-HERE>)) will *not* work; there's the issue that one can't just transcribe the implementation of this feature from the latest version of psyntax, as I've done for non-dotted tail patterns, as it's implemented using a dotted pattern like the above. Alas! [0] <http://article.gmane.org/gmane.lisp.guile.devel/9442> * module/ice-9/psyntax.scm (syntax-case, $sc-dispatch): Add support for tail patterns, transcribed from the latest psyntax. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test: Add tests for tail patterns. 2009-12-11 Andy Wingo <wingo@pobox.com> merge from master to elisp * module/language/elisp/compile-tree-il.scm: Update for changes to tree-il (lambda-case, mainly). * module/language/elisp/spec.scm: Update GPL version to 3. Update reader for new taking a port and environment argument. * libguile/_scm.h: Bump objcode version. * libguile/vm-i-system.c: Fix conflicts. * module/Makefile.am: Fix conflicts, and add elisp modules to the build. 2009-12-10 Andy Wingo <wingo@pobox.com> add ice-9/quasisyntax.scm to NOCOMP_SOURCES * module/Makefile.am (NOCOMP_SOURCES): Add quasisyntax.scm. fix emission of meta procedures * module/language/glil/compile-assembly.scm: Fix the check for when to emit a "meta" procedure. Fixes http://thread.gmane.org/gmane.lisp.guile.user/7469/focus=7470. if we have no eval.go, load no .go * libguile/load.c (scm_init_eval_in_scheme): If we have no eval.go, null out the load-compiled path so that we load no compiled code. Prevents partially compiled Guile from turning tail-calls into stack-munching calls. add gbt macro to gdbinit, and fix a bug in program-arity * gdbinit: Add gbt macro, to make a Guile backtrace whenever you want. * module/system/vm/program.scm (program-arity): If ip is #f, just take the first arity. 2009-12-09 Andy Wingo <wingo@pobox.com> fix arbiter compilation with the generic codepath * libguile/arbiters.c (scm_try_arbiter, scm_release_arbiter): Fix for the generic case; not sure why it wasn't working. fix FUNC_NAME of scm_memoize_variable_access_x * libguile/memoize.c (scm_memoize_variable_access_x): Fix FUNC_NAME definition. 2009-12-08 Andy Wingo <wingo@pobox.com> add SCM_SMOB_TYPE_BITS and SCM_SMOB_TYPE_MASK * libguile/smob.h (SCM_SMOB_TYPE_BITS, SCM_SMOB_TYPE_MASK): New macros, for when you want to identify a SMOB by type and mask. * libguile/arrays.c: * libguile/bitvectors.c: * libguile/srfi-4.c: Use the new macros. 2009-12-08 Andy Wingo <wingo@pobox.com> fix SCM_CELL macro usage. * libguile/vm.h (SCM_VM_CONT_DATA): Fix SCM_CELL macro usage. SCM_CELL in throw.c * libguile/throw.c (JBACTIVE, ACTIVATEJB, DEACTIVATEJB, JBJMPBUF) (SETJBJMPBUF, SCM_JBPREUNWIND, SCM_SETJBPREUNWIND) (pre_unwind_data_print, scm_ithrow): Fix SCM_CELL macro usage. SCM_VALIDATE_SMOB uses SCM_SMOB_PREDICATE * libguile/validate.h (SCM_VALIDATE_SMOB): Change to use SCM_SMOB_PREDICATE instead of SCM_TYP16_PREDICATE. SCM_CELL in srfi-4.c * libguile/srfi-4.c (SCM_UVEC_TYPE, SCM_UVEC_LENGTH, SCM_UVEC_BASE): Fix SCM_CELL macro usage. SCM_CELL in srcprop.c * libguile/srcprop.c (SRCPROPPOS, SRCPROPCOPY, SRCPROPALIST) (SETSRCPROPPOS, SETSRCPROPCOPY, SETSRCPROPALIST): Fix erroneous SCM_CELL macro usage. use the new public metatables from struct.c * libguile/procs.c (scm_init_procs): No need to lookup the applicable-struct-with-setter vtable, as it is now exported. scm_i_alloc_struct does not take a "what" arg * libguile/struct.h: * libguile/struct.c (scm_i_alloc_struct): Change to not take a "what" argument. Callers changed. reserve a vtable flag for smobs. * libguile/struct.h (SCM_VTABLE_FLAG_SMOB_0): Reserve a vtable flag for smobs. add vtable finalizer and printer setter macros * libguile/struct.h (SCM_VTABLE_INSTANCE_FINALIZER): Use DATA_REF, not SLOT_REF. (SCM_SET_VTABLE_INSTANCE_FINALIZER, SCM_SET_VTABLE_INSTANCE_PRINTER): New accessor macros. make some applicable struct vtable-vtable public to C * libguile/struct.h (scm_standard_vtable_vtable) (scm_applicable_struct_vtable_vtable) (scm_applicable_struct_with_setter_vtable_vtable) * libguile/struct.c: Make these stock meta-tables public to C. SCM_CELL in modules.c * libguile/modules.c (SCM_F_EVAL_CLOSURE_INTERFACE) (SCM_EVAL_CLOSURE_INTERFACE_P, scm_standard_interface_eval_closure): Fix to not use SCM_CELL macros. initialize smobs after structs * libguile/init.c (scm_i_init_guile): Move SMOB prehistory after structs init. No effect for now. SCM_CELL in guardians.c * libguile/guardians.c (GUARDIAN_DATA): Fix SCM_CELL macro usage. SCM_CELL in filesys.[ch] * libguile/filesys.h (SCM_DIR_FLAG_OPEN, SCM_DIR_OPEN_P) * libguile/filesys.c (scm_readdir, scm_rewinddir, scm_closedir) (scm_dir_print, scm_dir_free): Fix SCM_CELL macro usage. SCM_CELL in deprecated.c * libguile/deprecated.c (scm_smob_free): Fix SCM_CELL macro usage. fix SCM_CELL macro usage in continuations.[ch] * libguile/continuations.h (SCM_CONTREGS): * libguile/continuations.c (continuation_print): Fix SCM_CELL macro usage. fix SCM_CELL_* macro usage in async.c * libguile/async.c (ASYNC_GOT_IT, SET_ASYNC_GOT_IT, ASYNC_THUNK): Fix SCM_CELL_* macro usage. fix SCM_CELL_* macro usage in arbiters.c * libguile/arbiters.c (scm_try_arbiter, scm_release_arbiter): Fix erroneous SCM_CELL_* macro usage. fix erroneous SCM_CELL_* usage in arrays.[ch] * libguile/arrays.h (SCM_I_ARRAY_FLAG_CONTIGUOUS, SCM_I_ARRAY_NDIM): (SCM_I_ARRAY_CONTP, SCM_I_ARRAY_MEM): * libguile/arrays.c (SCM_SET_ARRAY_CONTIGUOUS_FLAG): (SCM_CLR_ARRAY_CONTIGUOUS_FLAG): Fix macros to use SCM_SMOB macros instead of SCM_CELL macros. 2009-12-08 Andy Wingo <wingo@pobox.com> clean up smob macro implementation * libguile/smob.h: Regularize the SCM_SMOB macros, and make them all go through some generic SMOB accessor macros. * libguile/smob.c (scm_i_set_smob_flags): Remove, as it is unused. 2009-12-07 Andy Wingo <wingo@pobox.com> add scm_c_make_struct[v] * libguile/struct.h (scm_c_make_struct, scm_c_make_structv): New functions with which you can make a struct without consing a rest list. * libguile/struct.c (scm_struct_init): Refactor to take an array of init values, not a list. (scm_make_struct, scm_make_vtable_vtable): Pull the rest arg out into a list and pass it down to the new array-taking functions. * libguile/memoize.c: Remove a neeless #include <alloca>. 2009-12-07 Andy Wingo <wingo@pobox.com> procedures-with-setters implemented in terms of structs * libguile/tags.h (scm_tc7_pws): No more. * libguile/procs.c (scm_procedure_with_setter_p) (scm_make_procedure_with_setter, scm_procedure, scm_setter): Implement procedures-with-setters in terms of applicable structs with setters. * libguile/procs.h: Remove a big, outdated comment, and the deprecated macros. * libguile/deprecated.h (SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE) (SCM_SETTER): Deprecate these. SCM_PROCEDURE and SCM_SETTER are bad names. * libguile/evalext.c (scm_self_evaluating_p): * libguile/gc.c (scm_i_tag_name): * libguile/goops.c: (scm_class_of): * libguile/print.c (iprin1): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p): * libguile/debug.c (scm_procedure_source): Remove a tc7_pws case. * libguile/goops.h: * libguile/goops.c (scm_class_procedure_with_setter): Remove this class; it is subsumed by applicable_struct_with_setter. * libguile/struct.h: Update a comment. * libguile/vm-i-system.c (call, goto/args, mv-call): Remove PWS cases. 2009-12-05 Andy Wingo <wingo@pobox.com> structs are alive early in guile's boot * libguile/init.c (scm_i_init_guile): Reorder deps so structs are initialized early in the boot process. more annotations to scm_i_init_guile * libguile/init.c (scm_i_init_guile): Annotate things that need smobs. 2009-12-05 Andy Wingo <wingo@pobox.com> decruftify scm_sys_protects * libguile/root.h * libguile/root.c (scm_sys_protects): It used to be that for some reason we'd define a special array of "protected" values. This was a little silly, always, but with the BDW GC it's completely unnecessary. Also many of these variables were unused, and none of them were good API. So remove this array, and either eliminate, make static, or make internal the various values. * libguile/snarf.h: No need to generate calls to scm_permanent_object. * guile-readline/readline.c (scm_init_readline): No need to call scm_permanent_object. * libguile/array-map.c (ramap, rafe): Remove the dubious nullvect optimizations. * libguile/async.c (scm_init_async): No need to init scm_asyncs, it is no more. * libguile/eval.c (scm_init_eval): No need to init scm_listofnull, it is no more. * libguile/gc.c: Make scm_protects a static var. (scm_storage_prehistory): Change the sanity check to use the address of protects. (scm_init_gc_protect_object): No need to clear the scm_sys_protects, as it is no more. * libguile/keywords.c: Make the keyword obarray a static var. * libguile/numbers.c: Make flo0 a static var. * libguile/objprop.c: Make object_whash a static var. * libguile/properties.c: Make properties_whash a static var. * libguile/srcprop.h: * libguile/srcprop.c: Make scm_source_whash a global with internal linkage. * libguile/strings.h: * libguile/strings.c: Make scm_nullstr a global with internal linkage. * libguile/vectors.c (scm_init_vectors): No need to init scm_nullvect, it's unused. 2009-12-05 Andy Wingo <wingo@pobox.com> further boot cleanups * libguile/srfi-14.c (define_charset): * libguile/deprecated.c (scm_create_hook): Don't bother making the returned objects (hooks or charsets) into permanent objects; they are already defined, and then the caller probably stores them away too. * libguile/init.c (scm_i_init_guile): Add a couple annotations. 2009-12-05 Andy Wingo <wingo@pobox.com> more boot cleanup * libguile/bytevectors.c (scm_bootstrap_bytevectors): Remove a call to scm_gc_protect_object. * libguile/gc.h: * libguile/gc.c (scm_init_gc_protect_object): Rename from scm_init_storage, and just return void. Make the GC boot procs have internal linkage. * libguile/init.c: Adapt to the name change. 2009-12-05 Andy Wingo <wingo@pobox.com> remove a bunch of needless scm_permanent_object calls * libguile/array-handle.c: * libguile/bytevectors.c: * libguile/deprecated.c: * libguile/eval.c: * libguile/feature.c: * libguile/filesys.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/goops.c: * libguile/instructions.c: * libguile/load.c: * libguile/modules.c: * libguile/numbers.c: * libguile/options.c: * libguile/ports.c: * libguile/scmsigs.c: * libguile/srcprop.c: * libguile/srfi-4.c: * libguile/stacks.c: * libguile/threads.c: * libguile/vm.c: Remove calls to scm_permanent_object, as they are no longer needed with the BDW GC. 2009-12-05 Andy Wingo <wingo@pobox.com> some scm_i_init_guile cleanups * libguile/init.c (scm_i_init_guile): Since hash tables are tc7 objects, things that depend on hash tables no longer depend on smobs, so move smob_prehistory up a bit. No more struct_prehistory. * libguile/struct.h: * libguile/struct.c (scm_struct_prehistory): Remove empty function. 2009-12-05 Andy Wingo <wingo@pobox.com> remove scm_ports_prehistory * libguile/ports.h: * libguile/ports.c (scm_ports_prehistory): Remove this function. Just initialize global vars to NULL/0 instead of needing a prehistory function. add printer for dynamic-states * libguile/fluids.c: * libguile/fluids.h: * libguile/print.c: Add dynamic-state printing infrastructure. 2009-12-05 Andy Wingo <wingo@pobox.com> fluids are tc7 objects If you're wondering what I'm doing, I'm trying to eventually reimplement smobs in terms of structs, so that applicable smobs can just follow the applicable struct dispatch path. But to do that I have to get structs initialized before things that use smobs, which means transforming a bunch of smobby things to tc7 things. But this transformation is good for performance anyway, and we currently have a glut of unused tc7s, so here we go... * libguile/tags.h (scm_tc7_fluid, scm_tc7_dynamic_state): Fluids (and dynamic states) now have tc7s. * libguile/fluids.h: Remove scm_fluids_prehistory, and add internal scm_i_fluid_print. Update a comment. * libguile/fluids.c: Update for tc7 representation. Also remove the next pointers while we're at it, as they aren't used in the new BDW GC. * libguile/eq.c (scm_equal_p): Remove the hashtable case. Hashtables could never be equal? before, I don't see why to add stubs doing the same thing now. * libguile/print.c (iprin1): * libguile/gc.c (scm_i_tag_name): * libguile/evalext.c (scm_self_evaluating_p): Add fluid and dynamic_state cases. * libguile/goops.h: Remove scm_class_hashtable; it will be static. * libguile/goops.c: Make <hashtable> static, and add <fluid> and <dynamic-state> classes. * libguile/hashtab.h: * libguile/hashtab.c: Remove scm_i_hashtable_equal_p. * libguile/init.c (scm_i_init_guile): Remove call to fluids_prehistory. 2009-12-05 Andy Wingo <wingo@pobox.com> hash tables have a tc7 * libguile/tags.h (scm_tc7_hashtable): Allocate a tc7 for hashtables. * libguile/hashtab.h: Adjust macros accordingly. (scm_i_hashtable_print, scm_i_hashtable_equal_p): New internal functions. (scm_hashtab_prehistory): Remove, no more need for this. * libguile/hashtab.c (scm_hash_fn_remove_x): Fix a longstanding bug. (make_hash_table): Adapt to the new hash table representation. * libguile/eq.c (scm_equal_p) * libguile/evalext.c (scm_self_evaluating_p) * libguile/print.c (iprin1) * libguile/gc.c (scm_i_tag_name): Add some tc7_hashtab cases. * libguile/init.c: Remove unused environments init functions. Remove call to hashtab_prehistory. * libguile/goops.h (scm_class_hashtable) * libguile/goops.c (scm_class_of, create_standard_classes): Have to make a class for hash tables manually, because they aren't smobs any more. 2009-12-04 Andy Wingo <wingo@pobox.com> eval.c closures are now applicable smobs, not tc3s * libguile/debug.c (scm_procedure_name): Remove a SCM_CLOSUREP case and some dead code. (scm_procedure_module): Remove. This was introduced a few months ago for the hygienic expander, but now it is no longer needed, as the expander keeps track of this information itself. * libguile/debug.h: Remove scm_procedure_module. * libguile/eval.c: Instead of using tc3 closures, define a "boot closure" applicable smob type, and represent closures with that. The advantage is that after eval.scm is compiled, boot closures take up no address space (besides a smob number) in the runtime, and require no special cases in procedure dispatch. * libguile/eval.h: Remove the internal functions scm_i_call_closure_0 and scm_closure_apply, and the public function scm_closure. * libguile/gc.c (scm_storage_prehistory): No tc3_closure displacement registration. (scm_i_tag_name): Remove closure case, and a dead cclo case. * libguile/vm.c (apply_foreign): * libguile/print.c (iprin1): * libguile/procs.c (scm_procedure_p, scm_procedure_documentation); * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of): Remove tc3_closure/tcs_closure cases. * libguile/hash.c (scm_hasher): * libguile/hooks.c (scm_add_hook_x): Use new scm_i_procedure_arity. * libguile/macros.c (macro_print): Print all macros using the same code. (scm_macro_transformer): Return any procedure, not just programs. * libguile/procprop.h: * libguile/procprop.c (scm_i_procedure_arity): Instead of returning a list that the caller has to parse, have the same prototype as scm_i_program_arity. An incompatible change, but it's an internal function anyway. (scm_procedure_properties, scm_set_procedure_properties) (scm_procedure_property, scm_set_procedure_property): Remove closure cases, and use scm_i_program_arity for arity. * libguile/procs.h (SCM_CLOSUREP, SCM_CLOSCAR, SCM_CODE) (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS) (SCM_CLOSURE_BODY, SCM_PROCPROPS, SCM_SETPROCPROPS, SCM_ENV) (SCM_TOP_LEVEL): Remove these macros that pertain to boot closures only. Only eval.c should know abut boot closures. * libguile/procs.c (scm_closure_p): Remove this function. There is a simple stub in deprecated.scm now. (scm_thunk_p): Use scm_i_program_arity. * libguile/tags.h (scm_tc3_closure): Remove. Yay, another tc3 to play with! (scm_tcs_closures): Remove. * libguile/validate.h (SCM_VALIDATE_CLOSURE): Remove. * module/ice-9/deprecated.scm (closure?): Add stub. * module/ice-9/documentation.scm (object-documentation) * module/ice-9/session.scm (help-doc, arity) * module/oop/goops.scm (compute-getters-n-setters) * module/oop/goops/describe.scm (describe) * module/system/repl/describe.scm (display-object, display-type): Remove calls to closure?. 2009-12-04 Andy Wingo <wingo@pobox.com> remove cxrs * libguile/pairs.h: * libguile/pairs.c: Previously scm_cdadr et al were implemented as #defines that called scm_i_chase_pairs, and the Scheme-exposed functions themselves were cxr subrs, which got special help in the interpreter. Since now the special help is unnecessary (because the compiler inlines and expands calls to car, cdadr, etc), the complexity is a loss. So just implement cdadr etc using normal functions. There's an advantage too, in that the compiler can unroll the cxring, reducing branches. * libguile/tags.h (scm_tc7_cxr): Remove this tag. (scm_tcs_subrs): Now there's only one kind of subr, yay! * libguile/debug.c (scm_procedure_name) * libguile/evalext.c (scm_self_evaluating_p) * libguile/gc.c (scm_i_tag_name) * libguile/goops.c (scm_class_of) * libguile/hash.c (scm_hasher) * libguile/print.c (iprin1) * libguile/procprop.c (scm_i_procedure_arity) * libguile/procs.c (scm_procedure_p, scm_subr_p) (scm_make_procedure_with_setter) * libguile/vm.c (apply_foreign): Remove cxr cases. Replace uses of scm_tcs_subrs with scm_tc7_gsubr. 2009-12-04 Andy Wingo <wingo@pobox.com> remove rpsubrs * libguile/tags.h: Remove rpsubrs (I chose to interpret the terse name as "recursive predicate subrs"). Just use gsubrs with rest arguments, or do a fold yourself. * libguile/array-map.c (scm_i_array_equal_p): Do the comparison in order, why not. * libguile/chars.c: * libguile/eq.c: * libguile/numbers.c: * libguile/strorder.c: Add 0,2,1 gsubr wrappers for rpsubrs like eq?, <, etc. * libguile/goops.c (scm_class_of) * libguile/procprop.c (scm_i_procedure_arity) * libguile/procs.c (scm_thunk_p) * libguile/vm.c (apply_foreign): Remove rpsubr cases. * test-suite/tests/numbers.test ("=", "<"): Turn a couple xfails into passes. 2009-12-03 Andy Wingo <wingo@pobox.com> remove asubrs * libguile/tags.h (scm_tcs_subrs, scm_tc7_asubr): Remove definitions. * libguile/goops.c (scm_class_of) * libguile/procprop.c (scm_i_procedure_arity) * libguile/procs.c (scm_thunk_p) * libguile/vm.c (apply_foreign): Remove cases for asubrs. * libguile/array-map.c: Gut all of the optimizations, because there are no more asubrs, soon won't be rpsubrs, and all of this should happen on the Scheme level, ideally. 2009-12-03 Andy Wingo <wingo@pobox.com> speed up scm_call_N for non-programs * libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3): All of these should dispatch through the VM, without consing. simplify apply_foreign * libguile/vm.c (apply_foreign): Simplify. +, -, min, lcm, gcd now documented * test-suite/tests/numbers.test: Change some xfail documented? tests to passes. change asubrs to be gsubrs * libguile/numbers.h: * libguile/numbers.c (scm_i_gcd, scm_i_lcm, scm_i_logand, scm_i_logior) (scm_i_logxor, scm_i_min, scm_i_max, scm_i_sum, scm_i_difference) (scm_i_product, scm_i_divide): Change asubrs to be gsubrs. + is not an asubr * libguile/numbers.h: * libguile/numbers.c (scm_i_sum): Rework so that scm_sum is just a normal function. Its generic is actually provided by scm_i_sum, a gsubr with rest args. In that way, + is no longer an asubr. 2009-12-03 Andy Wingo <wingo@pobox.com> remove scm_tc7_dsubr * libguile/tags.h: Remove scm_tc7_dsubr. There are no more users of this. * libguile/array-map.c: * libguile/eval.c: * libguile/eval.i.c: * libguile/goops.c: * libguile/procprop.c: * libguile/procs.h: Remove all dsubr cases. 2009-12-03 Andy Wingo <wingo@pobox.com> remove "primitive numerics" from the docs * doc/ref/api-data.texi: Update for $sin deprecation. 2009-12-03 Andy Wingo <wingo@pobox.com> implement transcendental sin, cos etc in c; deprecate $sin, $cos, etc * libguile/deprecated.h: * libguile/deprecated.c (scm_asinh, scm_acosh, scm_atanh): Deprecate these stand-ins for the C99 asinh, acosh, and atanh functions. Guile is not gnulib. (scm_sys_atan2): Deprecate as well, in favor of scm_atan. * libguile/numbers.h: * libguile/numbers.c (scm_sin, scm_cos, scm_tan) (scm_sinh, scm_cosh, scm_tanh) (scm_asin, scm_acos, scm_atan) (scm_sys_asinh, scm_sys_acosh, scm_sys_atanh): New functions, replacing the combination of dsubrs and boot-9 wrappers with C subrs that handle complex values. The latter three have _sys_ in their names due to the name conflict with the deprecated scm_asinh et al. Remove the $abs, $sin etc "dsubrs". * module/ice-9/boot-9.scm: Remove transcendental functions, as this all happens in C now. * module/ice-9/deprecated.scm: Add aliases for $sin et al. * test-suite/tests/ramap.test ("array-map!"): Adjust "dsubr" tests to use sqrt, not $sqrt. They don't actually test dsubrs now. In the two-source test, I'm pretty sure the dsubr array-map! should have been failing, as indeed it does now; I've changed the test case to expect the failure. I'd still like to know why it was succeeding before. 2009-12-03 Andy Wingo <wingo@pobox.com> expt implemented in C, handles complex numbers * libguile/numbers.h: * libguile/numbers.c (scm_expt): Rename from scm_sys_expt, and handle the complex cases as well. * libguile/deprecated.h: * libguile/deprecated.c (scm_sys_expt): Add a deprecated shim. * module/ice-9/boot-9.scm (expt): Remove definition, scm_expt does all we need. 2009-12-03 Andy Wingo <wingo@pobox.com> remove tc7_subr_* and tc7_lsubr_* * libguile/tags.h: Remove tc7 #defines for subrs, replacing them with placeholders. These were public, but hopfully unused. I don't see how to usefully deprecate them. * libguile/array-map.c (scm_array_map_x): Remove special cases for certain subr types. This might make things slower for the moment, otoh, native compilation should moot that question. * libguile/eval.i.c: * libguile/eval.c: Remove subr-handling cases. To regain this speed and more won't have to wait for native compilation, though -- this change smooths the way for subr dispatch in the VM. * libguile/gsubr.c (scm_i_gsubr_apply): Fix a bug in which we didn't detect too-many-arguments. This would only show up when using ceval, as only ceval called this function. * test-suite/tests/ramap.test ("array-map!"): Change the expected exception if passed a procedure of the wrong arity. It now gives wrong-num-args. more won't have to wait for native compilation, though -- this change smooths the way for subr dispatch in the VM. * libguile/goops.c (scm_class_of): Remove subr cases. No speed implication. * libguile/objects.c (scm_valid_object_procedure_p): Remove this public but undocumented, and useless, function. I do not think this will affect anyone at all. (scm_set_object_procedure_x): Replace a call to scm_valid_object_procedure_p with scm_procedure_p, and actually wrap with a scm_is_true. * module/oop/goops.scm (initialize-object-procedure): Don't call valid-object-procedure?. 2009-12-03 Andy Wingo <wingo@pobox.com> all subrs are gsubrs * libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Always create gsubrs -- never the specialized tc7 types. Allow gsubrs to have generics, there doesn't seem to be any reason not to. * libguile/macros.c (scm_make_synt): * libguile/values.c (scm_init_values): * libguile/eval.c (scm_init_eval): * libguile/gc.c (scm_init_gc): Use scm_c_define_gsubr instead of scm_c_define_subr. * libguile/goops.c (scm_class_of): Allow gsubrs to be primitive generics. 2009-12-03 Andy Wingo <wingo@pobox.com> replace frame implementation with VM frames * libguile/stacks.h: Rework so that a stack doesn't copy information out of VM frames, it just holds onto a VM frame, along with the stack id and length. VM frames are now the only representation of frames in Guile. (scm_t_info_frame, SCM_FRAME_N_SLOTS, SCM_FRAME_REF, SCM_FRAME_NUMBER) (SCM_FRAME_FLAGS, SCM_FRAME_SOURCE, SCM_FRAME_PROC, SCM_FRAME_ARGS) (SCM_FRAME_PREV, SCM_FRAME_NEXT) (SCM_FRAMEF_VOID, SCM_FRAMEF_REAL, SCM_FRAMEF_PROC) (SCM_FRAMEF_EVAL_ARGS, SCM_FRAMEF_OVERFLOW) (SCM_FRAME_VOID_P, SCM_FRAME_REAL_P, SCM_FRAME_PROC_P) (SCM_FRAME_EVAL_ARGS_P, SCM_FRAME_OVERFLOW_P): Remove these macros corresponding to the old frame implementation. (scm_frame_p scm_frame_source, scm_frame_procedure) (scm_frame_arguments): These definitions are now in frames.h. (scm_last_stack_frame): Remove declaration of previously-removed constructor. Probably should re-instate it though. (scm_frame_number, scm_frame_previous, scm_frame_next) (scm_frame_real_p, scm_frame_procedure_p, scm_frame_evaluating_args_p) (scm_frame_overflow_p) : Remove these procedures corresponding to the old stack implementation. * libguile/stacks.c: Update for new frames implementation. * libguile/frames.h: * libguile/frames.c: Rename functions operating on VM frames to have a scm_frame prefix, not scm_vm_frame -- because they really are the only frames we have. Rename corresponding Scheme functions too, from vm-frame-foo to frame-foo. * libguile/deprecated.h: Remove scm_stack and scm_info_frame data types. * libguile/vm.c (vm_dispatch_hook): Adapt to scm_c_make_frame name change. * module/system/vm/frame.scm: No need to export functions provided frames.c now, as we load those procedures into the default environment now. Rename functions, and remove a couple of outdated, unused functions. The bottom half of this file is still bitrotten, though. * libguile/backtrace.c: Rework to operate on the new frame representation. Also fix a bug displaying file names for compiled procedures. * libguile/init.c: Load the VM much earlier, just because we can. Also it allows us to have frames.[ch] loaded in time for stacks to be initialized, so that scm_frame_arguments can do the right thing. 2009-12-03 Andy Wingo <wingo@pobox.com> remove debug frames * libguile/debug.h (scm_t_debug_frame): Remove this type, as it was internal to the old evaluator. (SCM_EVALFRAME, SCM_APPLYFRAME, SCM_VOIDFRAME, SCM_MACROEXPF) (SCM_TAILREC, SCM_TRACED_FRAME, SCM_ARGS_READY, SCM_DOVERFLOW) (SCM_MAX_FRAME_SIZE, SCM_FRAMETYPE) (SCM_EVALFRAMEP, SCM_APPLYFRAMEP, SCM_VOIDFRAMEP, SCM_MACROEXPFP) (SCM_TAILRECP, SCM_TRACED_FRAME_P, SCM_ARGS_READY_P, SCM_OVERFLOWP) (SCM_SET_MACROEXP, SCM_SET_TAILREC, SCM_SET_TRACED_FRAME) (SCM_SET_ARGSREADY, SCM_SET_OVERFLOW) (SCM_CLEAR_MACROEXP, SCM_CLEAR_TRACED_FRAME, SCM_CLEAR_ARGSREADY): Remove macro accessors to scm_t_debug_frame. (SCM_DEBUGOBJP, SCM_DEBUGOBJ_FRAME, SCM_SET_DEBUGOBJ_FRAME): (scm_debug_object_p, scm_make_debugobj): Remove debugobj accessors. (scm_i_unmemoize_expr): Remove unused declaration. * libguile/debug.c (scm_debug_options): No more max limit on frame sizes. (scm_start_stack): Just call out to scm_vm_call_with_new_stack. (scm_debug_object_p, scm_make_debugobj, scm_init_debug): No more debugobj smob type. * libguile/deprecated.h: * libguile/deprecated.c (scm_i_deprecated_last_debug_frame) (scm_last_debug_frame): Remove deprecated debug-frame bits. * libguile/stacks.c (scm_make_stack): Rework this function and its dependents to only walk VM frames. (scm_stack_id): Call out to the holder of the VM frame in question, which should be a VM or a VM continuation, for the stack ID. Currently this bit is stubbed out. (scm_last_stack_frame): Removed. It seems this is mainly useful for a debugger, and we need to rewrite the debugger to work on the Scheme level. * test-suite/tests/continuations.test ("continuations"): Remove test for last-stack-frame. * libguile/continuations.h (struct scm_t_contregs): * libguile/continuations.c (scm_make_continuation): (copy_stack_and_call, scm_i_with_continuation_barrier): No need to save and restore debug frames. * libguile/threads.h (scm_i_thread): Don't track debug frames. (scm_i_last_debug_frame, scm_i_set_last_debug_frame): Remove macro accessors. * libguile/threads.c (guilify_self_1): Don't track debug frames. * libguile/throw.c: No need to track debug frames in a jmpbuf. * libguile/vm-engine.c (vm_engine, VM_PUSH_DEBUG_FRAMES): Don't push debug frames. * libguile/vm.h: * libguile/vm.c (scm_vm_call_with_new_stack): New function. Currently stubbed out though. 2009-12-03 Andy Wingo <wingo@pobox.com> clarify comments in eval.scm * module/ice-9/eval.scm: Add some more comments. 2009-12-03 Andy Wingo <wingo@pobox.com> really boot primitive-eval from scheme. * libguile/eval.c (scm_primitive_eval, scm_c_primitive_eval): (scm_init_eval): Rework so that scm_primitive_eval always calls out to the primitive-eval variable. The previous definition is the default value, which is probably overridden by scm_init_eval_in_scheme. * libguile/init.c (scm_i_init_guile): Move ports and load-path up, so we can debug when initing eval. Call scm_init_eval_in_scheme. Awesome. * libguile/load.h: * libguile/load.c (scm_init_eval_in_scheme): New procedure, loads up ice-9/eval.scm to replace the primitive-eval definition, if everything is there and up-to-date. * libguile/modules.c (scm_module_transformer): Export to Scheme, so it's there for eval.go. * module/ice-9/boot-9.scm: No need to define module-transformer. * module/ice-9/eval.scm (capture-env): Only reference the-root-module if modules are booted. (primitive-eval): Inline a definition for identity. Throw a more standard error for "wrong number of arguments". * module/ice-9/psyntax.scm (chi-install-global): The macro binding for a syncase macro is now a pair: the transformer, and the module that was current when the transformer was installed. The latter is used for hygiene purposes, replacing the use of procedure-module, which didn't work with the interpreter's shared-code closures. (chi-macro): Adapt for the binding being a pair, and get the hygiene from the cdr. (eval-local-transformer): Adapt to new form of macro bindings. * module/ice-9/psyntax-pp.scm: Regenerated. * .gitignore: Ignore eval.go.stamp. * module/Makefile.am: Reorder for fastest serial compilation, now that there are no ordering constraints. I did a number of experiments here and this seems to be the best; but the bulk of the time is compiling psyntax-pp.scm with eval.scm. Not so great. * libguile/vm-engine.c (vm-engine): Throw a more standard error for "wrong type to apply". * test-suite/tests/gc.test ("gc"): Remove a hack that shouldn't affect the new evaluator, and throw in another (gc) for good measure. * test-suite/tests/goops.test ("defining classes"): * test-suite/tests/hooks.test (proc1): We can't currently check what the arity is of a closure made by eval.scm -- or more accurately all closures have 0 required args and no rest args. So punt for now. * test-suite/tests/syntax.test ("letrec"): The scheme evaluator can't check that a variable is unbound, currently; perhaps the full "fixing letrec" expansion could fix this. But barring that, punt. 2009-12-01 Andy Wingo <wingo@pobox.com> apply goes to the vm, not the interpreter * libguile/eval.c (eval): Call scm_vm_apply instead of apply. (apply): Deleted, no longer referenced. Heh. (scm_apply): Call scm_vm_apply. * libguile/init.c (scm_i_init_guile): Bootstrap the VM before the evaluator. * libguile/vm.c (scm_vm_apply): Actually it's not necessary that the procedure is a program; so that's cool, relax the check. 2009-12-01 Andy Wingo <wingo@pobox.com> vm doesn't call the evaluator at all (at least not directly) * libguile/vm-i-system.c (goto/args, mv-call): Finish the port to use apply_foreign instead of scm_apply. 2009-12-01 Andy Wingo <wingo@pobox.com> first step to make the vm stop calling the interpreter * libguile/eval.h: * libguile/eval.c (scm_closure_apply): New function, applies a closure. Won't be necessary in the future, but for now here it is, with internal linkage. * libguile/gsubr.h: * libguile/gsubr.c (scm_i_gsubr_apply_array): New function, applies a gsubr to an array of values, potentially extending that array for optional arguments and rest arguments and such. * libguile/vm.c (apply_foreign): New function, applies a foreign function to arguments on the stack, in place. * libguile/vm-i-system.c (call): Add a case for procedures-with-setters (will go away when they are applicable structs). Instead of calling the evaluator for foreign functions, call apply_foreign. 2009-12-01 Andy Wingo <wingo@pobox.com> add new scheme evaluator * module/ice-9/eval.scm: New evaluator, written in Scheme. Whee! Batteries included but not wired up. * module/Makefile.am: Abuse touch(1) to make sure eval.go gets built before everything. Can't just depend on eval.go, because eval.go will get the timestamp of eval.scm, which might be newer than foo.go (and thus foo.scm). Something better is warranted. 2009-12-01 Andy Wingo <wingo@pobox.com> add memoized expression accessors to scheme * libguile/eval.c: Fix a comment. (eval): Abstract out the variable memoization into a function, scm_memoize_variable_access_x. * libguile/memoize.c (memoized_tags): Fix a couple names. (scm_memoize_variable_access_x): New internal function. Actually it's public to Scheme, but we can't do much about that, because the new evaluator will need it. (scm_memoized_expression_typecode, scm_memoized_expression_data): New accessors for memoized code, for Scheme. (scm_memoized_typecode): Looks up the typecode for a symbol. 2009-12-01 Andy Wingo <wingo@pobox.com> export scm_define to scheme as define! * libguile/modules.c (scm_define): Export to Scheme as `define!'. The evaluator needs it, and actually it's an OK thing to have around. 2009-12-01 Andy Wingo <wingo@pobox.com> wire through the existing vm ops for variable-ref and variable-set! * module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile variable-ref and variable-set instructions specially. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Add cases for variable-ref and variable-set!. The latter is a little tricky, because the args are switched for the VM op, and we can't really change that easily. 2009-12-01 Andy Wingo <wingo@pobox.com> fixes to variable-ref, variable-set vm ops * libguile/vm-i-system.c (variable-ref, variable-set): Fix declared number of pops and pushes. promises are in their own file now * libguile.h: * libguile/Makefile.am: * libguile/eval.c: * libguile/eval.h: * libguile/init.c: * libguile/promises.c: * libguile/promises.h: Split promises out into their own file. 2009-12-01 Andy Wingo <wingo@pobox.com> new evaluator, y'all * libguile/eval.c: So, ladies & gents, a new evaluator. It's similar to the old one, in that we memoize and then evaluate, but in this incarnation, memoization of an expression happens before evaluation, not lazily as the expression is evaluated. This makes the evaluation itself much cleaner, in addition to being threadsafe. In addition, since this C evaluator will in the future just serve to bootstrap the Scheme evaluator, we don't have to pay much concern for debugging conveniences. So the environment is just a list of values, and the memoizer pre-computes where it's going to find each individual value in the environment. Interface changes are commented below, with eval.h. (scm_evaluator_traps): No need to reset the debug mode after rnning te traps thing. But really, the whole traps system needs some love. * libguile/memoize.h: * libguile/memoize.c: New memoizer, which runs before evaluation, checking all syntax before evaluation begins. Significantly, no debugging information is left for lexical variables, which is not so great for interactive debugging; perhaps we should change this to have a var list in the future as per the classic interpreters. But it's quite fast, and the resulting code is quite good. Also note that it doesn't produce ilocs, memoized code is a smob whose type is in the first word of the smob itself. * libguile/eval.h (scm_sym_and, scm_sym_begin, scm_sym_case) (scm_sym_cond, scm_sym_define, scm_sym_do, scm_sym_if, scm_sym_lambda) (scm_sym_let, scm_sym_letstar, scm_sym_letrec, scm_sym_quote) (scm_sym_quasiquote, scm_sym_unquote, scm_sym_uq_splicing, scm_sym_at) (scm_sym_atat, scm_sym_atapply, scm_sym_atcall_cc) (scm_sym_at_call_with_values, scm_sym_delay, scm_sym_eval_when) (scm_sym_arrow, scm_sym_else, scm_sym_apply, scm_sym_set_x) (scm_sym_args): Remove public declaration of these symbols. (scm_ilookup, scm_lookupcar, scm_eval_car, scm_eval_body) (scm_eval_args, scm_i_eval_x, scm_i_eval): Remove public declaration of these functions. (scm_ceval, scm_deval, scm_ceval_ptr): Remove declarations of these deprecated functions. (scm_i_print_iloc, scm_i_print_isym, scm_i_unmemocopy_expr) (scm_i_unmemocopy_body): Remove declarations of these internal functions. (scm_primitive_eval_x, scm_eval_x): Redefine as macros for their less destructive siblings. * libguile/Makefile.am: Add memoize.[ch] to the build. * libguile/debug.h (scm_debug_mode_p, scm_check_entry_p) (scm_check_apply_p, scm_check_exit_p, scm_check_memoize_p) (scm_debug_eframe_size): Remove these vars that were tied to the old evaluator's execution model. (SCM_RESET_DEBUG_MODE): Remove, no more need for this. (SCM_MEMOIZEDP, SCM_MEMOIZED_EXP, SCM_MEMOIZED_ENV): Remove macros referring to old memoized code representation. (scm_local_eval, scm_procedure_environment, scm_memoized_environment) (scm_make_memoized, scm_memoized_p): Remove functions operating on old memoized code representation. (scm_memcons, scm_mem_to_proc, scm_proc_to_mem): Remove debug-only code for old evaluator. * libguile/debug.c: Remove code to correspond with debug.h removals. (scm_debug_options): No need to set the debug mode or frame limit here, as we don't have C stack limits any more. Perhaps this is a bug, but as long as we can compile eval.scm, we should be fine. * libguile/init.c (scm_i_init_guile): Init memoize.c. * libguile/modules.c (scm_top_level_env, scm_env_top_level) (scm_env_module, scm_system_module_env_p): Remove these functions. * libguile/print.c (iprin1): No more need to handle isyms. Adapt to new form of interpreted procedures. * libguile/procprop.c (scm_i_procedure_arity): Adapt to new form of interpreted procedures. * libguile/procs.c (scm_thunk_p): Adapt to new form of interpreted procedures. * libguile/procs.h (SCM_CLOSURE_FORMALS): Removed, this exists no more. (SCM_CLOSURE_NUM_REQUIRED_ARGS, SCM_CLOSURE_HAS_REST_ARGS): New accessors. * libguile/srcprop.c (scm_source_properties, scm_source_property) (scm_set_source_property_x): Remove special cases for memoized code. * libguile/stacks.c (read_frame): Remove a source-property case for interpreted code. (NEXT_FRAME): Remove a case that I don't fully understand, that seems to be designed to skip over apply frames. Will be obsolete in the futures. (read_frames): Default source value for interpreted frames to #f. (narrow_stack): Don't pay attention to the system_module thing. * libguile/tags.h: Remove isyms and ilocs. Whee! * libguile/validate.h (SCM_VALIDATE_MEMOIZED): Fix to use the new MEMOIZED_P formulation. * module/ice-9/psyntax-pp.scm (do, quasiquote, case): Adapt for these no longer being primitive macros. * module/ice-9/boot-9.scm: Whitespace change, but just a poke to force a rebuild due to and/or/cond/... not being primitives any more. * module/ice-9/deprecated.scm (unmemoize-expr): Deprecate, it's unmemoize-expression now. * test-suite/tests/eval.test ("define set procedure-name"): XFAIL a couple of tests here; I don't know what to do about them. I reckon the expander should ensure that defined values are named. * test-suite/tests/chars.test ("basic char handling"): Fix expected exception when trying to apply a char. 2009-12-01 Andy Wingo <wingo@pobox.com> goops moving away from evaluator opcodes, and a primitive compilation fix * module/oop/goops.scm (@slot-ref, @slot-set!): Define "primitives" for these. Probably should do something more general, though, allowing @struct-ref. * module/language/tree-il/primitives.scm (add-interesting-primitive!): Error if the primitive isn't bound. 2009-12-01 Andy Wingo <wingo@pobox.com> remove (lang elisp), as it won't work with the new evaluator * lang/: Delete. This causes me some pain, but the new elisp compiler is coming soon, and the old one really won't work with the new evaluator. * Makefile.am: * configure.ac: Autotoolery for elisp removal. * test-suite/tests/elisp.test: Comment out the body of the elisp test. The tests themselves should be useful in the new world, though. 2009-12-01 Andy Wingo <wingo@pobox.com> local-eval will go away * module/ice-9/debugger/commands.scm: * module/ice-9/debugging/traps.scm: * module/ice-9/emacs.scm: * module/ice-9/gds-client.scm: Add some FIXMEs due to impending local-eval removal. * module/oop/goops.scm (make-generic-bound-check-getter): Just the compiled closure case here. 2009-12-01 Andy Wingo <wingo@pobox.com> no special treatment for memoized code in srcprop.c * libguile/srcprop.c (scm_set_source_properties_x): No need to treat memoized code specially. * test-suite/tests/srcprop.test ("set-source-property!") ("set-source-properties!"): Well, just throw 'unresolved on these for now, because we need a few more things to land before these can be fixed, or even considered. 2009-12-01 Andy Wingo <wingo@pobox.com> factor copy-tree and cons-source out of eval.[ch] * libguile.h: * libguile/Makefile.am * libguile/init.c (scm_i_init_guile): Add trees.[ch] to the build. * libguile/eval.c: * libguile/eval.h: Remove scm_copy_tree and scm_cons_source... * libguile/trees.h: * libguile/trees.c: * libguile/srcprop.h: * libguile/srcprop.c: ... factoring them out here and here, respectively. * test-suite/tests/eval.test ("memoization"): Change expected exception for circular data structures, given new copy-tree location. 2009-12-01 Andy Wingo <wingo@pobox.com> remove unused scm_eval_stack var * libguile/private-options.h: * libguile/eval.c (scm_eval_stack): Remove declaration and definition of unused scm_eval_stack variable. remove evaluator-specific code from macros.c * libguile/macros.c (macro_print): No special printing for macros whose code is an interpreted procedure. 2009-12-01 Andy Wingo <wingo@pobox.com> remove class-environment slot, goops grubs less in the evaluator * libguile/goops.h (scm_sys_tag_body): Remove declaration of undefined function. (SCM_CLASS_CLASS_LAYOUT, scm_si_environment, SCM_N_CLASS_SLOTS) (scm_class_environment) Remove class environment slot and getter. * libguile/goops.c (compute_getters_n_setters): Use scm_primitive_eval to produce the init thunk, instead of scm_i_eval_x; though really we should be doing this in Scheme. (scm_basic_basic_make_class, build_class_class_slots) (create_basic_classes, scm_class_environment): Remove class environment slot. (get_slot_value, set_slot_value): Use scm_call_1 instead of evaluator tricks. * module/oop/goops.scm: Remove class-environment export, and environments throughout the file. 2009-12-01 Andy Wingo <wingo@pobox.com> fix to gdb_eval to use newer interfaces * libguile/gdbint.c (gdb_eval): Use scm_primitive_eval instead of scm_i_eval_x. 2009-12-01 Andy Wingo <wingo@pobox.com> formally deprecate trampolines * libguile/eval.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): Actually deprecate trampolines. * srfi/srfi-1.c: Fix all trampoline uses in srfi-1.c. 2009-12-01 Andy Wingo <wingo@pobox.com> remove uses of trampolines within guile itself * libguile/eval.c (scm_map, scm_for_each) * libguile/hashtab.c (scm_hash_for_each_handle) * libguile/list.c (scm_filter, scm_filter_x) * libguile/quicksort.i.c: * libguile/sort.c (scm_restricted_vector_sort_x, scm_sorted_p) (scm_merge, scm_merge_list_x, scm_merge_x) (scm_merge_list_step, scm_sort_x, scm_sort, scm_merge_vector_x) (scm_merge_vector_step, scm_stable_sort_x, scm_sort_list_x) (scm_sort_list)nn * libguile/srfi-13.c (scm_string_any, scm_string_every) (scm_string_tabulate, scm_string_trim, string_trim_right) (scm_string_trim_both, scm_string_index, scm_string_index_right) (scm_string_skip, scm_string_skip_right, scm_string_count) (scm_string_map, scm_string_map_x, scm_string_for_each) (scm_string_for_each_index, scm_string_filter, scm_string_delete): Remove uses of trampolines. gut the backtrace implementation for memoized code * libguile/backtrace.c (display_header, display_expression) (display_error_body, display_backtrace_get_file_line, display_frame): Gut the implementation for memoized code, as memoized code as it is currently understood is going away. 2009-12-01 Andy Wingo <wingo@pobox.com> remove some deprecated things, undeprecate scm_the_root_module() * libguile/deprecated.h * libguile/deprecated.c (SCM_ILOC00, SCM_IDINC, SCM_IDSTMSK) (scm_s_expression, scm_s_test, scm_s_body, scm_s_bindings) (scm_s_variable, scm_s_clauses, scm_s_formals, SCM_EVALIM2) (SCM_EVALIM, SCM_XEVAL, SCM_XEVALCAR): Remove these macros and constants, deprecated in 2003. (scm_the_root_module): Undeprecate, it's actually a useful function, that other parts of the code use. * libguile/modules.h (scm_the_root_module): Undeprecated. * libguile/modules.c (scm_the_root_module): Rename from the_root_module. Use it in the rest of this file. 2009-12-01 Andy Wingo <wingo@pobox.com> tweak to eval.c * libguile/eval.c (eval_letrec_inits): Rename from ceval_letrec_inits. Caller changed. 2009-12-01 Andy Wingo <wingo@pobox.com> eval.i.c -> eval.c * libguile/Makefile.am: * libguile/eval.i.c: Remove eval.i.c. * libguile/eval.c: Fold eval.i.c's contents into eval.c. 2009-12-01 Andy Wingo <wingo@pobox.com> more ceval excision * libguile/eval.c: * libguile/eval.i.c: Rename deval to eval. Substitute in some preprocessor macros. remove code from eval.i.c that was only for CEVAL. * libguile/eval.i.c: Remove CEVAL-only code. 2009-12-01 Andy Wingo <wingo@pobox.com> Don't double-include eval.i.c -- let's only build deval. * libguile/eval.c (SCM_I_XEVAL, SCM_I_XEVALCAR): No more debug_p args, we are always debugging. Adapt all callers. (ceval_letrec_inits): For some reason this function is used by deval. No idea why. Pull it out here. * libguile/eval.i.c (SCM_APPLY): scm_dapply is scm_apply. 2009-12-01 Andy Wingo <wingo@pobox.com> gut trampolines * libguile/eval.c: Gut the trampoline implementation. We'll be doing much more clever things here that will obviate the need for the procedure arg of map and for-each to be allocated in many cases... trampolines were a noble attempt at optimizing in the wrong place. * srfi/srfi-1.c (scm_srfi1_lset_difference_x): Validate that we get a proc, because the trampoline won't do it for us. * test-suite/tests/sort.test ("sort"): * test-suite/tests/srfi-1.test ("count", "fold", "list-index"): Change expected exceptions, due to trampoline functions not doing any computation. 2009-12-01 Andy Wingo <wingo@pobox.com> expand out named let to letrec in the eval case * module/ice-9/psyntax.scm: In the eval case, expand out named let to letrec. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-11-29 Ludovic Courtès <ludo@gnu.org> Make `SCM' type definition acceptable for C++ compilers. * libguile/tags.h (SCM) [SCM_DEBUG_TYPING_STRICTNESS == 1]: Use a named struct to avoid errors from C++ compilers such as "error: non-local function ‘<anonymous struct>* foo(<anonymous struct>*)’ uses anonymous type". This fixes a regression introduced in c6054feaf03f8bde236f5e45a946f38827074923 ("Add support for static allocation of cells, strings and stringbufs."). Reported by Linas Vepstas <linasvepstas@gmail.com>. 2009-11-28 Ludovic Courtès <ludo@gnu.org> Remove remaining uses of discouraged constructs, really. * libguile/throw.c, libguile/vm-engine.h, libguile/vm-i-system.c, libguile/vm.c: Replace uses of discouraged constructs by their current counterparts. Remove remaining uses of discouraged constructs. * libguile/frames.c, libguile/instructions.c, libguile/objcodes.c, libguile/programs.c, libguile/throw.c, libguile/vm-i-scheme.c, libguile/vm.c: Replace uses of discouraged constructs by their current counterparts. 2009-11-27 Ludovic Courtès <ludo@gnu.org> Disable encoding scanning on non-seekable file ports. * libguile/read.c (scm_i_scan_for_encoding): Don't attempt to scan non-seekable file ports. 2009-11-26 Andy Wingo <wingo@pobox.com> header tidyings * libguile/goops.h: * libguile/struct.h: c-backslash-region some vars. brace placement fixes * libguile/goops.c (scm_sys_allocate_instance): * libguile/vm-i-loader.c (load-wide-string): Fix some brace placements. push goops compile delay out to 30 invocations, for great justice * module/oop/goops/dispatch.scm (timer-init): Init to 30 for faster goops load time. generic method cache begone * libguile/goops.h (SCM_GENERIC_METHOD_CACHE) (SCM_SET_GENERIC_METHOD_CACHE, scm_si_generic_cache) * libguile/goops.c (create_standard_classes): Remove slot for generic method cache. Yay! 2009-11-26 Andy Wingo <wingo@pobox.com> remove code that manages the method cache * libguile/goops.h (SCM_MCACHE_N_SPECIALIZED) (SCM_SET_MCACHE_N_SPECIALIZED, SCM_INITIAL_MCACHE_SIZE) (scm_make_method_cache, scm_memoize_method, scm_mcache_lookup_cmethod) (scm_mcache_compute_cmethod): * libguile/goops.c: Remove these procedures which managed the method cache. There's still a slot there but it's not initialized. The method cache is no longer necessary. * module/oop/goops/dispatch.scm (memoize-method!): Change to not take a "cache" argument. * libguile/eval.i.c: * libguile/vm-i-system.c: Remove dispatch via the method cache. 2009-11-26 Andy Wingo <wingo@pobox.com> remove method cache management code from (oop goops dispatch) * module/oop/goops/dispatch.scm: Remove old method cache things. 2009-11-26 Andy Wingo <wingo@pobox.com> generics now dispatch as applicable structs * libguile/eval.i.c (CEVAL, SCM_APPLY): Dispatch applicable structs before pure generics. In practice what this means is that we never hit the mcache case, because all pure generics are applicable structs. We're moving over to having generics dispatch themselves. Also, they don't prepend the struct as an arg; in order to have that effect, the user has closures. * libguile/goops.c (scm_apply_generic, scm_call_generic_0): (scm_call_generic_1, scm_call_generic_2, scm_call_generic_3): Dispatch directly to the struct procedures. (scm_var_make_extended_generic): Remove a duplicate definition for scm_var_make_extended_generic. (create_standard_classes): Mark all instances of <applicable-struct-class> (themselves classes) as applicable classes. Meaning: generics are now applicable structs. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT): The hashsets are actually uw slots -- or at least, making subclasses maps the int slots to be uw slots * libguile/vm-i-system.c (call, goto/args, mv-call): Dispatch applicable structs in the VM. * module/oop/goops/dispatch.scm (emit-linear-dispatch): Fix bug in the non-rest cache miss case. (delayed-compile): Rework to avoid fluids. (cache-dispatch): Don't call `equal?', it causes bootstrapping problems with the primitive-generic equal?. Using our own version is faster anyway. 2009-11-26 Andy Wingo <wingo@pobox.com> make sure that when equal? is extended, that the generic has a method * libguile/goops.h: * libguile/goops.c (scm_set_primitive_generic_x): New function, for now local to the goops module. * module/oop/goops.scm (equal?): Make sure that when equal? is extended, that the generic already has a default method. 2009-11-26 Andy Wingo <wingo@pobox.com> remove cache-mutex slot from generics * libguile/goops.c: * libguile/goops.h: Remove cache-mutex slot from generics, and renumber other slots. remove locking in method memoization * libguile/goops.c (scm_memoize_method): Don't lock around method memoization, as the new protocol will be reeentrant and lock-free. 2009-11-26 Andy Wingo <wingo@pobox.com> limn goops flags, remove foreign objs, rename entity to applicable-struct * libguile/goops.c (scm_class_applicable_struct) (scm_class_applicable_struct_with_setter) (scm_class_applicable_struct_class): Rename from scm_class_entity, scm_class_entity_with_setter, and scm_class_entity_class. (scm_class_simple_method): Removed; this abstraction is not used. (scm_class_foreign_class, scm_class_foreign_object): Remove these, they are undocumented and unused. They might come back later. (scm_sys_inherit_magic_x): Simply inherit the vtable flags from the class's class. Flags are about layout, and it is the class that determines the layout of the instance. (scm_basic_basic_make_class): Don't bother setting GOOPS_OR_VALID, inherit-magic will do that. (scm_basic_make_class): Inherit magic after setting the layout. Allows the struct magic checker to do its job. (scm_accessor_method_slot_definition): Move implementation to Scheme. Removes the need for the accessor flag. (scm_sys_allocate_instance): Adapt to scm_i_alloc_struct name change, and that alloc-struct will handle finalization. (scm_compute_applicable_methods): Remove accessor check, as it's unnecessary. (scm_make): Adapt to new generic slot order, and no more simple-method. (create_standard_classes): What was the GF slot "dispatch-procedure" is now the applicable-struct slot "procedure". No more foreign class, foreign object, or simple method. Rename <entity> and friends to <applicable-struct> and friends. No more entity-with-setter -- though perhaps it will come back too. Instead generic-with-setter is its own thing. * libguile/goops.h (SCM_CLASSF_METACLASS): "A goops class that is a vtable" -- no need for a separate flag. (SCM_CLASSF_FOREIGN, SCM_CLASSF_SIMPLE_METHOD) (SCM_CLASSF_ACCESSOR_METHOD): Removed these unused flags. (SCM_ACCESSORP): Removed. Renumber generic slots, rename entity classes, and remove the foreign class, foreign object, and simple method classes. * libguile/struct.c (scm_i_struct_inherit_vtable_magic): New function, called when making new vtables.applicable structs (scm_i_alloc_struct): Remove 8-bit alignment check, as libGC guarantees this for us. Handle finalizer registration here. (scm_make_struct): Factor some things to scm_i_alloc_struct and scm_i_struct_inherit_vtable_magic. (scm_make_vtable_vtable): Adapt to scm_i_alloc_struct name change. * libguile/struct.h (scm_i_alloc_struct): Change name from scm_alloc_struct, and make internal. * module/oop/goops.scm (oop): Don't declare #:replace <class> et al, because <class> isn't defined in the core any more. (accessor-method-slot-definition): Defined in Scheme now. Remove <foreign-object> methods. (initialize on <class>): Prep layout before inheriting magic, as in scm_basic_make_class. * module/oop/goops/dispatch.scm (delayed-compile) (memoize-effective-method!): Adapt to 'procedure slot name change. 2009-11-26 Andy Wingo <wingo@pobox.com> %invalidate-method-cache invalidates the dispatch procedure too * libguile/goops.c (make_dispatch_procedure, clear_method_cache): Properly reset the dispatch procedure. 2009-11-26 Andy Wingo <wingo@pobox.com> generic dispatch protocol in scheme, not yet wired up * module/oop/goops/dispatch.scm: Add a dispatch protocol in Scheme. The idea is that instead of using a hardcoded C protocol, we compile dispatch procedures at runtime. To avoid too much thrashing at bootup, there is a simple JIT mechanism -- dispatch will be data-driven, through the cache, for the first 5 invocations, then a dispatch procedure will be compiled from the cache. My initial timings indicate that interpreted dispatch takes about 100us, and that compiled dispatch takes about 60us. Compilation itself takes about 16000us (16 ms). The compiled procedure dispatch times will improve soon, hopefully. 2009-11-26 Andy Wingo <wingo@pobox.com> eqv? not a generic, equal? dispatches to generic only for objects * libguile/eq.c (scm_eqv_p): Not a generic any more. Since eqv? is used by e.g. `case', which should be able to compile into dispatch tables, it really doesn't make sense to dispatch out to a generic. (scm_equal_p): So it was always the case that (equal? 'foo "foo") => #f. But (equal? 'foo 'bar) could actually be extended by a generic. This was a bug, if you follow the other logic of the code. Changed so that generic functions can only extend the domain of equal? when operating on goops objects. * oop/goops.scm: No more eqv? generic. * test-suite/tests/goops.test: Remove eqv? tests. 2009-11-26 Andy Wingo <wingo@pobox.com> generic tweaks; realizing what the setter slot actually is * libguile/goops.h (scm_si_dispatch_procedure) (scm_si_effective_methods): Rename the new generics slots to "effective-methods" and "dispatch-procedure". (scm_si_generic_setter): Rename this one from "%setter" to "setter", and it's not a cache -- it's a pointer to the setter, which is also a generic. I didn't realize that before. It's better this way (like it always was.) (SCM_SET_GENERIC_DISPATCH_PROCEDURE) (SCM_CLEAR_GENERIC_EFFECTIVE_METHODS): New helper macros. * libguile/goops.c (clear_method_cache): Clear the new dispatch procedure and the effective methods as well. (create_standard_classes): Rename slots, and fix the setter slots. 2009-11-26 Andy Wingo <wingo@pobox.com> more clarity in (oop goops dispatch) * module/oop/goops/dispatch.scm (memoize-method!): If we don't have a no-applicable-method, just call no-applicable-method directly. * test-suite/tests/goops.test ("no-applicable-method"): Add some tests. 2009-11-26 Andy Wingo <wingo@pobox.com> remove code-table slot from methods * libguile/goops.c (scm_sys_invalidate_method_cache_x, scm_make) (create_standard_classes): Remove code-table slot from methods. The generic cache completely does its job, afaict. * libguile/goops.h (scm_si_formals, scm_si_body, scm_si_make_procedure): Renumber slots. * module/oop/goops.scm (initialize on <method>): No more code-table slot. * module/oop/goops/compile.scm: Always "compile" a method, instead of looking for a hit in an always-empty cache. 2009-11-26 Andy Wingo <wingo@pobox.com> remove used-by slot from generics * libguile/goops.c (clear_method_cache) (scm_sys_invalidate_method_cache_x, scm_make) (create_standard_classes): Remove the used-by method from generics, as it is not used at all. * libguile/goops.h: Renumber generic slots. * module/oop/goops/dispatch.scm (memoize-method!): No more used-by slot. 2009-11-26 Andy Wingo <wingo@pobox.com> first step towards effective methods * libguile/goops.c (create_standard_classes): * libguile/goops.h *scm_si_applicable_methods, scm_si_effective_method) (scm_si_applicable_setter_methods, scm_si_effective_setter_method): Add space for the new form of the generic cache and effective method. 2009-11-26 Andy Wingo <wingo@pobox.com> a very big commit cleaning up structs & goops. also applicable structs. I tried to split this one, and I know it's a bit disruptive, but this stuff really is one big cobweb. So instead we'll pretend like these are separate commits, by separating the changelog. Applicable struct runtime support. * libguile/debug.c (scm_procedure_source): * libguile/eval.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): * libguile/eval.i.c (CEVAL): * libguile/goops.c (scm_class_of): * libguile/procprop.c (scm_i_procedure_arity): * libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Allow for applicable structs. Whee! * libguile/deprecated.h (scm_vtable_index_vtable): Define as a synonym for scm_vtable_index_self. (scm_vtable_index_printer): Alias scm_vtable_index_instance_printer. (scm_struct_i_free): Alias scm_vtable_index_instance_finalize. (scm_struct_i_flags): Alias scm_vtable_index_flags. (SCM_STRUCTF_FLAGS): Be a -1 mask, we have a whole word now. (SCM_SET_VTABLE_DESTRUCTOR): Implement by hand. Hidden slots. * libguile/struct.c (scm_make_struct_layout): Add support for "hidden" fields, writable fields that are not visible to make-struct. This allows us to add fields to vtables and not break existing make-struct invocations. (scm_struct_ref, scm_struct_set_x): Always get struct length from the vtable. Support hidden fields. * libguile/goops.c (scm_class_hidden, scm_class_protected_hidden): New slot classes, to correspond to the new vtable slots. (scm_sys_prep_layout_x): Turn hidden slots into 'h'. (build_class_class_slots): Reorder the class slots to account for vtable fields coming out of negative-land, for name as a vtable slot, and for hidden fields. (create_standard_classes): Define <hidden-slot> and <protected-hidden-slot>. Clean up struct.h. * libguile/struct.h: Lay things out cleaner. There are no more hidden (negative) words. Names are nicer. The exposition is nicer. But the basics are the same. The incompatibilities are that <vtable> has more slots now, and that scm_alloc_struct's signature has changed. The former is ameliorated by the "hidden" slots mentioned before, and the latter, well, it was always a very internal thing... (scm_t_struct_finalize): New type, a finalizer function to be run when instances of a vtable are collected. (scm_t_struct_free): Removed, structs' data is managed by the GC now, and not freed by vtable functions. * libguile/struct.c: (scm_vtable_p): Now we keep flags on vtable-vtables, so this check is cheaper. (scm_alloc_struct): No hidden words. Yippee. (struct_finalizer_trampoline): Entersify. (scm_make_struct): No need to babysit extra words, though now we have to babysit flags. Propagate the vtable, applicable, and setter flags appropriately. (scm_make_vtable_vtable): Update for new simplicity. (scm_print_struct): A better printer. (scm_init_struct): Define <applicable-struct-vtable>, a magical vtable like CL's funcallable-standard-class. Also define <applicable-struct-with-setter-vtable>. Remove foreign object implementation. * libguile/goops.h: * libguile/goops.c (scm_make_foreign_object, scm_make_class) (scm_add_slot, scm_wrap_object, scm_wrap_component): Remove, these were undocumented and unworking. Clean up goops.h, a little. * libguile/goops.h: * libguile/goops.c: Also clean up. * module/oop/goops/dispatch.scm (hashset-index): Adapt for new hashset index. 2009-11-25 Ludovic Courtès <ludo@gnu.org> Remove uses of discouraged constructs. * libguile/vm-i-scheme.c, libguile/vm-i-system.c, libguile/vm.c: Replace uses of discouraged constructs by their current counterparts. Don't build `inet-aton' and `inet-ntoa' when --disable-networking. * libguile/deprecated.c (scm_inet_aton, scm_inet_ntoa): Conditionalize on `HAVE_NETWORKING'. 2009-11-24 Ludovic Courtès <ludo@gnu.org> Use $(PATH_SEPARATOR) where appropriate. * examples/Makefile.am (AM_CFLAGS, AM_LIBS): Use $(PATH_SEPARATOR) instead of `:'. (installcheck): Likewise. 2009-11-24 Ludovic Courtès <ludo@gnu.org> Fix makefile indentation. * benchmark-suite/Makefile.am, libguile/Makefile.am, meta/Makefile.am: Use TAB instead of 8 spaces... * .x-sc_makefile_check: New file. 2009-11-24 Ludovic Courtès <ludo@gnu.org> Properly quote the first argument to `AC_DEFINE{,_UNQUOTED}'. * acinclude.m4, configure.ac, examples/compat/acinclude.m4: Properly quote the first argument for `AC_DEFINE' and `AC_DEFINE_UNQUOTED'. * .x-sc_m4_quote_check: New file. 2009-11-24 Ludovic Courtès <ludo@gnu.org> Add `cfg.mk', for use by the top-level GNUmakefile. * cfg.mk: New file, with 1.9.5 `NEWS' hash. "filesystem" -> "file system" * doc/ref/misc-modules.texi, doc/sources/unix.texi, module/ice-9/ftw.scm: Replace "filesystem" by "file system". 2009-11-24 Ludovic Courtès <ludo@gnu.org> Don't rely on `HAVE_' macros in public header "tags.h". * configure.ac: Check for `intptr_t' and `uintptr_t'. Substitute `SCM_I_GSC_T_INTPTR' and `SCM_I_GSC_T_UINPTR'. * libguile/__scm.h (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN, SCM_T_INTPTR_MAX): New macros. * libguile/_scm.h (SIZEOF_SCM_T_BITS): New macro. * libguile/gen-scmconfig.c (main): Produce typedefs for `scm_t_intptr' and `scm_t_uintptr'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_T_INTPTR, SCM_I_GSC_T_UINPTR): New macros. * libguile/tags.h: Don't check for `HAVE_INTTYPES_H' and `HAVE_STDINT_H'; don't include <inttypes.h> nor <stdint.h>. (scm_t_signed_bits, scm_t_bits): Define unconditionally as aliases for `scm_t_intptr' and `scm_t_uintptr', respectively. (SCM_T_SIGNED_BITS_MAX, SCM_T_SIGNED_BITS_MIN, SCM_T_BITS_MAX): Likewise. (SIZEOF_SCM_T_BITS): Remove. 2009-11-24 Ludovic Courtès <ludo@gnu.org> Remove unused, non-prefixed macros. * libguile/__scm.h (BIGNUMS, TICKS): Remove. Update to Gnulib v0.0-2923-g6575ab5. Really disable thread-local storage on NetBSD 5.0. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Adjust to match actual NetBSD 5 triplet, `x86_64-unknown-netbsd5.0.' (note the final dot). Fix compilation `--without-threads'. * configure.ac: For `--without-threads' and `--with-threads=null', set `SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=0'. This fixes compilation of `gen-scmconfig.c' in these cases. 2009-11-23 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `duplocale' module. * libguile/i18n.c (scm_make_locale): Simplify global locale handling, using duplocale(3) for all kinds of locales. (scm_init_i18n): Comment on why we don't just use `LC_GLOBAL_LOCALE' for `global_locale_smob'. * m4/gnulib-cache.m4: Add `duplocale'. 2009-11-23 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `locale' module. * configure.ac: Remove test for <xlocale.h>. * libguile/i18n.c: Remove conditional <xlocale.h> inclusion on `HAVE_XLOCALE_H'. * m4/gnulib-cache.m4: Add `locale' module. 2009-11-23 Ludovic Courtès <ludo@gnu.org> Correct manual wrt. encoding names. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Don't suggest `latin1' as a good encoding name since Emacs cannot deal with it. * libguile/read.c (scm_file_encoding): Fix "Emacs" spelling. 2009-11-21 Andy Wingo <wingo@pobox.com> better printing of procedures with keyword arguments * module/system/vm/program.scm (arguments->lambda-list): Print keyword arguments more sensibly. fix version-etc for older autoconf * lib/version-etc.c: Don't reference the undefined PACKAGE if PACKAGE_URL is undefined. Probably should go upstream. 2009-11-18 Ludovic Courtès <ludo@gnu.org> autogen.sh: Don't presume /usr/bin/m4. * autogen.sh: Don't presume /usr/bin/m4. Work around path name length limitations in `socket.test'. * test-suite/tests/socket.test (%tmpdir, %curdir): New variables. Chdir to %TMPDIR. Switch back to %CURDIR at the end. (temp-file-path): Return a base file name, not an absolute path. 2009-11-18 Ludovic Courtès <ludo@gnu.org> Remove conflicting definition of $PACKAGE from `GUILE-VERSION'. This obviates the need for the previous commit, 53da7372beca90a58b7401a84627815289a53d11. * GUILE-VERSION (VERSION, PACKAGE): Remove. The latter was conflicting with Automake's definition, which is "guile", not "GNU Guile". * Makefile.am (distdir): Remove. * configure.ac: Hardcode the package name passed to `AC_INIT'. (pkgdatadir, pkgincludedir, pkglibdir, pkglibexecdir): Remove. 2009-11-18 Ludovic Courtès <ludo@gnu.org> Fix $(pkgdatadir) & co. so they refer to $(PACKAGE_TARNAME), not $(PACKAGE). This fixes a regression introduced in 4f02b98d0ed4a314916c69a225d7a45dda3f5f8c ("Use Gnulib's `version-etc-fsf' for `--version' and `--help' output."), which led $(pkgdatadir) & co. to contain the string "GNU Guile" instead of "guile". * configure.ac (pkgdatadir, pkgincludedir, pkglibdir, pkglibexecdir): New variables. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.5. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Don't use `-Werror' by default. * configure.ac (GUILE_ERROR_ON_WARNING): Default to "no". * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. * NEWS: Update. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Fix copyright headers. * module/system/vm/debug.scm, module/system/vm/frame.scm, module/system/vm/vm.scm: Switch to LGPLv3+. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Fix stylistic issues revealed by "make syntax-check". * libguile/gc-malloc.c (scm_must_free): Remove unnecessary `if' before `free ()'. * libguile/stime.c (scm_localtime, scm_mktime): Likewise. * libguile/eval.i.c (ceval): Don't cast the result of alloca(3). * libguile/i18n.c (SCM_STRING_TO_U32_BUF): Likewise. * test-suite/standalone/test-unwind.c: Likewise. * libguile/strings.c (scm_i_deprecated_string_chars): Don't end error message in period. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Add Gnulib maintainer modules. * m4/gnulib-cache.m4: Add `announce-gen', `gendocs', `gitlog-to-changelog', `gnupload', `gnu-web-doc-update', and `maintainer-makefile'. * .gnuploadrc, .x-sc_GPL_version, .x-sc_avoid_if_before_free, .x-sc_error_message_period, .x-sc_cast_of_alloca_return_value, .x-sc_cast_of_argument_to_free, .x-sc_error_message_uppercase, .x-sc_error_message_warn_fatal: New files. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `version-etc-fsf' for `--version' and `--help' output. * m4/gnulib-cache.m4: Add `version-etc-fsf'. Switch to LGPLv3+. * GUILE-VERSION (PACKAGE): Change to "GNU Guile". * Makefile.am (distdir): New variable. * libguile/script.c (scm_shell_usage): Improve formatting. Use `emit_bug_reporting_address ()'. (scm_compile_shell_switches): Use `version_etc ()'. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Build the C code with additional GCC warnings. * configure.ac (POTENTIAL_GCC_CFLAGS): Add `-Wdeclaration-after-statement -Wundef -Wswitch-enum'. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Remove references to undefined macros. The intent is to allow compilation with `-Wundef', which in turn should make it easier to catch erroneous uses of nonexistent macros. * libguile/__scm.h: Don't assume `BUILDING_LIBGUILE' is defined. * libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): Remove unneeded CPP conditional on `TYPE_MIN == 0'. * libguile/fports.c: Check for the definition of `HAVE_CHSIZE' and `HAVE_FTRUNCATE', not for their value. * libguile/ports.c: Likewise. * libguile/numbers.c (guile_ieee_init): Likewise with `HAVE_DINFINITY' and `HAVE_DQNAN'. * test-suite/standalone/test-conversion.c (ieee_init): Likewise. * libguile/strings.c: Likewise with `SCM_STRING_LENGTH_HISTOGRAM'. * libguile/strings.h: Likewise. * libguile/tags.h: Likewise with `HAVE_INTTYPES_H' and `HAVE_STDINT_H'. * libguile/threads.c: Likewise with `HAVE_PTHREAD_GET_STACKADDR_NP'. * libguile/vm-engine.c (VM_NAME): Likewise with `VM_CHECK_IP'. * libguile/gen-scmconfig.c (main): Use "#ifdef HAVE_", not "#if HAVE_". * libguile/socket.c (scm_setsockopt): Likewise. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Remove now unneeded `putenv.c'. * libguile/Makefile.am (EXTRA_libguile_la_SOURCES): Remove `putenv.c'. * libguile/putenv.c: Remove. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Remove `qt/'. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Fix C99-style declarations after statements. * libguile/eval.i.c (ceval): Move declarations before statements. * libguile/read.c (scm_read_extended_symbol): Likewise. * libguile/struct.c (scm_make_struct_layout): Likewise. * libguile/threads.c (fat_mutex_unlock): Likewise. * libguile/vm-i-system.c (br_if_nargs_ne, br_if_nargs_lt): Likewise. * libguile/vm.c (make_vm): Likewise. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Remove deprecated guardian code. * libguile/guardians.c (guardian_apply): Remove `#if ENABLE_DEPRECATED' section since it was never compiled in, not even in 1.8. (scm_init_guardians): Likewise. 2009-11-17 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `warning' module. * m4/gnulib-cache.m4: Add `warnings'. * configure.ac: Use `gl_WARN_ADD' to check whether compiler flags are supported. * libguile/Makefile.am (libguile_la_LIBADD): Add $(LTLIBICONV). (libguile_la_LDFLAGS): Add $(INET_NTOP_LIB) $(INET_PTON_LIB). 2009-11-17 Andy Wingo <wingo@pobox.com> fold 1.9.5 NEWS items into the main text * NEWS: Fold 1.9.5 things into the main text. Update NEWS. * NEWS: Update for 1.9.5. Still needs these entries to be folded into the main section though. 2009-11-16 Andy Wingo <wingo@pobox.com> with a rest arg, allow for keywords anywhere * libguile/vm-i-system.c (br-if-nargs-gt): Fix variable declaration placement. (bind-kwargs): Patch mostly by Ludovic: it seems that in the mode in which we have rest args, the keywords can appear anywhere. Bummer. Change to allow for this. * module/ice-9/optargs.scm (parse-lambda-case): Same, add a permissive-keys clause that handles the case in which there's a rest argument. 2009-11-16 Ken Raeburn <raeburn@raeburn.org> SCM_DEBUG fix: Don't apply SCM_CAR to non-pairs when walking argument lists in method cache matching. * libguile/goops.c (scm_mcache_lookup_cmethod): Don't apply SCM_CAR to non-pairs when walking argument lists in method cache matching. Don't check for CLASSP or symbol in the car slot, since the end of the specifier list is a non-pair. Update comments to reflect new structure of method cache entry. * module/oops/goops/dispatch.scm: Update comments here too. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Add `iconv_open-solaris.h' to remove dependency on gperf. * lib/iconv_open-solaris.h: New file. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `alignof' module. * m4/gnulib-cache.m4: Use `alignof'. * libguile/objcodes.c (scm_c_make_objcode_slice): Use `alignof_type'. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Deprecate `inet-ntoa' and `inet-aton'. Suggested by Bruno Haible. * libguile/inet_aton.c: Remove. * libguile/Makefile.am (EXTRA_libguile_la_SOURCES): Remove `inet_aton.c'. * libguile/deprecated.c (scm_inet_aton, scm_inet_ntoa): New functions. * libguile/deprecated.h: Update accordingly. * libguile/socket.c (scm_inet_aton, scm_inet_ntoa): Remove. * doc/ref/posix.texi (Network Address Conversion): Mark `inet-ntoa' and `inet-aton' as deprecated. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `inet_ntop' and `inet_pton' modules. * m4/gnulib-cache.m4: Add `inet_ntop' and `inet_pton'. * configure.ac: Don't check for `inet_ntop' and `inet_pton'. * libguile/socket.c (scm_inet_pton, scm_inet_ntop): Compile regardless of `HAVE_INET_PTON' and `HAVE_INET_NTOP' respectively. * libguile/filesys.c: Use <stdlib.h> instead of <canonicalize.h>. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Re-add an indirection in bytevectors. The intent is to allow for mmap(3) bindings and to actually reuse user-provided buffers in `scm_c_take_bytevector ()'. * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Increment. (SCM_BYTEVECTOR_CONTENTS): Take the pointer from the second word. (SCM_BYTEVECTOR_CONTIGUOUS_P): New macro. (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust to live alongside the CONTIGUOUS flag. * libguile/bytevectors.c (SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_CONTIGUOUS_P): New macros. (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust. (SCM_BYTEVECTOR_TYPED_LENGTH): Properly parenthesize. (make_bytevector): Adjust to new bytevector header. (make_bytevector_from_buffer): Reuse CONTENTS. (scm_c_shrink_bytevector): Differentiate between contiguous and non-contiguous bytevectors. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Remove unused internal bytevector functions. * libguile/bytevectors.c (scm_i_make_typed_bytevector, scm_c_take_typed_bytevector): Remove. * libguile/bytevectors.h: Adjust accordingly. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Run the GC and retry `open-file' when getting `EMFILE'. * libguile/fports.c (scm_open_file): Run the GC and retry when getting `EMFILE'. 2009-11-16 Ludovic Courtès <ludo@gnu.org> Improve documentation of supported encoding names. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Mention IANA as the list of supported character encodings. Thanks to Bruno Haible for pointing this out. * doc/ref/api-io.texi (Ports): Likewise. Improve documentation of `%default-port-encoding'. 2009-11-16 Ken Raeburn <raeburn@raeburn.org> Fix off-by-one error in processing Emacs-style coding declaration. * libguile/read.c (scm_i_scan_for_encoding): Don't copy the first character after the coding declaration into the new string. 2009-11-15 Andy Wingo <wingo@pobox.com> opcodes for bit twiddling (ash, logand, logior, logxor) * module/language/tree-il/compile-glil.scm: * module/language/tree-il/primitives.scm: * libguile/vm-i-scheme.c (ash, logand, logior, logxor): New opcodes. class-of has an opcode * libguile/vm-i-scheme.c (class-of): New opcode. * module/language/tree-il/compile-glil.scm: * module/oop/goops.scm: Compile class-of into an opcode. faster conditionals * module/language/tree-il/compile-glil.scm (flatten): Compile `if' statements with `eq?' and `null?', and their `not?' variants, into more specific bytecode. fix (apply f) -- without the args list * module/language/tree-il/primitives.scm (apply): Only inline if we actually have an argument to apply. 2009-11-15 Andy Wingo <wingo@pobox.com> Revert "implement #:predicate" and remove predicate from <lambda-case> Turns out this was not a very useful idea, and semantically tricky to boot. This reverts commit 24bf130fd15afbc8b3a2ccdc50a027f9b6c9e623, and makes the following additional changes: * module/ice-9/optargs.scm (parse-lambda-case, let-optional) (let-optional*, let-keywords, let-keywords*): * module/language/tree-il.scm: (<lambda-case>, parse-tree-il) (unparse-tree-il, tree-il->scheme, tree-il-fold, make-tree-il-folder) (post-order!, pre-order!): * module/language/tree-il/analyze.scm (analyze-lexicals): * module/language/tree-il/compile-glil.scm (compile-glil): * module/language/tree-il/inline.scm (inline!): Remove all traces of #:predicate from tree-il. * module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case) (chi-lambda-case): Adapt to tree-il change. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/brainfuck/compile-tree-il.scm (compile-body): * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): * test-suite/tests/tree-il.test: Adapt to tree-il change. * doc/ref/api-procedures.texi (Case-lambda): Remove mention of #:predicate. 2009-11-15 Andy Wingo <wingo@pobox.com> actually set all 8 hashsets in classes * libguile/goops.c (prep_hashsets): Actually set all 8 hashsets. Doh... remove goops-local %tag-body * libguile/goops.c (scm_sys_tag_body): Remove goops-local hack that is no longer necessary. SCM_VALIDATE_VTABLE tweak * libguile/validate.h (SCM_VALIDATE_VTABLE): Simply call scm_struct_vtable_p. fix printing-programs bug * module/system/vm/program.scm (write-program): Fix a bug if we couldn't get a procedure's arity. values.c defines a vtable, not a vtable-vtable * libguile/values.c (scm_init_values): Define a vtable, not a "metaclass". srfi-35 properly uses vtable-offset-user * module/srfi/srfi-35.scm (condition-type-id): (condition-type-parent, condition-type-all-fields): Don't ref fixed struct indices, use vtable-offset-user instead. fix a structs.test test * test-suite/tests/structs.test ("equal?"): Instantiate vtables, not vtable-vtables. "hello" is not a valid vtable layout. 2009-11-15 Andy Wingo <wingo@pobox.com> remove redundant, unnecessary instance size from struct vtables * libguile/struct.h (scm_struct_i_size): Remove this shared field -- I mean, the slot is still there, but it's only used for flags. * libguile/goops.h (SCM_SET_CLASS_INSTANCE_SIZE): * libguile/goops.c (scm_sys_inherit_magic_x, scm_make_class): Remove uses and definition of SCM_SET_CLASS_INSTANCE_SIZE. Light structs used it, but you have that info in the layout; and foreign classes used it, but that is going away soon anyway :) 2009-11-15 Andy Wingo <wingo@pobox.com> fold objects.[ch] into goops.[ch] Remove objects.h #includes as appropriate. 2009-11-15 Andy Wingo <wingo@pobox.com> remove support for "entities" -- a form of applicable struct Entities were meant to be a form of applicable struct. Unfortunately, the implementation is intertwingled with generics. Removing them, for now, will make it possible to cleanly re-add applicable struct support. * libguile/struct.h (SCM_STRUCTF_ENTITY): Remove. (SCM_STRUCTF_GOOPS_HACK): New flag; sigh. * libguile/struct.c (scm_make_struct): We make "entity" structs if the GOOPS_HACK flag is set. This will be fixed when we rework flags and remove hidden words. * libguile/goops.c (scm_class_of): Structs are not applicable, for now at least. (scm_sys_inherit_magic_x, scm_basic_basic_make_class) (scm_sys_allocate_instance, scm_sys_set_object_setter_x): (make_struct_class): Adapt for no more entities (and thus no entity flag). (create_standard_classes): For some reason, generic functions were getting the LIGHT flag set, after the ENTITY flag was removed; so for now explicitly clear that flag. * libguile/goops.h (SCM_GENERIC_SETTER, SCM_SET_GENERIC_SETTER): New macros. * libguile/objects.h: * libguile/objects.c: Remove code for entities. * libguile/debug.c: (scm_procedure_source): Only work with generics. * libguile/eval.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): Only handle generics. * libguile/eval.i.c (CEVAL): #ifdef out the pieces about entities. * libguile/procprop.c (scm_i_procedure_arity): Remove support for entities. * libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Remove entity support. 2009-11-15 Andy Wingo <wingo@pobox.com> SCM_GENERIC_METHOD_CACHE macro splits from SCM_ENTITY_PROCEDURE * libguile/goops.h (SCM_GENERIC_METHOD_CACHE) (SCM_SET_GENERIC_METHOD_CACHE): Two new macros; the same as SCM_[SET_]ENTITY_PROCEDURE, but more reflecting the reality of the generic hack. * libguile/eval.i.c: * libguile/goops.c: * libguile/objects.c: * libguile/vm-i-system.c: Use the new macros when it is appropriate to do so. 2009-11-15 Andy Wingo <wingo@pobox.com> remove unused things from object.[ch] * libguile/objects.h: * libguile/objects.c (scm_object_procedure): Remove, it was only compiled with SCM_DEBUG. * libguile/objects.h: * libguile/objects.c (scm_make_class_object, scm_make_subclass_object, (scm_i_make_class_object, scm_metaclass_standard): Remove also. These implemented an undocumented object system, and are totally replaced by GOOPS. 2009-11-15 Andy Wingo <wingo@pobox.com> remove operators generic dispatch in the vm (sorta) * libguile/vm-i-system.c (call, goto/args, mv-call): Add a case for generics, so we can avoid the evaluator in that case. Still have to cons up a list -- the real solution comes later. remove unused struct gc chain macros * libguile/struct.h (SCM_STRUCT_GC_CHAIN, SCM_SET_STRUCT_GC_CHAIN): Remove, no longer necessary given topological finalization, provided by libGC. de-inline goops dispatch from the evaluator * libguile/eval.i.c: De-inline goops dispatch from the evaluator. Part of a refactor. 2009-11-14 Andreas Rottmann <a.rottmann@gmx.at> add quasisyntax * module/Makefile.am: * module/ice-9/boot-9.scm: * module/ice-9/quasisyntax.scm: Add quasisyntax. Implementation by Andre van Tonder, patch by Andreas Rottmann. * test-suite/tests/srfi-10.test: Hack to remove srfi-10's clobbering of #,. * test-suite/tests/syncase.test: Add a quasisyntax test. 2009-11-14 Andy Wingo <wingo@pobox.com> add include-from-path * module/ice-9/psyntax.scm (include-from-path): New syntax. Searches the load path for a file, and includes it. psyntax.scm uses #' shorthand for (syntax ...) * module/ice-9/psyntax.scm: Convert to use #'. 2009-11-14 Ludovic Courtès <ludo@gnu.org> Add currently failing tests for optargs. * test-suite/tests/optargs.test (exception:unrecognized-keyword, exception:extraneous-arguments): New variables. ("define*")["extraneous arguments", "unrecognized keyword", "rest given before keywords"]: New tests. Explicitly disable TLS on NetBSD 5.0. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Explicitly disable TLS on NetBSD 5.0. 2009-11-14 Ludovic Courtès <ludo@gnu.org> Have `scm_scan_for_encoding ()' use GC-managed memory. * libguile/read.c (scm_scan_for_encoding): Rename to ... (scm_i_scan_for_encoding): ... this; update callers. Use `scm_gc_strndup ()' instead of `scm_malloc ()'. * libguile/read.h: Update accordingly. * libguile/load.c (scm_primitive_load): Don't call free(3) on the value returned by `scm_i_scan_for_encoding ()'. 2009-11-14 Ludovic Courtès <ludo@gnu.org> Replace `setbinary' by a public `%default-port-encoding' fluid. * doc/ref/api-evaluation.texi (Character Encoding of Source Files): Add reference to the "Ports" node. * doc/ref/api-io.texi (Ports): Document `%default-port-encoding'. * libguile/ports.c (scm_port_encoding_var): Rename to... (default_port_encoding_var): ... this; update callers. Make `static'. * libguile/posix.c (scm_setbinary): Remove. * libguile/posix.h: Adjust accordingly. * test-suite/tests/numbers.test: Remove unneeded `setbinary' call. * test-suite/tests/ports.test: Replace `setbinary' call by equivalent `%default-port-encoding' mutation and `set-port-encoding!' calls. * test-suite/tests/r6rs-ports.test: Replace `setbinary' call by equivalent `%default-port-encoding' mutation. 2009-11-14 Ludovic Courtès <ludo@gnu.org> Explicitly require `sed'. * configure.ac: Use `AC_PROG_SED'. 2009-11-14 Andy Wingo <wingo@pobox.com> fix bugs in ecmascript compiler * module/language/ecmascript/compile-tree-il.scm: Fix a number of bugs, fallen out from the ghil->tree-il conversion. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Add a hack for "return" for javascript. Scheme shouldn't see this because it's not an "interesting primitive". 2009-11-14 Andy Wingo <wingo@pobox.com> fix scoping in let-keywords * module/ice-9/optargs.scm (let-keywords): I thought that I had the scoping right here, but I didn't. Make sure that the lambda formals for the initializers are new, fresh identifiers, so that let scoping works appropriately. fix bug in string comparison * libguile/srfi-13.c (compare_strings): Switch the "longer" and "shorter" arguments. All the callers of this function assumed that shorter came first. Fixes (string<? "abc" "abcd"). 2009-11-10 Ludovic Courtès <ludo@gnu.org> Improve the printer of SRFI-35 error conditions. * module/srfi/srfi-35.scm (print-condition): Print the name and value of each field. 2009-11-08 Ludovic Courtès <ludo@gnu.org> Add support for multiple arities in `arity-mismatch-analysis'. * module/language/tree-il/analyze.scm (validate-arity)[arity]: Rename to... [arities]: ... this. Return all the arities of PROC. Update caller accordingly. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("case-lambda", "case-lambda with wrong number of arguments", "case-lambda*", "case-lambda* with wrong arguments"): New tests. 2009-11-08 Ludovic Courtès <ludo@gnu.org> Update `.gitignore'. Fix C99-style comments. * libguile/generalized-vectors.c, libguile/programs.c, libguile/vm.c: Replace C99-style comments by plain old C89 comments. Compile with `-Warity-mismatch'. * am/guilec (GUILE_WARNINGS): New variable; add `-Warity-mismatch'. (.scm.go): Use it. Add tests for `unbound-variable-analysis'. * test-suite/tests/tree-il.test ("warnings")["unbound variable"]("optional arguments are visible", "keyword arguments are visible"): New tests. Fix optional argument handling in `unused-variable-analysis'. * module/language/tree-il/analyze.scm (unused-variable-analysis): Fix optional argument handling in <lambda-case>. 2009-11-08 Ludovic Courtès <ludo@gnu.org> Add support for keyword arguments in `arity-mismatch-analysis'. * module/language/tree-il/analyze.scm (validate-arity)[filter-keyword-args]: New procedure. [arity]: Get accurate arity for programs, return ALLOW-OTHER-KEYS? as an additional value. Update to `arity' change; use `filter-keyword-args'. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("keyword not passed and quiet", "keyword passed and quiet", "keyword passed to global and quiet", "extra keyword", "extra keywords allowed"): New tests. 2009-11-07 Ludovic Courtès <ludo@gnu.org> Fix typos leading to wrong argument counts. * module/ice-9/channel.scm (eval): Fix number of arguments to `guile:eval'. * module/oop/goops/save.scm (write-readably): Fix number of arguments to `write-array'. * module/srfi/srfi-19.scm (priv:char->int): Fix number of arguments to `priv:time-error'. 2009-11-07 Ludovic Courtès <ludo@gnu.org> Fix typos in `psyntax'. * module/ice-9/psyntax.scm (lambda*-formals): Fix argument count in `rest' invocations. [pred]: Fix argument count in `syntax->datum' invocation. 2009-11-07 Ludovic Courtès <ludo@gnu.org> Add `arity-mismatch' warning type. * module/language/tree-il/analyze.scm (<arity-info>): New record type. (validate-arity, arity-analysis): New variables. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `arity-mismatch'. * module/system/base/message.scm (%warning-types): Likewise. * test-suite/tests/tree-il.test (read-and-compile): Remove, as it's now public. (%opts-w-arity): New. ("warnings")["arity mismatch"]: New test prefix. 2009-11-06 Ludovic Courtès <ludo@gnu.org> Coalesce tree traversals made for warnings. * module/language/tree-il/analyze.scm (<tree-analysis>): New type. (analyze-tree): New procedure. (report-unused-variables): Replace by... (unused-variable-analysis): ... this, as a <tree-analysis>. (report-possibly-unbound-variables): Replace by... (unbound-variable-analysis): ... this, as a <tree-analysis>. * module/language/tree-il/compile-glil.scm (%warning-passes): Adjust accordingly. (compile-glil): Likewise. Use `analyze-tree'. 2009-11-05 Ludovic Courtès <ludo@gnu.org> Hold the GC lock when traversing weak hash table buckets. * libguile/hashtab.c (scm_fixup_weak_alist): Clarify comment. (struct t_assoc_args): New. (do_weak_bucket_assoc, weak_bucket_assoc): New. (START_WEAK_BUCKET_FIXUP, END_WEAK_BUCKET_FIXUP): Remove. (scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_remove_x): Use `weak_bucket_assoc ()' instead of `START_WEAK_BUCKET_FIXUP'/`END_WEAK_BUCKET_FIXUP'. Fix snarfing of `SCM_DEFINE' with static allocation. * libguile/snarf.h (SCM_DEFINE)[SCM_SUPPORT_STATIC_ALLOCATION]: Provide a declaration for FNAME since the last argument to `SCM_IMMUTABLE_SUBR ()' refers to it. 2009-11-04 Neil Jerram <neil@ossau.uklinux.net> Fill code coverage holes in continuations.c and keywords.c * test-suite/Makefile.am (SCM_TESTS): Add tests/keywords.test. * test-suite/standalone/Makefile.am (test-loose-ends): New test. * test-suite/standalone/test-loose-ends.c: New file. * test-suite/tests/continuations.test: Three new tests. * test-suite/tests/keywords.test: New file. 2009-11-03 Neil Jerram <neil@ossau.uklinux.net> Increase benchmark iterations to improve precision in comparisons over time * benchmark-suite/benchmarks/continuations.bm: Increase "call/cc" iterations from 300 to 12000. * benchmark-suite/benchmarks/srfi-13.bm ("strings"): Increase "copy" iterations from 1100 to 20000, and "pad" from 6800 to 34000. * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): Increase "uniform-vector-write" iterations from 500 to 4000, and "uniform-vector-read!" from 500 to 20000. 2009-11-02 Ludovic Courtès <ludo@gnu.org> Allocate vectors in a contiguous memory area. * libguile/vectors.c (scm_c_make_vector): Allocate the whole vector and header with `scm_gc_malloc ()'. (scm_vector_copy): Use `scm_c_make_vector ()'. (scm_i_vector_free, MAKE_WEAK_VECTOR): Remove. (allocate_weak_vector): Rename to... (make_weak_vector): ... this. Change to return the whole weak vector, allocated with `scm_gc_malloc_pointerless ()'. (scm_i_make_weak_vector, scm_i_make_weak_vector_from_list): Use `make_weak_vector ()'. * libguile/vectors.h (SCM_I_VECTOR_HEADER_SIZE): New macro. (SCM_I_VECTOR_ELTS): Write in terms of `SCM_I_VECTOR_WELTS ()'. (SCM_I_VECTOR_WELTS): Update to the new representation. (SCM_I_WVECT_EXTRA, SCM_I_SET_WVECT_EXTRA): Likewise. (SCM_I_WVECT_GC_CHAIN, SCM_I_SET_WVECT_GC_CHAIN): Remove. * libguile/weaks.h (SCM_I_WVECT_DELTA, SCM_I_SET_WVECT_DELTA): Remove. 2009-11-01 Ludovic Courtès <ludo@gnu.org> Restore signature of `scm_search_path ()' as found in 1.8. The incompatibly was introduced by 22f4ee48822db5e30df3abf9a11b6066f2bab9d3 ("make primitive-load-path load compiled files if available"). * doc/ref/api-options.texi (Build Config): Update `search-path' documentation. * libguile/load.c (scm_search_path): Change C prototype to expect only 3 arguments. Parse the rest argument accordingly. Update callers. * libguile/load.h (scm_search_path): Update accordingly. 2009-11-01 Ludovic Courtès <ludo@gnu.org> Merge branch 'bdw-gc-static-alloc' Conflicts: acinclude.m4 libguile/__scm.h libguile/bdw-gc.h libguile/eval.c 2009-10-30 Ken Raeburn <raeburn@raeburn.org> Clean up some uses of old GC macros that don't exist any more. * libguile/deprecated.h (SCM_GC8MARKP, SCM_SETGC8MARK, SCM_CLRGC8MARK): Delete. * libguile/gc.c (scm_assert_cell_valid): Remove check of SCM_GC_MARK_P. 2009-10-30 Ken Raeburn <raeburn@raeburn.org> Since support for "futures" in C has been completely disabled for some time, and should be easily implementable in Scheme with the current thread support, delete the C code. * libguile/futures.c, libguile/futures.h: Delete. * libguile/Makefile.am (libguile_la_SOURCES, DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Delete references to futures.* files. * libguile.h: Don't include futures.h. * libguile/eval.c: Don't include futures.h. (isymnames): Delete "#@future" entry. (scm_m_future, s_future, scm_sym_future, unmemoize_future, unmemoize_builtin_macro): Delete disabled futures code. * libguile/eval.i.c (CEVAL): Delete disabled futures code. * libguile/init.c: Don't include futures.h. (scm_i_init_guile): Delete disabled futures initialization call. * libguile/tags.h (SCM_IM_FUTURE): Delete. (SCM_IM_CALL_WITH_VALUES, SCM_IM_ELSE, SCM_IM_ARROW, SCM_IM_NIL_COND, SCM_IM_BIND): Renumber. * doc/ref/api-scheduling.texi: Delete commented-out node on Futures. * doc/maint/guile.texi: Delete make-future and future-ref mentions. 2009-10-30 Ken Raeburn <raeburn@raeburn.org> * meta/gdb-uninstalled-guile.in: Specify a path to libtool. Fix autogen.sh for Mac OS X. * autogen.sh: If uname indicates that the OS is Darwin, run "glibtool" instead of "libtool" for the version number check. 2009-10-28 Michael Gran <spk121@yahoo.com> Fix incorrect display of wide strings in decompilation A byte ordering error caused incorrect display of wide strings when using the ",c" decompilation from the REPL. * module/language/assembly/decompile-bytecode.scm (decode-bytecode): wide strings are encoded in native endianness 2009-10-28 Michael Gran <spk121@yahoo.com> Modify bytevectors/string conversions to allow wide strings The bytevector to string conversion functions were accomplished by converting via locale strings. This did not allow conversions of wide strings in an 8-bit locale. This is avoided by using knowledge of the storage format of the string. * libguile/bytevectors.c (STRING_TO_UTF, scm_string_to_utf8): modify string to bytevector conversion to use internal string information (UTF_TO_STRING, scm_utf8_to_string): modify bytevector to string conversion 2009-10-27 Mark H Weaver <mhw@netris.org> fix nil handling in the vm * libguile/vm-i-scheme.c (not, not-not): Treat nil as false. (null?, not-null?): Treat nil as null. * libguile/vm-i-system.c (br-if, br-if-not): Treat nil as false. (br-if-null, br-if-not-null): Treat nil as null. 2009-10-27 Mark H Weaver <mhw@netris.org> the cube of lisp booleans (#f nil () #t) * Renumbers the IFLAG constants. * Adds several macros related to boolean type tests, null tests, and boolean-truth testing (including lisp-style boolean-truth tests). * Adds compile-time checks to verify the necessary IFLAG numbering properties needed for the checks to work properly. * Changes some existing code to use the new optimized macros, without changing the semantics of the code at all (except that scm_is_bool is changed from a function to a macro). I added the following macros, whose names explicitly state how %nil should be handled. See the comments in the patch for more information about these. scm_is_false_assume_not_lisp_nil scm_is_true_assume_not_lisp_nil scm_is_false_and_not_lisp_nil scm_is_true_or_lisp_nil scm_is_false_or_lisp_nil scm_is_true_and_not_lisp_nil scm_is_lisp_false scm_is_lisp_true scm_is_null_assume_not_lisp_nil scm_is_null_and_not_lisp_nil scm_is_null_or_lisp_nil scm_is_bool_and_not_lisp_nil scm_is_bool_or_lisp_nil The following already-existing macros are defined as aliases, such that their semantics is unchanged (although scm_is_bool used to be a function and is now a macro). scm_is_null --> scm_is_null_and_not_lisp_nil scm_is_false --> scm_is_false_and_not_lisp_nil scm_is_true --> scm_is_true_or_lisp_nil scm_is_bool --> scm_is_bool_and_not_lisp_nil (I still believe that these should be changed to versions that handle %nil properly, but await approval on that point, so these patches do not make those changes) Also, if the preprocessor macro SCM_ENABLE_ELISP is not true (this macro already existed and was used in lang.h), all overheads associated with %nil handling are eliminated from the above macros. * libguile/tags.h (SCM_BOOL_F, SCM_BOOL_T, SCM_UNSPECIFIED) (SCM_UNDEFINED, SCM_UNBOUND, SCM_ELISP_NIL): Renumber, so that a number of important distinctions (false versus true, end-of-list, etc) can be made by masking a single bit. Also define a number of build-time tests to assert that this condition holds. * libguile/boolean.h (scm_is_false_and_not_nil, scm_is_true_or_nil) (scm_is_false_assume_not_nil, scm_is_true_assume_not_nil): (scm_is_false_or_nil, scm_is_true_and_not_nil) (scm_is_bool_or_nil, scm_is_bool_and_not_nil): New exciting macros to test certain boolean/end-of-list properties. (scm_is_false, scm_is_true): Use a restrictive definition, where only SCM_BOOL_F is false. Should probably change in the future. (scm_is_bool): Incompatible change: changed to be a macro. Was a function before. Probably should allow nil as a boolean, but that will be for a later patch. (scm_is_lisp_false, scm_is_lisp_true): New macros, implementing the standard Lisp boolean predicates, where '() is actually false. * libguile/eval.i.c (CEVAL): Fix a number of false-or-nil and similar tests to use the new macros. * libguile/lang.h (SCM_NULL_OR_NIL_P): Use scm_is_null_or_nil. * libguile/pairs.c: Add a compile-time check that null and nil differ by only one bit. * libguile/pairs.h (scm_is_null_and_not_nil, scm_is_null_assume_not_nil) (scm_is_null_or_nil): New exciting macros! (scm_is_null): Just be scm_is_null_and_not_nil, for now. * libguile/print.c: Adapt to the reordering, and print suitably nasty things for the not-to-be-used values. 2009-10-27 Ludovic Courtès <ludo@gnu.org> Use proper fold/for-each function types in `hashtab.h'. * libguile/hashtab.h (scm_t_hash_fold_fn, scm_t_hash_handle_fn): New types. (scm_internal_hash_fold, scm_internal_hash_for_each_handle): Use them. * libguile/hashtab.c (scm_internal_hash_fold): Take an `scm_t_hash_fold_fn'. Update callers. (scm_internal_hash_for_each_handle): Take an `scm_t_hash_handle_fn'. Update callers. 2009-10-27 Ludovic Courtès <ludo@gnu.org> Use proper assoc/hash function types in `hashtab.c'. This is a followup to d587c9e8b27219e68f8813fb648fc6913c93be0f ("Use proper types for hash/assoc functions in `hashtab.h'."). * libguile/hashtab.c (scm_i_rehash, scm_hash_fn_create_handle_x, scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Use `scm_t_hash_fn' and `scm_t_assoc_fn' as appropriate. 2009-10-27 Andy Wingo <wingo@pobox.com> update procedure docs for programs, lambda*, case-lambda * module/system/vm/program.scm: Export the arity things again, and program-arity. Why not. * doc/ref/api-procedures.texi (Compiled Procedures): Update for current API. (Optional Arguments): Update to assume lambda* and define* are always available, and (ice-9 optargs) is now the ghetto. (Case-lambda): Now here, moved from SRFI-16 docs. Also docs case-lambda*. * doc/ref/srfi-modules.texi: Point to core case-lambda docs. 2009-10-26 Andy Wingo <wingo@pobox.com> implement #:predicate will be useful for making e.g. typecase-lambda. Tough to tell though. * module/ice-9/psyntax.scm (lambda-formals, lambda*-formals): Parse out a #:predicate, which goes right before the rest args. The vanilla lambda doesn't parse it out of course, but it does return another value. (chi-lambda-case, lambda*, lambda): Expand and pass the predicate on to build-lambda-case. * module/ice-9/psyntax-pp.scm: Regenerate. * module/language/tree-il/compile-glil.scm (flatten): Compile a failing predicate without an else clause into a call to `error'. Also, fix something the compile warnings caught. 2009-10-26 Ludovic Courtès <ludo@gnu.org> Don't use memset(3) after `GC_MALLOC ()' calls. * libguile/gc-malloc.c (scm_gc_calloc): Don't use memset(3) as it's not needed. Reported by Andy Wingo. 2009-10-25 Julian Graham <julian.graham@aya.yale.edu> Resolve warning in gcc-4.3 about transposed parameters passed to memset * libguile/gc-malloc.c (scm_gc_calloc): Add explicit check on size parameter 2009-10-25 Ludovic Courtès <ludo@gnu.org> SRFI-35: Provide nice vtable names, to make GOOPS happier. * module/srfi/srfi-35.scm (%make-condition-type): New procedure. (make-condition-type, make-compound-condition-type): Use it. * test-suite/tests/srfi-35.test ("condition types")["struct-vtable-name"]: New test. 2009-10-25 Ludovic Courtès <ludo@gnu.org> Fix GOOPS `class-of' for nameless structs. * libguile/goops.c (scm_class_of): Fix second argument for `scm_make_extended_class_from_symbol ()' for nameless structs. * test-suite/tests/goops.test ("classes for built-in types")["struct vtable"]: New test case. 2009-10-25 Andy Wingo <wingo@pobox.com> srfi-16 just re-exports psyntax's case-lambda * module/srfi/srfi-16.scm (case-lambda): Just re-export the core's case-lambda, it's semantically the same but faster and better integrated. 2009-10-25 Andy Wingo <wingo@pobox.com> case-lambda, case-lambda* in psyntax * module/ice-9/psyntax.scm (case-lambda, case-lambda*): Add implementations of these, present in the base environment. * module/ice-9/psyntax-pp.scm: Regenerated. * module/srfi/srfi-16.scm (case-lambda): Replace the core's case-lambda definition with our own. We're not quite ready to switch yet. 2009-10-25 Andy Wingo <wingo@pobox.com> assembly/disassembly support for br-if-nargs-* * module/language/assembly/compile-bytecode.scm (write-bytecode): Handle br-if-nargs compilation. * module/language/assembly/decompile-bytecode.scm (decode-load-program): And decompile them nicely as well. * module/language/assembly/disassemble.scm (code-annotation): And, present the disassembly if br-if-nargs-* nicely. 2009-10-25 Andy Wingo <wingo@pobox.com> arities can have noncontiguous starts and ends * module/language/glil/compile-assembly.scm (open-arity, close-arity) (begin-arity, glil->assembly): Refactor so that arities can have noncontiguous starts and ends. So within a prelude there is no arity -- only before (the previous arity) or after (the new arity). * module/system/vm/program.scm (arity:end): Add this private accessor. Arities are expected to be in the new format. While not a change in objcode format, it is an incompatible change, so I'll bump the objcode cookie. (program-arity): Check that the ip is within both bounds of the arity. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/programs.c (scm_i_program_arity): Update for new arity format. * module/system/vm/frame.scm (vm-frame-arguments): Avoid throwing an error in this function, which is called from the backtrace code. 2009-10-25 Andy Wingo <wingo@pobox.com> refactor psyntax.scm's treatment of lambda and lambda* * module/ice-9/psyntax.scm (lambda-formals, chi-simple-lambda) (lambda*-formals, chi-lambda-case): Refactor the lambda transformations with an eye to being able to do case-lambda. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syntax.test: Adapted tests so that the errors we expect match what is given by psyntax. 2009-10-24 Andy Wingo <wingo@pobox.com> define* in psyntax * module/ice-9/optargs.scm: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: Make define* available in the default environment, as lambda* is available there. procedure property table is only key-weak, not doubly-weak * libguile/procprop.c: Make the procedure property table only key-weak. It seems that we want the association as long as the key is around. 2009-10-23 Ken Raeburn <raeburn@raeburn.org> Reduce some errors under -DSCM_DEBUG=1. * goops.c (scm_sys_modify_instance, scm_sys_modify_class): Use SCM_{,SET_}CELL_WORD_[01] instead of SCM_{,SET}C[AD]R since the objects passed are not pairs. 2009-10-23 Andy Wingo <wingo@pobox.com> (ice-9 optargs) based on the new lambda* work * module/ice-9/optargs.scm (let-optional, let-optional*, let-keywords) (let-keywords*): Implement in terms of parse-lambda-case, so all the logic is in one place. (lambda*): Re-export from the default environment -- it's all in the VM now :-)) (define*, define*-public, defmacro*, defmacro*-public): Implement with syntax-case. 2009-10-23 Andy Wingo <wingo@pobox.com> lambda* in psyntax * module/ice-9/psyntax.scm (build-lambda-case): Take an "inits" arg. Also work around a nasty memoizer bug: see http://article.gmane.org/gmane.lisp.guile.devel/9561. (lambda*): Implement in psyntax, in the default environment. Exciting stuff! * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/optargs.scm (parse-lambda-case): Helper for lambda* when we're running under the interpreter. 2009-10-23 Andy Wingo <wingo@pobox.com> separate "inits" field in <lambda-case>; compile fixes for inits, kwargs * module/language/tree-il.scm (<lambda-case>): Add "inits" field, so we don't have to parse it out of opt and kw. Adapt the traversal procedures. * module/language/tree-il/analyze.scm (analyze-lexicals): Analyze lexicals in the <lambda-case> init expressions as well. Fix keyword allocation. * module/language/tree-il/compile-glil.scm (compile-glil): Adapt to make-lambda-case change. (flatten): Adapt to "inits" slot, actually init uninitialized args, and fix bugs related to keyword arguments. * module/language/tree-il/inline.scm (inline!): Adapt a little bit -- but with no effect. * module/language/glil/compile-assembly.scm (glil->assembly): Flesh out <glil-kw-prelude> compilation some more. Add a "bound?" op for <glil-lexical>, which will push #t if the local is bound. * module/ice-9/psyntax.scm (build-simple-lambda, build-lambda-case): Update for new signature of make-lambda-case. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/brainfuck/compile-tree-il.scm (compile-body): * module/language/ecmascript/compile-tree-il.scm (comp): * test-suite/tests/tree-il.test ("lambda"): Update for new lambda-case syntax. 2009-10-23 Andy Wingo <wingo@pobox.com> add some optargs tests * libguile/modules.c (scm_module_lookup, scm_lookup): Throw to 'unbound-variable, like eval.i.c does. * test-suite/tests/optargs.test: Add an optargs test. Run optargs tests under both the VM and the interpreter. 2009-10-23 Andy Wingo <wingo@pobox.com> vm support for optional/kwarg init code, and bugfixes * libguile/vm-i-system.c (local-bound?, long-local-bound?) (variable-bound?): New instructions, push #f unless the local is bound. You can get unbound locals from optional arguments. (bind-optionals/shuffle): A number of bugfixes. (bind-kwargs): Bugfixes. If we enocunter an improper kwarg list but the procedure has a rest argument, just stop kwarg processing, but without an error. Renumbered ops. * libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION): Bump. 2009-10-23 Andy Wingo <wingo@pobox.com> more work towards compiling and interpreting keyword args * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bumparoo * libguile/vm-i-system.c (push-rest, bind-rest): Logically there are actually two rest binders -- one that pops, conses, and pushes, and one that pops, conses, and local-sets. The latter is used on keyword arguments, because the keyword arguments themselves have been shuffled up on the stack. Renumber ops again. * module/language/tree-il/compile-glil.scm (flatten): Attempt to handle compilation of lambda-case with keyword arguments. Might need some help. * module/ice-9/psyntax.scm (build-lambda-case): An attempt to handle the interpreted case correctly. This might need a couple iterations, but at least it looks like the compile-glil code. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/glil.scm (<glil>): Rename "rest?" to "rest" in <glil-opt-prelude> and <glil-kw-prelude>, as it is no longer a simple boolean, but if true is an integer: the index of the local variable to which the rest should be bound. * module/language/glil/compile-assembly.scm (glil->assembly): Adapt to "rest" vs "rest?". In the keyword case, use "bind-rest" instead of "push-rest". * test-suite/tests/tree-il.test: Update for opt-prelude change. 2009-10-23 Andy Wingo <wingo@pobox.com> finish support for optional & keyword args; update ecmascript compiler * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (br-if-nargs-ne, br-if-args-lt) (br-if-nargs-gt): New instructions, for use by different lambda cases. (bind-optionals, bind-optionals/shuffle, bind-kwargs): New instructions, for binding optional and keyword arguments. Renumber other ops. * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): Update for new tree-il. Use the new optional argument mechanism instead of emulating it with rest arguments. * module/language/glil/compile-assembly.scm (glil->assembly): Tweaks for optional and keyword argument compilation. * module/language/tree-il.scm (parse-tree-il, unparse-tree-il): Make the else case optional, in the s-expression serialization of tree-il. * module/language/tree-il/compile-glil.scm (flatten): Handle all of the lambda-case capabilities. 2009-10-23 Andy Wingo <wingo@pobox.com> fix brainfuck for new tree-il, and add tests * test-suite/Makefile.am: * test-suite/tests/brainfuck.test: Add a brainfuck test. * module/system/base/compile.scm: Also export read-and-compile. * module/language/tree-il/spec.scm (join): Fix the joiner in the 0-expression case. * module/language/tree-il/primitives.scm (+): Recognize (+ x -1) as 1-. * module/language/brainfuck/parse.scm (read-brainfuck): Return EOF if we actually received EOF, and there were no expressions read. * module/language/brainfuck/compile-tree-il.scm (compile-body): Fix the compiler for the new format of "lambda" in tree-il. 2009-10-23 Andy Wingo <wingo@pobox.com> tree-il support for case-lambda * module/language/tree-il.scm (<lambda>, <lambda-case>): Split lambda into the lambda itself, denoting the procedure, and lambda-case, denoting a particular arity case. Lambda-case is fairly featureful, and has not yet been fully tested. (<let-values>): Use a <lambda-case> as the binding expression. Seems to suit the purpose well. Adapt parsers, unparsers, traversal operators, etc. Sometimes in this first version we assume there are no optional args, rest args, or a predicate. * module/language/tree-il/analyze.scm (analyze-lexicals): Adapt for the new case-lambda regime. Fairly well commented. It actually simplifies things. (report-unused-variables): Update for new tree-il. * module/language/tree-il/compile-glil.scm: Adapt for the new tree-il. There are some first stabs here at proper case-lambda compilation, but they are untested as of yet. * module/language/tree-il/inline.scm (inline!): Rework so we can recurse on a single node; though these transformations are strictly reductive, so they should complete in bounded time. Simplify accordingly, and adapt to case-lambda. Oh, and we handle lambda->let in not just the nullary case. * module/ice-9/psyntax.scm (build-simple-lambda, build-case-lambda) (build-lambda-case): New constructors. The idea is that after syntax expansion, we shouldn't have to deal with improper lists any more. Build-simple-lambda is a shortcut for the common case. The others are not fully exercised yet. Adapt callers. (syntax): Add some debugging in the lambda case. I don't fully understand this, but in practice we don't seem to see rest args here. (lambda): Inline chi-lambda-clause, and adapt for build-simple-lambda. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/tree-il.test: Update tests for new tree-il lambda format, and to expect post-prelude labels for all glil programs. 2009-10-23 Andy Wingo <wingo@pobox.com> procedure property efficiency tweak * libguile/procprop.c (scm_procedure_property) scm_set_procedure_property_x): Fix to not call scm_procedure_properties(), and thus to avoid consing up the arity as well. 2009-10-23 Andy Wingo <wingo@pobox.com> flesh out glil support for optional and keyword arguments * libguile/vm-i-system.c (bind-rest): Renamed from push-rest-list. (reserve-locals): Change so that instead of reserving space for some additional number of locals, reserve-locals takes the absolute number of locals, including the arguments. * module/language/glil.scm (<glil-std-prelude>, <glil-opt-prelude>) (<glil-kw-prelude>): New GLIL constructs, to replace <glil-arity>. * module/language/glil/compile-assembly.scm (glil->assembly): Compile the new preludes. Some instructions are not yet implemented, though. * module/language/tree-il/analyze.scm (analyze-lexicals): The nlocs for a lambda will now be the total number of locals, including arguments. * module/language/tree-il/compile-glil.scm (flatten-lambda): Update to write the new prelude. * module/system/vm/program.scm (program-bindings-for-ip): If a given index doesn't have a binding at the ip given, don't cons it on the resulting list. * test-suite/tests/tree-il.test: Update for GLIL changes. 2009-10-23 Andy Wingo <wingo@pobox.com> de-nargs struct scm_objcode; procedure-property refactor * libguile/objcodes.h (struct scm_objcode): Remove nargs, nrest, and nlocs, as they are no longer needed. Also obviates the need for a padding word. * libguile/procs.c (scm_thunk_p): Use scm_i_program_arity for programs. * libguile/procprop.c (scm_i_procedure_arity): Use scm_i_program_arity for programs. (scm_procedure_properties, scm_set_procedure_properties_x) (scm_procedure_property, scm_set_procedure_property_x): Rework so that non-closure properties are stored directly in a weak hash, instead of needing a weak hash of "stand-in" closures to hold the properties. Fix docstrings also. * libguile/root.h (scm_stand_in_procs): Remove from the scm_sys_protects set. Actually with libGC, we should be able to store the elements of scm_sys_protects directly as global variables. * libguile/gc.c (scm_init_storage): Remove scm_stand_in_procs initialization. * libguile/programs.c (scm_i_program_arity): New private accessor, tries to determine the "minimum arity" of a program. * libguile/vm.c (really_make_boot_program): Adapt to changes in struct scm_objcode. * module/language/assembly.scm (*program-header-len*, byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): Adapt to changes in objcode. * module/system/xref.scm (program-callee-rev-vars): Adapt to changes in assembly. * module/language/glil.scm: Remove nargs, nrest, and nlocs from glil-program. * module/language/glil/compile-assembly.scm (make-meta, glil->assembly): * module/language/glil/decompile-assembly.scm (decompile-toplevel): (decompile-load-program): Adapt to changes in GLIL and assembly. * module/language/tree-il/compile-glil.scm (flatten-lambda): Adapt to changes in GLIL. * test-suite/tests/asm-to-bytecode.test: Adapt to assembly and bytecode changes. * test-suite/tests/tree-il.test: Adapt to GLIL changes. 2009-10-23 Andy Wingo <wingo@pobox.com> callees now check their args, cons rest list, reserve locals * gdbinit: Ignore SIGPWR and SIGXCPU, which the BDW GC seems to use. * libguile/vm-engine.h (FETCH_WIDTH): Remove unused macro. (INIT_ARGS, INIT_FRAME): Remove; callees now check their args and reserve space for their locals. * libguile/vm-engine.c: * libguile/vm-i-system.c: Turn on callee arg checking and local reservation. Seems to work! 2009-10-23 Andy Wingo <wingo@pobox.com> callees reserve their own local vars * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (reserve-locals): New instruction, to reserve space for local vars. Other ops renumbered. * module/language/tree-il/compile-glil.scm (flatten-lambda): Emit reserve-locals instructions as necessary. * test-suite/tests/tree-il.test: Update to expect reserve-locals as appropriate. 2009-10-23 Andy Wingo <wingo@pobox.com> runtime and debugging support for callee-parsed procedure args * libguile/objcodes.h: Bump for metadata format change. * libguile/frames.h: Rework so we don't frob the program's nargs, nlocs, etc at runtime. Instead we don't really know what's a local var, an argument, or an intermediate value. It's a little unfortunate, but this will allow for case-lambda, and eventually for good polymorphic generic dispatch; and the nlocs etc can be heuristically reconstructed. Such a reconstruction would be better done at the Scheme level, though. (SCM_FRAME_STACK_ADDRESS): New macro, the pointer to the base of the stack elements (not counting the program). (SCM_FRAME_UPPER_ADDRESS): Repurpose to be the address of the last element in the bookkeeping part of the stack -- i.e. to point to the return address. * libguile/vm-engine.h: * libguile/vm-i-system.c: Adapt to removal of stack_base. Though we still detect stack-smashing underflow, we don't do so as precisely as we did before, because now we only detect overwriting of the frame metadata. * libguile/vm-engine.c (vm_engine): Remove the stack_base variable. It is unnecessary, and difficult to keep track of in the face of case-lambda. Also fix miscommented "ra" and "mvra" pushes. Push the vp->ip as the first ra... * libguile/vm-i-system.c (halt): ...because here we can restore the vp->ip instead of setting ip to 0. Allows us to introspect ips all down the stack, including in recursive VM invocations. * libguile/frames.h: * libguile/frames.c (scm_vm_frame_stack): Removed, because it's getting more difficult to tell what's an argument and what's a temporary stack element. (scm_vm_frame_num_locals): New accessor. (scm_vm_frame_instruction_pointer): New accessor. (scm_vm_frame_arguments): Defer to an implementation in Scheme. (scm_vm_frame_num_locals scm_vm_frame_local_ref) (scm_vm_frame_local_set_x): Since we can get not-yet-active frames on the stack now, with our current calling convention, we have to add a heuristic here to jump over those frames -- because frames have pointers in them, not Scheme values. * libguile/programs.h: * libguile/programs.c (scm_program_arity): Remove, in favor of.. (scm_program_arities): ...this, which a list of arities, in a new format, occupying a slot in the metadata. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Fix mv-call decompilation. * module/system/vm/frame.scm (vm-frame-bindings, vm-frame-binding-ref) (vm-frame-binding-set!): New functions, to access bindings by name in a frame. (vm-frame-arguments): Function now implemented in Scheme. Commented fairly extensively. * module/system/vm/program.scm (program-bindings-by-index) (program-bindings-for-ip): New accessors, parsing the program bindings metadata into something more useful. (program-arities, program-arguments): In a case-lambda world, we have to assume that programs can have multiple arities. But it's tough to detect this algorithmically; instead we're going to require that the program metadata include information about the arities, and the parts of the program that that metadata applies to. (program-lambda-list): New accessor. (write-program): Show multiple arities. * module/language/glil/compile-assembly.scm (glil->assembly): Add "arities" to the state of the compiler, and add arities entries as appropriate. 2009-10-23 Andy Wingo <wingo@pobox.com> steps on the way to have the callee check the number of arguments * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (assert-nargs-ee, assert-nargs-ge) (push-rest-list): New instructions, which for now don't actually do anything. Renumber the rest of the ops in this file. * module/language/glil.scm (<glil-arity>): New GLIL type, an entity that checks the number of args for a block, optionally consing a rest list, and either branching or erroring if the arity doesn't match. * module/language/glil/compile-assembly.scm (glil->assembly): Compile <glil-arity> to assembly. Some of these VM ops are not implemented -- notably the branching case. * module/language/tree-il/compile-glil.scm (flatten-lambda): Emit <glil-arity>. * test-suite/tests/tree-il.test: Update. 2009-10-22 Ludovic Courtès <ludo@gnu.org> Compile Guile modules with `-Wunbound-variable'. * am/guilec (.scm.go): Compile with `-Wunbound-variable'. 2009-10-22 Ludovic Courtès <ludo@gnu.org> Fix typos leading to unbound variable references. * module/ice-9/session.scm (help): Fix unbound reference to `env'. * module/system/vm/program.scm (program-property): Fix typo. * module/system/vm/frame.scm: Add missing `#:use-module (system vm objcode)'. * module/system/repl/command.scm (guile:load): New. (load): Use either `primitive-load' or `load'. * module/srfi/srfi-18.scm (thread-sleep!): Fix typo. * module/srfi/srfi-19.scm: Use `(ice-9 rdelim)'. (date->broken-down-time, priv:year-day, priv:char->int): Fix typo. (time-*->time-*, time-*->time-*!): Fix reference to unbound variable `caller'. * module/oop/goops.scm (bound-check-get): Fix typo. * module/language/glil/compile-assembly.scm (glil->assembly): Fix typo. * module/language/glil.scm (parse-glil): Fix typo. * module/language/ecmascript/base.scm (object->value/string, object->value/number, ->number): Fix typos. * module/language/assembly/disassemble.scm (disassemble-free-vars): Fix typo. 2009-10-22 Ludovic Courtès <ludo@gnu.org> Adjust `unbound-variable' GOOPS heuristic for `goops.scm'. * module/language/tree-il/analyze.scm (goops-toplevel-definition): Add ENV argument. Deal with GOOPS macros expanded within `goops.scm'. (report-possibly-unbound-variables): Adjust. Fix bytecode disassembler. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Add missing argument to `ensure-label'. SRFI-88: Call `read-set!' at compile time and run time. * module/srfi/srfi-88.scm: Call `read-set!' both at compile time and run time. Remove obsolete `save-stack' case. * module/ice-9/boot-9.scm (save-stack): Remove obsolete `tk-stack' case. 2009-10-22 Ludovic Courtès <ludo@gnu.org> Have `-Wunbound-variable' account for GOOPS top-level definitions. * module/language/tree-il/analyze.scm (goops-toplevel-definition): New procedure. (report-possibly-unbound-variables): Check for GOOPS top-level definitions. * test-suite/tests/tree-il.test ("warnings")["GOOPS definitions are visible"]: New test. 2009-10-21 Ludovic Courtès <ludo@gnu.org> Add a `guile-2' SRFI-0 feature. * doc/ref/srfi-modules.texi (SRFI-0): Mention the `guile-2' feature. * module/ice-9/boot-9.scm (%cond-expand-features): Add `guile-2'. 2009-10-20 Ludovic Courtès <ludo@gnu.org> Use proper types for hash/assoc functions in `hashtab.h'. Partly fixes bug #23681 ("Function declarators with empty parentheses should not be used"). * libguile/goops.c (scm_wrap_component): Cast `scm_sloppy_assq'. * libguile/hashtab.c (scm_hash_fn_get_handle): Update to take functions of type `scm_t_hash_fn' and `scm_t_assoc_fn'. Update callers. (scm_ihashx): Change to match `scm_t_hash_fn'. (scm_sloppy_assx): Change to match `scm_t_assoc_fn'. * libguile/hashtab.h (scm_t_hash_fn, scm_t_assoc_fn): New types. (scm_t_hashtable)[hash_fn]: Change to `scm_t_hash_fn'. (scm_i_rehash, scm_hash_fn_get_handle, scm_hash_fn_create_handle_x, scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Change to take `scm_t_hash_fn' and `scm_t_assoc_fn' parameters. * libguile/srcprop.h (scm_whash_get_handle, scm_whash_create_handle, scm_whash_lookup): Implement in terms of `scm_hashq_*' instead of `scm_hash_fn_*'. * libguile/struct.c (scm_struct_ihashq): Change to match `scm_t_hash_fn'. (scm_struct_create_handle): Cast `scm_sloppy_assq'. * libguile/struct.h (scm_struct_ihashq): Update, make internal. 2009-10-19 Julian Graham <julian.graham@aya.yale.edu> Fix typo in psyntax.scm related to syntax-violation reporting. * module/ice-9/psyntax.scm (chi-macro): Replace `s' with `(wrap-subst w)'. 2009-10-19 Ludovic Courtès <ludo@gnu.org> Add support for R6RS/SRFI-30 nested block comments. Suggested by Andreas Rottmann <a.rottmann@gmx.at>. * libguile/read.c (flush_ws, scm_read_sharp): Add support for R6RS/SRFI-30 block comments. (scm_read_r6rs_block_comment): New function. * test-suite/tests/reader.test (exception:unterminated-block-comment): Adjust to match both block comment styles. ("reading")["R6RS/SRFI-30 block comment", "R6RS/SRFI-30 nested block comment", "R6RS/SRFI-30 block comment syntax overridden"]: New tests. ("exceptions")["R6RS/SRFI-30 unterminated nested block comment"]: New test. * doc/ref/api-evaluation.texi (Block Comments): Mention SRFI-30/R6RS block comments. * doc/ref/srfi-modules.texi (SRFI-30): New node. 2009-10-16 Andy Wingo <wingo@pobox.com> comment fixups to tree-il/compile-glil.scm * module/language/tree-il/compile-glil.scm: Remove some outdated comments. 2009-10-16 Andy Wingo <wingo@pobox.com> jumps encoded using 24 bits, not 19; blocks no longer aligned * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (FETCH_OFFSET, BR): Labels are no longer 8-byte aligned; instead, jumps are encoded into 3 bytes instead of 2. (br, br-if, br-if-not, br-if-eq, br-if-not-eq, br-if-null) (br-if-not-null, mv-call): Adapt for new length of br instructions (3 bytes instead of 2). * libguile/vm.c (really_make_boot_program): Adapt hand-coded bytecode for new offset regime. * module/language/assembly.scm (align-block): No alignment necessary. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out breaks as 24-bit relative jumps. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decompile break instructions. 2009-10-16 Andy Wingo <wingo@pobox.com> compilation enviroments are always modules; simplifications & refactorings * module/ice-9/boot-9.scm (make-fresh-user-module): New public function, makes an anonymous beautified module. * module/language/objcode/spec.scm: We used to have some things in here that allowed lexical variable names and values to be a part of the environment, but no more. Now an environment is just a module. If you want to "inject" free variables into code, just use lambda. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Same here. Also, rely on the fact that an environment *will* be a module -- because (system base compile) guarantees that for us. * module/language/scheme/spec.scm (scheme): In the reader, rely on the environment being a module. Define a #:make-default-environment handler, which returns a beautified module, augmented with a fresh definition for current-reader, so that side effects to current-reader are restricted to the compilation unit. * module/language/tree-il/analyze.scm (report-possibly-unbound-variables): * module/language/tree-il/compile-glil.scm (compile-glil): * module/language/tree-il/optimize.scm (optimize!): The environment will be a module. * module/system/base/language.scm (<language>): New field, `make-default-environment'. Defaults to `make-fresh-user-module'. (default-environment): New accessor, returns a default environment for a language. * module/system/repl/common.scm (repl-compile): Always compile relative to the current module, because a module is always acceptable as an environment. * module/system/base/compile.scm (compile-file, compile-and-load): Both of these have a new keyword argument, #:env. For `compile-file', it defaults to the default environment of the source language, and for `compile-and-load', to the current module. (read-and-compile): If there are no expressions read, pass the joiner its default environment (via `default-environment joint'). 2009-10-16 Andy Wingo <wingo@pobox.com> no more *compilation-environment* fluid * module/system/base/compile.scm (current-compilation-environment): Remove, as the only thing that needed it (language readers) now get the environment as an argument. (read-and-compile, compile): Rework for no *compilation-environment*, and default the environment using the define* mechanism. * module/language/tree-il/analyze.scm (env-module): Hack around the lack of a current compilation module. Will fix this in the next commit so that the environment is always valid. 2009-10-16 Andy Wingo <wingo@pobox.com> language-readers receive environment as an arg * module/language/assembly/spec.scm: * module/language/brainfuck/spec.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/spec.scm: * module/language/glil/spec.scm: * module/language/scheme/spec.scm: * module/language/tree-il/spec.scm: Language-readers now take two arguments: the port and the environment. This should allow for compile-environment-specific reader behavior. * module/system/base/compile.scm (read-and-compile): * module/system/repl/common.scm (repl-read): Pass the environment to the language-reader. * module/system/repl/repl.scm (meta-reader, prompting-meta-read): * module/system/repl/command.scm (define-meta-command): Use the second argument to repl-reader, so we avoid frobbing current-reader. 2009-10-16 Andy Wingo <wingo@pobox.com> repl-reader accepts optional "read" argument * module/ice-9/boot-9.scm (repl-reader): Accept an optional second argument, the reader to use. If it is given, use it instead of dereferencing the current-reader fluid. * guile-readline/ice-9/readline.scm (activate-readline): Make our replacement definition of repl-reader compatible with boot-9. 2009-10-16 Andy Wingo <wingo@pobox.com> remove GHIL, Elisp, and R5RS languages GHIL is obsolete, and it's about time we got rid of it. Elisp and R5RS were unmodified since their import from Guile-VM, so we ditch them too. R5RS compilation is supported via compiling Scheme within an R5RS environment. Elisp will be supported when we merge in Daniel's work. 2009-10-16 Andy Wingo <wingo@pobox.com> bitvector tweaks * libguile/arrays.c (scm_from_contiguous_typed_array): * libguile/bytevectors.c (scm_uniform_array_to_bytevector): Error if the uniform element size is more than 8 bits, but not divisible by 8 -- because our math could overflow in that case. * module/ice-9/deprecated.scm (#\y): Indeed, #* is the valid bitvector syntax :) 2009-10-15 Ludovic Courtès <ludo@gnu.org> Improve TLS detection for systems with compiler support but no libc support. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Use `AC_LINK_IFELSE' instead of `AC_COMPILE_IFELSE'. Bump version number for 1.9.4. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Fix compilation of literal bitvectors. * libguile/arrays.c (scm_from_contiguous_typed_array): Fix BYTE_LEN sanity check for bitvectors. * test-suite/tests/unif.test ("syntax")["bitvector is self-evaluating"]: New test. * module/ice-9/deprecated.scm (#\y): Fix deprecation comment: `#*' is not a read syntax. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Fix segfault for `(uniform-array->bytevector (bitvector))'. * libguile/bytevectors.c (scm_uniform_array_to_bytevector): Fix BYTE_LEN computation for bitvectors. * test-suite/tests/bytevectors.test ("uniform-array->bytevector"): New test prefix. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Fix `gitlog-to-changelog' on NixOS. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Document the interaction of the "compilee" with the compiler's current module. This is a followup to 87c595c757b7db84ffdcfda96f736ab235e674a8 ("Compile in a fresh module by default.") and f65e2b1ec5ae1962e57322ac3085ab4d44025694 ("Honor and confine expansion-time side-effects to `current-reader'."). * doc/ref/api-evaluation.texi (Loading): Explain how to change `current-reader' in a compiler-friendly way. * doc/ref/compiler.texi (The Scheme Compiler): Explain use of a fresh compilation module and separate `current-reader' fluid. * test-suite/tests/compiler.test ("current-reader")["with eval-when"]: New test. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Fix REPL environment for languages other than scheme. * module/system/repl/common.scm (repl-compile): Use `#:env #f' for languages other than scheme. 2009-10-15 Andy Wingo <wingo@pobox.com> signedness fix fix fix * libguile/inline.h: Fix signedness fix fix. `load' autocompiles -- in the current module. * module/ice-9/boot-9.scm (load): Pull `autocompiled-file-name' inside `load', and make it autocompile in the current module. Should fix Julian's issue noted in http://article.gmane.org/gmane.lisp.guile.devel/9483. update NEWS for 1.9.4 fix scm_array_handle_ref signedness fix * libguile/inline.h: Fix signedness fix. add back support for #y bitvector read syntax * module/ice-9/deprecated.scm (#\y): Add deprecated support for #y(1 0 1 ...) bitvectors. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Use pointer-less memory for `scm_gc_strdup ()'. * libguile/gc-malloc.c (scm_gc_strndup): Use `GC_MALLOC_ATOMIC ()' instead of `GC_MALLOC ()'. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Restore signature of `scm_primitive_load_path ()' as found in 1.8. The incompatibility was introduced by 0fb81f95b0222c5ba49efd3e36cf797df54c0863 ("add exception_on_error optional arg to primitive-load-path"). * libguile/load.c (scm_primitive_load_path): Change to take 1 rest argument. Interpret the argument as either a file name (C-level backward compatibility with 1.8) or an actual argument list. (scm_c_primitive_load_path): Update caller. * libguile/load.h (scm_primitive_load_path): Update accordingly. * doc/ref/api-evaluation.texi (Loading): Update documentation of `primitive-load-path' and `scm_primitive_load_path ()'. 2009-10-15 Ludovic Courtès <ludo@gnu.org> Use GC-managed memory for port->encoding. * libguile/ports.c (scm_new_port_table_entry): Use `scm_gc_strdup ()' instead of `strdup ()' for `entry->encoding'. (scm_i_set_port_encoding_x): Likewise. Remove free(3) call. (scm_i_remove_port): Don't explicitly free memory. (scm_unget_byte): Remove outdated and misleading comment. 2009-10-14 Ludovic Courtès <ludo@gnu.org> Fix signed/unsigned mismatch in `scm_array_handle_{ref,set} ()'. * libguile/inline.h (scm_array_handle_ref, scm_array_handle_set): Cast `h->base' so that it matches the signedness of `p'. 2009-10-13 Ken Raeburn <raeburn@raeburn.org> Flush output before forking, to make test output consistent and avoid duplication. * test-suite/tests/socket.test: Before calling primitive-fork, call force-output on the current output and error ports. 2009-10-13 Andy Wingo <wingo@pobox.com> add $libir to the ltdl path, not $pkglibdir; add extensionsdir * libguile/Makefile.am (libpath.h): Fix SCM_LIB_DIR to point to the libdir, not pkglibdir. Add SCM_EXTENSIONS_DIR, for a dir to put in the dynamic-link search path that's not managed by ldconfig or the like; and put this dir in the "extensionsdir" key of %guile-build-info. * libguile/dynl.c (sysdep_dynl_init): Rename the installed-libdir environment var to GUILE_SYSTEM_EXTENSIONS_PATH (from GUILE_SYSTEM_LTDL_PATH). Also add SCM_EXTENSIONS_DIR to the ltdl search path in the default case. * meta/uninstalled-env.in: Adapt override to match. * meta/guile-2.0.pc.in: Add extensionsdir, so you can pkg-config --variable=extensionsdir guile-2.0. 2009-10-12 Michael Gran <spk121@yahoo.com> Modify regexp.test to work better with mac/darwin * test-suite/tests/regexp.test (set-latin-1): also add .ISO8859-1 as a possible extension for latin-1 locales. Use set-latin-1 exclusively to set the locale for tests. 2009-10-09 Michael Gran <spk121@yahoo.com> Revert changes that gather thread-specific local language The method used was not portable. However, the underlying problem still exists: the uc_locale_language used by libunistring does not work with thread-specific locale_t locales. * libguile/i18n.c (locale_language): avoid unpacking semi-opaque type locale_t. * test-suite/tests/i18n.test: set Turkish string and char locale upcase and downcase tests to throw untested 2009-10-09 Ludovic Courtès <ludo@gnu.org> Adjust to match changes in libgc's CVS (pre-7.2). In libgc CVS the `GC_do_blocking ()' declaration is now public but it uses a slightly different signature for its first argument. * configure.ac: Check for `GC_fn_type'. * libguile/threads.c (GC_fn_type)[HAVE_GC_DO_BLOCKING && !HAVE_GC_FN_TYPE]: New typedef. (scm_without_guile): Explicitly cast `without_guile_trampoline' to `GC_fn_type'. This is because the upstream definition currently looks like `typedef void * (extern *GC_fn_type)(void *);', which isn't compatible. 2009-10-09 Ludovic Courtès <ludo@gnu.org> Use TLS when available for `SCM_I_CURRENT_THREAD'. * acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): New macro. * configure.ac: Use it. * libguile/__scm.h (SCM_THREAD_LOCAL): New macro. * libguile/gen-scmconfig.c (main): Define `SCM_HAVE_THREAD_STORAGE_CLASS'. * libguile/gen-scmconfig.h.in (SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS): New. * libguile/threads.c (scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New. (SET_CURRENT_THREAD): New macro. (guilify_self_1, on_thread_exit, init_thread_key): Use it. * libguile/threads.h (scm_i_current_thread)[SCM_HAVE_THREAD_STORAGE_CLASS]: New declaration. (SCM_I_CURRENT_THREAD)[SCM_HAVE_THREAD_STORAGE_CLASS]: New macro. (init_thread_key_once, init_thread_key): Conditionalize on `!defined SCM_HAVE_THREAD_STORAGE_CLASS'. (scm_i_init_thread_for_guile): Update accordingly. 2009-10-09 Ludovic Courtès <ludo@gnu.org> Arrange so that `SCM_I_CURRENT_THREAD' is not accessed outside of libguile. * libguile/__scm.h (scm_async_tick): New declaration. (SCM_ASYNC_TICK)[!BUILDING_LIBGUILE]: Use `scm_async_tick ()'. * libguile/async.c (scm_critical_section_start, scm_critical_section_end, scm_async_tick): New functions. * libguile/async.h (scm_i_critical_section_mutex): Made internal. (scm_critical_section_start, scm_critical_section_end): New declarations. (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END)[!BUILDING_LIBGUILE]: Use the same-named function (lower-case). * libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Conditionalize on `BUILDING_LIBGUILE'. * libguile/threads.h (SCM_I_CURRENT_THREAD, scm_i_dynwinds, scm_i_set_dynwinds, scm_i_last_debug_frame, scm_i_set_last_debug_frame): Conditionalize on `BUILDING_LIBGUILE'. 2009-10-09 Ludovic Courtès <ludo@gnu.org> Deprecate `scm_mask_ints'. * libguile/async.h (scm_mask_ints): Remove. * libguile/deprecated.c (scm_i_mask_ints): New. * libguile/deprecated.h (scm_mask_ints): New macro. (scm_i_mask_ints): New declaration. 2009-10-07 Neil Jerram <neil@ossau.uklinux.net> Revert "Change dynwind flag enums to #defines, for greater portability" This reverts commit b25aa0b9373d2798469e0fe999cd915e8beedc4f. 2009-10-06 Ludovic Courtès <ludo@gnu.org> Fix typo in `scm_array_p_2 ()'. * libguile/generalized-arrays.c (scm_array_p_2)[FUNC_NAME]: Fix. 2009-10-06 Ludovic Courtès <ludo@gnu.org> Add compiler warning for possibly unbound variables. * module/language/tree-il/analyze.scm (<toplevel-info>): New record type. (env-module, report-possibly-unbound-variables): New procedures. * module/language/tree-il/compile-glil.scm (%warning-passes): Add `unbound-variable'. * module/system/base/message.scm (%warning-types): Likewise. * test-suite/tests/tree-il.test (read-and-compile, %opts-w-unbound): New. ("warnings")["unbound variable"]: New test prefix. 2009-10-06 Ludovic Courtès <ludo@gnu.org> tree-il: Pass the environment to warning passes. * module/language/tree-il/analyze.scm (report-unused-variables): Taken a new parameter, ENV. * module/language/tree-il/compile-glil.scm (compile-glil): Pass E to individual warning passes. 2009-10-02 Neil Jerram <neil@ossau.uklinux.net> Change dynwind flag enums to #defines, for greater portability Thanks to Inge Gutheil for raising this problem. * doc/ref/api-control.texi (Dynamic Wind): Remove doc for scm_t_dynwind_flags, and change uses of scm_t_dynwind_flags to int. Mention possible flags inside doc for scm_dynwind_begin instead. Similarly for scm_t_wind_flags. In this case the doc on possible flags is moved to after the four functions that can use them. * libguile/dynwind.c (scm_dynwind_begin): Change scm_t_dynwind_flags to int. (scm_dynwind_unwind_handler): Change scm_t_wind_flags to int. (scm_dynwind_rewind_handler): Ditto. (scm_dynwind_unwind_handler_with_scm): Ditto. (scm_dynwind_rewind_handler_with_scm): Ditto. * libguile/dynwind.h (SCM_F_DYNWIND_REWINDABLE): Use #define instead of typedef enum. (SCM_F_WIND_EXPLICITLY): Ditto. (function declarations): Change scm_t_dynwind_flags and scm_t_wind_flags to int. * test-suite/standalone/test-unwind.c (check_cont_body): Change scm_t_dynwind_flags to int. 2009-10-02 Ludovic Courtès <ludo@gnu.org> Use `SCM_DEPRECATED' in declarations of deprecated functions/variables. * libguile/deprecated.c (SCM_BUILDING_DEPRECATED_CODE): New macro. * libguile/async.c (SCM_BUILDING_DEPRECATED_CODE): Likewise. * libguile/macros.c (SCM_BUILDING_DEPRECATED_CODE): Likewise. * libguile/async.h, libguile/deprecated.h, libguile/eval.h, libguile/gc.h, libguile/gc.h, libguile/macros.h, libguile/ports.h, libguile/srfi-4.h, libguile/strings.h: Change declarations of deprecated functions and variables to use `SCM_DEPRECATED' instead of `SCM_API'. 2009-10-02 Ludovic Courtès <ludo@gnu.org> Add `SCM_DEPRECATED' macro to declare deprecated C functions/variables. * libguile/__scm.h (SCM_DEPRECATED): New macro. 2009-10-02 Ludovic Courtès <ludo@gnu.org> Fix the argument list of gsubr stack frames. This fixes a bug introduced in e20d7001c3f7150400169fecb0bf0eefdf122fe2 and reported by Neil. * libguile/eval.i.c (CEVAL)[DEVAL]: Don't duplicate ARG1 in `debug.info->a.args' for gsubr stack frames. (scm_apply): Likewise. * test-suite/tests/eval.test ("stacks")["arguments of a gsubr stack frame"]: New test. 2009-10-02 Neil Jerram <neil@ossau.uklinux.net> Fix doc for inet-ntop: always produces a string Thanks to Scott McPeak for reporting this. * libguile/socket.c (scm_inet_ntop): In docstring, add quotes around IPv6 address (+ reflow a bit). * doc/ref/posix.texi (Network Address Conversion): Corresponding change. * doc/maint/guile.texi: Corresponding change. 2009-10-02 Neil Jerram <neil@ossau.uklinux.net> Fix handling of IPv6 addresses Thanks to Scott McPeak for reporting this and providing a patch. * libguile/socket.c (scm_to_ipv6): When address is the wrong type, provide more information in the exception message. (scm_to_sockaddr): scm_to_ipv6 expects just an address, not the whole vector. * test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): New set of tests. 2009-10-01 Neil Jerram <neil@ossau.uklinux.net> Fix incorrect doc mentions of INADDR_LOCALHOST Thanks to Scott McPeak for reporting this. * doc/ref/posix.texi (Network Sockets and Communication): Change INADDR_LOCALHOST to INADDR_LOOPBACK. 2009-10-01 Neil Jerram <neil@ossau.uklinux.net> Add define-module to signals.test * test-suite/tests/signals.test (test-suite): Add define-module form. Change signals.test to LGPLv3+ * test-suite/tests/signals.test: Update licence statement. Remove unused environments code and tests * libguile/environments.c, libguile/environments.h, test-suite/tests/environments.nottest: Deleted. 2009-09-30 Neil Jerram <neil@ossau.uklinux.net> Fix spurious `throw from within critical section' errors The crux of this problem was that the thread doing a throw, and so checking scm_i_critical_section_level, was different from the thread that was in a critical section. * libguile/async.h (scm_i_critical_section_level): Removed, replaced by per-thread critical_section_level. (SCM_CRITICAL_SECTION_START, SCM_CRITICAL_SECTION_END): Use per-thread critical_section_level. * libguile/continuations.c (scm_dynthrow): Check per-thread critical_section_level. * libguile/threads.c (guilify_self_1): Init per-thread critical_section_level. (scm_i_critical_section_level): Removed. * libguile/threads.h (scm_i_thread): New critical_section_level field. * libguile/throw.c (scm_ithrow): Check per-thread critical_section_level. 2009-09-30 Neil Jerram <neil@ossau.uklinux.net> Avoid throw from critical section, given invalid sigaction call * libguile/scmsigs.c (scm_sigaction_for_thread): Exit critical section before raising out-of-range error. * test-suite/Makefile.am (SCM_TESTS): Add signals.test. * test-suite/tests/signals.test: New file. 2009-09-28 Ludovic Courtès <ludo@gnu.org> Make `weaks.test' slightly more robust. * test-suite/tests/weaks.test (global-weak): Use `string-copy' on all the keys, in case one of them is retained in `scm_source_whash' or similar. Improve description of `scm_set_smob_mark ()'. * doc/ref/api-smobs.texi (Smobs): Improve description of `scm_set_smob_mark ()'. Mention malloc(3) regions. 2009-09-28 Ludovic Courtès <ludo@gnu.org> Remove unneeded SMOB/port mark/free procedures. * libguile/arrays.c (array_mark, array_free): Remove. (scm_init_arrays): Adjust accordingly. * libguile/bitvectors.c (bitvector_free): Remove. (scm_c_make_bitvector): Use `scm_gc_malloc_pointerless ()'. (scm_init_bitvectors): Adjust accordingly. * libguile/strports.c (scm_make_stptob): Remove `scm_set_port_mark ()' call. * libguile/vports.c (scm_make_sfptob): Likewise. 2009-09-28 Ludovic Courtès <ludo@gnu.org> Remove default port/SMOB finalizers. * libguile/ports.c (scm_port_free0): Remove. (scm_make_port_type): Set `free' to NULL. * libguile/smob.c (scm_make_smob_type): Leave `free' to NULL. (scm_smob_free): Remove. * libguile/smob.h (scm_smob_free): Remove. * libguile/deprecated.c (scm_smob_free): New. * libguile/deprecated.h (scm_smob_free): New declaration. 2009-09-26 Neil Jerram <neil@ossau.uklinux.net> Clean meta/guile-config * meta/Makefile.am (CLEANFILES): New, containing guile-config. 2009-09-25 Neil Jerram <neil@ossau.uklinux.net> Don't include guile-config and guile-tools in distribution They need to be regenerated, with the correct prefix, when configure and make run. * meta/Makefile.am (EXTRA_DIST): Remove bin_SCRIPTS. 2009-09-25 Neil Jerram <neil@ossau.uklinux.net> Fix make distcheck by looking for guile-config in $(srcdir) make distcheck is currently failing for me with: In file included from /usr/local/include/libguile/threads.h:35, from /usr/local/include/libguile/async.h:28, from /usr/local/include/libguile.h:37, from ../../examples/box/box.c:22: /usr/local/include/libguile/pthread-threads.h:33:31: error: libguile/boehm-gc.h: No such file or directory In file included from /usr/local/include/libguile.h:93, from ../../examples/box/box.c:22: - which is because it's picking up a load of installed headers, instead of those in the _inst tree - which is because there is no output from the preceding guile-config invocation: PATH=/home/neil/SW/Guile/ovnight/guile-master-20090924/_inst/bin:$PATH PKG_CONFIG_PATH=/home/neil/SW/Guile/ovnight/guile-master-20090924/_inst/lib/pkgconfig /home/neil/SW/Guile/ovnight/guile-master-20090924/_inst/bin/guile-config compile - which is because .../_inst/bin/guile-config is empty - which is because the rule in meta/Makefile.am that generates guile-config is missing $(srcdir), and so doesn't find guile-config.in. * meta/Makefile.am (guile-config): Look for guile-config.in in $(srcdir). 2009-09-25 Michael Gran <spk121@yahoo.com> Missing free in nl-langinfo This is a regression. * libguile/i18n.c (scm_nl_langinfo): free c_result 2009-09-25 Michael Gran <spk121@yahoo.com> Fix encoding of strings returned by nl-langinfo Strings returned by nl-langinfo were always being encoded using the global setlocale and not the scm_t_locale passed to the function. * libguile/i18n.c (scm_nl_langinfo): fix encoding of strings 2009-09-24 Michael Gran <spk121@yahoo.com> Language-specific case-conversion doesn't honor locale Libunistring uses a function uc_locale_language to extract the current language from the locale information. It does this by calling setlocale. This makes incompatible with Guile functions that use the locale_t thread-specific locale API, because the values returned by the call to setlocale ignore the locale set by uselocale. As a workaround, this patch extracts the language from the locale_t structure's __names field. A more complete solution is needed. Perhaps that solution would test that the __names field exists in the configure step and revert to !USE_GNU_LOCALE_API in that case. * libguile/i18n.c (locale_language): new function that performs the same job as uc_locale_language but is compatible with uselocale (u32_locale_casecoll, u32_locale_tocase): replace uc_locale_language with locale_language 2009-09-24 Michael Gran <spk121@yahoo.com> Tests for locale-specific case conversion * test-suite/tests/i18n.test: add tests for case conversion of Turkish letters 'i' to verify that the language is being honored. Try to adjust i18n for strict aliasing * libguile/i18n.c (u32_locale_tocase, scm_char_locale_downcase) (scm_char_locale_upcase, scm_string_locale_downcase) (scm_string_locale_upcase): use the scm_t_uint32 type for buffers that are used primarily for libunistring and not for Guile strings. 2009-09-24 Ludovic Courtès <ludo@gnu.org> Move "-z relro" out of $LDFLAGS so it's not in `guile-2.0.pc'. * acinclude.m4 (GUILE_GNU_LD_RELRO): Substitute `GNU_LD_FLAGS'. * libguile/Makefile.am (libguile_la_LDFLAGS): Add $(GNU_LD_FLAGS). * srfi/Makefile.am (AM_LDFLAGS): New. 2009-09-24 Ludovic Courtès <ludo@gnu.org> Have `guile-config' close over `pkg-config' and $(pkgconfigdir). * meta/Makefile.am (guile-config): New target. (EXTRA_DIST): Add `guile-config.in'. * meta/guile-config.in: New, formerly `guile-config'. Use the right installed `guile', with the right $PKG_CONFIG_PATH. Disable auto-compilation. (%pkg-config-program): New variable. (pkg-config): Use it. 2009-09-24 Ludovic Courtès <ludo@gnu.org> Partially revert e5f5113c21f396705d7479a570c96690135c9d36. The intent is to maintain the readability of `pmatch' invocations. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't use wildcards in `pmatch' invocations, even when the matched elements are unused. * module/language/glil/decompile-assembly.scm (decompile-toplevel, decompile-load-program): Likewise. * module/system/xref.scm (program-callee-rev-vars): Likewise. * module/language/assembly.scm (byte-length): Likewise. * module/language/tree-il/compile-glil.scm (flatten): Likewise. 2009-09-24 Ludovic Courtès <ludo@gnu.org> Reinstate backward-compatible `scm_array_p ()'. * libguile/generalized-arrays.c (scm_array_p_2): New, formerly `scm_array_p ()'. (scm_array_p): Add second argument, for compatibility with 1.8 and earlier and to match what the doc says and what `SCM_VALIDATE_ARRAY' expects. * libguile/generalized-arrays.h (scm_array_p_2): New. (scm_array_p): Adjust. 2009-09-23 Michael Gran <spk121@yahoo.com> Modify char and string locale upcase and downcase for Unicode * libguile/i18n.c (u32_locale_tocase): new helper function (scm_char_locale_downcase, scm_char_locale_upcase): add capability for UCS-4 characters. (scm_string_locale_downcase, scm_string_locale_upcase): modify for the new scheme strings. 2009-09-22 Neil Jerram <neil@ossau.uklinux.net> Manual link from `Guile Initialization' to `Initialization' Thanks to Dale Smith for suggesting this. * doc/ref/libguile-linking.texi: Add ref to full doc of Guile initialisation functions. 2009-09-22 Neil Jerram <neil@ossau.uklinux.net> Changes so that benchmark-guile runs successfully * benchmark-suite/benchmarks/bytevectors.bm: Add "coding: latin1" comment where Guile will find it. * benchmark-suite/benchmarks/chars.bm: Ditto. * benchmark-suite/benchmarks/srfi-13.bm: Ditto. * benchmark-suite/benchmarks/read.bm ("read"): Divide numbers of iterations by 10, so that the benchmarks complete within a few minutes. * benchmark-suite/lib.scm (benchmark): Use `run-benchmark' in macro definition, not `,run-benchmark'. * benchmark-suite/benchmarks/0-reference.bm, benchmark-suite/benchmarks/continuations.bm, benchmark-suite/benchmarks/if.bm, benchmark-suite/benchmarks/logand.bm: Add define-module. * benchmark-suite/results/neil-arudy: New file, containing benchmark results from my computer. 2009-09-22 Neil Jerram <neil@ossau.uklinux.net> GDS usability: operation without a mouse Derek Peschel provided this patch and described it as follows. "Most of the time I use Terminal in OS X, rather than xterm. I also don't bother with the GUI versions of Emacs. So unfortunately I have no mouse support in Emacs. Also the system I'm testing Guile on thinks my terminal doesn't support color and I haven't fixed it yet. The attached patch makes GDS more usable for me. "With no mouse, the "[click here to show error stack]" design is very inconvenient. You added a C-M (return) binding at some point. I copied that, but I also changed the message to show it. And I made the return work when the cursor is after the right bracket." * emacs/gds-scheme.el (gds-display-results): Make "click here" message more helpful for people without mice. Also extend text properties so that a RET key press works at the end of that line. 2009-09-22 Neil Jerram <neil@ossau.uklinux.net> Typo fixes Fix GDB in Emacs incantation 2009-09-21 Michael Gran <spk121@yahoo.com> Tests for record types * test-suite/tests/records.test: new tests 2009-09-21 Michael Gran <spk121@yahoo.com> More tests for strings * test-suite/tests/vectors.test: test make-vector and interactions between strings and vectors * test-suite/tests/strings.test: test string-null?, string? and backslash escapes * test-suite/tests/srfi-13.test: test null input strings in string-any and string-every 2009-09-21 Ludovic Courtès <ludo@gnu.org> Remove unused variables in system/language. * module/language/assembly.scm (byte-length): Don't match unused record slots. * module/language/tree-il.scm (tree-il->scheme, post-order!, pre-order!): Likewise. * module/language/tree-il/analyze.scm (analyze-lexicals): Likewise. * module/language/tree-il/compile-glil.scm (flatten): Likewise. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't match unused list elements. * module/language/glil/decompile-assembly.scm (decompile-toplevel, decompile-load-program): Likewise. * module/system/xref.scm (program-callee-rev-vars): Likewise. * module/language/assembly/compile-bytecode.scm (write-bytecode)[write-sized-loader]: Remove. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Factorize `pad' variables. * module/language/ecmascript/base.scm (object->value/string, object->value/number)[v]: Remove. * module/language/ecmascript/tokenize.scm (read-slash)[c0]: Remove. * module/language/objcode/spec.scm (decompile-value)[nargs]: Remove. * module/system/repl/command.scm (time)[vms-start, vms-end]: Remove. * module/system/repl/repl.scm (prompting-meta-read): Use `prompt'. 2009-09-21 Ludovic Courtès <ludo@gnu.org> Remove unused variables in ice-9/goops/srfi/scripts. * module/ice-9/boot-9.scm (scm-style-repl)[-abort]: Remove. * module/oop/goops.scm (class)[slot-defs]: Remove. (compute-slot-accessors)[name]: Remove. (compute-get-n-set)[env]: Remove. * module/oop/goops/active-slot.scm (compute-get-n-set)[env, name]: Remove. * module/oop/goops/dispatch.scm (cache-try-hash!)[max-misses]: Remove. * module/oop/goops/save.scm (make-mapper)[dims]: Remove. * module/scripts/autofrisk.scm (>>checks)[prog]: Remove. * module/srfi/srfi-19.scm (priv:read-directives)[ireaderf, eireader4]: Remove. 2009-09-20 Ludovic Courtès <ludo@gnu.org> Honor and confine expansion-time side-effects to `current-reader'. * module/language/scheme/spec.scm (scheme)[#:reader]: Honor the compilation environment's `current-reader'. * module/system/base/compile.scm (*compilation-environment*): New fluid. (current-compilation-environment): New procedure. (make-compilation-module): Provide a fresh `current-reader' fluid. (read-and-compile): Set `*compilation-environment*' appropriately. (compile): Likewise. * test-suite/tests/compiler.test (read-and-compile): New. ("current-reader"): New test prefix. 2009-09-20 Ludovic Courtès <ludo@gnu.org> Fix copyright in `(srfi srfi-4 gnu)'. 2009-09-20 Ludovic Courtès <ludo@gnu.org> Compile in a fresh module by default. * module/system/base/compile.scm (make-compilation-module, language-default-environment): New procedures. (read-and-compile, compile): Have ENV default to `(language-default-environment from)'. (compile-and-load): Compile in `(current-module)'. * module/system/repl/common.scm (repl-compile): Explicitly compile in the current module so that macro definitions are visible. * libguile/load.c (kw_env): New variable. (do_try_autocompile): Call `compile-file' with `#:env (current-module)'. * test-suite/tests/compiler.test ("psyntax")["compile uses a fresh module by default", "compile-time definitions are isolated"]: New tests. ["compile in current module"]: Specify `#:env (current-module)'. ["redefinition"]: Adjust. * test-suite/tests/bytevectors.test (c&e): Explicitly compile in the current module so that its imports are visible. 2009-09-18 Andy Wingo <wingo@pobox.com> fix bitvectors after the array handle refactoring * libguile/uniform.h (scm_array_handle_uniform_element_bit_size): New public accessor. * libguile/uniform.c (scm_array_handle_uniform_element_size): Better errors in non-byte-aligned arrays. (scm_uniform_vector_element_type, scm_uniform_vector_element_size) (scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x): (scm_uniform_vector_to_list): Don't require byte-aligned access. * libguile/bytevectors.c (scm_uniform_array_to_bytevector): * libguile/arrays.c (scm_from_contiguous_typed_array): Fix for uniform arrays whose element size is not a multiple of the byte size. 2009-09-18 Andy Wingo <wingo@pobox.com> fix thinko in api-memory.texi 2009-09-18 Ludovic Courtès <ludo@gnu.org> i18n: Remove non-local exists from `u32_locale_casecoll ()'. * libguile/i18n.c (u32_locale_casecoll): Add RESULT argument. Return zero or ERRNO. (compare_u32_strings_ci): Adjust accordingly. 2009-09-18 Ludovic Courtès <ludo@gnu.org> i18n: Always use locale-dependent string collation. * libguile/i18n.c (compare_u32_strings, compare_u32_strings_ci): Always use locale-dependent string collation. * test-suite/tests/i18n.test: Recoded in UTF-8. (%french-utf8-locale-name): New. (under-locale-or-unresolved): New. Don't catch errors on GNU systems. (under-french-locale-or-unresolved): Use it. (under-french-utf8-locale-or-unresolved): New. ("text collation (French)")["string-locale-ci=? (2 args, wide strings)", "string-locale-ci=? (3 args, wide strings)", "string-locale-ci<>? (wide strings)", "string-locale-ci<>? (wide and narrow strings)", "char-locale-ci<>? (wide)"]: New tests. 2009-09-18 Ludovic Courtès <ludo@gnu.org> i18n: Avoid needless heap allocation. * libguile/i18n.c (SCM_STRING_TO_U32_BUF): Allocate buffers on the stack rather on the heap. (SCM_U32_BUF_FREE): Remove. Callers updated. i18n: Simplify `RUN_IN_LOCALE_SECTION' (GNU version). * libguile/i18n.c (RUN_IN_LOCALE_SECTION)[USE_GNU_LOCALE_API]: Remove extraneous uselocale(3) call. 2009-09-18 Ludovic Courtès <ludo@gnu.org> Add the `%host-type' global variable. * configure.ac: Define `HOST_TYPE'. * libguile/load.c (sys_host_type): New variable. * doc/ref/api-options.texi (Build Config): Document `%host-type'. 2009-09-17 Michael Gran <spk121@yahoo.com> Adapt i18n string and char comparison funcs for Unicode * libguile/i18n.c (RUN_IN_LOCALE_SECTION) [USE_GNU_LOCALE_API]: new macro for this define. Should work the same as the !USE_GNU_LOCAL_API version (SCM_STRING_TO_U32_BUF, SCM_U32_BUF_FREE): helper macros (compare_u32_strings, compare_u32_strings_ci): new functions that compare scheme strings in the presence of the locale (u32_locale_casecoll): new helper function for compare_u32_strings_ci (compare_strings, compare_strings_ci): removed and replaced by compare_u32_strings and compare_u32_strings_ci (scm_string_locale_lt, scm_string_locale_gt, scm_string_locale_ci_lt) (scm_string_locale_ci_gt, scm_string_locale_ci_eq): modified to use new compare_u32_strings and compare_u32_strings_ci comparison functions (scm_char_locale_lt, scm_char_locale_gt, scm_char_locale_ci_lt) (scm_char_locale_ci_gt, scm_char_locale_ci_eq): modified to use new compare_u32_strings and compare_u32_strings_ci comparison functions 2009-09-17 Neil Jerram <neil@ossau.uklinux.net> Remove deprecation warnings from the build * module/srfi/srfi-35.scm: Remove explicit use of (ice-9 syncase). * test-suite/tests/r5rs_pitfall.test: Same again. * test-suite/tests/syncase.test: Remove "(ice-9 syncase) loads" test; syncase is always loaded now. 2009-09-17 Neil Jerram <neil@ossau.uklinux.net> Convenience for running GDB on Guile in Emacs * meta/gdb-uninstalled-guile.in: Add (in a comment) an elisp form that can be evaluated to run GDB on Guile in Emacs. 2009-09-17 Neil Jerram <neil@ossau.uklinux.net> Fix omission of VM frames from backtrace From the time when a #<program> was a SMOB, really_make_boot_program in vm.c was still using SCM_SET_SMOB_FLAGS to set the SCM_F_PROGRAM_IS_BOOT flag - which meant that it was setting flag 1<<32 :-) which obviously was then missed by the SCM_PROGRAM_IS_BOOT calls in stacks.c. * libguile/programs.h (SCM_F_PROGRAM_IS_BOOT): Use a less significant bit for this flag, now that programs use a tc7 type. * libguile/vm.c (really_make_boot_program): Don't use SCM_SET_SMOB_FLAGS, now that programs aren't SMOBs. 2009-09-17 Neil Jerram <neil@ossau.uklinux.net> Fix incorrect stack count warnings * libguile/stacks.c (stack_depth): Decrement depth count for a macro-expansion frame. (Missing this decrement will cause a "stack count incorrect" warning but is actually benign, as it only means that scm_make_stack allocates a bit more space for the stack than it really needs.) (read_frames): Increment count of remaining unused frames, when cutting out a macro transformer application frame. (Missing this increment could cause the "stack count incorrect" warning, and could make read_frames think it's filled up all the available stack frames when there's actually still one frame unused; this wasn't benign, because it could cause information to be missing from a stack trace.) 2009-09-17 Neil Jerram <neil@ossau.uklinux.net> Remove unhittable else branch for nonexistent type of debug frame * libguile/stacks.c (stack_depth): Remove unhittable else branch apparently catering to a kind of frame that isn't an eval, apply or void frame - in fact there are no other kinds of frames. 2009-09-16 Andy Wingo <wingo@pobox.com> add the libdir to the ltdl lib search path * libguile/Makefile.am (libpath.h): Fix pkgdatadir, pkglibdir, and pkgincludedir entries. Add a new define, SCM_LIB_DIR. * libguile/dynl.c (sysdep_dynl_init): Add the libdir to the libltdl search path. Should fix http://thread.gmane.org/gmane.lisp.guile.bugs/4289/focus=4296 -- that is, it should allow guile to be invoked from whereever it is installed, without munging LTDL_LIBRARY_PATH or the like variables. There is a trick though -- during the build, we don't want to be looking in the $libdir for loadable modules. So as with GUILE_SYSTEM_PATH, we have GUILE_SYSTEM_LTDL_PATH. * meta/uninstalled-env.in: Set GUILE_SYSTEM_LTDL_PATH to "" when building. 2009-09-15 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.3. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. 2009-09-15 Ludovic Courtès <ludo@gnu.org> Use fixnums for int32 when the native word size of greater than 4 bytes. This should also fix "condition is always true" warnings. * libguile/vm-i-scheme.c (bv_u32_native_ref, bv_s32_native_ref, bv_u32_native_set, bv_s32_native_set): Conditionalize use of `BV_FIXABLE_INT_REF' vs. `BV_INT_REF' based on `SIZEOF_VOID_P'. 2009-09-15 Ludovic Courtès <ludo@gnu.org> Keep the weak pair API internal. * libguile/weaks.h (scm_weak_car_pair, scm_weak_cdr_pair, scm_doubly_weak_pair): Make them internal. 2009-09-15 Ludovic Courtès <ludo@gnu.org> Fix bug #27450 ("Fat mutexes not GC'd until their owner dies"). * libguile/threads.c (do_thread_exit): Deal with `t->mutexes' being a weak list. (fat_mutex_lock): Use weak-car pairs when building up `t->mutexes'. * test-suite/tests/threads.test ("mutex-ownership")["mutex with owner not retained (bug #27450)"]: New test. 2009-09-15 Ludovic Courtès <ludo@gnu.org> Fix the (currently unused) weak pair accessors. * libguile/weaks.h (SCM_WEAK_PAIR_WORD): Fixed; changed to return `SCM_UNDEFINED' when the word has been nullified. 2009-09-15 Ludovic Courtès <ludo@gnu.org> "Document" the `set-module-eval-closure!' weak hash table glitch. * module/ice-9/boot-9.scm (set-module-eval-closure!): Add link to an explanation. * test-suite/tests/gc.test ("gc")["Unused modules are removed"]: Increase the `cleanup' loop. 2009-09-15 Ludovic Courtès <ludo@gnu.org> Nitpick in `srfi-14.c'. * libguile/srfi-14.c (scm_i_ucs_range_to_char_set): Fix warning about the position of BASE_CS. Make the precise stack mark procedure more robust. * libguile/vm.c (vm_stack_mark): Return if VM is NULL. Use GC-robust queues/lists in `threads.c'. * libguile/threads.c (remqueue, dequeue, on_thread_exit): Initialize the "next" link of the item returned/removed. Remove explicit thread/condvar/mutex finalization. * libguile/threads.c (fat_mutex_free): Remove explicit `scm_gc_free ()' call. (fat_cond_free, thread_free): Remove. (scm_threads_prehistory): Adjust accordingly. 2009-09-14 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. 2009-09-14 Ludovic Courtès <ludo@gnu.org> Merge `libguile-i18n' into `libguile'. * GUILE-VERSION (LIBGUILE_I18N_MAJOR, LIBGUILE_I18N_INTERFACE_CURRENT, LIBGUILE_I18N_INTERFACE_REVISION, LIBGUILE_I18N_INTERFACE_AGE, LIBGUILE_I18N_INTERFACE): Remove. * doc/ref/api-i18n.texi (i18n Introduction): Don't mention `libguile-i18n'. * libguile.h: Include "libguile/i18n.h". * libguile/Makefile.am (lib_LTLIBRARIES): Remove `libguile-i18n-v*'. (libguile_la_SOURCES): Add `i18n.c'. (libguile_i18n_v_*_SOURCES, libguile_i18n_v_*_CFLAGS, libguile_i18n_v_*_LIBADD, libguile_i18n_v_*_LDFLAGS): Remove. * libguile/i18n.c (scm_bootstrap_i18n): New function. * libguile/i18n.h (scm_nl_langinfo, scm_init_i18n): Made internal. (scm_bootstrap_i18n): New declaration. * libguile/init.c (scm_i_init_guile): Invoke `scm_bootstrap_i18n ()'. * module/ice-9/i18n.scm: Load from `libguile' instead of `libguile-i18n-v-0'. 2009-09-14 Ludovic Courtès <ludo@gnu.org> Switch the `encoding*.test' files to LGPLv3+. * test-suite/tests/encoding-escapes.test, test-suite/tests/encoding-iso88591.test, test-suite/tests/encoding-iso88597.test, test-suite/tests/encoding-utf8.test: Switch to LGPLv3+ for the sake of consistency. Update `scm_without_guile ()' documentation. * doc/ref/api-scheduling.texi (Blocking): Mention that `scm_without_guile ()' & co. aren't needed any longer. 2009-09-14 Ludovic Courtès <ludo@gnu.org> Rename "boehm-gc.h" to "bdw-gc.h"; add to the distribution. * libguile/Makefile.am (modinclude_HEADERS): Add `bdw-gc.h'. * libguile/bdw-gc.h: Rename from "boehm-gc.h"; users updated. Update to LGPLv3+. 2009-09-14 Ludovic Courtès <ludo@gnu.org> Remove unused IA64 macro. * libguile/threads.c (SCM_MARK_BACKING_STORE): Remove. 2009-09-11 Michael Gran <spk121@yahoo.com> More setlocale robustness in regexp tests * test-suite/tests/regexp.test (mysetlocale, set-latin-1): new functions (with-latin1-locale): removed (regexp-quote tests): try to print test names in locale but run tests in ISO-8859-1. 2009-09-11 Ludovic Courtès <ludo@gnu.org> Remove `scm_enter_guile ()' and `scm_leave_guile ()'. * libguile/threads.c (scm_t_guile_ticket): Remove type. (resume, scm_enter_guile, suspend, scm_leave_guile): Remove. (scm_i_init_thread_for_guile): Set `t->top' to NULL, which has the same effect as calling `scm_enter_guile ()'. (scm_leave_guile_cleanup, scm_i_with_guile_and_parent): Remove `scm_leave_guile ()' call. 2009-09-11 Ludovic Courtès <ludo@gnu.org> Add `λ' macro as an alternative to `lambda'. * module/ice-9/boot-9.scm (λ): New macro. * NEWS: Update. 2009-09-11 Ludovic Courtès <ludo@gnu.org> Report missing libunistring at `configure'-time. * configure.ac: Reinstate libunistring check from 1ee2c72eafaae5f91f4c899bc4b4853af5c16f28. 2009-09-10 Ludovic Courtès <ludo@gnu.org> Remove unnecessary uses of `scm_{leave,enter}_guile ()'. * libguile/threads.c (scm_pthread_cond_wait, scm_pthread_cond_timedwait): Remove `scm_{leave,enter}_guile ()' calls. 2009-09-10 Ludovic Courtès <ludo@gnu.org> Link with `-z relro' when available. * acinclude.m4 (GUILE_GNU_LD_RELRO): New macro. * configure.in: Use `GUILE_GNU_LD_RELRO'. 2009-09-09 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/gc_os_dep.c Avoid unneeded `scm_dynwind_free ()'. * libguile/array-map.c (indices_gc_hint): New variable. (scm_ramapc, scm_array_index_map_x): Avoid `scm_dynwind_free ()' using `scm_gc_malloc_pointerless ()'. 2009-09-09 Ludovic Courtès <ludo@gnu.org> Update doc of `scm_gc_protect_object ()' and SMOB mark/free. * doc/ref/api-memory.texi (Garbage Collection Functions)[scm_gc_protect_object]: Explain that it's equivalent to storing in a global variable. * doc/ref/api-smobs.texi (Smobs)[scm_set_smob_free]: Expand on the relationship with `scm_gc_malloc ()'. [scm_set_smob_mark]: Explain that it's usually not needed. 2009-09-09 Michael Gran <spk121@yahoo.com> Avoid prematurely ending regexp test when ISO-8859-1 locale not found * test-suite/tests/regexp.test (with-latin1-locale): new function Call tests in context of with-latin1-locale 2009-09-09 Michael Gran <spk121@yahoo.com> Make scm_i_from_stringn into API for use with libguilereadline * libguile/strings.c (scm_i_from_stringn): renamed to scm_from_stringn. All callers changed. * libguile/strings.h: change declaration of scm_i_from_stringn to scm_from_stringn * libguile/strports.c (scm_strport_to_string): scm_i_from_stringn -> scm_from_stringn * guile-readline/readline.c (internal_readline): scm_i_from_stringn -> scm_from_stringn 2009-09-09 Ludovic Courtès <ludo@gnu.org> Update documentation of `scm_gc_malloc ()' & co. * doc/ref/api-memory.texi (Memory Blocks): Update description of `scm_gc_malloc ()' & co. Add `scm_gc_malloc_pointerless ()'. Update `README'. 2009-09-08 Ludovic Courtès <ludo@gnu.org> Fix misleading comments in `gc-benchmarks/run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (pretty-print-result): Fix comments. Improve `gc-benchmarks/run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (pretty-print-result)[ref-heap, ref-time]: New variable. [distance, score, score-string]: New procedures. [print-line]: Use `score-string'. (print-raw-result): New procedure. (%options)["raw", "load-results"]: New options. (%default-options): Add `printer' pair. (show-help): Update. (main): Add support for `--raw' and `--load-results'. 2009-09-08 Michael Gran <spk121@yahoo.com> 8-bit locale needed for 8-bit regexp tests Since the regex library expects 8-bit clean characters and an 8-bit locale, tests of 8-bit characters need to occur within the context of an 8-bit locale. * test-suite/tests/regexp.test (regexp-quote tests): wrap them in an ISO-8859-1 locale 2009-09-08 Michael Gran <spk121@yahoo.com> Fix broken interaction between readline and Unicode This requires separate small fixes. Readline has internal logic to deal with multi-byte characters, so it wants bytes, not characters. scm_c_read gets called by the vm when readline is activated, and it was truncating multi-byte characters because soft ports didn't have the UCS-4 capability. Soft ports need the capability to read UCS-4 characters. Since soft ports may have a single byte buffer, full characters need to be stored into the pushback buffer. This broke the optimizations in scm_c_read for using an alternate buffer for single-byte-buffered ports, because the opimization wasn't expecting anything in the pushback buffer. * libguile/vports.c (sf_fill_input): store complete chars, not single bytes * libguile/ports.c (scm_c_read): don't use optimized path for non Latin-1. Add debug prints. * libguile/string.h: make scm_i_from_stringn and scm_i_string_ref public so that readline can use them * guile-readline/readline.c: read bytes, not complete chars, from the input port. Convert output to the output port's locale 2009-09-06 Andy Wingo <wingo@pobox.com> fix compile-time bug compiling (+ "foo" " bar") * module/language/tree-il/primitives.scm (+, -): Avoid calling exact? on non-numeric args. 2009-09-06 Andy Wingo <wingo@pobox.com> update news; ready for 1.9.3 * doc/ref/api-control.texi: * doc/ref/goops.texi: Fix some typos. * NEWS: Update. 2009-09-06 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Minor text revisions, and fold new NEWS entries into the main body too. 2009-09-05 Michael Gran <spk121@yahoo.com> Avoid string buffer overrun in scm_scan_for_encoding * libguile/read.c (scm_scan_for_encoding): possible overrun if coding declaration is at end of file 2009-09-05 Michael Gran <spk121@yahoo.com> Doc updates for character encoding of source code files * NEWS * doc/ref/scheme-scripts.texi: doc updates for character encoding of source code * doc/ref/api-evaluation.texi: doc updates for character encoding of source code 2009-09-04 Michael Gran <spk121@yahoo.com> Doc updates for Unicode string escapes and port encodings * NEWS: string and port changes * doc/ref/api-data.texi: string escapes and string-ci * doc/ref/api-io.texi: port encoding functions 2009-09-04 Michael Gran <spk121@yahoo.com> Remove locale u8vector functions Locale u8vector functions deemed harmful. * libguile/strports.c (scm_strport_to_locale_u8vector) (scm_call_with_output_locale_u8vector, scm_open_input_locale_u8vector) (scm_get_output_locale_u8vector): removed * libguile/strports.h: removed declarations for scm_strport_to_locale_u8vector, scm_call_with_output_u8vector, scm_input_locale_u8vector, scm_get_output_locale_u8vector * test-suite/tests/encoding-iso88591.test: display tests removed * test-suite/tests/encoding-iso88597.test: display tests removed 2009-09-04 Michael Gran <spk121@yahoo.com> Initialize string ports with UTF-8 encoding String ports should be able to accept any string characters, regardless of the current locale. Setting it to UTF-8 achieves that. * libguile/strports.c (scm_i_mkstrport): set port's locale to UTF-8 (scm_mkstrport): convert input string to UTF-8 2009-09-04 Michael Gran <spk121@yahoo.com> write-char should handle UCS-4 characters * libguile/print.c (scm_write_char): call UCS-4 printing routine, instead of 8-bit primitive 2009-09-03 Ken Raeburn <raeburn@raeburn.org> Make test-case compilation with -DSCM_DEBUG=1 work. * gc.h (scm_i_expensive_validation_check): Declare SCM_API. 2009-09-03 Michael Gran <spk121@yahoo.com> Doc updates for srfi-14 character sets * NEWS: updates for srfi-14 character sets * doc/ref/api-data.texi: update char-set section and some spellchecking 2009-09-03 Michael Gran <spk121@yahoo.com> Update docs and docstrings for Unicode characters * doc/ref/api-data.texi: more info about characters and codepoints * libguile/chars.c: replace 'code point' with 'Unicode code point' in docstrings 2009-09-03 Michael Gran <spk121@yahoo.com> Add char-set debugging function * libguile/srfi-14.c (scm_sys_char_set_dump): new function * libguile/srfi-14.h: declaration of scm_sys_char_set_dump 2009-09-03 Michael Gran <spk121@yahoo.com> Distinguish between all codepoints and designated codepoints in char-sets * libguile/unidata_to_charset.pl (designated): renamed from full * libguile/srfi-14.c (scm_char_set_designated): new char-set * libguile/srfi-14.i.c (cs_designated): renamed from cs_full 2009-09-03 Michael Gran <spk121@yahoo.com> Modify read and print of combining characters Since combining characters, such as accents, modify the appearance of the previous letter, it looks awkward in its character literal form (#\name) since it modified the backslash. This instead prints the combining character on a small circle. * libguile/chars.h (SCM_CODEPOINT_DOTTED_CIRCLE): new #define * libguile/print.c (iprint1): print combining characters on dotted circles * libguile/read.c (scm_read_character): parse the combination of combining characters and dotted circles 2009-09-03 Ludovic Courtès <ludo@gnu.org> Fix invalid syntax in `dynamic-input-large.sch' (gc-benchmarks). * gc-benchmarks/larceny/dynamic-input-large.sch: Remove invalid "\;" escape. 2009-09-03 Ludovic Courtès <ludo@gnu.org> Add test case for `scm_take_u8vector ()'. This is a followup to commit d7e7a02a6251c8ed4f76933d9d30baeee3f599c0 ("Fix leaky behavior of `scm_take_TAGvector ()'.") and a reminder that the uniform vector implementation can't do away with the cell->buffer indirection. * test-suite/standalone/Makefile.am (test_scm_take_u8vector_SOURCES, test_scm_take_u8vector_CFLAGS, test_scm_take_u8vector_LDADD): New. (check_PROGRAMS, TESTS): Add `test-scm-take-u8vector'. * test-suite/standalone/test-scm-take-u8vector.c: New file. 2009-09-02 Michael Gran <spk121@yahoo.com> Remove always-true range checks in scm_i_ucs_range_to_char_set * libguile/srfi-14.c (scm_i_ucs_range_to_char_set): limits are always non-negative due to the type of the variable More srfi-14 char-set tests * test-suite/tests/srfi-14.test: many new tests Unreachable code in charset set operator * libguile/srfi-14.c (scm_i_charset_set): remove unreachable code in scm_i_charset_set Optimize charset union operator * libguile/srfi-14.c (charsets_union): call scm_i_charset_set_range instead of setting characters one-by-one. The charset complement operator should not include surrogates * libguile/srfi-14.c (charsets_complement): skip over surrogates when making a charset complement char-set-filter! does not properly iterate over the charset * libguile/srfi-14.c (scm_char_set_filter_x): iterate over codepoints ucs-range->char-set should not store surrogates and has off-by-one error * libguile/srfi-14.c (scm_i_ucs_range_to_char_set): new function that contains the functionality of ucs_range_to_char_set, fixes off-by-one, and doesn't store surroges (scm_ucs_range_to_char_set, scm_ucs_range_to_char_set_x): call scm_i_ucs_range_to_char_set (scm_i_charset_set_range): new helper function char-set-any improperly unpacks charset data * libguile/srfi-14.c (scm_char_set_any): unpack the charset correctly 2009-09-02 Michael Gran <spk121@yahoo.com> char-set-xor! should modify the input parameter char-set-xor! was not modifying its input parameter. It isn't technically required to do so by the spec, but, the other similar functions do it. * libguile/srfi-14.c (scm_char_set_xor_x): modify the input parameter 2009-09-02 Ludovic Courtès <ludo@gnu.org> Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc Conflicts: acinclude.m4 libguile/strings.c 2009-09-01 Ludovic Courtès <ludo@gnu.org> Fix leaky behavior of `scm_take_TAGvector ()'. * libguile/srfi-4.c (free_user_data): New function. * libguile/srfi-4.i.c (scm_take_TAGvector): Register `free_user_data ()' as a finalizer for DATA. * libguile/objcodes.c (scm_objcode_to_bytecode): Allocate with `scm_malloc ()' since the memory taken by `scm_take_u8vector ()' will eventually be free(3)d. * libguile/vm.c (really_make_boot_program): Likewise. 2009-09-01 Andy Wingo <wingo@pobox.com> fix nontail loops within loops * module/language/tree-il/compile-glil.scm (flatten): Fix compilation of loops within loops in non-tail positions. Will add a test case soon, but one way to reproduce it was with the following function: (define (test) (let lp () (pk 'zero) (let ((fk (lambda () (let ((fk2 (lambda () (pk 'two)))) (let ((fk3 (lambda () (if #t (pk 'three) (fk2))))) (if #t (fk3) (fk2))))))) (pk 'one) (fk)) (lp))) One would expect to see a sequence of "zero one three", but in fact zero only showed once. This should fix simplex as well. 2009-09-01 Ludovic Courtès <ludo@gnu.org> Remove the distinction between inline/outline storage for stringbufs. * libguile/strings.c (STRINGBUF_HEADER_SIZE, STRINGBUF_HEADER_BYTES): New macros. (STRINGBUF_F_INLINE, STRINGBUF_INLINE, STRINGBUF_OUTLINE_CHARS, STRINGBUF_OUTLINE_LENGTH, STRINGBUF_INLINE_CHARS, STRINGBUF_INLINE_LENGTH, STRINGBUF_MAX_INLINE_LEN): Remove. (STRINGBUF_CHARS, STRINGBUF_WIDE_CHARS): Adjust to return a fixed location. (STRINGBUF_LENGTH): Get the length from word 1. (make_stringbuf, make_wide_stringbuf): Adjust to use a contiguous memory region. (wide_stringbuf): Renamed from `widen_stringbuf'. Adjust similarly. Return the new stringbuf. Callers updated. (narrow_stringbuf): Likewise. (scm_sys_string_dump, scm_sys_symbol_dump): Remove `stringbuf-inline' pair. * test-suite/tests/strings.test ("string internals")["null strings are inlined", "short Latin-1 encoded strings are inlined", "long Latin-1 encoded strings are not inlined", "short UCS-4 encoded strings are not inlined", "long UCS-4 encoded strings are not inlined"]: Remove. * test-suite/tests/symbols.test ("symbol internals")["null symbols are inlined", "short Latin-1 encoded symbols are inlined", "long Latin-1 encoded symbols are not inlined", "short UCS-4 encoded symbols are not inlined", "long UCS-4 encoded symbols are not inlined"]: Remove. 2009-09-01 Ludovic Courtès <ludo@gnu.org> Fix leaky handling of `scm_take_locale_{symbol,string} ()'. * libguile/strings.c (scm_i_take_stringbufn, scm_i_c_take_symbol): Remove. (scm_take_locale_stringn): Rewrite in terms of `scm_from_locale_stringn ()'. * libguile/strings.h (scm_i_c_take_symbol, scm_i_take_stringbufn): Remove declarations. 2009-08-31 Michael Gran <spk121@yahoo.com> Update docs for Unicode characters * NEWS: add note about Unicode characters * doc/ref/api-data.texi: update Characters subsection * libguile/chars.c: update docstrings to match manual 2009-08-31 Michael Gran <spk121@yahoo.com> Tests for display and writing of characters * test-suite/tests/encoding-iso88591.test: tests for writing and display of characters * test-suite/tests/encoding-iso88597.test: tests for writing and display of characters * test-suite/tests/encoding-utf8.test: tests for writing and display of characters 2009-08-31 Michael Gran <spk121@yahoo.com> Fix escape sequence normalization for wide strings * libguile/strings.c (scm_to_stringn): convert unistring escapes to guile escapes for both wide and narrow strings 2009-08-31 Michael Gran <spk121@yahoo.com> Fix encoding errors with strings returned by string ports String ports, being 8-bit, store strings using the character encoding of the port. This fixes a bug where the default character encoding, and not the port's encoding, was being used to convert the string port data back to a string. * libguile/strports.c: extra comments (scm_strport_to_string): use port's encoding when converting port data to a string * libguile/strings.c (scm_i_from_stringn): renamed from scm_from_stringn and made internal. All callers changed. (scm_from_stringn): renamed to scm_i_from_stringn. * libguile/strings.h: declaration for scm_i_from_stringn 2009-08-31 Ludovic Courtès <ludo@gnu.org> Fix `benchmark-guile'. * benchmark-guile.in (guile): Use `meta/guile', not `pre-inst-guile'. 2009-08-31 Ludovic Courtès <ludo@gnu.org> Remove the distinction between inline/outline storage for bytevectors. * libguile/bytevectors.c (SCM_BYTEVECTOR_INLINE_THRESHOLD, SCM_BYTEVECTOR_INLINEABLE_SIZE_P, SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_INLINE): Remove. (SCM_BYTEVECTOR_HEADER_BYTES): New macro. (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): Adjust to new flag layout. (make_bytevector): Remove content inlining machinery; use `scm_gc_malloc_pointerless ()' in all cases; special-case zero-sized vu8 buffers. (make_bytevector_from_buffer): Simplified. (scm_c_shrink_bytevector): New, formerly `scm_i_shrink_bytevector ()'. Remove buffer inlining machinery. (scm_bootstrap_bytevectors): Use `make_bytevector ()' for SCM_NULL_BYTEVECTOR. * libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): New macro. (SCM_BYTEVECTOR_CONTENTS): Adjust to new layout. (SCM_SET_BYTEVECTOR_FLAGS): Properly cast F. (SCM_F_BYTEVECTOR_INLINE, SCM_BYTEVECTOR_INLINE_P): Remove. (SCM_BYTEVECTOR_ELEMENT_TYPE): Adjust. (scm_c_shrink_bytevector): Remove macro, make a C function declaration. 2009-08-30 Ludovic Courtès <ludo@gnu.org> Use a TC7 tag instead of a SMOB for bytevectors. * libguile/bytevectors.c (scm_tc16_bytevector): Remove. (SCM_BYTEVECTOR_SET_LENGTH, SCM_BYTEVECTOR_SET_CONTENTS, SCM_BYTEVECTOR_SET_INLINE, SCM_BYTEVECTOR_SET_ELEMENT_TYPE, make_bytevector_from_buffer, scm_is_bytevector, scm_bootstrap_bytevectors): Adjust to the SMOB->tc7 change. (scm_i_print_bytevector): New, formerly `print_bytevector ()'. (bytevector_equal_p): Remove. * libguile/bytevectors.h (SCM_BYTEVECTOR_LENGTH, SCM_BYTEVECTOR_CONTENTS, SCM_BYTEVECTOR_P): Adjust to SMOB->tc7 change. (SCM_BYTEVECTOR_FLAGS, SCM_SET_BYTEVECTOR_FLAGS): New macros. (scm_tc16_bytevector): Remove declaration. (scm_i_print_bytevector): New declaration. * libguile/eq.c (scm_equal_p): Handle `scm_tc7_bytevector'. * libguile/evalext.c (scm_self_evaluating_p): Likewise. * libguile/print.c (iprin1): Likewise. * libguile/tags.h (scm_tc7_bytevector): New. (scm_tc7_unused_8): Remove. * libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): Adjust. * test-suite/tests/bytevectors.test ("Datum Syntax")["self-evaluating?"]: New test. 2009-08-30 Neil Jerram <neil@ossau.uklinux.net> Export readline history functions * guile-readline/ice-9/readline.scm: Export history functions. 2009-08-29 Michael Gran <spk121@yahoo.com> Range check octal-escaped characters * libguile/read.c (scm_read_character): range check octal escapes 2009-08-29 Michael Gran <spk121@yahoo.com> More tests for chars.test Testing out-of-range octals, bad charnames, and write format * test-suite/tests/chars.test 2009-08-29 Michael Gran <spk121@yahoo.com> More tests for chars.test * test-suite/tests/chars.test: more tests 2009-08-29 Michael Gran <spk121@yahoo.com> Surrogate characters shouldn't be in charsets * libguile/srfi-14.c (charsets_complement): use surrogate #defines instead of hardcoded numbers * libguile/srfi-14.i.c (cs_full_ranges): remove surrogates from full charset * libguile/unidata_to_charset.pl (full): test for surrogates 2009-08-29 Michael Gran <spk121@yahoo.com> Better range check for codepoints * libguile/chars.h (SCM_IS_UNICODE_CHAR): check for negative codepoints 2009-08-29 Michael Gran <spk121@yahoo.com> Cast the input to isalpha et al to integer * libguile/gc_os_dep.c (GC_linux_stack_base) [LINUX_STACKBOTTOM]: cast input of ctype functions to int * libguile/inet_aton.c (inet_aton): cast input of ctype functions to int * libguile/read.c (scm_scan_for_encoding): cast input of isalnum to int * libguile/win32-socket.c (scm_i_socket_uncomment): cast input of isspace to int 2009-08-28 Ludovic Courtès <ludo@gnu.org> Add `BDW_GC_CFLAGS' to the `.pc' files. This is needed because <gc/gc.h> is included in public headers (via <libguile/boehm-gc.h>. * meta/guile-2.0-uninstalled.pc.in (Cflags): Add `@BDW_GC_CFLAGS'. * meta/guile-2.0.pc.in (Cflags): Likewise. 2009-08-28 Ludovic Courtès <ludo@gnu.org> Remove deprecated variables/macros from the GC headers. * libguile/deprecated.c (scm_mtrigger, scm_mallocated, scm_max_segment_size): New global variables, from gc.c. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New stubs. * libguile/deprecated.h (scm_mallocated, scm_mtrigger, scm_max_segment_size): New declarations. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New declarations. * libguile/gc-malloc.c (scm_i_minyield_malloc): Remove. (scm_gc_init_malloc): Remove references to `scm_i_minyield_malloc' and `scm_mtrigger'. * libguile/gc.c (scm_mtrigger, scm_mallocated): Remove. (scm_init_storage): Remove reference to `SCM_HEAP_SEG_SIZE'. * libguile/gc.h (scm_max_segment_size, SCM_SET_FREELIST_LOC, SCM_FREELIST_LOC, scm_i_master_freelist, scm_i_master_freelist2, scm_mallocated, scm_mtrigger): Remove. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[SCM_ENABLE_DEPRECATED && GUILE_DEBUG_FREELIST]: Remove. * libguile/private-gc.h (SCM_DEFAULT_INIT_HEAP_SIZE_1, SCM_DEFAULT_MIN_YIELD_1, SCM_DEFAULT_MIN_YIELD_2, DEFAULT_SWEEP_AMOUNT, SCM_DEFAULT_MAX_SEGMENT_SIZE, SCM_MIN_HEAP_SEG_SIZE, SCM_HEAP_SEG_SIZE, SCM_GC_CARD_BVEC_SIZE_IN_LONGS, SCM_GC_IN_CARD_HEADERP): Remove. (scm_getenv_int): Made internal. (scm_i_marking, scm_mark_all, scm_i_deprecated_memory_return, scm_i_find_heap_calls, scm_gc_init_malloc, scm_gc_init_freelist, scm_gc_init_segments, scm_gc_init_mark): Remove declarations. * libguile/gc-segment-table.c: Remove, finally. 2009-08-28 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/bytevectors.c libguile/gc-card.c libguile/gc-mark.c libguile/programs.c libguile/srcprop.c libguile/srfi-14.c libguile/symbols.c libguile/threads.c libguile/unif.c libguile/vm.c 2009-08-28 Andy Wingo <wingo@pobox.com> fix case in which compiled path had stale .go, but fallback had fresh .go * libguile/load.c (scm_primitive_load_path): If the compiled path was out of date, but the fallback path was current, we correctly detected that case, but loaded the wrong file. So here fix the typo. 2009-08-28 Michael Gran <spk121@yahoo.com> Don't presume existence or success of setlocale in test-suite * test-suite/lib.scm (with-locale, with-locale*): new test functions * test-suite/tests/encoding-escapes: don't fail if en_US.utf8 doesn't exist * test-suite/tests/encoding-iso88591.test: set and restore locale, if possible * test-suite/tests/encoding-iso88597.test: set and restore locale, if possible * test-suite/tests/encoding-utf8.test: set and restore locale, if possible * test-suite/tests/srfi-14.test: don't need to setlocale to Latin-1 to test Latin-1 since string conversion is handled at read/compile time. Set and restore locale, if possible. 2009-08-28 Michael Gran <spk121@yahoo.com> scm_getc improperly handles Latin-1 characters Upper-plane Latin-1 characters should be converted to codepoints. * libguile/ports.c (scm_getc): improper conversion of char to scm_t_wchar 2009-08-28 Michael Gran <spk121@yahoo.com> Fix FUNC_NAME definitions and #endif in srfi-14.[ch] * libguile/srfi-14.c: whitespace and FUNC_NAME fixes * libguile/srfi-14.h: #endif comment 2009-08-28 Michael Gran <spk121@yahoo.com> Script to generate srfi-14 charsets from UnicodeData.txt This script was used to generate srfi-14.i.c from the UnicodeData.txt file supplied by ftp://www.unicode.org/Public/UNIDATA/ * libguile/unidata_to_charset.pl 2009-08-28 Neil Jerram <neil@ossau.uklinux.net> Fix GDS utility client startup * emacs/gds-scheme.el (gds-start-utility-guile): Use buffer-local variable gds-client instead of client, as client is actually unbound when the process-filter lambda runs. (i.e. This isn't Scheme code!) 2009-08-28 Ludovic Courtès <ludo@gnu.org> Add missing `FUNC_NAME' definition. * libguile/load.c (scm_sys_warn_autocompilation_enabled): Define `FUNC_NAME'. 2009-08-27 Neil Jerram <neil@ossau.uklinux.net> Merge branch 'ossau-gds-dev' Conflicts: THANKS 2009-08-27 Neil Jerram <neil@ossau.uklinux.net> Fix doc of let*-values Thanks to Judy Hawkins for reporting this. * doc/ref/api-modules.texi (Included Guile Modules): Change `let-values*' to `let*-values'. 2009-08-27 Neil Jerram <neil@ossau.uklinux.net> Make GDS resilient to autocompilation comments * emacs/gds-scheme.el (gds-start-utility-guile): Make the extraction of client number more robust; in particular when the client emits comments (about auto compilation) before the number. 2009-08-27 Neil Jerram <neil@ossau.uklinux.net> Incorporate ice-9-debugger-extensions properly i.e. put the extensions where they need to be, and delete ice-9-debugger-extensions.scm. * doc/ref/api-debug.texi (Single Stepping through a Procedure's Code): Change mentions of (ice-9 debugging ice-9-debugger-extensions) module to whatever is appropriate now (or just remove them). * module/Makefile.am (NOCOMP_SOURCES): Remove ice-9-debugger-extensions.scm. * module/ice-9/debugger.scm (debug-trap): Move here from ice-9-debugger-extensions.scm. * module/ice-9/debugger/command-loop.scm ("continue", "finish", "step", "next"): Move here from ice-9-debugger-extensions.scm. * module/ice-9/debugger/commands.scm (assert-continuable, continue, finish, step, next): Move here from ice-9-debugger-extensions.scm. * module/ice-9/debugging/breakpoints.scm: Don't use ice-9-debugger-extensions module. * module/ice-9/debugging/ice-9-debugger-extensions.scm: Removed. * module/ice-9/debugging/trace.scm, module/ice-9/debugging/traps.scm: Remove more old version code. * module/ice-9/debugging/traps.scm (guile-trap-features): Hardcoded as '(tweaking). 2009-08-27 Neil Jerram <neil@ossau.uklinux.net> Remove superfluous ice-9-debugger-extensions code for old Guile versions * module/ice-9/debugging/ice-9-debugger-extensions.scm: Remove all code checking for version < 1.7, and move code for versions >= 1.7 up to top level. Comment out dummy mutex definitions for now, as I'm not sure how to rewrite them correctly for psyntax. 2009-08-27 Daniel Kraft <d@domob.eu> Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp Support circular structures in elisp reader. * module/language/elisp/lexer.scm: Recognize circular markers. * module/language/elisp/parser.scm: Handle them correctly. * test-suite/tests/elisp-reader.test: Check circular structure parsing. 2009-08-27 Michael Gran <spk121@yahoo.com> Default srfi-14 character set information * libguile/srfi-14.i.c: structures containing the default srfi-14 sets 2009-08-27 Daniel Kraft <d@domob.eu> Replaced generated elisp parser with hand-written one to fix source properties. * module/language/elisp/parser.scm: Hand-written parser. * test-suite/tests/elisp-reader.test: Test for source properties. 2009-08-27 Michael Gran <spk121@yahoo.com> Always cast input to toupper as int * libguile/read.c (scm_scan_for_encoding): add cast to int Segfault when writing non-Latin-1 characters under Latin-1 locale * libguile/print.c (iprin1): handle write of non-Latin-1 characters under the Latin-1 locale 2009-08-27 Michael Gran <spk121@yahoo.com> Unicode-capable srfi-14 charsets * libguile/Makefile.am: distribute new files srfi-14.i.c and unidata_to_charset.pl * chars.c (scm_c_upcase, scm_c_downcase): use unicode-enable toupper and tolower * libguile/srfi-14.h (scm_t_char_range, scm_t_char_set): new structures to describe char-sets (scm_t_char_set_cursor): new structure to describe char-set-cursors (SCM_BITS_PER_LONG): removed (SCM_CHARSET_GET): calls function New declarations for scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset, and scm_debug_char_set. * test-suite/tests/srfi-14.test: new tests * libguile/srfi-14.c (SCM_CHARSET_DATA): new macro (SCM_CHARSET_SET, SCM_CHARSET_UNSET): call function (BYTES_PER_CHARSET, LONGS_PER_CHARSET): removed (scm_i_charset_get, scm_i_charset_set, scm_i_charset_unset) (charsets_equal, charsets_leq, charsets_union) (charsets_intersection, charsets_complement, charsets_xor): new functions that are low-level charset operators (charset_print, charset_free): modified for new charset struct (charset_cursor_print, charset_cursor_free): new function (make_char_set, scm_char_set_p, scm_char_set_eq, scm_car_set_leq) (scm_char_set_hash, scm_char_set_cursor, scm_char_set_ref) (scm_char_set_cursor_next, scm_end_of_char_set_p, scm_char_set_fold) (scm_char_set_unfold, scm_char_set_unfold_x, scm_char_set_for_each) (scm_char_set_map, scm_char_set_copy, scm_char_set, scm_list_to_char_set) (scm_list_to_char_set_x, scm_string_to_char_set, scm_string_to_char_set_x) (scm_char_set_filter, scm_char_set_filter_x, scm_ucs_range_to_char_set) (scm_ucs_range_to_char_set_x, scm_to_char_set, scm_char_set_size) (scm_char_set_count, scm_char_set_to_list, scm_char_set_to_string) (scm_char_set_contains_p, scm_char_set_every, scm_char_set_any) (scm_char_set_adjoin, scm_char_set_delete, scm_char_set_adjoin_x) (scm_char_set_delete_x, scm_char_set_complement, scm_char_set_union) (scm_char_set_intersection, scm_char_set_difference, scm_char_set_xor) (scm_char_set_diff_plus_intersection, scm_char_set_complement_x) (scm_char_set_union_x, scm_char_set_intersection_x, scm_char_set_difference_x) (scm_char_set_xor_x, scm_char_set_diff_plus_intersection_x): modified to use new charset and charset-cursor data structures (CSET_BLANK_PRED, CSET_SYMBOL_PRED, CSET_PUNCT_PRED, CSET_LOWER_PRED) (CSET_UPPER_PRED, CSET_LETTER_PRED, CSET_DIGIT_PRED, CSET_WHITESPACE_PRED) (CSET_CONTROL_PRED, CSET_HEX_DIGIT_PRED, CSET_ASCII_PRED, CSET_LETTER_PRED) (CSET_LETTER_AND_DIGIT_PRED, CSET_PRINTING_PRED, CSET_TRUE_PRED) (CSET_FALSE_PRED): removed (scm_srfi_14_compute_char_sets): removed - too slow to iterate over all of unicode at startup (scm_debug_char_set) [SCM_CHARSET_DEBUG]: new function 2009-08-27 Daniel Kraft <d@domob.eu> Don't accept backquote/unquote/unquote-splicing any longer in elisp. The real names \`, \, and \,@ should be used instead and are returned now by the real reader. * module/language/elisp/compile-tree-il.scm: Only accept correct names. 2009-08-27 Andy Wingo <wingo@pobox.com> Revert "eval is actually compile" This reverts commit afe5e6baa76796b1467890fd55416a7f304bed5c. 2009-08-27 Ken Raeburn <raeburn@raeburn.org> Don't leave and reenter guile mode if mutex is available On Aug 5, 2009, at 10:06, Ken Raeburn wrote: > (1) In scm_pthread_mutex_lock, we leave and re-enter guile mode so > that we don't block the thread while in guile mode. But we could > use pthread_mutex_trylock first, and avoid the costs scm_leave_guile > seems to incur on the Mac. If we can't acquire the lock, it should > return immediately, and then we can do the expensive, blocking > version. A quick, hack version of this changed my run time for > A(3,8) from 17.5s to 14.5s, saving about 17%; sigaltstack and > sigprocmask are still in the picture, because they're called from > scm_catch_with_pre_unwind_handler. I'll work up a nicer patch > later. Ah, we already had scm_i_pthread_mutex_trylock lying around; that made things easy. A second timing test with A(3,9) and this version of the patch (based on 1.9.1) shows the same improvement. * libguile/threads.c (scm_pthread_mutex_lock): Try the mutex before leaving and reentering guile mode. 2009-08-27 Ken Raeburn <raeburn@raeburn.org> Pick up in tree headers rather than installed ones From Ken Raeburn: The Mac build off of "master" fails for me currently in srfi-13.c, with the comparison-always-false warning Greg discussed. I hacked around that, but then guile-readline doesn't build: Making all in guile-readline ../libguile/guile-snarf -o readline.x ../../guile-readline/readline.c - DHAVE_CONFIG_H -I. -I.. -I../../guile-readline/.. -I../../guile- readline/lib -I./lib -g -O2 In file included from ../../guile-readline/readline.c:29: ../../guile-readline/../libguile.h:25:17: error: gmp.h: No such file or directory In file included from ../../guile-readline/../libguile.h:95, from ../../guile-readline/readline.c:29: ../../guile-readline/../libguile/strings.h:26:21: error: uniconv.h: No such file or directory Neither the path specified for libgmp nor the path specified for libunistring at configure time is included here. I don't think any of this is Mac-specific; I'm surprised that it works on GNU/Linux systems. Perhaps I'm building it in ways that are unusual for the other developers (build dir != src dir, libgmp and guile-1.8 installed in the same place, libgmp and libunistring installed in different nonstandard directories)? If I use CPPFLAGS=... and LDFLAGS=... instead of --with-libfoo-prefix configure options to specify paths to find libgmp and libunistring, the tests still pick old, installed Guile headers (which this time I've poisoned to highlight the problem) from those locations instead of the in-tree versions: Making all in test-suite Making all in standalone ../../libguile/guile-snarf -o test-asmobs-lib.x ../../../test-suite/ standalone/test-asmobs-lib.c -DHAVE_CONFIG_H -I. -I../../../test-suite/ standalone -I../.. -I/opt/local/include -I/Users/raeburn/dev/guile/ libunistring-0.9.1/I/include -g -O2 -I../../.. -I../../../lib -I../../ lib -I../.. In file included from /opt/local/include/libguile.h:30, from ../../../test-suite/standalone/test-asmobs- lib.c:23: /opt/local/include/libguile/__scm.h:3:2: error: #error Poison! I might be building Guile as part of a larger package (*cough*Emacs*cough*) that wants to include stuff from the same system directories (e.g., for MacPorts, pkgsrc, whatever) where an old version of Guile is installed, and thus Guile gets passed CPPFLAGS/ LDFLAGS settings that add that old version to the search paths. So I think the CPPFLAGS/LDFLAGS version needs to be made to work, as well as the --with-libfoo-prefix version. With the attached patch, I can get guile to build with CPPFLAGS= and LDFLAGS= ... someone more familiar than I am with automake will have to fix the guile-readline stuff. 2009-08-26 Daniel Kraft <d@domob.eu> Error in lexer when 'empty' symbol would have been read. Parser for elisp and use it as reader. * module/language/elisp/parser.scm: New parser file. * module/language/elisp/lexer.scm: Fix lexer/1 and add unquote-splicing support. * module/language/elisp/spec.scm: Use new elisp-reader. * module/language/elisp/README: Document we've got a reader now. * test-suite/tests/elisp-reader.test: Test the parser. get-lexer/1 for elisp that finishes after the first full expression is read. * module/language/elisp/lexer.scm: Add get-lexer/1. * test-suite/tests/elisp-reader.test: Test lexer/1. Character and string literal support for the elisp lexer. * module/language/elisp/lexer.scm: Handle character and string literals. * test-suite/tests/elisp-reader.test: Test it. A first, rough lexer for elisp still missing some stuff. * module/language/elisp/lexer.scm: New lexer file. * test-suite/Makefile.am: Register elisp-reader.test as new test. * test-suite/tests/elisp-reader.test: New test-case. 2009-08-26 Andy Wingo <wingo@pobox.com> fix uninitialized variable in scm_read_character * libguile/read.c (scm_read_character): Fix uninitialized variable. actually install guile-tools * meta/Makefile.am (bin_SCRIPTS): Re-add guile-tools here (removed in 54b38caf19deb0e5a6e8146c65b3e176e7fffa60). Otherwise guile-tools doesn't get installed. I think that 1.9.2 had this bug. fix guile-readline linker bug * acinclude.m4 (GUILE_READLINE): Fix typo that caused readline not to be linked to termcap. 2009-08-25 Ludovic Courtès <ludo@gnu.org> Remove the `scm_tc_free_cell' SMOB type. * libguile/deprecated.h (SCM_FREEP, SCM_NFREEP): Changed to constants. * libguile/gc.c (scm_i_tag_name): Remove reference to `scm_tc_free_cell'. * libguile/gc.h (SCM_FREE_CELL_CDR, SCM_SET_FREE_CELL_CDR): Remove. * libguile/smob.c (free_print): Remove. (scm_smob_prehistory): Don't create the "free" SMOB type. * libguile/struct.c (struct_finalizer_trampoline): Use a bare `scm_tc3_struct' tag for finalized structs instead of `scm_tc_free_cell'. * libguile/tags.h (scm_tc_free_cell): Remove. 2009-08-25 Andy Wingo <wingo@pobox.com> Merge commit 'origin/master' Conflicts: libguile/unif.c Merge wip-array refactor, up to cd43fdc5b7a7c Conflicts: NEWS libguile/print.c 2009-08-25 Michael Gran <spk121@yahoo.com> Add full Unicode capability to ports and the default reader Ports are given two additional properties: a character encoding and a conversion failure strategy. These properties have getters and setters. The new properties are used to convert any locale text to/from the internal representation of strings. If unspecified, ports use a default value. The default value of these properties is held in a fluid. The default character encoding can be modified by calling setlocale. ISO-8859-1 is treated specially. Since it is a native encoding of strings, it can be processed more quickly. Source code is assumed to be ISO-8859-1 unless otherwise specified. The encoding of a source code file can be given as 'coding: XXXXX' in a magic comment at the top of a file. The C functions that deal with encoding often use a null pointer as shorthand for the native Latin-1 encoding, for efficiency's sake. * test-suite/tests/encoding-iso88591.test: new tests * test-suite/tests/encoding-iso88597.test: new tests * test-suite/tests/encoding-utf8.test: new tests * test-suite/tests/encoding-escapes.test: new tests * test-suite/tests/numbers.test: declare 'binary' encoding * test-suite/tests/ports.test: declare 'binary' encoding * test-suite/tests/r6rs-ports.test: declare 'binary' encoding * module/system/base/compile.scm (compile-file): use source-code file's self-declared encoding when compiling files * libguile/strports.c: store string ports in locale encoding (scm_strport_to_locale_u8vector, scm_call_with_output_locale_u8vector) (scm_open_input_locale_u8vector, scm_get_output_locale_u8vector): new functions * libguile/strings.h: new declaration for scm_i_string_contains_char * libguile/strings.c (scm_i_string_contains_char): new function (scm_from_stringn, scm_to_stringn): use NULL for Latin-1 (scm_from_locale_stringn, scm_to_locale_stringn): respect character encoding of input and output ports * libguile/read.h: declaration for scm_scan_for_encoding * libguile/read.c: (read_token): now takes scheme string instead of C string/length (read_complete_token): new function (scm_read_sexp, scm_read_number, scm_read_mixed_case_symbol) (scm_read_number_and_radix, scm_read_quote, scm_read_semicolon_comment) (scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bit_vector) (scm_read_scsh_block_comment, scm_read_commented_expression) (scm_read_extended_symbol, scm_read_sharp_extension, scm_read_shart) (scm_read_expression): use scm_t_wchar for char type, use read_complete_token (scm_scan_for_encoding): new function to find a file's character encoding (scm_file_encoding): new function to find a port's character encoding * libguile/rdelim.c: don't unpack strings * libguile/print.h: declaration for modified function scm_i_charprint * libguile/print.c: use locale when printing characters and strings (scm_i_charprint): input parameter is now scm_t_wchar (scm_simple_format): don't unpack strings * libguile/posix.h: new declaration for scm_setbinary. * libguile/posix.c (scm_setlocale): set default and stdio port encodings based on the locale's character encoding (scm_setbinary): new function * libguile/ports.h (scm_t_port): add encoding and failed conversion handler to port type. Declarations for new or modified functions scm_getc, scm_unget_byte, scm_ungetc, scm_i_get_port_encoding, scm_i_set_port_encoding_x, scm_port_encoding, scm_set_port_encoding_x, scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x, scm_port_conversion_strategy, scm_set_port_conversion_strategy_x. * libguile/ports.c: assign the current ports to zero on startup so we can see if they've been set. (scm_current_input_port, scm_current_output_port, scm_current_error_port): return #f if the port is not yet initialized (scm_new_port_table_entry): set up a new port's encoding and illegal sequence handler based on the thread's current defaults (scm_i_remove_port): free port encoding name when port is removed (scm_i_mode_bits_n): now takes a scheme string instead of a c string and length. All callers changed. (SCM_MBCHAR_BUF_SIZE): new const (scm_getc): new function, since the scm_getc in inline.h is now scm_get_byte_or_eof. This pulls one codepoint from a port. (scm_lfwrite_substr, scm_lfwrite_str): now uses port's encoding (scm_unget_byte): new function, incorportaing the low-level functionality of scm_ungetc (scm_ungetc): uses scm_unget_byte * libguile/numbers.h (scm_t_wchar): compilation order problem with scm_t_wchar being use in functions in multiple headers. Forward declare scm_t_wchar. * libguile/load.c (scm_primitive_load): scan for file encoding at top of file and use it to set the load port's encoding * libguile/inline.h (scm_get_byte_or_eof): new function incorporating most of the functionality of scm_getc. * libguile/fports.c (fport_fill_input): now returns scm_t_wchar * libguile/chars.h (scm_t_wchar): avoid compilation order problem with declaration of scm_t_wchar 2009-08-23 Michael Gran <spk121@yahoo.com> Avoid unpacking symbols in GOOPS * libguile/goops.c (scm_make_extended_class_from_symbol): new function (scm_class_of): don't unpack symbol chars (wrap_init): don't unpack symbol chars (make_class_from_symbol): new function (make_struct_class): don't unpack symbol chars 2009-08-23 Michael Gran <spk121@yahoo.com> Modify socket and time functions for wide strings * libguile/socket.c (scm_recv): receive the message without holding the stringbuf writing lock (scm_send): try to narrow a string before using it * libguile/stime.c (strftime): convert string to UTF-8 so that it can be safely passed to strftime (strptime): convert input string to UTF-8 so that it can be safely passed through strptime * libguile/strings.c (narrow_stringbuf): new function (scm_i_try_narrow_string): new function * libguile/strings.h: new declaration for scm_i_try_narrow_string 2009-08-23 Michael Gran <spk121@yahoo.com> Use string and symbol accessors in struct, throw, and array funcs * libguile/struct.c (scm_make_struct_layout, scm_struct_init) (scm_struct_vtable_p, scm_struct_ref, scm_struct_set_x): use string and symbol accessors and avoid unpacking strings and symbols * libguile/throw.c (scm_ithrow): allow wide symbols in the error message * libguile/unif.c (scm_enclose_array, scm_istr2bve): use string accessors and avoid unpacking strings 2009-08-23 Michael Gran <spk121@yahoo.com> Avoid type-punning warning in scm_gentemp Int and size_t may not have the same storage size * libguile/deprecated.c (scm_gentemp): use size_t for string length 2009-08-21 Neil Jerram <neil@ossau.uklinux.net> Update NEWS 2009-08-22 Neil Jerram <neil@ossau.uklinux.net> Avoid clash with system setjmp/longjmp on IA64 Problem was that if an application includes both libguile.h and the system's setjmp.h, and is compiled on IA64, it gets compile errors because of jmp_buf, setjmp and longjmp being multiply defined. * libguile/__scm.h (__ia64__): Define scm_i_jmp_buf, SCM_I_SETJMP and SCM_I_LONGJMP instead of jmp_buf, setjmp and longjmp. (all other platforms): Map scm_i_jmp_buf, SCM_I_SETJMP and SCM_I_LONGJMP to jmp_buf, setjmp and longjmp. * libguile/continuations.c (scm_make_continuation): Use `SCM_I_SETJMP' instead of `setjmp'. (copy_stack_and_call): Use `SCM_I_LONJMP' instead of `longjmp'. (scm_ia64_longjmp): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/continuations.h (scm_t_contregs): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/threads.c (suspend): Use `SCM_I_SETJMP' instead of `setjmp'. * libguile/threads.h (scm_i_thread): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/throw.c (JBJMPBUF, make_jmpbuf, jmp_buf_and_retval): Use type `scm_i_jmp_buf' instead of `jmp_buf'. (scm_c_catch): Use `SCM_I_SETJMP' instead of `setjmp'. (scm_ithrow): Use `SCM_I_LONGJMP' instead of `longjmp'. 2009-08-22 Neil Jerram <neil@ossau.uklinux.net> Remove trailing whitespace Fix set-source-properties so that the special source properties work * libguile/srcprop.c (scm_set_source_properties_x): Look for the special source properties, save them off, and then construct a srcprops object using them. 2009-08-22 Neil Jerram <neil@ossau.uklinux.net> In srcprop.c change all occurrences of "plist" to "alist" As with the previous commit, this is to avoid any suggestion that the source properties API uses the property list format, i.e. (key1 value1 key2 value2 ...). Also remove scm_srcprops_to_plist () from the API. It doesn't have any external usefulness and has never documented. 2009-08-22 Neil Jerram <neil@ossau.uklinux.net> Minor improvements to doc on source properties In particular avoid any suggestion that the API uses the property list format, i.e. (key1 value1 key2 value2 ...), as opposed to the alist format that it actually does use. 2009-08-21 Neil Jerram <neil@ossau.uklinux.net> Merge branch 'wip-manual' of ssh://ossau@git.sv.gnu.org/srv/git/guile Conflicts: doc/ref/autoconf.texi doc/ref/vm.texi 2009-08-21 Michael Gran <spk121@yahoo.com> Use uc_tolower in number conversion * libguile/numbers.c (XDIGIT2UINT): use uc_tolower 2009-08-21 Michael Gran <spk121@yahoo.com> Use string accessors for string->number conversion * libguile/numbers.c (scm_i_print_fraction): use string accessors (XDIGIT2UINT): use libunistring function (mem2uinteger, mem2integer, mem2decimal_from_point, mem2ureal) (mem2complex): take scheme string instead of c string; use accessors (scm_i_string_to_number): new function (scm_c_locale_string_to_number): use scm_i_string_to_number * libguile/numbers.h: declaration for scm_i_string_to_number * libguile/strings.c (scm_i_string_strcmp): new function * libguile/strings.h: declaration for scm_i_string_strcmp 2009-08-21 Michael Gran <spk121@yahoo.com> Add initial support for wide symbols * libguile/hash.c (scm_i_string_hash): new function (scm_hasher): don't unpack string: use scm_i_string_hash * libguile/hash.h: new declaration for scm_i_string_hash * libguile/print.c (quote_keywordish_symbol): use symbol accessors (scm_i_print_symbol_name): new function (scm_print_symbol_name): call scm_i_print_symbol_name (iprin1): use scm_i_print_symbol_name to print symbols * libguile/print.h: new declaration for scm_i_print_symbol_name * libguile/symbols.c (lookup_interned_symbol): now takes scheme string instead of c string; callers changed (lookup_interned_symbol): add wide symbol support (scm_i_c_mem2symbol): removed (scm_i_mem2symbol): removed and replaced with scm_i_str2symbol (scm_i_str2symbol): new function (scm_i_mem2uninterned_symbol): removed and replaced with scm_i_str2uninterned_symbol (scm_i_str2uninterned_symbol): new function (scm_make_symbol, scm_string_to_symbol, scm_from_locale_symbol) (scm_from_locale_symboln): use scm_i_str2symbol * test-suite/tests/symbols.test: new tests 2009-08-21 Michael Gran <spk121@yahoo.com> Use symbol accessors in scm_gc_mark_dependencies * libguile/gc-mark.c (scm_gc_mark_dependencies): don't unpack symbols. Use symbol accessors. Use string accessors in scm_basename and scm_dirname * libguile/filesys.c (basename, dirname): don't unpack strings. Use string accessor functions. Avoid type-limits warning in SCM_TO_TYPE_PROTO * libguile/conv-uinteger.i.c (SCM_TO_TYPE_PROTO): avoid a comparison that is always true due to the limited range of the data type Type-limits error in GC environment initialization * libguile/gc-malloc.c (scm_gc_init_malloc): GUILE_INIT_MALLOC_LIMIT is cast to unsigned then tested as if it were still signed 2009-08-21 Michael Gran <spk121@yahoo.com> Avoid accessing symbol internals in call_dsubr_1 and DEVAL The symbol's characters are only accessed in case they are needed for an error message. This can be avoided by passing the symbol all the way to a error message function. * libguile/__scm.h (SCM_WTA_DISPATCH_1_SUBR): new macro * libguile/error.c (scm_i_wrong_type_arg_symbol): new error function * libguile/error.h: declaration of scm_i_wrong_type_arg_symbol * libguile/eval.c (call_dsubr_1): use new macro SCM_WTA_DISPATCH_1_SUBR to avoid having to unpack the symbol's chars * libguile/eval.i.c: use new macro SCM_WTA_DISPATCH_1_SUBR 2009-08-21 Michael Gran <spk121@yahoo.com> Use string and symbol accessors with obarrays and keyword-dash-symbols * libguile/deprecated.c (intern_obarray_soft): new function (scm_intern_obarray_soft, scm_string_to_obarray_symbol): use intern_obarray_soft (scm_gentemp): don't unpack string chars, use intern_obarray_soft * libguile/discouraged.c (scm_make_keyword_from_dash_symbol): use symbol accessor 2009-08-21 Ludovic Courtès <ludo@gnu.org> Aggregate `guile-readline' makefiles. * configure.ac: Don't produce `guile-readline/ice-9/Makefile'. * guile-readline/Makefile.am (SUBDIRS): Remove. (ice9dir, nobase_ice9_DATA): New, formerly under `ice-9'. (ETAGS_ARGS, EXTRA_DIST): Augment. (DEFS): Move outside of `if'. (MKDEP): Remove. * guile-readline/ice-9/Makefile.am: Remove. 2009-08-21 Ludovic Courtès <ludo@gnu.org> Don't use a sub-`configure' for `guile-readline'. * acinclude.m4 (GUILE_READLINE): New macro, based on the former `guile-readline/configure.ac'. * configure.ac: Remove `AC_CONFIG_SUBDIRS' invocation. Add `GUILE_READLINE' invocation. Produce files under `guile-readline'. * guile-readline/Makefile.am: Conditionalize the meat under `HAVE_READLINE'. (INCLUDES): Rename to... (AM_CPPFLAGS): this. Users updates. (AM_CFLAGS): New variable. (libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): Add $(READLINE_LIBS). * guile-readline/readline.c: Include <config.h>. * guile-readline/configure.ac, guile-readline/autogen.sh: Remove. 2009-08-20 Andy Wingo <wingo@pobox.com> eval is actually compile * module/ice-9/boot-9.scm (eval): Here at the tail of boot-9, replace the root definition of `eval' with a procedure that will call `compile'. * test-suite/tests/syntax.test ("top-level define"): ("internal define"): Run unmemoization tests in the interpreter, using primitive-eval. 2009-08-20 Andy Wingo <wingo@pobox.com> programs have their own tc7 now * libguile/tags.h (scm_tc7_program): * libguile/programs.h: Programs now have their own tc7 code. Fix up the macros appropriately. * libguile/programs.c: Remove smobby bits, leaving marking, printing, and application for other parts of Guile. * libguile/debug.c (scm_procedure_source): * libguile/eval.c (scm_trampoline_0, scm_trampoline_1) (scm_trampoline_2): Add cases for tc7_program. * libguile/eval.i.c (CEVAL, SCM_APPLY): * libguile/evalext.c (scm_self_evaluating_p): * libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name): * libguile/gc-mark.c (1): * libguile/print.c (iprin1): * libguile/procs.c (scm_procedure_p, scm_thunk_p) * libguile/vm-i-system.c (make-closure): Adapt to new procedure representation. * libguile/procprop.c (scm_i_procedure_arity): Do the right thing for programs. * test-suite/tests/procprop.test ("procedure-arity"): Arity test now succeeds. * libguile/goops.c (scm_class_of): Programs now belong to the class <procedure>, not a smob class. * libguile/vm.h (struct vm, struct vm_cont): * libguile/vm-engine.c (vm_engine): * libguile/frames.h (SCM_FRAME_BYTE_CAST, struct vm_frame): * libguile/frames.c (scm_c_make_vm_frame): Fix usages of scm_byte_t, changing them to scm_t_uint8. 2009-08-20 Andy Wingo <wingo@pobox.com> eval-elisp uses primitive-eval * lang/elisp/interface.scm (eval-elisp): Use primitive-eval, as we will be switching the evaluator soon. 2009-08-20 Andy Wingo <wingo@pobox.com> define @bind using syntax-case * module/ice-9/boot-9.scm (@bind): Define a VM-compatible syntax definition for this old evaluator primitive. * test-suite/tests/dynamic-scope.test: Change the expected error messages. 2009-08-20 Andy Wingo <wingo@pobox.com> use primitive-eval in run-vm-tests.scm * testsuite/run-vm-tests.scm (run-vm-tests): Use primitive-eval, as we'll be changing eval soon. better VM error messages * libguile/vm-engine.c: Attempt to make error messages more friendly and uniform with historical expectation. update docs for calling convention change * doc/ref/vm.texi: Update. 2009-08-20 Andy Wingo <wingo@pobox.com> push new frame on stack before procedure & args * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump * libguile/vm-engine.c (vm_engine): Push a frame corresponding to the mv-call. * libguile/vm-i-system.c: Renumber ops. (new-frame): New op, pushes a frame. (call, mv-call): No need to shuffle args, though we do need to pop the frame in the non-vm call case. (goto/args): Inconsequential tweaks. (call/cc): Push a frame if needed. * module/language/tree-il/compile-glil.scm (flatten): Emit `new-frame' as appropriate. * test-suite/tests/tree-il.test: Fix to expect new-frame. 2009-08-20 Andy Wingo <wingo@pobox.com> reorder frame layout * libguile/frames.h: Reorder the frame layout so the return address comes below the arguments.working (SCM_FRAME_SET_RETURN_ADDRESS, SCM_FRAME_SET_MV_RETURN_ADDRESS): New macros. * libguile/frames.c (scm_vm_frame_arguments): Use the macros to access the arguments. * libguile/vm-engine.c (vm_engine): Fix for new calling convention. * libguile/vm-engine.h (INIT_FRAME): New macro. Does part of what NEW_FRAME used to do. * libguile/vm-i-system.c (call, mv-call): Shuffle args up to make room for the stack, and adapt to new calling convention. (goto/args): Shuffling down is easier now. (return, return/args): Adapt to new frame layout. * libguile/vm.c (vm_mark_stack): Adapt to new frame layout, and the possibility of there being crap on the stack. (really_make_boot_program): Remove extraneous comment. 2009-08-20 Andy Wingo <wingo@pobox.com> remove dead weight from vm-i-system.c * libguile/vm-i-system.c: Remove mark, list-mark, cons-mark, vector-mark, and list-break, as they are no longer used. (call, goto/args, mv-call): Remove bits about trampolines, which was slower, and VM continuations, which are not used (we use Guile's continuations as the applicable objects). Renumber ops. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. 2009-08-20 Andy Wingo <wingo@pobox.com> disable autocompilation in the test suite * check-guile.in: Disable autocompilation while working in the test suite, for now at least. We'll enable it again later. 2009-08-20 Andy Wingo <wingo@pobox.com> autocompiled files before installation go to a cache dir in the builddir * libguile/load.c (scm_init_load_path): Append a slash after XDG_CACHE_HOME. * meta/gdb-uninstalled-guile.in: * meta/guile.in (XDG_CACHE_HOME): Export this var so we write to a cache within the build directory. Probably we should have a GUILE_CACHE_DIR to be more specific, though. * Makefile.am (clean-local): Clear the cache when making clean. 2009-08-20 Michael Gran <spk121@yahoo.com> type limits error in string-tabulate * libguile/srfi-13.c (scm_string_tabulate): test range of signed integer before casting it to unsigned size_t 2009-08-20 Ludovic Courtès <ludo@gnu.org> Relax assumptions made in the precise VM stack marking procedure. * libguile/vm.c (vm_stack_mark): Change assertions into checks to determine whether VM points to a sane (initialized) object. The assumption previously was that free-list elements would be zeroed, as implied by the comment in <gc/gc_mark.h>, but this doesn't appear to be the case. 2009-08-20 Michael Gran <spk121@yahoo.com> Update srfi-13 functions for Unicode * libguile/srfi-13.c (MY_SUBF_VALIDATE_SUBSTRING_SPEC): new macro (MY_VALIDATE_SUBSTRING_SPEC_COPY): now unused, removed (MY_VALIDATE_SUBSTRING_SPEC_UCOPY): now unused, removed (REF_IN_CHARSET): new macro (race_error)[0]: unused, removed (scm_string_any, scm_string_every, scm_string_tabulate) (scm_substring_to_list, scm_reverse_string_to_list) (scm_reverse_list_to_string, scm_string_join) (s_scm_srfi13_substring_copy, scm_string_copy, scm_string_copy_x) (scm_string_pad, scm_string_pad_right, scm_string_trim) (scm_string_trim_right, scm_string_trim_both, scm_substring_fill_x): (scm_string_compare, scm_string_compare_ci): modified for both wide and narrow strings (compare_string): new function (scm_string_eq, scm_string_neq, scm_string_lt, scm_string_gt) (scm_string_le, scm_string_ge, scm_string_ci_eq, scm_string_ci_neq) (scm_string_ci_lt, scm-string_ci_gt, scm_string_ci_le, scm_string_ci_gt) (scm_substring_hash, scm_string_prefix_length, scm_string_suffix_length) (scm_string_prefix_length_ci, scm_string_suffix_length_ci) (scm_string_prefix_p, scm_string_prefix_ci_p, scm_string_suffix_p) (scm_string_suffix_ci_p, scm_string_index, scm_string_index_right) (scm_string_skip, scm_string_skip_right, scm_string_count) (scm_string_contains, scm_string_contains_ci, string_upcase_x) (scm_substring_upcase_x, scm_substring_upcase, string_downcase_x) (scm_string_downcase_x, scm_string_downcase, scm_string_titlecase_x) (scm_string_titlecase, scm_string_capitalize, scm_string_reverse) (scm_string_reverse_x, scm_string_map, scm_string_map_x) (scm_string_fold, scm_string_fold_right, scm_string_unfold) (scm_string_unfold_right, scm_xsubstring, scm_string_xcopy_x) (scm_string_replace, scm_string_tokenize, scm_string_split) (scm_string_filter, scm_string_delete): modified for both wide and narrow strings Some srfi-13 test with wide strings * test-suite/tests/srfi-13.test: more tests 2009-08-20 Michael Gran <spk121@yahoo.com> Updates to benchmarks for srfi-13 Test more of the positive paths. Add test for string-prefix-ci? string-suffix-ci? and string-hash-ci. Update the counts per test to give approximately the same bench/interp time for each test for 1.8.7. * benchmark-suite/benchmarks/srfi-13.bm: update benchmarks 2009-08-20 Michael Gran <spk121@yahoo.com> Avoid possible mutex hang on error message output Avoid possible mutex hang when scm_lfwrite_substr is used in error message output and when an error has caused the stringbuf write mutex to not be unlocked. scm_lfwrite_substr makes a substring: making a substring requires that mutex. Hopefully, all cases of non-local jumps when the stringbuf write lock is held have been eliminated anyway, making this O.B.E. * libguile/ports.c (scm_lfwrite_str): include functionality in this function instead of making this a special case of scm_lfwrite_substr 2009-08-20 Michael Gran <spk121@yahoo.com> Add VM exception in strings.test * test-suite/tests/strings.test (exception:wrong-type-arg): change regex Try to optimize scm_string for speed * libguile/strings.c (scm_string): optimize for speed 2009-08-20 Michael Gran <spk121@yahoo.com> Rename string-width to string-bytes-per-char * libguile/strings.h: rename scm_string_width to scm_string_bytes_per_char * libguile/strings.c (scm_string_width): renamed to scm_string_bytes_per_char (scm_string_bytes_per_char): renamed from scm_string_width * module/language/assembly/compile-bytecode.scm (write-bytecode): string-width -> string-bytes-per-char * module/language/glil/compile-assembly.scm (dump-object): string-width -> string-bytes-per-char 2009-08-20 Michael Gran <spk121@yahoo.com> Misleading error message text in scm_i_string_writable_wide_chars * libguile/strings.c (scm_i_string_writable_wide_chars): change error text 2009-08-20 Ludovic Courtès <ludo@gnu.org> Implement precise marking of the VM stack. Suggested by Andy Wingo. * libguile/vm.c (VM_ENABLE_PRECISE_STACK_GC_SCAN): New macro. (vm_stack_gc_kind): New variable. (make_vm)[VM_ENABLE_PRECISE_STACK_GC_SCAN]: Use `GC_generic_malloc ()' to allocate the stack. (vm_stack_mark): New function. (scm_bootstrap_vm)[VM_ENABLE_PRECISE_STACK_GC_SCAN]: Initialize `vm_stack_gc_kind'. 2009-08-20 Ludovic Courtès <ludo@gnu.org> Fix bogus computation of `vm->stack_limit'. * libguile/vm.c (make_vm): Remove bogus "- 3" when computing `stack_size'. * libguile/vm-engine.h (CHECK_OVERFLOW): Change accordingly. 2009-08-20 Ludovic Courtès <ludo@gnu.org> Simplify the creation of the SMOB GC "kind". * libguile/smob.c (smob_freelist): Remove. (scm_smob_prehistory): Adjust accordingly. Include "scmconfig.h" in <libguile/boehm-gc.h>. * libguile/boehm-gc.h: Use "scmconfig.h". Check for `SCM_USE_PTHREAD_THREADS', not `SCM_I_GSC_USE_PTHREAD_THREADS'. 2009-08-19 Andy Wingo <wingo@pobox.com> procedure-documentation works on vm procedures * libguile/procs.c (scm_procedure_documentation): Add a hack so that this function works for compiled procedures too. 2009-08-19 Michael Gran <spk121@yahoo.com> Display wide strings using escapes * libguile/print.c (iprin1): for now, display wide strings as escaped strings 2009-08-19 Michael Gran <spk121@yahoo.com> Avoid double-casts of stringbuf Conversion from char to scm_t_wchar require an intermediate cast to unsigned char. By changing the return type of SCM_STRINGBUF_INLINE_CHARS to unsigned char *, doublecasts in the code can be avoided. Also, some clarification of return types. * libguile/strings.c (STRINGBUF_OUTLINE_CHARS) (STRINGBUF_INLINE_CHARS): now returns unsigned char *; all callers changed. 2009-08-19 Michael Gran <spk121@yahoo.com> Avoid compilation warnings in SCM_MAKE_CHAR * libguile/chars.h (SCM_MAKE_CHAR): change inequality 2009-08-19 Michael Gran <spk121@yahoo.com> Benchmarks for common character and string procedures * benchmark-suite/benchmarks/chars.bm: new benchmarks * benchmark-suite/benchmarks/srfi-13.bm: new benchmarks 2009-08-19 Ludovic Courtès <ludo@gnu.org> Remove unneeded `scm_without_guile ()' call. * libguile/scmsigs.c (read_without_guile_data, do_read_without_guile, read_without_guile): Remove. (signal_delivery_thread): Use read(2) instead of `read_without_guile ()'. Reinstate missing IA64 helper functions. * libguile/threads.c (scm_ia64_register_backing_store_base, scm_ia64_ar_bsp): New, formerly in `gc.c', which was removed in the BDW-GC branch. 2009-08-18 Ludovic Courtès <ludo@gnu.org> Use `scm_gc_malloc_pointerless ()' for bytevectors. * libguile/bytevectors.c (make_bytevector): Use `scm_gc_malloc_pointerless ()' for the buffer itself. * libguile/r6rs-ports.c (scm_get_bytevector_some, scm_get_bytevector_all, bop_buffer_grow): Likewise. 2009-08-18 Andy Wingo <wingo@pobox.com> remove (ice-9 lineio)'s dependency on (ice-9 readline) * module/ice-9/lineio.scm: Use (ice-9 rdelim) instead of (ice-9 readline) to remove readline dependency. 2009-08-18 Andy Wingo <wingo@pobox.com> `load' autocompiles * libguile/load.h: * libguile/load.c (scm_sys_warn_autocompilation_enabled): New primitive, not exported. Since `load' autocompiles now, it should warn in the same way that the bits hardcoded into C warn. (scm_try_autocompile): Use scm_sys_warn_autocompilation_enabled. * module/ice-9/boot-9.scm (autocompiled-file-name): New helper. (load): Try autocompiling the argument, if appropriate. Will autocompile files passed on Guile's command line. `primitive-load' is unaffected. 2009-08-18 Ludovic Courtès <ludo@gnu.org> Remove unneeded SMOB mark/free procedures. * libguile/bytevectors.c (free_bytevector): Remove. (scm_bootstrap_bytevectors): Update accordingly. * libguile/r6rs-ports.c (bip_mark, cbp_mark, bop_free, bop_proc_mark): Remove. (initialize_bytevector_input_ports, initialize_custom_binary_input_ports, initialize_bytevector_output_ports, initialize_custom_binary_output_ports): Update accordingly. 2009-08-18 Ludovic Courtès <ludo@gnu.org> Fix malloc/scm_c_take_bytevector mismatch. * libguile/bytevectors.c (STRING_TO_UTF): Use `make_bytevector ()' instead of `scm_c_take_bytevector (). (scm_string_to_utf8): Likewise. Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am libguile/Makefile.am libguile/frames.c libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc_os_dep.c libguile/load.c libguile/macros.c libguile/objcodes.c libguile/programs.c libguile/strings.c libguile/vm.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/inline.m4 2009-08-17 Ludovic Courtès <ludo@gnu.org> Thanks, Mike. Update `NEWS' for commit d8dd381fa781c236ae777ca1ac55b73d3ca91c2a. 2009-08-15 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.2. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Turn off auto-compilation to stand-alone tests. * test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Add "GUILE_AUTO_COMPILE=0". 2009-08-15 Ludovic Courtès <ludo@gnu.org> Update the manual and `NEWS' regarding `guile-2.0.pc'. * NEWS: Mention `guile-2.0.pc'. * doc/ref/autoconf.texi (Autoconf Macros): Update to `guile-2.0'. 2009-08-15 Ludovic Courtès <ludo@gnu.org> Add proper `--help' and `--version' for `guile-tools compile'. * configure.ac: Produce `meta/guile-tools'. * meta/Makefile.am (EXTRA_DIST): Add `guile-tools.in'. (bin_SCRIPTS): Remove `guile-tools'. * meta/uninstalled-env.in (PATH): Add "${top_builddir}/meta". * module/scripts/compile.scm (%options): Add `--version'. (parse-args): Show the offending option name upon error. (show-version): New. (compile): Use `%guile-bug-report-address'. 2009-08-15 Andy Wingo <wingo@pobox.com> update NEWS for 1.9.2 * NEWS: Update. 2009-08-15 Ludovic Courtès <ludo@gnu.org> Update `.gitignore' for GNU Global. 2009-08-15 Ludovic Courtès <ludo@gnu.org> Switch from `guile-1.8.pc' to `guile-2.0.pc'. * configure.ac: Produce guile-2.0*.pc. * meta/Makefile.am (EXTRA_DIST): Rename guile-1.8*.pc.in to guile-2.0*.pc.in. (pkgconfig_DATA): Update accordingly. * meta/guile-config (guile-module): Likewise. 2009-08-13 Ludovic Courtès <ludo@gnu.org> Uncomment run-time objcode alignment check. This should now work thanks to the changes in 28b119ee3da0f4b14cb87e638794d22843778cda ("make sure all programs are 8-byte aligned"). This commit is a follow-up to ec99fe8ecb412e49e8e981246eb62ca46b32754b ("Add FIXMEs about misaligned objcode-metas."). * libguile/objcodes.c (scm_c_make_objcode_slice): Uncomment assertion that checks for proper alignment of PTR. * module/language/assembly/compile-bytecode.scm (write-bytecode): Update comment about META's alignment. 2009-08-13 Ludovic Courtès <ludo@gnu.org> Remove deprecated semi-public memoizers. * libguile/eval.c (scm_m_expand_body, scm_macroexp, scm_unmemocar): Remove. (scm_m_undefine): Make `static'. * libguile/eval.h (scm_m_undefine, scm_m_expand_body, scm_unmemocar, scm_macroexp): Remove declarations. 2009-08-13 Ludovic Courtès <ludo@gnu.org> Make the evaluator's memoizers private. * libguile/eval.c (macroexp): Move upwards. (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_and, scm_m_or, scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_quasiquote, scm_m_delay, scm_m_generalized_set_x, scm_m_define, scm_m_letrec, scm_m_let, scm_m_at, scm_m_atat, scm_m_apply, scm_m_cont, scm_m_nil_cond, scm_m_atfop, scm_m_atbind, scm_m_atslot_ref, scm_m_atslot_set_x, scm_m_at_call_with_values, scm_m_eval_when): New static declarations; definitions made static. (s_atslot_ref, s_atslot_set_x): New, from `goops.c'. * libguile/eval.h (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_vref, scm_m_vset, scm_m_and, scm_m_or, scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_quasiquote, scm_m_delay, scm_m_generalized_set_x, scm_m_future, scm_m_define, scm_m_letrec, scm_m_let, scm_m_at, scm_m_atat, scm_m_apply, scm_m_cont, scm_m_nil_cond, scm_m_atfop, scm_m_atbind, scm_m_atslot_ref, scm_m_atslot_set_x, scm_m_atdispatch, scm_m_at_call_with_values, scm_m_eval_when): Remove public declarations. * libguile/goops.c (s_atslot_ref, s_atslot_set_x): Remove. 2009-08-13 Ludovic Courtès <ludo@gnu.org> compiler.test: Enforce evaluation order. * test-suite/tests/compiler.test ("psyntax")["redefinition", "compile in current module", "compile in fresh module"]: Use `begin' to enforce evaluation order. Thanks Andy! 2009-08-13 Ludovic Courtès <ludo@gnu.org> Allow fresh modules to be passed to `compile'. * module/ice-9/boot-9.scm (module-name): When making MOD non-anonymous, bind it in the `(%app modules)' name space. * test-suite/tests/compiler.test ("psyntax")["compile in current module", "compile in fresh module"]: New tests. * test-suite/tests/modules.test ("foundations")["modules don't remain anonymous"]: New test. 2009-08-13 Ludovic Courtès <ludo@gnu.org> Allow redefinitions in compiled code as in `(define round round)'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (chi-top)[define-form]: If a same-named imported variable exists, take its value instead of `#f'. * test-suite/tests/compiler.test ("psyntax")["redefinition"]: New tests. 2009-08-12 Andy Wingo <wingo@pobox.com> update docs for recent vm/compiler work * doc/ref/compiler.texi: * doc/ref/vm.texi: Update for recent changes. * module/language/assembly/disassemble.scm (disassemble-load-program): Don't print nops, they are distracting. 2009-08-12 Andy Wingo <wingo@pobox.com> "fix" <let>-bound lambda expressions too * module/language/tree-il/compile-glil.scm (compile-glil): Compute warnings before optimizing, as unreferenced variables will be optimized out. * libguile/_scm.h: Fix C99 comment. * module/language/tree-il/fix-letrec.scm (partition-vars): Also analyze let-bound vars. (fix-letrec!): Fix a bug whereby a set! to an unreffed var would be called for value, not effect. Also "fix" <let>-bound lambda expressions -- really speeds up pmatch. * test-suite/tests/tree-il.test ("lexical sets", "the or hack"): Update to take into account the new optimizations. 2009-08-12 Michael Gran <spk121@yahoo.com> Don't include libunistring headers in Guile public headers This requres the creation of a new type scm_t_string_failed_conversion_handler to replace libunistring's enum iconveh_ilseq_handler. * libguile/strings.h: don't include <uniconv.h> (scm_t_string_failed_conversion_handler): new enum type (SCM_FAILED_CONVERSION_ERROR, SCM_FAILED_CONVERSION_QUESTION_MARK): (SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE): new enum type values * libguile/strings.c (scm_to_stringn): now takes type scm_t_string_failed_conversion_handler. All callers changed. * libguile/print.c: include <uniconv.h> * libguile/ports.c (scm_lfwrite_substr): use scm_t_string_conversion_handler's constants * libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR): (SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store iconveh_ilseq_hander constants as #define's 2009-08-12 Michael Gran <spk121@yahoo.com> Regression, scm_string fails to test for circular lists * libguile/string.c (scm_string): Restores the functionality where scm_string tests for circular lists * test-suite/tests/strings.test: add test for circular lists 2009-08-12 Michael Gran <spk121@yahoo.com> Some signed/unsigned comparison and conversions * libguile/ports.c (scm_lfwrite_str, scm_lfwrite_substr): signed/unsigned conversion and comparison * libguile/strings.c (scm_string_append): signed/unsigned comparison 2009-08-12 Andy Wingo <wingo@oblong.net> rework the vm support for wide strings * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-engine.c (vm_error_bad_wide_string_length): New error case. * libguile/vm-i-loader.c (load-unsigned-integer, load-integer) (load-keyword): Remove these instructions. The former two are obsoleted by make-int64/make-uint64, the latter via make-keyword. (load-string): Only handle narrow strings. (load-symbol): Only handle narrow symbols. The wide case is handled via make-symbol. (load-wide-string): New instruction, for wide strings. * libguile/vm-i-system.c (define): Move here from loaders.c, as now it just takes a sym on the stack. (make-keyword, make-symbol): New instructions. * module/language/assembly.scm: Remove removed instructions. No more width byte in load-string etc. * module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt to change in instruction set. * module/language/glil/compile-assembly.scm (glil->assembly): Compile define by pushing the sym then emitting (define). (dump-object): Dump narrow and wide strings differently. Use make-keyword and make-symbol as appropriate. * module/language/tree-il/compile-glil.scm (flatten): When compiling a ref to a primitive (not a call), first see if the primitive is actually bound in the root module. (That's not the case with e.g. bytevector-u8-ref). * module/system/xref.scm (program-callee-rev-vars): Don't parse out "nexts". * test-suite/tests/asm-to-bytecode.test ("compiler"): Adapt to bytecode format change. 2009-08-12 Michael Gran <spk121@yahoo.com> Fix disassembly of strings and symbols * module/language/assembly/decompile-bytecode.scm (decode-bytecode): fix disassembly of strings, symbols, keywords, and defines 2009-08-12 Michael Gran <spk121@yahoo.com> Quiet signed/unsigned comparison warnings in chars.[ch] * libguile/chars.h (SCM_MAKE_CHAR): quiet signed/unsigned comparison warnings * libguile/chars.c (scm_i_charname): (scm_i_charname_to_char): quiet signed/unsigned comparison warnings 2009-08-12 Michael Gran <spk121@yahoo.com> Avoid unitialized and unused warnings in scm_string_append * libguile/strings.c (scm_string_append): avoid warnings 2009-08-12 Michael Gran <spk121@yahoo.com> Revert to locale-dependent toupper and tolower To avoid leaving Guile in a broken state, the conversion from locale-dependent case modification to Unicode case modification should be an atomic commit * libguile/chars.c (scm_c_upcase): revert to locale-dependent toupper and tolower 2009-08-12 Michael Gran <spk121@yahoo.com> Only pass ints to tolower and toupper * libguile/strings.c (unistring_escapes_to_guile_escapes): cast tolower's parameter to int * libguile/read.c (CHAR_DOWNCASE): cast tolower's parameter to int 2009-08-12 Andy Wingo <wingo@pobox.com> debitrot the ecmascript compiler * module/Makefile.am (ECMASCRIPT_LANG_SOURCES): * module/language/ecmascript/compile-ghil.scm: * module/language/ecmascript/compile-tree-il.scm: SOURCES): Replace the GHIL compiler with a ->tree-il compiler. Not fully functional, but the basics work. * module/language/ecmascript/spec.scm: Only include the tree-il compiler. * module/language/ecmascript/tokenize.scm (read-punctuation): Avoid mutating a constant. 2009-08-11 Andy Wingo <wingo@pobox.com> make the fallback path look less like line noise * libguile/_scm.h: * libguile/load.c: Rework to only include the relevant pieces in the fallback path. 2009-08-11 Andy Wingo <wingo@pobox.com> include objcode cookie in the fallback path * libguile/_scm.h (SCM_OBJCODE_COOKIE): Move the objcode cookie define here, so that load.c can use it. This is a private header. * libguile/load.c (FALLBACK_DIR): Include the objcode cookie in the fallback path. Should fix problems when objcode changes incompatibly during the 1.9 series. * libguile/objcodes.c: Adapt to SCM_OBJCODE_COOKIE move. This should fix http://article.gmane.org/gmane.lisp.guile.devel/9059. 2009-08-11 Michael Gran <spk121@yahoo.com> More string and symbol tests * test-suite/tests/strings.test: more tests * test-suite/tests/symbols.test: more tests 2009-08-11 Michael Gran <spk121@yahoo.com> Fix %string-dump and %symbol-dump fields * libguile/strings.c (scm_sys_string_dump): don't print stringbuf. Print read-only status. (scm_sys_symbol_dump): don't print stringbuf. Print interned status. 2009-08-10 Ludovic Courtès <ludo@gnu.org> Change `defined?' to accept a module as its second argument. Reported by Daniel Kraft <d@domob.eu>. * doc/ref/api-binding.texi (Binding Reflection): Update documentation of `defined?'. * libguile/evalext.c (scm_defined_p): Expect a module as the second argument, not a lexical environment. 2009-08-10 Michael Gran <spk121@yahoo.com> Make scm_charprint and scm_i_string_wide_chars SCM_INTERNAL. Also, scm_charprint is renamed to scm_i_charprint. * libguile/strings.h: make scm_i_string_wide_chars internal. * libguile/print.h: rename scm_charprint to scm_i_charprint. Make internal. * libguile/print.c (scm_i_charprint): renamed from scm_charprint (scm_charprint): renamed to scm_i_charprint. All callers changed. 2009-08-10 Michael Gran <spk121@yahoo.com> Improve %string-dump and %symbol-dump %string-dump and %symbol-dump are modified to return assocation lists of string and symbol attributes instead of printing to stderr. They are no longer conditional on SCM_DEBUG. * libguile/strings.c (scm_sys_string_dump) (scm_sys_symbol_dump): now returns alist of properties. No longer require that SCM_DEBUG be defined. (scm_sys_stringbuf_hist): now conditional on SCM_STRING_LENGTH_HISTOGRAM * libguile/strings.h: scm_sys_string_dump and scm_sys_symbol dump are now declared as API 2009-08-10 Michael Gran <spk121@yahoo.com> More comments for string functions * libguile/strings.c: comments Missing parentheses in SCM_MAKE_CHAR macro * libguile/chars.h (SCM_MAKE_CHAR): missing parentheses 2009-08-10 Michael Gran <spk121@yahoo.com> Port position macros shouldn't require enclosing braces The port position macros incorrectly required enclosing braces when used within if statements. * libguile/ports.h (SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL) (SCM_DECCOL, SCM_TABCOL): enclose macro in do/while * libguile/ports.c (update_port_lf): remove extra braces 2009-08-09 Ludovic Courtès <ludo@gnu.org> Use a linker version script for libguile. * libguile/Makefile.am (libguile_la_LDFLAGS)[HAVE_LD_VERSION_SCRIPT]: Use `libguile.map'. (EXTRA_DIST): Add `libguile.map'. * libguile/libguile.map: New file. 2009-08-09 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `lib-symbol-versions' module. * m4/gnulib-cache.m4: Add `lib-symbol-versions'. Remove bogus `configure' test for GNU libunistring. * configure.ac: Remove explicit test for libunistring, which conflicted with Gnulib's own test. This fixes commit f4863880f5ef539cb545999c19b6b5c0eec9382d. 2009-08-09 Neil Jerram <neil@ossau.uklinux.net> Misc GOOPS chapter updates * doc/ref/goops-tutorial.texi: Update intro text. Fix `an' typo. * doc/ref/goops.texi: Update quick start intro text. Simplify example that uses `format'. 2009-08-09 Neil Jerram <neil@ossau.uklinux.net> Use #:keyword syntax in preference to :keyword because that is Guile's default. 2009-08-09 Neil Jerram <neil@ossau.uklinux.net> In general, use @lisp in preference to @smalllisp because it looks better in the DVI output. Exceptions are - wide examples, which would cause overfull hboxes if they used the bigger @lisp font - very large examples, which may look too big at the @lisp size. 2009-08-09 Neil Jerram <neil@ossau.uklinux.net> Use @result{} instead of --> * doc/ref/goops.texi: Use @result{} instead of -->. Update GOOPS Getting Started section * doc/ref/goops.texi (Getting Started): Renamed `Quick Start', to fit better with following Tutorial. Also add a bit more text to the Methods subsection. 2009-08-08 Neil Jerram <neil@ossau.uklinux.net> Minor textual improvements to slot sections Move tutorial sections on slots before inheritance * doc/ref/goops-tutorial.texi (Instance creation and slot access, Slot description): Move to before Inheritance. Change <complex> to <my-complex> in GOOPS tutorial * doc/ref/goops-tutorial.texi (Class Definition): Minor text improvements. Change the class being defined to <my-complex>, to reduce the confusion with the built in <complex> class. 2009-08-08 Neil Jerram <neil@ossau.uklinux.net> Start updating/merging GOOPS getting started / tutorial text * doc/ref/goops-tutorial.texi (Introduction): Merge this subsection's non-duplicate text into the introductory text of the whole section, then remove this subsection. (Tutorial): Textual updates to introductory text. (Class definition and instantiation): Rename `Class definition', since that's all it covers. Remove unnecessary footnote about loading (oop goops) module. (All @nodes): Remove explicit up, next and prev nodes. (They make the document harder to change.) * doc/ref/goops.texi (Tutorial): Move from the end of the GOOPS chapter to the beginning of it. (Running GOOPS): Removed; useful text merged into containing section. 2009-08-08 Neil Jerram <neil@ossau.uklinux.net> Remove page break after heading of Chapter 6 (Modules) This brings this chapter into line with the others, which do not have page breaks before the first section. Use GOOPS Introduction as intorudctory text for the whole GOOPS chapter 2009-08-08 Michael Gran <spk121@yahoo.com> Merge commit 'origin/master' 2009-08-08 Michael Gran <spk121@yahoo.com> Add Unicode strings and symbols This adds full Unicode strings as a datatype, and it adds some minimal functionality. The terminal and port encoding is assumed to be ISO-8859-1. Non-ISO-8859-1 characters are written or input as string character escapes. The string character escapes now have 3 forms: \xXX \uXXXX and \UXXXXXX, for unprintable characters that have 2, 4 or 6 hex digits. The process for writing to strings has been modified. There is now a function scm_i_string_start_writing that does the copy-on-write conversion if necessary. To compile strings that may be wide, the VM storage of strings and string-likes has changed. Most string-using functions have not yet been updated and may break when used with wide strings. * module/language/assembly/compile-bytecode.scm (write-bytecode): use variable width string bytecode format * module/language/assembly.scm (byte-length): use variable width bytecode format * libguile/vm-i-loader.c (load-string, load-symbol): (load-keyword, define): use variable-width bytecode format * libguile/vm-engine.h (FETCH_WIDTH): new macro * libguile/strings.h: new declarations * libguile/strings.c (make_wide_stringbuf): new function (widen_stringbuf): new function (scm_i_make_wide_string): new function (scm_i_is_narrow_string): new function (scm_i_string_wide_chars): new function (scm_i_string_start_writing): new function (scm_i_string_ref): new function (scm_i_string_set_x): new function (scm_i_is_narrow_symbol): new function (scm_i_symbol_wide_chars, scm_i_symbol_ref): new function (scm_string_width): new function (unistring_escapes_to_guile_escapes): new function (scm_to_stringn): new function (scm_i_stringbuf_free): modify for wide strings (scm_i_substring_copy): modify for wide strings (scm_i_string_chars, scm_string_append): modify for wide strings (scm_i_make_symbol, scm_to_locale_stringn): modify for wide strings (scm_string_dump, scm_symbol_dump, scm_to_locale_stringbuf): (scm_string, scm_i_deprecated_string_chars): modify for wide strings (scm_from_locale_string, scm_from_locale_stringn): add null test * libguile/srfi-13.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing (scm_string_for_each): modify for wide strings * libguile/socket.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/rw.c: add calls for scm_i_string_start_writing for each call of scm_i_string_stop_writing * libguile/read.c (scm_read_string): allow reading of wide strings * libguile/print.h: add declaration for scm_charprint * libguile/print.c (iprin1): print wide strings and add new string escapes (scm_charprint): new function * libguile/ports.h: new declarations for scm_lfwrite_substr and scm_lfwrite_str * libguile/ports.c (update_port_lf): new function (scm_lfwrite): use update_port_lf (scm_lfwrite_substr): new function (scm_lfwrite_str): new function * test-suite/tests/asm-to-bytecode.test ("compiler"): add string width byte to sting-like asm tests 2009-08-07 Andy Wingo <wingo@pobox.com> lambda, the ultimate goto * module/language/tree-il/analyze.scm (analyze-lexicals): Rework to actually determine when a fixed-point procedure may be allocated as a label. * module/language/tree-il/compile-glil.scm (emit-bindings): Always emit a <glil-bind>. Otherwise it's too hard to pair with unbindings. (flatten-lambda): Consequently, here we only `bind' if there are any vars to bind. This doesn't make any difference, given that lambdas don't have trailing unbind instructions, but it does keep the GLIL output the same for thunks -- no extraneous (bind) instructions. Keeps tree-il.test happy. (flatten): Some bugfixes. Yaaay, it works!!! implement compilation of label-allocated lambda expressions * module/language/tree-il/compile-glil.scm (flatten-lambda, flatten): Implement compilation of label-allocated lambda expressions. Quite tricky, we'll see if this works when the new analyzer lands. 2009-08-07 Andy Wingo <wingo@pobox.com> add label alist to lambda allocations in tree-il->glil compiler * module/language/tree-il/analyze.scm: Add some more comments about something that will land in a future commit: compiling fixpoint lambdas as labels. (analyze-lexicals): Reorder a bit, and add a label alist to procedure allocations. Empty for now. * module/language/tree-il/compile-glil.scm (flatten): Adapt to the free variables being in the cddr of the allocation, not the cdr. 2009-08-06 Andy Wingo <wingo@pobox.com> loop detection in the house * libguile/vm-i-scheme.c (vector-ref, vector-set): Sync registers if we call out to C. * module/language/tree-il/compile-glil.scm (flatten-lambda): Add an extra argument, the self-label, which should be the gensym under which the procedure is bound in a <fix> expression. (flatten): If we see a call to a lexical ref to the self-label in a tail position, rename and goto instead of goto/args, which will tear down the frame -- or will, in the future. It's a primitive form of loop detection. * module/language/tree-il/primitives.scm (zero?): Expand to (= x 0). 2009-08-06 Andy Wingo <wingo@pobox.com> actually implement "fixing letrec" * module/Makefile.am (SOURCES): Reorganize so GHIL is compiled last, along with ecmascript. * module/language/scheme/spec.scm: Remove references to GHIL, as it's bitrotten and obsolete.. * module/language/tree-il.scm (make-tree-il-folder): Rework so that we only have down and up procs, and call down and up on each element. * module/language/tree-il/analyze.scm (analyze-lexicals): Fix a thinko handling let-values. * module/language/tree-il/fix-letrec.scm: Actually implement fixing letrec. The resulting code will perform better, but violations of the letrec restriction are not detected. This behavior is allowed by the spec, but it is undesirable. Perhaps that will be fixed later. * module/language/tree-il/inline.scm (inline!): Fix a case in which ((lambda args foo)) would be erroneously inlined to foo. Remove empty let, letrec, and fix statements. * module/language/tree-il/primitives.scm (effect-free-primitive?): New public predicate. 2009-08-06 Andy Wingo <wingo@pobox.com> actually inline call-with-values to tree-il's <let-values> * module/srfi/srfi-11.scm (let-values): In the one-clause case, avoid going through temporary variables. * module/language/tree-il/inline.scm (inline!): Add another case: (call-with-values (lambda () ...) (lambda ... ...) -> let-values. * module/language/tree-il/compile-glil.scm (flatten): Fix a bug compiling applications in "vals" context. * module/language/tree-il/analyze.scm (analyze-lexicals): Fix a couple bugs with let-values and rest arguments. 2009-08-06 Neil Jerram <neil@ossau.uklinux.net> Include GOOPS pictures in the distribution 2009-08-05 Andy Wingo <wingo@pobox.com> let-values in terms of syntax-case, add make-tree-il-folder * module/language/tree-il.scm (tree-il-fold): Fix for let-values case. (make-tree-il-folder): New public macro, makes a multi-valued folder specific to the number of seeds that the user wants. * module/language/tree-il/optimize.scm (optimize!): Reverse the order of inline! and fix-letrec!, as the latter might expose opportunities for the former. * module/srfi/srfi-11.scm (let-values): Reimplement in terms of syntax-case, so that its expressions may reference hygienically bound variables. See the NEWS for the rationale. (let*-values): An empty let*-values still introduces a local `let' binding contour. * module/system/base/syntax.scm (record-case): Yukkkk. Reimplement in terms of syntax-case. Ug-ly, but see the NEWS again: "Lexical bindings introduced by hygienic macros may not be referenced by nonhygienic macros." 2009-08-05 Andy Wingo <wingo@pobox.com> add <fix> tree-il construct, and compile it * libguile/vm-i-system.c (fix-closure): New instruction, for wiring together fixpoint procedures. * module/Makefile.am (TREE_IL_LANG_SOURCES): Add fix-letrec.scm. * module/language/glil/compile-assembly.scm (glil->assembly): Reindent the <glil-lexical> case, and handle 'fix for locally-bound vars. * module/language/tree-il.scm (<fix>): Add the <fix> tree-il type and accessors, for fixed-point bindings. This IL construct is taken from the Waddell paper. (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold) (pre-order!, post-order!): Update for <fix>. * module/language/tree-il/analyze.scm (analyze-lexicals): Update for <fix>. The difference here is that the bindings may not be assigned, and are not marked as such. They are not boxed. (report-unused-variables): Update for <fix>. * module/language/tree-il/compile-glil.scm (flatten): Compile <fix> to GLIL. * module/language/tree-il/fix-letrec.scm: A stub implementation of fixing letrec -- will flesh out in a separate commit. * module/language/tree-il/inline.scm: Fix license, it was mistakenly added with LGPL v2.1+. * module/language/tree-il/optimize.scm (optimize!): Run the fix-letrec! pass. 2009-08-05 Andy Wingo <wingo@pobox.com> add a brain-dead inliner * module/Makefile.am (TREE_IL_LANG_SOURCES): * module/language/tree-il/inline.scm: Add a brain-dead inliner, to inline ((lambda () x)) => x. * module/language/tree-il/optimize.scm (optimize!): Invoke the inliner. 2009-08-05 Andy Wingo <wingo@pobox.com> add1 and sub1 instructions * libguile/vm-i-scheme.c: Add add1 and sub1 instructions. * module/language/tree-il/compile-glil.scm: Compile 1+ and 1- to add1 and sub1. * module/language/tree-il/primitives.scm (define-primitive-expander): Add support for `if' statements in the consequent. (+, -): Compile (- x 1), (+ x 1), and (+ 1 x) to 1- or 1+ as appropriate. (1-): Remove this one. Seems we forgot 1+ before, but we weren't compiling it nicely anyway. * test-suite/tests/tree-il.test ("void"): Fix expected compilation of (+ (void) 1) to allow for add1. 2009-08-04 Andy Wingo <wingo@pobox.com> perform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGS * configure.ac: Rework gmp and unistring checks to use AC_LIB_HAVE_LINKFLAGS, so that the compilation checks run with the right -L/-l flags. * libguile/Makefile.am (libguile_la_LIBADD): Adapt to need to add $(LIBGMP) and $(LIBUNISTRING) here. Hopefully this solves http://article.gmane.org/gmane.lisp.guile.bugs/4288. 2009-08-04 Andy Wingo <wingo@pobox.com> rename configure.in to configure.ac * configure.ac: * guile-readline/configure.ac: Rename from configure.in, as recommended by the autoconf manual. 2009-08-04 Andy Wingo <wingo@pobox.com> fix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+ * libguile/numbers.c (mem2decimal_from_point, mem2ureal, mem2complex): Fix a number of cases where, for invalid numbers, we could read past the end of the buffer. This happened in e.g. "1.0+", "1/" and "1.0f". But I couldn't figure out how to test for these, given that the behavior depended on the contents of uninitialized memory in the reader buffer. We'll just have to be happy with this. Thanks to Kjetil S. Matheussen for the report. 2009-08-04 Neil Jerram <neil@ossau.uklinux.net> Git-Ignore effective-version.texi Fix overfull hboxes Typos Add an effective version variable for the manual Add copyright statements to goops.texi and goops-tutorial.texi 2009-08-04 Daniel Kraft <d@domob.eu> Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp Abstracted dynamic binding a little off the fluids. * module/language/elisp/compile-tree-il.scm: Move dynamic binding to one place and changed names that refer to `fluids' for dynamic binding. * module/language/elisp/bindings.scm: Changed names referring to `fluids'. 2009-08-04 Neil Jerram <neil@ossau.uklinux.net> Move GOOPS documentation into the main manual Nothing editorial here, just the minimum to move the GOOPS documentation into the main manual, and then still have everything build properly. 2009-08-03 Daniel Kraft <d@domob.eu> Implement catch and unwind-protect as macros. * module/language/elisp/compile-tree-il.scm: Remove catch and unwind-protect. * module/language/elisp/runtime/macro-slot.scm: Re-implement them here. 2009-08-03 Neil Jerram <neil@ossau.uklinux.net> Move `Continuation Barriers' to the section that covers continuations Since continuation barriers protect against non-local exits, it makes better sense to document them in the same section as continuations and exceptions. Review/update sections on arbiters and asyncs Miscellaneous small updates - Typos - Minor changes to texinfo markup - Minor wording changes Remove the idea of a separate manual edition number I don't believe this has ever been useful, and I doubt that we've consistently incremented it in the past. The reality is that the manual evolves with the rest of Guile, so Guile's version number should apply to the manual too. It is conceivable that we might one day revise the manual for an existing Guile release, so we keep a REVISION number to cover that. 2009-08-01 Michael Gran <spk121@yahoo.com> Don't doubly define scm_t_wchar * libguile/chars.h: don't define scm_t_wchar * libguile/numbers.h: define scm_t_wchar here 2009-08-01 Michael Gran <spk121@yahoo.com> Fix coding style compliance for recent 32-bit char changes * libguile/print.c (iprin1): extra braces * libguile/chars.h (SCM_IS_UNICODE_CHAR): coding style 2009-08-01 Michael Gran <spk121@yahoo.com> Don't use GNU extensions for SCM_MAKE_CHAR macro Since the contents of SCM_MAKE_CHAR are evaluated more than once, don't use it in situations where this could cause side-effects. * libguile/vm-i-system.c (make-char8): avoid side-effects with SCM_MAKE_CHAR call * libguile/chars.h (SCM_MAKE_CHAR): modified 2009-08-01 Michael Gran <spk121@yahoo.com> Make charname declarations module-level and GCS Charname array declarations are corrected for style and are made module-level. Array list length variables are replaced with macros. * libguile/chars.c: variable declaration fixes 2009-08-01 Michael Gran <spk121@yahoo.com> Update NEWS for charname changes * NEWS: updated 2009-08-01 Daniel Kraft <d@domob.eu> Allow lexical binding of lambda arguments. * module/language/elisp/compile-tree-il.scm: Rework lambda compiler to allow opional lexical binding of (some) lambda arguments. * test-suite/tests/elisp-compiler.test: Check this. 2009-07-31 Daniel Kraft <d@domob.eu> Compiler option to always bind certain symbols lexically. Affects so far let-bound symbols, lambda arguments to come in the future. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Add :always-lexical option. * test-suite/tests/elisp-compiler.test: Test it. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-31 Ludovic Courtès <ludo@gnu.org> Add unused variable analysis in the tree-il->glil compiler. * module/language/tree-il/analyze.scm (<binding-info>): New record type. (report-unused-variables): New procedure. * module/language/tree-il/compile-glil.scm (%warning-passes): New variable. (compile-glil): Honor `#:warnings' from OPTS. * test-suite/tests/tree-il.test (call-with-warnings): New procedure. (%opts-w-unused): New variable. ("warnings"): New test prefix. 2009-07-31 Ludovic Courtès <ludo@gnu.org> Add `(system base message)', a simple warning framework. * module/Makefile.am (SOURCES): Add `system/base/message.scm'. * module/scripts/compile.scm (%options): Add `--warn'. (parse-args): Update default value for `warnings'. (show-warning-help): New procedure. (compile)[compile-opts]: Add `#:warnings'. Update help message. * module/system/base/compile.scm (compile): Sanity-check the requested warnings. * module/system/base/message.scm: New file. 2009-07-31 Ludovic Courtès <ludo@gnu.org> Add `tree-il-fold', a purely functional iterator on `tree-il'. * module/language/tree-il.scm (tree-il-fold): New procedure. * test-suite/tests/tree-il.test ("tree-il-fold"): New test prefix. 2009-07-30 Daniel Kraft <d@domob.eu> Use explicit guile-primitive forms in the macro expansion of dotimes and dolist. Implement some elisp constructs in macros instead of hard-coded compiler code. * module/language/elisp/compile-tree-il.scm: Remove implementation of prog1, and, or, cond, dolist. * module/language/elisp/runtime/macro-slot.scm: Implement them here instead. Switch use of guile-primitive to now available funcall in test. without-void-checks as new extension for fine-control * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Handle without-void-checks. * test-suite/tests/elisp-compiler.test: Test it. 2009-07-29 Daniel Kraft <d@domob.eu> funcall, apply and eval built-ins. * module/language/elisp/README: Document new features. * module/language/elisp/runtime/function-slot.scm: Implement funcall, apply and eval by using the existing compiler code. * test-suite/tests/elisp-compiler.test: Test those. 2009-07-29 Michael Gran <spk121@yahoo.com> Add 32-bit characters This adds the 32-bit standalone characters. Strings are still 8-bit. Characters larger than 8-bit can only be entered or displayed in octal format at this point. At this point, the terminal's display encoding is expected to be Latin-1. * module/language/assembly/compile-bytecode.scm (write-bytecode): add 32-bit char * module/language/assembly.scm (object->assembly): add 32-bit char (assembly->object): add 32-bit char * libguile/vm-i-system.c (make-char32): new op * libguile/print.c (iprin1): print 32-bit char * libguile/numbers.h: add type scm_t_wchar * libguile/numbers.c: add type scm_t_wchar * libguile/chars.h: new type scm_t_wchar (SCM_CODEPOINT_MAX): new (SCM_IS_UNICODE_CHAR): new (SCM_MAKE_CHAR): operate on 32-bit char * libguile/chars.c: comparison operators now use Unicode codepoints (scm_c_upcase): now receives and returns scm_t_wchar (scm_c_downcase): now receives and returns scm_t_wchar 2009-07-29 Daniel Kraft <d@domob.eu> Added guile-primitive construct for references to primitives from Elisp. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement guile-primitive. * test-suite/tests/elisp-compiler.test: Switched a usage of guile-ref to the now available guile-primitive. Added length built-in. * module/language/elisp/runtime/function-slot.scm: Add length built-in. * test-suite/tests/elisp-compiler.test: Test length. Implemented lexical-let and lexical-let* for elisp. * module/language/elisp/README: Document it. * module/language/elisp/bindings.scm: New fields in bindings data structure to keep track of lexical bindings for symbols. * module/language/elisp/compile-tree-il.scm: Implement lexical-let(*). * test-suite/tests/elisp-compiler.test: Test lexical scoping with lexical-let. 2009-07-28 Michael Gran <spk121@yahoo.com> Replace global charnames variables with accessors The global variables scm_charnames and scm_charnums are replaced with the accessor functions scm_i_charname and scm_i_charname_to_num. Also, the incomplete and broken EBCDIC support is removed. * libguile/print.c (iprin1): use new func scm_i_charname * libguile/read.c (scm_read_character): use new func scm_i_charname_to_num * libguile/chars.c (scm_i_charname): new function (scm_i_charname_to_char): new function (scm_charnames, scm_charnums): removed * libguile/chars.h: new declarations 2009-07-27 Daniel Kraft <d@domob.eu> In elisp-compiler.test, check that let* works without values given, too. 2009-07-26 Andy Wingo <wingo@pobox.com> increase range of relative jumps by aligning blocks to 8-byte boundaries * libguile/objcodes.c (OBJCODE_COOKIE): Bump again, as our jump offsets are now multiplied by 8. * libguile/vm-i-system.c (BR): Interpret the 16-bit offset as a relative jump to the nearest 8-byte-aligned block -- increasing relative jump range from +/-32K to +/-240K. (mvra): Do the same for the mvra jump. * libguile/vm.c (really_make_boot_program): Align the mvra. * module/language/assembly.scm (align-block): New export, for aligning blocks. * module/language/assembly/compile-bytecode.scm (write-bytecode): Emit jumps to the nearest 8-byte-aligned block. Effectively our range is 18 bits in either direction. I would like to do this differently -- have long-br and long-br-if, and all the other br instructions go to 8 bits only. But the assembler doesn't have an appropriate representation to allow me to do this yet, so for now this is what we have. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decode the 19-bit jumps. 2009-07-26 Andy Wingo <wingo@pobox.com> make sure all programs are 8-byte aligned * libguile/objcodes.c (OBJCODE_COOKIE): Bump objcode cookie, as we added to struct scm_objcode. * libguile/objcodes.h (struct scm_objcode): Add a uint32 after metalen and before base, so that if the structure has 8-byte alignment, base will have 8-byte alignment too. (Before, base was 12 bytes from the start of the structure, now it's 16 bytes.) * libguile/vm-engine.h (ASSERT_ALIGNED_PROCEDURE): Add a check that can be turned on with VM_ENABLE_PARANOID_ASSERTIONS. (CACHE_PROGRAM): Call ASSERT_ALIGNED_PROCEDURE. * libguile/vm-i-system.c (long-local-ref): Add a missing semicolon. * libguile/vm.c (really_make_boot_program): Rework to operate directly on a malloc'd buffer, so that the program will be 8-byte aligned. * module/language/assembly.scm (*program-header-len*): Add another 4 for the padding. (object->assembly): Fix case in which we would return (make-int8 0) instead of (make-int8:0). This would throw off compile-assembly.scm's use of addr+. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out the padding int. * module/language/assembly/decompile-bytecode.scm (decode-load-program): And pop off the padding int too. * module/language/glil/compile-assembly.scm (glil->assembly): Don't pack the assembly, assume that assembly.scm has done it for us. If a program has a meta, pad out the program so that meta will be aligned. * test-suite/tests/asm-to-bytecode.test: Adapt to expect programs to have the extra 4-byte padding int. 2009-07-26 Andy Wingo <wingo@pobox.com> fix alignment of subprograms of subprograms * module/language/glil/compile-assembly.scm (glil->assembly) (dump-object): Fix an exciting bug! Subprograms of subprograms were not being aligned correctly, because the code was generated too early. So instead delay dumping the object table until the proper time. fix unused SCM_FRAME_SET_DYNAMIC_LINK macro * libguile/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): Fix for new stack layout, though this macro is not used. fix vmstack gdb macro for new stack frame layout * gdbinit (vmstack): No more external link. 2009-07-24 Andy Wingo <wingo@pobox.com> check that jumps are within the range of a signed 16-bit int * module/language/assembly/compile-bytecode.scm (write-bytecode): Check that the offset is within the range of a signed int16 value. fix gensym creation in psyntax * module/ice-9/psyntax.scm (build-lexical-var): Make our gensyms really unique. Before, there was a chance that different lexicals could result in the same gensym. * module/ice-9/psyntax-pp.scm: Regenerate. increase default stack size to 64 kilowords * libguile/vm.c (VM_DEFAULT_STACK_SIZE): Increase to 64 kilowords. Really, we should simply add overflow handlers, but in the meantime, this will do. 2009-07-24 Daniel Kraft <d@domob.eu> Compiler option to disable void-checks in elisp. * module/language/elisp/README: Document the change. * module/language/elisp/compile-tree-il.scm: Add disable-void-check option. * test-suite/tests/elisp-compiler.test: Test it. 2009-07-24 Andy Wingo <wingo@pobox.com> compiler support for nlocs >= 256 * libguile/vm-i-system.c (long-local-ref, long-local-set) (make-variable): New intructions, for handling nlocs >= 256. * module/language/glil/compile-assembly.scm (glil->assembly): Compile <glil-lexical> with support for nlocs >= 256. 2009-07-24 Daniel Kraft <d@domob.eu> Don't pass the bindings-data all around in compile-tree-il, but use fluids for this dynamic binding. * module/language/elisp/compile-tree-il.scm: Use fluid for bindings-data. 2009-07-24 Andy Wingo <wingo@pobox.com> nlocs is now 16 bits wide * libguile/objcodes.h (struct scm_objcode): Remove the "unused" field -- the old "nexts" -- and expand nlocs to 16 bits. * module/language/assembly/compile-bytecode.scm (write-bytecode): Write the nlocs as a uint16. * module/language/assembly/decompile-bytecode.scm (decode-load-program): Decompile 16-bit nlocs. It seems this decompilation is little-endian :-/ * test-suite/tests/asm-to-bytecode.test: Fix up to understand nlocs as a little-endian value. The test does the right thing regarding endianness. 2009-07-24 Daniel Kraft <d@domob.eu> Implemented the flet and flet* extensions. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement flet and flet*. * test-suite/tests/elisp-compiler.test: Test flet and flet*. 2009-07-23 Andy Wingo <wingo@pobox.com> remove all mentions of "external" from the compiler and related code With this, GHIL is effectively bitrotten. I need to port the ECMAScript compiler to tree-il, then I'll remove it. * module/language/assembly.scm (byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): (disassemble-free-vars, code-annotation): * module/language/glil.scm (<glil-program>, <glil-local>) (<glil-exteral>, parse-glil, unparse-glil): * module/language/glil/compile-assembly.scm (make-meta): (compile-assembly, glil->assembly): * module/language/glil/decompile-assembly.scm (decompile-toplevel): (decompile-load-program): * module/language/objcode/spec.scm (decompile-value): * module/language/tree-il/compile-glil.scm (flatten-lambda): * module/system/vm/frame.scm (frame-binding-ref): (frame-binding-set!): * module/system/vm/program.scm (binding:boxed?): * module/system/vm/trace.scm (trace-next): * test-suite/tests/asm-to-bytecode.test ("compiler"): * test-suite/tests/tree-il.test: Remove all mentions of "external", and of <glil-local>. Docs updates will come soon. 2009-07-23 Andy Wingo <wingo@pobox.com> rename "closure-ref" to "free-ref"; s/vars/variables/ in some names * libguile/programs.h: * libguile/programs.c: (SCM_PROGRAM_FREE_VARIABLES): Rename from SCM_PROGRAM_FREE_VARS. Callers changed. * libguile/programs.c (scm_make_program): Rename arg to "free_variables". (scm_program_free_variables): Rename from program-free-vars. * libguile/vm-engine.h: * libguile/vm-engine.c (VM_CHECK_FREE_VARIABLES): Rename from VM_CHECK_CLOSURE. (vm_engine, CACHE_PROGRAM): Rename closure and closure_count to free_vars and free_vars_vount. * libguile/vm-i-system.c (FREE_VARIABLE_REF): Rename from CLOSURE_REF. (free-ref, free-boxed-ref, free-boxed-set): Rename from closure-ref, closure-boxed-ref, closure-boxed-set. (make-closure): Renamed from make-closure2. * module/language/glil/compile-assembly.scm (glil->assembly): Hack to never write out the the old "make-closure" instruction. Will fix better later. Change to emit free-ref etc instead of closure-ref. * module/language/tree-il/compile-glil.scm (flatten): Emit make-closure instead of make-closure2, now that the old make-closure is gone. * module/system/vm/program.scm (system): Rename program-free-vars to program-free-variables. * test-suite/tests/tree-il.test ("lambda"): Update for make-closure. 2009-07-23 Andy Wingo <wingo@pobox.com> remove "externals" from the vm * libguile/frames.c (scm_frame_external_link): Removed. * libguile/frames.h: No need to have the "external link" in the stack frame -- update macros to take the new situation into account. * libguile/objcodes.h (struct scm_objcode): Rename the nexts field to "unused". In the future we can use it for nlocs, I think. (SCM_OBJCODE_NEXTS): removed. * libguile/programs.h: * libguile/programs.c (scm_make_program): Expect the third argument to be a vector of free variables, not a list of free variables. SCM_BOOL_F indicates no free variables, not SCM_EOL. (program_mark): Adapt. (scm_program_arity): No more nexts. (scm_program_free_vars): Replaces scm_program_externals. * libguile/vm-engine.c (VM_CHECK_EXTERNAL) (vm_engine): No need for the "external" var. * libguile/vm-engine.h (CACHE_PROGRAM): Update for SCM_PROGRAM_FREE_VARS instead of SCM_PROGRAM_EXTERNALS. (NEW_FRAME): Update for new frame size, and no need to cons up externals. Yay :) * libguile/vm-i-loader.c (load-program): Update for scm_make_program. * libguile/vm-i-system.c (external-ref, external-set): No more. (make-closure): No more. (goto/args): No need to re-cons externals here. Update for new stack frame size. (mv-call, return, return/values): Update for new frame size. No need to reinstate externals on return. * libguile/vm.c (really_make_boot_program, scm_load_compiled_with_vm): Update for scm_make_program. * module/language/objcode/spec.scm (objcode-env-externals): Treat '() as #f, for the externals. Need to clean this up later... * module/system/vm/program.scm (arity:nexts): Remove. Rename program-external to program-free-vars. 2009-07-23 Andy Wingo <wingo@pobox.com> compile lexical variable access and closure creation to the new ops * module/language/glil.scm (<glil>): New GLIL type, <glil-lexical>, which will subsume other lexical types. * module/language/glil/compile-assembly.scm: Compile <glil-lexical>. (make-open-binding): Change the interpretation of the second argument -- instead of indicating an "external" var, it now indicates a boxed var. (open-binding): Adapt to new glil-bind format. * module/language/tree-il/analyze.scm: Add a lot more docs. (analyze-lexicals): Change the allocation algorithm and output format to allow the tree-il->glil compiler to capture free variables appropriately and to reference bound variables in boxes if necessary. Amply documented. * module/language/tree-il/compile-glil.scm (compile-glil): Compile lexical variable access to <glil-lexical>. Emit variable capture and closure creation code here, instead of leaving that task to the GLIL->assembly compiler. * test-suite/tests/tree-il.test: Update expected code emission. 2009-07-23 Daniel Kraft <d@domob.eu> Implemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...) * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function. * module/language/elisp/runtime.scm: Runtime functions to support dynamic value access. * module/language/elisp/runtime/function-slot.scm: Defined the built-ins. * test-suite/tests/elisp-compiler.test: Test them. 2009-07-22 Daniel Kraft <d@domob.eu> Added guile-ref extension construct, change throw implementation to easier one using a built-in function and implement unwind-protect. * module/language/elisp/README: Document the changes. * module/language/elisp/compile-tree-il.scm: Implement unwind-protect. * module/language/elisp/runtime/function-slot.scm: throw as built-in. * test-suite/tests/elisp-compiler.test: Test unwind-protect. Implemented catch and throw in elisp. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement catch and throw. * test-suite/tests/elisp-compiler.test: Test catch/throw. 2009-07-22 Andy Wingo <wingo@pobox.com> vm support for display closures * libguile/vm-i-system.c (box, empty-box): Boxing values and storing them in local variables. (local-boxed-ref, local-boxed-set): A combination of local-ref then variable-ref/set. (make-closure2, closure-ref, closure-boxed-ref, closure-boxed-set): New ops. The idea is to migrate Guile over to using flat dispay closures. See the paper "Three Implementation Models for Scheme" by Kent Dybvig for more details; this is the "stack-based" model. * libguile/vm-engine.c: * libguile/vm-engine.h: Add the necessary infrastructure to keep track of a "closure" variable, like our "externals" in semantics, but minimal, flat, and O(1) in implementation. 2009-07-21 Andy Wingo <wingo@pobox.com> renumber vm ops (objcode cookie bumped) * libguile/objcodes.c (OBJCODE_COOKIE): Bump. * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Renumber instructions, so I can have a bit more space to work. 2009-07-21 Daniel Kraft <d@domob.eu> Don't ensure fluids all over the place but scan for variables needed and ensure just before the compiled code all those. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement it here, pass bindings all around the compilation. * module/language/elisp/bindings.scm: New module with symbol-tracking abilities needed for this. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-20 Daniel Kraft <d@domob.eu> Implemented prog1, prog2, dotimes, dolist control structures. * module/language/elisp/README: Document it and some further ideas written down. * module/language/elisp/compile-tree-il.scm: Implement prog1, dolist. * module/language/elisp/runtime/macro-slot.scm: prog2 and dotimes. * test-suite/tests/elisp-compiler.test: Test prog1, prog2, dotimes, dolist. 2009-07-19 Andy Wingo <wingo@pobox.com> fix (bytevector-ieee-single-native-set! x 0 0) * libguile/bytevectors.c (VALIDATE_REAL): SCM_VALIDATE_REAL is not what we need for checking values for bytevector-ieee-single-native-set! et al, so define our own validator. (IEEE754_SET, IEEE754_NATIVE_SET): Use it. 2009-07-19 Andy Wingo <wingo@pobox.com> bytevectors have "element type" field, e.g. for generalized-vector-ref Bytevectors have a very close relationship to other forms of uniform vectors. Often you want to view a u64vector as a series of bytes, for writing over a socket; or to process an incoming stream using the convenient and less error-prone s16vector-ref API rather than bytevector-s16-native-ref. The essential needs of the representation of a bytevector and an s64vector are the same, so we take advantage of that and extend the bytevector implementation to have a "native type" field, which defaults to VU8. This commit doesn't actually expose any user-noticeable changes, however. * libguile/bytevectors.h (SCM_BYTEVECTOR_ELEMENT_TYPE): New internal defines. (scm_i_make_typed_bytevector, scm_c_take_typed_bytevector): New internal functions. * libguile/bytevectors.c (SCM_BYTEVECTOR_SET_ELEMENT_TYPE): (SCM_BYTEVECTOR_TYPE_SIZE): (SCM_BYTEVECTOR_TYPED_LENGTH): New internal macros. (make_bytevector, make_bytevector_from_buffer): Take an extra argument, the element type. The length argument is interpreted as being the number of elements, which corresponds to the number of bytes in the default VU8 case. Doing it this way eliminates a class of bugs -- e.g. a u32vector of length 3 bytes doesn't make sense. We do have to check for another class of bugs: overflow. The length stored on the bytevector itself is still the byte length, though. (scm_i_make_typed_bytevector): (scm_c_take_typed_bytevector): New internal functions. (scm_i_shrink_bytevector): Make sure the new size is valid for the bytevector's type. (scm_i_bytevector_generalized_set_x): Remove this function, the array-handle infrastructure takes care of this for us. (print_bytevector): Print the bytevector according to its type. (scm_make_bytevector, scm_bytevector_copy) (scm_uniform_array_to_bytevector) (scm_u8_list_to_bytevector, scm_bytevector_to_uint_list): Adapt to make_bytevector extra arg. (bv_handle_ref, bv_handle_set_x): Adapt to ref and set based on the type of the bytevector, e.g. f64 or u8. (bytevector_get_handle): Set the typed length of the vector, not the byte length. Conflicts: libguile/bytevectors.c 2009-07-19 Andy Wingo <wingo@pobox.com> bytevector inlinedness indicated by flag, not length * libguile/bytevectors.h (SCM_BYTEVECTOR_INLINE_P): Change to check a flag instead of checking the length of the bytevector. * libguile/bytevectors.c (make_bytevector_from_buffer): Handle the len <= inline threshold case as well. Set the inline flag as appropriate. (make_bytevector): Updat the inline flag as appropriate. (scm_c_take_bytevector): Just dispatch to make_bytevector_from_buffer. (scm_i_shrink_bytevector): Update the inline flag as appropriate. Update the length when shrinking an already-inlined vector. (STRING_TO_UTF): Fix some indentation. 2009-07-19 Andy Wingo <wingo@pobox.com> any->u8vector and family now implemented in Scheme * module/Makefile.am: * module/srfi/srfi-4/gnu.scm: New module, for extensions to srfi-4. Currently defines the any->FOOvector family. * libguile/srfi-4.c: * libguile/srfi-4.i.c: Dispatch scm_any_to_FOOvector calls to the scheme-implemented functions in (srfi srfi-4 gnu). 2009-07-19 Andy Wingo <wingo@pobox.com> make-typed-array builds backing vector via make-generalized-vector * libguile/arrays.c: Rework to use scm_make_generalized_vector instead of our own type table. * libguile/bitvectors.c: Fix some includes. 2009-07-19 Andy Wingo <wingo@pobox.com> add registry of vector constructors, make-generalized-vector * libguile/generalized-vectors.h: * libguile/generalized-vectors.c: Add a registry of vector constructors. (scm_make_generalized_vector): New public function, constructs a vector of a given type. * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/srfi-4.c: * libguile/strings.c: * libguile/vectors.c: Register vector constructors. * libguile/extensions.c (scm_init_extensions): No need to NULL the list of registered extensions here, the static init does it for us. Allows scm_c_register_extension to be called before scm_init_extensions. * libguile/init.c (scm_i_init_guile): Move array initialization earlier, so e.g. scm_init_strings has access to a valid list of array element types when registering its vector constructor. 2009-07-19 Andy Wingo <wingo@pobox.com> uniform vector functions to their own file * libguile/uniform.c: * libguile/uniform.h: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/Makefile.am: Move uniform vector funcs out of srfi-4 to their own file. * libguile.h: * libguile/arrays.c: * libguile/bytevectors.c: Update includers. 2009-07-19 Andy Wingo <wingo@pobox.com> generic vector ops to own file * libguile/Makefile.am: * libguile/vectors.c: * libguile/vectors.h: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: Move generic vector ops off into their own file too. The implementation is now based on the generic array-handle infrastructure. * libguile.h: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/random.c: * libguile/srfi-4.c: Update includers. 2009-07-19 Andy Wingo <wingo@pobox.com> move generic array foo out to its own file * libguile/arrays.h: * libguile/arrays.c: * libguile/generalized-arrays.h: * libguile/generalized-arrays.c: Move some generic functionality out of arrays.c to a new file. * libguile/array-map.c: * libguile/deprecated.c: * libguile/init.c: Update includers. 2009-07-19 Andy Wingo <wingo@pobox.com> remove enclosed arrays * libguile/arrays.h: * libguile/array-map.c: * libguile/arrays.c: * libguile/deprecated.c: Remove "enclosed arrays". The only user-facing procedures that this affects are scm_enclose_array / enclose-array. If enclosed arrays are added back, it should be through the generic array interface; but really, it sounds like something that would be better implemented in Scheme. 2009-07-19 Andy Wingo <wingo@pobox.com> add generic array implementation facility * libguile/array-handle.c (scm_i_register_array_implementation): (scm_i_array_implementation_for_obj): Add generic array facility, which will (in a few commits) detangle the array code. (scm_array_get_handle): Use the generic array facility. Note that scm_t_array_handle no longer has ref and set function pointers; instead it has a pointer to the array implementation. It is unlikely that code out there used these functions, however, as the supported way was through scm_array_handle_ref/set_x. (scm_array_handle_pos): Move this function here from arrays.c. (scm_array_handle_element_type): New function, returns a Scheme value representing the type of element stored in this array. * libguile/array-handle.h (scm_t_array_element_type): New enum, for generically determining the type of an array. (scm_array_handle_rank): (scm_array_handle_dims): These are now just #defines. * libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/srfi-4.c: * libguile/strings.c: * libguile/vectors.c: Register array implementations for all of these. * libguile/inline.h: Update for array_handle_ref/set change. * libguile/deprecated.h: Need to include arrays.h now. 2009-07-19 Andy Wingo <wingo@pobox.com> rename unif.[ch] to arrays.[ch] * libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/arrays.c: * libguile/arrays.h: Rename unif.[ch] to arrays.[ch]. * libguile.h: * libguile/array-handle.c: * libguile/array-map.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/eq.c: * libguile/gc-card.c: * libguile/gc-malloc.c: * libguile/gc-mark.c: * libguile/gc.c: * libguile/init.c: * libguile/inline.h: * libguile/print.c: * libguile/random.c: * libguile/read.c: * libguile/socket.c: * libguile/sort.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/strports.c: * libguile/vectors.c: * libguile/vectors.h: Update includers. 2009-07-19 Andy Wingo <wingo@pobox.com> bitvector exodus from unif.[ch] * libguile/Makefile.am: * libguile/unif.c: * libguile/unif.h: * libguile/bitvectors.c: * libguile/bitvectors.h: Move bitvector functionality out of unif.[ch]. * libguile/array-handle.c: * libguile/array-map.c: * libguile/init.c: * libguile/read.c: * libguile/srfi-4.c: * libguile/vectors.c: Oh, what a tangled web we weave... 2009-07-19 Andy Wingo <wingo@pobox.com> parts of unif.[ch] to array-handle.[ch] * libguile/array-handle.c: * libguile/array-handle.h: Move some parts of unif.c and unif.h to these new files. * libguile/unif.c: * libguile/unif.h: Update includers. Since unif.h depends on the array handle type, we include array-handle.h, which also means that there will be no difference for our callers. * libguile/init.c: Call scm_init_array_handle, though it does nothing as of yet. * libguile/Makefile.am: Adapt for new files. 2009-07-19 Andy Wingo <wingo@pobox.com> rename ramap.[ch] to array-map.[ch] * libguile/array-map.c: * libguile/array-map.h: Rename from ramap.c and ramap.h. * libguile.h: * libguile/Makefile.am: * libguile/eq.c: * libguile/init.c: * libguile/sort.c: * libguile/unif.c: * libguile/vectors.c: All referrers changed. 2009-07-19 Andy Wingo <wingo@pobox.com> rename scm_i_make_ra to scm_i_make_array * libguile/unif.c (scm_i_make_array): Rename from scm_i_make_ra. All callers changed. clean up libguile/Makefile.am * libguile/Makefile.am: Clean up some of the file lists, should make future diffs easier to parse. remove convert.{c,i.c,h} * libguile/convert.c: * libguile/convert.h: * libguile/convert.i.c: Remove these functions, which were undocumented, not in the libguile/ header, and thus unlikely to have been used. 2009-07-19 Andy Wingo <wingo@pobox.com> remove deprecated functions from unif.c * libguile/unif.h: * libguile/unif.c: Remove deprecated functions. * module/ice-9/deprecated.scm: Remove array-related deprecated functions. * NEWS: Update. 2009-07-18 Daniel Kraft <d@domob.eu> Implemented some important list built-ins. * module/language/elisp/runtime.scm: Updated/added convenience macros. * module/language/elisp/runtime/function-slot.scm: Implement list built-ins. * module/language/elisp/runtime/macro-slot.scm: Implement list built-ins. * test-suite/tests/elisp-compiler.test: Test the implemented built-ins. Implemented unless, when and dotimes using built-in macros. * module/language/elisp/README: Document that. * module/language/elisp/runtime.scm: Defined built-in-macro macro. * module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes. * test-suite/tests/elisp-compiler.test: Test for those constructs. Return correct value for setq form. * module/language/elisp/compile-tree-il.scm: Fix implementation of setq. * test-suite/tests/elisp-compiler.test: Check for value of setq form. Implemented real quotation (added support for backquotation). * module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Implement backquote. * test-suite/tests/elisp-compiler.test: Test quotation and backquotes. Implemented eq and equal built-in predicates. * module/language/elisp/runtime/function-slot.scm: Implement eq and equal. * test-suite/tests/elisp-compiler.test: Test them. 2009-07-16 Daniel Kraft <d@domob.eu> Implemented macros in elisp compiler. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement defmacro and expansion. * module/language/elisp/runtime/macro-slot.scm: New module to keep definitions. * test-suite/Makefile.am: Add elisp-compiler.test to list of tests. * test-suite/tests/elisp-compiler.test: Basic macro tests. Extended test-suite to cover already implemented built-ins and fixed errors found. * module/language/elisp/runtime/function-slot.scm: Fixed errors in number preds. * test-suite/tests/elisp-compiler.test: Test built-ins already implemented. 2009-07-15 Ludovic Courtès <ludo@gnu.org> Bump version number for 1.9.1. * GUILE-VERSION (GUILE_MICRO_VERSION): Increment. Make the non-integrated VM test-suite less verbose. * testsuite/run-vm-tests.scm (run-vm-tests): Don't display the number of tests passed since it's always 1 or 0. 2009-07-15 Ludovic Courtès <ludo@gnu.org> Add FIXMEs about misaligned objcode-metas. * libguile/objcodes.c (scm_c_make_objcode_slice): Add comment about misaligned `objcode-meta'. * module/language/assembly/compile-bytecode.scm (write-bytecode): Likewise. 2009-07-15 Ludovic Courtès <ludo@gnu.org> Fix unaligned access in the VM code. * libguile/vm.c (struct t_32bit_aligned): New. (really_make_boot_program)[bytes]: Use it. This fixes possibly unaligned accesses, which cause a "bus error" on some platforms (e.g., sparc-*). 2009-07-15 Ludovic Courtès <ludo@gnu.org> Const-qualify buffers passed to `scm_c_make_objcode_slice ()'. * libguile/objcodes.c (scm_c_make_objcode_slice): Add `const' qualifier for PTR and DATA. * libguile/objcodes.h: Update accordingly. 2009-07-15 Ludovic Courtès <ludo@gnu.org> Switch remaining GPLv2+ Guile-VM headers to LGPLv3+. * module/system/base/compile.scm, module/system/base/syntax.scm, module/system/repl/common.scm, module/system/repl/describe.scm, module/system/vm/instruction.scm, module/system/vm/objcode.scm, module/system/vm/profile.scm, module/system/vm/program.scm, module/system/vm/trace.scm: Switch header from GPLv2+ to LGPLv3+. 2009-07-15 Daniel Kraft <d@domob.eu> Test-suite for elisp compiler so far, excluding the built-ins. * test-suite/tests/elisp-compiler.test: Tests for compiler so far. Removed wrong not in zerop built-in. * module/language/elisp/runtime/function-slot.scm: Fix zerop. 2009-07-15 Ludovic Courtès <ludo@gnu.org> Fix typo in the compile-type verification of `OBJCODE_COOKIE'. * libguile/objcodes.c: Fix `sizeof (OBJCODE_COOKIE)' assertion: the trailing 0 must not be taken into account, and multiple of 8 means the 3 LSBs are clear. Make sure at compile-time that `OBJCODE_COOKIE' has the right size. * libguile/objcodes.c: Use `verify' to assert that the size of `OBJCODE_COOKIE' is a multiple of 8. Explicitly use Gnulib's `verify' module. * m4/gnulib-cache.m4: Add `verify'. Augment `OBJCODE_COOKIE' to detect wrong endianness or word size. * libguile/objcodes.c (OBJCODE_ENDIANNESS, _OBJCODE_STRINGIFY, OBJCODE_STRINGIFY, OBJCODE_WORD_SIZE): New macros. (OBJCODE_COOKIE): Use them. The intent is that `.go' files compiled for a different endianness or word size are detected. Remove the `long_long' and `ulong_long' types. * libguile/gen-scmconfig.c (main): Don't emit typedefs for `long_long' and `ulong_long'. This was already deprecated in 1.8 and known to cause conflicts with other libraries such as HDF5, as reported by Mark Patterson <mpatterson@physics.queensu.ca> (http://lists.gnu.org/archive/html/bug-guile/2009-02/msg00003.html). 2009-07-14 Andy Wingo <wingo@pobox.com> update NEWS * NEWS: Update. NEWS has info on 1.9.N to 1.9.N+1 in addition to 1.8 to 2.0 * NEWS: Update to have an incremental section in addition to a comprehensive 1.8->2.0 section. fix race in which some instruction name symbols could go unmarked * libguile/instructions.c: In loops, replace scm_op_last with SCM_VM_NUM_INSTRUCTIONS. (fetch_instruction_table): Protect the instruction symbols from collection. Before they were only marked by the name->opcode hash table, leading to races in which they could be collected. (scm_lookup_instruction_by_name): Protect the hash table earlier, as it's not actually a stack variable, since it's static. fix bounds checks for the last element of bv-*-{ref,set} * libguile/vm-i-scheme.c (BV_FIXABLE_INT_REF, BV_INT_REF): (BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Fix the bounds check for the last element. 2009-07-14 Daniel Kraft <d@domob.eu> Implemented defconst, defvar, defun special forms for elisp. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement defconst/defvar/defun. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-14 Ludovic Courtès <ludo@gnu.org> Remove potential "uninitialized variable" GCC warnings. * libguile/vm-i-scheme.c (vector_ref, vector_set, BV_FIXABLE_INT_REF, BV_INT_REF, BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Explicitly initialize all locals, to make some versions of GCC happier. Patch by Dale P. Smith <dsmich@roadrunner.com>. Fix tests that assumed little endian. * test-suite/tests/asm-to-bytecode.test (u32->u8-list): New procedure. ("compiler")[(load-program 3 2 1 0 () 3 #f (make-int8 3) (return)), (load-program 3 2 1 0 () 3 (load-program 3 2 1 0 ...))]: Make these tests work on hosts whose endianness is not little endian. 2009-07-13 Daniel Kraft <d@domob.eu> Some bug fixes on the way and mainly implemented some built-ins (arithmetic). * module/language/elisp/README: Document changes. * module/language/elisp/compile-tree-il.scm: Bug fixes to fluid-creation. * module/language/elisp/runtime.scm: Some helping definitions for built-ins. * module/language/elisp/runtime/function-slot.scm: Defined artihmetic built-ins. Automatically create fluids when necessary. * module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Create fluids when necessary. * module/language/elisp/runtime/function-slot.scm: Fix module name. Fixed lambda expressions and implemented function calls using the basic list notation. * module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Implement function calls. Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp Lambda expressions in elisp, but not yet function calls. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement lambda expressions. 2009-07-07 Daniel Kraft <d@domob.eu> Implemented let and let* in elisp. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement let and let*. Implemented while construct in elisp. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement while construct. 2009-07-05 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `vsnprintf' module. * m4/gnulib-cache.m4: Use `vsnprintf', needed by `deprecation.c'. Update `NEWS'. * NEWS: Update. Enclose `bit-operations.test' in its own module. * test-suite/tests/bit-operations.test: Use the `define-module' clause. Fix the `BUILD_PTHREAD_SUPPORT' Automake conditional when not using pthread. * configure.in: Set $build_pthread_support to "no" when thread support isn't built. This fixes the `BUILD_PTHREAD_SUPPORT' Automake conditional. 2009-07-04 Daniel Kraft <d@domob.eu> Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-07-03 Daniel Kraft <d@domob.eu> Implemented fluid-based variable references and setting using setq. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement variable references, setq * module/language/elisp/runtime.scm: New file for runtime definitions. * module/language/elisp/runtime/function-slot.scm: Ditto. * module/language/elisp/runtime/value-slot.scm: Ditto. 2009-07-02 Andy Wingo <wingo@pobox.com> fix error message for bad objcode cookie * libguile/objcodes.c: Whoop-dee :) 2009-07-02 Daniel Kraft <d@domob.eu> Implemented elisp's or form. * module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement or. For elisp's (cond ...) and (condition) forms without body, return the condition as value. * compile-tree-il.scm: Fix compilation of (cond ...) for bodyless conditions. 2009-07-01 Neil Jerram <neil@ossau.uklinux.net> Read complex numbers where both parts are inexact decimals Thanks to Bill Schottstaedt for reporting this problem! * libguile/numbers.c (mem2ureal): Don't be misled by *p_exactness being INEXACT on entry (as is possible when reading a complex number): use local exactness variable x which starts as EXACT. Call mem2decimal_from_point () with &x instead of p_exactness. * test-suite/tests/numbers.test ("string->number"): Add complex number tests suggested by Bill. 2009-07-01 Neil Jerram <neil@ossau.uklinux.net> Correction to doc on Accessing Arrays from C Thanks to Ludovic for the new wording! * doc/ref/api-compound.texi (Accessing Arrays from C): Correct text to reflect the current implementation of scm_array_get_handle and scm_array_handle_release - which don't actuall do any dynwind stuff. 2009-06-29 Daniel Kraft <d@domob.eu> Added make-nil instruction to VM and use it for Emacs' nil in the compiler. * doc/ref/vm.texi: Document new instruction. * libguile/vm-i-system.c: Add it to the VM. * module/language/assembly.scm: Compile (const %nil) to (make-nil) assembly. * module/language/glil/decompile-assembly.scm: Handle (make-nil) * module/language/elisp/compile-tree-il.scm: Use (const %nil) for nil. 2009-06-28 Ludovic Courtès <ludo@gnu.org> Remove seek/truncate shortcuts to file ports. Suggested by Neil. * libguile/fports.c (fport_seek_or_seek64): Rename to `fport_seek ()'. (fport_seek, scm_i_fport_seek, scm_i_fport_truncate): Remove. * libguile/fports.h (scm_i_fport_seek, scm_i_fport_truncate): Remove declarations. * libguile/ports.c (scm_seek): Remove shortcut that would call out to `scm_i_fport_seek ()'. (scm_truncate_file): Likewise. 2009-06-27 Daniel Kraft <d@domob.eu> Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp 2009-06-26 Andy Wingo <wingo@pobox.com> bytevector ops now compile down to low-level VM ops * libguile/instructions.c (scm_instruction_list): Fix a longstanding bug in this humble function. * libguile/vm-i-scheme.c (BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Fix some bugs in these macros -- now the bytevector ops work. * module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile bytevector calls to VM ops. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Resolve bytevector calls to primitive calls. 2009-06-26 Andy Wingo <wingo@pobox.com> run bytevectors tests under the compiler and evaluator * test-suite/tests/bytevectors.test: Run a number of tests under the compiler/vm and the evaluator. 2009-06-26 Andy Wingo <wingo@pobox.com> vector-ref and vector-set! now have opcodes * module/language/tree-il/primitives.scm (*interesting-primitive-names*): Resolve vector-ref and vector-set!. * module/language/tree-il/compile-glil.scm (*primcall-ops*): And compile vector-ref and vector-set! to their opcodes. * libguile/vm-i-scheme.c (vector-ref, vector-set): New opcodes, placed before the bytevector ops. The renumbering shouldn't affect anyone, given that the bytevector ops were not yet used. Fix a few bugs in the bytevector ops. 2009-06-26 Andy Wingo <wingo@pobox.com> add bytevector ops to the vm * libguile/instructions.h (SCM_VM_NUM_INSTRUCTIONS): Enlarge to 255. Not sure what performance effects this will have. * libguile/vm-engine.c: Add new error case, vm_error_not_a_bytevector. * libguile/vm-engine.h: Don't assign specific registers for i386. Having added the new VM vector ops, GCC 4.4 is erroring for me now. * libguile/vm-i-scheme.c: Add bytevector-specific ops to the VM. We don't actually use them yet, though. 2009-06-26 Andy Wingo <wingo@pobox.com> bytevectors provide scm_i_native_endianness to the vm * libguile/bytevectors.h (scm_i_native_endianness): Allow the VM to use scm_i_native_endianness, but still keep it marked as internal. * libguile/bytevectors.c: Adjust to use scm_i_native_endianness instead of native_endianness. Define it at bootstrap time. 2009-06-26 Andy Wingo <wingo@pobox.com> minor doc tweaks * doc/ref/api-compound.texi: Generalized vector doc fixups. * doc/ref/api-data.texi: Minor fixes to bytevector docs. 2009-06-26 Neil Jerram <neil@ossau.uklinux.net> Revert "* FAQ: New file." This reverts commit d53f85dd859fa69af8a0b67482774d2a88aaf407. It was a confusing mistake to create an FAQ file in the Guile repository/distribution, because there was already an FAQ page on the Guile web site. The information that was in the FAQ file is now in the FAQ web page. 2009-06-25 Ludovic Courtès <ludo@gnu.org> Add `scm_t_off' type so that `scm_t_port' has a fixed layout. * libguile/gen-scmconfig.c (main): Produce a definition for `scm_t_off'. * libguile/ports.h (scm_t_port)[read_buf_size, saved_read_buf_size, write_buf_size, seek, truncate]: Use `scm_t_off' instead of `off_t' so that the layout and size of the structure does not depend on the application's `_FILE_OFFSET_BITS' value. Reported by Bill Schottstaedt, see http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html. (scm_set_port_seek, scm_set_port_truncate): Update. * libguile/ports.c (scm_set_port_seek, scm_set_port_truncate): Use `scm_t_off' and `off_t_or_off64_t'. * libguile/fports.c (fport_seek, fport_truncate): Use `scm_t_off' instead of `off_t'. * libguile/r6rs-ports.c (bip_seek, cbp_seek, bop_seek): Use `scm_t_off' instead of `off_t'. * libguile/rw.c (scm_write_string_partial): Likewise. * libguile/strports.c (st_resize_port, st_seek, st_truncate): Likewise. * doc/ref/api-io.texi (Port Implementation): Update prototype of `scm_set_port_seek ()' and `scm_set_port_truncate ()'. * NEWS: Update. 2009-06-25 Ludovic Courtès <ludo@gnu.org> Fix `load-objcode' FD/mapping leak occurring upon failure. * libguile/objcodes.c (make_objcode_by_mmap): Close FD and unmap ADDR upon failure. 2009-06-24 Andy Wingo <wingo@pobox.com> allow primcall ops to push 0 values * libguile/objcodes.c (OBJCODE_COOKIE): Bump the objcode cookie. We'll be doing this on incompatible changes until 2.0. * libguile/vm-i-scheme.c (set_car, set_cdr, slot_set): These instructions don't have natural return values -- so declare them that way, that they push 0 values. * module/language/tree-il/compile-glil.scm (flatten): When compiling primitive calls, check `(instruction-pushes op)' to see how many values that instruction will push, and do something appropriate, instead of just assuming that all primcall ops push 1 value. 2009-06-24 Andy Wingo <wingo@pobox.com> remove lambda wrap hack of brainfuck tree-il compiler * module/language/brainfuck/compile-tree-il.scm (compile-tree-il): Remove the hack where we wrapped the compiled code in a `lambda', because not only should the tree-il compiler optimize that away, it was really papering around other inefficiencies, and obtuse to boot. 2009-06-24 Neil Jerram <neil@ossau.uklinux.net> Remove AC_SYS_RESTARTABLE_SYSCALLS and related code As the Autoconf documentation says, "These days portable programs [...] should not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays whether a system call is restartable is a dynamic issue, not a configuration-time issue." In other words, if we ever rely on HAVE_RESTARTABLE_SYSCALLS, we are at the mercy of any code that Guile happens to be linked with, because that code could install a signal handler without the SA_RESTART flag, and then a Guile system call could unexpectedly return EINTR. The readline part of this goes back to this problem report: http://sources.redhat.com/ml/guile/2000-05/msg00177.html; and is an excellent example of the above paragraph. It was noted during the discussion that undefining HAVE_RESTARTABLE_SYSCALLS would fix the problem, but that solution wasn't adopted - I guess because Guile was still using cooperative threads then (not pthreads) and so there was a significant concern (whether founded or not) that not using restartable syscalls (where available) could lead to a loss of performance. Now Guile's default mode of operation is with pthreads, where we already don't assume that HAVE_RESTARTABLE_SYSCALLS is reliable, so there is no possible further performance loss. And in any case we really have no choice, if we want correct operation. Thanks to Sylvain Beucler for reporting this and suggesting the fix. * configure.in (AC_SYS_RESTARTABLE_SYSCALLS): Removed. * doc/ref/posix.texi (Signals): Remove statement that Guile always sets SA_RESTART flag. * guile-readline/configure.in (GUILE_SIGWINCH_SA_RESTART_CLEARED): Remove this setting, together with its test code. (HAVE_RL_PRE_INPUT_HOOK): Remove this setting and its code, as no longer needed. * guile-readline/readline.c (sigwinch_enable_restart): Removed. (scm_init_readline): Remove setting of rl_pre_input_hook. * libguile/_scm.h (SCM_SYSCALL): Remove the definition that relies on HAVE_RESTARTABLE_SYSCALLS. * libguile/scmsigs.c (scm_sigaction_for_thread): Don't always set the SA_RESTART flag if available. Update docstring accordingly. (scm_init_scmsigs): Remove code that sets SA_RESTART flag for all signals. * THANKS: Add Sylvain. 2009-06-22 Andy Wingo <wingo@pobox.com> flush whitespace from the repl input buffer *before* evaluation * module/system/repl/repl.scm (start-repl): Given that the input port of the repl is line-buffered, it's likely we have #\newline in the input that is strictly extraneous, an in-band indicator to the repl that it should begin reading now. So flush out that newline, so that you can (read-char) at the repl, and it actually does wait for you to type in a char instead of just returning #\newline. While it's not an overriding concern, this does fix some brainfuck programs that want to input from the user. 2009-06-22 Andy Wingo <wingo@pobox.com> more docs to brainfuck->tree-il compiler * module/language/brainfuck/compile-tree-il.scm (compile-tree-il): Wrap the result in a ((lambda () ...)), so we can use toplevel-ref. Add lots more comments. 2009-06-22 Andy Wingo <wingo@pobox.com> meta-commands read off their own arguments * module/system/repl/command.scm: Update copyright. (meta-command): Rework so that it's the various meta-commands that do the reading for their arguments. This way you can compile forms that span more than one line, and forms that need to be read with another language's reader. (define-meta-command): New helper macro. Update commands to use it. (help): Allow ,help on commands too. * module/system/repl/repl.scm: Update copyright. (start-repl): Adjust to give meta-command what it wants. 2009-06-22 Ludovic Courtès <ludo@gnu.org> Always create the bytevector SMOB type. * libguile/bytevectors.c (scm_tc16_bytevector, print_bytevector, bytevector_equal_p, free_bytevector): Don't use the snarfing macros. (scm_bootstrap_bytevectors): New. (scm_init_bytevectors): No longer initialize SCM_NULL_BYTEVECTOR, which is done by `scm_bootstrap_bytevectors ()'. * libguile/bytevectors.h (scm_bootstrap_bytevectors): New declaration. (scm_init_bytevectors): Made internal. This can be done because we explicitly register it with `scm_c_register_extension ()' in `scm_bootstrap_bytevectors ()'. * libguile/init.c (scm_i_init_guile): Call `scm_bootstrap_bytevectors ()'. This is so that expressions like "(generalized-vector-length #vu8())" work even when `(rnrs bytevector)' hasn't been loaded. 2009-06-22 Ludovic Courtès <ludo@gnu.org> Make bytevectors accessible using the generalized-vector API. As a side effect, this allows compilation of literal bytevectors ("#vu8(...)"), which gets done by the generic array handling of the GLIL->assembly compiler. * doc/ref/api-compound.texi (Generalized Vectors): Mention bytevectors. (Arrays, Array Syntax): Likewise. * doc/ref/api-data.texi (Bytevectors as Generalized Vectors): New node. * libguile/bytevectors.c (scm_i_bytevector_generalized_set_x): New. * libguile/bytevectors.h (scm_i_bytevector_generalized_set_x): New declaration. * libguile/srfi-4.c (scm_i_generalized_vector_type, scm_array_handle_uniform_element_size, scm_array_handle_uniform_writable_elements): Add support for bytevectors. * libguile/unif.c (type_creator_table): Add `vu8'. (bytevector_ref, bytevector_set): New functions. (memoize_ref, memoize_set): Add support for bytevectors. * libguile/vectors.c (scm_is_generalized_vector, scm_c_generalized_vector_length, scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x): Add support for bytevectors. * test-suite/tests/bytevectors.test ("Generalized Vectors"): New test set. 2009-06-22 Ludovic Courtès <ludo@gnu.org> bytevectors: Add a C-friendly API. * doc/ref/api-data.texi (Bytevector Manipulation): Add `scm_is_bytevector ()', `scm_c_bytevector_length ()', `scm_c_bytevector_length ()', and `scm_c_bytevector_set_x ()'. * libguile/bytevectors.c (scm_is_bytevector, scm_c_bytevector_length, scm_c_bytevector_ref, scm_c_bytevector_set_x): New functions. (scm_bytevector_p): Use `scm_is_bytevector ()'. (scm_bytevector_length): Use `scm_c_bytevector_length ()'. * libguile/bytevectors.h (scm_is_bytevector, scm_c_bytevector_length, scm_c_bytevector_ref, scm_c_bytevector_set_x): New declarations. 2009-06-22 Ludovic Courtès <ludo@gnu.org> bytevectors: Use `size_t' rather than `unsigned' for sizes. * doc/ref/api-data.texi (Bytevector Manipulation): Update. * libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE, make_bytevector_from_buffer, scm_c_make_bytevector, scm_c_take_bytevector, scm_i_shrink_bytevector): Use `size_t' for bytevector lengths. 2009-06-22 Ludovic Courtès <ludo@gnu.org> Fix documentation of `make-bytevector'. * doc/ref/api-data.texi (Bytevector Manipulation): Fix documentation of the FILL argument of `make-bytevector'. 2009-06-21 Andy Wingo <wingo@pobox.com> add brainfuck->tree-il compiler * module/Makefile.am (BRAINFUCK_LANG_SOURCES): Compile at the end. Add compile-tree-il.scm. * module/language/brainfuck/compile-tree-il.scm: New compiler, compiles to tree-il instead of scheme. I thought it would be more illustrative, though there are some uncommented bits. * module/language/brainfuck/parse.scm: Modify not to put a header on the scheme representation. After all, we don't put <scheme> before scheme code, do we? :) * module/language/brainfuck/spec.scm: Add tree-il compiler. * module/language/tree-il.scm: Understand (set! (lexical foo) ...). * module/system/base/language.scm: Update license. Actually, updates licenses on all these. 2009-06-21 Andy Wingo <wingo@pobox.com> formatting changes to (language brainfuck compile-scheme) * module/language/brainfuck/compile-scheme.scm: Standalone comments should have more than one semicolon, and update copyright to LGPLv3+. link to brainfuck wikipedia page * doc/ref/compiler.texi: Point to more info on Brainfuck. Patch by Daniel Kraft. 2009-06-21 Daniel Kraft <d@domob.eu> added documenting comments to the brainfuck compiler and mention it in the VM documentation. * doc/ref/compiler.texi: Mention the new brainfuck compiler as an example. * module/language/brainfuck/compile-scheme.scm: Add a lot of documentation comments. * module/language/brainfuck/parse.scm: Ditto. * module/language/brainfuck/spec.scm: Ditto. basic brainfuck -> scheme example compiler. * module/Makefile.am: Install the brainfuck compiler modules. * module/language/brainfuck/spec.scm: New file. * module/language/brainfuck/parse.scm: New file. * module/language/brainfuck/compile-scheme.scm: New file. 2009-06-21 Andy Wingo <wingo@pobox.com> remove obsolete guile-vm.texi * doc/guile-vm.texi: Remove, has been folded into the Guile manual for a while now. * doc/Makefile.am: Remove guile-vm.texi. 2009-06-21 Andy Wingo <wingo@pobox.com> update .gitignore * .gitignore: Update. 2009-06-21 Neil Jerram <neil@ossau.uklinux.net> Deterministic test for the r6rs-ports.test segmentation fault * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Add (gc), to test the (ex-)bug in cbp_mark () when marking a closed port. 2009-06-21 Andy Wingo <wingo@pobox.com> Fix crash when marking closed custom bytevector port * libguile/r6rs-ports.c (cbp_mark): A closed port will have had its stream destroyed, so don't dereference the stream in that case. Patch by Mike Gran. 2009-06-20 Andy Wingo <wingo@pobox.com> put autocompiled files into ~/.cache or $XDG_CACHE_HOME * module/system/base/compile.scm (compiled-file-name): Remove unneeded path separator. * libguile/load.c (scm_init_load_path): Change so the default cache path is ~/.cache/guile/ccache/1.9, and respect $XDG_CACHE_HOME. 2009-06-20 Andy Wingo <wingo@pobox.com> fix source information lossage for (define (foo) ...) lambda sugar * module/ice-9/psyntax.scm (source-wrap): Use decorate-source, for clarity. (syntax-type): When turning the RHS of (define (foo) ...) into a lambda, decorate the resulting lambda expression with source information, as the RHS later goes to chi-expr, which receives no source information. Perhaps that is a bug. In any case, fixes some source location lossage, reported by Jao. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-06-20 Andy Wingo <wingo@pobox.com> better error in make_objcode_by_mmap * libguile/objcodes.c (make_objcode_by_mmap): Better error when the object header is incorrect. 2009-06-20 Andy Wingo <wingo@pobox.com> source information for the interpreter * module/ice-9/psyntax.scm: Try to propagate source information when generating output for the interpreter. * module/ice-9/psyntax-pp.scm: Regenerate. 2009-06-19 Ludovic Courtès <ludo@gnu.org> Make `cond-expand' compilable. * module/ice-9/boot-9.scm (cond-expand): Changed into a `define-macro' macro. Fix copyright year and authorship of `guile-tools'. Slightly improve `NEWS'. Fix "guile-tools disassemble". * module/scripts/disassemble.scm (disassemble): Accept a variable number of arguments. Invoke the right `disassemble' procedure. 2009-06-19 Andy Wingo <wingo@pobox.com> don't autocompile at installcheck * examples/Makefile.am: Don't autocompile our tests at installcheck time. 2009-06-19 Andy Wingo <wingo@pobox.com> new function: canonicalize-path. use when autocompiling * libguile/filesys.h: * libguile/filesys.c (scm_canonicalize_path): New function, canonicalize-path. * module/system/base/compile.scm (compiled-file-name): Canonicalize the filename so that compiling e.g. ../foo.scm doesn't compile to ~/.guile-ccache/1.9/../foo.scm. 2009-06-19 Andy Wingo <wingo@pobox.com> gnulib-tool --import canonicalize-lgpl 2009-06-19 Andy Wingo <wingo@pobox.com> generate changelogs at dist time * Makefile.am: Add rule to make a ChangeLog at dist-time. The rule comes from coreutils. * build-aux/gitlog-to-changelog: New helper script, from gnulib. 2009-06-19 Andy Wingo <wingo@pobox.com> rename SCM_SNAME to SCM_SUBR_NAME * libguile/procs.h: Rename SCM_SNAME to SCM_SUBR_NAME. * libguile/debug.c: * libguile/eval.c: * libguile/eval.i.c: * libguile/goops.c: * libguile/gsubr.c: * libguile/print.c: * libguile/procs.c: Update callers. 2009-06-19 Andy Wingo <wingo@pobox.com> another draft of NEWS * NEWS: Another draft. 2009-06-19 Ludovic Courtès <ludo@gnu.org> Fix decompilation of the `load-array' instruction. This allows, e.g., ",c #u8(1 2 3)" at the REPL to actually work instead of failing to decode `load-array'. * module/language/assembly/decompile-bytecode.scm (decode-bytecode): Account for the `load-array' instruction, which is followed by a bytevector instead of a string. We should find a more elegant way to do that. 2009-06-19 Ludovic Courtès <ludo@gnu.org> Fix the REPL's `,compile' command. * module/system/repl/command.scm (compile): Use `guile:disassemble' instead of the former `disassemble-objcode'. 2009-06-19 Ludovic Courtès <ludo@gnu.org> Implement R6RS bytevector read syntax. * libguile/read.c (scm_read_bytevector): New function. (scm_read_sharp): Add `v' case for bytevectors. * test-suite/lib.scm (exception:read-error): New variable. * test-suite/tests/bytevectors.test ("Datum Syntax"): New test set. 2009-06-19 Ludovic Courtès <ludo@gnu.org> Fix `equal?' on bytevectors. * libguile/bytevectors.c (bytevector_equal_p): New function. * test-suite/tests/bytevectors.test ("2.3 Operations on Bytes and Octets")["equal?"]: New test. 2009-06-18 Ludovic Courtès <ludo@gnu.org> Import documentation for the R6RS bytevector and port APIs. * doc/ref/api-compound.texi (Uniform Numeric Vectors): Add xref to the bytevector API. * doc/ref/api-data.texi (Bytevectors): New node. * doc/ref/api-io.texi (R6RS I/O Ports): New node. 2009-06-18 Andy Wingo <wingo@pobox.com> update NEWS, THANKS * NEWS: Update, but only partially. I wanted to push out this incomplete, not yet organized draft for review, if anyone had comments. I'll pick it up tomorrow morning. * THANKS: Add Juhani, whose last name changed? 2009-06-17 Neil Jerram <neil@ossau.uklinux.net> Change guile-readline license to GPLv3+ Complete changing license to LGPLv3+ (Still guile-readline to do, but that will all be GPLv3+.) Reinstate lines removed by mistake from chars.test Change Guile license to LGPLv3+ (Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* ) 2009-06-14 Neil Jerram <neil@ossau.uklinux.net> Update README on using libraries in non-standard locations * README: Update instructions on using libraries in non-standard locations. Also change expected next stable release number from 1.10.0 to 2.0.0. Add Tex and texinfo output and auxiliary suffixes to .gitignore 2009-06-14 Neil Jerram <neil@ossau.uklinux.net> Provide easier configure options for GMP and readline This patch uses the AC_LIB_LINKFLAGS macro, provided by Gnulib's havelib module, to provide --with-gmp-prefix and --with-readline-prefix configure options. Many thanks to Bruno Haible for suggesting and explaining this to me. * configure.in (top level): Add AC_LIB_LINKFLAGS(gmp). * guile-readline/configure.in (AC_CONFIG_AUX_DIR): Change to ../build-aux, to share the main build-aux directory and so avoid having to distribute multiple copies of config.rpath. (top level): Add AC_LIB_LINKFLAGS(readline). * lib/Makefile.am, m4/gnulib-cache.m4: Regenerated by gnulib-tool for new import of the `havelib' module. 2009-06-13 Neil Jerram <neil@ossau.uklinux.net> Fix for make distcheck * examples/Makefile.am (AM_CFLAGS, AM_LIBS): Set PATH so that guile-config can find guile. Fix `make distcheck' * libguile/r6rs-ports.c (scm_init_r6rs_ports): Add libguile/ to included .x file name. 2009-06-12 Neil Jerram <neil@ossau.uklinux.net> Note Andy as a contributor 2009-06-10 Andy Wingo <wingo@oblong.net> fix defmacro*, defmacro*-public * module/ice-9/boot-9.scm (define-private): Remove apocyphal comment. The FIXME would really be to remove `define-private', though... * module/ice-9/optargs.scm (defmacro*, defmacro*-public): Fix these macros. Thanks to Dale Smith for the report. 2009-06-10 Andy Wingo <wingo@oblong.net> bump default stack limit to 160000 words * libguile/eval.c (scm_debug_opts): Up the default stack limit by a factor of 4. Psyntax expansions currently bounce back and forth between the VM and the interpreter, due to `map'. (Hopefully that won't be the case in the future, when have map in scheme, and we get an inliner.) Anyway when expanding a big nested expression, as for example in (language ecmascript compile-ghil) -- the pmatch code ends up being super-nested -- we can consume loads o stack. So given that on desktop machines, where rlimit is likely to be unset, default rlimits are around 8 or 10 MB or so, let's bump up our default limit to 640KB (on 32-bit). Should be enough for anyone. See http://thread.gmane.org/gmane.lisp.guile.devel/8599/focus=8662 for more info. Thanks to Mark H. Weaver for the diagnosis! 2009-06-10 Andy Wingo <wingo@pobox.com> fix debug-options * module/ice-9/boot-9.scm (define-option-interface): Fix (debug-options 'full), along with other options. Thanks to Mark Weaver for the tip. * THANKS: Update, though many more names need to be added. 2009-06-09 Andy Wingo <wingo@pobox.com> some attempts to solve the ecmascript stack overflow problem * module/language/ecmascript/compile-ghil.scm (comp): Just use pmatch, not ormatch. Now with syncase running over everything, it doesn't matter. * module/ice-9/boot-9.scm (false-if-exception): Avoid saving stacks inside false-if-exception. There's probably a more general solution to this, though. Fixes getting bogus backtraces sometimes. * module/Makefile.am (ECMASCRIPT_LANG_SOURCES): Reorder things so that spec comes last. 2009-06-09 Daniel Kraft <d@domob.eu> First code for elisp compilation, handling a very limited set of operations (but not really usable yet). * module/language/elisp/README: New file containing some notes. * module/language/elisp/compile-tree-il.scm: New file with compilation code. * module/language/elisp/spec.scm: Updated language definition. 2009-06-08 Andy Wingo <wingo@pobox.com> a start to changing VM scheme copyrights * module/language/tree-il/primitives.scm: Change copyright to LGPLv2.1. Others will follow. 2009-06-08 Andy Wingo <wingo@pobox.com> pretty-print psyntax-pp.scm * module/ice-9/compile-psyntax.scm: Pretty-print psyntax-pp.scm, given that we are going to compile it anyway. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-06-08 Andy Wingo <wingo@oblong.net> don't autocompile snarfing m4 docs * doc/ref/Makefile.am (autoconf-macros.texi): Yet another place we shouldn't autocompile. 2009-06-08 Andy Wingo <wingo@pobox.com> fix bootstrapping after last night's psyntax patch * module/Makefile.am (ice-9/psyntax-pp.scm): Don't try autocompiling when making psyntax-pp.scm. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm (chi-top): Only affect the compile-time environment if modules have booted. 2009-06-08 Andy Wingo <wingo@pobox.com> call-with-values can make fewer closures * module/language/tree-il.scm: Rename let-exp and letrec-exp to let-body and letrec-body. Add <let-values>, a one-expression let-values that should avoid the needless creation of two closures in many common multiple-value cases. We'll need to add an optimization pass to the compiler to produce this form, though, as well as rewriting lambdas into lets, etc. I added this form instead of adding more special cases to the call-with-values compile code because it's a useful intermediate form -- it will allow the optimizer to perform constant folding across more code. * module/language/tree-il.scm (parse-tree-il, unparse-tree-il) (tree-il->scheme, post-order!, pre-order!): Adapt to let/letrec body renaming, and let-values. * module/language/tree-il/analyze.scm (analyze-lexicals): Adapt for renaming, and add cases for let-values. * module/language/tree-il/compile-glil.scm (flatten): Add a new context, `vals', used by let-values code for the values producer. Code that produces multiple values can then jump to the let-values MV return address directly, instead of trampolining into a procedure. Add code to compile let-values. 2009-06-07 Andy Wingo <wingo@pobox.com> fix incorrect inlining of + when + is locally redefined * libguile/vm-i-scheme.c (FUNC2): Use a signed value for the intermediate result here. Not sure what the effect is, though. * module/ice-9/psyntax.scm (chi-top): Toplevel definitions ensure that variables are defined in the current module. Fixes the specific case of guile-lib's md5.scm, which redefines + -- this code is needed so that we don't incorrectly open-code +. * module/language/tree-il/primitives.scm (resolve-primitives!): I think there were some cases in which vars and names would not resolve properly here. Fix those. 2009-06-07 Andy Wingo <wingo@pobox.com> new instructions: make-int64, make-uint64 * doc/ref/vm.texi (Loading Instructions): Remove references to load-integer and load-unsigned-integer -- they're still in the VM but will be removed at some point. (Data Control Instructions): Add make-int64 and make-uint64. * libguile/vm-i-loader.c (load-unsigned-integer): Allow 8-byte values. But this instruction is on its way out, yo. * libguile/vm-i-system.c (make-int64, make-uint64): New instructions. * module/language/assembly.scm (object->assembly): Write out make-int64 and make-uint64 instructions, using bytevectors to do the endianness conversion. (assembly->object): And pretty-print them back, for disassembly. * module/language/glil/compile-assembly.scm: Don't generate load-integer / load-unsigned-integer instructions. 2009-06-07 Andy Wingo <wingo@pobox.com> fix bug in goops' method cache with rest args * module/oop/goops/compile.scm (code-table-lookup): Fix a tricky little bug! * test-suite/tests/goops.test ("the method cache"): Add a wee test. 2009-06-06 Neil Jerram <neil@ossau.uklinux.net> Fix popen.test on NetBSD and Ubuntu Jaunty, where sh is not Bash Thanks to Greg Troxel for reporting, and Barry Fishman for the explanation and fix. * test-suite/tests/popen.test ("open-input-pipe"): Use shell function `read' with an explicit argument, as apparently not all shells support read with no argument. 2009-06-06 Andy Wingo <wingo@pobox.com> support ((@ ...) ...) where the car is a macro * module/ice-9/psyntax.scm (syntax-type): Remove `external-macro', not used any more. Take an extra arg, `for-car?', indicating that we're checking on the type of a form in the car position. In the case that the expression is a pair, do a full recursion on the car, which allows us to catch the fact that the car of the following form is a macro: ((@ (ice-9 optargs) let-optional) ...) and thus the form itself should be macroexpanded. But, since we want to distingush `lambda' from `(lambda ...)', just as we have global and global-call, we have core to the new `core-form'. (chi-top, chi, chi-expr, chi-body, set!): Adapt to changes to syntax-type. 2009-06-05 Neil Jerram <neil@ossau.uklinux.net> State and explain dependency on libtool 2.2 * HACKING: Updated to recommend libtool 2.2 and anti-recommend libtool 1.5.26. Fix `Mismatching FUNC_NAME' warning from guile-func-name-check * libguile/bytevectors.c (FUNC_NAME): Change to match function name. 2009-06-05 Andy Wingo <wingo@pobox.com> add ability to compile uniform arrays * module/rnrs/bytevector.scm (rnrs): * libguile/bytevectors.h: * libguile/bytevectors.c (scm_uniform_array_to_bytevector): New function. * libguile/unif.h: * libguile/unif.c (scm_from_contiguous_typed_array): New function. * libguile/vm-i-loader.c (load-array): New instruction, for loading byte data into uniform vectors. Currently it copies out the data, though in the future we could avoid that. * module/language/assembly.scm (align-code): New exported function, aligns code on some boundary. (align-program): Use align-code. * module/language/assembly/compile-bytecode.scm (write-bytecode): Support the load-array instruction. * module/language/glil/compile-assembly.scm (dump-object): Dump uniform arrays. Neat :) 2009-06-05 Andy Wingo <wingo@pobox.com> add long-object-ref, long-toplevel-ref, long-toplevel-set * libguile/vm-i-system.c (long-object-ref, long-toplevel-ref) (long-toplevel-set): Add new instructions, for accessing the object table with a 16-bit offset. HTMLprag defines a test program that has more than 256 constants, necessitating this addition. * doc/ref/vm.texi: Mention the new instructions. * module/language/glil/compile-assembly.scm: Emit long refs for object tables bigger than 256 entries. 2009-06-05 Andy Wingo <wingo@pobox.com> disable autocompilation when running guile-tools compile * module/scripts/compile.scm (compile): Disable autocompilation when running guile-tools compile. 2009-06-05 Andy Wingo <wingo@pobox.com> refactoring for toplevel-ref, toplevel-set, link-now * libguile/vm-i-system.c (toplevel-ref, toplevel-set) * libguile/vm-i-loader.c (link-now): * libguile/vm.c (resolve_variable): Factor out common code to a static method. The compiler can still inline it, so it shouldn't have a significant performance effect. * libguile/vm-engine.c (vm_error_no_such_module): Remove now-unused label. 2009-06-05 Andy Wingo <wingo@pobox.com> add gperf-generated files to git * lib/iconv_open-osf.h: * lib/iconv_open-aix.h: * lib/iconv_open-hpux.h: * lib/iconv_open-irix.h: Add to git. Should remove build-time dep on gperf; we'll see if this causes problems. 2009-06-05 Andy Wingo <wingo@pobox.com> stamp .go with timestamp of .scm; a fresh go has same mtime of .scm * libguile/load.c (compiled_is_fresh): Rename from compiled_is_newer. Check that the mtines of the .go and .scm match exactly, so we don't get fooled by rsync-like modifications of the filesystem. * module/system/base/compile.scm (call-with-output-file/atomic): Add optional arg, a reference file. If present we utime the output file to match the source file, before the rename. (compile-file): Stamp the .go file with the timestamp of the .scm. 2009-06-05 Andy Wingo <wingo@pobox.com> compile and install srfi-98. * module/Makefile.am (SRFI_SOURCES): Add SRFI-98. final (?) tweaks to the autocompile code * libguile/load.c (do_try_autocompile): Use module_variable, not module_lookup, when resolving compile-file, so we get #f instead of an exception if the compiler is in the process of being loaded. (scm_primitive_load_path): In what I hope is the last patch to this code, recheck the fallback path if we found a stale installed .go file. 2009-06-05 Andy Wingo <wingo@pobox.com> simplify autocompilation some more * libguile/load.c (scm_init_load_path): Set the fallback path even if GUILE_SYSTEM_COMPILED_PATH is set. Now that we store full paths in the autocompiled files, and the path contains the effective Guile version, there's no danger of accidental collisions. (do_try_autocompile, autocompile_catch_handler, scm_try_autocompile): Simplify again -- since there's only one place we put autocompiled files, and compile-file finds it itself, there's no need to pass along the compiled file path. (scm_primitive_load_path): Don't call out to compiled-file-name to get the fallback path, as we might not be autocompiling, and besides that we need to check if the file exists at all. * module/system/base/compile.scm (compiled-file-name): Simplify again. The auto-compiled path is just fallback path + full source path + .go. 2009-06-05 Andy Wingo <wingo@pobox.com> further autocompilation tweaks * module/system/base/compile.scm (compiled-file-name): * libguile/load.c (scm_init_load_path, scm_try_autocompile) (scm_primitive_load_path): Rework so that we search for .go files in the load-compiled path and in the fallback path, but we only autocompile to the fallback path. Should produce a more desirable experience. 2009-06-04 Andy Wingo <wingo@pobox.com> propagate timestamps to installed .scm and .go files * am/guilec: Propagate timestamps of .scm and .go files on to their installed variants. Helps the is-the-.go-file-stale? code do its job. 2009-06-04 Andy Wingo <wingo@oblong.net> fix .go installation * am/guilec (nobase_ccache_DATA): Fix .go installation. turn off autocompilation when snarfing * libguile/Makefile.am (snarf2checkedtexi): Turn off autocompilation when snarfing. 2009-06-03 Andy Wingo <wingo@pobox.com> fix error autocompiling parts of the compiler; make check works * libguile/load.c (scm_try_autocompile): Punt if compiled-file-name does not resolve, which would indicate that the file in question is part of the compiler itself. * test-suite/tests/elisp.test: Today I was an evil one -- disable autocompilation for the elisp tests, as they are meant only for the memoizer's eyes. Hopefully Daniel will fix this :-) 2009-06-03 Andy Wingo <wingo@pobox.com> tweaks to autocompile code * libguile/load.c (compiled_is_newer): Tweak diagnostic output. (do_try_autocompile, autocompile_catch_handler, scm_try_autocompile): Rework to compute the name of the compiled file in advance. If the computed name is different from the found .go file and is fresh, use it directly. Fixes the case where /usr/lib/.../foo.go is out of date but the user doesn't have permissions to recompile, so we use the user's local compile cache instead if it's fresh. (scm_primitive_load): Pass the found .go file as well to scm_try_autocompile. 2009-06-03 Andy Wingo <wingo@pobox.com> implement autocompilation * am/guilec (.scm.go): Set GUILE_AUTO_COMPILE=0 when compiling individual files, and remove the mkdir -p as compile-file takes care of that now. * libguile/load.c (do_try_autocompile, autocompile_catch_handler) (scm_try_autocompile, scm_init_load): Implement autocompilation. * libguile/script.c (scm_shell_usage, scm_compile_shell_switches): Add --autocompile / --no-autocompile command-line options, and support for the GUILE_AUTO_COMPILE environment variable, defaulting to autocompilation enabled. 2009-06-03 Andy Wingo <wingo@pobox.com> add exception_on_error optional arg to primitive-load-path * libguile/init.c (scm_load_startup_files): Use scm_c_primitive_load_path. * libguile/load.c (scm_primitive_load_path): Add an optional arg, exception_on_error, which if #f will cause primitive-load-path to just return #f if no file is found. This is to help out the semantics of try-module-autoload. We can't just catch misc-error, because loading the file could raise any exception. (scm_c_primitive_load_path): Add the extra arg to scm_primitive_load_path. * libguile/load.h: Adapt scm_primitive_load_path prototype. * module/ice-9/boot-9.scm (try-module-autoload): Refactor slightly to be clearer. 2009-06-03 Andy Wingo <wingo@pobox.com> refactors to load.c to support auto-compilation * libguile/load.c (compiled_is_newer): Factored out of scm_primitive_load_path. (scm_try_autocompile): New stub, for autocompiling. Currently just returns false. (scm_primitive_load_path): Refactor, and call out to scm_try_autocompile if the .go is missing or not fresh. compiled-file-name tries to put the .go in the %load-compiled-path * module/system/base/compile.scm (ensure-writable-dir): Rename from ensure-directory. (dsu-sort): Helper, does a decorate / sort / undecorate. (compiled-file-name): Refactor to only return a writable filename. The readable case is handled by load.c now, and the other case was silly. Hopefully it will do the right thing. (load-ensuring-compiled): Remove, load.c will call out to compile-file if necessary. (ensure-fallback-path): Remove, load.c will add the ~/.guile-ccache dir to the load-compiled path, which will prompt its creation if necessary. install .go files under $libdir, not $datadir * am/guilec: Install .go files to $(pkglibdir)/$GUILE_EFFECTIVE_VERSION/ccache. file-exists? doesn't cause a throw, simpler try-module-autoload * module/ice-9/boot-9.scm (file-exists?): Change to use the stat interface that doesn't throw exceptions. (try-module-autoload): Simplify to take advantage of the fact that primitive-load-path does the right thing with regards to loading compiled files if they are available. update uninstalled-env.in for load-compiled path separation * meta/uninstalled-env.in: Update to set GUILE_LOAD_COMPILED_PATH and GUILE_SYSTEM_COMPILED_PATH. add exception-on-error optional arg to `stat' in scheme * libguile/filesys.h: * libguile/filesys.c (scm_stat): Add optional arg, exception-on-error, which if #f (not the default) will just return #f instead of raising an exception if the stat fails. 2009-06-03 Andy Wingo <wingo@pobox.com> separate the load-compiled path from the load path * libguile/Makefile.am (libpath.h): Add definitions for SCM_CCACHE_DIR and SCM_EFFECTIVE_VERSION. These are private, the header is not installed. Add ccachedir to build-info. Rework some other build-info definitions. * libguile/load.c (scm_loc_load_compiled_path): New global, corresponding to the new environment variable, GUILE_LOAD_COMPILED_PATH. Compiled files will now be searched for in this path, and only in this path. (scm_init_load_path): Init the load-compiled path too. We initialize it with $pkglibdir/guile/$effective_version/ccache, and also with $HOME/.guile-ccache/$effective_version/. This will respect the libdir/datadir difference, and it is a preparation for automatic compilation support. (scm_primitive_load_path): Search only the GUILE_LOAD_COMPILED_PATH for compiled files. (scm_init_load): Cache scm_loc_load_compiled_path. 2009-06-02 Julian Graham <julian@transmetropolitan.(none)> Merge branch 'master' of git://git.savannah.gnu.org/guile 2009-05-31 Julian Graham <julian@transmetropolitan.(none)> Implementation of SRFI-98 (An interface to access environment variables). * NEWS: Add SRFI-98 to 1.8.7 features. * doc/ref/srfi-modules.text (SRFI-98): Documentation for SRFI-98. * module/srfi/srfi-98.scm: New file. SRFI-98 implementation. * test-suite/tests/srfi-98.test: New file. SRFI-98 unit tests. 2009-05-29 Andy Wingo <wingo@pobox.com> Merge branch 'syncase-in-boot-9' Conflicts: module/Makefile.am 2009-05-28 Ludovic Courtès <ludo@gnu.org> Import R6RS bytevectors and I/O ports from Guile-R6RS-Libs 0.2. * README: Document dependency on GNU libunistring. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `benchmark/bytevectors.bm'. * configure.in: Make sure we have libunistring; update $LIBS. * libguile.h: Include "bytevectors.h" and "r6rs-ports.h". * libguile/Makefile.am (libguile_la_SOURCES): Add `bytevectors.c' and `r6rs-ports.c' (DOT_X_FILES): Add `bytevectors.x' and `r6rs-ports.x'. (DOT_DOC_FILES): Add `bytevectors.doc' and `r6rs-ports.doc'. (noinst_HEADERS): Add `ieee-754.h'. (modinclude_HEADERS): Add `bytevectors.h' and `r6rs-ports.h' * libguile/validate.h (SCM_VALIDATE_BYTEVECTOR): New macro. * module/Makefile.am (SOURCES): Add $(RNRS_SOURCES). (RNRS_SOURCES): New variable. * test-suite/Makefile.am (SCM_TESTS): Add `bytevectors.test' and `r6rs-ports.test'. 2009-05-28 Ludovic Courtès <ludo@gnu.org> Use GNU libunistring and Gnulib modules needed by R6RS bytevectors and ports. * m4/gnulib-cache.m4 (gl_MODULES): Add `byteswap', `iconv_open-utf', `libunistring', `striconveh', and `string'. 2009-05-28 Andy Wingo <wingo@pobox.com> add tests for #' etc * test-suite/tests/reader.test ("#'"): Add tests for the hash-syntax reader macros. add reader tests for #; * test-suite/tests/reader.test ("#;"): Add reader tests for #;. 2009-05-28 Andy Wingo <wingo@pobox.com> add reader support for #; #` #' #, and #,@. fix bug in compile-and-load. * libguile/read.c (flush_ws, scm_read_commented_expression) (scm_read_sharp): Add support for commenting out expressions with #;. (scm_read_syntax, scm_read_sharp): Add support for #', #`, #, and #,@. * module/ice-9/boot-9.scm: Remove #' read-hash extension, which actually didn't do anything at all. It's been there since 1997, but no Guile code I've ever seen uses it, and it conflicts with #'x => (syntax x) from modern Scheme. * module/system/base/compile.scm (compile-and-load): Whoops, fix a number of bugs here. 2009-05-27 Neil Jerram <neil@ossau.uklinux.net> Remove possible deadlock in scm_join_thread_timed * libguile/threads.c (scm_join_thread_timed): Recheck t->exited before looping round to call block_self again, in case thread t has now exited. * test-suite/tests/threads.test ("don't hang when joined thread terminates in SCM_TICK"): New test. 2009-05-27 Neil Jerram <neil@ossau.uklinux.net> Fix wait-condition-variable so that it doesn't leave asyncs blocked * libguile/threads.c (fat_mutex_unlock): Unblock asyncs when breaking out of loop. * test-suite/tests/threads.test (asyncs-still-working?): New function, to test if asyncs are working (i.e. unblocked). Use this throughout threads.test, in particular before and after the "timed locking succeeds if mutex unlocked within timeout" test. 2009-05-26 Andy Wingo <wingo@pobox.com> adjust VM copyright notices to LGPL, use SCM_INTERNAL/API properly * libguile/frames.c: * libguile/frames.h: * libguile/instructions.c: * libguile/instructions.h: * libguile/objcodes.c: * libguile/objcodes.h: * libguile/programs.c: * libguile/programs.h: * libguile/vm-bootstrap.h: * libguile/vm-engine.c: * libguile/vm-engine.h: * libguile/vm-expand.h: * libguile/vm-i-scheme.c: * libguile/vm.c: * libguile/vm.h: Update to use SCM_API and SCM_INTERNAL correctly. Adjust copyright to be the same as the copyright of Guile itself, which should be fine given that the FSF holds the whole thing. 2009-05-26 Andy Wingo <wingo@pobox.com> fix backtraces with compiled boot-9 * module/ice-9/boot-9.scm (default-pre-unwind-handler): Since we were tail-called by pre-unwind-handler-dispatch, we can't use pre-unwind-handler-dispatch as a narrowing argument. Instead just narrow by one frame. (pre-unwind-handler-dispatch): Deprecate. (error-catching-loop): Remove crack comment and code, and just use default-pre-unwind-handler as our pre-unwind handler. * module/ice-9/stack-catch.scm (stack-catch): * module/system/repl/repl.scm (call-with-backtrace): Use default-pre-unwind-handler directly. 2009-05-26 Andy Wingo <wingo@wingomac.bcn.oblong.net> gnulib-tool --import environ; rely on gnulib for environ definitions * libguile/posix.c: * libguile/stime.c: Remove environ definition, gnulib provides it now. 2009-05-26 Andy Wingo <wingo@wingomac.bcn.oblong.net> symbols are now hidden unless explicitly exported by SCM_API * libguile/__scm.h (SCM_API, SCM_INTERNAL): Take the reverse strategy: symbols will be hidden by default, and only exported with SCM_API. In addition to working on Mac OS, it has the several nice efficiency benefits on Linux, and unifies codepaths with Win32. * libguile/Makefile.am: Define BUILDING_LIBGUILE when building Guile. 2009-05-26 Andy Wingo <wingo@wingomac.bcn.oblong.net> gnulib-tool --import lib-symbol-visibility 2009-05-26 Andy Wingo <wingo@oblong.net> distcheck fix, fix (ice-9 time) * lang/Makefile.am (elisp_sources): Add elisp/expand.scm. * module/ice-9/time.scm (time): Fix for new macro expander. Ew. 2009-05-25 Andy Wingo <wingo@pobox.com> update docs -- sections on assembly and objcode * doc/ref/api-procedures.texi: * doc/ref/compiler.texi: * doc/ref/vm.texi: Update the docs some more. 2009-05-24 Andy Wingo <wingo@pobox.com> update docs, clean up VM vestiges, macro docs, fix (/ a b c) * doc/ref/api-procedures.texi (Compiled Procedures): Fix for API changes. * doc/ref/compiler.texi (Compiling to the Virtual Machine): Replace GHIL docs with Tree-IL docs. Update the bits about the Scheme compiler to talk about Tree-IL and the expander instead of GHIL. Remove <glil-argument>. Add placeholder sections for assembly and bytecode. * doc/ref/vm.texi: Update examples with what currently happens. Reword some things. Fix a couple errors. * libguile/vm-i-system.c (externals): Remove this instruction, it's not used. * module/ice-9/documentation.scm (object-documentation): If the object is a macro, try to return documentation on the macro transformer. * module/language/assembly/disassemble.scm (disassemble-load-program): Fix problem in which we skipped the first element of the object vector, because of changes to procedure layouts a few months ago. * module/language/scheme/spec.scm (read-file): Remove read-file definition. * module/language/tree-il.scm: Reorder exports. Remove <lexical>, it was a compat shim to something that was never released. Fix `location'. * module/language/tree-il/primitives.scm (/): Fix expander for more than two args to /. * module/system/base/compile.scm (read-file-in): Remove unused definition. * module/system/base/language.scm (system): Remove language-read-file. * module/language/ecmascript/spec.scm (ecmascript): Remove read-file definition. 2009-05-22 Ludovic Courtès <ludo@gnu.org> Rewrite SRFI-35 macros using `syntax-rules'. * module/srfi/srfi-35.scm: Use `(ice-9 syncase)'. (define-condition-type, condition): Rewritten using `syntax-rules'. (compound-condition, condition-instantiation): New helper internal macros. Thanks to Andy Wingo for his help! 2009-05-22 Andy Wingo <wingo@pobox.com> fix (oop goops) compilation for (language tree-il primitives) * module/oop/goops.scm (compile): Whoop-dee, fix up (oop goops) for (language tree-il primitives) change. 2009-05-22 Andy Wingo <wingo@pobox.com> source location tracking in psyntax, booya! * module/ice-9/psyntax.scm (source-annotation): Return #f if source-properties returns null. (source-wrap): Rework a bit. (syntax-type): Don't throw away source info for wrapped expressions. Can has source location info, fools! (chi-body): Correctly propagate source info for body subforms. (syntax): Remove special case for map, it doesn't apply (ahem) for Guile. * module/ice-9/psyntax-pp.scm: Regenerate. 2009-05-22 Andy Wingo <wingo@pobox.com> remove annotations in psyntax in favor of guile's source properties * module/ice-9/psyntax.scm: Remove references to annotation objects, we're just going to try and use Guile's source properties now. It works until `syntax' reconstructs output, at which point it seems we lose it. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-05-22 Andy Wingo <wingo@pobox.com> fix problem naming internal definitions * module/ice-9/psyntax.scm (chi-body): Fix a problem introduced in dc1eed52f71, that internal syntax definitions were included in the id lis along with value definitions. Only showed up on a second bootstrap. Psyntax, how I love thee. * module/ice-9/psyntax-pp.scm 2009-05-22 Andy Wingo <wingo@pobox.com> move things to (language tree-il primitives) * module/language/tree-il/optimize.scm: * module/language/tree-il/primitives.scm: Move primitive-related things to primitive.scm from inline.scm and optimize.scm. * module/Makefile.am: Update for inventory changes. 2009-05-22 Andy Wingo <wingo@pobox.com> fix tree-il test to work if source info happens to be present * module/language/tree-il/compile-glil.scm (flatten-lambda): Fix source emission. * test-suite/tests/tree-il.test (strip-source): Strip source info on tree-il before compiling, so we don't get extraneous source info in the glil. Make check passes! 2009-05-22 Andy Wingo <wingo@pobox.com> fix bad call to make-glil-src * module/language/tree-il/compile-glil.scm (flatten-lambda): Fix bad call to make-glil-src, unfortunately not hit during production because psyntax doesn't yet understand source locations. fix expansion of (ice-9 threads) * module/ice-9/threads.scm: Move syntax definitions before the procedures that use them, and rewrite as hygienic macros since they are so much nicer that way. Fixes the thread tests. 2009-05-22 Andy Wingo <wingo@pobox.com> syntax.test is passing, yay * test-suite/tests/syntax.test ("top-level define"): Remove the test for currying, as we don't do that any more by default. It should be easy for the user to add in if she wants it, though. ("do"): Remove unmemoization tests, as sc-expand fully expands `do'. ("while"): Remove while tests in empty environments. They have been throwing 'unresolved, and the problem they seek to test is fully handled by hygiene anyway. And otherwise tweak expected exception strings, and everything passes! 2009-05-22 Andy Wingo <wingo@pobox.com> residualize names into procedures. re-implement srfi-61. module naming foo. * module/ice-9/boot-9.scm (cond): Implement srfi-61; most of the code is from the SRFI itself. Yuk. (%print-module, make-modules-in, %app, (%app modules)) (module-name): Syncase needs to get at the names of modules, even at anonymous modules. So lazily assign gensyms as module names. Name %app as (%app), but since (%app modules) is at the top of the module hierarchy, name it (). * module/ice-9/psyntax.scm: When building tree-il, try to name lambdas in definitions and in lets. (let, letrec): Give more specific errors in a couple of cases. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syntax.test: More work. Many exceptions have different messages than they used to, many more generic; we can roll this back to be faithful to the original strings, but it doesn't seem necessary to me. 2009-05-21 Andy Wingo <wingo@pobox.com> some work on syntax.test * module/language/tree-il.scm (tree-il->scheme): * module/ice-9/psyntax.scm (build-conditional): Attempt to not generate (if #f #f) as the second arm of an if, but it doesn't seem to be successful. * module/ice-9/psyntax-pp.scm (syntax-rules): Regenerate. * test-suite/tests/syntax.test (exception:unexpected-syntax): Change capitalization. ("unquote-splicing"): Update test. ("begin"): Add in second arms on these ifs, to avoid the strange though harmless expansion of `if'. (matches?): New helper macro. ("lambda"): Match on lexically bound symbols, as they will be alpha-renamed. 2009-05-21 Andy Wingo <wingo@pobox.com> catch syntax errors in unquote and unquote-splicing * module/ice-9/psyntax.scm (quasiquote): Catch syntax errors in unquote and unquote-splicing. * module/ice-9/psytax-pp.scm: Regenerated. 2009-05-21 Andy Wingo <wingo@pobox.com> fix multiple values returning from srfi-18's `with-exception-handler' * module/srfi/srfi-18.scm (with-exception-handler): Hah! Fixed a scurrilous bug in which we assumed that the thunk returned one or more values. Hah. 2009-05-21 Andy Wingo <wingo@pobox.com> fix apply and call/cc in drop contexts * module/language/tree-il/compile-glil.scm (flatten): Actually apply only needs one arg after the proc. And shit, call/cc and apply in drop contexts also need to be able to return arbitrary numbers of values; work it by trampolining through their applicative (non-@) definitions. Also, simplify the single-valued drop case to avoid the truncate-values. * module/language/tree-il/inline.scm (call/cc): * module/language/tree-il/optimize.scm (*interesting-primitive-names*): Define call/cc as "interesting". Perhaps we should be hashing on value and not on variable. * test-suite/tests/tree-il.test ("application"): Fix up test for new, sleeker output. (Actually the GLIL is more verbose, but the assembly is better.) ("apply", "call/cc"): Add some more tests. 2009-05-21 Andy Wingo <wingo@pobox.com> procedures in "drop" contexts can return unspecified values * module/language/tree-il/compile-glil.scm (flatten): For applications in "drop" context, allow the procedure to return unspecified values (including 0 values). * test-suite/tests/tree-il.test ("application"): Adapt test. * module/srfi/srfi-18.scm (wrap): Clarify. * test-suite/tests/srfi-18.test: Fix so that the expression importing srfi-18 is expanded before the tests. However the tests are still failing, something about 0-valued returns... 2009-05-21 Andy Wingo <wingo@pobox.com> fix srfi-17.test * test-suite/tests/srfi-17.test (exception:bad-quote): Change the expected exception for (set! (quote foo) ...) errors. just parse method arguments once. * module/oop/goops.scm (method): Tweak to just run through the arguments once. Thanks to Eli Barzilay for the tip. 2009-05-21 Andy Wingo <wingo@pobox.com> rewrite `method' as a hygienic macro to re-allow lexical specializers * module/oop/goops.scm (method): Reimplement as a hygienic macro. This seriously took me like 6 hours to figure out. Allows for lexical specializers: (let ((<x> ...)) (define-method (foo (arg <x>)) ...)). * module/oop/goops/compile.scm (next-method?, compile-make-procedure): Remove these, as `method' does it all now, hygienically. 2009-05-21 Ludovic Courtès <ludo@gnu.org> Make use of Gnulib's `flock' module. * libguile/posix.c: Always use <sys/file.h>, which is provided by Gnulib. (flock)[__MINGW32__]: Remove. (scm_flock): Compile unconditionally. Always use Gnulib's flock(2). Make use of Gnulib's `putenv' module. * libguile/posix.c: Include <stdlib.h> since the putenv(3) declaration is there (POSIX and Gnulib). (scm_putenv): Rely on Gnulib's `putenv' module. Add Gnulib portability modules; update Gnulib files. * m4/gnulib-cache.m4 (gl_MODULES): Add `flock' (provides flock(2) declaration and implementation), `fpieee' (fixes floating point behavior on Alpha and SH), `stdlib' (provides an unsetenv(3) declaration, among others), `putenv' (provides a putenv(3) declaration and implementation with the semantics we need). Update `NEWS'. 2009-05-21 Michael Gran <spk121@yahoo.com> Symbols longer than 128 chars can cause an exception. Also, the terminating colon of long postfix keywords are not handled correctly. * test-suite/tests/reader.test ("read-options"): Add test for long postfix keywords. * libguile/read.c (scm_read_mixed_case_symbol): Fix exception on symbols are greater than 128 chars. Also, colons are not stripped from long postfix keywords. 2009-05-21 Ludovic Courtès <ludo@gnu.org> Update `NEWS' wrt. `branch_release-1-8'. Fix compilation of `test-round.c' on BSD. * test-suite/standalone/test-round.c (HAVE_MACHINE_FPU_H): Include <sys/types.h> when available. This fixes compilation on NetBSD. Reported by Greg Toxel. Update `NEWS'. Don't use raw divisions by zero in `test-conversion.c'. * test-suite/standalone/test-conversion.c (ieee_init): New function. (guile_Inf, guile_NaN): New variables. (test_from_double, test_to_double): Use them. Divisions by zero made `cc' on Tru64 5.1b ("Compaq C V6.5-011") bail out and led to a floating point exception when compiled with GCC on the same platform. (main): Call `ieee_init ()'. 2009-05-21 Ludovic Courtès <ludo@gnu.org> Use <machine/fpu.h> instead of <fenv.h> when needed (e.g., Tru64 5.1b). * configure.in: Look for <machine/fpu.h>. * test-suite/standalone/test-round.c: Use <machine/fpu.h> if available. 2009-05-21 Ludovic Courtès <ludo@gnu.org> Work around lack of cuserid(3) declaration on Tru64 5.1b. * configure.in: Check for a cuserid(3) declaration. * libguile/posix.c [HAVE_CUSERID][!HAVE_DECL_CUSERID]: Provide a declaration. 2009-05-21 Ludovic Courtès <ludo@gnu.org> Work around the lack of hstrerror(3) declaration on Tru64. * configure.in: Look for the declaration of hstrerror(3). * libguile/net_db.c: Add hstrerror(3) declaration if `HAVE_DECL_HSTRERROR' is undefined. 2009-05-20 Ludovic Courtès <ludo@gnu.org> Remove extraneous semicolons from `test-conversion.c'. * test-suite/standalone/test-conversion.c: Remove extraneous semicolon following `DEF[SU]TST' invocations since that made Compaq C V6.5-011 (`cc' on Tru64 5.1b) bail out. Fix compilation of `numbers.c' on Tru64. * libguile/numbers.c (scm_c_make_polar): Don't use sincos(3) on non-GNU platforms. Reported by Didier Godefroy <ldg@ulysium.net>. Fix compilation of `gcc_os_dep.c' on Tru64. * libguile/gc_os_dep.c [OSF1](_end): Specify the type. (scm_get_stack_base): Suitably cast RESULT. Reported by Didier Godefroy <ldg@ulysium.net>. Update `NEWS' and `THANKS'. 2009-05-20 Neil Jerram <neil@ossau.uklinux.net> Avoid "no duplicate" popen tests leaving zombie processes On the one hand we want the child process in these tests to exit. On the other, we don't want it to exit before the parent Guile code has tested the relevant condition (EOF in the first test, broken pipe in the second) - because these conditions would obviously be true if the child had already exited, and that's not what we're trying to test here. We're trying to test getting EOF and broken pipe while the child process is still alive. * test-suite/tests/popen.test (open-input-pipe:no duplicate): Add another pipe from parent to child, so that the child can finish by reading from this. Then the parent controls the child lifetime by writing to this pipe. * test-suite/tests/popen.test (open-output-pipe:no duplicate): Add another pipe from child to parent, and have the child finish by endlessly writing into this. Then the parent controls the child lifetime by closing its end of the pipe, causing a broken pipe in the child. 2009-05-20 Neil Jerram <neil@ossau.uklinux.net> Fix `explicitely' typos, should be `explicitly' 2009-05-20 Andy Wingo <wingo@pobox.com> fix failing macro-as-parameter tests in eval.test * module/ice-9/psyntax.scm (chi-lambda-clause): Strip the docstring before passing it on to the continuation. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/eval.test (exception:failed-match): New exception, for syntax-case failed matches. ("evaluator"): Fix macro-as-parameter tests. They pass now :) 2009-05-20 Andy Wingo <wingo@pobox.com> remove compile-time-environment * module/ice-9/boot-9.scm (guile-user): Move the `compile' autoload to the guile-user module. Remove reference to compile-time-environment. * module/language/scheme/compile-ghil.scm: * module/language/tree-il/compile-glil.scm: * module/language/tree-il/optimize.scm: * module/system/base/compile.scm: * test-suite/tests/compiler.test: Remove definition of and references to compile-time-environment. While I do think that recompilation based on a lexical environment can be useful, I think it needs to be implemented differently. So for now we've lost nothing if we take it away, as it doesn't work with syncase anyway. 2009-05-20 Andy Wingo <wingo@pobox.com> Fix a bug in the (ice-9 match) test * testsuite/t-match.scm (matches?): Fix match invocation. As far as I can tell, although (ice-9 match) does advertise a => form of clauses, it requires that the end of the => be a symbol. For some reason this works in the interpreter: ((lambda () (begin => #t))) It's part of the expansion of matches?. It also worked in the old compiler. Thinking that maybe toplevel references could cause side effects, I made the new compiler actually ref =>, which brought this to light. 2009-05-20 Andy Wingo <wingo@pobox.com> fix @slot-ref / @slot-set! compilation * module/language/tree-il/compile-glil.scm: Add primcall compilers for @slot-ref and @slot-set. * module/language/tree-il/optimize.scm (add-interesting-primitive!): New export. Creates an association between a variable in the current module and a primitive name. * module/oop/goops.scm: Rework compiler hooks to work with tree-il and not ghil. 2009-05-20 Andy Wingo <wingo@pobox.com> compile `list' and `vector' to their associated opcodes * module/language/glil/compile-assembly.scm (glil->assembly): Check the length when emitting calls to variable-argument stack instructions. Allow two-byte lengths -- allows e.g. calls to `list' with more than 256 arguments. * module/language/tree-il/compile-glil.scm: Add primcall associations for `list' and `vector', with any number of arguments. Necessary because syncase's quasiquote expansions will produce calls to `list' with many arguments. * module/language/tree-il/optimize.scm (*interesting-primitive-names*): Add `list' and `vector' to the set of primitives to resolve. 2009-05-20 Andy Wingo <wingo@pobox.com> don't allocate too many locals for expansions of `or' * module/language/tree-il/analyze.scm (analyze-lexicals): Add in a hack to avoid allocating more locals than necessary for expansions of `or'. Documented in the source. * test-suite/tests/tree-il.test: Add a test case. 2009-05-20 Andy Wingo <wingo@pobox.com> a few fixups * module/ice-9/psyntax.scm (chi-install-global, syntax-case): Fix a couple of cases in which bare datums were passed to output constructors. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/spec.scm (scheme): Clean up the #:compilers list. * module/language/tree-il/compile-glil.scm (flatten): Fix call to `length' in call/cc compiler. 2009-05-20 Andy Wingo <wingo@pobox.com> and, or, cond etc use syntax-rules, compile scheme through tree-il * libguile/vm-i-system.c: * libguile/vm-engine.h (ASSERT_BOUND): New assertion, that a value is bound. Used by local-ref and external-ref in paranoid mode. * module/ice-9/boot-9.scm (and, or, cond, case, do): Since we are switching to use psyntax as the first pass of the compiler, and perhaps soon of the interpreter too, we need to make sure it expands out all forms to primitive expressions. So define expanders for these derived syntax forms, as in the R5RS report. * module/ice-9/psyntax-pp.scm: Regenerate, with core forms fully expanded. * module/ice-9/psyntax.scm (build-void): New constructor, for making undefined values. (build-primref): Add in a hack so that primitive refs in the boot module expand out to toplevel refs, not module refs. (chi-void): Use build-void. (if): Define an expander for if that calls build-conditional. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Use let* so as not to depend on binding order for the result of (current-module). * module/language/scheme/spec.scm (scheme): Switch over to tree-il as the primary intermediate language. Not yet fully tested, but at least it can compile psyntax-pp.scm. * module/language/tree-il/analyze.scm (analyze-lexicals): Arguments don't count towards a function's nlocs. * module/language/tree-il/compile-glil.scm (*comp-module*, compile-glil): Define a "compilation module" fluid. (flatten-lambda): Fix a call to make-glil-argument. Fix bug in heapifying arguments. (flatten): Fix number of arguments passed to apply instruction. Add a special case for `(values ...)'. If inlining primitive-refs fails, try expanding into toplevel-refs if the comp-module's variable is the same as the root variable. * module/language/tree-il/optimize.scm (resolve-primitives!): Add missing src variable for <module-ref>. * test-suite/tests/tree-il.test ("lambda"): Fix nlocs counts. Add a closure test case. 2009-05-18 Andy Wingo <wingo@pobox.com> add tree-il->glil compilation test suite * module/language/tree-il.scm (parse-tree-il): Fix a number of bugs. (unparse-tree-il): Apply takes rest args now. * module/language/tree-il/analyze.scm (analyze-lexicals) (analyze-lexicals): Heap vars shouldn't increment the number of locals. * module/language/tree-il/optimize.scm (resolve-primitives!): Don't resolve public refs to primitives, not at the moment anyway. * test-suite/Makefile.am (SCM_TESTS): Add tree-il test. * test-suite/lib.scm (pass-if, expect-fail, pass-if-exception) (expect-fail-exception): Rewrite as syntax-rules macros. In a very amusing turn of events, it turns out that bindings introduced by hygienic macros are not visible inside expansions produced by defmacros. This seems to be expected, so go ahead and work around the problem. * test-suite/tests/srfi-31.test ("rec special form"): Expand in eval. * test-suite/tests/syntax.test ("begin"): Do some more expanding in eval, though all is not yet well. * test-suite/tests/tree-il.test: New test suite, for tree-il->glil compilation. 2009-05-18 Andy Wingo <wingo@pobox.com> special cases for more types of known applications * module/language/tree-il/compile-glil.scm (flatten): Handle a number of interesting applications, and fix a bug for calls in `drop' contexts. * module/language/tree-il/inline.scm: Define expanders for apply, call-with-values, call-with-current-continuation, and values. 2009-05-17 Andy Wingo <wingo@pobox.com> inline calls to some primitives * module/system/base/pmatch.scm: Wrap consequents in (let () ) instead of (begin ) so that they can have local definitions. * module/language/tree-il/compile-glil.scm: Inline some calls to primitives. 2009-05-17 Andy Wingo <wingo@pobox.com> define `delay' in terms of make-promise * module/ice-9/boot-9.scm (delay): Define `delay' in terms of make-promise. * module/ice-9/psyntax-pp.scm (compile): Regenerated with a fully compiled Guile, so that the gensym numbers are the same. * module/language/tree-il/compile-glil.scm: Add some notes about what needs doing to catch up to the old compiler. 2009-05-17 Andy Wingo <wingo@pobox.com> and now, we residualize the original names into the metadata. yay! * module/language/tree-il/compile-glil.scm (vars->bind-list) (emit-bindings, flatten-lambda, flatten): Write the original names into <glil-bind> structures. Yaaaaay! 2009-05-17 Andy Wingo <wingo@pobox.com> actually pass original ids on to tree-il data types * module/ice-9/psyntax.scm (build-lambda, build-let, build-named-let) (build-letrec): Actually pass along the original ids to tree-il constructors. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/tree-il.scm: Add fields in <lambda>, <let>, and <letrec> for the original variable names. * module/language/tree-il/compile-glil.scm (compile-glil): Adapt for new make-lambda arg. 2009-05-17 Andy Wingo <wingo@pobox.com> preserve original var names in lets and lambdas * module/ice-9/psyntax.scm (build-letrec, build-let, build-lambda) (build-named-let): Take extra args for the original names of the gensyms. Not used yet. Callers adapted. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-05-15 Andy Wingo <wingo@pobox.com> tree-il -> glil compiler works now, at least in initial tests * module/language/tree-il/analyze.scm: Break analyzer out into its own file. * module/language/tree-il/compile-glil.scm: Port the GHIL->GLIL compiler over to work on tree-il. Works, but still misses a number of important optimizations. * module/language/tree-il.scm: Add <void>. Not used quite yet. * module/language/glil.scm: Remove <glil-argument>, as it is the same as <glil-local> (minus an offset). * module/language/glil/compile-assembly.scm: * module/language/glil/decompile-assembly.scm: * module/language/ghil/compile-glil.scm: Adapt for <glil-argument> * removal. * module/Makefile.am (TREE_IL_LANG_SOURCES): Reorder, and add analyze.scm. 2009-05-14 Andy Wingo <wingo@pobox.com> add lexical analyzer and allocator * module/language/tree-il/optimize.scm: Rework to just export the optimize! procedure. * module/language/tree-il/compile-glil.scm (analyze-lexicals): New function, analyzes and allocates lexical variables. Almost ready to compile now. (codegen): Dedent. 2009-05-12 Andy Wingo <wingo@pobox.com> add primitive expander for tree-il * module/Makefile.am: Add inline.scm. * module/language/tree-il.scm (pre-order!, post-order!): pre-order! is new. post-order! existed but was not public. They do destructive tree traversals of tree-il, and need more documentation. Also, add predicates to tree-il's export list. * module/language/tree-il/inline.scm: New file, which expands primitives into more primitive primitives. In the future perhaps it will not be necessary, as the general inlining infrastructure will handle these cases, but for now it's useful. * module/language/tree-il/optimize.scm: Move post-order! out to better pastures. 2009-05-11 Andy Wingo <wingo@pobox.com> add tree-il optimizer * module/language/tree-il/optimize.scm: New module, for optimizations. Currently all we have is resolving some toplevel refs to primitive refs. * module/Makefile.am: Add new module. * module/language/tree-il.scm: Fix exports for accessors for `src'. * module/language/tree-il/compile-glil.scm: Tweaks, things still aren't working yet. 2009-05-08 Andy Wingo <wingo@pobox.com> more work on tree-il compilation * module/language/scheme/amatch.scm: Remove, this approach won't be used. * module/Makefile.am: Adjust for additions and removals. * module/language/scheme/compile-ghil.scm: Remove an vestigial debugging statement. * module/language/scheme/spec.scm: * module/language/scheme/compile-tree-il.scm: * module/language/scheme/decompile-tree-il.scm: Add tree-il compiler and decompiler. * module/language/tree-il/compile-glil.scm: Add some notes. * module/language/tree-il/spec.scm: No need to wrap expressions in lambdas -- GHIL needs somewhere to put its variables, we don't. 2009-05-07 Andy Wingo <wingo@pobox.com> go ahead and regenerate psyntax-pp.scm 2009-05-07 Andy Wingo <wingo@pobox.com> remove (ice-9 expand-support) * module/ice-9/Makefile.am: * module/ice-9/expand-support.scm: Remove module, no longer used. * module/ice-9/psyntax.scm: Fix a comment. 2009-05-07 Andy Wingo <wingo@pobox.com> new language: tree-il. psyntax generates it when run in compile mode. * module/Makefile.am: Add tree-il sources. * module/ice-9/compile-psyntax.scm: Adjust for sc-expand producing tree-il in compile mode. * module/ice-9/psyntax.scm: Switch from expand-support to tree-il for generating output in compile mode. Completely generate tree-il -- the output wasn't Scheme before, but now it's completely not Scheme. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/compile-ghil.scm: Strip structures using tree-il, not expand-support. * module/language/tree-il.scm: * module/language/tree-il/spec.scm * module/language/tree-il/compile-glil.scm: New language. It will compile to GLIL, though it doesn't yet. 2009-05-07 Andy Wingo <wingo@pobox.com> make expand-support structure constructors take a source argument * module/ice-9/expand-support.scm (make-module-ref, make-lexical): Add source arguments to these constructors. * module/ice-9/psyntax.scm: * module/ice-9/psyntax-pp.scm: Adapt to match, though we don't wire everything up yet. 2009-05-07 Andy Wingo <wingo@pobox.com> fix install-global construction of `define' forms * module/ice-9/psyntax.scm (build-global-definition): Remove mod argument, as it does not seem we could ever define something in another module. (chi-install-global): Build the define as a definition, not an application. Doesn't matter now, but it will later. (chi-top): Fix build-global-definition call. * module/ice-9/psyntax.scm: Regenerated. 2009-05-04 Andy Wingo <wingo@pobox.com> when compiling, use make-lexical to residualize original var names * module/ice-9/psyntax.scm (build-lexical-reference): Change to be a function. Take an extra arg, the original name of the variable. If we are compiling, make a #<lexical>, annotated with the original var name. All callers changed. (build-lexical-assignment): Also a function, taking also the original var name, using build-lexical-reference to build its output. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-05-04 Andy Wingo <wingo@pobox.com> sc-expand in compile mode produces (ice-9 expand-support) structures * module/ice-9/psyntax.scm (*mode*): New moving part, a fluid. (sc-expand): Dynamically bind *mode* to the expansion mode. (build-global-reference): Change to be a procedure instead of local syntax. Import the logic about when to make a @ or @@ form to here, from boot-9.scm. If we are compiling, build output using (ice-9 expand-support)'s make-module-ref, otherwise just making the familiar s-expressions. (This will allow us to correctly expand in modules in which @ or @@ are not bound, at least when we are compiling.) (build-global-assignment): Use the result of build-global-reference. A bit hacky, but hey. (top-level-eval-hook, local-eval-hook): Strip expansion structures before evalling. * module/ice-9/boot-9.scm (make-module-ref): Remove, this logic is now back in psyntax.scm. * module/ice-9/compile-psyntax.scm (source): Since we expand in compile mode, we need to strip expansion structures. * module/ice-9/expand-support.scm (strip-expansion-structures): Remove the logic about whether and how to strip @/@@ from here, as it's part of psyntax now. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/compile-ghil.scm (compile-ghil): Strip expansion structures -- for now. In the future, we might translate directly from these structures into GHIL. 2009-05-04 Andy Wingo <wingo@pobox.com> replace sc-expand with sc-expand3, removing binding for sc-expand3 * module/ice-9/boot-9.scm (sc-expand3): * module/ice-9/psyntax.scm (sc-expand3): Replace sc-expand with sc-expand3, as expand3 with one argument is the same as sc-expand. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/compile-psyntax.scm: * module/language/scheme/compile-ghil.scm: Change callers to sc-expand3 to use sc-expand. 2009-04-29 Andy Wingo <wingo@pobox.com> remove (void) from boot-9 and psyntax * module/ice-9/psyntax.scm: Tweak comments. Remove references to `void'; just produce (if #f #f) instead of (void). * module/ice-9/psyntax-pp.scm: Regenerated, twice. * module/ice-9/boot-9.scm (void): Remove this binding. 2009-04-29 Andy Wingo <wingo@pobox.com> more cleanups to boot-9/psyntax * module/ice-9/boot-9.scm: Comment some more things. * module/ice-9/psyntax.scm: Remove error-hook -- callers should just use syntax-violation. Change all callers. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-29 Andy Wingo <wingo@pobox.com> remove andmap from public API (we still have and-map) * module/ice-9/boot-9.scm (and-map, or-map): Move these definitions up so psyntax can use them. (andmap): Remove, yay. * module/ice-9/psyntax.scm: Remove notes about andmap, and just use Guile's and-map -- except in cases that need the multiple list support, in which case we have a private and-map*. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-29 Andy Wingo <wingo@pobox.com> cleanups to boot-9 * module/ice-9/boot-9.scm: Shuffle around some definitions. (module-add!): Removed stub definition, no longer used. (install-global-transformer): Removed, no longer used (yay!). * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Remove install-global-transformer. 2009-04-29 Andy Wingo <wingo@pobox.com> first-class macro representation (no bits on variables) * libguile/macros.c (scm_macro_p): Update docs. * module/ice-9/boot-9.scm (module-define!, module-ref): Define pre-boot forms of these functions as well. I suspect module-add! can go soon. (module-lookup-keyword, module-define-keyword!) (module-undefine-keyword!) Remove these. * module/ice-9/psyntax-pp.scm: Regenerate. Notice the difference? * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook): Rework to expect first-class macros. Heh heh. (remove-global-definition-hook): Pleasantly, this hook can go away. (chi-install-global): Terrorism to generate the right kind of output -- will clean up. (chi-top): Unify definition handling for all kinds of values. 2009-04-29 Andy Wingo <wingo@pobox.com> a different tack for syncase macro representation * libguile/macros.c (macro_print): Show syntax-case bindings, if present. (macro_mark): Mark the extra two words if they're there. (scm_make_syncase_macro, scm_make_extended_syncase_macro): OK! A new take at the "how do we represent syncase macros in Guile" problem. Whereas we need a disjoint type, but would like it to be compatible with old predicates (e.g. `macro?'), and need to be able to extend existing syntax definitions (e.g. `cond'), let's add a bit to macros to indicate whether they have syncase macro bindings or not, and a fourth macro type for native syncase macros. (scm_macro_type): Return 'syntax-case for native syntax-case macros. Note that other macro types may have syntax-case bindings. (scm_macro_name): Return #f if the transformer is not a procedure. (scm_syncase_macro_type, scm_syncase_macro_binding): New accessors for the syncase macro bindings. * libguile/macros.h: Add API for syncase macros. * module/ice-9/boot-9.scm (module-define-keyword!): Adapt to use syncase macros, though they are not yet used. Reorder other syncase API. * module/ice-9/psyntax.scm (chi-expr): Fix syntax-violation invocation. 2009-04-26 Andy Wingo <wingo@pobox.com> syntax-dispatch -> $sc-dispatch * module/ice-9/boot-9.scm: * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: Change syntax-dispatch to $sc-dispatch, as it is in current psyntax. The idea is that this isn't really a public variable, though it has to be, currently, so just obscure that fact with an obscure name. build ecmascript stuff last * module/Makefile.am: Wait to build ecmascript until the compiler has bootstrapped. 2009-04-26 Andy Wingo <wingo@pobox.com> syntax-object->datum => syntax->datum, likewise datum->syntax * module/ice-9/boot-9.scm (datum->syntax, syntax->datum): Rename from datum->syntax-object and syntax-object->datum, following r6rs. Change all callers. Reorder some of the other exports from psyntax. * module/ice-9/psyntax.scm: Change datum->syntax and syntax->datum definitions and callers. * module/ice-9/psyntax-pp.scm: Regenerated. * module/oop/goops.scm (define-class-pre-definition): Update for changes. 2009-04-26 Andy Wingo <wingo@pobox.com> replace psyntax's syntax-error with r6rs' syntax-violation * module/ice-9/boot-9.scm (syntax-violation): Well, as long as we have to have a function for indicating syntax errors, let's let it be a well-thought-out one -- syntax-violation from r6rs. No more syntax-error. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Replace instances of syntax-error with syntax-violation. Implement as a scm-error to 'syntax-error, with some nice arguments. 2009-04-26 Andy Wingo <wingo@pobox.com> add module-{define-keyword!,undefine-keyword!,lookup-keyword} * libguile/modules.c (scm_module_local_variable): Allow this to be called before modules are booted with #f as the module. * module/ice-9/boot-9.scm (module-define-keyword!) (module-lookup-keyword, module-undefine-keyword!): Well, if syncase forces us to allow the keyword bindings to be partitioned from value bindings, let's go ahead and do that in boot-9 instead of in psyntax. A step on the way to removing `install-global-transformer'. (sc-chi): Remove. * module/ice-9/psyntax.scm (put-global-definition-hook): (remove-global-definition-hook, get-global-definition-hook): Use our new module-* functions. (sc-chi): Remove, no longer needed. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-26 Andy Wingo <wingo@pobox.com> remove sc-macro definition * module/ice-9/boot-9.scm (sc-macro): Remove sc-macro definition, yay. 2009-04-26 Andy Wingo <wingo@pobox.com> fix module-bound?, start compiling srfi-18.scm * module/Makefile.am (SRFI_SOURCES): Let's finally start compiling srfi-18.scm, what the hell. * module/ice-9/boot-9.scm (module-bound?): module-bound? was returning true if (not (variable-bound? (module-local-variable m v))), but (variable-bound? (module-variable m v)). Fix to cut out on the first variable it finds. This bug has been there for a while now. 2009-04-25 Andy Wingo <wingo@pobox.com> Fix the elisp memoizer code for syncase-in-boot-9 * lang/elisp/interface.scm: * lang/elisp/internals/lambda.scm: * lang/elisp/primitives/syntax.scm: * lang/elisp/transform.scm: Use (lang elisp expand) as the transformer, because we really are intending this code for the memoizer and not the compiler. * lang/elisp/expand.scm: A null expander. * lang/elisp/interface.scm (use-elisp-file, use-elisp-library): * lang/elisp/transform.scm (scheme): Turn these defmacros into procedure->memoizing-macro calls, given that without syncase we have no defmacro either. * lang/elisp/primitives/fns.scm (macroexpand): Comment out, as Scheme's macro expander (temporarily on hiatus) won't work with elisp. 2009-04-25 Andy Wingo <wingo@pobox.com> allow defmacros to have docstrings * module/ice-9/boot-9.scm (define-macro, defmacro): Add the ability to have a docstring. * module/ice-9/documentation.scm (object-documentation): Remove references to defmacro? and macro?. Since we store the transformation procedure as the binding, we can get docs from the procedure directly. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (put-global-definition-hook): Take the type and the value separately, so we can set the variable to the procedure, while keeping the *sc-expander* to be the "binding object". (global-extend): Pass type and val separately. 2009-04-25 Andy Wingo <wingo@pobox.com> all of guile compiles now, expanded with syncase * libguile/eval.c (scm_m_eval_when): Whoops, eval-when has an implicit begin. Fix. * module/oop/goops.scm: Syncase doesn't like definitions in expression context, and grudgingly I have decided to go along with that. But that doesn't mean we can't keep the old semantics, via accessing the module system directly. So do so. I took the opportunity to rewrite some macros with syntax-rules and syntax-case -- the former is nicer than the latter, of course. * module/oop/goops/save.scm: Don't define within an expression. * module/oop/goops/simple.scm (define-class): Use define-syntax. * module/oop/goops/stklos.scm (define-class): Use define-syntax. 2009-04-25 Andy Wingo <wingo@pobox.com> fix bad syntax in define-macro, (ice-9 match), and (oop goops) * module/ice-9/boot-9.scm (define-macro): Use syntax-case to destructure macro arguments, so we get good errors. * module/ice-9/match.scm (defstruct, define-const-structure): Don't unquote in the `defstruct' macro as a value in expansions. * module/oop/goops.scm (standard-define-class): Can't define a macro with `define', use `define-syntax' instead. (define-accessor): Use syntax-rules. Doesn't give us much in this case. (toplevel-define!): New helper, to let us keep GOOPS' behavior with the new expander. Some solution that works lexically and at the toplevel would be nice, though. (define-method): Reimplement with syntax-rules -- soooo much nicer. * module/oop/goops/dispatch.scm (lookup-create-cmethod): Don't define within an expression. 2009-04-24 Andy Wingo <wingo@pobox.com> allow docstrings with internal definitions * module/Makefile.am (SCHEME_LANG_SOURCES): * module/language/scheme/expand.scm: Remove expand.scm, we don't need it any more. * module/ice-9/psyntax.scm (build-lambda, chi-lambda-clause): Support docstrings with internal definitions. What are Scheme people thinking these days? * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo <wingo@pobox.com> make sure we compile boot code in (guile), not (guile-user) * libguile/eval.h: * libguile/eval.c (scm_m_eval_when): Define a cheap eval-when, used before syncase has booted. * module/Makefile.am: Reorder to put (system vm) and (system repl) modules after the compiler, as they are not needed at runtime. * module/ice-9/boot-9.scm: Move the eval-when earlier, to be the first thing -- so when we recompile Guile we do so all in the '(guile) module, not '(guile-user). * module/ice-9/compile-psyntax.scm: Rewrite to assume that psyntax.scm will eval-when to set its module, etc. Have everything in a let -- otherwise the `format' call is in (guile), but `target' was defined in (guile-user). Also, write in an eval-when to the expanded file. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/networking.scm: * module/ice-9/psyntax.scm: * module/ice-9/r4rs.scm: Sprinkles of eval-when, for flavor. 2009-04-24 Andy Wingo <wingo@pobox.com> handle pre-module macro procedures correctly * module/ice-9/psyntax.scm (chi-macro): It's possible for a macro procedure to have no module, if the procedure was made before modules were booted. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo <wingo@pobox.com> Merge branch 'master' into syncase-in-boot-9 2009-04-24 Andy Wingo <wingo@pobox.com> merge ice-9, srfi, oop makfiles into module makefile * configure.in: No longer output the Makefile.ins. * module/Makefile.am: Include the contents of ice-9/, srfi/, and oop/. * module/ice-9/Makefile.am: * module/ice-9/debugger/Makefile.am: * module/ice-9/debugging/Makefile.am: * module/oop/Makefile.am: * module/oop/goops/Makefile.am: * module/srfi/Makefile.am: Removed. 2009-04-24 Andy Wingo <wingo@pobox.com> finish transition to bare/hygiene/public/private * module/ice-9/boot-9.scm (make-module-ref): Remove the transition support. * module/ice-9/psyntax.scm (get-global-definition-hook): Remove transition support. Also remove support for guile-macro. (build-global-reference, build-global-assignment): Remove transition support. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo <wingo@pobox.com> only bend hygiene in macro-introduced output, not for explicit @/@@ * module/ice-9/psyntax.scm * module/ice-9/psyntax-pp.scm * module/ice-9/boot-9.scm (make-module-ref): We were so almost there with what we had, sniff. The deal is that (begin (load "foo.scm") ((@@ (foo) bar))) would expand to (begin (load "foo.scm") (bar)) because bar was unbound at expansion time, and make-module-ref assumed it was like the else in a cond. But it shouldn't have, because we /explicitly/ asked for the @@ var -- so now if we see a @ or @@, we never drop it. @@ introduced by hygiene can be dropped if it doesn't reference a var, though. Practically speaking, this means tagging all modules in psyntax with their intent: public or private (corresponding to @ or @@), hygiene (introduced by a macro), or bare (when we don't have a module). I'm not sure when we'd see a bare. The implementation is complicated by the need to support the old format and the new format at the same time, so that psyntax-pp can be regenerated. 2009-04-24 Andy Wingo <wingo@pobox.com> fix @ and syncase * module/ice-9/boot-9.scm (make-module-ref): equal?, not eq?, when matching on module name. (Module names don't have to come from an invocation of module-name in this process.) * module/ice-9/psyntax.scm (build-global-reference) (build-global-assignment, @): Rework the format of the module in syntax objects so that a car of #f indicates a public reference. Loading (foo %module-public-interface) didn't guarantee that (foo) was loaded and useful. * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/scheme/compile-ghil.scm (lookup-transformer): primitive-macro? does not exist any more. 2009-04-24 Andy Wingo <wingo@pobox.com> ice-9 syncase now deprecated, woo Remove #:use-module (ice-9 syncase) from lots of places, as it's no longer needed. 2009-04-24 Andy Wingo <wingo@pobox.com> it is alive!!!!! + concision + fix to compile-ghil * module/ice-9/boot-9.scm: Remove lots of debugging prints. Remove some already-deprecated attempts to load modules from shared libraries. * module/ice-9/psyntax.scm: If we have to create a variable for a syntactic binding, initialize its contents to a gensym. I'd like something more meaningful, but at least this way we can tell different macros apart. Only warn about missing modules if modules are booted. Chi the value part of a (set! (@ ...) ) expression -- whoops! * module/ice-9/psyntax-pp.scm: Regenerated. * module/language/glil.scm (parse-glil): Fix an unquoting error. * module/language/scheme/compile-ghil.scm: No need to import syncase, we gots it. Rework compiler to expand only once, with syncase, instead of incrementally. Fix define-scheme-transformer to work with syncase, by not referencing bare keywords. It works! 2009-04-24 Andy Wingo <wingo@pobox.com> allow redefinition of global macros to variables * module/ice-9/psyntax.scm: Allow the redefinition of keywords to variables. Otherwise we can't do (define let #f), which is totally useful and stuff. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-24 Andy Wingo <wingo@pobox.com> fix load for syncase-in-boot-9; compile-psyntax works again * module/ice-9/r4rs.scm: * module/ice-9/boot-9.scm (%load-verbosely, assert-load-verbosity) (%load-announce, %load-hook, load): Move these from r4rs.scm to boot-9.scm. * module/ice-9/compile-psyntax.scm: Update to work with syncase-in-boot-9. * module/ice-9/psyntax-pp.scm: Recompiled with syncase-in-boot-9. 2009-04-24 Andy Wingo <wingo@pobox.com> leap of faith: (ice-9 syncase) in psyntax-pp.scm -> (guile) * module/ice-9/psyntax-pp.scm: Manually switch psyntax-pp over to (guile) from (ice-9 syncase). Heh heh. 2009-04-24 Andy Wingo <wingo@pobox.com> syncase early in boot-9, defmacros in terms of syntax-case -- halfway working * module/ice-9/boot-9.scm (eval-when): Remove, as syncase is going to handle this one for us. (sc-expand, sc-expand3, sc-chi, install-global-transformer) (syntax-dispatch, syntax-error, annotation?, bound-identifier=?) (datum->syntax-object, free-identifier=?, generate-temporaries) (identifier?, syntax-object->datum, void, andmap): Oh, ugly of uglies: add these exciting definitions to the main environment. Hopefully we can pull them back out soon. (make-module-ref, resolve-module): Stub these out, as a replacement for expand-support. (%pre-modules-transformer): Define to sc-expand, so that we are using syncase from the very start. (defmacro, define-macro): Define in terms of syntax-case. (macroexpand, macroexpand-1): Remove, there should be a different way to get at this -- though perhaps with the same name. (make-module): Make sc-expand the default module-transformer. (process-define-module): Issue a deprecation warning when using ice-9 syncase. (primitive-macro?): Remove, no meaning... (use-syntax): Deprecate. (define-private, define-public, defmacro-public): Rework in terms of syntax-rules. * module/ice-9/syncase.scm: Gut, as syncase is provided by core now. 2009-04-24 Andy Wingo <wingo@pobox.com> module-name returns '(guile) during boot; psyntax tweak * module/ice-9/boot-9.scm (module-name): Return '(guile) before the module system is booted, for syncase's benefit. Defer redefinition until the module system is booted. * module/ice-9/psyntax.scm (put-global-definition-hook): Only set a variable if it's unbound. * module/ice-9/psyntax.scm: Regenerated. 2009-04-24 Andy Wingo <wingo@pobox.com> more steps on the way to boot-time syncase * module/ice-9/boot-9.scm: Define a version of module-add! for psyntax, before modules are booted. * module/ice-9/psyntax.scm: Remove a warning, and rename a variable. Initialize a new variable to 'sc-macro, though it will have no effect. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-23 Andy Wingo <wingo@pobox.com> I ain't broke, but brother I'm badly bent * module/ice-9/expand-support.scm (strip-expansion-structures): If, when producing @/@@ forms, we find that an @@ variable is not bound in its module, just serialize the symbol. This bends hygiene, in that it can introduce a global (but not lexical) reference in the expanded module, but it seems necessary to not produce (@@ (foo) else) in forms like ((@@ (foo) cond) ((test then) ((@@ (foo) else) bar))). 2009-04-22 Andy Wingo <wingo@pobox.com> fix erroneous #:use-syntax clausen * module/system/repl/command.scm: * module/system/repl/common.scm: * module/system/repl/repl.scm: * module/system/vm/debug.scm: * module/system/vm/trace.scm: Change #:use-syntax to #:use-module, as that's really what we want to do. move pk, peek, and warn to the beginning of boot-9 * module/ice-9/boot-9.scm (peek, pk, warn): Move these helpers up to the top. I like them! (load-compiled): Don't define within an if, syncase doesn't like that. module-name before syncase is booted * module/ice-9/boot-9.scm (module-name): Give psyntax a module-name definition, even before psyntax is booted (in a future commit). 2009-04-21 Andy Wingo <wingo@pobox.com> fix begin-deprecated * module/ice-9/boot-9.scm (begin-deprecated): Fix to output source code, doh. tweaks to boot-9 * module/ice-9/boot-9.scm: Move the r4rs init up to the top. (try-module-autoload): Don't use with-fluids before it's defined. allow eval to be called before modules are booted * libguile/eval.c (scm_eval): If the module system isn't booted, assert not on the module argument. commit some tweaks to expand.scm, likely obviated by syncase though * module/language/scheme/expand.scm (re-annotate, expand): A couple of speculative cases for dealing with syncase better -- but all of this code is likely to go. scm_[current_]module_transformer returns the %pre-modules-transformer, if set * libguile/modules.c (scm_module_transformer) (scm_current_module_transformer): So, if the module system hasn't yet booted, take the current transformer from a variable named %pre-modules-transformer from the %pre-modules-obarray. This is a prequel to booting syncase early in boot-9. 2009-04-21 Andy Wingo <wingo@pobox.com> make syncase aware of (set! (@ (foo) bar) baz) * module/ice-9/psyntax.scm (set!): Handle (set! (@ (foo ..) bar) val) inside syncase. Heh heh heh. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-04-21 Andy Wingo <wingo@pobox.com> syncase knows about @ / @@ * module/ice-9/psyntax.scm (syntax-type): Handle a new type, module-ref. Like external-macro, it also has a procedure as a binding. (chi-expr): module-ref forms -- that is to say, (@ (foo ...) bar) -- as expressions they are global references, but with respect to a specific module. (@, @@): Define module-ref syntax handlers. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/syncase.scm: Mark as primitive syntax so we don't clobber their definitions. The reason I'm doing things like this is so as to support (set! (@@ ...) ...) sensibly, which will be the next patch. 2009-04-21 Andy Wingo <wingo@oblong.net> distcheck fixen * examples/Makefile.am: Fix the installed guile-config invocation to set PKG_CONFIG_PATH. * meta/Makefile.am (EXTRA_DIST): Dist the bin_SCRIPTS. * meta/guile-config (pkg-config): Better error messages if pkg-config invocation fails. * meta/uninstalled-env.in (PATH): Now that guile-config and guile-tools are not generated, make it the srcdir/meta instead of the builddir. (Guile itself will be picked up from libguile.) 2009-04-20 Andy Wingo <wingo@pobox.com> Merge branch 'syncase' 2009-04-20 Andy Wingo <wingo@wingomac.bcn.oblong.net> fix guile.m4 for sitedir change * meta/guile.m4 2009-04-20 Andy Wingo <wingo@wingomac.bcn.oblong.net> scripts take rest args * meta/guile-tools: Instead of fixing scripts I should have been fixing the script runner. * module/scripts/compile.scm: * module/scripts/snarf-guile-m4-docs.scm: Fix to take rest args. 2009-04-20 Andy Wingo <wingo@wingomac.bcn.oblong.net> some more build fixes for bugs that I introduced * meta/guile-1.8.pc.in: Include a pkgdatadir, which will map down to `guile-config info pkgdatadir', used in existing guile.m4 files. * meta/guile-config: Fix guile-config info varname. Facepalm. * meta/guile.m4: Make GUILE_SITE_DIR use the sitedir variable instead. Really it should use pkg-config directly, though. 2009-04-20 Andy Wingo <wingo@wingomac.bcn.oblong.net> fix build errors on fresh checkout * meta/guile-tools: We can't use srfi-1, because on a fresh checkout the srfi-1 shlib isn't built yet. Bummer. * meta/uninstalled-env.in: Fix up the DYLD lines for BSDen. * module/scripts/snart-guile-m4-docs.scm: Fix expected arguments. 2009-04-20 Andy Wingo <wingo@oblong.net> fix m4->texi snarfage after the guile-tools change * doc/ref/Makefile.am: Fix to work after a make clean with the recent guile-tools changes. 2009-04-17 Andy Wingo <wingo@pobox.com> no positions when reading psyntax-pp, validation in @/@@, cleanups * module/ice-9/syncase.scm (old-debug): Re-disable position recording when reading psyntax-pp. * libguile/eval.c (scm_m_at, scm_m_atat): More input validation. * libguile/debug.c (scm_procedure_module): Use scm_env_module. Remove extraneous docstring. 2009-04-17 Andy Wingo <wingo@pobox.com> fix hygiene + modules + local macros * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (syntax-type): Look up the type of the car of a form relative to its module, if it is a syntax object. Fixes hygiene wrt modules and private macros. * module/ice-9/syncase.scm (sc-macro): Add a comment. * module/system/base/pmatch.scm: The big test case: just export pmatch, not ppat too. 2009-04-17 Andy Wingo <wingo@pobox.com> fix handling of pre-modules errors in the vm * libguile/vm-i-system.c (toplevel-ref, toplevel-set): Correct situation whereby we would not throw when toplevel vars were unbound, before modules had booted. 2009-04-17 Andy Wingo <wingo@pobox.com> @ and @@ as primitive macros * libguile/eval.h: * libguile/eval.c (error_unbound_variable, error_defined_variable): Move these prototypes up earlier. (scm_m_at, scm_m_atat): New functions, provide the @ and @@ functionality. Moved here from defmacros because they are "special", inasmuch as syncase doesn't really understand them in interpreted code. * module/ice-9/boot-9.scm (@, @@): Don't define as defmacros, as defmacros have to actually return source now. 2009-04-17 Andy Wingo <wingo@pobox.com> hygienic compilation * module/language/scheme/compile-ghil.scm (lookup-transformer): Recognize macros as initial (@ ...) or (@@ ...) forms, enabling hygienic compilation. 2009-04-17 Andy Wingo <wingo@pobox.com> houston, we have hygiene * module/ice-9/expand-support.scm (strip-expansion-structures): Enable @/@@ substitution. * module/ice-9/psyntax-pp.scm: Recompile. * module/ice-9/psyntax.scm: Since syntax objects are quotable, make the module field the module name, not the module itself. Scope the operand of global calls appropriately. Thread modules through syntax-dispatch destructuring. Houston, we have hygiene. * module/ice-9/syncase.scm: Adapt to module / module-name changes. 2009-04-17 Andy Wingo <wingo@pobox.com> more work on modules and hygiene, not finished yet, alas. * module/ice-9/compile-psyntax.scm: No more expansion-eval-closure. * module/ice-9/expand-support.scm (strip-expansion-structures): Only @@ names whose module is not the current module. Actually @@ serialization is disabled for this commit, just to get this one in and keep things working. * module/ice-9/psyntax-pp.scm: Recompiled. * module/ice-9/psyntax.scm (put-global-definition-hook) (get-global-definition-hook): Instead of going through that stupid getprop/putprop interface, let's just inline Guile-specific code here. (build-global-reference, build-global-assignment): Fix a bug where the module and public? were switched, which happily allowed things to compile. (We reintroduce a similar bug above in expand-support.) (lookup): Add a module argument. (global-extend): Adapt for put-global-definition-hook invocation. (syntax-type): Lookup with mod. Return mod even for lexicals and define-form -- why not. (chi-top, fluid-let-syntax, syntax, set!): Lookup with mod. Wrap with mod. * module/ice-9/syncase.scm (expansion-eval-closure) (current-eval-closure, env->eval-closure): OK! So the idea is: module hygiene is syncase's business, not ours. So lose the eval-closure fluid. Also, eval closures are so 1990s. (sc-macro): But, we have to take the module from the env, sadly. In the future this will be different. Remove the rest of the eval-closure bits. Enable source reporting, while we're debugging. * module/language/scheme/compile-ghil.scm (lookup-transformer): Adapt for eval closure fluid changes. 2009-04-17 Andy Wingo <wingo@pobox.com> eval-closure-module, here hopefully not for long * libguile/modules.h: * libguile/modules.c (scm_eval_closure_module): Define a new-yet-deprecated accessor, to ease a transition. 2009-04-17 Andy Wingo <wingo@pobox.com> thread the module through syntax-case's expansion * libguile/debug.h: * libguile/debug.c (scm_procedure_module): New procedure, returns the module that was current when the given procedure was defined. Used by syncase to scope free identifiers. * module/ice-9/psyntax-pp.scm: Recompiled. * module/ice-9/psyntax.scm: Thread the module through the syntax expansion. This is harder than it would appear because in many places the different components of syntax objects are destructured. * module/ice-9/syncase.scm (guile-macro): Adapt to new signature for syntax transformer functions. 2009-04-17 Andy Wingo <wingo@pobox.com> finish bootstrap to syntax-objects with modules * module/ice-9/psyntax.scm: Now that we have gone through the intermediate step (in which both representations of syntax-object had to coexist), change all callers to make-syntax-object to pass the third argument, and restore the define-structure definition of syntax objects. * module/ice-9/psyntax-pp.scm: Recompile. 2009-04-17 Andy Wingo <wingo@pobox.com> add modules to syntax objects (part 1, intermediate step) * module/ice-9/psyntax.scm (make-syntax-object): As an intermediate step to adding modules to syntax objects, replace the definition of syntax-object as a structure with an expanded-out definition that has (1) a constructor that takes 2 or 3 arguments, and (2) a predicate that works with vectors of length 3 or 4. I couldn't just redefine make-syntax-object, for example, because these are internal definitions, and we can't have duplicate bindings in a letrec. 2009-04-17 Andy Wingo <wingo@pobox.com> serialize module information into syncase's output -- getting ready for hygiene * module/ice-9/Makefile.am: Replace annotate.scm with expand-support.scm. * module/ice-9/annotate.scm: Removed; subsumed into expand-support.scm. * module/ice-9/compile-psyntax.scm: Strip out expansion structures before writing to disk. * module/ice-9/expand-support.scm: New file. Provides annotation support, and other compound data types for use by the expander. Currently the only one that is used is the toplevel reference, <module-ref>, but we will record lexicals this way soon. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/psyntax.scm (build-global-reference) (build-global-assignment): Instead of expanding out global references as symbols, expand them as <module-ref> structures, with space to record the module that they should be scoped against. This is in anticipation of us actually threading the module info through the syntax transformation, so that we can get hygiene with respect to modules. * module/ice-9/syncase.scm: Replace eval-when. Since sc-expand will give us something that isn't Scheme because we put the <module-ref> structures in it, strip that info whenever we actually do need scheme. * module/language/scheme/compile-ghil.scm (lookup-transformer): Strip expansion structures here too. * module/language/scheme/expand.scm (language): Swap annotate for expand-support. But this file will die soon, I think. 2009-04-17 Andy Wingo <wingo@pobox.com> fix a tricky GC bug in scm_c_make_subr * libguile/procs.c (scm_c_make_subr): Fix a really tricky bug!!! If scm_double_cell caused GC, the symbolic name wouldn't be marked. But the symptom wouldn't appear until you accessed that symbol much later, for example during tab completion / apropos grovelling. Not sure why we didn't see this earlier. 2009-04-17 Andy Wingo <wingo@pobox.com> guile-tools is a scheme script that loads scheme modules * meta/guile-tools: Changed to be a scheme script. Instead of looking for executables in a "scripts dir", we just look for modules in (scripts), and load the modules directly. * module/Makefile.am: * module/scripts/: Move the scripts into module/ so they can be compiled. Rename scripts from `foo' to `foo.scm'. * libguile/Makefile.am: Invoke the snarf->texi code via guile-tools. * configure.in: * .gitignore: Update for changes. 2009-04-17 Andy Wingo <wingo@pobox.com> fix a couple gc-related continuations bugs Thanks to Juhani Rantanen for the report. * libguile/continuations.c (scm_make_continuation): Delay making the smob until the data is fully initialized. Fixes a bug whereby a GC in scm_vm_capture_continuations would catch the us with an undefined continuation->vm_conts, leading to marking badness. * libguile/vm.c (vm_cont_free): Report the correct size to scm_gc_free. 2009-04-16 Andy Wingo <wingo@pobox.com> support expression-by-expression compilation * module/language/ghil.scm (unparse-ghil): Fix unparsing of quasiquoted expressions. * module/language/ghil/spec.scm (join): Define a joiner for GHIL. * module/language/scheme/compile-ghil.scm (cenv-ghil-env): Expand the definition of a CENV so it can have an actual ghil-env, if available. (compile-ghil): Return the actual ghil env in the cenv. * module/system/base/compile.scm (compile-file): Rewrite. `output-file' is now a keyword argument, along with the new kwargs `env' and `from'. We now allow exceptions to propagate up, and instead of printing the output file to the console, we return a string corresponding to its location. (compile-and-load): Use read-and-compile. (compile-fold): Thread around the cenv as well. Return all three values. (find-language-joint, read-and-compile): New exciting helpers. The idea is that compiling a file should be semantically equivalent to compiling each expression in it, one by one. Compilation can have side effects, e.g. affecting the current language or the current reader. So what we do is find a point in the compilation path at which different expressions of a given language can be joined into one. Expressions from the source language are compiled to the joint language, then joined and compiled to the target. (compile): Just return the first value from compile-fold. * module/system/base/language.scm (language-joiner): New optional field. * scripts/compile: Rework for changes to compile-file. 2009-04-16 Andy Wingo <wingo@pobox.com> compilation passes return third value: the continuation environment * module/system/base/compile.scm: Expect compile passes to produce three values, not two. The third is the "continuation environment", the environment that can be used to compile a subsequent expression from the same source language. For example, expansion-time side effects can set the current module, which would be reflected appropriately in the continuation environment. * module/language/assembly/compile-bytecode.scm: * module/language/bytecode/spec.scm: * module/language/ecmascript/compile-ghil.scm: * module/language/ghil/compile-glil.scm: * module/language/glil/spec.scm: * module/language/objcode/spec.scm: * module/language/scheme/compile-ghil.scm: * module/system/base/compile.scm: Update compile passes to return a continuation environment. 2009-04-06 Andy Wingo <wingo@pobox.com> guile-config rebased on top of pkg-config * configure.in: * meta/Makefile.am (EXTRA_DIST): Remove guile-config.in bits. * meta/guile-config: Reimplement to work on top of pkg-config. This lets guile-config not be substed by configure. * meta/uninstalled-env.in: Remove the path to guile-config, belatedly. Set the pkg-config path correctly. 2009-04-05 Ludovic Courtès <ludo@gnu.org> Avoid uses of deprecated forms in the VM code. Reported by Daniel Kraft <d@domob.eu>. * libguile/frames.c, libguile/vm.c: Include <stdlib.h>, use `size_t' instead of `scm_sizet'. * libguile/objcodes.c, libguile/programs.c, libguile/vm-engine.c, libguile/vm-i-loader.c, libguile/vm-i-system.c: Use `scm_list_X ()' instead of the deprecated `SCM_LISTX ()'. 2009-04-05 daniel <daniel@dani.localdomain.invalid> Make `--disable-deprecated' work. * configure.in (enable_deprecated): Set SCM_WARN_DEPRECATED_DEFAULT even when --disable-deprecated is passed. * libguile/deprecation.h: Declare deprecation-issuing methods even if SCM_ENABLE_DEPRECATED is not set. * libguile/deprecation.c: Ditto. (scm_init_deprecation): Include full body even for unset SCM_ENABLE_DEPRECATED. 2009-04-04 Jose A. Ortega Ruiz <jao@gnu.org> Improved handling of callers cache in (system xref). * We cache callees in each module, and keep a list of modified ('tainted') modules, which is used to reconstruct the callers database incrementally. * `procedure-callers' now returns an a-list, keyed by module name. 2009-04-04 Andy Wingo <wingo@pobox.com> fix nondeterminism in vm-i-system.c * libguile/vm-i-system.c (br-if-eq, br-if-not-eq): Fix some nondeterminism caught by GCC 4.4. 2009-04-03 Andy Wingo <wingo@pobox.com> no hard-coded stack limitations if the user has getrlimit * libguile/debug.c (init_stack_limit): Instead of "1 MB or 80% of rlimit, whichever is lower", just use 80% of the rlimit, if set. 2009-03-31 Andy Wingo <wingo@pobox.com> add test case for load-extension bug, fix gdb-uninstalled-guile * test-suite/standalone/test-extensions: * test-suite/standalone/test-extensions-lib.c: * test-suite/standalone/Makefile.am: Add a test case for the load-extension bug. * meta/gdb-uninstalled-guile.in: Fix the path to include meta/. 2009-03-29 Andy Wingo <wingo@pobox.com> Merge branch 'wingo' fix duplicates in procedure-callers * module/system/xref.scm (ensure-callers-db): OK! Since we can see the same variable twice, e.g. in different modules, keep a unified hash of seen vars and modules. Prevents duplicates in procedure-callers. fix spurious duplicates in procedure-callees and callers * module/system/xref.scm (program-callee-rev-vars): It's possible to get duplicates when combining callees of inner procedures, so ignore dups. Quadratic, boo. 2009-03-28 Andy Wingo <wingo@pobox.com> bugfix: don't dynamic link if we found a registered extension * libguile/extensions.c (load_extension): Don't do dynamic linking if we actually did find an extension in the list. 2009-03-28 Andy Wingo <wingo@pobox.com> frame, program, objcode, etc inits use load-extension * libguile/extensions.h: Define a scm_t_extension_init_func. * libguile/frames.c: * libguile/instructions.c: * libguile/objcodes.c: * libguile/programs.c: * libguile/vm.c: Register extension init funcs. Should play nicer with a static Guile, in addition to working on Darwin with non-default installation prefixes without munging DYLD_LIBRARY_PATH. * module/system/vm/frame.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: Use load-extension. 2009-03-28 Andy Wingo <wingo@pobox.com> fix distcheck hopefully, by cleaning the vm-i-*.i files * libguile/Makefile.am (CLEANFILES): Clean vm-i-*.i. fix "linking" of guile-config * meta/guile-config.in: Adjust "linking"; @bindir@ doesn't get fully expanded. So instead use a shell trampoline. fix check for guile-tools running uninstalled * meta/guile-tools.in (mydir): Fix check for running uninstalled. 2009-03-27 Andy Wingo <wingo@pobox.com> rely on getrlimit to DTRT, don't make stack calibration file * libguile/measure-hwm.scm: Remove. * .gitignore: Update for removal. * test-suite/standalone/test-fast-slot-ref.in: * test-suite/standalone/test-use-srfi.in: * am/guilec: * check-guile.in: Revert back to normal guile invocation. * libguile/Makefile.am: Don't make a stack calibration file, as the getrlimit-based limit setting should work fine. 2009-03-27 Andy Wingo <wingo@pobox.com> getrlimit-based stack limits * libguile/debug.c (init_stack_limit): Initialize the stack limit based on operating system limits (via getrlimit(2)), or 1 MB -- whichever is smaller. 2009-03-27 Andy Wingo <wingo@pobox.com> add getrlimit and setrlimit wrappers * README: Some rewording. * configure.in: Check for getrlimit and setrlimit. * libguile/posix.h: * libguile/posix.c: Add some getrlimit and setrlimit wrappers. They're documented, but I suspect something else has to be done to get them into the manual. 2009-03-27 Andy Wingo <wingo@pobox.com> allow building against uninstalled guile; move some things to meta/ * README: Add more info about building against an uninstalled Guile. * meta/: New directory. The proximate cause of its creation is that I want to be able to build external packages against uninstalled Guile, and to do that I need guile-tools in the PATH, but I don't want $top_builddir/libtool in the path. But it seems like a good reorganization, for things that are /about/ Guile: pkg-config files, m4 files, guile-config... then we also include uninstalled info: the environment, the pre-inst-guile script, etc. * meta/guile-1.8-uninstalled.pc.in: New pkg-config template. pkg-config prefers -uninstalled pkg-config files, if they are in its path. * meta/Makefile.am: * meta/ChangeLog-2008: * meta/gdb-uninstalled-guile.in: * meta/guile-1.8.pc.in: * meta/guile-config.in: * meta/guile.m4: * meta/guile-tools.in: Moved to meta/. * meta/guile.in: This is the new name of pre-inst-guile.in. * meta/uninstalled-env.in: And this, pre-inst-guile-env.in. * Makefile.am: * am/guilec: * am/pre-inst-guile: * check-guile.in: * configure.in: * doc/ref/Makefile.am: * gc-benchmarks/run-benchmark.scm: * test-suite/standalone/Makefile.am: * test-suite/standalone/README: * testsuite/Makefile.am: Adapt to meta/ change. 2009-03-27 Ludovic Courtès <ludo@gnu.org> Improve wording in `libguile/Makefile.am' regarding stack calibration. * libguile/Makefile.am (stack-limit-calibration.scm): Improve wording of the comment. Suggested by Neil Jerram. 2009-03-26 Ludovic Courtès <ludo@gnu.org> Run the stack calibration script before running the compiler. * am/guilec (.scm.go): Use `pre-inst-guile' and load `stack-limit-calibration.scm'. This is particularly useful when building the first `.go' files where the compiler is run using the interpreter, which may end up using a lot of stack space. * libguile/Makefile.am (BUILT_SOURCES): Add `stack-limit-calibration.scm'. (TESTS, TESTS_ENVIRONMENT): Remove. (stack-limit-calibration.scm): Prepend `-' so that any errors during the calibration are ignored. 2009-03-26 Ludovic Courtès <ludo@gnu.org> Remove multiple definition of `scm_i_marking'. * libguile/private-gc.h (scm_i_marking): Turn definition into a declaration. (scm_mark_all): Mark as `SCM_INTERNAL'. * libguile/gc-mark.c (scm_i_marking): New definition. 2009-03-25 Ludovic Courtès <ludo@gnu.org> Fix `testsuite/Makefile.am' for `distcheck'. * testsuite/Makefile.am (check_SCRIPTS): Remove, renamed to `TESTS'. (EXTRA_DIST): Add $(TESTS). 2009-03-24 Ludovic Courtès <ludo@gnu.org> Aggregate `Makefile.am' files under `examples/'. * configure.in: Don't produce `examples/*/Makefile'. * examples/Makefile.am (SUBDIRS): Remove. (EXTRA_DIST, AM_CFLAGS, AM_LIBS): New. (box/box, box/box.o, box-module/box, box-module/box.o, libbox.la, box-dynamic/box.lo, libbox-module.la, box-dynamic-module/box.lo, installcheck, CLEANFILES, clean-local): New targets, aggregated from `Makefile.am' files formerly in sub-directories. * examples/check.test: New file, aggregated from `check.test' files in sub-directories. 2009-03-24 Ludovic Courtès <ludo@gnu.org> Include <alloca.h> in `gsubr.c'. * libguile/gsubr.c: Include <alloca.h>. Reported by Carlo Bramini <carlo.bramix@libero.it>. 2009-03-22 Ludovic Courtès <ludo@gnu.org> Remove unneeded SMOB mark procedure in `i18n.c'. * libguile/i18n.c (smob_locale_mark): Remove. (scm_init_i18n): Remove `scm_set_smob_mark ()' call. 2009-03-22 Ludovic Courtès <ludo@gnu.org> Remove references to `scm_in_heap_p ()'. * libguile/gc.c (scm_i_expensive_validation_check): Don't call `scm_in_heap_p ()'. Cells don't necessarily live in the heap nowadays. * libguile/gc.h (scm_in_heap_p): Remove declaration. 2009-03-22 Ludovic Courtès <ludo@gnu.org> Remove unneeded VM SMOB mark/free procedures. * libguile/vm.c (vm_mark_stack, vm_cont_mark, vm_cont_free, vm_mark, vm_free): Remove. (scm_bootstrap_vm): Remove corresponding `scm_set_smob_mark ()' and `scm_set_smob_free ()' calls. * libguile/frames.c (vm_frame_mark, vm_frame_free): Remove. (scm_bootstrap_frames): Remove `scm_set_smob_mark ()' and `scm_set_smob_free ()' calls. * libguile/objcodes.c (objcode_mark): Remove. (scm_bootstrap_objcodes): Remove call to `scm_set_smob_mark ()'. * libguile/programs.c (program_mark): Remove. (scm_bootstrap_programs): Remove call to `scm_set_smob_mark ()'. 2009-03-22 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/continuations.c libguile/gc-freelist.c libguile/gc-mark.c libguile/symbols.c libguile/threads.c module/ice-9/boot-9.scm 2009-03-20 Andy Wingo <wingo@pobox.com> speed up goops rehashing * module/oop/goops/dispatch.scm (cache-try-hash!): Speed up goops rehashing, in theory. I haven't measured, though. fix interpreted methods with empty bodies * module/oop/goops.scm (method): If a method has no body, subst in `(if #f #f)' instead of `(begin)', to please the memoizer. add generic method-formals; fixes to method-source * module/oop/goops.scm (method-source): Don't throw an error if this method has no source. (method-formals): New generic function, the complement of method-specializers for introspection. fix casts to unsigned long in objcodes.c * libguile/objcodes.c (scm_c_make_objcode_slice): Fix casts to unsigned long. 2009-03-19 Ludovic Courtès <ludo@gnu.org> Have `scm_take_locale_symbol ()' return an interned symbol (fixes bug #25865). * libguile/symbols.c (intern_symbol): New function, with code formerly duplicated in `scm_i_c_mem2symbol ()' and `scm_i_mem2symbol ()'. (scm_i_c_mem2symbol, scm_i_mem2symbol): Use it. (scm_take_locale_symboln): Use `intern_symbol ()'. This fixes bug #25865. * test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_SOURCES, test_scm_take_locale_symbol_CFLAGS, test_scm_take_locale_symbol_LDADD): New variables. (check_PROGRAMS, TESTS): Add `test-scm-take-locale-symbol'. 2009-03-18 Andy Wingo <wingo@pobox.com> rework procedure-callers to stay correct as callees are redefined * module/system/xref.scm (procedure-callers): Rework to calculate the callers of a *variable*, not of a value. This is because the module-observers only get fired when the module changes, not with the variables change values. Also accept either a variable, a symbol (resolved in the current module), or a modname . symname pair. doubly-weak callers db * module/system/xref.scm (ensure-callers-db): Store the callers db as a doubly-weak hash table. 2009-03-18 Andy Wingo <wingo@pobox.com> implement procedure-callers * module/system/xref.scm: Implement procedure-callers, as the inverse of procedure-callees, with a cache invalidated by changes in modules. * module/ice-9/boot-9.scm (module-use!): Don't poke module observers when module-use! is called for an already-used module. 2009-03-17 Andy Wingo <wingo@pobox.com> add xref stub for interpreted procedures * module/system/xref.scm (hacky-procedure-callees): Add a procedure-callees implementation for procedures with source, that currently does nothing. Not sure what to do, going into the future. 2009-03-17 Andy Wingo <wingo@pobox.com> add xref.scm * module/system/xref.scm: New module, will provide callers/callees info. * module/Makefile.am (SOURCES): Add xref.scm. 2009-03-17 Andy Wingo <wingo@pobox.com> tweaks to the un-integrated test cases * testsuite/Makefile.am: Sortof turn these VM tests into more automake-like tests. Needs further work. 2009-03-17 Andy Wingo <wingo@pobox.com> non-srcdir build fixes * guile-tools.in: Fix the checks to account for non-srcdir builds. * libguile/frames.c: * libguile/objcodes.c: * libguile/programs.c: * libguile/instructions.c: * libguile/vm.c: Fix snarf-includes to cope with non-srcdir builds. * libguile/instructions.h: * libguile/instructions.c: Fix the stubs inclusion to be non-srcdir compatible. * libguile/vm-expand.h (VM_DEFINE_INSTRUCTION): Fix some things so as not to require the instructions.h defintitions, since we have the codes already. Not important tho :) * pre-inst-guile-env.in: Minor tweak that should have no effect. * test-suite/standalone/Makefile.am (all-local): Remove a chmod +x step, the configure.ac rule should do that if necessary. 2009-03-17 Andy Wingo <wingo@pobox.com> try a new way of checking byte order decompile source info into <glil-source> annotations. * module/language/glil/decompile-assembly.scm (decompile-load-program): Decompile source information into <glil-source> annotations. fix bug serializing filenames in source locations * module/language/glil/compile-assembly.scm (limn-sources): Fix bug whereby filename was serialized as a ("foo") instead of "foo". 2009-03-17 Andy Wingo <wingo@pobox.com> tweaks to asm->glil decompiler, perhaps fix a (program-source p 0) bug * module/language/ghil/compile-glil.scm (codegen): Push a program's source locations before copying external args to heap -- perhaps fixes (program-source p 0) for some programs. * module/language/glil/decompile-assembly.scm (decompile-load-program): Take another arg, the object vector. Emit <glil-bind> and <glil-unbind> correctly. Properly unparse properties. Just have to deal with source locations now. 2009-03-17 Andy Wingo <wingo@pobox.com> add assembly->glil decompiler * module/language/glil/decompile-assembly.scm: A first pass at an assembly->glil decompiler. Works for a small subset of programs. * module/Makefile.am (GLIL_LANG_SOURCES): * module/language/glil/spec.scm (glil): Add the decompiler. 2009-03-17 Andy Wingo <wingo@pobox.com> update disassembler for changes to decompiler * module/language/assembly/disassemble.scm (disassemble-load-program) (code-annotation): And update the disassembler for changes to decompiler. parse jumps as labels when decompiling bytecode->assembly * module/language/assembly/decompile-bytecode.scm (decode-load-program): Parse out jumps as labels. procedure-arity on vm-compile apply: verily, unresolved. * test-suite/tests/procprop.test ("procedure-arity"): Procedure-property 'arity on "apply" will fail if "apply" is a program. I suggest that procedure-property is actually the wrong interface for this; if we even want to preseve the old arity forms, we should have an accessor for arity directly that the VM can implement. But in the meantime throw this nasty error while we decide. 2009-03-17 Andy Wingo <wingo@oblong.net> Merge commit 'cb9d473112ac172a3d328bb029b5b550918d4262' into vm-check 2009-03-17 Andy Wingo <wingo@oblong.net> Merge commit 'e20d7001c3f7150400169fecb0bf0eefdf122fe2' into vm-check Conflicts: libguile/stacks.c 2009-03-17 Andy Wingo <wingo@oblong.net> fix marking of double-cell subrs * libguile/gc-mark.c (scm_gc_mark_dependencies): Mark the name, generic, and properties of subrs. Merge commit 'e092357058850a6f998bf462bdc5504c6379c96f' into vm-check Merge commit 'feccd2d3100fd2964d4c2df58ab3da7ce4949a66' into vm-check Merge commit 'cce8b2ce93703aff953750fb40cb53176ea66504' into vm-check Merge commit '4c9e29ec38350a5206aa3e8e72ad4376512ada2b' into vm-check Merge commit 'ad5f5ada1d50ecdab634d60ffe3a13b9193156aa' into vm-check Merge commit '95a040cd2be7ad03bf197edbdb1fec2c52749ef6' into vm-check Merge commit '6290d3f10927f887102a164ccb1a7291cc62288d' into vm-check Merge commit '5bb2d903b9e54fdd5858a16ba11fa91a9dc0c692' into vm-check Merge commit '04795a1cb259c20896fb2edb50c58086027281b0' into vm-check Merge commit '202271f291971cf14175f5a1a193955f72d43d79' into vm-check Merge commit 'c010924a71f942100dc7b4021d5ef1c6decf9c85' into vm-check 2009-03-17 Andy Wingo <wingo@oblong.net> Merge commit '53d81399bef1d9396665e79fb6b9c25eb8e2a6ad' into vm-check Also cherry-picks the changes from 1405f1b60fa178303484cd428068ecd01ff6d322 Conflicts: module/ice-9/session.scm 2009-03-17 Andy Wingo <wingo@oblong.net> Merge commit 'ab878b0f8e675a741a7dd56f52638a7cc0419907' into vm-check Merge commit 'cbee5075d69cb057c4af4c5e24319da90367897f' into vm-check Merge commit '32a2609de06af65341e6b4db6961557b788821e8' into vm-check Merge commit 'e95d11110b7af0f528404d28209c3a464ab7074d' into vm-check 2009-03-17 Andy Wingo <wingo@oblong.net> Merge commit '752be95a475132506c35922d284884cf776149d0' into vm-check Conflicts: INSTALL 2009-03-17 Andy Wingo <wingo@oblong.net> Merge commit '8b0174c879bf74981efe702a00471ed5b8e6912e' into vm-check 2009-03-17 Andy Wingo <wingo@pobox.com> revert annotation support in syncase. another day perhaps. * module/ice-9/syncase.scm: Revert support for annotations, as I'm seeing wierd problems whereby syntax-object->datum does not fully strip its input. 2009-03-16 Ludovic Courtès <ludo@gnu.org> Allow the static allocation of all types of subrs. This is a follow-up to 46f9baf49a8ea4461e8494c75a88b87d0f5c5195 ("Allow the static initialization of subrs.") and e20d7001c3f7150400169fecb0bf0eefdf122fe2 ("Remove "compiled closures" ("cclos") in favor of a simpler mechanism."). * libguile/procs.h (SCM_SUBR_ARITY_TO_TYPE): Return the appropriate type for gsubrs instead of returning -1. * libguile/Makefile.am (snarf-gsubr.h): Remove target. (BUILT_SOURCES, nodist_modinclude_HEADERS, MOSTLYCLEANFILES): Remove `snarf-gsubr.h'. * libguile/snarf.h (SCM_DEFINE)[SCM_SUPPORT_STATIC_ALLOCATION]: Don't include "libguile/snarf-gsubr.h". (SCM_DEFINE_SUBR_reqX_optY_rstZ): Remove. 2009-03-16 Ludovic Courtès <ludo@gnu.org> Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc Conflicts: libguile/procs.h 2009-03-09 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. 2009-03-08 Andy Wingo <wingo@pobox.com> Fix errors when stripping annotations * module/ice-9/annotate.scm (set-annotation-stripped!): Fix prototype to correspond to what syncase needs. * module/ice-9/psyntax.scm (strip-annotation): Use `if', not `when', for portability. * module/ice-9/psyntax-pp.scm: Regenerate. 2009-03-08 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/gc-card.c libguile/gc-mark.c Aggregate `Makefile.am' files under `lang/'. * lang/Makefile.am (SUBDIRS): Remove. (elisp_sources): Aggregate the value of `elisp_SOURCES' formerly found in sub-directories' `Makefile.am'. Move `guardians.test' to its own module. * test-suite/tests/guardians.test: Add `define-module' clause. 2009-03-08 Ludovic Courtès <ludo@gnu.org> Provide a C vararg interface to gsubr invocation. * libguile/eval.i.c (CEVAL): Update calls to `scm_i_gsubr_apply ()' with a fixed number of arguments. Use `scm_i_gsubr_apply_list ()' for calls with a list of arguments of unknown length. (SCM_APPLY): Use `scm_i_gsubr_apply_list ()' instead of `scm_i_gsubr_apply ()'. * libguile/gsubr.c (gsubr_apply_raw): New. (scm_i_gsubr_apply): Change to take a C vararg list instead of a Scheme list. Use `gsubr_apply_raw ()'. (scm_i_gsubr_apply_list): Use `gsubr_apply_raw ()'. * libguile/gsubr.h (scm_i_gsubr_apply): Update prototype. (scm_i_gsubr_apply_list): New declaration. 2009-03-08 Ludovic Courtès <ludo@gnu.org> Slightly simplify gsubr invocation in the evaluator. * libguile/eval.i.c (CEVAL): Remove the `cclon' label; replace jumps to `cclon' with `RETURN (scm_i_gsubr_apply (...))'. Add new subr invocation benchmarks. * benchmark-suite/benchmarks/subr.bm (hook1, hook3): New variables. ("subr invocation")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. ("subr application")("generic subr with rest arg", "generic subr with rest arg and 3+ parameters"): New benchmarks. 2009-03-06 Andy Wingo <wingo@pobox.com> actually use syncase's source information tracking. rock! * module/ice-9/annotate.scm (deannotate/source-properties): Version of deannotate that sets source properties on the resulting expressions. * module/ice-9/syncase.scm (sc-macro, syncase): Annotate expressions before they go into syncase, and deannotate/source-properties when they come out. The upshot is that syncase now understands source information, yay! 2009-03-06 Andy Wingo <wingo@pobox.com> modify psyntax so it produced annotated source if given annotated source * module/ice-9/psyntax.scm (build-annotated): New helper, used by the output constructors. (build-application, build-conditional, build-lexical-reference) (build-lexical-assignment, build-global-reference) (build-global-assignment, build-global-definition, build-lambda) (build-primref, build-data, build-sequence, build-let) (build-named-let, build-letrec, build-lexical-var): Use build-annotated, so we produce annotated source if we have source information. * module/ice-9/psyntax-pp.scm: Regenerated. 2009-03-06 Andy Wingo <wingo@pobox.com> support source-level annotations in syncase * module/ice-9/annotate.scm (<annotation>): Slightly more concise printing. (annotate): Don't create annotations if we have no source info. * module/ice-9/psyntax.scm (annotation?): Remove this definition, as we now provide annotation support. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/syncase.scm: Use (ice-9 annotate). * module/language/scheme/expand.scm (eval-when): Define the eval-when transformer. 2009-03-06 Andy Wingo <wingo@pobox.com> fix eval-when statements in boot-9 * module/ice-9/boot-9.scm: Fix a couple eval-when statements. 2009-03-06 Andy Wingo <wingo@pobox.com> Replace eval-case with eval-when * module/ice-9/boot-9.scm (eval-when): Replace eval-case with eval-when. Eval-when is *much* simpler, and more expressive to boot. Perhaps in the future we'll get 'visit and 'revisit too. * module/ice-9/deprecated.scm (eval-case): Provide mostly-working deprecated version of eval-case. * module/ice-9/boot-9.scm (defmacro, define-macro): Relax condition: we can make defmacros that are not at the toplevel now. But in the future we should replace this implementation of defmacros with one written in syntax-case. (define-module, use-modules, use-syntax): Allow at non-toplevel. (define-public, defmacro-public, export, re-export): Don't evaluate at compile-time, I can't see how that helps things. Allow `export' and `re-export' at non-toplevel. * module/ice-9/getopt-long.scm: * module/ice-9/i18n.scm: * module/oop/goops.scm: * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: Switch to use eval-when, not eval-case. * module/language/scheme/compile-ghil.scm (eval-when): Replace eval-case transformer with eval-when transformer. Sooooo much simpler, and it will get better once we separate expansion from compilation. * module/language/scheme/expand.scm (quasiquote): Hm, expand quasiquote properly. Not hygienic. Syncase needed. (lambda): Handle internal defines with docstrings propertly. 2009-03-02 Andy Wingo <wingo@pobox.com> fixups to expand.scm * module/language/scheme/expand.scm: Some changes to avoid unnecessary begins or empty lets, and properly handle internal defines (finally). 2009-03-02 Andy Wingo <wingo@pobox.com> add separate expansion phase, to detwingle things a bit * module/language/scheme/expand.scm: New module, implements a separate expansion phase, not interleaved with compilation. * module/language/scheme/amatch.scm: Helper for expand.scm, it's pmatch with support for annotated source. * module/ice-9/Makefile.am (SOURCES): Add annotate.scm to build list -- early on because it will be used in the compiler. * module/ice-9/annotate.scm: Fix the printer, default to unstripped (whatever that is), and add a deannotator. * module/system/base/compile.scm (call-with-compile-error-catch): Fix for new representation of source locations. * module/Makefile.am (SCHEME_LANG_SOURCES): Add amatch and expand. 2009-03-02 Andy Wingo <wingo@pobox.com> fix printer in struct docs * doc/ref/api-compound.texi (Vtables): Fix example printer. add annotation module * module/ice-9/annotate.scm: Add annotation module, for source location tracking with syncase, and for internal use in the compiler. 2009-03-02 Ludovic Courtès <ludo@gnu.org> Mark `scm_gsubr_apply ()' as internal. * libguile/gsubr.h (scm_gsubr_apply): Renamed to... (scm_i_gsubr_apply): this. Marked as `SCM_INTERNAL'. Callers updated. 2009-03-02 Ludovic Courtès <ludo@gnu.org> Remove "compiled closures" ("cclos") in favor of a simpler mechanism. The idea is to introduce `gsubrs' whose arity is encoded in their type (more precisely in the sizeof (void *) - 8 MSBs). This removes the indirection introduced by cclos and simplifies the code. * libguile/__scm.h (CCLO): Remove. * libguile/debug.c (scm_procedure_source, scm_procedure_environment): Remove references to `scm_tc7_cclo'. * libguile/eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2): Replace `scm_tc7_cclo' with `scm_tc7_gsubr'. * libguile/eval.i.c (CEVAL): Likewise. No longer make PROC the first argument. Directly invoke `scm_gsubr_apply ()' instead of jump to the `evap(N+1)' label or call to `SCM_APPLY ()'. * libguile/evalext.c (scm_self_evaluating_p): Remove reference to `scm_tc7_cclo'. * libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name): Likewise. * libguile/gc-mark.c (scm_gc_mark_dependencies): Likewise. * libguile/goops.c (scm_class_of): Likewise. * libguile/print.c (iprin1): Likewise. * libguile/gsubr.c (create_gsubr): Use `unsigned int's for REQ, OPT and RST. Use `scm_tc7_gsubr' instead of `scm_makcclo ()' in the default case. (scm_gsubr_apply): Remove calls to `SCM_GSUBR_PROC ()'. (scm_f_gsubr_apply): Remove. * libguile/gsubr.h (SCM_GSUBR_TYPE): New definition. (SCM_GSUBR_MAX): Changed to 33. (SCM_SET_GSUBR_TYPE, SCM_GSUBR_PROC, SCM_SET_GSUBR_PROC, scm_f_gsubr_apply): Remove. * libguile/procprop.c (scm_i_procedure_arity): Remove reference to `scm_tc7_cclo'; add proper handling of `scm_tc7_gsubr'. * libguile/procs.c (scm_makcclo, scm_make_cclo): Remove. (scm_procedure_p): Remove reference to `scm_tc7_cclo'. (scm_thunk_p): Likewise, plus add proper `scm_tc7_gsubr' handling. * libguile/procs.h (SCM_CCLO_LENGTH, SCM_MAKE_CCLO_TAG, SCM_SET_CCLO_LENGTH, SCM_CCLO_BASE, SCM_SET_CCLO_BASE, SCM_CCLO_REF, SCM_CCLO_SET, SCM_CCLO_SUBR, SCM_SET_CCLO_SUBR, scm_makcclo, scm_make_cclo): Remove. * libguile/stacks.c (read_frames): Remove reference to `scm_f_gsubr_apply'. * libguile/tags.h (scm_tc7_cclo): Remove. (scm_tc7_gsubr): New. (scm_tcs_subrs): Add `scm_tc7_gsubr'. 2009-03-02 Ludovic Courtès <ludo@gnu.org> Change `scm_gsubr_apply ()' to take the gsubr as its first argument. * libguile/gsubr.c (scm_gsubr_apply): Make SELF the first argument instead of the first element of ARGS. * libguile/gsubr.h: Update. * libguile/eval.i.c (CEVAL): Update. 2009-03-02 Ludovic Courtès <ludo@gnu.org> Add subr invocation benchmark. * benchmark-suite/Makefile.am (SCM_BENCHMARKS): Add `subr.bm'. 2009-02-28 Ludovic Courtès <ludo@gnu.org> Move `guardians.test' to its own module. * test-suite/tests/guardians.test: Add `define-module' clause. Increase chances that `guardians.test' can be successfully run. * test-suite/tests/guardians.test: Document overall test sloppiness. ("g2-garbage saved"): Document failure. ("guarding independent objects")["guarding non-immediate", "guarding two non-immediates", "re-guarding non-immediates"]: Improve chances to remove references to the dying object left on the stack. ("guarding weakly referenced objects")["guarded weak vector element gets returned from guardian"]: Likewise. ("guarding weak containers")["element of guarded weak vector gets collected"]: Likewise. ("guarding objects more than once")["guarding twice in one guardian", "guarding twice in two guardians"]: Likewise. Add `DEBUG_GUARDIANS' macro for guardian finalization debugging. * libguile/guardians.c (finalize_guarded): Use `#ifdef DEBUG_GUARDIANS' instead of `#if 0'. Add " guardian for %p vanished\n" debugging statement. 2009-02-27 Andy Wingo <wingo@pobox.com> make the ES compiler more readable via use of -> * module/language/ecmascript/compile-ghil.scm: Use -> to make the ES compiler more readable. Fix bugs in do, while, and for, whereby we were missing ->boolean calls. use -> macro in scheme->ghil compiler * module/language/scheme/compile-ghil.scm (->): New macro, makes GHIL generation a bit more palatable. Use it in all the transformers. 2009-02-27 Andy Wingo <wingo@pobox.com> slight optimization in transform-record, note in optimize* * module/language/ghil/compile-glil.scm (optimize*): Add a note. * module/system/base/syntax.scm (transform-record): Access the common slots once at the beginning. Cuts down on the number of toplevel refs needed by the generated code. 2009-02-27 Andy Wingo <wingo@pobox.com> introduce -> binding inside transform-record body expressions * module/system/base/syntax.scm (transform-record): Introduce a -> binding inside the body, that produces records of the same type. * module/language/ghil/compile-glil.scm (optimize*): Remove our ->ghil definition, as transform-record introduces a -> binding for us. Nice. 2009-02-27 Andy Wingo <wingo@pobox.com> first stabs as s-expression-driven transformation of GHIL * module/language/ghil/compile-glil.scm (optimize*): Rewritten optimizer -- not yet in use, but it's closer to the code that I'd like to write. * module/system/base/syntax.scm (transform-record): New crazy macro, makes GHIL a little less painful to work with. 2009-02-27 Andy Wingo <wingo@pobox.com> common slot accessors are procedures-with-setters * module/system/base/syntax.scm (define-type): Common slot accessors are also procedures-with-setters. 2009-02-27 Andy Wingo <wingo@pobox.com> use common slots mechanism in ghil * module/system/base/syntax.scm (define-type): Fix getter for common slot. * module/language/ghil.scm (<ghil>): Use the common slots mechanism. 2009-02-27 Andy Wingo <wingo@pobox.com> define-type has #:common-slots * module/system/base/syntax.scm (define-type): Accept a #:common-slots argument, defining slots that are in all instances of this type. 2009-02-25 Andy Wingo <wingo@pobox.com> fix variable not initialized spurious warnings * libguile/vm-i-system.c: Work around some spurious "variable not initialized" messages on Etch's gcc. don't crash etch's gcc * libguile/vm-engine.h: Don't allocate registers in registers if we're on Etch's GCC. 2009-02-25 Andy Wingo <wingo@pobox.com> export procedure-arguments from ice-9 session * module/system/vm/program.scm (program-arguments): New function, used by procedure-arguments. * module/ice-9/session.scm (procedure-arguments): New exported function, returns an alist describing the given procedure. 2009-02-24 Ludovic Courtès <ludo@gnu.org> Aggregate makefiles for `module/system' and `module/language'. * am/guilec (.scm.go): Create the target's directory, in case $(builddir) != $(srcdir). * configure.in: Don't output any makefile under `module/system' or `module/language'. * module/Makefile.am (SUBDIRS): Remove `language' and `system'. Add `.' to the front. (modpath, SOURCES, SCHEME_LANG_SOURCES, ECMASCRIPT_LANG_SOURCES, GHIL_LANG_SOURCES, GLIL_LANG_SOURCES, ASSEMBLY_LANG_SOURCES, BYTECODE_LANG_SOURCES, OBJCODE_LANG_SOURCES, VALUE_LANG_SOURCES): New variables, taken from former `Makefile.am' files in sub-directories. 2009-02-24 Andy Wingo <wingo@pobox.com> unbork the repl * module/system/repl/repl.scm (meta-reader): Whoops, unbork the repl. in meta-reader, return directly if the peeked char is EOF * module/system/repl/repl.scm (meta-reader): If the (next-char #t) returns EOF, return that EOF directly, as it seems that with guile -q, the subsequent `read' actually waits for another C-d. Dunno why. use umask when making permissions on .go files * module/system/base/compile.scm (call-with-output-file/atomic): Temp files get created 0600. After we're done writing, chmod them to something in line with the user's umask. use nobase in am/guilec * am/guilec (nobase_mod_DATA): Use nobase_mod_DATA so we install to the correct dir for foo/bar.scm. 2009-02-22 Andy Wingo <wingo@pobox.com> parse division vs regexps properly * module/language/ecmascript/tokenize.scm (make-tokenizer/1): Whoops, fix the cases in which we detect that division is valid. 2009-02-22 Andy Wingo <wingo@pobox.com> compile for-in * module/language/ecmascript/base.scm (prop-keys): New method, returns the list of keys of props of this instance. * module/language/ecmascript/impl.scm: Refactor the global object into a special kind of module object. Provide a prop-keys implementation for module objects. * module/language/ecmascript/compile-ghil.scm (comp): Compile for-in. * module/language/ecmascript/impl.scm: Reshuffly things, and implement make-enumerator, a helper for use in for-in statements. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix parsing of for (var foo in bar) {}... 2009-02-22 Andy Wingo <wingo@pobox.com> fix "for" compilation * module/language/ecmascript/compile-ghil.scm (comp): Whoops, fix `for' compilation. add scheme integration to js via `require' * module/language/ecmascript/impl.scm: Add <js-module-object>, that wraps a module. Add js-require, a javascript-happy function that returns an object that wraps a Guile module. Bind it to `require' in the default environment. ecmascript tokens have source info * module/language/ecmascript/tokenize.scm: Attach source information to tokens. We have to enhance the lalr parser to actually let this information propagate through, though... throw SyntaxError on bad syntax * module/language/ecmascript/parse.scm (syntax-error): * module/language/ecmascript/tokenize.scm (syntax-error): Throw an error on bad syntax. 2009-02-22 Andy Wingo <wingo@pobox.com> more arithmetic on non-numbers * module/language/ecmascript/compile-ghil.scm (comp): Convert to number on unary +. * module/language/ecmascript/impl.scm: Define -, *, /, <, <=, >=, > operations on non-numbers. 2009-02-22 Andy Wingo <wingo@pobox.com> + for strings, global js object, new Foo() works * module/language/ecmascript/array.scm (*array-prototype*): Declare the constructor. * module/language/ecmascript/base.scm (pput, pdel): Remove some needless checks. (new): Move definition of new here, and use the constructor. * module/language/ecmascript/compile-ghil.scm (compile-ghil): Add a stub so that when we load a compiled JS program, we make sure the runtime has been booted. * module/language/ecmascript/function.scm (js-constructor): Export a js-constructor method instead of a new method. * module/language/ecmascript/impl.scm (<js-global-object>): Define a new class for the global "this" object, wrapping bindings from the current module. (init-js-bindings!): Define the dozen or so global properties, in the current module. (+): Define addition operations for non-numbers. This is efficient because the generics are only dispatched if the fast-path fails. 2009-02-21 Andy Wingo <wingo@pobox.com> compile ecmascript's parser. yay! instant load-time! * module/language/ghil/compile-glil.scm (codegen): If there are more than 255 arguments, make a list and use apply instead of calling directly. * module/language/Makefile.am: Now we can compile parse.scm. Yay! * module/language/scheme/compile-ghil.scm: Add a note. * module/language/ecmascript/compile-ghil.scm: Add a note. 2009-02-21 Andy Wingo <wingo@pobox.com> be smarter about allocating local variables, reusing slots if possible * module/language/Makefile.am: OK, we can compile compile-ghil.scm now, thankfully. * module/language/ecmascript/compile-ghil.scm (ormatch): New macro, a wrapper around pmatch to avoid some of the more egregious non-tail recursiveness. (comp): Use ormatch. * module/language/ghil.scm (unparse-ghil): The body of bind and mv-bind is a single expression, not a list of expressions. * module/language/ghil/compile-glil.scm (codegen): Be more clever when allocating "local" variables -- if a variable goes out of scope, its index can be re-used later. * module/language/glil.scm (parse-glil, unparse-ghil): The "rest" of a mv-bind is a flag, not a list. The "ra" of an mv-call is a label, not a GLIL expression. * module/language/objcode/spec.scm (collapse-locals, decompile-value): When decompiling a value, process the bindings list differently. Comments in the code. * module/language/scheme/compile-ghil.scm (define-scheme-translator): Fix the generated error procedure. (let): Re-indent. (letrec): Re-indent. * module/system/base/syntax.scm (record-case): If the body of a clause is null, fill it with the unspecified value. 2009-02-21 Andy Wingo <wingo@pobox.com> implement break and continue, work around overly recursive pmatch expansion * libguile/vm-i-system.c (goto/args): On a tail call to a different procedure, init the locals to valid scheme values. Shouldn't matter for well-compiled scheme, but inspecting uninitialized locals could give garbage, or badly-compiled code could cause a crash. * module/language/Makefile.am (NOCOMP_SOURCES): For the moment, don't compile compile-ghil.scm. I need to fix this. * module/language/ecmascript/compile-ghil.scm (load-toplevel): Sigh, and disable stack checking in the evaluator too. Grr. (comp): Implement (unnamed) break and continue. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix var statements in `for' -- though it still doesn't work. 2009-02-21 Ludovic Courtès <ludo@gnu.org> Fix `.go' compilation for $(builddir) != $(srcdir). * am/guilec (.scm.go): Use "-o $@" to make sure the output file ends up in $(builddir). 2009-02-21 Ludovic Courtès <ludo@gnu.org> Add `-o'/`--output' option to "guile-tools compile". * module/system/base/compile.scm (compile-file): Add optional OUTPUT-FILE argument. * scripts/compile (fail): New procedure. (%options): Add `-o'/`--output' option. (compile): Handle `-o'. 2009-02-21 Andy Wingo <wingo@pobox.com> implement do, while, for * module/language/ecmascript/compile-ghil.scm (comp): Use ghil-bind when making temp vars, so that disassembly understands things. Implement do, while, and for. * module/language/ecmascript/parse.scm (parse-ecmascript): Some tweaks. * module/language/ecmascript/impl.scm (language): Export ->boolean. 2009-02-21 Andy Wingo <wingo@pobox.com> implement more operations * module/language/ecmascript/base.scm: Implement some more robust property getters that convert strings to symbols. Implement has-property?. * module/language/ecmascript/compile-ghil.scm (comp): Implement lots more mathematical operators. We now do all expressions; on to statements. * module/language/ecmascript/impl.scm: Define some math helpers. They probably need to call ->number on some things. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix a typo. 2009-02-21 Andy Wingo <wingo@pobox.com> clean up ++ and -- a little bit * module/language/ecmascript/compile-ghil.scm (comp): Define let1 and begin1 helpers. Use them in pre- and post- increment and decrement. 2009-02-21 Andy Wingo <wingo@pobox.com> implement ++, --, new, delete, void, typeof * module/language/ecmascript/compile-ghil.scm (@impl): Implement with @implv. (comp): Implement ++ and -- (pre- and post-). Quite a pain. I'll be looking for ways to simplify this notation. Also implement new, delete, and void. * module/language/ecmascript/impl.scm: Implement typeof. 2009-02-21 Andy Wingo <wingo@pobox.com> handle "this" in ecmascript * module/language/ecmascript/base.scm: * module/language/ecmascript/compile-ghil.scm: * module/language/ecmascript/impl.scm: * module/language/ecmascript/parse.scm: Compile "method calls" in such a way that "this" gets propagated correctly. implement more of the standard runtime * module/language/Makefile.am: * module/language/ecmascript/impl.scm: * module/language/ecmascript/array.scm: * module/language/ecmascript/base.scm: * module/language/ecmascript/function.scm: Split out the runtime into different files. Implement more of the spec's runtime. 2009-02-20 Ludovic Courtès <ludo@gnu.org> Fix interpretation of `(ice-9 getopt-long)'. * module/ice-9/getopt-long.scm (define-one-option-spec-field-accessor, define-one-option-spec-field-modifier): Eval-case for `load-toplevel' as well so that the interpreter can load this module. Fix compilation of `(ice-9 getopt-long)'. * module/ice-9/getopt-long.scm (option-spec-fields): Enclose in a `(load-toplevel compile-toplevel)' `eval-case'. (define-one-option-spec-field-accessor, define-one-option-spec-field-modifier): Enclose in a `compile-toplevel'-only `eval-case'. Add `-L'/`--load-path' option to "guile-tools compile". * scripts/compile (%options): Add `-L'/`--load-path'. (parse-args): Have `load-path' default to '(). (compile): Handle `--load-path' option. Change "guile-tools compile" to use SRFI-37 to process options. * scripts/compile (%options): Rewrite in SRFI-37 style. (parse-args): New procedure. (compile): Update to SRFI-37. Make the `module-defer-observers-mutex' recursive. * module/ice-9/boot-9.scm (module-defer-observers-mutex): Made recursive. See http://lists.gnu.org/archive/html/guile-devel/2009-02/msg00068.html for an example where it matters. 2009-02-19 Andy Wingo <wingo@pobox.com> support foo["bar"] in addition to foo.bar * module/language/ecmascript/parse.scm (parse-ecmascript): And update the function declaration forms for the new var syntax. * module/language/ecmascript/compile-ghil.scm (comp): Support foo["bar"] in addition to foo.bar. * module/language/ecmascript/impl.scm (pget, pput): Some fixes for when we get non-symbols -- it can happen, yo. I suppose we should allow for non-string keys too.. 2009-02-19 Andy Wingo <wingo@pobox.com> implement object literals * module/language/ecmascript/impl.scm: * module/language/ecmascript/compile-ghil.scm (comp): Object literals. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix some object literal parsing. 2009-02-19 Andy Wingo <wingo@pobox.com> var at toplevel works too * module/language/ecmascript/compile-ghil.scm (comp): Fix the var form at toplevel. 2009-02-19 Andy Wingo <wingo@pobox.com> property gets and puts implemented, yays * module/language/ecmascript/compile-ghil.scm (@impl): Ok, don't recurse on args here. (comp): Implement property gets and puts and lexical assignment. (comp-body): Fix scanning of var forms. * module/language/ecmascript/impl.scm (prop-attrs): Allow for the prop attr array to be #f. * module/language/ecmascript/parse.scm (parse-ecmascript): Fix assignment parsing. 2009-02-19 Andy Wingo <wingo@pobox.com> add array support * module/language/ecmascript/compile-ghil.scm (@impl): Whoops, fix this macro. (comp): Handle array literals. * module/language/ecmascript/impl.scm: Add support for arrays. 2009-02-19 Andy Wingo <wingo@pobox.com> further ecmascript work * libguile/vm-i-system.c (drop, return): Declare drop and return as popping one arg from the stack. * module/language/ghil/compile-glil.scm: * module/language/glil/compile-assembly.scm (make-meta): Adjust so that we declare 'drop and 'return calls as popping one arg from the stack. * module/language/ecmascript/compile-ghil.scm (comp, comp-body): Flesh out a bit more. Most significantly, scoping within functions obeys javascript semantics better, modulo bits about with() forms. * module/language/ecmascript/impl.scm: Define some runtime helper routines. * module/language/Makefile.am (SOURCES): Add impl.scm. * module/language/ecmascript/parse.scm (parse-ecmascript): Minor tweaks. * module/language/ecmascript/tokenize.scm (read-identifier): Identifiers now read as symbols, not strings. 2009-02-18 Andy Wingo <wingo@pobox.com> add more ecmascript compilation -- functions work now * module/language/ecmascript/parse.scm (parse-ecmascript): Lambdas always just have one member in their bodies. * module/language/ecmascript/compile-ghil.scm (comp): Add some more silly compilers. 2009-02-18 Ludovic Courtès <ludo@gnu.org> Add `load-unsigned-integer' instruction. * libguile/vm-i-loader.c (load_unsigned_integer): New loader. * module/language/assembly.scm (byte-length): Handle `load-unsigned-integer'. * module/language/assembly/compile-bytecode.scm (write-bytecode): Likewise. * module/language/glil/compile-assembly.scm (dump-object): Emit a `load-unsigned-integer' instruction for positive integers. This fixes loading of integers greater than 2^31 - 1. * testsuite/Makefile.am (vm_test_files): Add `t-literal-integers.scm'. * doc/ref/vm.texi (Loading Instructions): Add `load-unsigned-integer'. 2009-02-18 Andy Wingo <wingo@pobox.com> world's stupidest ecmascript compiler * module/language/ecmascript/spec.scm: Add language spec for ecmascript. * module/language/ecmascript/compile-ghil.scm: Add a stupid compiler. * module/language/Makefile.am: Buildage. 2009-02-18 Andy Wingo <wingo@pobox.com> add ecmascript parser * module/language/ecmascript/parse-lalr.scm: Add the Boucher/Bison lalr parser. This is from guile-lib, but with : changed to -> so as not to molest `prefix' keywords. Should probably be elsewhere. * module/language/ecmascript/parse.scm: Add parser for ECMAScript. Rules from the spec, 3rd edition. * module/language/ecmascript/tokenize.scm: Add ECMAScript tokenizer, hand-written. Neat stuff. * module/language/Makefile.am: Autofoo. 2009-02-17 Andy Wingo <wingo@pobox.com> lengths written out in native endianness * module/language/assembly/compile-bytecode.scm (write-bytecode): Write out the lengths that are mapped to struct scm_objcode using native endianness. 2009-02-17 Andy Wingo <wingo@oblong.net> avoid deprecated functions in SCM_VALIDATE_VECTOR_LEN * libguile/validate.h (SCM_VALIDATE_VECTOR_LEN): Don't use deprecated functions. 2009-02-17 Ludovic Courtès <ludo@gnu.org> Add tests for the stack inspection API. * test-suite/tests/eval.test (stack->frames): New procedure. ("stacks"): New test prefix. Add new GOOPS tests for built-in types. * test-suite/tests/goops.test ("classes for built-in types"): New test prefix. 2009-02-16 Ludovic Courtès <ludo@gnu.org> Add test for `procedure-properties'. * test-suite/Makefile.am (SCM_TESTS): Add `tests/procprop.test'. 2009-02-14 Andy Wingo <wingo@pobox.com> better alignment * module/language/assembly.scm (align-program): Whoops, align programs properly. * module/language/glil/compile-assembly.scm (compile-assembly): Start with addr=-1, for the unserialized load-program byte. (glil->assembly): Align programs in all cases. 2009-02-14 Ludovic Courtès <ludo@gnu.org> Change `compiled-file-name' to preserve the input file's directory. * module/system/base/compile.scm (compiled-file-name): Prepend "(dirname file)" so that "guile-tools compile foo/bar.scm" produces "foo/bar.go", not "bar.go". 2009-02-14 Andy Wingo <wingo@pobox.com> align programs on 8-byte boundaries * module/language/assembly.scm (addr+): New helper. (align-program): New function, aligns a (load-program) form, currently to 8-byte boundaries. * module/language/glil/compile-assembly.scm (<subprogram>): Record the object table and the program code separately, so that we can align the program after the object table has been written. (glil->assembly): Use addr+. (dump-object): Rework to fold `addr' through dumping of compound objects, so that procedures can be aligned properly. 2009-02-14 Andy Wingo <wingo@pobox.com> re-enable assembly packing * module/language/glil/compile-assembly.scm (glil->assembly): Enable assembly packing, for e.g. (make-int8:0). 2009-02-14 Ludovic Courtès <ludo@gnu.org> Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc Conflicts: .gitignore libguile/procs.h Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/gc-mark.c libguile/procs.c libguile/procs.h libguile/threads.c libguile/threads.h 2009-02-14 Andy Wingo <wingo@pobox.com> a slight add-method speedup * module/oop/goops.scm (add-method-in-classes!): Use memq instead of memv. 2009-02-14 Andy Wingo <wingo@pobox.com> generate the fixed-offset accessors at compile-time * module/language/scheme/compile-ghil.scm (define-scheme-translator): Only add an else clause if the transformer didn't have one. * module/oop/goops.scm (min-fixnum, max-fixnum): Define at compile-time as well. (@slot-ref, @slot-set!): Only define transformers for these at compile-time. Avoids loading up the compiler unnecessarily. Also, allow for the `n' to be determined lexically, in which case we dispatch to the primitive. (num-standard-pre-cache, define-standard-accessor-method) (bound-check-get, standard-get, standard-set): Rework the fixed-offset getters and setters so that they can be computed at compile-time. Accessors to fields with n > num-standard-pre-cache will be dispatched to the primitive instead of within the VM. 2009-02-13 Andy Wingo <wingo@pobox.com> don't re-enter the compiler during method dispatch * libguile/goops.c (scm_make): In the pre-inst `make', default `procedure' to #f, and read a `make-procedure' instead of `compile-env'. * libguile/goops.h (scm_si_make_procedure): This instead of scm_si_compile_env. * module/oop/goops.scm (make-method): Remove this unused function. Users should use (make <method> ...) directly. (method): Capture `make-procedure' instead of `procedure' in the case that the body calls a next-method. Allows for the kind of "recompilation" that we were using before, but with closures instead of re-entering the compiler. Type-specific compilation is still interesting, but probably should be implemented in another way. (initialize): Default #:procedure to #f, and s/compile-env/make-procedure/. * module/oop/goops/compile.scm (code-table-lookup): Just return the cmethod, not the entry -- since the entry is now just (append types cmethod). (compile-make-procedure): New procedure, returns a form that, when evaluated/compiled, will yield a procedure of one argument, the next-method. When called with a next-method, the procedure returns an actual method implementation. compile-make-procedure returns #f if the body doesn't call next-method. (compile-method): Unify to always return procedures. Much cleaner and *much* faster in the compiled case. In the interpreted case, there might be a slight slowdown, but if there is one it should be slight. * module/oop/goops/dispatch.scm (method-cache-install!): Adapt to removal of compute-entry-with-cmethod. 2009-02-13 Andy Wingo <wingo@pobox.com> flush output when writing .go files * module/system/base/compile.scm (call-with-output-file/atomic): Close the port we are writing to before renaming it, so that we flush output. Might fix some 0-length write errors that Jao was seeing. inline record predicates into record-case * module/system/base/syntax.scm (record-case): Inline record predicates into the record-case. Shaves off a few more milliseconds from a GOOPS load. 2009-02-13 Andy Wingo <wingo@pobox.com> no keyword arguments in GHIL / GLIL, just optional args -- faster compiles * module/system/base/syntax.scm (define-record): So, in the generated constructors, allow optional arguments, but not keyword arguments. Conses much less in the constructors. (define-record/keywords): And the old define-record is here. * module/language/ghil.scm (parse-ghil): * module/language/ghil/compile-glil.scm (codegen): * module/language/scheme/compile-ghil.scm (translate-1, quote) (quasiquote): Don't use keywords in this compiler hotpath. * module/system/base/language.scm (<language>): * module/system/repl/common.scm (<repl>): * module/system/vm/debug.scm (<debugger>): Use define-record/keywords. 2009-02-12 Ludovic Courtès <ludo@gnu.org> Link with `-z relro' when available. * acinclude.m4 (GUILE_GNU_LD_RELRO): New macro. * configure.in: Use `GUILE_GNU_LD_RELRO'. 2009-02-12 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. Small cleanup relative to the use of double cells for subrs. * libguile/procs.c (scm_c_make_subr): Remove comments about the number of subrs, improve formatting. 2009-02-12 Ludovic Courtès <ludo@gnu.org> Use double-cells to store subrs. * libguile/procs.c (scm_subr_table, scm_subr_table_size, scm_subr_table_room, subr_table_gc_hint, scm_init_subr_table, scm_mark_subr_table): Remove. (scm_c_make_subr): Simply return a double-cell, with the procedure name and properties stored in a two-element array. (scm_free_subr_entry): Free the meta-info slot. * libguile/init.c (scm_i_init_guile): Remove call to `scm_init_subr_table ()'. * libguile/procs.h (SCM_SUBR_META_INFO): New macro. (SCM_SNAME, SCM_SUBR_PROPS): Use it. (SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): Update. (scm_t_subr_entry, SCM_SUBR_ENTRY, SCM_SUBRNUM, scm_subr_table, scm_mark_subr_table, scm_init_subr_table): Remove. 2009-02-11 Ludovic Courtès <ludo@gnu.org> Add `SCM_SET_SUBR_GENERIC ()' to replace `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/goops.c (scm_c_extend_primitive_generic): Use `SCM_SET_SUBR_GENERIC ()' instead of using `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/procs.c (scm_c_make_subr_with_generic): Use `SCM_SET_SUBR_GENERIC_LOC ()'. * libguile/procs.h (SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): New macros. 2009-02-11 Ludovic Courtès <ludo@gnu.org> Use `SCM_SNAME ()' when requesting the name of a subr. * libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Use `SCM_SNAME ()' instead of `SCM_SUBR_ENTRY (subr).name'. * libguile/procs.c (scm_c_define_subr_with_generic, scm_makcclo): Likewise. (scm_c_make_subr_with_generic): Same with `SCM_SUBR_GENERIC ()'. 2009-02-11 Ludovic Courtès <ludo@gnu.org> Small cleanup relative to the use of double cells for subrs. * libguile/procs.c (scm_c_make_subr): Remove comments about the number of subrs, improve formatting. * libguile/Makefile.am: Comment the generation of `snarf-gsubr.h'. 2009-02-11 Andy Wingo <wingo@pobox.com> provide program apply_0, apply_1, apply_2 implementations * libguile/programs.c (program_apply_0, program_apply_1) (program_apply_2, scm_bootstrap_programs): Provides some cons-less smob application procedures. This molests some internal interfaces, but hey, we're internal. 2009-02-11 Andy Wingo <wingo@pobox.com> speed up record-case * module/language/ghil.scm: Whoops, export some unquote-splicing accessors that we didn't have exported before. * module/system/base/syntax.scm: Speed up record-case, by syntactically determining the predicates and accessors. Nasty, in a way; but also much faster. 2009-02-10 Andy Wingo <wingo@pobox.com> match bare literals with eq? in pmatch, not equal? * module/system/base/pmatch.scm (ppat): Match atoms with eq?, not equal?. This speeds up compilation considerably, as we never match against numbers or strings or what-have-you. Note, you can match against literals with equal? via quoting the literal in the pattern. 2009-02-10 Andy Wingo <wingo@pobox.com> propagate much more source info through compilation * module/language/ghil/compile-glil.scm (codegen): Record source location for offset 0 into a lambda, if we can. * module/language/scheme/compile-ghil.scm (translate-1) (define-scheme-translator): In the retrans procedures, propagate the location information from the enclosing expression if the subexpression has no location information. Gives source information to many more expressions. (location): Just propagate the source properties as they are, the glil->assembly compiler will interpret them. * module/language/glil.scm (<glil>): Change glil-source to take "props" and not "loc", as it's the source properties that we're interested in. * module/language/glil/compile-assembly.scm (limn-sources): New function, takes a list of addr-source property pairs and "compresses" them for serialization to disk. (glil->assembly): Limn the sources before writing them to disk. Avoid non-tail recursion when determining total byte length of code. * module/system/vm/program.scm (source:file, source:line, source:column): Update for new source representation. (program-source): Export. (write-program): Nicer pretty-printing of anonymous procedures. * libguile/backtrace.c (display_backtrace_get_file_line): Update for the new VM source representation. * libguile/programs.h: * libguile/programs.c (scm_program_sources): Update for the new serialized source representation, where the filename is not in the stream unless it changes. (scm_program_source): New exported function, looks up the source for a given ip offset. (scm_c_program_source): Update to return the last source information that was <= the given IP, because we only serialize source info when it changes. 2009-02-09 Neil Jerram <neil@ossau.uklinux.net> Merge branch 'master' into ossau-gds-dev Clean lib-version.texi * doc/ref/Makefile.am (CLEANFILES): Add lib-version.texi. 2009-02-09 Andy Wingo <wingo@pobox.com> nicety in the compiler * module/language/scheme/compile-ghil.scm (lookup-transformer): Use @@. Delightfully metacircular. allow defmacros to unquote in macros into expanded expressions * module/language/scheme/compile-ghil.scm (lookup-transformer): Allow macros to be unquoted into the car of any form that results from macro expansion. This lets modules export defmacros built on other defmacros that are not exported. 2009-02-09 Andy Wingo <wingo@pobox.com> minor cleanups * libguile/stacks.c (scm_make_stack): Instead of aborting when we misread the number of stack frames, just print a warning. I'd like to figure out what these cases are, exactly. * module/language/scheme/compile-ghil.scm (lambda): Reindent the lambda transformer. * module/system/base/compile.scm (call-with-compile-error-catch): Write the expression instead of displaying it. (call-with-output-file/atomic): Don't actually redirect output to this port, as it's not necessary -- the language-printer should respect the port that we pass. 2009-02-08 Neil Jerram <neil@ossau.uklinux.net> Merge branch 'master' into ossau-gds-dev 2009-02-08 Neil Jerram <neil@ossau.uklinux.net> Allow @ to work with (ice-9 syncase) (Reported by Panicz Maciej Godek.) * test-suite/tests/syncase.test ("@ works with syncase"): New test. * ice-9/syncase.scm (guile-macro): When a Guile macro transformer produces a variable, don't pass it through sc-expand. 2009-02-08 Neil Jerram <neil@ossau.uklinux.net> Fix build when compiled with -Wundef -Werror (Reported by David Fang) * libguile/inline.h: Check if __APPLE_CC__ is defined before testing its value. 2009-02-05 Andy Wingo <wingo@pobox.com> fix the ping-pong between evaluator and vm stacks in make-stack * libguile/frames.c (vm_frame_print): Add a frame printer. * libguile/stacks.c (stack_depth, read_frames): Only switch the VM stack for boot program dframes. * libguile/vm-engine.c (VM_NAME): Push one debug frame per invocation, unconditionally. (If we push them at all, of course.) 2009-02-05 Andy Wingo <wingo@pobox.com> fix boot program detection, which in turn makes `make-stack' actually work * libguile/programs.h (SCM_F_PROGRAM_IS_BOOT, SCM_PROGRAM_IS_BOOT): Flags for determining if a program is a boot program. It turns out that our heuristics e.g. in stacks.c would catch non-boot programs, like programs that end with (goto/args 1), because the 1 is the same byte as `halt'. That took a while to find... * libguile/stacks.c (stack_depth, read_frames): Use the new boot prog macros. (scm_make_stack): Assert that we read the number of frames that we said we would. * libguile/vm.c (really_make_boot_program): Mark boot programs appropriately. 2009-02-05 Andy Wingo <wingo@pobox.com> in debug mode, make sure that calls to the vm can be captured via make-stack * libguile/vm-engine.c (VM_PUSH_DEBUG_FRAMES): New knob, if true we much with the scm_i_last_debug_frame when entering the VM, because sometimes the evaluator doesn't do it for us. (VM_ENGINE): Plug through debug frame fondling. Now, program exit comes back to the main text. Rename err_args to finish_args, and reuse for the return value. * libguile/vm-engine.h (PUSH_LIST): * libguile/vm-i-loader.c: * libguile/vm-i-scheme.c: * libguile/vm-i-system.c: Update for finish_args. (halt): goto vm_done, now, instead of returning directly. 2009-02-05 Andy Wingo <wingo@pobox.com> scm_call_N doesn't cons for calling programs * libguile/eval.c (scm_call_0, scm_call_1, scm_call_2, scm_call_3) (scm_call_4): Special-case compiled procedures here, to avoid consing. * libguile/vm.h: * libguile/vm.c (scm_c_vm_run): Take a SCM after all. (scm_vm_apply, scm_load_compiled_with_vm): Adapt to vm_run change. 2009-02-05 Andy Wingo <wingo@pobox.com> use append-map in goops * module/oop/goops.scm (ensure-metaclass, make-extended-generic): Some minor optimizations to use append-map. 2009-02-05 Andy Wingo <wingo@pobox.com> inline call to scm_make_program when making closures * libguile/programs.c (scm_make_program): Add a comment. * libguile/vm-engine.h (INIT_ARGS): Add a couple of UNLIKELY notes. * libguile/vm-i-system.c (make-closure): Inline the call to scm_make_program, which avoids some redundant checks. 2009-02-04 Andy Wingo <wingo@pobox.com> enable multiple vm engines (regular, debug, ...) * libguile/vm-engine.c (VM_USE_HOOKS, VM_USE_CLOCK, VM_CHECK_EXTERNAL) (VM_CHECK_OBJECT): Update to define these here, before including vm-engine.h. (vm_run): Change so that we can make different engines. Also, we take an array of arguments, and the struct scm_vm directly, so as to avoid any need to cons. * libguile/vm-engine.h (CHECK_EXTERNAL, CHECK_OBJECT): Add some UNLIKELY bits; don't seem to help. * libguile/vm.c (vm_dispatch_hook): Change to not pass the VP. This needs some love, and perhaps we revert to the old way. (VM_ENGINE): Actually make two engines, vm_regular_engine and vm_debug_engine. Probably there is room for improvement here. Actually their speeds are the same at the moment. (make_vm): Choose which engine to run; currently the debug engine by default. (scm_c_vm_run): A thin wrapper to invoke a VM without consing. (scm_vm_apply): Use scm_c_vm_run. (scm_load_compiled_with_vm): Use scm_c_vm_run. 2009-02-04 Andy Wingo <wingo@pobox.com> "optimize" dispatch to specific GF's in goops * libguile/goops.c: Some micro-optimizations so that calling generic functions as part of the protocol doesn't cons. 2009-02-04 Andy Wingo <wingo@pobox.com> make catch cache and restore vm regs, not the vm itself -- speedy speedy * libguile/throw.c (scm_c_catch): Stash away the current vm's regs, and restore them if there's a nonlocal exit. There is a terrible case we have to handle if we catch from when the vm smob type isn't registered but the throw has the vm registered, but I think we handle this fine. * libguile/vm-engine.c (vm_run): * libguile/vm-i-system.c (halt): Don't make a dynwind context, so that entering the VM doesn't cons at all, except for the arg list. Maybe we can fix that bit too. * libguile/vm.c (vm_reset_stack): Remove, as there is no more dynwind. (make_vm): Return #f if the tc16 hasn't yet been registered. 2009-02-03 Andy Wingo <wingo@pobox.com> make symbol -> opcode lookup faster * libguile/instructions.c (fetch_instruction_table) (scm_lookup_instruction_by_name): Rework so we lazily load instructions into an array keyed by opcode, and a hash table keyed by symbolic name. Much faster, in this hot spot of compilation. * libguile/vm-engine.c (vm_run): Use malloc instead of scm_gc_malloc, given that we aren't ever going to free this thing. * libguile/vm-expand.h (VM_DEFINE_FUNCTION, VM_DEFINE_LOADER): Rework to always be aliases to VM_DEFINE_INSTRUCTION. (VM_DEFINE_INSTRUCTION): In the table case, update to work with fetch_instruction_table(). 2009-02-03 Andy Wingo <wingo@pobox.com> inline dispatch to program cmethods, tick in return, remove old goops methods * libguile/objects.c (scm_apply_generic): Inline the case when the generic is a program. * libguile/vm-i-system.c (return): Tick when functions return. * module/oop/goops.scm (object-eqv?, object-equal?): Remove these historical methods. 2009-02-03 Ludovic Courtès <ludo@gnu.org> GOOPS: Statically allocate the PORT class array. * libguile/goops.c (scm_port_class): Statically allocate it. (create_port_classes): Don't use `scm_calloc ()'. * libguile/goops.h (scm_port_class): Update declaration. * libguile/ports.c (scm_make_port_type): When checking whether GOOPS is initialized, check whether the first element of SCM_PORT_CLASS is non-zero. 2009-02-03 Ludovic Courtès <ludo@gnu.org> Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'. * libguile/goops.c (create_port_classes): Use `SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256. * libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX): Likewise. * libguile/ports.c (scm_make_port_type): Likewise. * libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro. 2009-02-03 Ludovic Courtès <ludo@gnu.org> GOOPS: Statically allocate the SMOB class array. * libguile/goops.c (scm_smob_class): Statically allocate it. (create_smob_classes): Don't malloc(3) `scm_smob_class'. * libguile/goops.h (scm_smob_class): Update declaration. * libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When checking whether GOOPS is initialized, check whether the first element of SCM_SMOB_CLASS is non-zero. 2009-02-03 Ludovic Courtès <ludo@gnu.org> Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/goops.c (create_smob_classes): Refer to `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256. * libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro. 2009-02-02 Andy Wingo <wingo@pobox.com> Name anonymous let- or letrec-bound procedures * module/language/scheme/compile-ghil.scm (let, letrec): Give names to procedures of the form (let ((foo (lambda ....)))). 2009-02-02 Andy Wingo <wingo@pobox.com> tick in calls, procedure-name works on compiled procedures * module/system/vm/program.scm: * libguile/programs.h: * libguile/programs.c (scm_program_bindings, scm_program_bindings) (scm_program_properties, scm_program_name): Unfortunately, implement more procs in C, so that C can use them more easily. * libguile/debug.c (scm_procedure_name): Dispatch to scm_program_name as appropriate. * libguile/vm-i-system.c (call): Tick in a call. 2009-02-02 Julian Graham <julian@transmetropolitan.(none)> Update SRFI-11 docs to use correct name for let*-values. 2009-02-01 Ludovic Courtès <ludo@gnu.org> Use `GC_base ()' to determine whether a pointer points to the heap. * libguile/boehm-gc.h (SCM_I_IS_POINTER_TO_THE_HEAP): Use `GC_base ()' instead of `GC_{least,greatest}_plausible_heap addr' since the GC does not assume that the heap is contiguous (suggested by Ivan Maidanski and Hans Boehm). 2009-02-01 Andy Wingo <wingo@pobox.com> fix the disassembler for load-string, load-symbol et al * module/language/assembly/decompile-bytecode.scm (decode-bytecode): Fix decoding of lengths in loader instructions. no disasm in measure.scm * benchmark/measure.scm: Don't use (system vm disasm). don't make intermediate garbage when making vectors in the vm * libguile/vm-i-system.c (vector): Don't cons up a list just to make a vector. Saves a couple percent in total cell allocation when loading syncase. Probably not worth it, but foo! 2009-02-01 Andy Wingo <wingo@pobox.com> avoid 8 words of allocation per lambda, whoooo * libguile/objcodes.c (scm_bytecode_to_objcode): Check that the length of the vector matches the length embedded in the bytecode. * libguile/programs.c (scm_program_meta): Call through to scm_objcode_meta, instead of looking in the object table. Avoids consing up a program+objcode slice for the meta until the meta is actually called. * libguile/vm-i-loader.c (load-program): Step past the metadata too. * module/language/glil/compile-assembly.scm (make-meta): Just return the load-program form, or #f. (assoc-ref-or-acons, object-index-and-alist, make-object-table): Don't write the meta into the object table. (glil->assembly): Instead write the meta into the load-program form. 2009-02-01 Andy Wingo <wingo@pobox.com> add code for writing out metadata to the end of a program * libguile/objcodes.c (make_objcode_by_mmap, scm_c_make_objcode_slice): Verify the lengths with the meta-length. (scm_objcode_meta): New procedure, for getting at the meta-info of an objcode. (scm_objcode_to_bytecode): (scm_write_objcode): Write bytecode with the metadata too. * module/system/vm/objcode.scm: Export object-meta. * module/language/assembly.scm (byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): * module/language/glil/compile-assembly.scm (glil->assembly): * test-suite/tests/asm-to-bytecode.test ("compiler"): Change to load-program format to have meta-or-#f instead of meta-length, so that we can serialize the meta as objcode without a load-program byte. Add a test for writing out the meta. 2009-02-01 Andy Wingo <wingo@pobox.com> add metalen field to bytecode serialization * libguile/objcodes.h (struct scm_objcode): Add a new field, metalen, in preparation for embedding metadata within a program. (SCM_OBJCODE_META_LEN, SCM_OBJCODE_TOTAL_LEN): New defines. * libguile/vm.c (really_make_boot_program): * module/language/assembly.scm (*program-header-len*, byte-length): * module/language/assembly/compile-bytecode.scm (write-bytecode): * module/language/assembly/decompile-bytecode.scm (decode-load-program): * module/language/assembly/disassemble.scm (disassemble-load-program): * module/language/glil/compile-assembly.scm (glil->assembly): * test-suite/tests/asm-to-bytecode.test ("compiler"): Update for metalen addition. 2009-02-01 Ludovic Courtès <ludo@gnu.org> Fix invalid writes to read-only stringbufs. * libguile/strings.c (SET_STRINGBUF_SHARED): Don't modify BUF if it's already marked as shared since it might be a read-only stringbuf. This error can be caught when linking with GNU ld with "-z relro". 2009-01-31 Ludovic Courtès <ludo@gnu.org> Allow the static initialization of subrs. * libguile/Makefile.am (snarf-gsubr.h): New target. (BUILT_SOURCES, nodist_modinclude_HEADERS, MOSTLYCLEANFILES): Add `snarf-gsubr.h'. * libguile/procs.h (SCM_SUBR_ARITY_TO_TYPE): New macro. * libguile/snarf.h (SCM_DEFINE): Rename to... (SCM_DEFINE_GSUBR): this. (SCM_DEFINE_SUBR)[SCM_SUPPORT_STATIC_ALLOCATION]: New macro. (SCM_DEFINE_SUBR_reqX_optY_rstZ)[SCM_SUPPORT_STATIC_ALLOCATION]: New set of macros. (SCM_IMMUTABLE_SUBR): New macro. 2009-01-31 Andy Wingo <wingo@pobox.com> cache 8 boot programs * libguile/vm.c (vm_make_boot_program): Cache boot programs for nargs < 8. 2009-01-31 Ludovic Courtès <ludo@gnu.org> Allow several `SNARF_INIT ()' per CPP output line. * libguile/guile-snarf.in (modern_snarf): Allow several `SNARF_INIT ()' per line. This makes it possible to write snarffing macros that contain several `SNARF_INIT ()' invocations. Improve CPP token pasting in <snarf.h>. * libguile/snarf.h (scm_i_paste, scm_i_paste3): New macros. (SCM_SYMBOL, SCM_GLOBAL_SYMBOL, SCM_IMMUTABLE_STRING): Use them. 2009-01-31 Ludovic Courtès <ludo@gnu.org> Don't register disappearing links for non-heap objects. * libguile/boehm-gc.h (SCM_I_IS_POINTER_TO_THE_HEAP, SCM_I_REGISTER_DISAPPEARING_LINK): New. * libguile/vectors.c (scm_c_vector_set_x): Use `SCM_I_REGISTER_DISAPPEARING_LINK ()' instead of `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'. * libguile/weaks.c (scm_weak_car_pair, scm_weak_cdr_pair, scm_doubly_weak_pair): Likewise. 2009-01-30 Andy Wingo <wingo@pobox.com> remove conv.scm, disasm.scm; objcode->bytecode rename * module/system/vm/Makefile.am: * module/system/vm/conv.scm: * module/system/vm/disasm.scm: Remove these modules, as their functionality is now in (language ...). * libguile/objcodes.h: * libguile/objcodes.c: * module/system/vm/objcode.scm: Rename objcode->u8vector to objcode->bytecode. * module/system/vm/frame.scm: * module/language/bytecode/spec.scm: Fix for objcode->bytecode. * scripts/disassemble: * testsuite/run-vm-tests.scm: Fix for (system vm disasm) removal. * module/system/repl/command.scm: Use the right disassembler. 2009-01-30 Andy Wingo <wingo@pobox.com> add disassembler that fits in with old compiler tower * module/language/assembly/Makefile.am: * module/language/assembly/disassemble.scm: Add a disassembler, based on the old one but fitting in with the decompiler tower. * module/language/objcode/spec.scm (decompile-value): When decompiling programs, shove all the metadata that we know about into the "env". * module/system/base/compile.scm (decompile-fold, decompile): Return the env from `decompile' as a second value. Not sure if `compile' should do this too. 2009-01-30 Andy Wingo <wingo@pobox.com> add decompilers that can take us back to assembly * module/language/assembly/Makefile.am: * module/language/assembly/spec.scm: * module/language/assembly/decompile-bytecode.scm: Add a bytecode decompiler. Neat! * module/language/bytecode/spec.scm (decompile-objcode): * module/language/objcode/spec.scm (decompile-value): Add some "decompilers" here too. * module/system/base/compile.scm (current-language): Since we can refer to languages by name, do so here -- removes the previous anti-circularity hack. (compile-file, compile): Refer to target languages by name. (decompile): New public function. Neat! * module/system/base/language.scm (lookup-decompilation-order): Fix so we look for decompilers with the high-level language definition. 2009-01-30 Andy Wingo <wingo@pobox.com> allow specification of languages by name; add decompilers to languages * module/system/base/language.scm (lookup-decompilation-order): New function, like its compiling cousin, but backwards. (compute-translation-order): Rework so that languages can be specified either by name or by identity. Return a list of language - procedure pairs, without the "to" language in the list, instead of a list of languages. (invalidate-compilation-cache!): Invalidate the decompilation cache too. (<language>): Add a decompiler field. * module/system/base/compile.scm (compile-passes): Much simpler now that lookup-compilation-order gives us the procedures directly. * module/language/*/spec.scm: Specify compilers by name, so that we can avoid unnecessary module loads, and so that when we specify decompilers, we can avoid cycles. 2009-01-30 Andy Wingo <wingo@pobox.com> remove glil->objcode path in favor of passing through assembly; refactorings. * module/language/assembly.scm: Refactor a bit; remove the name "code" from the API, as it's too generic, and replace with "assembly". * module/language/assembly/compile-bytecode.scm: Get byte lengths via, well, byte-length. * module/language/glil/Makefile.am: * module/language/glil/spec.scm: * module/language/glil/compile-objcode.scm: Remove compile-objcode, as we just go through bytecode now. * module/language/glil/compile-assembly.scm (glil->assembly) (dump-object): s/object->code/object->assembly/. 2009-01-30 Andy Wingo <wingo@pobox.com> add new language between assembly and objcode: bytecode * module/language/bytecode/Makefile.am: * module/language/bytecode/spec.scm: Add another language to the stack, bytecode. Bytecode is the u8vector form of object code.. * configure.in: * module/language/Makefile.am: * module/language/assembly/Makefile.am: * test-suite/tests/asm-to-bytecode.test: * module/language/assembly/spec.scm: * module/language/assembly/compile-bytecode.scm: Update to include the new pass. 2009-01-29 Andy Wingo <wingo@pobox.com> remove GPKG.def files * module/language/ghil/GPKG.def: * module/language/r5rs/GPKG.def: Reove these, they aren't used any more. 2009-01-29 Andy Wingo <wingo@pobox.com> static opcodes; refactor program/objcode division; use new assembly pipeline * gdbinit: Untested attempts to get the stack fondling macros to deal with the new program representation. * libguile/frames.c (scm_vm_frame_arguments, scm_vm_frame_source) (scm_vm_frame_local_ref, scm_vm_frame_local_set_x): SCM_PROGRAM_DATA is a struct scm_objcode*. * libguile/instructions.h: * libguile/instructions.c: Hide the instruction table and the struct scm_instruction structure; all access to instructions now goes through procedures. This is because instructions are no longer in a packed array indexed by opcode. Also, declare a mask that all instructions should fit in. * libguile/objcodes.h: * libguile/objcodes.c: Rewrite so that object code directly maps its arity and length from its bytecode. This makes it unnecessary to keep this information in programs, allowing programs to be simple conses between the code (objcodes) and data (the object table and the closure variables). * libguile/programs.c (scm_make_program): Rework so that make-program takes objcode, an object table, and externals as arguments. It's much clearer this way, and we avoid malloc(). * libguile/stacks.c (is_vm_bootstrap_frame): Update for program/objcode changes. * libguile/vm-engine.c (vm_run): Initialize the jump table on the first run, with the opcodes declared in the instruction sources, and with bad instructions raising an error instead of wandering off into the Unknown. * libguile/vm-engine.h (FETCH_LENGTH): Always represent lengths as 3 bytes. The old code was too error-prone. (NEXT_JUMP): Mask the instruction with SCM_VM_INSTRUCTION_MASK. (NEW_FRAME): Update for program/objcode changes. * libguile/vm-expand.h (VM_DEFINE_FUNCTION, VM_DEFINE_INSTRUCTION) (VM_DEFINE_LOADER): Update so that we explicitly specify opcodes, so that we have a stable bytecode API. * libguile/vm-i-loader.c: Update license to LGPLv2+. Explicitly declare opcodes. (load-integer): Use an int instead of a long as the accumulator; still need to revisit this code at some point, I think. (load-program): Simplify, thankfully!! Just creates the objcode slice and rolls with it. * libguile/vm-i-scheme.c: Number the opcodes explicitly. * libguile/vm-i-system.c: Update license to LGPLv2+. Explicitly declare opcodes. (make-closure): Update for new program API. * libguile/vm.c (vm_make_boot_program): Update for new program/objcode API. Still a bit ugly. (scm_load_compiled_with_vm): Update for new program/objcode API. * module/language/assembly.scm (byte-length): Fix byte-length calculation for loaders, and load-program. (code-pack, code-unpack): Start to move things from (system vm conv) here. (object->code, code->object): More things from conv.scm. * module/language/glil.scm (<glil-program>): Add a new field, closure-level. (make-glil-program, compute-closure-level): Calculate the "closure level" when making a glil program. This is the maximum depth of external binding refs in this closure. (unparse-glil): Fix label serialization. * module/language/glil/compile-assembly.scm (make-meta): Prepend #f for the meta's object table, though maybe in the future we can avoid creating assembly in the first place. (assoc-ref-or-acons, object-index-and-alist): GRRR! Caught again by the different sets of arguments to assoc and assoc-ref! (glil->assembly): Attempt to make the <glil-program> case more readable, and fix the bugs. Sorry I don't know how to comment this change any more than this. (glil->assembly): For <glil-module> serialize the whole key, not just the name. (dump-object): subprogram-code is already a list. Serialize integers as strings, not u8vectors. Fix the order of lists and vectors. * module/language/glil/spec.scm (glil): Switch orders, so we prefer glil -> assembly -> objcode. Actually glil->objcode doesn't work any more, needs to be removed I think. * module/language/objcode/spec.scm (objcode->value): s/objcode->program/make-program/. * module/language/scheme/inline.scm: Add acons inline. * module/system/vm/conv.scm (make-byte-decoder): Skip the first 8 bytes, they are header. Handle subprograms properly. Still needs help though. (decode-length): Lengths are always 3 bytes now. * module/system/vm/disasm.scm: Superficial changes to keep things working. I'd like to fix this better in the future. * module/system/vm/frame.scm (bootstrap-frame?): Fixes for program-bytecode. * module/system/vm/program.scm: Export make-program. It's program-objcode now, no more program-bytecode. * module/system/vm/vm.scm (vm-load): Use make-program. * test-suite/tests/asm-to-bytecode.test: New test, very minimal. * module/system/vm/objcode.scm: Export word-size, byte-order, and write-objcode. 2009-01-28 Andy Wingo <wingo@pobox.com> cleanups to value and help help handlers * ice-9/session.scm (*value-help-handlers*): Define object-documentation as the default value help handler. (remove-value-help-handler!, add-name-help-handler!) (remove-name-help-handler!): Fix docs. (help, help-doc): Fix so that we try object-documentation through try-value-help, and we obey the docs regarding what happens with return values. 2009-01-27 Andy Wingo <wingo@pobox.com> merge in from guile-lib: add some extensibility to `help' * ice-9/session.scm (add-value-help-handler!) (remove-value-help-handler!, add-name-help-handler!) (remove-name-help-handler!): New public interfaces, to allow some basic extensibility of the help interface. Merged in from guile-lib's (scheme session). 2009-01-23 Neil Jerram <neil@ossau.uklinux.net> Fix build when scm_t_timespec is different from struct timespec Reported by Roland Haeder. The declaration and definition of scm_pthread_cond_timedwait were using possibly different types for the third arg. * THANKS: Added Roland Haeder. * libguile/threads.h (scm_pthread_cond_timedwait): Use scm_t_timespec for third arg rather than struct timespec, for consistency with the function implementation. 2009-01-23 Neil Jerram <neil@ossau.uklinux.net> Fix MinGW HAVE_STRUCT_TIMESPEC build problem Reported by Carlo Bramini. See the comment in _scm.h. * THANKS: Add Carlo Bramini. * libguile/_scm.h: Undefine HAVE_STRUCT_TIMESPEC. 2009-01-21 Ludovic Courtès <ludo@gnu.org> Use double-cells to store subrs. * libguile/procs.c (scm_subr_table, scm_subr_table_size, scm_subr_table_room, subr_table_gc_hint, scm_init_subr_table): Remove. (scm_c_make_subr): Simply return a double-cell, with the procedure name and properties stored in a two-element array. * libguile/init.c (scm_i_init_guile): Remove call to `scm_init_subr_table ()'. * libguile/procs.h (SCM_SUBR_META_INFO): New macro. (SCM_SNAME, SCM_SUBR_PROPS): Use it. (SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): Update. (scm_t_subr_entry, SCM_SUBR_ENTRY, SCM_SUBRNUM, scm_subr_table, scm_init_subr_table): Remove. 2009-01-20 Ludovic Courtès <ludo@gnu.org> Add `SCM_SET_SUBR_GENERIC ()' to replace `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/goops.c (scm_c_extend_primitive_generic): Use `SCM_SET_SUBR_GENERIC ()' instead of using `SCM_SUBR_GENERIC ()' as an lvalue. * libguile/procs.c (scm_c_make_subr_with_generic): Use `SCM_SET_SUBR_GENERIC_LOC ()'. * libguile/procs.h (SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC): New macros. 2009-01-20 Ludovic Courtès <ludo@gnu.org> Use `SCM_SNAME ()' when requesting the name of a subr. * libguile/gsubr.c (create_gsubr, create_gsubr_with_generic): Use `SCM_SNAME ()' instead of `SCM_SUBR_ENTRY (subr).name'. * libguile/procs.c (scm_c_define_subr_with_generic, scm_makcclo): Likewise. (scm_c_make_subr_with_generic): Same with `SCM_SUBR_GENERIC ()'. 2009-01-19 Ludovic Courtès <ludo@gnu.org> Merge branch 'boehm-demers-weiser-gc' into bdw-gc-static-alloc 2009-01-19 Andy Wingo <wingo@pobox.com> add assembly intermediate language * configure.in: * module/language/Makefile.am: * module/language/assembly/Makefile.am: Automakery. * module/language/assembly.scm: * module/language/assembly/spec.scm: Add a new language, which is oddly even lower than GLIL. I got tired of GLIL's terrible compile-objcode.scm, and wanted a cleaner intermediate format. * module/language/glil/compile-assembly.scm: A purely-functional assembler, that produces "assembly". Will document later. * module/language/glil/spec.scm: Declare the compiler to assembly. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Remove useless cooperative multi-threading source files. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Make variables related to the subr table size private and unsigned. * libguile/procs.c (scm_subr_table_size, scm_subr_table_room): Made `static' and `unsigned'. (scm_c_make_subr)[entry]: Made `unsigned'. * libguile/procs.h (scm_subr_table_size, scm_subr_table_room): Remove declarations. 2009-01-18 Ludovic Courtès <ludo@gnu.org> GOOPS: Statically allocate the PORT class array. * libguile/goops.c (scm_port_class): Statically allocate it. (create_port_classes): Don't use `scm_calloc ()'. * libguile/goops.h (scm_port_class): Update declaration. * libguile/ports.c (scm_make_port_type): When checking whether GOOPS is initialized, check whether the first element of SCM_PORT_CLASS is non-zero. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'. * libguile/goops.c (create_port_classes): Use `SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256. * libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX): Likewise. * libguile/ports.c (scm_make_port_type): Likewise. * libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro. 2009-01-18 Ludovic Courtès <ludo@gnu.org> GOOPS: Statically allocate the SMOB class array. * libguile/goops.c (scm_smob_class): Statically allocate it. (create_smob_classes): Don't malloc(3) `scm_smob_class'. * libguile/goops.h (scm_smob_class): Update declaration. * libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When checking whether GOOPS is initialized, check whether the first element of SCM_SMOB_CLASS is non-zero. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/goops.c (create_smob_classes): Refer to `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256. * libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Use `scm_gc_malloc ()' when allocating GOOPS `t_extension' objects. * libguile/goops.c (extension_gc_hint): New. (scm_c_extend_primitive_generic): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. (setup_extended_primitive_generics): Don't call `free(3)' when removing a `t_extension' object. Use `scm_gc_malloc ()' when allocating hook entries. * libguile/hooks.c (hook_entry_gc_hint): New. (scm_c_hook_add): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. (scm_c_hook_remove): Don't explicitly free(3) the entry, let the GC do its job. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Use `scm_gc malloc_pointerless ()' in `scm_i allocate_string_pointers ()'. * libguile/dynl.c (free_string_pointers): Remove. (scm_dynamic_args_call): Remove reference to `free_string_pointers ()' and remove dynwind. * libguile/posix.c (free_string_pointers): Remove. (scm_execl, scm_execlp, scm_execle, scm_environ): Remove references to `free_string_pointers ()'. * libguile/simpos.c (free_string_pointers): Remove. (scm_system_star): Remove reference to `free_string_pointers ()', remove enclosing dynwind. * libguile/strings.c (scm_i_allocate_string_pointers): Use `scm_gc_malloc_pointerless ()' and `scm_gc_malloc ()' instead of `scm_malloc ()' and `scm_to_locale_string ()', so that the result is automatically GC'd when no longer referenced. Remove unneeded dynwind. (scm_i_free_string_pointers): Remove. * libguile/strings.h (scm_i_free_string_pointers): Remove declaration. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Use `scm_gc_malloc ()' when allocating the allocated fluid vector. * libguile/fluids.c (next_fluid_num): Use `scm_gc_malloc ()'. Don't explicitly free the previously allocated array. Remove useless cooperative multi-threading source files. Use `scm_gc_malloc ()' and friends when allocating the subr table. * libguile/procs.c (subr_table_gc_hint): New. (scm_c_make_subr): Use `scm_gc_realloc ()' instead of `scm_realloc ()'. (scm_init_subr_table): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Make variables related to the subr table size private and unsigned. * libguile/procs.c (scm_subr_table_size, scm_subr_table_room): Made `static' and `unsigned'. (scm_c_make_subr)[entry]: Made `unsigned'. * libguile/procs.h (scm_subr_table_size, scm_subr_table_room): Remove declarations. 2009-01-18 Ludovic Courtès <ludo@gnu.org> Don't use `scm_immutable_cell ()' for subrs. * libguile/procs.c (scm_c_make_subr): Use `scm_cell ()' instead of `scm_immutable_cell ()' since subr cells can be mutated, e.g., via `SCM_SUBR_GENERIC ()' as in `scm_c_extend_primitive_generic ()' (this doesn't make any difference in practice as of libgc 7.1, though). 2009-01-17 Neil Jerram <neil@ossau.uklinux.net> Remove `INSTALL' * INSTALL: Removed. 2009-01-17 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am m4/gnulib-cache.m4 m4/gnulib-comp.m4 2009-01-17 Andy Wingo <wingo@pobox.com> move module and meta inside programs' object tables * libguile/programs.h (struct scm_program): Remove the module and meta fields. * libguile/programs.c (scm_c_make_program): Add a new argument, `objs'. If it's a vector, we'll look for the module and the metadata in there, instead of having them in the scm_program structure. (scm_c_make_closure, program_mark, scm_program_meta) (scm_c_program_source, scm_program_module): Adapt to the new program representation. * libguile/objcodes.c (scm_objcode_to_program): Pass #f as the object table when making the program. * libguile/vm-engine.h (CACHE_PROGRAM): * libguile/vm-engine.c (vm_run): Rework to use the simple vector API for getting the current object table. Call the helper, vm_make_boot_program, to make the boot program. * libguile/vm-i-loader.c (load-program): Set the current module and the meta in the object vector, which we pass to scm_c_make_program. * libguile/vm-i-system.c (toplevel-ref, toplevel-set): Adapt to the new program representation. * module/language/glil/compile-objcode.scm (codegen): Clarify. 2009-01-17 Andy Wingo <wingo@pobox.com> placeholder for meta and module in a program's object table * module/language/glil/compile-objcode.scm (codegen): If the generated objcode will have a meta or it has objects, prepend two cells to the object table: one for the meta, and one for the module. This is a placeholder for future work. 2009-01-16 Neil Jerram <neil@ossau.uklinux.net> Don't try to unlock already unlocked heap mutex For each thread that goes into Guile mode, Guile pushes a cleanup function, scm_leave_guile_cleanup, whose purpose is to execute `scm_leave_guile ()' if the thread is terminated while in Guile mode. The problem is that there are various places - like scm_pthread_cond_wait, scm_without_guile and scm_std_select - where the thread temporarily leaves Guile mode (which means unlocking the heap mutex), and the cleanup function is still in place. Therefore if the thread is terminated at these places, the cleanup function ends up trying to unlock a mutex (the heap mutex) which isn't actually locked. * libguile/threads.h (scm_i_thread): New heap_mutex_locked_by_self field. * libguile/threads.c (scm_enter_guile): Set heap_mutex_locked_by_self. (scm_leave_guile): Only unlock if heap_mutex_locked_by_self is 1. (guilify_self_1): Initialize heap_mutex_locked_by_self. (scm_i_thread_sleep_for_gc): Remove incorrect use of t->held_mutex here. 2009-01-15 Andy Wingo <wingo@pobox.com> fold in ludovic's suggestions for new manual sections * INSTALL: Update from newest merge * doc/ref/compiler.texi: * doc/ref/vm.texi: Fold in Ludovic's suggestions 2009-01-15 Andy Wingo <wingo@pobox.com> Merge commit 'origin/master' into vm Conflicts: INSTALL 2009-01-15 Neil Jerram <neil@ossau.uklinux.net> Invoke gnulib-tool with --no-vc-files option, and remove files that should not have been committed to the repository. Revert lib/.gitignore and m4/.gitignore to how they should be (before my confused Gnulib commits...) Revert unintended change to INSTALL made by commit 4a462e35440fdc3f10b0f88b3fb737fa76ed146d Add more missing Gnulib files 2009-01-14 Neil Jerram <neil@ossau.uklinux.net> Add more missing Gnulib files Add missing Gnulib file (m4/localcharset.m4) 2009-01-14 Ludovic Courtès <ludo@gnu.org> Add support for static allocation of cells, strings and stringbufs. * libguile/__scm.h (SCM_ALIGNED): New macro. * libguile/_scm.h: Include "libguile/strings.h", to make the string/stringbuf-related constants visible to snarffed code. * libguile/snarf.h (SCM_SUPPORT_STATIC_ALLOCATION): New macro. (SCM_SYMBOL, SCM_GLOBAL_SYMBOL)[SCM_SUPPORT_STATIC_ALLOCATION]: New alternative versions of these macros with support for (almost) static allocation via the use of `string->symbol'. (SCM_IMMUTABLE_DOUBLE_CELL, SCM_IMMUTABLE_STRINGBUF, SCM_IMMUTABLE_STRING): New macros. * libguile/tags.h (SCM)[SCM_DEBUG_TYPING_STRICTNESS==1]: Use a pointer type that is compatible with other pointer types, to avoid potential violation of strict aliasing rules. 2009-01-13 Ludovic Courtès <ludo@gnu.org> Expose some of the string/stringbuf internal flags and tags. * libguile/strings.h (scm_tc7_ro_string, SCM_I_STRINGBUF_F_SHARED, SCM_I_STRINGBUF_F_INLINE): New macros. * libguile/strings.c (STRINGBUF_F_SHARED): Alias for `SCM_I_STRINGBUF_F_SHARED'. (STRINGBUF_F_INLINE): Alias for `SCM_I_STRINGBUF_F_INLINE'. (RO_STRING_TAG): Alias for `scm_tc7_ro_string'. 2009-01-13 Andy Wingo <wingo@pobox.com> fix marking empty VM continuations * libguile/vm.h (struct scm_vm_cont): * libguile/vm.c (capture_vm_cont, reinstate_vm_cont): Change so we just store the registers as they are, with the reloc. (vm_cont_mark): Only mark the stack if it has elements on it, otherwise we get a bogus fp. * libguile/stacks.c (scm_make_stack): Update for change to vm continuations. 2009-01-12 Andy Wingo <wingo@pobox.com> Merge branch 'master' into vm 2009-01-12 Ludovic Courtès <ludo@gnu.org> Fixlet for `run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (%default-options): Default to the empty list for `input'. gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework. * gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'. (GCOld): Fix the order of the predicate and run-maker. gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al. See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for details. gc-benchmarks: Add `run-benchmark.scm'. gc-profile: Show the result of `(version)'. * gc-benchmarks/gc-profile.scm (main): Show `(version)'. gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter. (run-benchmark): Moved from `twobit-compat.scm'. Honor `*iteration-count*'. (%options): Add `--iterations'. (show-help): Document it. (main): Parameterize `*iteration-count*'. Import GC benchmarks from Larceny, by Hansen, Clinger, et al. These GPLv2+-licensed GC benchmarks are available from http://www.ccs.neu.edu/home/will/GC/sourcecode.html . gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer. * gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm". (save-directory-excursion, load-larceny-benchmark): New procedures. (%options): New variable. (show-help, parse-args): New procedures. (main): Use `parse-args' and `load-larceny-benchmark'. Add GC benchmarks. 2009-01-12 Neil Jerram <neil@ossau.uklinux.net> Make sure that we have a real on-the-stack alloca() Because of how Guile saves and restores continuations (by copying the stack), and how it uses alloca to create space for debug information on the stack, we must have an alloca() that really does use the stack, and not one that uses the heap. To do this, we use the Gnulib "alloca-opt" module instead of "alloca". This commit also updates the Gnulib sources from the current Gnulib Git repository. 2009-01-12 Andy Wingo <wingo@pobox.com> remove a paranoid define; fix bitrot in measure.scm. * benchmark/measure.scm (measure): Fix bitrot. * libguile/vm.c (VM_ENABLE_STACK_NULLING): Undefine this, as it hasn't caught any errors in quite a while. 2009-01-12 Andy Wingo <wingo@pobox.com> fix mismerge on srfi-19.scm * module/srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Whoops, fix broken manual merge on srfi-19.scm. fix typo when compiling receive forms * module/language/glil/compile-objcode.scm (codegen): Fix an embarassing typo, introduced in c2c82b62f40242a4212528c3d3e882038b48f0a2 2009-01-12 Andy Wingo <wingo@pobox.com> Merge commit 'origin/master' into vm Conflicts: .gitignore guile-tools.in srfi/srfi-19.scm 2009-01-11 Andy Wingo <wingo@pobox.com> fold in neil's feedback to history.texi * doc/ref/history.texi: Fold in Neil's feedback 2009-01-11 Andy Wingo <wingo@pobox.com> word tweaks * doc/ref/guile.texi: Finish some wording. * doc/ref/compiler.texi: Fix some goofiness. 2009-01-11 Andy Wingo <wingo@pobox.com> tweaks to compiler.texi * doc/ref/compiler.texi: Minor tweaks. 2009-01-11 Andy Wingo <wingo@pobox.com> finish compiler.texi, woo * libguile/objcodes.c (do-pair): Removed unused debuging hack. * module/language/glil/spec.scm (glil): Simplify a bit. * module/system/repl/repl.scm (default-catch-handler): Don't catch vm-error, as vm-backtrace doesn't exist any more. * doc/ref/compiler.texi: Finish documenting GLIL and object code. 2009-01-11 Andy Wingo <wingo@pobox.com> rename <glil-asm> to <glil-program> * module/language/glil.scm (<glil-program>): Rename from <glil-asm>. * module/language/ghil/compile-glil.scm (codegen): * module/language/glil.scm (parse-glil, unparse-glil): * module/language/glil/compile-objcode.scm (preprocess, codegen): Adapt to naming change. 2009-01-11 Andy Wingo <wingo@pobox.com> remove useless <glil-vars> helper type, serialize GHIL more strictly * module/language/ghil.scm (parse-ghil, unparse-ghil): Rework to make the parse format correspond more closely with the object representation, so that I only have to document it once in the manual. The salient change is that no expression is self-quoting, and that variable references should go through `(ref FOO)'. Rename `set!' to `set'. * module/language/ghil/compile-glil.scm: Add a couple of compilers for unquote and unquote-splicing, that just raise an error. This way I can document unquote and unquote-splicing as normal ghil expressions, except that it's the compiler that catches them if they're outside a quasiquote. (codegen): Adapt to change in <glil-asm>. * module/language/ghil/spec.scm (parse): Fix parser typo bug. * module/language/glil.scm (<glil-asm>): Remove useless <glil-vars> structure, which also had a confusing name. Just put the nargs, nrest, nlocs, and nexts in the <glil-asm> directly. (parse-glil, unparse-glil): Serialize `asm' more straightforwardly. * module/language/glil/compile-objcode.scm (<bytespec>): Remove <glil-vars>, as with <glil-asm>. (preprocess, make-meta, codegen, dump-object!): Adapt to change in <glil-asm>. 2009-01-09 Andy Wingo <wingo@pobox.com> rename translate.scm to compile-ghil.scm, and more work on compiler.texi * doc/ref/api-evaluation.texi: Fix some typos and xrefs. * doc/ref/compiler.texi (The Scheme Compiler): Document the scheme compiler, and start documenting the GHIL language. * doc/ref/guile.texi (Guile Implementation): Whoops, put autoconf after the implementation foo. Unless we want it before? * doc/ref/history.texi (The Emacs Thesis): Fix typo. * doc/ref/vm.texi (Environment Control Instructions): Rename offset to index. * module/language/ghil.scm (parse-ghil): Fix what I think was a bug -- the consumer in a mv-call shouldn't be a rest arg. * module/language/scheme/Makefile.am (SOURCES): * module/language/scheme/compile-ghil.scm: Rename this file from translate.scm. * module/oop/goops.scm: * module/language/scheme/spec.scm: Deal with renaming. 2009-01-09 Andy Wingo <wingo@pobox.com> fix some xrefs, flesh out compiler.texi a bit more * doc/ref/api-debug.texi: * doc/ref/vm.texi: Fix some cross-references. * doc/ref/compiler.texi: Hack some more, finishing the section on the compiler tower. 2009-01-09 Andy Wingo <wingo@pobox.com> finish api-procedures.texi * doc/ref/api-procedures.texi: Finish documenting bits on compiled procedures. 2009-01-08 Andy Wingo <wingo@pobox.com> more work on api-procedures.texi * doc/ref/api-procedures.texi (Compiled Procedures): Stub out these docs some more, taking some commented-out docs from vm.texi. * doc/ref/vm.texi: Move docs ^. 2009-01-08 Andy Wingo <wingo@pobox.com> start at documenting the compiler * doc/ref/api-evaluation.texi: Add documentation for the standard compilation interface, and some notes about compiled files. * doc/ref/api-procedures.texi (Compiled Procedures): A stub at documenting compiled procedures. * doc/ref/compiler.texi (Compiling to the Virtual Machine): Flesh out with some structure, though much of the text remains to be written. This stuff is hard to write! 2009-01-08 Andy Wingo <wingo@pobox.com> (language ghil def) becomes (language ghil) * module/language/Makefile.am: * module/language/ghil/Makefile.am: * module/language/ghil.scm: * module/language/ghil/compile-glil.scm: * module/language/ghil/spec.scm: * module/language/glil/Makefile.am: * module/language/glil.scm: * module/language/glil/compile-objcode.scm: * module/language/glil/spec.scm: * module/language/scheme/inline.scm: * module/language/scheme/translate.scm: * module/oop/goops.scm: Rename (language ghil def) and (language glil def) to not have the "def". They're nicer names. 2009-01-08 Andy Wingo <wingo@pobox.com> move lang-specific modules, e.g. (system il compile) to (language ghil compile-glil) * configure.in: Remove module/system/il directory. * module/language/ghil/Makefile.am (SOURCES): * module/language/ghil/compile-glil.scm (system): * module/language/ghil/def.scm (language): * module/language/ghil/spec.scm (language, ghil): * module/language/glil/Makefile.am (SOURCES): * module/language/glil/compile-objcode.scm (language): * module/language/glil/def.scm (language): * module/language/glil/spec.scm (language, compile): * module/language/scheme/Makefile.am (SOURCES): * module/language/scheme/inline.scm (system, define-inline): * module/language/scheme/translate.scm (language): Move files, renaming the modules. * module/oop/goops.scm (load-toplevel): Unfortunately the GHIL name leaked here. Patch it up. * module/system/vm/Makefile.am (SOURCES): Remove assemble.scm. 2009-01-06 Andy Wingo <wingo@pobox.com> react to comments by ludovic on history.texi * doc/ref/history.texi: Adjust to some of Ludovic's comments. finish vm.texi except references * doc/ref/vm.texi: Finish writing the VM reference, all correct except for the missing references. 2009-01-04 Neil Jerram <neil@ossau.uklinux.net> NEWS entry for %fast-slot-ref/set! fix 2009-01-04 Neil Jerram <neil@ossau.uklinux.net> Fix implementation of %fast-slot-ref and %fast-slot-set! * libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x): Correct incantation for getting the number of slots of the specified instance. * libguile/goops.h (SCM_NUMBER_OF_SLOTS): Removed (because wrong). * test-suite/standalone/test-fast-slot-ref.in: New standalone test. * configure.in: Generate test-suite/standalone/test-fast-slot-ref. * test-suite/standalone/Makefile.am (check_SCRIPTS): Add test-fast-slot-ref. 2009-01-04 Andy Wingo <wingo@pobox.com> allow `apply' on %nil-terminated lists * libguile/vm-engine.h (PUSH_LIST): Add a parameter to check that the list was proper. * libguile/vm-i-system.c: Adapt PUSH_LIST callsites to pass SCM_NULLP or SCM_NULL_OR_NIL_P, as appropriate. Add a check to return/values*. * libguile/vm.c: Add lang.h header for SCM_NULL_OR_NIL_P. * test-suite/tests/elisp.test: Fix XFAIL for elisp + apply. 2009-01-03 Neil Jerram <neil@ossau.uklinux.net> Update autogen.sh * autogen.sh: Don't call guile-readline/autogen.sh; not needed because autoreconf recurses itself. Remove copies of config.guess and config.sub, which are now invalid because we don't have those files in the top level directory. Remove mention of --enable-maintainer-mode, as we don't use AM_MAINTAINER_MODE any more. 2009-01-03 Ludovic Courtès <ludo@gnu.org> Delete redundant `config.{guess,sub}'. 2008-12-26 Andy Wingo <wingo@pobox.com> remove heap links in VM frames, incorporate vm frames into normal backtraces * doc/ref/vm.texi (Stack Layout): Update to remove references to the "heap link". * gdbinit: Update for "heap link" removal. * libguile/frames.c: * libguile/frames.h: Update macros and diagram for removal of "heap link". As part of this, we also remove "heap frames", replacing them with "vm frames", which are much like the interpreter's debug objects, but for VM stacks. That is to say, they don't actually hold the stack themselves, just the pointers into stack that's held by a continuation (either captured or current). * libguile/stacks.c (stack_depth, read_frames): Since a "stack" object is really a copy of information that comes from somewhere else, it makes sense to copy over info from the VM, just as `make-stack' does from the evaluator. The tricky bit is to figure out how to interleave VM and interpreter frames. We do that by starting in the interpreter, and whenever the current frame's procedure is actually a program, we switch to the VM stack, switching back when we reach a "bootstrap frame". The last bit is hacky, but it does work... (is_vm_bootstrap_frame): Hacky predicate to see if a VM frame is a bootstrap frame. (scm_make_stack): Accept a VM frame in addition to debug frames. Probably has some bugs in this case. But in the case that the arg is #t (a common case), do the right thing, capturing the top VM frame as well, and interleaving those frames appropriately on the stack. As an accident, we lost the ability to limit the number of frames in the backtrace. We could add that back, but personally I always want *all* frames in the trace... Narrowing still works fine, though there are some hiccups sometimes -- e.g. an outer cut to a procedure that does a tail-call in VM code will never find the cut, as it no longer exists in the continuation. * libguile/vm.h (struct scm_vm): So! Now that we have switched to save stacks in the normal make-stack, there's no more need for `this_frame' or `last_frame'. On the other hand, we can take this opportunity to fix tracing: when we're in a trace hook, we set `trace_frame' on the VM, so we know not to fire hooks when we're already in a hook. (struct scm_vm_cont): Expose this, as make-stack needs it to make VM frames from VM continuations. * libguile/vm.c (scm_vm_trace_frame): New function, gets the current trace frame. (vm_mark, make_vm): Hook up the trace frame. (vm_dispatch_hook): New hook dispatcher, with a dynwind so it does the right thing if the hook exits nonlocally. * libguile/vm-engine.c (vm_run): No more this_frame in the wind data. * libguile/vm-engine.h (RUN_HOOK): Run hooks through the dispatcher. (ALIGN_AS_NON_IMMEDIATE, POP_LIST_ON_STACK): Remove unused code. (NEW_FRAME): Adapt for no HL in the frame. * libguile/vm-i-system.c (goto/args, mv-call, return, return/values): Adapt for no HL in the frame. * module/system/vm/frame.scm: * module/system/vm/vm.scm: Beginnings of some reworkings, needs more thought. 2008-12-26 Andy Wingo <wingo@pobox.com> repl.scm relies on `display-backtrace' to do everything, some naming tweaks * module/ice-9/boot-9.scm (default-pre-unwind-handler): Rename from default-lazy-handler. (pre-unwind-handler-dispatch): Rename from lazy-hadler-dispatch. (error-catching-loop): Adjust caller. * module/system/repl/repl.scm (default-pre-unwind-handler): Remove this definition, in favor of the default one in boot-9. (default-catch-handler): Don't do a vm-backtrace, as we will soon be relying on core machinery to do that for us. (call-with-backtrace): Start a new stack for the thunk. (with-backtrace): Macro version of call-with-backtrace. (start-repl): Use with-backtrace for brevity. Start a stack with #t as the tag instead of repl-eval, because all traces of repl-eval are gone after it does a tail-call. * module/ice-9/debugger.scm: * module/ice-9/debugging/traps.scm: * module/ice-9/stack-catch.scm: Adapt to s/lazy/pre-unwind/ in boot-9.scm. 2008-12-26 Andy Wingo <wingo@pobox.com> add scm_c_program_source * libguile/programs.h: * libguile/programs.c (scm_c_program_source): New helper for getting source information from C. backtrace.c: allow vectors for SCM_FRAME_SOURCE (frame) * libguile/backtrace.c (display_backtrace_get_file_line): If the source is a vector, treat it as a #(line column file) vector, as emitted by the VM. Needs subsequent patches to make sense. fix doc typo * doc/ref/data-rep.texi (Non-immediate objects): Fix a typo, thanks to Dale Smith. 2008-12-22 Ludovic Courtès <ludo@gnu.org> Fix typo in SRFI-19. * srfi/srfi-19.scm (priv:string->date): Check for EOF on CH, not PORT. 2008-12-19 Andy Wingo <wingo@pobox.com> remove the `late-bind' instruction * doc/ref/vm.texi: Minor fixes. * libguile/vm-i-loader.c: Remove the unused `late-bind' instruction. 2008-12-19 Andy Wingo <wingo@pobox.com> write history.texi * doc/ref/vm.texi: Flesh out the VM documentation, adding a rationale. * doc/ref/history.texi: Write the Guile history. * doc/ref/guile.texi (Top): Some tweaks. 2008-12-18 Ludovic Courtès <ludo@gnu.org> Update `INSTALL', from Automake 1.10.2. Don't use deprecated functions in `debug-malloc.c'. * libguile/debug-malloc.c (scm_malloc_stats): Use `scm_from_locale_string ()'. Patch by Linas Vepstas <linasvepstas@gmail.com>. 2008-12-18 Ludovic Courtès <ludo@gnu.org> srfi-19: Fix `string->date' weekday lookup. * srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Use `locale-day-short' since it expects integers in the range 1-7, unlike `priv:locale-abbr-weekday'. (priv:locale-long-weekday->index): Likewise. * test-suite/tests/srfi-19.test ("SRFI date/time library")["string->date works on Sunday"]: New test. 2008-12-14 Ludovic Courtès <ludo@gnu.org> Fixlet for `run-benchmark.scm'. * gc-benchmarks/run-benchmark.scm (%default-options): Default to the empty list for `input'. Fix typo in makefile. * libguile/Makefile.am (DOT_X_FILES): Substitute `gettext.x' to `gettext.c'. Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am libguile/struct.c libguile/threads.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 2008-12-13 Neil Jerram <neil@ossau.uklinux.net> Ignore gds-test.debug and gds-test.transcript 2008-12-13 Neil Jerram <neil@ossau.uklinux.net> Support multiple concurrent instances of Emacs + GDS server By: - Making the Unix socket name unique (for each Emacs instance), by appending Emacs's PID to it. - Changing the GDS server to listen on both Unix domain and TCP (and not to mind if the TCP bind fails, which will happen if another GDS instance has already bound to the TCP port number). - Adding this unique Unix socket name to the environment (as GDS_UNIX_SOCKET_NAME), so that Guile clients started from inside Emacs can pick it up. - Changing the GDS client code to look for GDS_UNIX_SOCKET_NAME in the environment, and to connect to the Unix socket with that name instead of over TCP. Guile clients started outside Emacs will not find GDS_UNIX_SOCKET_NAME and so will fall back to using TCP. This means they will connect to whichever Emacs + GDS server instance started first. * emacs/gds-server.el (gds-start-server): Take both Unix socket name and TCP port args, instead of just one (which could be either Unix or TCP), and pass these on to `run-server'. Remove unused optional bufname arg. * emacs/gds.el (gds-unix-socket-name, gds-tcp-port): New variables. (gds-socket-type-alist): Removed. (gds-run-debug-server): Pass gds-unix-socket-name and gds-tcp-port to gds-start-server. Add the Unix socket name to the environment. (gds-server-socket-type): Note now obsolete. * ice-9/gds-client.scm (connect-to-gds): Get Unix socket name from environment, and connect to this in preference to using TCP. * ice-9/gds-server.scm (run-server): Take both Unix socket name and TCP port args. Listen and accept connections on both. 2008-12-12 Neil Jerram <neil@ossau.uklinux.net> Thank people who provided reports or fixes for GDS (while it was a standalone project) * THANKS (R Clayton, John Steele Scott, Thomas Wawrzinek): Added. 2008-12-12 Neil Jerram <neil@ossau.uklinux.net> Add more files that I wrote to the list in AUTHORS * AUTHORS (Neil Jerram): Several files added. 2008-12-12 Neil Jerram <neil@ossau.uklinux.net> Add GDS test and documentation files (Transferred from the remains of the old standalone guile-debugging project at gna.org.) * emacs/gds-faq.txt, emacs/gds-test.el, emacs/gds-test.sh, emacs/gds-test.stdin, emacs/gds-tutorial.txt: New files. 2008-12-11 Neil Jerram <neil@ossau.uklinux.net> Add a GDS protocol hook, that we can use for testing * emacs/gds.el (gds-protocol-hook): New hook. (gds-debug-protocol): Run this hook for each received protocol form. 2008-12-10 Neil Jerram <neil@ossau.uklinux.net> Revert "(scm_shell_usage): Note need for subscription to bug-guile@gnu.org." This reverts commit f3e3f530c28cfa5c7830c5d9b01de6fc388bc42a, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. Conflicts: 2008-12-10 Neil Jerram <neil@ossau.uklinux.net> Revert "Note need for subscription to bug-guile@gnu.org." This reverts commit cbea802b3763aa8cb43c88f7df272da3e41c32da, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. Conflicts: 2008-12-10 Neil Jerram <neil@ossau.uklinux.net> Revert "(Reporting Bugs): Note need for subscription to" This reverts commit e563095988a1c64feb30307928bcc090828cdda9, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. Conflicts: 2008-12-10 Neil Jerram <neil@ossau.uklinux.net> Revert "* README: Note need for subscription to bug-guile@gnu.org." This reverts commit 51d079ab0d23e4175d333ce22eb3e74aeae5913d, which is appropriate because subscription is not now required for someone to send a message to bug-guile@gnu.org. 2008-12-10 Ludovic Courtès <ludo@gnu.org> i18n: Add comment about standardization of the `locale_t' API. * libguile/i18n.c: Add pointer to the POSIX 2008 standardization of the API. Fix erroneous differences in `NEWS' compared to `branch_release-1-8'. configure: Check for <ltdl.h>. * configure.in: Check for <ltdl.h>, to clarify misconfigurations. configure: Don't substitute `DLPREOPEN'. * configure.in: Don't substitute `DLPREOPEN' since it's no longer used (see commit 72db29f200c38fca64a8ccd0d679821eb25de5a9). 2008-12-10 Neil Jerram <neil@ossau.uklinux.net> Remove everything to do with GDS Breakpoints (which I now regard as an unsuccesful experiment) This commit makes all affected files the same in master as they are in branch_release-1-8. * doc/ref/api-debug.texi (Breakpoints): Removed. * doc/ref/scheme-using.texi (GDS Introduction, GDS Getting Started, Displaying the Scheme Stack): Remove mentions of breakpoints. (Setting Specific Breakpoints, Setting GDS-managed Breakpoints, Setting and Managing Breakpoints, Listing and Deleting Breakpoints, Moving and Losing Breakpoints): Removed. * emacs/gds-scheme.el (gds-bufferless-breakpoints, gds-bpdef:behaviour, gds-bpdef:type, gds-bpdef:file-name, gds-bpdef:proc-name, gds-bpdef:lc, gds-breakpoint-number, gds-breakpoint-buffers, gds-breakpoint-programming, gds-breakpoint-cache, gds-breakpoint-face, gds-breakpoints-file-name, gds-delete-lost-breakpoints, gds-bpdefs-cache, gds-read-breakpoints-file, gds-adopt-breakpoints, gds-adopt-breakpoint, gds-make-breakpoint-overlay, gds-send-breakpoint-to-client, gds-default-breakpoint-type, gds-set-breakpoint, gds-defun-name-region, gds-breakpoint-overlays-at, gds-write-breakpoints-file, gds-fold-breakpoints, gds-delete-breakpoints, gds-delete-breakpoint, gds-breakpoint-at-point, gds-union, gds-user-selected-breakpoint, gds-describe-breakpoints, gds-describe-breakpoint, gds-after-save-update-breakpoints, gds-breakpoint-map): Removed. (gds-nondebug-protocol): Removed handling for `breakpoint' and `get-breakpoints'. * emacs/gds.el (gds-scheme-first-load): Removed. * ice-9/debugging/Makefile.am (ice9_debugging_sources): Removed breakpoints.scm and load-hooks.scm. * ice-9/debugging/breakpoints.scm: Removed. * ice-9/debugging/load-hooks.scm: Removed. * ice-9/gds-client.scm (handle-nondebug-protocol): Remove everything to do with breakpoints. (breakpoints, set-gds-breakpoints): Removed. (run-utility): Call `connect-to-gds' instead of `set-gds-breakpoints'. 2008-12-09 Ludovic Courtès <ludo@gnu.org> Mention the end of `ChangeLog' files in `NEWS'. Make `config.status' happier. * guile-tools.in (datarootdir): New variable, needed since `pkgdatadir' may refer to `${datarootdir}'. 2008-12-08 Ludovic Courtès <ludo@gnu.org> Add other missing Gnulib files. 2008-12-07 Ludovic Courtès <ludo@gnu.org> Remove useless references to Libtool's `dlpreopen' mechanism. * libguile/Makefile.am (guile_LDFLAGS): Remove `@DLPREOPEN@' since it has no effect. * libguile/guile.c (main): Don't invoke `LTDL_SET_PRELOADED_SYMBOLS ()' since it had no effect given how we invoke `libtool'. It also fixes compatibility issues when using libltdl 1.5 with a Libtool 2.2 package. 2008-12-07 Ludovic Courtès <ludo@gnu.org> Add missing Gnulib M4 files. Reported by Neil Jerram. 2008-12-07 Neil Jerram <neil@ossau.uklinux.net> Several new hash table tests, written by Gregory Marton. * test-suite/tests/hash.test ("make-hash-table, hash-table?", "hash-set and hash-ref", "auto-resizing hashx", "hashx"): New tests. * AUTHORS, THANKS: Add Gregory Marton as a contributor. 2008-12-02 Ludovic Courtès <ludo@gnu.org> Fix sloppy bound checking in `string-{ref,set!}' with the empty string. * libguile/strings.c (scm_string_ref): Add proper range checking for the empty string. (scm_string_set_x): Likewise. Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>. * test-suite/tests/strings.test ("string-ref"): New test prefix. ("string-set!")["empty string", "empty string and non-zero index", "out of range", "negative index", "regular string"]: New tests. * NEWS: Update. 2008-12-02 Ludovic Courtès <ludo@gnu.org> Update `NEWS'. 2008-11-30 Ludovic Courtès <ludo@gnu.org> Fix potential deadlock in `make-struct'. * libguile/struct.c (scm_make_struct): Remove critical section, as suggested by Linas Vepstas <linasvepstas@gmail.com>. See http://lists.gnu.org/archive/html/bug-guile/2008-11/msg00036.html for a discussion. 2008-11-30 Ludovic Courtès <ludo@gnu.org> Make GNU Libtool 2.2.x happier. * configure.in: Use `AC_CONFIG_MACRO_DIR([m4])'. Reverts patch b01284227e180d223c97e1b9ba7e2cbd0ddded7e and makes `libtoolize' from Libtool 2 happier (removes a couple of warnings). * Makefile.am (ACLOCAL_AMFLAGS): Remove `-I guile-config' since that directory only contains macros that we distribute, not macros that we use. 2008-11-30 Ludovic Courtès <ludo@gnu.org> Check the return value of libc's functions to make `_FORTIFY_SOURCE=2' work. This fixes bug #24009 reported by Martin Pitt. * libguile/threads.c (guilify_self_1): Check the return value of pipe(2). (scm_std_select): Use `full_read ()' instead of `read ()' when reading from WAKEUP_FD. * libguile/async.c (scm_i_queue_async_cell): Use `full_write ()' instead of write(2) when writing to SLEEP_FD. * libguile/fports.c (fport_flush): Likewise. * libguile/posix.c (getgroups): Use the return value of getgroups(2) as NGROUPS. (scm_nice): Get the return value of nice(2) to make glibc happy. * libguile/scmsigs.c (take_signal): Use `full_write ()' instead of write(2). 2008-11-30 Ludovic Courtès <ludo@gnu.org> Use Gnulib's `full-write' and `full-read' modules. Update Gnulib files to commit d4b129b8e5f8a8d1198020fd6fc79310d305936c. 2008-11-24 Ludovic Courtès <ludo@gnu.org> Use orthodox libtoology in `guile'. * libguile/guile.c (main): Use `LTDL_SET_PRELOADED_SYMBOLS ()' instead of our own trick. 2008-11-24 Ludovic Courtès <ludo@gnu.org> Run the handler of SRFI-34's `with-exception-handler' in the right dyn. env. * srfi/srfi-34.scm (with-exception-handler): Use `with-throw-handler' instead of `lazy-catch'. * test-suite/tests/srfi-34.test ("SRFI 34")["`with-exception-handler' invokes HANDLER in THUNK's dynamic env."]: New test. * test-suite/tests/srfi-39.test: Use `(srfi srfi-34)'. ("SRFI-39")["SRFI-34"]: New test. * NEWS: Update. 2008-11-24 Ludovic Courtès <ludo@gnu.org> Fix comments in `test-scm-c-read.c'. * test-suite/standalone/test-scm-c-read.c (make_port): Fix comments. 2008-11-23 Ludovic Courtès <ludo@gnu.org> Add C unit test for `scm_c_read ()' and the port API. * test-suite/standalone/Makefile.am (check_PROGRAMS, TESTS): Add `test-scm-c-read'. (test_scm_c_read_SOURCES, test_scm_c_read_CFLAGS, test_scm_c_read_LDADD): New. 2008-11-23 Neil Jerram <neil@ossau.uklinux.net> Make scm_c_read use caller buffer only for unbuffered ports. We recently modified scm_c_read so that it temporarily swaps the caller's buffer with the port's normal read buffer, in order to improve performance in the case where the port is unbuffered (which actually means having a single-byte buffer) - but we implemented the swap in the buffered case too. The latter turns out to be a bad idea - because it means that the C code of a custom port implementation cannot rely on a port's buffer always being the same as when it was first set up - and so this commit reverts that. The buffer swapping trick now applies to unbuffered ports only. * libguile/ports.c (scm_c_read): Only do swapping of port and caller buffer for unbuffered ports. 2008-11-20 Andy Wingo <wingo@pobox.com> late-variable-{ref,set} -> toplevel-{ref,set} * benchmark/lib.scm: * libguile/vm-i-system.c (toplevel-ref, toplevel-set): * module/system/vm/assemble.scm (codegen): * module/system/vm/disasm.scm (code-annotation): s/late-variable/toplevel/. It's just a better name. 2008-11-20 Andy Wingo <wingo@pobox.com> merge vm docs into guile reference (as yet unfinished) * doc/ref/compiler.texi: A new empty section on the compiler. * doc/ref/data-rep.texi: Made to be a section of a chapter instead of an appendix. The beginnings of some revision, but not there yet. * doc/ref/guile.texi: Put the "Data Representation" essay into the new "History and Implementation Details" chapter. * doc/ref/history.texi: New empty section on Guile history. * doc/ref/libguile-concepts.texi: * doc/ref/libguile-smobs.texi: Fix up some xrefs. * doc/ref/vm.texi: New section documenting the VM. Not done yet. 2008-11-14 Andy Wingo <wingo@pobox.com> nifty generic compiler infrastructure -- no more hardcoded passes * module/system/base/language.scm (<language>): Rework so that instead of hardcoding passes in the language, we define compilers that translate from one language to another. Add `parser' to the language fields, a bit of a hack but useful for languages with s-expression external representations but with record internal representations. (define-language, *compilation-cache*, invalidate-compilation-cache!) (compute-compilation-order, lookup-compilation-order): Add an algorithm that does a depth-first search for a translation path from a source language to a target language, caching the result in a lookup table. * module/language/scheme/spec.scm: * module/language/ghil/spec.scm: Update to the new language format. * module/language/glil/spec.scm: Add a language specification for GLIL, with a compiler to objcode. Also there are parsers and printers, for repl usage, but for some reason this doesn't work yet. * module/language/objcode/spec.scm: Define a language specification for object code. There is some sleight of hand here, in the "compiler" to values; but there is method behind the madness, because this way we higher levels can pass environments (a module + externals pair) to objcode->program. * module/language/value/spec.scm: Define a language specification for values. There is something intellectually dishonest about this, but it does serve its purpose as a foundation for the language hierarchy. * configure.in: * module/language/Makefile.am * module/language/ghil/Makefile.am * module/language/glil/Makefile.am * module/language/objcode/Makefile.am * module/language/value/Makefile.am: Autotomfoolery for the ghil, glil, objcode, and value languages. * module/language/scheme/translate.scm (translate): Import the bits that understand `compile-time-environment' here, and pass on the relevant portions of the environment to the next compiler pass. * module/system/base/compile.scm (current-language): New procedure, refs the current language fluid, or lazily sets it to scheme. (call-once, call-with-output-file/atomic): Refactor these bits to use with-throw-handler. No functional change. (compile-file, compile-and-load, compile-passes, compile-fold) (compile): Refactor the public interface of the compiler to be generic and simple. Uses `lookup-compilation-order' to find a path from the source language to the target language. * module/system/base/syntax.scm (define-type): Adapt to changes in define-record. (define-record): Instead of expecting all slots in the first form, expect them in the body, and let the first form hold the options. * module/system/il/compile.scm (compile): Adapt to the compilation pass API (three in and two out). * module/system/il/ghil.scm (<ghil-var>, <ghil-env>) (<ghil-toplevel-env>): Adapt to define-record changes. * module/system/il/glil.scm (<glil-vars>): Adapt to define-record changes. (<glil>, print-glil): Add a GLIL record printer that uses unparse. (parse-glil, unparse-glil): Update unparse (formerly known as pprint), and write a parse function. * module/system/repl/common.scm (<repl>): Adapt to define-record changes. (repl-parse): New function, parses the read form using the current language. Something of a hack. (repl-compile): Adapt to changes in `compile'. (repl-eval): Fix up the does-the-language-have-a-compiler check for changes in <language>. * module/system/repl/repl.scm (start-repl): Parse the form before eval. * module/system/repl/command.scm (describe): Parse. (compile): Be more generic. (compile-file): Adapt to changes in compile-file. (disassemble, time, profile, trace): Parse. * module/system/vm/debug.scm: * module/system/vm/assemble.scm: Adapt to define-record changes. * module/language/scheme/translate.scm (receive): Fix an important bug that gave `receive' letrec semantics instead of let semantics. Whoops! 2008-11-14 Ludovic Courtès <ludo@gnu.org> Update `THANKS'. 2008-11-14 Ludovic Courtès <ludo@gnu.org> Update the thread stack base when `scm_with_guile' is invoked multiple times. * NEWS: Update. * libguile/threads.c (scm_i_init_thread_for_guile): When the thread is already guilified, update `t->base' so that it corresponds to the new stack base. Bug report and patch by Linas Vepstas <linasvepstas@gmail.com>. * test-suite/standalone/Makefile.am (test_scm_with_guile_CFLAGS, test_scm_with_guile_LDADD): New. (check_PROGRAMS, TESTS): Add `test-scm-with-guile'. 2008-11-13 Ludovic Courtès <ludo@gnu.org> Augment `.gitignore'. Update "guile(1)" man page. * doc/guile.1: Remove reference to the version and date. Mention R5RS, instead of R4RS. Explicitly say that the full documentation is in Texinfo (as other GNU packages do). 2008-11-13 Ludovic Courtès <ludo@gnu.org> Add "guile(1)" man page. Robert Merkel's copyright assignment to the FSF had apparently been on file for some time. * NEWS: Update. * doc/Makefile.am (dist_man1_MANS): New. 2008-11-12 Andy Wingo <wingo@pobox.com> more ghil parsing fixen * module/system/il/ghil.scm (parse-ghil): Fix a typo for values* (unparse-ghil): Only output (quote foo) if the object is a symbol. (unparse-ghil): Fix some missing ,@. 2008-11-11 Andy Wingo <wingo@pobox.com> fix unparse-ghil errors with quasiquote * module/system/il/ghil.scm (unparse-ghil): Fix some issues with quasiquote and unquote[-splicing]. Doh! rashly bump stack limit to 40k words * libguile/eval.c (scm_debug_opts): Whereas, today's machines are larger than yesterday's; GCC consumes more words per stack frame than it used to; and you can get quite some recursion in a halfway-compiled system, be it resolved: let's bump up the C stack limit to 40k words (160 kB / 320 kB, depending on word size). 2008-11-11 Andy Wingo <wingo@pobox.com> add parsers and unparser for ghil; ,language ghil works now * module/system/repl/common.scm (repl-print): Slightly refine the meaning of "language-printer": a language printer prints an expression of a language, not the result of evaluation. `write' prints values. * module/language/ghil/spec.scm (ghil): Define a language printer, and a translator for turning s-expressions (not scheme, mind you) into GHIL. * module/language/scheme/translate.scm (quote, quasiquote): Add some #:keyword action, so that we can (quote #:keywords). * module/system/base/language.scm (<language>): * module/system/base/compile.scm (read-file-in): Don't require that a language have a read-file; instead error when read-file is called. (compile-passes, compile-in): Refactor to call a helper method to turn the language + set of options into a set of compiler passes. * module/system/base/syntax.scm (define-type): Allow the type to be a list, with the car being the name and the cdr being keyword options. Interpret #:printer as a printer, and pass it down to... (define-record): Here. * module/system/il/ghil.scm (print-ghil, <ghil>): New printer for GHIL, yay! (parse-ghil, unparse-ghil): New lovely functions. Will document them in the manual. 2008-11-11 Ludovic Courtès <ludo@gnu.org> gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework. * gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'. (GCOld): Fix the order of the predicate and run-maker. gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al. See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for details. gc-benchmarks: Add `run-benchmark.scm'. gc-profile: Show the result of `(version)'. * gc-benchmarks/gc-profile.scm (main): Show `(version)'. 2008-11-10 Ludovic Courtès <ludo@gnu.org> Have `version' return `PACKAGE_VERSION'. * libguile/version.c (scm_version): Return `PACKAGE_VERSION' instead of "MAJOR.MINOR.MICRO". Change `GUILE_VERSION' to `1.9.0-bdwgc'. * GUILE-VERSION (GUILE_VERSION): Add `-bdwgc' prefix. Use `pkg-config' to detect BDW-GC at configure-time. * configure.in: Use `PKG_CHECK_MODULES' to look for libgc. This only works with GC 7.x+, which is what we want anyway. gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'. * gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter. (run-benchmark): Moved from `twobit-compat.scm'. Honor `*iteration-count*'. (%options): Add `--iterations'. (show-help): Document it. (main): Parameterize `*iteration-count*'. Import GC benchmarks from Larceny, by Hansen, Clinger, et al. These GPLv2+-licensed GC benchmarks are available from http://www.ccs.neu.edu/home/will/GC/sourcecode.html . gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer. * gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm". (save-directory-excursion, load-larceny-benchmark): New procedures. (%options): New variable. (show-help, parse-args): New procedures. (main): Use `parse-args' and `load-larceny-benchmark'. 2008-11-10 Andy Wingo <wingo@pobox.com> remove .cvsignore files 2008-11-05 Ludovic Courtès <ludo@gnu.org> Work around unintentional retention of modules by the GC. This reverts par of "Document the failure of `gc.test' wrt. unused modules." (commit 328efeb9a66dddcf78a24fad96d3db58e9c3375d.) * ice-9/boot-9.scm (set-module-eval-closure!): Don't set the `module' property on CLOSURE. * libguile/modules.c (scm_lookup_closure_module): Call `abort ()' to make it clear that code that uses the `module' property no longer works. That code is unused anyway. 2008-11-04 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/threads.c 2008-11-02 Ludovic Courtès <ludo@gnu.org> Remove the SMOB mark procedure for source properties. * libguile/srcprop.c (srcprops_mark): Remove. (scm_init_srcprop): Remove call to `scm_set_smob_mark ()'. 2008-11-02 Andy Wingo <wingo@pobox.com> proper printing of thunks, reduced disasm verbosity * module/system/vm/disasm.scm (disassemble-program): Don't print the nargs= nrest= etc line, it's redundant. * module/system/vm/program.scm (program-bindings-as-lambda-list): If the program bindings is null, then that's that. 2008-11-01 Andy Wingo <wingo@pobox.com> define macros before functions using macros; more MV fixen in srfi-69 * module/srfi/srfi-69.scm: Move the macros up before the functions that use them, so that the compiler can do its job. (hash-table-walk): While it is true about what I said about R5RS before, it seems that for R6 this will have to change. Anyway. In the meantime, since the test suite checks that hash-table-walk procedures' return values and number of return values are ignored, call that procedure within a call-with-values. 2008-11-01 Andy Wingo <wingo@pobox.com> fix for (apply values '(1)) * libguile/vm-i-system.c (return/values): In the multiple-values-to-a-single-value-continuation (or MV but where N=1), null out the correct number of values from the stack. Fixes aborts on (apply values '(1)). * testsuite/t-values.scm (call-with-values): Add a test. 2008-11-01 Andy Wingo <wingo@pobox.com> fix multiple values coming from interpreted or C procedures * libguile/vm-i-system.c (call, goto/args): Handle the case in which a non-program (i.e. interpreted program or a subr) returns multiple values. * testsuite/t-values.scm: Add test case that exhibited this problem. 2008-11-01 Andy Wingo <wingo@pobox.com> make-procedure-with-setter inherits name from getter * libguile/procs.c (scm_make_procedure_with_setter): Patch through the getter's procedure name to the procedure-with-setter. Fixes part of the srfi-17 test, as the VM doesn't set procedure-name on define -- but perhaps that is the bug that should be fixed. In any case this patching is cheap. * test-suite/tests/eval.test: Change so that (define name pws) is initially passed an anonymous procedure-with-setter, as was the case before the procs.c change. 2008-11-01 Andy Wingo <wingo@pobox.com> avoid delivering 0 values to 1-valued continuations in srfi-19 * module/srfi/srfi-19.scm: Some parts of this code used a strange idiom, `(values)', to indicate that a procedure did nothing. However, quoth R5RS: Except for continuations created by the `call-with-values' procedure, all continuations take exactly one value. Indeed the VM indicated this error. I reworked the code to avoid these cases. 2008-11-01 Andy Wingo <wingo@pobox.com> move scm srfi files to module/srfi, and compile them. * .gitignore: Add gdb-pre-inst-guile. * configure.in: Add module/srfi/Makefile. * module/Makefile.am: Add srfi/. * module/srfi/: SRFI scheme files moved here, and compiled. * srfi/Makefile.am: Remove the bits about the scheme files. 2008-11-01 Andy Wingo <wingo@pobox.com> move guilec.mk to am/guilec * am/Makefile.am: * am/guilec: guilec moved here from /guilec.mk. All includers of guilec adapted. 2008-11-01 Andy Wingo <wingo@pobox.com> remove stale env script, clean up gdb-pre-inst-guile * env: Removed (a vestige of the guile-vm merge). * gdb-pre-inst-guile.in: Make a bit more robust (using libtool --mode=execute). 2008-11-01 Andy Wingo <wingo@pobox.com> move ice-9/ and oop/ under module/ Moved ice-9/ and oop/ under module/, with the idea being that we have only scheme under module/. Adjusted configure.in and Makefile.am appropriately. Put oop/ at the end of the compilation order. 2008-10-31 Ludovic Courtès <ludo@gnu.org> Fix initialization of the SMOB GC "kind". * libguile/smob.c (scm_smob_prehistory): When initializing SMOB_GC_KIND, pass 1 as the CLEAR_NEW_OBJECTS argument to `GC_new_kind ()'. Without this, an assertion failure is triggered in libgc's `reclaim.c'. 2008-10-31 Andy Wingo <wingo@pobox.com> compile goops accessors. woot! * oop/goops.scm: Define compiler hooks for dealing with @slot-ref and @slot-set!. (make-bound-check-get, make-get, make-set): Compile these indexed accessors instead of having them be closures. Probably slower for the memoizer, but faster for the vm... not sure what the perfect solution is. * test-suite/tests/goops.test ("defining classes"): Add a test that defining a class with accessors works (it didn't until I figured out that (@ (system base compile) compile) thing). 2008-10-31 Andy Wingo <wingo@pobox.com> new ops: slot-ref, slot-set. remove and recompile your .go files * libguile/vm-i-scheme.c (slot-ref, slot-set): New ops. fix bug in define-scheme-translator * module/language/scheme/translate.scm (define-scheme-translator): Fix a bug in this macro for the syntax-error case. pass backtraces through the compiler * module/system/base/compile.scm (call-with-nonlocal-exit-protect): New helper, like unwind-protect but only for nonlocal exits. (call-with-output-file/atomic): Use call-with-nonlocal-exit-protect so that we don't mess up backtraces by catching all and then rethrowing. Should fix this more comprehensively somewhere, though. make define-inline more usable from external modules * module/system/il/inline.scm (define-inline): Use @ when accessing module vars so that other modules don't need to import all of our modules. However case-lambda is still needed. rework the scheme translator so it's extensible by external modules * module/language/scheme/translate.scm (*translate-table*) (define-scheme-translator): Rework the translator to have the clauses defined separately via the define-scheme-translator macro, so that external modules can define their own translators. Should be no functional change in this commit, though. 2008-10-31 Andy Wingo <wingo@pobox.com> compile goops submodules, goops.test now passes again * libguile/goops.c (get_slot_value, set_slot_value): While keeping the inlined getter/setter dispatch for closures, allow the getters and setters to be any kind of procedure. * oop/goops.scm (compute-getters-n-setters): Relax the checks on getter/setter procedures, so that if a getter is a procedure but not a closure, we don't try to poke its arity. * oop/goops/Makefile.am (SOURCES): Compile all the goops submodules! * oop/goops/old-define-method.scm: Removed, in an act of housekeeping. * oop/goops/compile.scm: * oop/goops/dispatch.scm: Break a circular module dependency by making sure that (oop goops) is loaded when we go to compile submodules. * oop/goops/compile.scm (compile-method/memoizer) (compile-method/memoizer+next): Allow a procedure without source through. This can happen with getter and setter lambdas that were compiled, and in that case there is no next-method call anyway. Ideally we should be able to specify compile-method for accessor methods... 2008-10-31 Andy Wingo <wingo@pobox.com> fix chaining up from interpreted to compiled methods; allow compiled init-thunk * libguile/goops.c (scm_sys_initialize_object): Don't assume that an init thunk is a closure; just go through scm_call_0 instead. * oop/goops/compile.scm (make-make-next-method/memoizer): Allow for the case that the next method is compiled. 2008-10-31 Ludovic Courtès <ludo@gnu.org> Don't invoke `on_thread_exit ()' from a pthread key destructor. The `on_thread_exit ()' function allocates memory via libgc. When called from the context of a pthread key detructor, the thread is essentially "dead" already and `GC_lookup_thread ()' returns NULL, which triggers an assertion in libgc's `thread_local_alloc.c'. This patch arranges so that `on_thread_exit ()' is called from a suitable context. * libguile/threads.c (on_thread_exit): Remove now invalid comment about access to libgc's TLS. (init_thread_key): Don't pass `on_thread_exit ()' to `scm_i_pthread_key_create ()'. (scm_leave_guile_cleanup): Invoke `do_thread_exit ()'. (really_launch): Invoke `pthread_exit ()'. 2008-10-31 Andy Wingo <wingo@pobox.com> compile goops The pending task is to make the accessors compiled too, and also to compile compile.scm and dispatch.scm, and to integrate dispatch into the VM. * oop/Makefile.am (SOURCES): VM-ify the makefile, so we compile goops.scm by default. * oop/goops.scm (load-toplevel): Load goops builtins when compiling too. (method): Fix a literal #<unspecified> in the generated procedure (for an empty body). (internal-add-method!): Cleverness when bootstrapping add-method!. Neat! (initialize for <generic>): Use the `method' macro so we get compilation support. * oop/goops/dispatch.scm (cache-methods): Don't assume entries are pairs. 2008-10-30 Andy Wingo <wingo@pobox.com> compile occam-channel * ice-9/Makefile.am (SOURCES): Compile the goops-using occam-channel.scm. 2008-10-30 Andy Wingo <wingo@pobox.com> fix up some assumptions that cmethods were lists * libguile/eval.i.c (type_dispatch, apply_vm_cmethod) (apply_memoized_cmethod): Tweak the nastiness a bit more so as to deal with the '(no-method) empty entries. I would like to stop the search if the cdr isn't a pair, but currently with the inlined memoized bits, the cdr is a pair. The fix would be to make the memoizer return a procedure and not the already-inlined bits -- slightly slower but the vm will be faster anyway. * libguile/objects.c (scm_mcache_lookup_cmethod): Same fixes here. * oop/goops/dispatch.scm (cache-hashval, cache-try-hash!): Allow non-list cmethod tails. 2008-10-30 Andy Wingo <wingo@pobox.com> runtime byte compilation of goops methods, whooooo * ice-9/boot-9.scm (make-modules-in): Change to make sure that we are making modules in modules; that is, that a global binding of `compile' doesn't prevent a module from importing a submodule named `compile'. (resolve-module): Clean up a bit, and serialize the logic. * libguile/objects.c (scm_mcache_lookup_cmethod, scm_apply_generic): * libguile/eval.i.c (CEVAL): Now that cmethod entries can have a program as their tail instead of a memoized proc, we have to change the halting condition on the method cache search, in both places: the one that's inlined into eval.i.c and the one in objects.c. If the cmethod isn't a pair, apply it. * libguile/goops.c (make): In the `make' procedure that's used before GOOPS is booted, bind #:formals, #:body, and #:compile-env on methods. * oop/goops/compile.scm (compute-entry-with-cmethod): There was a terrible trick here that involved putting a dummy pair in the cache, then modifying it in place with the result of memoization. The note claimed that this was to cut recursion short, or something. I can't see how it could recurse, given that `methods' is changing each time. Also, the pair trick doesn't work with byte-compiled methods. So, remove it. (compile-method): Dispatch to the appropriate method compiler, based on whether the method was defined with the interpreter or with the compiler. (make-next-method): New function, generically computes a `next-method' procedure, though the caller has to supply the arguments. (compile-method/vm): Exciting method byte compiler! (make-make-next-method/memoizer, compile-method/memoizer): Add the /memoizer suffix, and move all this code to the bottom of the file. 2008-10-30 Andy Wingo <wingo@pobox.com> recompiling with compile environments, fluid languages, cleanups * ice-9/boot-9.scm (compile-time-environment): Remove definition from boot-9 -- instead, autoload it and `compile' from (system base compile). * libguile/objcodes.h: * libguile/objcodes.c (scm_objcode_to_program): Add an optional argument, `external', the external list to set on the returned program. * libguile/vm-i-system.c (externals): New instruction, returns the external list. Only used by (compile-time-environment). * libguile/vm.c (scm_load_compiled_with_vm): Adapt to scm_objcode_to_program change. * module/language/scheme/translate.scm (translate): Actually pay attention to the environment passed as an argument. (custom-transformer-table): Expand out (compile-time-environment) to something that can be passed to `compile'. * module/system/base/compile.scm (*current-language*): Instead of hard-coding `scheme' in various places, use a current language fluid, initialized to `scheme'. (compile-file, load-source-file): Adapt to *current-language*. (load-source-file): Ada (scheme-eval): Removed, no one used this. (compiled-file-name): Don't hard-code "scm" and "go"; instead use the %load-extensions and %load-compiled-extensions. (cenv-module, cenv-ghil-env, cenv-externals): Some accessors for compile-time environments. (compile-time-environment): Here we define (compile-time-environment) to something that will return #f; the compiler however produces different code as noted above. (compile): New function, compiles an expression into a thunk, then runs the thunk to get the value. Useful for procedures. The optional second argument can be either a module or a compile-time-environment; in the latter case, we can recompile even with lexical bindings. (compile-in): If the env specifies a module, set that module for the duration of the compilation. * module/system/base/syntax.scm (%compute-initargs): Fix a bug where the default value for a field would always replace a user-supplied value. Whoops. * module/system/il/ghil.scm (ghil-env-dereify): New function, takes the result of ghil-env-reify and turns it back into a GHIL environment. * scripts/compile (compile): Remove some of the tricky error handling, as the library procedures handle this for us. * test-suite/tests/compiler.test: Add a test for the dynamic compilation bits. 2008-10-28 Ludovic Courtès <ludo@gnu.org> Document the impossibility to call the GC from within `on_thread_exit ()'. * libguile/threads.c (on_thread_exit): Add `FIXME' comment. 2008-10-26 Neil Jerram <neil@ossau.uklinux.net> Fix stack calibration-related errors when running make distcheck. * libguile/Makefile.am (stack-limit-calibration.scm): Use $(srcdir), to support building in a different directory. (MOSTLYCLEANFILES): Add stack-limit-calibration.scm. 2008-10-25 Andy Wingo <wingo@pobox.com> add `formals', `body', and `compile-env' slots to <method> * ice-9/boot-9.scm (compile-time-environment): Return #f instead of erroring under the interpreter, a bit more sane. * libguile/goops.c (create_standard_classes): * libguile/goops.h (scm_si_formals, scm_si_body, scm_si_compile_env): * oop/goops.scm (method, initialize): Add `formals', `body', and `compile-env' slots to <method>. 2008-10-25 Andy Wingo <wingo@pobox.com> defmacroize (oop goops accessors), (oop goops save) * oop/goops/accessors.scm (define-class-with-accessors) (define-class-with-accessors-keywords): Turn into defmacros. * oop/goops/save.scm (readable, restore, write-component): Turn into defmacros. Both of these changes are untested, unfortunately. 2008-10-25 Andy Wingo <wingo@pobox.com> add `compile-time-environment' * ice-9/boot-9.scm (compile-time-environment): New function, with documentation. The trick is that the compiler recognizes calls to (compile-time-environment) and replaces it with a representation of the *available* lexicals. Note that this might not be all the lexicals; only the heap-allocated ones are returned. * module/language/scheme/translate.scm (custom-transformer-table): Compile `compile-time-environment' to <ghil-reified-env>. * module/system/il/compile.scm (codegen): Add <ghil-reified-env> clause, which calls ghil-env-reify. * module/system/il/ghil.scm (ghil-env-reify): New procedure, returns a list of (NAME . EXTERNAL-INDEX). (<ghil>): Add <ghil-reified-env> object. 2008-10-25 Andy Wingo <wingo@pobox.com> define-type no longer expects `|' subform * module/system/base/syntax.scm (define-type): Rework to not require the `|', which confuses Emacs. * module/system/il/ghil.scm (<ghil>): * module/system/il/glil.scm (<glil>): Adapt to define-type changes. 2008-10-25 Neil Jerram <neil@ossau.uklinux.net> Add measure-hwm.scm to the set of distribution files. * libguile/Makefile.am (EXTRA_DIST): Add measure-hwm.scm. 2008-10-24 Neil Jerram <neil@ossau.uklinux.net> Fix hang in srfi-18.test * libguile/threads.h (held_mutex): New field. * libguile/threads.c (enqueue, remqueue, dequeue): Use critical section to protect access to the queue. (guilify_self_1): Initialize held_mutex field. (on_thread_exit): If held_mutex non-null, unlock it. (fat_mutex_unlock, fat_cond_free, scm_make_condition_variable, fat_cond_signal, fat_cond_broadcast): Delete now unnecessary uses of c->lock. (fat_mutex_unlock): Pass m->lock to block_self() instead of c->lock; move scm_i_pthread_mutex_unlock(m->lock) call from before block_self() to after. (scm_pthread_cond_wait, scm_pthread_cond_timedwait, scm_i_thread_sleep_for_gc): Set held_mutex before pthread call; reset it afterwards. I was seeing a hang in srfi-18.test, when running make check in master, in the "exception handler installation is thread-safe" test. It wasn't 100% reproducible, so looked like a race. The problem is that wait-condition-variable is not actually atomic in the way that it is supposed to be. It unlocks the mutex, then starts waiting on the cond var. So it is possible for another thread to lock the same mutex, and signal the cond var, before the wait-condition-variable thread starts waiting. In order for wait-condition-variable to be atomic - e.g. in a race where thread A holds (Scheme-level) mutex M, and calls (wait-condition-variable C M), and thread B calls (begin (lock-mutex M) (signal-condition-variable C)) - it needs to call pthread_cond_wait with the same underlying mutex as is involved in the `lock-mutex' call. In terms of the threads.c code, this means that it has to use M->lock, not C->lock. block_self() used its mutex arg for two purposes: for protecting access and changes to the wait queue, and for the pthread_cond_wait call. But it wouldn't work reliably to use M->lock to protect C's wait queue, because in theory two threads can call (wait-condition-variable C M1) and (wait-condition-variable C M2) concurrently, with M1 and M2 different. So we either have to pass both C->lock and M->lock into block_self(), or use some other mutex to protect the wait queue. For this patch, I switched to using the critical section mutex, because that is a global and so easily available. (If that turns out to be a problem for performance, we could make each queue structure have its own mutex, but there's no reason to believe yet that it is a problem, because the critical section mutex isn't used much overall.) So then we call block_self() with M->lock, and move where M->lock is unlocked to after the block_self() call, instead of before. That solves the first hang, but introduces a new one, when a SRFI-18 thread is terminated (`thread-terminate!') between being launched (`make-thread') and started (`thread-start!'). The problem now is that pthread_cond_wait is a cancellation point (see man pthread_cancel), so the pthread_cond_wait call is one of the few places where a thread-terminate! call can take effect. If the thread is cancelled at that point, M->lock ends up still being locked, and then when do_thread_exit() tries to lock M->lock again, it hangs. The fix for that is a new `held_mutex' field in scm_i_thread, which is set to point to the mutex just before a pthread_cond_(timed)wait call, and set to NULL again afterwards. If on_thread_exit() finds that held_mutex is non-NULL, it unlocks that mutex. A detail is that checking and unlocking held_mutex must be done before on_thread_exit() calls scm_i_ensure_signal_delivery_thread(), because the innards of scm_i_ensure_signal_delivery_thread() can do another pthread_cond_wait() call and so overwrite held_mutex. But that's OK, because it's fine for the mutex check and unlock to happen outside Guile mode. Lastly, C->lock is then not needed, so I've removed it. 2008-10-24 Neil Jerram <neil@ossau.uklinux.net> Fix hang in srfi-18.test * libguile/threads.h (held_mutex): New field. * libguile/threads.c (enqueue, remqueue, dequeue): Use critical section to protect access to the queue. (guilify_self_1): Initialize held_mutex field. (on_thread_exit): If held_mutex non-null, unlock it. (fat_mutex_unlock, fat_cond_free, scm_make_condition_variable, fat_cond_signal, fat_cond_broadcast): Delete now unnecessary uses of c->lock. (fat_mutex_unlock): Pass m->lock to block_self() instead of c->lock; move scm_i_pthread_mutex_unlock(m->lock) call from before block_self() to after. (scm_pthread_cond_wait, scm_pthread_cond_timedwait, scm_i_thread_sleep_for_gc): Set held_mutex before pthread call; reset it afterwards. I was seeing a hang in srfi-18.test, when running make check in master, in the "exception handler installation is thread-safe" test. It wasn't 100% reproducible, so looked like a race. The problem is that wait-condition-variable is not actually atomic in the way that it is supposed to be. It unlocks the mutex, then starts waiting on the cond var. So it is possible for another thread to lock the same mutex, and signal the cond var, before the wait-condition-variable thread starts waiting. In order for wait-condition-variable to be atomic - e.g. in a race where thread A holds (Scheme-level) mutex M, and calls (wait-condition-variable C M), and thread B calls (begin (lock-mutex M) (signal-condition-variable C)) - it needs to call pthread_cond_wait with the same underlying mutex as is involved in the `lock-mutex' call. In terms of the threads.c code, this means that it has to use M->lock, not C->lock. block_self() used its mutex arg for two purposes: for protecting access and changes to the wait queue, and for the pthread_cond_wait call. But it wouldn't work reliably to use M->lock to protect C's wait queue, because in theory two threads can call (wait-condition-variable C M1) and (wait-condition-variable C M2) concurrently, with M1 and M2 different. So we either have to pass both C->lock and M->lock into block_self(), or use some other mutex to protect the wait queue. For this patch, I switched to using the critical section mutex, because that is a global and so easily available. (If that turns out to be a problem for performance, we could make each queue structure have its own mutex, but there's no reason to believe yet that it is a problem, because the critical section mutex isn't used much overall.) So then we call block_self() with M->lock, and move where M->lock is unlocked to after the block_self() call, instead of before. That solves the first hang, but introduces a new one, when a SRFI-18 thread is terminated (`thread-terminate!') between being launched (`make-thread') and started (`thread-start!'). The problem now is that pthread_cond_wait is a cancellation point (see man pthread_cancel), so the pthread_cond_wait call is one of the few places where a thread-terminate! call can take effect. If the thread is cancelled at that point, M->lock ends up still being locked, and then when do_thread_exit() tries to lock M->lock again, it hangs. The fix for that is a new `held_mutex' field in scm_i_thread, which is set to point to the mutex just before a pthread_cond_(timed)wait call, and set to NULL again afterwards. If on_thread_exit() finds that held_mutex is non-NULL, it unlocks that mutex. A detail is that checking and unlocking held_mutex must be done before on_thread_exit() calls scm_i_ensure_signal_delivery_thread(), because the innards of scm_i_ensure_signal_delivery_thread() can do another pthread_cond_wait() call and so overwrite held_mutex. But that's OK, because it's fine for the mutex check and unlock to happen outside Guile mode. Lastly, C->lock is then not needed, so I've removed it. 2008-10-23 Ludovic Courtès <ludo@gnu.org> Expose `GC_dump ()' at the Scheme level. * libguile/gc.h (scm_gc_dump): New declaration. * libguile/gc.c (scm_gc_dump): New function. 2008-10-23 Andy Wingo <wingo@pobox.com> method is a defmacro. * oop/goops.scm (method): Make into a defmacro. define-method is a defmacro * oop/goops.scm (define-method): Make into a defmacro -- didn't change any of the logic, but the logic is a bit dodgy (see the note in the source). define-generic, define-accessor are defmacros too * oop/goops.scm (define-generic, define-accessor): Define as defmacros. I find their semantics to be a bit odd, though -- but the test case checks for this behavior, so we'll follow the test cases. make `define-class' and `class' into defmacros * oop/goops.scm: Use srfi-1, as util.scm already does. (kw-do-map): New helper for processing keyword args. (define-class-pre-definition, define-class): Rework so that define-class is a defmacro without side effects. There are two functional differences: we don't check that define-class is called only at the toplevel, because defining a lexical class might makes sense, and defmacros don't give us the toplevel check that we would want. Second in the redefinition case, we don't do a `define', as we don't actually need a new variable. (class): Similarly, make `class' a defmacro. 2008-10-18 Andy Wingo <wingo@pobox.com> fix typo in assembler * module/system/vm/assemble.scm (dump-object!): Whoops, spell `nexts' correctly. 2008-10-18 Andy Wingo <wingo@pobox.com> fix bug in self-tail-recursion with "external" variables; other sundries * gdbinit (pp, inst): New commands. * libguile/vm-engine.c (vm_error_not_a_pair): New error case. * libguile/vm-i-scheme.c (VM_VALIDATE_CONS): New macro -- use this instead of SCM_VALIDATE_* because SCM_VALIDATE will exit nonlocally before we have a chance to sync the regs. (car, cdr, set-car, set-cdr): Use VM_VALIDATE_CONS. * libguile/vm-i-system.c (goto/args): Bugfix: when doing a self-tail-recursion, allocate fresh externals. Fixes use of match.go. * module/system/vm/assemble.scm (dump-object!): Add some checks that we aren't dumping out values that the VM can't handle. * module/system/vm/disasm.scm (disassemble-externals): Fix rotten call to `print-info'. * oop/goops/dispatch.scm: Add a FIXME. * testsuite/Makefile.am (vm_test_files): * testsuite/t-closure4.scm (extract-symbols): New test, distilled with much effort out of match.scm. * ice-9/Makefile.am (NOCOMP_SOURCES): Re-enable compilation of match.scm. Yay! 2008-10-18 Andy Wingo <wingo@pobox.com> bug fix to enable code "packing" * module/system/vm/conv.scm (code-pack): Fix so that we actually recognize (make-int8 1) and turn it into (make-int8:1). 2008-10-17 Neil Jerram <neil@ossau.uklinux.net> Avoid `Stack overflow' errors when running `make check' For explanation, see comments and text in the new file libguile/measure-hwm.scm. * .gitignore: Add libguile/stack-limit-calibration.scm. * check-guile.in: Load libguile/stack-limit-calibration.scm. * configure.in: Add AC_CONFIG_FILES to generate test-use-srfi from test-use-srfi.in. * libguile/Makefile.am (TESTS, TESTS_ENVIRONMENT, stack-limit-calibration.scm): New targets, so that `make check' calibrates the stack limit before running the Guile test suite. * libguile/measure-hwm.scm: New file, calibrates stack limit for `make check'. * libguile/stackchk.c (scm_sys_get_stack_size): New primitive. * libguile/stackchk.h (scm_sys_get_stack_size): New primitive (declaration). * test-suite/standalone/test-use-srfi: Renamed test-use-srfi.in, so that ./configure can fill in variables in it. * test-suite/standalone/test-use-srfi.in: Load libguile/stack-limit-calibration.scm. 2008-10-16 Andy Wingo <wingo@pobox.com> elisp.test: apply to nil-terminated list is UNRESOLVED with compiled boot-9 * test-suite/tests/elisp.test: If running the '(apply foo nil) test fails with a vm-error, throw UNRESOLVED. This allows the test suite to pass in the compiled boot-9.scm while still keeping the elisp apply issue open. run the elisp test with a larger stack limit * test-suite/tests/elisp.test: Enlarge the stack for the duration of the elisp test. It's a hack, but it at least allows the test to run with a compiled ice-9. fix backtraces, broken since the program-bindings format change * module/system/vm/frame.scm (frame-bindings): Fix for new binding format; actually use the bindings accessors. (frame-lookup-binding): Clarify. 2008-10-16 Andy Wingo <wingo@pobox.com> fix use of `binding' data abstraction * module/system/vm/assemble.scm (make-temp-binding, btemp:name) (btemp:extp, btemp:index): Don't abuse program.scm's make-binding to make something that actually isn't a binding. (codegen): Do use program.scm's make-binding to make something that actually is a binding. * module/system/vm/program.scm (binding:start, binding:end): New accessors. (make-binding): Expand to have the start and end arguments in the constructor. 2008-10-16 Andy Wingo <wingo@pobox.com> ensure that lists pushed onto the stack are proper I saw this problem when running elisp.test -- it tries to apply a function to an arglist ending in nil, which obviously is not null. * libguile/vm-engine.h (PUSH_LIST): New helper macro, pushes the elements of a list onto the stack. Checks to make sure that the list is proper. * libguile/vm-i-system.c (list-break, mv-call, apply, goto/apply) (goto/cc): Use LIST_BREAK. * libguile/vm-engine.c (vm_error_improper_list): New error case. 2008-10-16 Andy Wingo <wingo@pobox.com> fix asyncs running in the vm; re-enable popen.scm compilation * libguile/vm-i-system.c (goto/args): Sync the registers before doing the SCM_TICK. We probably need a different SCM_TICK that saves the regs only if necessary. This fixes GC problems with a compiled popen.scm. * ice-9/Makefile.am: Re-enable popen.scm compilation. 2008-10-15 Andy Wingo <wingo@pobox.com> fix `(help)' * ice-9/session.scm (help): Return valid scheme forms in the no-arg and no-regex cases. fix mv-call disasm bug * module/system/vm/disasm.scm (code-annotation): Fix bug with mv-call. fix disasm bugs, add some more instruction annotations * module/system/vm/disasm.scm (disassemble-program): Fix misunderstanding of nlocs: the *actual* number of locals is nlocs + nargs, even if the arg is heap-allocated -- because our calling convention always puts the initial val on the stack. Also: don't disassemble the objects, they are now woven into the text. (code-annotation): Fix external-{ref,set} handling to allow for referencing externals from enclosed stack frames. Really this should be statically determined, though. Add late-variable-{ref,set} handling. 2008-10-12 Ludovic Courtès <ludo@gnu.org> Add GC benchmarks. 2008-10-12 Andy Wingo <wingo@pobox.com> make disassembly better -- a more woven text. * module/system/vm/assemble.scm (pop): Define a pop here too. (codegen): Rework how bindings are represented in a program's meta-info, so they declare their range in the binding list instead of you having to figure out when they end. * module/system/vm/conv.scm (make-byte-decoder): Return the end-address as well; requires a change to callers. * module/system/vm/disasm.scm (disassemble-objcode, disassemble-program) (disassemble-bytecode, disassemble-objects, disassemble-externals) (disassemble-meta, source->string, make-int16, code-annotation) (print-info): Rework to display my domination of `format', and, more seriously, start to integrate the "subsections" of the disassembly into the main disassembly text. * module/system/vm/program.scm (program-bindings-as-lambda-list): Update for new bindings format; should be more correct. 2008-10-11 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/threads.c 2008-10-11 Andy Wingo <wingo@pobox.com> simplify disassembly annotations a bit * module/system/vm/disasm.scm (original-value): Simplify a bit to normally dispatch on the instruction, only trying code->object at the end. make each invocation of `while' throw to different keys * ice-9/boot-9.scm (while): Further fixes to while, brought out by the test suite. Also updated documentary comments. relax an assertion -- the test suite completes without aborting, whee * libguile/vm-i-system.c (call/cc, goto/cc): Don't assert that ip matches vp->ip, because vp->ip is not restored by vm_reset_stack, and indeed it's re-set to 0 by `halt'. But still, perhaps reset_stack and halt should indeed reset vp->ip. 2008-10-11 Andy Wingo <wingo@pobox.com> truly thread-local vms; don't compile popen.scm * ice-9/Makefile.am: Don't compile popen.scm, its behaviour at runtime is not consistent -- seems to miss some GC references? I suspect a bug in the compiler. In any case without popen.scm being compiled, continuations.test, r4rs.tes, and r5rs_pitfall.test do pass. * libguile/threads.h (scm_i_thread): * libguile/threads.c (thread_mark, guilify_self_2): Add a field for the thread's vm. Previously I had this as a fluid, but it seems that newly created threads share their fluid values from the creator thread; as expected, I guess. In any case one VM should not be active in two threads. * libguile/vm.c (scm_the_vm): Change to access the thread-local vm, instead of accessing a fluid. (scm_the_vm_fluid): Removed. * module/system/vm/vm.scm: Removed *the-vm*. 2008-10-10 Ludovic Courtès <ludo@gnu.org> Fix compilation error due to strict aliasing rules on `i386-unknown-freebsd7.0'. * libguile/threads.c (scm_threads_mark_stacks): Cast `&t->regs' to `(void *)' rather than `(SCM_STACKITEM *)' to avoid "warning: dereferencing type-punned pointer will break strict-aliasing rules" with GCC 4.2.1 on `i386-unknown-freebsd7.0'. 2008-10-09 Ludovic Courtès <ludo@gnu.org> Fix compilation of the hard copy of the R5RS, tutorial and GOOPS manual. * doc/tutorial/Makefile.am (TEXINFO_TEX): Remove. * doc/goops/Makefile.am (TEXINFO_TEX): Remove. * doc/r5rs/Makefile.am (TEXINFO_TEX): Remove. 2008-10-09 Ludovic Courtès <ludo@gnu.org> Add test case to make sure `read' returns mutable strings. * test-suite/tests/reader.test ("reading")["returned strings are mutable"]: New test, as reported by szgyg <szgyg@ludens.elte.hu>. 2008-10-09 Ludovic Courtès <ludo@gnu.org> Revert "Make literal strings (i.e., returned by `read') read-only." This reverts commit fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4. The rationale is that `read' must return mutable strings, as reported by szgyg <szgyg@ludens.elte.hu>. 2008-10-09 Andy Wingo <wingo@pobox.com> NULLSTACK fixes for nonlocal exits in reentrant pre-wind handlers * libguile/vm-i-system.c (goto/cc): Add some asserts here. * libguile/vm.c (capture_vm_cont): Add some asserts here too. (reinstate_vm_cont): Null the correct number of bytes. Add a FIXME. (vm_reset_stack): Make the code a bit clearer. Null the correct number of bytes. * libguile/vm-engine.h (NULLSTACK_FOR_NONLOCAL_EXIT): New macro, handles a very tricky case that took me days to find! Amply commented. Expands to nothing in the normal case. * libguile/vm-i-system.c (call, goto/args, mv-call): Call NULLSTACK_FOR_NONLOCAL_EXIT in the right places. Fixes continuations.test. 2008-10-09 Andy Wingo <wingo@pobox.com> sundries: side effects in interpreted repl, wrong-num-args in vm, self-checks * libguile/vm-engine.c (vm_error_wrong_num_args): Sync the registers before calling scm_wrong_num_args. (The other cases are handled more uniformly.) * libguile/vm.c (vm_heapify_frames_1): Add a FIXME: I don't think we should be modifying the stack. (scm_vm_save_stack): If stack nulling is enabled, verify the stack here before reifying it. * module/language/scheme/spec.scm (scheme): Use primitive-eval here instead of eval, because at the repl we do want to allow evaluations to have side effects like setting the current module. 2008-10-09 Andy Wingo <wingo@pobox.com> handle throws to unknown keys in the repl * module/system/repl/repl.scm (default-catch-handler): Don't rethrow if we don't know the key, just print an error. fix dynwind + nonlocal entrance/exit + programs bug * libguile/dynwind.c (scm_i_dowinds): Invoke guard procedures when entering and exiting nonlocally. Previously this procedure was program-racist. 2008-10-03 Andy Wingo <wingo@pobox.com> precise stack marking, fix some missed references, still imperfect * libguile/vm-engine.h (CHECK_STACK_LEAK, NULLSTACK): Add a new mode, VM_ENABLE_STACK_NULLING, that tries to ensure that all stack data past the top of the stack is NULL. This helps to verify the VM's consistency. If VM_ENABLE_STACK_NULLING is not defined, there is no overhead. (DROP, DROPN): Hook into NULLSTACK. (POP_LIST): Hoo, fix a good bug: if CONS triggered a GC, the elements of the list that had not yet been consed would not be marked, because the sp was already below them. (NEXT): Hook into CHECK_STACK_LEAK. (INIT_ARGS): Add a note that consing the rest arg can cause GC. (NEW_FRAME): Cons up the external data after initializing the frame, so that if GC is triggered, the precise marker sees a well-formed frame. * libguile/vm-i-loader.c (load-program): In the four-integers case, use the POP macro so that we can hook into NULLSTACK (if necessary). * libguile/vm-i-scheme.c (ARGS2, ARGS3): Hook into NULLSTACK. * libguile/vm-i-system.c (halt): Null the nvalues. Rework some asserts into using ASSERT, and null the stack when we free the frame. (variable-set): Use DROPN instead of sp -= 2. (BR): Hook into NULLSTACK. (goto/args): Hook into NULLSTACK. In the non-self case, delay updating the frame until after INIT_ARGS so that GC sees a well-formed frame. Delay consing the externals until after the frame is set up, as in NEW_FRAME. (call/cc): Add some asserts. (return): Rework some asserts into ASSERT, and hook into NULLSTACK. (return/values): Hook into NULLSTACK, and use ASSERT. (return/values*) Use ASSERT. * libguile/vm.c (VM_ENABLE_ASSERTIONS, VM_ENABLE_STACK_NULLING): These are the variables that control assertions and nulling. Perhaps we can do these per-engine when we start compiling the debug engine separate from a speedy engine. (vm_mark_stack): Add a precise stack marker. Yay! (vm_cont_mark): Mark the continuation stack precisely. (capture_vm_cont): Record the difference from the vp's stack_base too, so that we can translate the dynamic links when marking the continuation stack. Memset the stack to NULL if we are doing nulling. (reinstate_vm_cont): If we are nulling, null out the relevant part of the stack. (vm_reset_stack): When resetting sp due to a nonlocal exit, null out the stack too. (vm_mark): If we are nulling, assert that there are no extra values on the stack. Mark the stack precisely. 2008-10-03 Andy Wingo <wingo@pobox.com> remove repl.scm's start-stack definition * module/system/repl/repl.scm: Now that we actually compile start-stack, no need to provide our own definition here. add gdb-pre-inst-guile * configure.in: * gdb-pre-inst-guile.in: Add gdb-pre-inst-guile, because I'm tired of typos. You can run it just like Guile. For compiling, you might try GUILE=./gdb-pre-inst-guile scripts/compile foo.scm. 2008-10-02 Andy Wingo <wingo@pobox.com> be more like the interpreter in signalling wrong-num-args * libguile/vm-engine.c: Call scm_wrong_num_args in the wrong-num-args case, to be more like the interpreter. * libguile/vm-engine.h (ASSERT): New macro. * libguile/vm-i-system.c (apply, goto/apply): Assert that nargs >= 2, because the compiler should always feed us correct instructions. (call/cc): If no values are returned to the continuation, signal no_values instead of wrong_num_args. 2008-09-30 Andy Wingo <wingo@pobox.com> load the i18n extension when compiling i18n.scm * ice-9/i18n.scm: Load the i18n extension when compiling too, so that the macros that depend on (provided? 'nl-langinfo) actually have nl-langinfo. Fixes the i18n test. 2008-09-30 Andy Wingo <wingo@pobox.com> fix compilation of quasiquote with splicing and improper lists * libguile/vm-engine.h (POP_CONS_MARK): New macro, analagous to POP_LIST_MARK; used in quasiquote on improper lists. * libguile/vm-i-system.c (cons-mark): New instruction. You know the drill, remove all your .go files please. * module/system/il/compile.scm (codegen): Compile quasiquoted improper lists with splices correctly. Additionally check that we don't have slices in the CDR of an improper list. * testsuite/t-quasiquote.scm: Add a test for unquote-splicing in improper lists. 2008-09-30 Andy Wingo <wingo@pobox.com> fix some missed references when calling C functions * gdbinit: Update to be a bit more useful. * libguile/vm-i-system.c: Make sure that arguments to C procedures are visible on the stack so they get marked. Could be a source for the missed references. 2008-09-30 Andy Wingo <wingo@pobox.com> Merge commit 'origin/master' into vm Conflicts: doc/Makefile.am ice-9/Makefile.am libguile/gc.c 2008-09-30 Andy Wingo <wingo@pobox.com> (oop goops) works again, after (the-environment) removal * oop/goops.scm: Update so as not to use (the-environment), which no longer exists. I think that the speed characteristics are the same, broadly speaking. object-documentation knows about programs * ice-9/documentation.scm (object-documentation): Add hooks for getting documentation for compiled procedures, too. (Goops would be helpful here.) don't require users of users of optargs to have used optargs * ice-9/optargs.scm: Do the compile-friendly equivalent of unquoting in a value into the macro: use @@. 2008-09-30 Andy Wingo <wingo@pobox.com> compile @ and @@ * libguile/vm-engine.c (vm_run): Add new error case for resolving @ or @@ references, but there is no such module. Possible if module-public-interface returns #f. * libguile/vm-i-loader.c (link-now): Allow the stack arg to be a sym, as before, or a list, indicating an absolute reference. Could be two separate instructions, but I'm lazy. * libguile/vm-i-system.c (late-variable-ref, late-variable-set): As in link-now, allow the lazy reference to be a list, for @ and @@. * module/language/scheme/translate.scm (custom-transformer-table): Compile @ and @@, and set! forms for both of them. This will ease the non-hygienic pain for exported macros. * module/system/il/compile.scm (make-glil-var): Translate public and private module variable references into glil-module variables. * module/system/il/ghil.scm (ghil-var-at-module!): New function, resolves a variable for @ or @@. * module/system/il/glil.scm (<glil-module>): Revival of <glil-module>, this time with the semantics that it really links to a particular module. * module/system/vm/assemble.scm (<vlink-now>, <vlink-later>): Redefine as taking a "key" as the argument, which may be a sym or a list; see the notes on link-now for more details. (codegen): Compile <glil-module> appropriately. Some duplication here, probably could use some cleanup later. 2008-09-29 Andy Wingo <wingo@pobox.com> call toplevel variables "toplevel", not "module" * module/system/il/ghil.scm (ghil-var-for-set!, ghil-var-for-ref!) (ghil-var-define!): ghil-var-kind of a toplevel var is now 'toplevel. * module/system/il/glil.scm: Renamve <glil-module> to <glil-toplevel>. Remove the unused `module' field. Remove the unused <glil-late-bound> type. * module/system/il/compile.scm (make-glil-var): s/toplevel/module/ * module/system/vm/assemble.scm (<vlink-later>, <vdefine>): Remove the unused `module' parameters from these two types. (codegen, dump-object!): Adapt to module/toplevel name changes. 2008-09-29 Andy Wingo <wingo@pobox.com> remove `type' and `value' fields from <ghil-var> * module/system/il/ghil.scm (<ghil-var>): Remove `type' and `value' fields, as they were not used. move module-public-interface to C, and expose it as C API * libguile/modules.h: * libguile/modules.c: * ice-9/boot-9.scm (module-public-interface): Move definition of module-public-interface to C, where it is now available as scm_module_public_interface (). 2008-09-28 Han-Wen Nienhuys <hanwen@lilypond.org> Remove GH and its traces. 2008-09-28 Andy Wingo <wingo@pobox.com> allocate variables that are set! on the heap * module/system/il/ghil.scm (ghil-lookup): So, it turns out this function needed to be split into three: (ghil-var-is-bound?, ghil-var-for-ref!, ghil-var-for-set!): The different facets of ghil-lookup. Amply commented in the source. The difference being that we now allocate variables that are set! on the heap, so that other continuations see their possibly-modified values. (force-heap-allocation!): New helper. * testsuite/Makefile.am: * testsuite/t-call-cc.scm: New test, that variables that are set! are allocated on the heap, so that subsequent modifications are still seen by the continuation. The test was distilled from test 7.3 in r5rs_pitfall.test. 2008-09-28 Andy Wingo <wingo@pobox.com> revert part of 7ff017002ddc980 that caused missed references * libguile/programs.c (scm_c_make_closure): If the program is actually not a program, abort. This can happen if GC misses a reference, as currently seems to happen. * libguile/vm.c (vm_mark): Revert part of 7ff017002ddc980f684120653549a10c6c7cde5c, which changed the call to scm_mark_locations. I'm 99% *sure* this is wrong, but it seems to prevent missed references when recompiling the .go files in guile itself. Needs revisiting soon, but for the time being we can go back to where we were a couple of days ago. * libguile/vm-i-system.c (halt, vector, vector-mark): Sync the registers before calling into C, as it may GC. 2008-09-28 Andy Wingo <wingo@pobox.com> don't compile psyntax.scm * ice-9/Makefile.am: Don't try to compile psyntax.scm 2008-09-26 Ludovic Courtès <ludo@gnu.org> Don't use `scm_leave_guile ()' in mutex/cond-related procedures. * libguile/threads.c (scm_pthread_mutex_lock, scm_pthread_cond_wait, scm_pthread_cond_timedwait): Don't call `scm_{leave,enter}_guile ()'. Implement `scm_std_select ()' in terms of `scm_without_guile ()'. * libguile/threads.c (struct select_args): New. (do_std_select): New function. (scm_std_select): Don't use `scm_{leave,enter}_guile ()' since they don't have any effect; use `scm_without_guile ()' instead. 2008-09-26 Andy Wingo <wingo@pobox.com> rename psyntax.ss to psyntax.scm to hack around makefile foo * ice-9/Makefile.am (SOURCES): * ice-9/syncase.scm: * ice-9/psyntax.scm: Renamve psyntax.ss to psyntax.scm. This way the guilec rules won't delete it on a make clean. Doh! 2008-09-26 Andy Wingo <wingo@pobox.com> Fix continuation marking, and some tests. * libguile/continuations.c (continuation_mark): Mark the vm continuations. * libguile/vm.c (vm_cont_mark): Fix the marking function. (vm_mark): Fix this one too -- the size is a number of STACKITEMS, which we foolishly assume are the same size as SCM. * test-suite/tests/ftw.test: Make our stat hacks verifyable without assuming that they are interpreted. * test-suite/tests/r5rs_pitfall.test: Re-indent. 2008-09-26 Andy Wingo <wingo@pobox.com> actually compile start-stack to something useful * ice-9/boot-9.scm (start-stack): Define as a defmacro instead of an acro in C. We have a way to delay evaluation of the exp, after all: putting it in a thunk is sufficient. * libguile/debug.h: * libguile/debug.c (scm_sys_start_stack): Renamed from scm_start_stack, and exposed to the user. Takes a thunk instead of an expression + environment. (scm_m_start_stack): Remove this acro. * module/language/scheme/translate.scm (custom-transformer-table): Remove the start-stack special case. 2008-09-25 Ludovic Courtès <ludo@gnu.org> Enclose `regexp.test' in a module. * test-suite/tests/regexp.test: Add `define-module' clause. 2008-09-25 Ludovic Courtès <ludo@gnu.org> Fix handling of the FLAGS argument in `fold-matches'. * ice-9/regex.scm (fold-matches): If FLAGS is non-null, use `(car flags)', not `flags'. * test-suite/tests/regexp.test ("fold-matches"): New test prefix. * NEWS: Update. 2008-09-25 Andy Wingo <wingo@pobox.com> further compilation fixes -- all files compile fine now * ice-9/runq.scm (strip-sequence): Remove use of obtuse guile `define' extension. * ice-9/boot-9.scm (while): Redefine so as not to unquote in a procedure. Less hygienic. Perhaps we should switch to syncase at some point. * ice-9/session.scm (help): Redefine as a normal macro, so that it can be compiled. Not very useful though -- further effort should go into (system repl ...). (system-module): Removed, it didn't work, and is not useful as far as I can tell. * ice-9/string-fun.scm (string-prefix-predicate): Remove guile define extension usage. Compilation also fixed by `while' compilation fix. * ice-9/threads.scm (par-mapper): Remove guile define extension usage. 2008-09-25 Andy Wingo <wingo@pobox.com> compile `delay' into `make-promise' with a thunk * module/language/scheme/translate.scm (custom-transformer-table): Translate `delay' into `make-promise'. 2008-09-25 Andy Wingo <wingo@pobox.com> export `make-promise' to scheme * libguile/eval.h: * libguile/eval.c (scm_make_promise): Rename from `scm_makprom', and export as the scheme procedure, `make-promise'. * libguile/eval.i.c (CEVAL): s/makprom/make_promise/. 2008-09-25 Andy Wingo <wingo@pobox.com> enable compilation of more modules * ice-9/Makefile.am: Compile most modules. There are still a couple that fail to compile. 2008-09-25 Andy Wingo <wingo@pobox.com> a number of small compilation fixes * ice-9/boot-9.scm: Allow a compiled load of posix, networking, and deprecated files. * module/language/scheme/translate.scm (lookup-transformer): Lookup the sc-macro by value, not by name. Works around the fact that compiled macros don't have names, which is probably a bug. * module/system/base/compile.scm (syntax-error) (call-with-compile-error-catch): Throw and catch a key that's not used by anyone else. Write error messages to the error port. * module/system/repl/repl.scm (default-catch-handler): Call display-error with the correct number of arguments. * module/system/vm/frame.scm (frame-program-name): Guard against unbound variables. * ice-9/optargs.scm (let-keywords-template): Don't unquote in a helper procedure. A bit irritating. I suppose we should fix the modules + syncase situation at some point, and then switch to syncase. 2008-09-25 Andy Wingo <wingo@pobox.com> compile psyntax-pp * ice-9/Makefile.am: Compile psyntax-pp.scm, which is the new name of psyntax.pp. * ice-9/syncase.scm: Load the pre-processed source as psyntax-pp so that we load up a .go file if available. 2008-09-25 Andy Wingo <wingo@pobox.com> fix handling of multiple values from c functions * libguile/vm-i-system.c (mv-call, goto/cc): Fix handling of values returns from C or interpreted functions. add gdbinit for debugging the vm * gdbinit: Add my gdbinit. The most useful commands are gwrite and vmstack. 2008-09-25 Andy Wingo <wingo@pobox.com> compile call/cc, yee ha * libguile/vm-i-system.c (call, goto/args): Add a FIXME for handling the case in which a call to the interpreter returns a values object. (call/cc, goto/cc): Flesh out, and handle full continuations (with the C stack also). * module/language/scheme/translate.scm (custom-transformer-table): Compile call-with-current-continuation. This is necessary so that the called procedure is called in tail position. * module/system/il/compile.scm (codegen): Translate apply to goto/apply, call/cc to goto/cc, etc when in tail position. 2008-09-25 Andy Wingo <wingo@pobox.com> fix bug introduced in the fluid commit * libguile/vm.c (the-vm): If the dynamic binding of *the-vm* is false, make a new vm. Fixes multiple threads with the vm since the *the-vm* fluid changes. 2008-09-24 Andy Wingo <wingo@pobox.com> make call/cc capture and restore the vm stacks * libguile/continuations.c (scm_make_continuation): Capture VM continuations as well, as their stack is outside the C stack. (copy_stack): Reinstate VM stacks with the C stack. * libguile/continuations.h (scm_t_contregs): Add a pointer for VM stacks. A binary-incompatible change -- hopefully not too many people were messing around with this struct, though. * libguile/vm-engine.c (vm_run): Add a note about possibly maintaining a stack of vms. * libguile/vm.c (struct scm_vm_cont): New struct, distinct from scm_vm. (vm_cont_mark, vm_cont_free, capture_vm_cont, reinstate_vm_cont): Reorder some code, and fix some bad assumptions about what part of the stack to copy; obviously this code was never used. * libguile/vm.h: * libguile/vm.c (scm_vm_capture_continuations) (scm_vm_reinstate_continuations): New public functions, used by continuations.c. 2008-09-24 Andy Wingo <wingo@pobox.com> the vm is a fluid * module/system/vm/vm.scm: * libguile/vm.h: * libguile/vm.c: Make the `the-vm' procedure access a fluid, `*the-vm*'. Export that fluid from vm.h and vm.scm. 2008-09-23 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc 2008-09-23 Ludovic Courtès <ludo@gnu.org> Make literal strings (i.e., returned by `read') read-only. * libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to return a read-only string, as mandated by R5RS. Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>. * libguile/strings.c (scm_i_make_read_only_string): New function. (scm_i_shared_substring_read_only): Special-case the empty string so that the read-only and read-write empty strings are `eq?'. This optimization is relied on by the `substring/shared' `empty string' test case in `srfi-13.test'. * libguile/strings.h (scm_i_make_read_only_string): New declaration. * test-suite/tests/strings.test ("string-set!")["literal string"]: New test. * NEWS: Update. 2008-09-23 Ludovic Courtès <ludo@gnu.org> Make `symbol->string' return a read-only string. * libguile/strings.c (scm_i_symbol_substring): Return a read-only string since R5RS requires `symbol->string' to return a read-only string. Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>. * test-suite/tests/symbols.test: Add `define-module' clause. (exception:immutable-string): Adjust to current exception. ("symbol->string")["result is an immutable string"]: Use `pass-if-exception' instead of `expect-fail-exception'. * NEWS: Update. 2008-09-22 Neil Jerram <neil@ossau.uklinux.net> Fix for incorrect (gcd -2) => -2; should give 2. (reported by Bill Schottstaedt) * libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs to ensure that result is non-negative. * test-suite/tests/numbers.test ("gcd"): New test, (gcd -2). 2008-09-19 Ludovic Courtès <ludo@gnu.org> Use GC's accessors rather than its global variables. * libguile/gc.c (scm_storage_prehistory): Use `GC_set_free_space_divisor ()' instead of accessing the global variable directly. 2008-09-18 Ludovic Courtès <ludo@gnu.org> Fix `strftime' documentation wrt. `%Z'. * doc/ref/posix.texi (Time)[strftime]: Remove erroneous note saying that `%Z' ignores `tm:zone'. Reported by Neil Jerram. 2008-09-18 Andy Wingo <wingo@pobox.com> don't poke installed scm, go, etc files when running pre-inst-guile * libguile/load.c (scm_init_load_path): If GUILE_SYSTEM_PATH is set, use that instead of the compiled-in suffix to the load path. And, as a special case, GUILE_SYSTEM_PATH= is interpreted as '(). A bit nasty. * pre-inst-guile-env.in (top_builddir): Set GUILE_SYSTEM_PATH to the empty string, if it is not set. 2008-09-18 Ludovic Courtès <ludo@gnu.org> Implement `scm_without_guile ()' in terms of `GC_do_blocking ()'. * libguile/threads.c (guilify_self_1): Initialize `t->guile_mode'. (guilify_self_2): Likewise. (struct without_guile_arg): New type. (without_guile_trampoline): New function. (scm_without_guile): Implement in terms of `GC_do_blocking ()'. * libguile/threads.h (scm_i_thread)[guile_mode]: New field. 2008-09-18 Ludovic Courtès <ludo@gnu.org> Remove double inclusion of <config.h> in `threads.c'. configure: Look for `GC_do_blocking ()' and its declaration. * configure.in: Look for `GC_do_blocking ()' and its declaration. 2008-09-18 Andy Wingo <wingo@pobox.com> lambda-lifting for (lambda () ...) as consumer of call-with-values * libguile/vm-engine.c (vm_run): Add new error case, vm_error_not_enough_values. * libguile/vm-i-system.c (goto/nargs, call/nargs): So, in these cases, if we get too many values, we don't truncate the values like we do in the single-value continuation case, or in the mvbind case. What to do? I guess we either truncate them here, or only allow the correct number of values. Dunno. Mark the code as a fixme. (truncate-values): New instruction, for mv-bind: checks that the number of values on the stack is compatible with the number of bindings we have arranged for them, truncating if necessary. * module/language/scheme/translate.scm (custom-transformer-table): Compile receive as a primary form -- not so much because it is a primary form, but more to test the mv-bind machinery. Also it's more efficient, I think. * module/system/il/compile.scm (lift-variables!): New helper, factored out of `optimize'. (optimize): Add a few more cases. Adapt `lambda' optimization, which isn't much. I'm not happy with ghil as a mungeable language. Add a case for call-with-values with the second argument is a lambda: lift the lambda. Untested. (codegen): Refactor the push-bindings! code. Compile mv-bind. * module/system/il/ghil.scm (<ghil-mv-bind>): Add mv-bind construct, along with its procedures. * module/system/il/glil.scm (<glil-mv-bind>): Add mv-bind construct, different from the high-level one. It makes sense in the source, I think. * module/system/vm/assemble.scm (codegen): Assemble glil-mv-bind by pushing onto the bindings list, and actually push some code to truncate the values. 2008-09-18 Ludovic Courtès <ludo@gnu.org> Use the `GC_FREE_SPACE_DIVISOR' environment variable. * libguile/gc.c (scm_storage_prehistory): Initialize `GC_free_space_divisor' using the `GC_FREE_SPACE_DIVISOR' environment variable. 2008-09-18 Ludovic Courtès <ludo@gnu.org> Fix first-time compilation Hello! The attached patch fixes first-time compilation, by ensuring SRFI modules are built before "guile-tools compile" is ever run. Thanks, Ludo'. From 691a111c440a26c021f52b4027b0d9772f8e04cc Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org> Date: Tue, 16 Sep 2008 23:13:38 +0200 Subject: [PATCH] Fix compilation order of the sub-directories. * Makefile.am (SUBDIRS): Move `ice-9' past `srfi' and friends, so that the SRFI modules needed by the compiler are built before "guile-tools compile" is used. 2008-09-18 Andy Wingo <wingo@pobox.com> fix case in which we can fail to exit the repl cleanly * module/system/repl/repl.scm (next-char): Don't throw if we get an EOF, just return the EOF object. Fixes a case in which we fail to exit cleanly. 2008-09-18 Ludovic Courtès <ludo@gnu.org> Remove per-thread `gc_running_p'. * libguile/gc.c (scm_gc): Don't use `scm_gc_running_p' as an lvalue. * libguile/gc.h (scm_gc_running_p): Define to 0. * libguile/threads.h (scm_i_thread)[gc_running_p]: Remove. 2008-09-17 Ludovic Courtès <ludo@gnu.org> Remove GC-related fields from `scm_i_thread'. * libguile/gc.h (scm_i_freelist, scm_i_freelist2): Remove declarations. * libguile/threads.c (resume): Don't use `t->clear_freelists_p' and `scm_i_freelist{,2}'. (scm_enter_guile, scm_leave_guile, guilify_self_1): Don't use the `heap_mutex' and other fields removed from `scm_i_thread'. (scm_i_freelist, scm_i_freelist2): Remove. * libguile/threads.h (scm_i_thread)[heap_mutex, freelist, freelist2, clear_freelists_p]: Remove. 2008-09-17 Ludovic Courtès <ludo@gnu.org> Remove code intended to put threads to sleep. Actually, threads would "go to sleep" either by blocking on a heap allocation, or by noticing `scm_i_thread_go_to_sleep' is set when running `SCM_TICK', which limits the applicability of this technique (e.g., it was not appropriate for the shared string code). * libguile/threads.c (scm_i_thread_go_to_sleep, scm_i_thread_put_to_sleep, scm_i_thread_invalidate_freelists, scm_i_thread_wake_up, scm_i_thread_sleep_for_gc): Remove. * libguile/threads.h (scm_i_thread_go_to_sleep, scm_i_thread_put_to_sleep, scm_i_thread_invalidate_freelists, scm_i_thread_wake_up, scm_i_thread_sleep_for_gc): Remove declarations. (SCM_THREAD_SWITCHING_CODE): Do nothing. 2008-09-17 Ludovic Courtès <ludo@gnu.org> Remove use of `scm_i_thread_put_to_sleep ()' in the string code. * libguile/strings.c (scm_i_string_writable_chars): Remove use of `scm_i_thread_put_to_sleep ()'. This leaves a race condition, which is hopefully not harmful. 2008-09-17 Ludovic Courtès <ludo@gnu.org> Remove GC-related code from fluids. * libguile/fluids.c (all_dynamic_states, all_fluids): Remove. Together, they prevented dynamic states and fluids to be collected. Callers no longer use them. (resize_all_states): Remove. (grow_dynamic_state): New function. (next_fluid_num): Don't call `resize_all_states ()'. (scm_i_fluid_num, scm_i_fast_fluid_ref, scm_i_fast_fluid_set_x): Remove, as they broke encapsulation and would have needed duplication of the lazy dynamic state growing code. (scm_fluid_ref, scm_fluid_set_x): Lazily grow the dynamic state's fluid vector. (scm_fluids_prehistory): Don't set an `scm_after_sweep_c_hook'. * libguile/fluids.h (SCM_FLUID_NUM, SCM_FAST_FLUID_REF, SCM_FAST_FLUID_SET_X, scm_i_fluid_num, scm_i_fast_fluid_set_x, scm_i_fast_fluid_ref): Remove. * libguile/load.c (the_reader_fluid_num): Remove. (scm_primitive_load): Use `scm_fluid_ref ()' instead of `SCM_FAST_FLUID_REF ()'. (scm_init_load): Likewise. 2008-09-16 Ludovic Courtès <ludo@gnu.org> Use immutable cells for vectors. * libguile/vectors.c (scm_c_make_vector): Use `scm_immutable_cell ()'. Use immutable double-cells for symbols. * libguile/strings.c (scm_i_make_symbol): Use `scm_immutable_double_cell ()'. Add `scm_immutable_double_cell ()'. * libguile/inline.h (scm_immutable_double_cell): New. 2008-09-16 Andy Wingo <wingo@pobox.com> compile call-with-values, woot! * libguile/vm-engine.c (vm_run): Add another byte onto the bootstrap program, as the offset passed to mv-call now takes two bytes. * module/system/vm/frame.scm (bootstrap-frame?): Update for the new bootstrap length. Really we should just check for 'halt though. * libguile/vm-i-system.c (FETCH_OFFSET): New helper, used in BR(). (goto/nargs, call/nargs): Versions of goto/args and call, respectively, that take the number of arguments from a value on the top of the stack. (mv-call): Call FETCH_OFFSET to get the offset. * module/language/scheme/translate.scm (custom-transformer-table): Compile call-with-values to <ghil-mv-call>. There is some trickery because of the r4rs.scm call-with-values trampolines. * module/system/il/ghil.scm: Add <ghil-mv-call> and accessors. * module/system/il/compile.scm (codegen): Compile <ghil-mv-call>. * module/system/il/glil.scm: Add <glil-mv-call>, which needs some special assembly because of the label. Fix some typos. * module/system/vm/assemble.scm (byte-length): New helper, factored out and made more general. (codegen): Assemble mv-call, including the label. (check-length): New helper, makes sure that the addressing is consistent within the produced object code. (stack->bytes): Rewrite to be more generic -- now `br' instructions aren't the only ones jumping around in the instruction stream. * module/system/vm/conv.scm (make-byte-decoder): Return two values in the #f case. * module/system/vm/disasm.scm (disassemble-bytecode): Rewrite, because the previous implementation depended on a guile interpreter quirk: namely, that multiple values could be represented within one value, and destructured later. 2008-09-15 Ludovic Courtès <ludo@gnu.org> Use immutable cells for closures. * libguile/eval.c (scm_closure): Use `scm_immutable_cell ()' instead of `scm_cell ()'. * libguile/procs.h (SCM_SETCODE, SCM_SETENV): Remove. 2008-09-15 Ludovic Courtès <ludo@gnu.org> Use immutable cells (aka. libgc "stubborn") for subrs. * libguile/procs.c (scm_c_make_subr): Use `scm_immutable_cell ()' instead of `scm_cell ()'. (scm_free_subr_entry): Remove. * libguile/procs.h (SCM_SET_SUBRNUM, SCM_SET_SUBRF): Remove. (scm_free_subr_entry): Remove declaration. 2008-09-15 Ludovic Courtès <ludo@gnu.org> Add `scm_immutable_cell ()'. * libguile/inline.h (scm_immutable_cell): New. 2008-09-15 Ludovic Courtès <ludo@gnu.org> Remove unused GC string/symbol functions. * libguile/strings.c (scm_i_stringbuf_mark, scm_i_stringbuf_free, scm_i_string_mark, scm_i_string_free, scm_i_symbol_mark, scm_i_symbol_free): Remove. * libguile/strings.h: Remove corresponding declarations. 2008-09-15 Ludovic Courtès <ludo@gnu.org> Conditionalize GC 6.x code. * libguile/gc.c (scm_storage_prehistory): Have `GC_init ()' called only with GC 6.x (it doesn't hurt with 7.x, though). 2008-09-15 Neil Jerram <neil@ossau.uklinux.net> Make multi-byte reads on unbuffered ports more efficient. Idea and original patch were by Ludovic Court�s, this is Neil Jerram's reworking of it. * libguile/srfi-4.c (scm_uniform_vector_read_x): Use scm_c_read, instead of equivalent code here. * libguile/ports.c (scm_fill_input): Add assertion that read buffer is empty when called. (port_and_swap_buffer, swap_buffer): New, for... (scm_c_read): Use caller's buffer for reading, to avoid making N 1-byte low-level read calls, in the case where the port is unbuffered (or has a very small buffer). 2008-09-15 Ludovic Courtès <ludo@gnu.org> Add `uniform-vector-read!' benchmark. 2008-09-15 Andy Wingo <wingo@pobox.com> add special case for (apply values ...) * libguile/vm-engine.c (vm_run): Move nvalues to the top level, to avoid (spurious, it seems) gcc warnings about it being used uninitialized. * libguile/vm-i-system.c (halt, return/values): Adapt to gcc silliness. Deindent some of return/values. (return/values*): New instruction, does what (apply values . args) would do. * module/language/scheme/translate.scm (custom-transformer-table): Move the apply and @apply cases here from inline.scm, because we need some more cleverness when dealing with cases like (apply values . args). (lookup-apply-transformer): Define an eval transformer for `values', turning it into ghil-values*. * module/system/il/compile.scm (codegen): Compile <ghil-values*> into return/values*. * module/system/il/ghil.scm: Add <ghil-values*> and accessors. (ghil-lookup): Add optional argument, define?, which if false tells us not to actually cache the binding if it is not found in the toplevel. * module/system/il/inline.scm: Remove apply clauses. * module/system/vm/frame.scm (bootstrap-frame?): Update heuristic for bootstrap-frame?, as the bootstrap frame is now 5 bytes since it accepts multiple values. 2008-09-14 Ludovic Courtès <ludo@gnu.org> Fix detection of the GC version. * libguile/boehm-gc.h: Don't expect `GC_VERSION_MAJOR' to be defined, as it's defined only since 7.x. 2008-09-14 Andy Wingo <wingo@pobox.com> add multiple values support to the vm * libguile/vm-engine.c (vm_run): The bootstrap program now uses mv_call, so as to allow multiple values out of the VM. (It did before, because multiple values were represented internally as single scm_values objects, but now that values go on the stack, we need to note the boot frame as accepting multiple values.) (vm_error_no_values): New error, happens if you pass no values into a single-value continuation. Passing more than one is OK though, it just takes the first one. * libguile/vm-i-system.c (halt): Assume that someone has pushed the number of values onto the stack, and package up that number of values as a scm_values() object, for communication with the interpreter. (mv-call): New instruction, calls a procedure with a multiple-value continuation, even handling calls out to the interpreter. (return/values): New instruction, returns multiple values to the continuation. If the continuation is single-valued, takes the first value or errors if there are no values. Otherwise it returns to the multiple-value return address, pushing the number of values on top of the values. * module/system/il/compile.scm (codegen): Compile <ghil-values> forms. * module/system/il/ghil.scm (<ghil-values>) Add new GHIL data structure and associated procedures. * module/language/scheme/translate.scm (custom-transformer-table): Compile (values .. ) forms into <ghil-values>. 2008-09-14 Andy Wingo <wingo@pobox.com> look up scheme translators by value, not by name * module/language/scheme/translate.scm (custom-transformer-table): Rename from `primitive-syntax-table', because now it will handle procedural values as well. (lookup-transformer): Update for renaming. Look up custom transformers by value, not name. (make-pmatch-transformers): Key the transformer table by value, not name. 2008-09-13 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: lib/Makefile.am libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/private-gc.h m4/.cvsignore m4/gnulib-cache.m4 m4/gnulib-comp.m4 2008-09-13 Ludovic Courtès <ludo@gnu.org> Include <config.h> in standalone tests. * test-suite/standalone/Makefile.am (test_cflags): Add `-I$(top_builddir)' so that <config.h> can be found. (snarfcppopts): Likewise. * test-suite/standalone/*.c: Include <config.h>. 2008-09-13 Andy Wingo <wingo@pobox.com> rename tail-call to goto/args, add some more tail instructions * libguile/vm-i-system.c (call): Rename continuation invocation from `vm_call_cc' to `vm_call_continuation', because that's what it really does. Add a note that it doesn't handle multiple values at the moment. (goto/arg): Renamed from tail-call, in deference to the progenitors, on Dale Smith's suggestion. (goto/apply): New instruction, for `apply' in a tail context. Not yet used, or vetted for that matter. (call/cc): No need to pop the program, I don't think; although this isn't tested either. (goto/cc): New instruction, for call/cc in a tail context. * module/language/scheme/translate.scm (*forbidden-primitives*): Rename from %forbidden-primitives. * module/system/il/compile.scm (codegen): Adapt to goto/args instead of tail-call. * module/system/il/inline.scm: Start inlining some macros used in r4rs.scm -- not yet fully tested. * ice-9/boot-9.scm: Allow load of a compiled r4rs file. 2008-09-13 Andy Wingo <wingo@pobox.com> add a multiple values return address to stack frames * libguile/frames.c (frame-mv-return-address): New accessor. * libguile/frames.h: Update frame diagram. (SCM_FRAME_UPPER_ADDRESS): Update for data area growing by one pointer. (SCM_FRAME_MV_RETURN_ADDRESS): New macro. * libguile/vm-engine.h (NEW_FRAME): Update for frame getting bigger by a pointer. In a normal NEW_FRAME, set the MV return address to NULL, to indicate that this continuation does not accept multiple values. * libguile/vm-i-system.c (tail-call): Update frame replacement code to understand the MV return address. (return): Make room for the MVRA. 2008-09-13 Andy Wingo <wingo@pobox.com> inline frame replacement in tail-call * libguile/programs.c (program_print): Only try to lookup write-program if the module system is booted. * libguile/vm-engine.h (FREE_FRAME): Remove, it's now inlined everywhere. * libguile/vm-i-system.c (tail-call): Inline FREE_FRAME, and implement the calling bits here. Will make things more hackable. 2008-09-13 Ludovic Courtès <ludo@gnu.org> Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'. 2008-09-13 Andy Wingo <wingo@pobox.com> inline FREE_FRAME in halt * libguile/vm-i-system.c (halt): Inline FREE_FRAME, specialized for the halt case. 2008-09-13 Andy Wingo <wingo@pobox.com> inline FREE_FRAME in return, sync stack_base in CACHE_REGISTER * libguile/vm-engine.h (CACHE_REGISTER): Sync stack_base too. * libguile/vm-i-system.c (return): Inline FREE_FRAME here, micro-optimizing a wee bit. Sounds silly, but it's to enable some refactoring. 2008-09-13 Andy Wingo <wingo@pobox.com> clean up NEW_FRAME macro * libguile/vm-engine.h (NEW_FRAME): Clean up this macro. readability improvement in vm-i-scheme * libguile/vm-engine.h: * libguile/vm-i-scheme.c: Move some helper macros closer to their use sites. 2008-09-13 Andy Wingo <wingo@pobox.com> tweaks for printing programs * module/system/vm/program.scm (program-bindings-as-lambda-list): Handle the bindings-is-null case too -- not sure how it comes about, though. A thunk with no let, perhaps. (write-program): Another default for the name: the source location at which it was defined. * libguile/programs.c (program_print): Add some "logic" to stop doing detailed prints if one print had a nonlocal exit -- preventing exceptions in backtraces. 2008-09-13 Andy Wingo <wingo@pobox.com> programs can now get at their names, and print nicely * module/system/vm/frame.scm (frame-call-representation) (frame-program-name): Rename program-name to frame-program-name, and use the program-name if it is available. * module/system/vm/program.scm (program-bindings): Return #f if there are no bindings. (program-name): New public procedure. (program-bindings-as-lambda-list, write-program): A more useful writer for programs. * libguile/programs.c (scm_bootstrap_programs, program_print): Add a smob printer for programs, which dispatches to `write-program'. 2008-09-13 Andy Wingo <wingo@pobox.com> (define (foo ...) ...) actually gives the lambda a name * module/language/scheme/translate.scm (primitive-syntax-table): In forms like (define x y) where y is a lambda, and the lambda has no name yet, set the lambda's name in its metadata. fix confusion in disassemble-bindings * module/system/vm/disasm.scm (disassemble-bindings): Fix external/local confusion when printing args and locals. 2008-09-13 Andy Wingo <wingo@pobox.com> fix *another* bug in compiling `or'. incredible. * module/system/il/compile.scm (codegen): Fix *another* bug in compiling `or' -- in the case in which the value was being discarded, as in `or' used as a control structure, we were sometimes leaving a value on the stack. * testsuite/t-or.scm: Add another test case for `or'. 2008-09-12 Andy Wingo <wingo@pobox.com> untabify process-define-module * ice-9/boot-9.scm (process-define-module): Untabify. correctly disassemble program bindings (arguments, locals, externals) * module/system/vm/disasm.scm (disassemble-bindings): New function, properly disassembles the bindings data. Neat! 2008-09-11 Ludovic Courtès <ludo@gnu.org> Revert "Use Gnulib's `count-one-bits' module." We don't need it in this branch. This reverts commit d7014610b16cd5f273479e70db253bff2f0124fc. 2008-09-11 Ludovic Courtès <ludo@gnu.org> Adjust to be usable with `libgc' 7.1. * libguile/boehm-gc.h: Only include <gc/gc_local_alloc.h> with `libgc' 6.x. Define `GC_PTR' for `libgc' 7.x+. Fix bug in port eviction code * libguile/fports.c (scm_i_evict_port): Check whether PORT has a ptab entry associated with it. It's unclear when this can happen. 2008-09-10 Ludovic Courtès <ludo@gnu.org> Fix broken hash-table merge. * libguile/hashtab.c (scm_hash_fn_create_handle_x): Return IT only when it satisfies `scm_is_pair ()'. 2008-09-10 Ludovic Courtès <ludo@gnu.org> Fix broken GC and threads merge. * libguile/private-gc.h (scm_i_tag_name): New declaration. * libguile/threads.c: Include <config.h>. 2008-09-10 Ludovic Courtès <ludo@gnu.org> Fix broken port merge. * libguile/ports.c (finalize_port): Don't call `scm_remove_from_port_table ()'. (scm_flush): Don't refer to `scm_i_port_table_size'. (scm_ports_prehistory): Don't allocate `scm_i_port_table'. * libguile/ports.h (scm_i_port_table_room): Remove declaration. 2008-09-10 Ludovic Courtès <ludo@gnu.org> Merge branch 'master' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/coop-defs.h libguile/gc-card.c libguile/gc-freelist.c libguile/gc-malloc.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc.c libguile/gc.h libguile/gc_os_dep.c libguile/hashtab.c libguile/hashtab.h libguile/inline.h libguile/private-gc.h libguile/struct.c libguile/struct.h libguile/threads.c libguile/threads.h libguile/vectors.h libguile/weaks.h test-suite/tests/gc.test 2008-09-10 Ludovic Courtes <ludo@gnu.org> Document the failure of `gc.test' wrt. unused modules. * test-suite/tests/gc.test (Unused modules are removed): Use guardians instead of `gc-live-object-stats'. Explain failure (FIXME). * ice-9/boot-9.scm (make-module): Add `FIXME' about circular reference. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-9 2008-09-10 Ludovic Courtes <ludo@gnu.org> Add comment about `GC_local_malloc ()' upon thread destruction. * libguile/threads.c (on_thread_exit): Add caveat about possible segfault. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-8 2008-09-10 Ludovic Courtes <ludo@gnu.org> Remove `scm_get_stack_base ()'. * libguile/threads.c: Replace `scm_get_stack_base ()' by `GC_stackbottom'. * libguile/gc.h (scm_get_stack_base): Remove declaration. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-7 2008-09-10 Ludovic Courtès <ludo@gnu.org> Merge commit '2e77f7202b11ad0003831fcff94ec7db80cca015' into boehm-demers-weiser-gc Conflicts: libguile/threads.c Merge commit '29776e85da637ec4d44b2b2822d6934a50c0084b' into boehm-demers-weiser-gc Conflicts: libguile/gc-card.c libguile/gc.c libguile/gc.h libguile/ports.c 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed warnings due to unused stuff. * libguile/gc.c (scm_cells_allocated, scm_last_cells_allocated, scm_gc_cells_collected, scm_gc_cells_collected_1, scm_gc_malloc_collected, scm_gc_time_taken, t_before_gc, scm_gc_mark_time_taken, scm_gc_times, scm_gc_cells_swept, scm_gc_cells_marked_acc, scm_gc_cells_swept_acc, scm_gc_cell_yield_percentage, scm_gc_malloc_yield_percentage): Removed. * libguile/gc.h: Updated accordingly. * libguile/gdbint.c (port_mark_p, stream_mark_p, string_mark_p, unmark_port, remark_port): Removed. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-4 2008-09-10 Ludovic Courtès <ludo@gnu.org> Merge commit '7337d56d5714227865aeca2b40b6bd97cce296d2' into boehm-demers-weiser-gc Conflicts: libguile/struct.c 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> scm_gc_malloc: Handle zero-octet allocations. * libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to `GC_MALLOC ()' when SIZE is zero. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2 2008-09-10 Ludovic Courtès <ludo@gnu.org> Merge commit '032913739218c756f673bfb9c8f66ef9f8f02330' into boehm-demers-weiser-gc Conflicts: libguile/gc.c libguile/srcprop.c libguile/srcprop.h 2008-09-10 Ludovic Court`es <ludovic.courtes@laas.fr> Reverted inappropriate merge in `gc.c'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-53 2008-09-10 Ludovic Courtès <ludo@gnu.org> Merge commit 'f30e1bdf97ae8b2b2918da585f887a4d3a23a347' into boehm-demers-weiser-gc Conflicts: libguile/Makefile.am libguile/coop-pthreads.c libguile/gc-freelist.c libguile/gc-segment.c libguile/gc.c libguile/private-gc.h test-suite/tests/environments.nottest 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Use thread-local allocation (significant perf. improvement!); added the `boehm-gc.h' header. * libguile/Makefile.am (modinclude_HEADERS): Added `boehm-gc.h'. * libguile/coop-defs.h: Use "libguile/boehm-gc.h" instead of <gc/gc.h>. * libguile/coop-threads.h: Likewise. * libguile/coop.c: Likewise. * libguile/gc.c: Likewise. (scm_storage_prehistory): Invoke `GC_init ()'. * libguile/guardians.c: Use "libguile/boehm-gc.h" instead of <gc/gc.h>. * libguile/inline.h: Likewise. (scm_double_cell): Use `GC_MALLOC' instead of `GC_malloc'. * libguile/pthread-threads.h: Use "libguile/boehm-gc.h" instead of <gc/gc.h>. * libguile/smob.c: Likewise. * libguile/smob.h: Likewise. * libguile/struct.c: Likewise. * libguile/threads.c: Likewise. * libguile/weaks.c: Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-51 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Removed `scm_gc_registered_roots' and `scm_permobjs'. * libguile/gc.c (scm_permanent_object): Use `scm_gc_protect_object ()'. (scm_gc_register_root): Do nothing. (scm_init_storage): Removed initialization of `scm_permobjs' and `scm_gc_register_roots'. * libguile/root.h (scm_permobjs): Removed. (scm_gc_registered_roots): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-50 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Expand heap size at startup time. * libguile/gc.c (scm_storage_prehistory): Invoke `GC_expand_hp ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-49 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Turn "all interior pointers" off (slight performance gain). * libguile/gc.c (scm_storage_prehistory): Set `GC_all_interior_pointers' to 0. Register `scm_tc3_cons' and `scm_tc3_closure' as valid displacements. * libguile/struct.c (scm_alloc_struct): Register additional displacements. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-48 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Implemented `gc-stats' using `libgc' information. * libguile/gc.c (protected_obj_count): Made `static'. (scm_heap_size): Mapped to `heap-size' rather than `cell-heap-size'. (scm_heap_free_size): New. (scm_heap_total_allocated): New. (scm_gc_stats): Rewritten. Return the (little) information available from `libgc'. (scm_gc_disable): New. (scm_gc_enable): New. (scm_storage_prehistory): Don't call `GC_add_roots ()' with SCM_SYS_PROTECTS. Use `GC_is_visible ()' to check whether SCM_SYS_PROTECTS is visible. * libguile/gc.h (scm_gc_enable): New declaration. (scm_gc_disable): New declaration. (scm_gc_for_alloc): Removed. (scm_gc_for_newcell): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-46 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Have source properties only use regular GC mechanisms. * libguile/srcprop.c: Include "libguile/gc.h". (srcprops_chunklist): Removed. (srcprops_freelist): Removed. (srcprops_free): Removed. (scm_make_srcprops): Use `scm_gc_malloc ()' rather than SRCPROPS_FREELIST et al. (scm_init_srcprop): Don't call `scm_set_smob_free ()'. (scm_finish_srcprop): Do nothing. * libguile/srcprop.h (SRCPROPS_CHUNKSIZE): Removed. (scm_t_srcprops_chunk): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-45 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed symbols so that interned symbols are only weakly referenced. * libguile/symbols.c (lookup_interned_symbol): When a deleted weak pair is encountered, remove it and update the hashtable's item count. Also, check the hash table threshold and trigger a rehashing if needed. (scm_i_c_mem2symbol): Allocate CELL using `scm_weak_car_pair ()' rather than `scm_cons ()'. (scm_i_mem2symbol): Likewise. (scm_symbols_prehistory): Don't invoke `scm_permanent_object ()' for SYMBOLS. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-44 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Re-fixed the hash table element counting in `scm_i_rehash ()'. * libguile/hashtab.c (scm_i_rehash): Don't invoke `SCM_HASHTABLE_DECREMENT ()' when a weak pair is encountered in the source bucket. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-43 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed `guardians.test' so that it does not use symbols. * test-suite/tests/guardians.test: Use strings instead of symbols for `g3-garbage' et al. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-42 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Allow guardians to be GC'd before the objects they guard. * libguile/guardians.c (finalize_guarded): While traversing GUARDIANS_LIST, check for deleted weak-car pairs. (scm_i_guard): Instantiate GUARDIANS_FOR_OBJ using `scm_weak_car_pair ()' rather than `scm_cons ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-41 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Minor weak hashtables fixes. * libguile/hashtab.c (scm_fixup_weak_alist): Cosmetic change. (scm_i_rehash): Call `SCM_HASHTABLE_DECREMENT ()' when a deleted weak pair is encountered. (scm_internal_hash_fold): Call `SCM_HASHTABLE_DECREMENT ()' instead of a complicated `SCM_SET_HASHTABLE_N_ITEMS ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-40 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Moved weak pair code into `weaks.[ch]'. * libguile/hashtab.c: Don't include <gc/gc_typed.h> and <gc/gc.h>. Updated users of weak (wcar_cell_descr): Removed. (wcdr_cell_descr): Removed. (scm_weak_car_cell): Removed. (scm_weak_cdr_cell): Removed. (scm_doubly_weak_cell): Removed. (SCM_WEAK_CELL_*_DELETED_P): Removed. (SCM_WEAK_CELL_WORD): Removed. (SCM_WEAK_CELL_C[AD]R): Removed. (scm_hashtab_prehistory): Don't initialize weak pairs. * libguile/init.c (scm_i_init_guile): Invoke `scm_weaks_prehistory ()' before `scm_hashtab_prehistory ()' in order to initialize weak pairs. * libguile/weaks.c: Include <gc/gc.h> and <gc/gc_typed.h>. (wc[ad]r_cell_descr): New. (scm_weak_c[ad]r_pair): New. (scm_doubly_weak_pair): New. (scm_weaks_prehistory): New. * libguile/weaks.h (scm_weak_c[ad]r_pair): New declaration. (scm_doubly_weak_pair): New declaration. (SCM_WEAK_PAIR_WORD_DELETED_P): New. (SCM_WEAK_PAIR_CAR_DELETED_P): New. (SCM_WEAK_PAIR_CDR_DELETED_P): New. (SCM_WEAK_PAIR_DELETED_P): New. (SCM_WEAK_PAIR_WORD): New. (SCM_WEAK_PAIR_CAR): New. (SCM_WEAK_PAIR_CDR): New. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-39 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Implemented rehashing of weak hash tables. * libguile/hashtab.c (weak_hashtables): Removed. (SCM_WEAK_CELL_DELETED_P): New macro. (START_WEAK_BUCKET_FIXUP): Added the HASHFN argument. Invoke `scm_i_rehash ()' when pairs have been removed. (END_WEAK_BUCKET_FIXUP): Added the HASHFN argument. (make_hash_table): Use `SCM_NEWSMOB2 ()' instead of `SCM_NEWSMOB3 ()' -- last argument used to be WEAK_HASHTABLES. (scm_i_rehash): Handle weak hash tables. (to_rehash): Removed. (scm_internal_hash_fold): Use `SCM_WEAK_CELL_DELETED_P ()' rather than hand-written equivalent code. (rehash_after_gc): Removed. (scm_hashtab_prehistory): Don't add it as an after-gc hook. * libguile/hashtab.h (SCM_HASHTABLE_NEXT): Removed. (SCM_HASHTABLE_NEXTLOC): Removed. (SCM_SET_HASHTABLE_NEXT): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-38 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Implemented port finalization. * libguile/ports.c (register_finalizer_for_port): New. (finalize_port): New. (scm_new_port_table_entry): Call `register_finalizer_for_port ()' before returning the new port. (scm_ports_prehistory): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for SCM_I_PORT_TABLE. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-37 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Use `scm_gc_malloc_pointerless' in various places (improves performance). * libguile/fports.c (scm_fport_buffer_add): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for the read/write buffers. * libguile/numbers.c (scm_c_make_rectangular): Likewise. * libguile/ports.c (scm_ungetc): Likewise. * libguile/random.c (scm_i_copy_rstate): Likewise. (scm_c_make_rstate): Likewise. * libguile/regex-posix.c (scm_make_regexp): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-36 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Removed the now-useless `scm_struct_free_*' functions. * libguile/struct.c (scm_alloc_struct): Set the `scm_struct_i_free' element to 0 instead of `scm_struct_free_standard'. (scm_struct_free_0): Removed. (scm_struct_free_light): Removed. (scm_struct_free_standard): Removed. (scm_struct_free_entity): Removed. * libguile/struct.h (scm_struct_free_0): Removed. (scm_struct_free_light): Removed. (scm_struct_free_standard): Removed. (scm_struct_free_entity): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-35 2008-09-10 Ludovic Courtes <ludovic.courtes@laas.fr> Removed unnecessary uses of class destructors. * libguile/goops.c (scm_sys_inherit_magic_x): Don't invoke `SCM_SET_CLASS_DESTRUCTOR' for legacy destructors that are no longer needed (e.g., `scm_struct_free_entity ()', etc.). * libguile/objects.c (scm_init_objects): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-34 2008-09-09 Andy Wingo <wingo@pobox.com> really newline on eof * module/system/repl/repl.scm (next-char): Another newline-on-eof case. fix program disassembly for meta-in-a-thunk * module/system/vm/disasm.scm (disassemble-program): Fix for recent meta-in-a-thunk change. 2008-09-09 Andy Wingo <wingo@pobox.com> run the vm repl instead of the scm-style-repl * ice-9/boot-9.scm (@, @@): Note that these don't work with the compiler. Damn. (top-repl): Run the VM repl. Whooo! * module/system/repl/repl.scm (start-repl): Catch 'quit, as the scm-style-repl does. Newline after input EOF's, so that we don't leave the user's shell messed up. 2008-09-09 Andy Wingo <wingo@pobox.com> add repl option to interpret rather than compile * module/language/scheme/spec.scm (scheme): Specify an evaluator, `eval'. * module/system/repl/common.scm (repl-default-options): Add option, `interp', specifying that, if possible, the repl should interpret its expressions rather than compile them. Defaults to #f. 2008-09-09 Andy Wingo <wingo@pobox.com> rework late binding resolution to be simpler and more efficient * libguile/programs.h (struct scm_program): * libguile/programs.c (scm_c_make_program): Record the current module when making a program. This replaces the per-late binding recorded module in the generated code, which should be more efficient, both in terms of garbage, and in not calling resolve-module. (program-module): New accessor. * module/system/vm/program.scm: Add program-module to exports. * libguile/vm-i-loader.c (link-later): Remove this instruction, since now the entry in the object table is just a symbol, and can be loaded with load-symbol. * libguile/vm-i-system.c (late-variable-ref, late-variable-set): Rework so as to look up in the module of the current program. The logic could be condensed quite a bit if scm_module_lookup () knew what to do with mod==#f. * module/system/vm/assemble.scm (dump-object!): Dump <vlink-later> just as load-symbol, as mentioned in the note on link-later. * module/system/il/ghil.scm: Update comment to reflect the new reality. 2008-09-09 Andy Wingo <wingo@pobox.com> final de-:prefixification * scripts/compile: Don't (read-set! keywords 'prefix) here either. 2008-09-09 Andy Wingo <wingo@pobox.com> use #:keywords in module/*.scm, not :keywords * module/system/base/syntax.scm (keywords): Don't enable :keywords, it breaks code that may assume that ':foo is a symbol, like boot-9. * module/*.scm: Don't use :keywords, use #:keywords. The user can decide if she wants #:keywords in their .guile, and :keywords might make us compile modules differently. 2008-09-08 Andy Wingo <wingo@pobox.com> lazily load meta info, for less consage * module/system/vm/assemble.scm (make-meta, codegen): Hide the "meta" information -- the names of the bindings, source info, procedure properties, etc -- behind a lambda. This way, loading up a program conses less, because the metadata stays as mmap'd code until it is needed. * libguile/vm-i-loader.c (load-program): Adjust load-program to expect the metadata to be a program. * module/system/vm/program.scm (program-bindings, program-sources) (program-properties): Adjust to new meta format. 2008-09-07 Andy Wingo <wingo@pobox.com> compile boot-9. woop! * ice-9/Makefile.am (SOURCES, NOCOMP_SOURCES): Compile boot-9.scm. Wooooo! This makes some things harder to debug, and program loading needs to cons much less, but I think it makes sense to compile boot-9 by default if for no other reason than to catch bugs earlier. macro-transformer recognizes compiled macros * libguile/macros.c (macro-transformer): Recognize compiled as well as interpreted transformer procedures. print compiled macros correctly * libguile/macros.c (macro_print): Print macros whose code is a program as non-primitive. (Already, primitive-macro? would return #f.) allow boot-9.go load if available * libguile/init.c (scm_load_startup_files): Don't specify the .scm suffix, so as to allow loading a boot-9.go if appropriate. remove define-syntax-macro from boot-9.scm * ice-9/boot-9.scm (defmacro:syntax-transformer, define-syntax-macro): Removed these, as I could not see anywhere they were being used, and they use the unnecessary procedure->syntax procedure. take procedure->memoizing-macro off of probation * module/language/scheme/translate.scm (%forbidden-primitives): Take procedure->memoizing-macro off probation; although it's not a good idea, there is a fair amount of existing code that uses it that can be compiled fine. So allow it in that case. make thunk? understand programs * libguile/procs.c (thunk?): Return #t for thunk programs. reorder module system boot time * ice-9/boot-9.scm: Postpone module system boot until (%app modules) is defined, so that resolve-module will work. This might not actually be necessary given the previous tomfoolery in resolve-module, but it doesn't seem like a bad change. 2008-09-07 Andy Wingo <wingo@pobox.com> module-variable accesses pre-module-obarray if module is #f * libguile/modules.c (module-variable): If module is #f, access the pre-modules-array. This is so that nested-ref can work before the module system is booted, I think. Of course all of these dependency lines during bootstrap are just to make sure the system can be booted properly, either interpreted or compiled, so there's no one right way: there are many ways that could work. 2008-09-07 Andy Wingo <wingo@pobox.com> prevent (resolve-module '(guile)) recursion * ice-9/boot-9.scm (resolve-module): Change so that resolving '(guile) does not require any module lookups. This is so that while within a call to (resolve-module '(guile)), we don't recurse when looking up the location for e.g. `append'. I can imagine other ways to get around this, but this one seems OK. make late-variable-{ref,set} work before module system boot * libguile/vm-i-system.c (late-variable-ref, late-variable-set): If the module system isn't booted, do a simple scm_lookup. In the -ref case, actually cache the variable location (doh!). better diagnostics on quasiquote errors * module/system/il/compile.scm (constant?, codegen): Add some diagnostics so that we can get decent error reporting if we accidentally unquote an unreadable value into the compiled output. 2008-09-07 Andy Wingo <wingo@pobox.com> allow multiple modules in one compilation unit * module/system/il/ghil.scm (<ghil-env>, <ghil-toplevel-env>): Refactor so that all environments point (eventually) at one toplevel environment. Instead of having potentially multiple toplevel environments, each noting the module against which its bindings are resolved, have each binding in the toplevel record what module it should be resolved in. Should fix compilation units that define multiple modules. (ghil-lookup, ghil-define): Reworked to not be destructive. Module variables now have the module name as their "env", and are keyed as `(MODNAME . SYM)' in the var table. (call-with-ghil-environment): Reindented. * module/system/il/inline.scm (try-inline-with-env): Adapt to env/toplevel changes. * module/system/vm/assemble.scm (dump-object!): A vlink-later now holds the module name, not the module itself. * module/system/il/compile.scm (make-glil-var): The "env" of a "module" var is now the module name, not the module. * module/language/scheme/translate.scm (primitive-syntax-table): Update the way we test for toplevel environments. Reindent the lambda translator. (lookup-transformer, trans): lookup-transformer now has 2 args, not 3. (translate): Update the way we make toplevel environments. 2008-09-07 Andy Wingo <wingo@pobox.com> improve backtraces * module/system/vm/frame.scm (frame-call-representation): Show more of lists. (program-name): Avoid a traceback if (frame-address link) is #f. Not sure when this can happen, but it does, and since this is already in the backtrace function, there be badness there. update .gitignore files * .gitignore: * libguile/.gitignore: Update 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Added support for the free function of structures. * libguile/struct.c (struct_finalizer_trampoline): New. (scm_struct_gc_init): Removed. (scm_i_structs_to_free): Removed. (scm_free_structs): Removed. (scm_make_struct): Register a finalizer for the new struct if need be. (scm_struct_prehistory): Cleared. * libguile/struct.h (scm_i_structs_to_free): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-33 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Use the SMOB API in `coop-pthreads.c' rather than low-level primitives. * libguile/coop-pthreads.c: Include "smob.h". (make_thread): Use `SCM_NEWSMOB' rather than `scm_cell'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-32 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed a warning in `symbols.c'. * libguile/symbols.c (lookup_interned_symbol): When checking for `NULL', use `SCM2PTR' rather than `SCM_UNPACK' (this fixes a warning). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-31 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed the SMOB mark procedure so that it handles free-list objects. * libguile/smob.c (smob_mark): Check the 7-bit type tag and ignore those whose type tag is not that of a SMOB in order to cleanly handle free-list objects (this fixes a bug which showed up on SPARC64). Also, don't mark & push ADDR itself. (scm_gc_mark): Moved the definition and undefinition of `CURRENT_MARK_PTR' and `CURRENT_MARK_LIMIT' here. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-30 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed use of finalizers for guardians and SMOBs (undoes patches 23-24). * libguile/gc.c (finalizer_trampoline): Removed. (scm_gc_register_finalizer): Removed (undoes patches 23 and 24). * libguile/gc.h (scm_gc_register_finalizer): Removed. * libguile/guardians.c (finalize_guarded): Undid patch 23. Added support for "proxied finalizers". (scm_i_guard): Likewise. * libguile/smob.c (scm_i_finalize_smob): Adapted to `GC_finalization_proc'. * libguile/smob.h: Include <gc/gc.h>. (SCM_NEWSMOB): Use `GC_REGISTER_FINALIZER_NO_ORDER' instead of `scm_gc_register_finalizer ()'. (SCM_NEWSMOB3): Likewise. (scm_i_finalize_smob): Updated. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-29 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Removed a lot of now-useless SMOB mark/free functions. * libguile/arbiters.c (scm_init_arbiters): Don't invoke `scm_set_smob_mark'. * libguile/async.c (async_gc_mark): Removed. (scm_init_async): Don't invoke `scm_set_smob_mark'. * libguile/coop-pthreads.c (thread_mark): Removed. (create_thread): Use `scm_gc_malloc' instead of `scm_malloc' when allocating `launch_data'. (mutex_mark): Removed. (scm_threads_init): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/debug.c (scm_init_debug): Don't invoke `scm_set_smob_mark'. * libguile/dynl.c (dynl_obj_mark): Removed. (scm_init_dynamic_linking): Don't invoke `scm_set_smob_mark'. * libguile/dynwind.c (winder_mark): Removed. (scm_init_dynwind): Don't invoke `scm_set_smob_mark'. * libguile/environments.c (environment_mark): Removed. (environment_free): Removed. (observer_mark): Removed. (core_environments_mark): Removed. (core_environments_finalize): Removed. (leaf_environment_mark): Removed. (leaf_environment_free): Removed. (leaf_environment_funcs): Don't refer to the above funcs. (eval_environment_mark): Removed. (eval_environment_free): Removed. (eval_environment_funcs): Don't refer to the above funcs. (import_environment_mark): Removed. (import_environment_free): Removed. (import_environment_funcs): Don't refer to the above funcs. (export_environment_mark): Removed. (export_environment_free): Removed. (export_environment_funcs): Don't refer to the above funcs. (scm_environments_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/environments.h (scm_environment_funcs)[mark]: Removed. [free]: Removed. * libguile/eval.c (promise_mark): Removed. (promise_free): Removed. (scm_init_eval): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/fluids.c (fluid_free): Removed. (scm_fluids_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/futures.c (future_mark): Removed. (scm_init_futures): Don't invoke `scm_set_smob_mark'. * libguile/hashtab.c (hashtable_free): Removed. (scm_hashtab_prehistory): Don't invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/hooks.c (scm_init_hooks): Don't invoke `scm_set_smob_mark'. * libguile/keywords.c (scm_init_keywords): Don't invoke `scm_set_smob_mark'. * libguile/macros.c (scm_init_macros): Don't invoke `scm_set_smob_mark'. * libguile/modules.c (scm_init_modules): Don't invoke `scm_set_smob_mark'. * libguile/print.c (scm_init_print): Don't invoke `scm_set_smob_mark'. * libguile/random.c (scm_i_copy_rstate): Use `scm_gc_malloc' instead of `scm_malloc'. (scm_c_make_rstate): Likewise. (rstate_free): Removed. (scm_init_random): Don't invoke `scm_set_smob_free'. * libguile/srcprop.c (srcprops_mark): Removed. (scm_init_srcprop): Don't invoke `srcprops_mark'. * libguile/srfi-14.c (charset_free): Removed. (scm_init_srfi_14): Don't invoke `scm_set_smob_free'. * libguile/srfi-4.c (uvec_mark): Removed. (uvec_free): Removed. (scm_init_srfi_4): Don't invoke `scm_set_smob_free' and `scm_set_smob_mark'. * libguile/threads.c (thread_mark): Removed. (fat_mutex_mark): Removed. (fat_cond_mark): Removed. (scm_init_threads): Dont invoke `scm_set_smob_mark' and `scm_set_smob_free'. * libguile/unif.c (bitvector_free): Removed. (array_mark): Removed. (array_free): Removed. (scm_init_unif): Don't invoke `scm_set_smob_free' and `scm_set_smob_mark'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-28 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed the undocumented `scm_make_smob ()' function. * libguile/smob.c (scm_make_smob): Use `SCM_RETURN_NEWSMOB ()' instead of `scm_cell ()' when instantiating the SMOB. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-27 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Added support for SMOBs free function (via finalizers). * libguile/smob.c (scm_i_finalize_smob): New. * libguile/smob.h (SCM_NEWSMOB): Register `scm_i_finalize_smob ()' as a finalizer for Z if its SMOB type has a free function. (SCM_NEWSMOB3): Likewise. (scm_i_finalize_smob): New declaration. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-26 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Removed the free function from the malloc-object SMOB type. * libguile/mallocs.c (malloc_free): Removed. (scm_init_mallocs): Don't invoke `scm_set_smob_free ()' because the memory allocated by `scm_gc_malloc ()' will automatically be freed. Furthermore, `malloc_free ()' used to invoke `free ()' instead of `scm_gc_free ()' which is incorrect. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-25 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed `scm_gc_register_finalizer ()' to avoid bootstrap problem. * libguile/gc.c (finalizer_trampoline): Don't use `scm_call_2 ()' to invoke the finalizer: directly call the C function instead. (scm_gc_register_finalizer): Don't create a real subr with `scm_c_make_gsubr ()': simply convert the C function pointer to an `SCM' object instead. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-24 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Generalized BGC's finalizer mechanism. Use it in `guardians.c'. * libguile/gc.c (finalizer_trampoline): New. (scm_gc_register_finalizer): New. * libguile/gc.h (scm_gc_register_finalizer): New declaration. * libguile/guardians.c (finalize_guarded): Updated to the new prototype. (scm_i_guard): Use `scm_gc_register_finalizer ()' instead of `GC_REGISTER_FINALIZER_NO_ORDER ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-23 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Added support for SMOB custom mark procedures. * libguile/gc.c (scm_gc_mark): Removed. (scm_gc_mark_dependencies): Removed. (scm_mark_locations): Removed. * libguile/gc.h (scm_gc_mark_dependencies): Removed. (scm_mark_locations): Removed. * libguile/inline.h (scm_cell): Use `GC_MALLOC ()' instead of `GC_malloc ()'. * libguile/smob.c (smob_freelist): New. (smob_gc_kind): New. (smob_mark): New. (scm_gc_mark): New. (scm_i_new_smob_with_mark_proc): New. (scm_smob_prehistory): Initialize `smob_freelist' and `smob_gc_kind'. * libguile/smob.h (scm_i_new_smob_with_mark_proc): New declaration. (SCM_NEWSMOB): Use it if a mark procedure is available. (SCM_NEWSMOB2): Likewise. (SCM_NEWSMOB3): Likewise. * libguile/threads.c (guilify_self_1): Initialize the `current_mark_stack_*' fields. * libguile/threads.h (scm_i_thread)[current_mark_stack_ptr]: New field. [current_mark_stack_limit]: New field. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-22 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Removed the mark/free functions of continuations and threads. * libguile/continuations.c (continuation_mark): Removed. (continuation_free): Removed. (scm_init_continuations): Don't use them. * libguile/coop-pthreads.c (scm_threads_mark_stacks): Removed (was unused). * libguile/threads.c (scm_threads_mark_stacks): Likewise. * libguile/threads.h (scm_threads_mark_stacks): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-21 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Removed useless files; beautified `libguile/Makefile.am'. * libguile/Makefile.am: Beautified backslashification (complements `patch-1'). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-20 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Disabled the `environments' unit test. * test-suite/Makefile.am (SCM_TESTS): Removed `tests/environments.test'. * test-suite/tests/environments.nottest: Disabled. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-19 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> procs/weaks/hashtab: Removed a bit of useless mark/free code. * libguile/hashtab.c (UNMARKED_CELL_P): Removed. (scm_i_scan_weak_hashtables): Removed. * libguile/hashtab.h (scm_i_scan_weak_hashtables): Removed. * libguile/procs.c (scm_mark_subr_table): Removed. * libguile/procs.h (scm_mark_subr_table): Removed. * libguile/weaks.c (UNMARKED_CELL_P): Removed. (scm_i_remove_weaks): Removed. (scm_i_remove_weaks_from_weak_vectors): Removed. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-18 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Tiny updates in `environments.c'. * libguile/environments.c (scm_make_environment): Use `SCM_RETURN_NEWSMOB' instead of `scm_cell'. (core_environments_observe): Use `SCM_NEWSMOB3' instead of `scm_double_cell'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-17 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixes in weak hash tables handling, notably in `hash-fold'. * libguile/hashtab.c (scm_i_rehash): Return immediately if TABLE is weak. (scm_hash_fn_create_handle_x): Explicitly mention that we don't support weak alist vectors. (scm_internal_hash_fold): Handle weak pairs within buckets. * libguile/modules.c (scm_module_reverse_lookup): Handle weak alists (currently, don't do anything if a NULL pair is met). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-16 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed a typo/bug in `make-doubly-weak-alist-vector'. * libguile/weaks.c (scm_make_doubly_weak_alist_vector): Fixed typo (endless recursive call). git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-15 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed printing of weak vectors. * libguile/print.c (iprin1): When displaying a weak vector, access elements via `scm_c_vector_ref ()', not via the macro. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-14 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed `list->weak-vector'. * libguile/vectors.c (scm_i_allocate_weak_vector): Removed. (MAKE_WEAK_VECTOR): New macro. (allocate_weak_vector): New. (scm_i_make_weak_vector): New. (scm_i_make_weak_vector_from_list): New. * libguile/vectors.h: Updated. * libguile/weaks.c (scm_make_weak_vector): Use `scm_i_make_weak_vector ()'. (scm_weak_vector): Use `scm_i_make_weak_vector_from_list ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-13 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed weak alist vectors by having them use weak hash tables instead. * libguile/weaks.c (scm_make_weak_key_alist_vector): Use `scm_make_weak_key_hash_table ()'. (scm_make_weak_value_alist_vector): Use `scm_make_weak_value_hash_table ()'. (scm_make_doubly_weak_alist_vector): Use `scm_make_doubly_weak_hash_table ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-12 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> First stab at the guardian implementation. Works fine at first glance! * libguile/guardians.c: Overhauled. Removed the `tconc' structure. Much, much, simpler. (finalize_guarded): New function. * libguile/init.c (scm_i_init_guile): Call `scm_init_guardians ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-11 2008-09-05 Ludovic Court`es <ludovic.courtes@laas.fr> Tell `libgc' that we're using POSIX threads. This fixes Guile on PPC. * libguile/coop-defs.h: If `GUILE_PTHREAD_COMPAT' is defined, then define `GC_THREADS' and include <gc/gc.h> after <pthread.h>. * libguile/coop-pthreads.h: Likewise. * libguile/pthread-threads.h: Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-10 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed `scm_fixup_weak_alist ()'; update weak hash table size as needed. * libguile/hashtab.c (scm_fixup_weak_alist): Added a REMOVED_ITEMS parameter. Fixed a bug in the case where PREV is `SCM_EOL'. (IS_WEAK_THING): New macro. (START_WEAK_BUCKET_FIXUP): New macro. (END_WEAK_BUCKET_FIXUP): New macro. (scm_hash_fn_get_handle)[buckets]: New variable. Use the above macros. (scm_hash_fn_create_handle_x): Likewise. (scm_hash_fn_remove_x): Likewise. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-9 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed the weak cell implementation (for weak hash tables). * libguile/hashtab.c (wcar_cell_descr): New. (wcdr_cell_descr): New. (scm_weak_car_cell): Use `GC_malloc_explicitly_typed ()' instead of `scm_gc_malloc_pointerless ()'. (scm_weak_cdr_cell): Likewise. (SCM_WEAK_CELL_WORD_DELETED_P): Use `SCM_CELL_OBJECT' instead of `SCM_CELL_WORD'. (scm_hash_fn_get_handle): Call `GC_disable ()' before calling `scm_fixup_weak_alist ()' and `GC_enable ()' afterwards. (scm_hash_fn_create_handle_x): Likewise. (scm_hash_fn_remove_x): Likewise. (scm_hashtab_prehistory): Initialize WCAR_CELL_DESCR and WCDR_CELL_DESCR. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-8 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> First stab at implementing weak hash tables and vectors. Unable to run the REPL. * libguile/hashtab.c (scm_weak_car_cell): New. (scm_weak_cdr_cell): New. (scm_doubly_weak_cell): New. (SCM_WEAK_CELL_WORD_DELETED_P): New. (SCM_WEAK_CELL_WORD): New. (scm_fixup_weak_alist): New. (make_hash_table): Always use non-weak vectors. Allocate `scm_t_hashtable' objects as pointerless. (scm_i_rehash): Always make NEW_BUCKETS a non-weak vector. (scm_hash_fn_get_handle): Call `scm_fixup_weak_alist ()' on weak buckets before calling ASSOC_FN. (scm_hash_fn_remove_x): Likewise. (scm_hash_fn_create_handle_x): Likewise. Also, use `scm_.*weak.*cell ()' for HANDLE when needed. * libguile/symbols.c (lookup_interned_symbol): Check for nullified pairs. * libguile/vectors.c (scm_vector_elements): Abort on weak vectors. (scm_vector_writable_elements): Likewise. (scm_c_vector_ref): Check whether the referenced element has been nullified. (scm_c_vector_set_x): Use `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'. (scm_i_allocate_weak_vector): Use `scm_gc_malloc_pointerless ()' instead of `scm_gc_malloc ()' when allocating room for the vector itself. * libguile/weaks.c (scm_make_weak_key_alist_vector): Use `scm_make_vector ()' instead of `scm_i_allocate_weak_vector ()'. (scm_make_weak_value_alist_vector): Likewise. (scm_make_doubly_weak_alist_vector): Likewise. (weak_vectors): Removed. (scm_i_init_weak_vectors_for_gc): Removed. (scm_i_mark_weak_vector): Removed. (scm_i_mark_weak_vector_non_weaks): Removed. (scm_i_mark_weak_vectors_non_weaks): Removed. (scm_i_remove_weaks_from_weak_vectors): Commented out. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-7 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed GC initialization and static roots. * libguile/gc.c (scm_storage_prehistory): Call `GC_INIT ()'. Invoke `GC_add_roots ()' as well. (scm_init_gc): Removed call to `GC_init ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-6 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Added `scm_gc_malloc_pointerless ()', equivalent to `GC_MALLOC_ATOMIC ()'. * libguile/gc-malloc.c (scm_gc_register_collectable_memory): Tidied. (scm_gc_unregister_collectable_memory): Likewise. (scm_gc_malloc_pointerless): New. * libguile/gc.h (scm_gc_malloc_pointer_less): New declaration. * libguile/strings.c (make_stringbuf): Use it. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-5 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed garbage collection of ports: basics work (no SMOBs, no guardians, no WHT). * libguile/gc.c (scm_init_storage): Do not initialize SCM_I_PORT_TABLE here: this is done in `scm_ports_prehistory ()'. This fixes the bug mentioned in the previous patch log. * libguile/ports.c (scm_new_port_table_entry): Slightly clarified the code. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-4 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> First ``working'' Guile! Crashes in `flush-all-ports' (relates to SCM_I_PORT_TABLE). * libguile/gc.c (scm_gc_stats): Fixed so that it returns a relevant result instead of just `SCM_EOL'. * libguile/ports.c: Include `assert.h'. Don't include `malloc.h'. (scm_make_port_type): Use `scm_gc_realloc ()' instead of `realloc ()'. (scm_new_port_table_entry): Likewise. (scm_flush): Added an assertion on the port number. (scm_ports_prehistory): Use `scm_gc_malloc ()' instead of `scm_malloc ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-3 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Small fixes. Gets to the REPL and `abort ()'s soon after. * libguile/inline.h (scm_cell): Re-added comment about the assignment order of CAR/CDR. * libguile/srcprop.c (scm_make_srcprops): Use `scm_gc_malloc ()' instead of `malloc' + `scm_gc_register_collectable_memory ()'. * libguile/threads.c (guilify_self_1): Likewise. (guilify_self_2): Likewise. * libguile/strings.c (make_stringbuf): Use `GC_MALLOC_ATOMIC ()' instead of `scm_gc_malloc ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-2 2008-09-05 Ludovic Courtes <ludovic.courtes@laas.fr> Merge from lcourtes@laas.fr--2005-mobile Patches applied: * lcourtes@laas.fr--2005-mobile/guile-core--boehm-gc--1.9 (base, patch 1) - tag of lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--base-0 - Initial hack for Boehm's GC support: nothing works. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-1 2008-09-02 Andy Wingo <wingo@pobox.com> superstition with no important effect * module/system/vm/assemble.scm (dump-object!): Some superstition, use bit arithmetic instead of int arithmetic. Makes me happier. 2008-09-02 Andy Wingo <wingo@pobox.com> make primitive-load-path load compiled files if available * libguile/load.h: Update scm_search_path prototype. * libguile/load.c: Include vm.h for load-compiled/vm. Not sure if this is bad wrt modularity. (scm_c_string_has_an_ext): New private helper. (scm_search_path): Add an extra optional arg, `require_exts'; if true, require that the returned file name have one of the given extensions. Changes the C API, but not the scheme API. (scm_sys_search_load_path): Adapt to scm_search_path API change. (primitive-load-path): Here is the craziness: load a compiled file if found and newer than the corresponding (or not) source file. (scm_init_load): Define %load-compiled-extensions as the list of extensions denoting compiled files; defaults to '(".go"). 2008-09-02 Andy Wingo <wingo@pobox.com> move up some initializations in the vm * libguile/vm.c: Move 'vm-run, 'vm-error, 'debug sym initialization up to the bootstrap phase, so they are ready if load-compiled/vm is called before (system vm vm) is loaded. turn define-option-interface into a defmacro * ice-9/boot-9.scm (define-option-interface): Turn into a defmacro instead of an mmacro. disable start-stack in compiled code * module/language/scheme/translate.scm (primitive-syntax-table): Disable semantics of start-stack in compiled code. I think start-stack semantics aren't bad, but they don't have vm-based implementations at this point. remove the-environment, the-root-environment, environment-module * ice-9/boot-9.scm (the-environment, the-root-environment) (environment-module): Remove these representation of the interpreter's idea of the environment, because they are not valid in the compiled case, and are not part of the scheme spec anyway. avoid local-eval in record constructors and accessors * ice-9/boot-9.scm (record-constructor, record-accessor) (record-modifier): Avoid local-eval when possible, because it uses the interpreter's representation of environments; and when we need to eval, use primitive-eval instead. Slight semantic change in that this evaluates relative to the current module rather than the root module, but not really a biggie. Should make this compilable in the future, somehow. nits picked on boot-9.scm * ice-9/boot-9.scm (defmacro): Indentation fix. (begin-deprecated): Don't cons in the `begin' macro itself, only the symbol `begin'. enter into the (guile) module when compiling boot-9.scm * ice-9/boot-9.scm: Before doing very much, put us into the (guile) module when compiling. This avoids some circularity in the module boot process, whereby symbols are seen to resolve to the (guile-user) module, whereas in fact they originally pertain to the (guile) module. Fix compilation #ifndef STACK_CHECKING. * libguile/debug.c (scm_debug_options): Fix compilation #ifndef STACK_CHECKING. fix Makefile.am in module/language * module/language/Makefile.am: Actually recurse into scheme/. ditch the 8-bit compiled form of program parameters * libguile/vm-i-loader.c (load-program): * module/system/vm/assemble.scm (dump-object!): There are cases in which we use the 16-bit representation for program params (nargs, nexts, etc), but the actual 16-bit number actually fits into 8 bits -- which is then misinterpreted by the loader as the 8-bit form. So ditch the 8-bit form entirely (it was never much of an optimization), and just use the 16-bit form. Make sure to clear out all your .go files before recompiling this one! fix a bug loading functions with 8 or more arguments * libguile/vm-i-loader.c: A combination of superstition and a bugfix: make sure that we treat bits as being of a type as wide as we think it is, and, more importantly, allow for programs with 8 <= nargs < 16. 2008-09-02 Andy Wingo <wingo@pobox.com> fix nested quasiquotes (yeepers) * module/language/scheme/translate.scm (primitive-syntax-table) (trans-quasiquote): Fix handling of nested quasiquotes. * testsuite/Makefile.am (vm_test_files): * testsuite/t-quasiquote.scm: Add a quasiquote test case. 2008-08-28 Andy Wingo <wingo@pobox.com> shamefully disable some more gc asserts * libguile/gc-freelist.c: Disable some more asserts. I have no idea why they're hitting, however. 2008-08-28 Andy Wingo <wingo@pobox.com> move guilec and guile-disasm to be guile-tools scripts * .gitignore: Some touchups. * configure.in: * src/.cvsignore: * src/Makefile.am: * Makefile.am: No more src/. * scripts/compile: * scripts/disassemble: Moved here from src/ and changed into guile-tools scripts. * scripts/Makefile.am: Add the new scriptes. * guilec.mk: Adapt to new way of invoking the compiler. 2008-08-26 Andy Wingo <wingo@pobox.com> fix guile-disasm * src/guile-disasm.in: Adapt to the split-up of (system vm core). Detabify. Patch by C. K. Jester-Young <cky944 <at> gmail.com>. 2008-08-26 Andy Wingo <wingo@pobox.com> m4 quoting foo in labels-as-values.m4. * m4/labels-as-values.m4: More m4 quoting love. Patch from C. K. Jester-Young <cky944 <at> gmail.com>. 2008-08-26 Andy Wingo <wingo@pobox.com> fix casting-pointers-to-ints bug * libguile/vm.c: Cast pointers to intptr_t, not int. Patch from C. K. Jester-Young <cky944 <at> gmail.com>. 2008-08-26 Andy Wingo <wingo@pobox.com> fetch an inum's bits into a scm_bits_t, not an int * libguile/vm-i-scheme.c (FUNC1): Remove, cause it's not used. (FUNC2): Don't assume an inum can fit into an int, use scm_bits_t instead. In reality though we should probably do use different checks, i.e. for multiplication probably we overflow. (That would be a bug.) Based on a patch by C. K. Jester-Young <cky944 <at> gmail.com>. 2008-08-26 Andy Wingo <wingo@pobox.com> suppress autoconf warning * guile-tools.in: Suppress ``WARNING: $ac_file_inputs seems to ignore the --datarootdir setting'' message. Patch from C. K. Jester-Young <cky944 <at> gmail.com> 2008-08-26 Andy Wingo <wingo@pobox.com> disable gc statistics asserts * libguile/gc.c: Disable the statistics asserts; see http://thread.gmane.org/gmane.lisp.guile.devel/7505 merge from guile master Had to fix up .gitignore for some conflicts. start compiling ice-9 * ice-9/Makefile.am: Integrate with guilec.mk, and start compiling sources. Have to figure out what to do with procedure->memoized-macro though, to get boot-9.scm compiling. 2008-08-25 Andy Wingo <wingo@pobox.com> module compilation fixen, post-integration Thanks to Dale Smith. * guilec.mk: Rework to expect the includer to define $(modpath), then make $(moddir) from that. * module/language/Makefile.am: * module/language/scheme/Makefile.am: * module/system/base/Makefile.am: * module/system/il/Makefile.am: * module/system/repl/Makefile.am: * module/system/vm/Makefile.am: Define modpath instead. * src/guilec.in: Don't import (system vm bootstrap), it is no more. 2008-08-22 Andy Wingo <wingo@pobox.com> merge guile-vm into libguile itself * ice-9/boot-9.scm: Only define load-compiled as #f if it's not already defined, which won't normally be the case. * libguile/guile-vm.c: Removed, there's no more guile-vm binary. * libguile/frames.c: (with change frame? -> heap-frame?) * libguile/frames.h: * libguile/instructions.c: * libguile/instructions.h: * libguile/objcodes.c: * libguile/objcodes.h: * libguile/programs.c: * libguile/programs.h: * libguile/vm-bootstrap.h: (was bootstrap.h) * libguile/vm-engine.c: (was vm_engine.c) * libguile/vm-engine.h: (was vm_engine.h) * libguile/vm-expand.h: (was vm_expand.h) * libguile/vm-i-loader.c: (was vm_loader.c) * libguile/vm-i-scheme.c: (was vm_scheme.c) * libguile/vm-i-system.c: (was vm_system.c) * libguile/vm.c: * libguile/vm.h: These files moved here from src/, as guile-vm is now a part of libguile. * libguile/init.c: Bootstrap the VM. Yay! * libguile/Makefile.am: The necessary chicanery here. * module/system/vm/Makefile.am: * module/system/vm/bootstrap.scm: * module/system/vm/frame.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: * pre-inst-guile-env.in: Add builddirs to the load path; add module/ to the path in the empty-$GUILE_LOAD_PATH case as well. * src/Makefile.am: Moved out everything except guilec and guile-disasm, which probably should be moved to the scripts directory? * testsuite/Makefile.am: Update to find guile-vm in the right place. * module/system/vm/Makefile.am: * module/system/vm/bootstrap.scm: Removed bootstrap.scm, scm_init_guile handles the bootstrapping for us. * module/system/vm/frame.scm: * module/system/vm/instruction.scm: * module/system/vm/objcode.scm: * module/system/vm/program.scm: * module/system/vm/vm.scm: Call the init functions in libguile; should fix at some point to avoid the dlopen? 2008-08-22 Andy Wingo <wingo@pobox.com> make pre-inst-guile use pre-inst-guile-env * pre-inst-guile-env.in: * pre-inst-guile.in: Change so that pre-inst-guile uses pre-inst-guile-env. Fixed inconsistency regarding $subdirs_with_ltlibs. 2008-08-21 Andy Wingo <wingo@pobox.com> chmod -x guilec.in. * src/guilec.in: Chmod -x. 2008-08-20 Andy Wingo <wingo@pobox.com> fix some compilation warnings, in anticipation of moving to libguile/ * src/Makefile.am: Use standard guile CFLAGS, which has -Werror and -Wmissing-prototypes. * src/frames.h: * src/instructions.h: * src/objcodes.h: * src/programs.h: * src/vm.h: * src/vm.c: Fix warnings, mostly about prototypes. * src/vm_system.c: Fix a tricky x-is-not-initialized error. Thanks, GCC! 2008-08-20 Andy Wingo <wingo@pobox.com> remove unused "envs" code from guile-vm * src/Makefile.am: * src/envs.c: * src/envs.h: Remove the envs code, which was historically used to implement modules. But since we use Guile's modules, these aren't necessary. * src/vm.c: * src/vm_loader.c: * module/system/vm/assemble.scm: Remove code bits that trafficked in yon deprecation. 2008-08-11 Andy Wingo <wingo@pobox.com> make ,stats work * module/system/repl/command.scm (display-time-stat, display-mips-stat): Always convert to float. * module/system/vm/frame.scm (print-frame): Write the args, don't display them. * module/system/repl/command.scm (statistics): gc-sweep-time is no more. 2008-08-11 Andy Wingo <wingo@pobox.com> ease-of-use improvement to ,m; catch read errors at the repl * module/system/repl/command.scm (module): Accept e.g. `,m ice-9 popen' in addition to `,m (ice-9 popen)'. * module/system/repl/repl.scm (start-repl): Call read with a backtrace handler too. 2008-08-11 Andy Wingo <wingo@pobox.com> fix bug in compilation of `and' and `or'; more robust underflow detection. * module/system/il/compile.scm (codegen): Rewrite handling of `and' and `or' ghil compilation, because it was broken if drop was #t. Tricky bug, this one! Took me days to track down! * module/system/repl/repl.scm: Export call-with-backtrace, which probably should go in some other file. * src/vm.c (scm_vm_save_stack): Handle the fp==0 case for errors before we have a frame. * src/vm_engine.h (NEW_FRAME, FREE_FRAME): Stricter underflow checking, raising the stack base to the return address, in an attempt to prevent inadvertant stack smashing (the symptom of the and/or miscompilation bug). (CHECK_IP): A check that the current IP is within the bounds of the current program. Not normally compiled in. Perhaps it should be? * src/vm_system.c (halt): Set vp->ip to NULL. Paranoia, I know. (return): Call CHECK_IP(), if such a thing is compiled in. * testsuite/Makefile.am (vm_test_files): * testsuite/t-catch.scm: * testsuite/t-map.scm: * testsuite/t-or.scm: New tests. 2008-08-09 Andy Wingo <wingo@pobox.com> backtraces on meta-commands too * module/system/repl/repl.scm (call-with-backtrace): New helper. (start-repl): Use the helper, for normal expressions *and* for meta-commands. warn and load source file if newer than compile file * ice-9/boot-9.scm (try-module-autoload): Warn if the compiled file is older than the source file, and in that case load the source file. don't truncate .go files, do an atomic rename to prevent SIGBUS * module/system/base/compile.scm (call-with-output-file/atomic): New proc, outputs to a tempfile then does an atomic rename. Prevents SIGBUS if a compiled file is truncated and rewritten, as the file's objcode is mmap'd in. (compile-file): Use the new helper. 2008-08-09 Andy Wingo <wingo@pobox.com> fix source location reporting for compiled code * module/system/repl/repl.scm (default-catch-handler): Cosmetic improvements on VM error backtraces. * module/system/vm/frame.scm (print-frame): Cosmetic improvements. (frame-line-number): source:line operates on the handle, not the cdr. (print-frame-chain-as-backtrace): Cosmetic improvements. 2008-08-08 Andy Wingo <wingo@pobox.com> heapify the bootstrap program * src/vm_engine.c (vm_run): * src/programs.c (scm_c_make_program): If the holder is #f, malloc *and* copy the bytecode. * module/system/vm/frame.scm (bootstrap-frame?): Now that we actually heapify the bootstrap program, we can check for `halt' in the bytecode. 2008-08-08 Andy Wingo <wingo@pobox.com> More relevant VM backtrace * module/system/repl/repl.scm: Remove a useless print in the backtrace handler. * module/system/vm/debug.scm (vm-backtrace): s/reverse!/reverse/ * module/system/vm/frame.scm (bootstrap-frame?): A heuristic to see if a frame is a bootstrap frame, the one allocated on the stack in vm_engine.c; need to have a better solution for this. (make-frame-chain): Don't include bootstrap frames, they add no information. (print-frame-chain-as-backtrace): Remove a pk. * src/vm_engine.c (vm_run): Add a fixme about the bootstrap prograp. 2008-08-08 Andy Wingo <wingo@pobox.com> improve source loc info in nonlocal exits and backtraces * module/system/il/compile.scm (codegen): The currently-executing instruction is actually the one right before the instruction pointer; so for purposes of assv to find a source location for an ip, put the source after the code, as it was before. * module/system/vm/debug.scm (vm-backtrace): Move more code to frame.scm. * module/system/vm/frame.scm (make-frame-chain): Include all frames, even the bootstrap one. For a reentrant backtrace we'll have boostrap programs anyway. Probably should check for objcode[2] == scm_op_halt, to not show those frames in the trace. (frame-line-number, frame-file): New helpers. (print-frame): Print out the line number too. (frame-call-representation): Code from print-frame-call moved here. (print-frame-chain-as-backtrace): A backtrace printer, yays. (program-name): Check link validity before calling frame-address on it. * module/system/vm/program.scm (source:addr, source:line, source:column) (source:file): New accessors for the elements of program-sources. * module/system/vm/vm.scm (vm:last-ip): New export. (vm-last-frame-chain): Use vm:last-ip in making the frame chain. * src/vm.h (struct scm_vm): * src/vm.c (make_vm, scm_vm_last_ip, scm_vm_save_stack): Save the last instruction pointer when saving the stack. Really though, we should be saving all of the stack data on a spaghetti stack. * src/vm_system.c (late-variable-ref): Pointless s/REGISTER/BEFORE_GC/. 2008-08-08 Andy Wingo <wingo@pobox.com> fix bug in variable-set instruction; ,x prints out program metadata * module/system/vm/disasm.scm (disassemble-program, disassemble-meta): Disassemble program meta information too, if it's there. * src/vm_system.c (variable-set): Don't try to proxy name information; maybe we can do this later, but the code as it was was calling SCM_CAR on a variable, which is for the lose. 2008-08-07 Andy Wingo <wingo@pobox.com> fix stack corruption on vm-save-stack; more robust with nonlocal exits * module/system/repl/command.scm: Coerce rationals to floats. * module/system/vm/program.scm (program-documentation): Fix a typo, doh! * src/vm.c (vm_reset_stack, struct vm_unwind_data): Add unwind handler to reset vp->sp, vp->fp, and vp->this_frame when performing a nonlocal exit from a vm_run. (vm_heapify_frames_1): Don't repack the stack, it causes stack corruption. I think we need spaghetti stacks to handle continuations, not separate heap frames. I don't think call/cc is working now. (vm-save-stack): Don't call heapify_frames, that modifies the stack that we're copying. Instead call its helper, heapify_1. * src/vm_engine.c (vm_run): Set up the vm_reset_stack unwind handler. * src/vm_engine.h (IP_REG, SP_REG, FP_REG): If we got through all of the checks without having these macros defined, define them as empty. Happens on x86-64. * src/vm_system.c (halt): End the dynwind before we return from the VM. * src/vm_scheme.c (REL): Sync the regs before calling scm_lt_p et al, cause they can do a nonlocal exit. 2008-08-07 Andy Wingo <wingo@pobox.com> vm backtrace improvements * module/system/repl/repl.scm (default-pre-unwind-handler): Save the VM stack in addition to the interpreter stack. At some point these functions should know about each other, I guess. (default-catch-handler): Show the VM stack too. Needs a bit of work. * module/system/vm/frame.scm: Export make-frame-chain. * module/system/vm/vm.scm: Export vm-save-stack. * src/vm.c (scm_vm_save_stack): New function, heapifies the current stack, saving it to vm->last_frame. * src/vm_engine.c (vm_run:vm_error): Don't heapify frames here, because nonlocal exits avoid this code entirely. Instead rely on the user saving the stack with a pre-unwind handler, as the repl does. 2008-08-07 Andy Wingo <wingo@pobox.com> build fixes * benchmark/measure.scm: Update for module changes. * module/system/vm/Makefile.am: Update the set of modules needing compilation. * src/guile-vm.c: Bootstrap the VM, now that we have a function for it. * testsuite/Makefile.am: * testsuite/run-vm-tests.scm: Update to fix make check, broken since we merged with Guile. 2008-08-07 Andy Wingo <wingo@pobox.com> big reorg of scheme modules -- e.g. programs.c -> (system vm program) This reorganization kills the ugly module-export-all hacks in bootstrap.scm and core.scm. In fact, it gets rid of core.scm entirely, breaking out its functionality into separate files. * module/system/vm/trace.scm: * module/system/vm/profile.scm: * module/system/vm/disasm.scm: * module/system/vm/debug.scm: * module/system/vm/conv.scm: * module/system/vm/assemble.scm: * module/system/repl/repl.scm: * module/system/repl/common.scm: * module/system/base/compile.scm: * module/system/repl/command.scm: Update for changes, and fix a bug in procedure-documentation. * module/system/vm/bootstrap.scm: Just call scm_bootstrap_vm, which handles setting load-compiled for us. * module/system/vm/core.scm: Removed, functionality folded into other modules. * module/system/vm/frame.scm: Export the C frame procedures here; also move scheme functions from core.scm here. * module/system/vm/instruction.scm: New file, exports procedures from instructions.c. * module/system/vm/objcode.scm: New file, exports procedures from objcodes.c. * module/system/vm/program.scm: New file, exports procedures from programs.c, and some scheme functions originally from core.scm. * module/system/vm/vm.scm: New file, from vm.c and core.scm. * src/Makefile.am (libguile_vm_la_SOURCES): Add bootstrap.h. * src/bootstrap.h: New file, prototypes scm_bootstrap_vm (), which the scm_init_* functions call. * src/frames.h: * src/frames.c (scm_init_frames): * src/frames.c (scm_bootstrap_frames): * src/vm.h: * src/instructions.h: * src/instructions.c (scm_init_instructions): * src/instructions.c (scm_bootstrap_instructions): * src/objcodes.h: * src/objcodes.c (scm_bootstrap_objcodes): * src/objcodes.c (scm_init_objcodes): * src/programs.h: * src/programs.c (scm_bootstrap_programs): * src/programs.c (scm_init_programs): * src/vm.c (scm_bootstrap_vm): * src/vm.c (scm_init_vm): Call scm_bootstrap_vm() before doing anything in an init function. Bootstrap_vm will call bootstrap_instructions(), etc to initialize types, then set load-compiled to point to load-compiled/vm. * src/vm.c (scm_load_compiled_with_vm): Code to load .go files, if they're present. 2008-08-06 Andy Wingo <wingo@pobox.com> sync registers before calling c functions, really * src/vm_loader.c: * src/vm_scheme.c: Use SYNC_REGISTER, although it's the same as SYNC_BEFORE_GC. A style issue? * src/vm_system.c (call, tail-call): Explicitly do a SYNC_REGISTER, not relying on POP_LIST to do it for us, because POP_LIST won't do it if there are 0 arguments. The way that this manifested itself to me was badness after the second (read) call in a repl session. I wish I understood more about this problem. 2008-08-05 Andy Wingo <wingo@pobox.com> save vm's state before calling out to c procedures * .gitignore: Ignore .go files. * src/vm_loader.c: * src/vm_scheme.c: * src/vm_system.c: Sync the VM's state before calling out to C procedures that might cons or cause a nonlocal exit. 2008-08-05 Andy Wingo <wingo@pobox.com> disable trampoline "optimizations" * src/vm_system.c: Disable those trampoline "optimizations", as they actually slowed down benchmark/measure.scm '(fibo 30)'. They were edifying, in that now I have an appreciation of the need for SYNC_ALL(). 2008-08-05 Andy Wingo <wingo@pobox.com> re-enable computed goto; fix ,help in the repl; subr dispatch optimizations * m4/labels-as-values.m4: New file, checks for computed goto. * configure.in: Use AC_C_LABELS_AS_VALUES. * module/system/repl/command.scm (procedure-documentation): Extend the core's procedure-documentation in an ad-hoc way, so that ,help works. * module/system/vm/core.scm (program-properties): New function. (program-documentation): New function. * src/vm_engine.h (DROP, DROPN): Decrement sp before checking for underflow. * src/vm_system.c (call, tail-call): Add some optimized dispatch for some C functions, so that we can avoid consing and the interpreter if possible. However currently it seems that I'm always getting the scm_call_* trampolines back. 2008-08-03 Andy Wingo <wingo@pobox.com> Add docstring support * module/language/scheme/translate.scm (translate): Adapt to lambda having a `meta' slot now. (primitive-syntax-table, parse-lambda-meta): Parse out a docstring from lambda forms, putting in the <ghil-lambda>'s meta slot. * module/system/il/compile.scm (optimize, codegen): Passthrough for the `meta' slot to the <glil-asm> object. * module/system/il/ghil.scm (<ghil-lambda>): Add meta slot. * module/system/il/glil.scm (<glil-asm>): Add meta slot. (unparse): Unparse meta. * module/system/vm/assemble.scm (preprocess): Pass through the meta slot. (codegen): So, set the bytespec's meta slot as a list: bindings, source info, then the tail is the meta-info, which should be an alist. Currently the only defined key is `documentation', but `name' could come in the future. * module/system/vm/core.scm (program-sources): Sources are now in the cadr... (program-property): And here we have access to the cddr. 2008-08-03 Andy Wingo <wingo@pobox.com> fix recording of source locations * module/language/scheme/translate.scm (translate, trans) (make-pmatch-transformers): When recursing into subexpressions, get the appropriate source location information. (location): Include the source filename in the location information. * module/system/il/compile.scm (codegen): Record source locations in more cases. (This information ends up being part of the procedure metadata, not the actual codepath.) * module/system/il/glil.scm (unparse): Don't destructure the source locations (it's a vector now). 2008-08-02 Andy Wingo <wingo@pobox.com> only pass symbols to module-ref & c * module/language/scheme/translate.scm: Make sure that we're actually passing symbols to module-ref et al. add compile-toplevel and evaluate conditions to eval-case * ice-9/boot-9.scm (eval-case): Define two more conditions: compile-toplevel and evaluate, as common lisp and chez scheme do. (defmacro, define-option-interface, define-macro, define-syntax-macro) (define-module, use-modules, use-syntax, define-public) (defmacro-public, export, re-export): Add `compile-toplevel' to all uses of eval-case. make has-suffix? use string-suffix? * ice-9/boot-9.scm (has-suffix?): Use the core / srfi-13's string-suffix?. Support loading of compiled syncase macros * ice-9/syncase.scm (current-eval-closure): New procedure. (env->eval-closure): Don't default to the root module: if we have no environment, we default to the current module via the logic in current-eval-closure. This is because psyntax's compilation mode doesn't know about guile modules, and thus won't dump the code to twiddle the current eval closure. (putprop, getprop, guile-macro): Use `current-eval-closure'. At the end, leave the expansion-eval-closure set to #f. support thunks as prompts, as readline does. * ice-9/boot-9.scm (repl-reader): Support thunks as prompts. make readline's `repl-reader' impl check the current-reader fluid * guile-readline/ice-9/readline.scm (activate-readline): Use the current binding of the current-reader fluid, if it is available. 2008-08-02 Andy Wingo <wingo@pobox.com> Fixes to make guile-vm compile in guile source tree * INSTALL: Updated. * m4/gnulib-cache.m4: Regenerated. * Makefile.am: Spelling fix. * guilec.mk: * src/Makefile.am: * src/vm.c: Update to actually work inside a guile source tree. * libguile/Makefile.am: Don't error on warnings in the flex-generated c-tokenize function. 2008-08-02 Andy Wingo <wingo@pobox.com> merge guile-vm to guile An attempt to pull in the original history from guile-vm into guile itself. 2008-05-25 Andy Wingo <wingo@pobox.com> Updated loop disassembly * benchmark/lib.scm: Update loop disassembly, with inlining. Neat! add inline macros for zero? and 1- * module/system/il/inline.scm (zero?, 1-): New inlines. Neat :) The loop benchmark speedup is now up to 5x. 2008-05-25 Andy Wingo <wingo@pobox.com> Speed up the self-tail-recursive case (1x->2x) * benchmark/lib.scm: Add a comment, update the loop disassembly. Loop is now faster in the VM, thankfully. * src/vm_engine.h (CACHE_PROGRAM): Only release and regrab the object array handle if the program changed. That is to say, optimize the self-tail-recursive case. But perhaps the thing to optimize here are the procedure calls themselves. Worth looking at in the future. 2008-05-25 Andy Wingo <wingo@pobox.com> enable inlining; speed! * module/system/il/inline.scm: New module, implements generic inlining of scheme functions. It even does the right thing regarding (define arity:nopt caddr) and such. So now there are many more inlines: the arithmetics, `apply', the caddr family, etc. This makes the benchmarks *much* faster. * module/language/scheme/translate.scm (trans): Remove the %scheme-primitives code in favor of the generic (scheme il inline) code. Adds inlining for +, -, =, etc. * src/vm.c (vm_puts): Fix to work. * module/system/base/compile.scm (system): Export load/compile also. * module/system/il/compile.scm (optimize): Further debitrotting, but I haven't tried this function yet. It seems that <ghil-inst> was what <ghil-inline> is. * module/system/il/ghil.scm (*core-primitives*, *macro-module*) (ghil-primitive-macro?, ghil-macro-expander, ghil-primitive?): Remove these unused things. * module/system/il/macros.scm: Removed, replaced with inline.scm. * module/system/vm/assemble.scm (stack->bytes): Before, the final serialization code did an (apply u8vector (apply append (map u8vector->list ...))). Aside from the misspelling of append-map, this ends up pushing all elements of the u8vector on the stack -- assuredly not what you want. But besides even that, I think that pushing more than 32k arguments on the stack brings out some other bug that I think was hidden before, because now we actually use the `apply' VM instruction. Further testing is needed here, I think. Fixed the code to be more efficient, which fixes the manifestation of this particular bug: a failure to self-compile after inlining was enabled. * module/system/vm/bootstrap.scm: New module, serves to bootstrap boot-9's `load-compiled'. That way when we load (system vm core), we're loading compiled code already. * module/system/vm/core.scm: Use (system vm bootstrap). * src/guilec.in: Use the bootstrap code, so that we really are compiling with an entirely compiled compiler. * module/system/repl/repl.scm (default-catch-handler): An attempt at making the repl print a backtrace; more work needed here. * module/system/vm/frame.scm (make-frame-chain): Fix some misspellings -- I think, anyway. 2008-05-20 Andy Wingo <wingo@pobox.com> update news * NEWS: Update news for 0.7 release 2008-05-20 Andy Wingo <wingo@pobox.com> distcheck works now * guilec.mk: New file, to be included when building .go files. * module/language/scheme/Makefile.am: * module/system/base/Makefile.am: * module/system/il/Makefile.am: * module/system/repl/Makefile.am: * module/system/vm/Makefile.am: Use guilec.mk. * module/system/base/compile.scm (compiled-file-name): Work on the basename of a file, so that we always create files in the directory where we run. Perhaps should add a -o option to guilec in the future. * Makefile.am: Actually recurse into module/ in a normal build. 2008-05-20 Andy Wingo <wingo@pobox.com> include local copy of guile.m4 * acinclude.m4: Add guile.m4 to this, because I really can't be arsed with aclocal. * autogen.sh: More better vanilla. 2008-05-20 Andy Wingo <wingo@pobox.com> autotooling, version bump to 0.7 * acconfig.h: Removed. * acinclude.m4: Use the extended AC_DEFINE for HAVE_LABELS_AS_VALUES, so as to remove the need for acconfig.h. * autogen.sh: Use autoreconf. * configure.in: Update info, don't warn about non-gnu make, bump version to 0.7. * doc/texinfo.tex: Automagically updated. (Should this be in VCS?) 2008-05-20 Andy Wingo <wingo@pobox.com> fix distcheck * src/Makefile.am (AM_CFLAGS, libguile_vm_la_LDFLAGS): Don't build with -pg. (There are better profilers out there.) (CLEANFILES): Add guilev and guile-disasm. * testsuite/Makefile.am (GUILE_VM): s/srcdir/builddir/. 2008-05-20 Andy Wingo <wingo@pobox.com> properly include config.h in source files, not headers * src/Makefile.am: Add $(DEFAULT_INCLUDES) to a couple of our custom rules so we pick up the -I for config.h. * src/*.[ch]: Include the config.h in the C files, not in the headers. 2008-05-20 Andy Wingo <wingo@pobox.com> guile-vm is completely self-compiling now! * module/language/scheme/translate.scm (*the-compile-toplevel-symbol*): Reset to compile-toplevel, which requires a patch to guile. * module/system/base/compile.scm (compile-file): Some foo so that we load up the scheme language before call-with-output-file. Fixes compilation of (language scheme) modules. * module/system/base/language.scm (define-language): Don't unquote in make-language; refer to it by name instead, and export it. * module/system/repl/Makefile.am (vm_DATA): Don't compile describe.scm, because we really can't deal with goops yet. * module/system/repl/repl.scm (compile-toplevel): If we're compiling, put in a stub definition of start-stack, which is closely tied to the interpreter. * src/vm_loader.c (load-program): Fix a very tricky corruption bug! 2008-05-19 Andy Wingo <wingo@pobox.com> fix syntax error in describe.scm * module/system/repl/describe.scm (format-documentation): Remove bad string syntax. This file doesn't compile though, due to define-macro being a procedure->syntax macro. 2008-05-19 Andy Wingo <wingo@pobox.com> fix immediate linkage, some other fixes to allow vm/ to compile * module/language/scheme/translate.scm (lookup-transformer): Allow for undefined variables when doing the transformation -- it's possible that they come from a module definition's forward declaration. * module/system/repl/command.scm (import): Make into legal Scheme, caught by the compiler :-) * module/system/vm/assemble.scm (<vlink-now>): Remove the module field. Immediate bindings will now always be relative to the current module. Fixes some mess about process-define-module not being defined when loading modules, probably because we destructively modified the ghil-env. (codegen, dump-object!): Don't dump a module name. * src/vm_loader.c (link-now): Just use scm_lookup. 2008-05-19 Andy Wingo <wingo@pobox.com> bind all module-level variables lazily comments in ghil-lookup are pertinent. * module/system/il/compile.scm (make-glil-var): Require that ghil vars have environments. Remove the 'unresolved case -- we'll treat all module-level variables as late bound. * module/system/il/ghil.scm (ghil-lookup): Treat all module level vars as late bound. * module/system/vm/assemble.scm: Instead of vlink and vlate-bound, have vlink-now and vlink-later. (codegen): Add a bunch of crap to get the various cases right. (object-assoc, dump-object!): Handle the new cases, remove the old cases. * src/vm_loader.c (link-now, link-later): Change from link and lazy-bind. Include the module in which the link is to be done, so that callers from other modules get the right behavior. * src/vm_system.c (late-variable-ref, late-variable-set): Instead of a sym, the unbound representation is a module name / symbol pair. * testsuite/run-vm-tests.scm (run-vm-tests): Remove some debugging. 2008-05-19 Andy Wingo <wingo@pobox.com> Add instructions for doing very late binding Fixes the mutually-recursive toplevel definitions case. This could be fixed by rewriting bodies as letrecs, as r6 does, but that's not really repl-compatible. * module/system/il/ghil.scm (ghil-lookup): Ok, if we can't locate a variable, mark it as unresolved. * module/system/il/compile.scm (make-glil-var): Compile unresolved variables as <glil-late-bound> objects. * module/system/il/glil.scm: Add <glil-late-bound> definition. * module/system/vm/assemble.scm (codegen): And, finally, when we see a <vlate-bound> object, allocate a slot for it in the object vector, setting it to a symbol. Add a new pair of instructions to resolve that symbol to a variable at the last minute. * src/vm_loader.c (load-number): Bugfix: the radix argument should be SCM_UNDEFINED in order to default to 10. (late-bind): Add an unresolved symbol to the object vector. Could be replaced with load-symbol I guess. * src/vm_system.c (late-variable-ref, late-variable-set): New instructions to do late symbol binding. * testsuite/Makefile.am (vm_test_files): * testsuite/t-mutual-toplevel-defines.scm: New test, failing for some reason involving the core even? and odd? definitions. 2008-05-19 Andy Wingo <wingo@pobox.com> compile all of base/; some arbitrary changes; more "fixes" to `link' * module/language/scheme/translate.scm (lookup-transformer): When expanding syncase macros, use the eval closure from the ghil-env. Probably doesn't make any difference whatsoever. * module/system/base/Makefile.am (SOURCES): Compile pmatch.scm, now that it works :-)) * module/system/base/compile.scm (compile-in): Compile inside a save-module-excursion, so that side effects of evaluation don't leak out. * module/system/base/pmatch.scm: Change from :use-syntax/:export-syntax to simply :use-modules/:export. Also probably has no effect. * module/system/il/ghil.scm (fix-ghil-mod!): Suppress warnings resulting from compilation of define-module. * src/vm_loader.c (link): So, referencing variables defined but not exported from the current module didn't work. Fixed that, but it's hacky. There are still some uncaught cases. 2008-05-19 Andy Wingo <wingo@pobox.com> syncase macros compiling! * module/system/base/compile.scm: Also import load-objcode from (system vm core). * module/language/scheme/translate.scm (lookup-transformer): Use sc-expand3 in compilation mode when compiling macros. Yay, syncase macros compile! 2008-05-15 Andy Wingo <wingo@pobox.com> rudimentary syncase support; some dash symbol syncase removal * module/system/vm/assemble.scm (dump-object!): * src/vm_loader.c (VM_DEFINE_LOADER): Use scm_from_locale_keywordn, not the krazy dash symbol stuff. * module/language/scheme/translate.scm (lookup-transformer): Add a special case for syncase macros. 2008-05-15 Andy Wingo <wingo@pobox.com> avoid zealous unquotation * module/system/base/syntax.scm (define-record): Again, don't unquote in actual objects, because this is uncompilable. Ah well. At least now all of base/ is compiling. * module/system/vm/assemble.scm (dump-object!): More debug info. 2008-05-15 Andy Wingo <wingo@pobox.com> fix else in cond, letrec env corruption, syntax.scm compile, define-module side effects * module/language/scheme/translate.scm (primitive-syntax-table): Translate the `else' clause of a cond as (begin ...). We used to use trans-body, which processes internal defines, which are not legal syntax here. * module/system/base/syntax.scm (define-record): Unfortunately, we can't unquote in the actual procedure for `%compute-initargs', because that doesn't work with compilation. So reference %compute-initargs by name, and export it. * module/system/il/ghil.scm (apopq!): Gaaaaar. The order of the arguments to assq-remove! was reversed, which was the badness, causing corruption to the env after calling call-with-ghil-bindings. Grrrrrr. (fix-ghil-mod!, ghil-lookup, ghil-define): As amply commented in the code, deal with compile-time side effects to the current module by lazily noticing and patching up the compile-time environment. A hacky solution until such a time as we special-case something for `define-module'. 2008-05-15 Andy Wingo <wingo@pobox.com> `link' instruction links to symbols by module * module/system/il/compile.scm (make-glil-var): Only dump the module if we actually have one. * module/system/il/ghil.scm (ghil-define): Make sure that ghil-var-env is a ghil-env. * src/vm_loader.c (link): * module/system/vm/assemble.scm (dump-object!): Rewrite `link' to take two Scheme arguments on the stack: the symbol, as before, and the module in which the symbol was found at compile time. This introduces some undesireable early binding, but it does let the vm load up modules, and (potentially) have multiple modules in one .go file. On a practical level, I can now compile modules and have their .go files load up the modules' dependencies as necessary. 2008-05-15 Andy Wingo <wingo@pobox.com> remove some debugging info * module/system/vm/assemble.scm: remove a pk 2008-05-15 Andy Wingo <wingo@pobox.com> push the module resolution info for variables down into glil * module/system/il/compile.scm (make-glil-var): Make the :mod of the glil-var actually a guile module, not a ghil-env. * module/system/il/ghil.scm (module-lookup, ghil-lookup): For module variables, encode the location where we found the variable in the ghil-var. 2008-05-15 Andy Wingo <wingo@pobox.com> fix dumping of #:keywords * module/language/scheme/translate.scm (trans): * module/system/il/compile.scm (codegen): When making records where a value can be a keyword, make sure to use the keyword initialization form, so that the record initializer doesn't interpret the keyword as a slot name. * module/system/base/Makefile.am (vm_DATA): For now, don't compile pmatch. 2008-05-15 Andy Wingo <wingo@pobox.com> allow interpretation of load-toplevel as compile-toplevel * module/language/scheme/translate.scm (*the-compile-toplevel-symbol*) (primitive-syntax-table): Existing eval-case invocations in boot-9.scm only have `load-toplevel', not `load-toplevel' and `compile-toplevel' as they should. Allow for interpreting `load-toplevel' as `compile-toplevel'. rework eval-case handling to be like cl's eval-when * module/language/scheme/translate.scm (trans): Remove the hacky case for the unspecified value, not needed any more. (primitive-syntax-table): Rework eval-case to understand compile-toplevel and evaluate contexts, as in common lisp's eval-when: http://www.lisp.org/HyperSpec/Body/speope_eval-when.html This is the Right Thing. 2008-05-14 Andy Wingo <wingo@pobox.com> fix use-syntax / use-modules confusion -- fixes testsuites * testsuite/t-match.scm: * testsuite/t-records.scm: While the attempt to redefine use-syntax as being "use during compilation" was cute, it does not reflect the historical usage of use-syntax, nor does it correspond to existing code that includes other modules and uses them during compilation. So use-syntax has been replaced with use-modules. The test suites now pass. In the future, compilation phases should be done on whole modules, I think; r5rs-style computation does not have phases. 2008-05-14 Andy Wingo <wingo@pobox.com> fix macro compilation via hooking into eval-case * module/language/scheme/translate.scm (eval-at-compile-time) (&compile-time-module, expand-macro): Remove this attempt at dealing with macros. Instead, we're going to rely on macros being first-class, and just catch eval-case at the bottom. (lookup-transformer): Lookup all syntax transformers in the module's eval closure. We catch the primitive-macros, compiling them to ghil, and expand the rest. (lookup-transformer): Fold in trans-pair here. Add a hacky case for the unspecified value; the problem shows up when compiling e.g. (define-macro (plus! x) `(set! ,x (1+ x))), as a fallout from eval-case. (make-pmatch-transformers, primitive-syntax-table): Define the primitive syntax transformers as a data-driven table instead of a function. There's a bit of syntax, too. Eval-case was rewritten to use pmatch. * module/system/base/compile.scm (scheme): Define as a thunk instead of a value, so as to allow (language scheme translate) to be imported in the repl. Still, a hack. 2008-05-14 Andy Wingo <wingo@pobox.com> (void) -> (begin) * module/language/scheme/translate.scm (expand-macro, trans-pair): Remove support for the scheme form, '(void). Replace it by (begin). What was Keisuke thinking? :) remove x.foo.bar -> (slot x 'foo 'bar) compile-time translation * module/language/scheme/translate.scm (trans): Remove compile-time dot expansion. 2008-05-13 Andy Wingo <wingo@pobox.com> fix env script * env: Fix env script to find $top_srcdir correctly 2008-05-13 Andy Wingo <wingo@pobox.com> Update Makefile.am's; remove slib import * Makefile.am: * module/Makefile.am: * module/language/scheme/Makefile.am: * module/system/Makefile.am: * module/system/base/Makefile.am: * module/system/il/Makefile.am: * module/system/repl/Makefile.am: * module/system/vm/Makefile.am: Cleaned up to be more complete, if not completely working. * module/guile/slib.scm: * module/slib/: Removed the slib import; it's a bit out of place here, and bitrotten at that. 2008-05-12 Andy Wingo <wingo@pobox.com> add env script * env: New file, run as ./env guile catch errors in the repl, with poor backtraces * module/system/repl/repl.scm (default-pre-unwind-handler) (default-catch-handler): New procedures, to do some error handling in the repl. (start-repl): Catch errors in the repl loop. 2008-05-12 Andy Wingo <wingo@pobox.com> replace cenv with things in <repl> and fluids; remove the `use' meta-command * module/system/base/compile.scm (<cenv>): No more cenv, it was a useless data structure. * module/system/repl/command.scm (*command-table*): Remove `use', it's the same as `import'. Otherwise in this file, adapt to the repl having direct pointers to the vm and the language, and to the module being in the current-module fluid. * module/system/repl/repl.scm (prompting-meta-read): * module/system/repl/common.scm (<repl>): The repl now has a direct pointer to the vm and language. Adapt accordingly. 2008-05-12 Andy Wingo <wingo@pobox.com> fixes so that typing asdfadfasff in the repl doesn't error Before: > ,c (set! x 3) 0 (make-int8 3) ;; 3 2 (link "x") 5 (variable-set) > ,c (define x 3) 0 (make-int8 3) ;; 3 2 (link "x") 5 (variable-set) After: > ,c (define x 3) 0 (make-int8 3) ;; 3 2 (define "x") 5 (variable-set) * src/vm_loader.c (link): `link' now errors if the variable is undefined. This corresponds with desired behavior, for both `ref' and `set' operations, for scheme. It's not what elisp wants, though. Perhaps elisp linking needs another instruction. (define): New instruction, the same as calling scm_define(), basically. * module/language/scheme/translate.scm (trans-pair): Don't try to look up an existing variable definition when translating `define'; instead use the special-purpose lookup from ghil.scm's `ghil-define'. * module/system/il/compile.scm (codegen): Compile to a different kind of variable access from `set!', specifically via passing 'define as the op to `make-glil-var'. * module/system/il/ghil.scm (ghil-lookup): Don't add to the module table when compiling variable sets via `set!'. (ghil-define): New procedure, for looking up variables for `define'. * module/system/vm/assemble.scm (<vdefine>): New record: a new instruction type. (codegen): Compile `define' module vars into <vdefine>. (dump-object!): <vdefine> == `define'. 2008-05-11 Andy Wingo <wingo@pobox.com> only allow `define' at toplevel * module/language/scheme/translate.scm (trans-pair): Add a guard to only allow `define' at the top level; other defines are already filtered out via trans-body. * module/system/il/ghil.scm (ghil-env-toplevel?): Export, and fix. 2008-05-11 Andy Wingo <wingo@pobox.com> remove define-private * module/language/scheme/translate.scm: Remove define-private. explicitly list exports instead of using define-public * module/system/base/compile.scm: * module/system/il/ghil.scm: * module/system/repl/describe.scm: * module/system/vm/core.scm: * module/system/vm/frame.scm: * module/system/vm/trace.scm: Explicitly list exports in the module declaration instead of using define-public. 2008-05-11 Andy Wingo <wingo@pobox.com> <foo>? -> foo?; some exports cleanups * module/system/base/compile.scm: Export cenv? also. * module/system/base/syntax.scm: Clean up vestiges of the old structure code. Make accessors defined as foo? instead of <foo>?. * module/system/il/glil.scm: * module/system/il/ghil.scm: Remove <foo>-1 accessors, since we have named accessors. 2008-05-11 Andy Wingo <wingo@pobox.com> pmatchify a cond for prettiness * module/language/scheme/translate.scm: pmatchify, it's prettier. fix to meta-reader's optional port argument * module/system/repl/repl.scm (meta-reader): Make the generated read procedure accept a port argument. 2008-05-09 Andy Wingo <wingo@pobox.com> ice-9 history integration * module/system/repl/repl.scm (start-repl): (ice-9 history) integration via the before-eval-hook and the before-print-hook. 2008-05-09 Andy Wingo <wingo@pobox.com> readline integration for guile-vm * module/system/repl/common.scm (repl-prompt): Return a string instead of outputting to the port, for better readline integration. * module/system/repl/repl.scm (meta-reader, prompting-meta-read) (start-repl): Integrate with (ice-9 readline) via the current-reader fluid and the repl-reader function, both from boot-9.scm. 2008-05-09 Andy Wingo <wingo@pobox.com> more exports cleanups * module/system/repl/common.scm: Declare exports in the module declaration. 2008-05-09 Andy Wingo <wingo@pobox.com> multiple-values help for the repl; exports cleanups * module/system/repl/command.scm (system): Declare exports in the module declaration. * module/system/repl/repl.scm (start-repl): If the evaluation returns multiple values, print them separately. 2008-05-04 Andy Wingo <wingo@pobox.com> Replace ice-9 match's structures with guile's records * module/system/base/syntax.scm (define-record): Rebase to implement on top of Guile's records, which are the substrate of srfi-9's records. (%compute-initargs): Rename from %make-struct, just return the list of values. (get-slot, set-slot!, slot): Removed, no longer used. (record-case): Allow slots of the form (MYNAME SLOTNAME), which binds SLOTNAME to MYNAME (instead of SLOTNAME to SLOTNAME). (record-case, record?): No more ice-9 match! * module/system/il/compile.scm (codegen): Tweaks so that the new record code works. * module/system/il/ghil.scm: Fix some slot references. * module/system/vm/assemble.scm (preprocess, codegen): Remove calls to `slot'. (codegen): Fix some slot references. 2008-05-04 Andy Wingo <wingo@pobox.com> Removed dot-expander syntax foo * module/system/base/syntax.scm (expand-dot!, expand-symbol, syntax): Removed, we don't use this syntax any more. 2008-05-04 Andy Wingo <wingo@pobox.com> finish dedottifying * module/system/base/compile.scm: Dedottify. * module/system/base/language.scm: Export language accessors. * module/system/repl/common.scm: Dedottify. It's ugly, I know. 2008-05-04 Andy Wingo <wingo@pobox.com> more dedottification, almost done * module/system/repl/common.scm: * module/system/base/compile.scm: Export some more things. * module/system/repl/command.scm: Dedottify. 2008-05-04 Andy Wingo <wingo@pobox.com> Dedottify some more * module/system/il/compile.scm: Dedottify. * module/system/il/ghil.scm: Export some more thingies. 2008-05-04 Andy Wingo <wingo@pobox.com> procedures-with-setters, debitrot `optimize', dedottification * module/system/base/syntax.scm (define-record): Define the accessors as procedures-with-setters, not just as getters. * module/system/il/compile.scm (optimize): This function was bitrotten since the addition of source locations in cb4cca12e719edfef1740f238d9187c21c8e1e35. Untested attempts to de-bitrot it. Dedottify as well. * module/system/il/ghil.scm: * module/system/il/glil.scm (unparse): * module/system/vm/debug.scm (debugger-repl): Ongoing dedottification. 2008-05-04 Andy Wingo <wingo@pobox.com> fix errors in (language scheme translate) introduced in pmatchification * module/language/scheme/translate.scm (trans-pair): Fix some errors introduced in pmatchification. Start the process of de-dottification. * module/system/vm/assemble.scm: De-dottify. 2008-05-04 Andy Wingo <wingo@pobox.com> Define named accessors for legacy record types * module/system/base/syntax.scm (define-record): Define named accessors, to prepare the code for srfi-9 records switchover. * module/system/il/ghil.scm: * module/system/il/glil.scm: Export a bunch of named accessors. 2008-05-04 Andy Wingo <wingo@pobox.com> Refactor (language scheme translate) to use pmatch * module/language/scheme/translate.scm: Refactor use of `match' to use `pmatch'. Relatively straightforward. * module/system/base/pmatch.scm (ppat): Fix some copy-n-paste bugs: the _ rule, the quote rule. 2008-05-03 Andy Wingo <wingo@pobox.com> more pmatchification * module/system/il/ghil.scm: No need for a match * module/system/repl/command.scm: Pmatchify * module/system/vm/disasm.scm: Pmatchify. 2008-05-03 Andy Wingo <wingo@pobox.com> bugfix to make-cenv * module/system/base/compile.scm (make-cenv): Fix make-cenv. 2008-05-03 Andy Wingo <wingo@pobox.com> start using pmatch instead of match * module/system/base/Makefile.am: Add pmatch.scm. * module/system/base/pmatch.scm: New file, taken from Dan Friedman's alpha-kanren paper. Implements a less magical match syntax, pmatch. * module/system/vm/assemble.scm: No more need for (ice-9 match). * module/system/vm/conv.scm (code-pack, code->object): Change to use pmatch. 2008-05-03 Andy Wingo <wingo@pobox.com> s/match-lambda\*/case-lambda/g * module/system/il/macros.scm: Use case-lambda from srfi-16 rather than match-lambda*. 2008-05-03 Andy Wingo <wingo@pobox.com> convert a couple more modules to record-case * module/system/base/syntax.scm (record-case): Capture the match macro. * module/system/il/glil.scm: * module/system/il/compile.scm: Convert to record-case. 2008-05-03 Andy Wingo <wingo@pobox.com> unify variant types and records; also make-foo instead of <foo> * module/system/base/syntax.scm (define-record): Rework to separate the type and its constructor. Now (define-record (<foo> bar)) will create `make-foo' as the constructor, not `<foo>'. Also the constructor now takes either keyword or positional arguments, so that it can be used as the implementation of variant types as well. (|): Map directly to define-record instead of rolling our own thing. * module/language/scheme/translate.scm: * module/system/base/language.scm: * module/system/il/compile.scm: * module/system/il/ghil.scm: * module/system/il/glil.scm: * module/system/repl/common.scm: * module/system/vm/assemble.scm: * module/system/vm/debug.scm: Change instances of record creation to use the make-foo procedures instead of <foo>. Adjust module exports as necessary. 2008-05-03 Andy Wingo <wingo@pobox.com> Convert assemble.scm to use record-case. * module/system/base/syntax.scm (record?): Temporarily export this thing, so that code will remain correct when I change to srfi-9 records. * module/system/vm/assemble.scm: Convert to use record-case. 2008-05-03 Andy Wingo <wingo@pobox.com> fix to (system base syntax)'s syntax * module/system/base/syntax.scm: Fix define-module rebase record-case on `match' * module/system/base/syntax.scm (record-case): Rebase on `match', for transition purposes. pull in srfi-9, implement record-case * module/system/base/syntax.scm: Pull in srfi-9. Define a record-case macro that will replace (match foo (($ <type> slot ...) body...)). 2008-05-02 Andy Wingo <wingo@pobox.com> clean up some syntax imports and exports * module/system/base/syntax.scm (system): Don't re-export receive or and-let*; modules should explicitly import these if they want to. Don't export an empty stack-catch definition! * module/system/repl/command.scm (system): Pull in and-let*. * module/system/vm/disasm.scm (system): Don't import and-let*. 2008-05-02 Andy Wingo <wingo@pobox.com> remove module.scm * module/system/base/module.scm: Removed module.scm, as it was unused (see 9419ff9ae91c93983972797e607e135ecd1233bb). 2008-05-02 Andy Wingo <wingo@pobox.com> cleanups in syntax.scm * benchmark/lib.scm (fibo): Make fibo actually a fibonacci sequence. * module/system/base/syntax.scm (system): Forward-declare all exports. (expand-symbol, slot): Rewrite expand-symbol to expand to a non-recursive invocation of `slot', so that in the future when we get rid of this syntax, the replacement will be more palatable to the eyes. 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Slowly improving support for macro compilation. * module/language/scheme/translate.scm (¤t-macros): Removed. (¤t-macro-module): Removed. (&compile-time-module): New. (eval-at-compile-time): New. (translate): Initialize `&compile-time-module'. (expand-macro)[use-syntax]: New case. [begin let...]: Don't expand these built-in macros. [else]: Rewrote the macro detection and invocation logic. Invoke macro transformers in the current compile-time module. (trans): Let `expand-macro' raise an exception if needed. (trans-pair)[defmacro define-macro]: Evaluate the macro definition in the compile-time module. * testsuite/t-match.scm: Use `use-syntax' instead of `use-modules' for `(ice-9 match)' and `(srfi srfi-9)'. * testsuite/t-records.scm: Likewise. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-15 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Fixed `autogen.sh' and removed `module' from the list of dirs to build. * autogen.sh: Fixed (call `libtoolize'). * Makefile.am (SUBDIRS): Removed `module' which doesn't build right now. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-16 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Improved macro handling; started documenting the issue. * doc/guile-vm.texi (Compiling Scheme Code): New node. * module/language/scheme/translate.scm (¤t-macro-module): New. (translate): Evaluate macros in `¤t-macro-module'. (trans-pair): Likewise. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-13 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed the exception handler of `guilec'. * src/guilec.in: Fixed the exception handler. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-12 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Encode the length of constant lists/vectors on 2 octets instead of 1. * module/system/vm/assemble.scm (dump-object!): New sub-procedure `too-long'. For `list' and `vector', encode the length on 2 octets instead of 1 and report an error if a list/vector is longer than 65535. * module/system/vm/disasm.scm (original-value): New sub-procedure `list-or-vector?'; when true, return the number of elements for that list/vector. * src/vm_system.c (list): Fetch the length as a two-octet integer. (vector): Likewise. * testsuite/t-basic-contructs.scm: New. * testsuite/Makefile.am (vm_test_files): Added the above file. * module/system/vm/core.scm (load-compiled): Added a bit of documentation. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-11 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Renamed the library from `libguilevm' to `libguile-vm'. * src/Makefile.am (lib_LTLIBRARIES): Renamed to `libguilevm.la' to `libguile-vm.la'. * module/system/vm/core.scm: Dynamic-link "libguile-vm" instead of "libguilevm.so". git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-10 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Added support for `defmacro' and `define-macro' in the compiler. * module/language/scheme/translate.scm: Use `(srfi srfi-39)'. (¤t-macros): New top-level. (expand-macro): New. (scheme-primitives): Renamed `%scheme-primitives'. (%forbidden-primitives): New. (trans): Use `expand-macro' instead of `macroexpand'. (trans-pair): Handle `define-macro' and `defmacro'. * module/system/base/compile.scm (call-with-compile-error-catch): Handle non-pair LOC. * testsuite/t-macros2.scm: New test case. * testsuite/Makefile.am (vm_test_files): Updated. * testsuite/t-macros.scm: Test `read-options'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-9 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed an "unbound variable" in `(system vm conv)'. * module/system/vm/conv.scm: Autoload `(system vm core)' also when `opcode->instruction' is hit. This fixes an "unbound variable" problem. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-8 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed error handling; detect and report macro expansion errors. * module/language/scheme/translate.scm (trans): Catch exceptions thrown by `macroexpand' and throw a syntax error. (trans-pair): Catch calls to `procedure->memoizing-macro' and raise a syntax error. * module/system/base/compile.scm (call-with-compile-error-catch): Made a macro (a procedure doesn't do the job). (compile-file): Uncommented call to `call-with-compile-error-catch'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-7 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Tried compiling more code; augmented the doc. * module/language/Makefile.am: New. * module/language/scheme/Makefile.am: New. * configure.in: Produce these two new Makefiles. * doc/guile-vm.texi: Documented `compile-file', `compiled-file-name', and `compile-in'. * module/system/base/compile.scm: Cosmetic changes. * module/system/base/language.scm: Likewise. * module/system/il/Makefile.am: Tried (and failed) to compile more things. * module/system/vm/Makefile.am: All source files in here can now be compiled without harming further compilation. * module/system/vm/assemble.scm: Select only specific bindings from `(system vm core)'. (dump-object!): Show a more meaningful error message. * module/system/vm/conv.scm: Select only specific bindings from `(system vm core)'. * module/system/vm/debug.scm: Likewise. * module/system/vm/frame.scm: Changed the header. Use a renamer for `(system vm core)'. * src/guilec.in: Added options, via `getopt-long'. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-6 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Fixed a Scheme translation bug; cleaned compilation with GCC 4. * module/language/scheme/translate.scm (trans-pair): In the `set!' case, when a procedure-with-setter is passed, call `trans:pair' with an actual pair. This fixes a long-lasting bug which prevented compilation of `set!' statements with procedures-with-setter (this showed up when compiling `(system vm assemble)'). * module/system/base/compile.scm: Added `objcode->u8vector' to the `#:select' clause. * module/system/base/syntax.scm: Cosmetic changes. * module/system/vm/assemble.scm (preprocess): Removed debugging statements. * src/frames.c: Cosmetic changes. * src/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): New. * src/objcodes.c: Use `scm_t_uint8' instead of `char' when relevant. * src/vm.c (vm_heapify_frames_1): Use `SCM_FRAME_SET_DYNAMIC_LINK ()'. * src/vm_loader.c: Added casts to mute GCC 4 warnings. * testsuite/run-vm-tests.scm (*scheme*): Renamed to `%scheme'. (run-test-from-file): Renamed to `compile/run-test-from-file'. (run-vm-tests): Run each test using both the VM and the interpreter; compare the results. * testsuite/t-proc-with-setter.scm: Try out `get/set'. * doc/Makefile.am (info_TEXINFOS): New. * doc/guile-vm.texi: Added index entries and indices. * doc/texinfo.tex: New file. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-5 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Minor binding name clash tweak. * module/system/base/compile.scm: Only import `the-vm' and `vm-load' from `(system vm core)'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-10 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Started documenting the compiler. * doc/guile-vm.texi: Documented the compiler (node `The Compiler'). Removed a number of things that might have been relevant to Guile-VM 0.0. * module/system/il/compile.scm (optimize): Commented out the case using `<ghil-inst?>'. * src/vm_engine.c (vm_run)[objects_handle]: New variable. Before leaving the function, release OBJECTS_HANDLE. * src/vm_engine.h (CACHE_PROGRAM): Use `scm_vector_writable_elements' instead of `scm_vector_elements'; don't release the handle right away. * src/vm_loader.c (load-program): New commented out piece of code dealing with simple vectors. * src/vm_system.c (object-ref): Added the type of OBJNUM. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-3 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> * src/objcodes.c (make_objcode_by_mmap): Fixed the error type when the object file is too small. * doc/guile-vm.texi: Documented `make-closure'. Improved the documentation of `load-program'. * testsuite: New directory. * configure.in: Added `testsuite/Makefile' to `AC_OUTPUT'. * Makefile.am (SUBDIRS): Added `testsuite'. * src/vm_engine.h (VM_CHECK_OBJECT): New option. (CHECK_OBJECT): New macro. * src/vm_system.c (object-ref): Use VM_CHECK_OBJECT. * module/system/vm/assemble.scm (preprocess): Commented out the debugging code. * benchmark/lib.scm (do-loop): New procedure. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-2 2008-04-25 Ludovic Courtes <ludovic.courtes@laas.fr> Removed a few more deprecated function calls; documented closures. * src/Makefile.am (.c.x): Fixed the rule. * src/envs.c: Use `scm_hash_get_handle ()' instead of `scm_sym2ovcell_soft ()' and `scm_hash_create_handle_x ()' instead of `scm_intern_symbol ()'. * src/objcodes.c (bytecode->objcode): Don't use `SCM_VALIDATE_INUM', use `SCM_VALIDATE_NUMBER' instead. (make_objcode_by_mmap): Check whether the file is smaller than the magic cookies; check whether the magic cookies are there. * src/frames.c (frame-local-ref): Likewise, but use `SCM_MAKE_VALIDATE'. (frame-local-set!): Likewise. * src/instructions.c (opcode->instruction): Likewise. * src/programs.c (program-external-set!): New function. * src/guile-disasm.in: New file. * src/Makefile.am: Produce `guile-disasm'. * doc/guile-vm.texi: Documented `external-ref', `external-set', `local-ref' and `local-set'. * module/system/vm/disasm.scm (disassemble-bytecode): Fixed the way `load-program' is represented. git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-1 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Playing with the procedure call mechanism. * src/objcodes.c (do-pair): New experiment. * src/vm_engine.h (ALIGN_AS_NON_IMMEDIATE): New macro. (POP_LIST_ON_STACK): New experimental macro. * src/vm_engine.c (call): In the procedure call case, I tried using the above macro. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-8 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Fixed a stack leak. Now observing actual performance. * src/*.[ch]: Replaced `scm_mem2symbol' by `scm_from_locale_symboln' and `scm_ulong2num' by `scm_from_ulong'. * src/vm_system.c (tail-call): Fixed stack leak (SP lacked decrement by one more Scheme object in the tail-recursive case). * benchmark/measure.scm (measure): Make sure we are using the compiled procedure (i.e. a program object) when measuring. This yields better results than before. :-) * doc/guile-vm.texi: Augmented the instruction set documentation with branch instructions, `call' and `tail-call'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-7 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Improved the VM's efficiency. The VM is as fast as the interpreter. :-( * benchmark/lib.scm: New file. * benchmark/measure.scm: New file. * README: Added useful pointers to various threads. * doc/guile-vm.texi: Fixed the description of `load-program' (it now expects _immediate_ integers). * src/*.[ch]: Use immediate integers whereever possible, as in the original code. For `CONS', use `scm_cell' rather than `scm_cons'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-6 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Got the VM up and running! Augmented the documentation. * src/*.[ch]: Replaced the remaining `SCM_MAKINUM', and changed `SCM_VELTS' into `scm_vector_elements ()'. * src/vm_loader.c (link): Fixed so that it pushed a variable object on the stack. * src/vm_system.c (variable-ref): Fixed so that it uses `scm_variable_ref ()' and friends. * module/system/vm/assemble.scm (dump-object!): Fixed the string case. * src/vm_engine.h (CONS): Use `scm_cons' instead of `SCM_NEWCELL'. * doc/guile-vm.texi: Added actual instruction definitions, explanations of the program invocation mechanism, programs' object tables, etc., in the `Instruction Set' chapter. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-5 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Fixed the compiler, got the disassembler working. * doc/guile-vm.texi: Texified and cleaned up. * src/vm.c: Use `scm_from_locale_string ()' instead of `scm_makfrom0str ()'. * src/vm_engine.c: Likewise. * src/programs.c (scm_program_bytecode): Return a u8vector instead of a string. * module/system/vm/conv.scm (make-byte-decoder): Fixed a few things wrt. to the string to u8vector transition. * src/objcodes.c (bytecode->objcode): Fixed a bug where the last 10 bytes of the bytecode where ignored. * module/system/vm/assemble.scm (dump-object!): Don't convert everything to a u8vector, keep strings where it makes sense. * module/system/vm/conv.scm (code->bytes): Accordingly, convert strings to u8vectors when needed. (make-byte-decoder): Accordingly too, when decoding instructions, return variable-length instructions' argument as strings except for `load-program'. * module/system/vm/disasm.scm: Export `disassemble-bytecode'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-4 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Updated the assembly process so that `u8vectors' are used. Compilation works. * module/system/vm/conv.scm (encode-length): Use u8vectors. (code->bytes): Likewise. * module/system/vm/assemble.scm (codegen): Use u8vectors instead of strings. * src/objcodes.c (objcode->string): Removed. (objcode->u8vector): New function. * module/system/base/compile.scm (compile-file): Use `objcode->u8vector' and `uniform-vector-write'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-3 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Translation from Scheme to GHIL, and compilation to GLIL work. * src/*.c: Removed calls to `scm_must_malloc', `SCM_MUST_MALLOC' and `scm_must_free'. Same for `SCM_INUMP', `SCM_INUM', `SCM_STRING_CHARS', and the likes. * module/system/base/syntax.scm: Do not import `(ice-9 match)' and do not re-export `match', do not export `syntax-error' which was not defined here. * module/system/base/compile.scm (call-with-compile-error-catch): Use the `catch' form instead of `try'. * src/instructions.c: Use `scm_from_char ()' instead of the deprecated macro `SCM_MAKINUM ()'. * src/instructions.h (scm_instruction): Made `npop' a signed char. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-2 2008-04-25 Ludovic Court`es <ludovic.courtes@laas.fr> Updated the C code base so that it compiles with Guile 1.7.2. * src/*.[ch]: Introduced changes so that it compiles with Guile 1.7.2. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-1 2001-05-02 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** 2001-04-25 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-23 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-22 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-20 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-19 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-16 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-15 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-14 Keisuke Nishida <kxn30@po.cwru.edu> SLIB init file for Guile. Import SLIB 2d1. 2001-04-13 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** 2001-04-12 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-11 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-10 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** 2001-04-09 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-08 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** apply *** empty log message *** 2001-04-07 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-06 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-05 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** *** empty log message *** 2001-04-04 Keisuke Nishida <kxn30@po.cwru.edu> Quick documentation. Don't use module.scm. *** empty log message *** Better current module system support. Don't load modules explicitly at initialization. Current module support hack. Current module support hack. 2001-04-03 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** 2001-04-01 Keisuke Nishida <kxn30@po.cwru.edu> New files. *** empty log message *** New VM. *** empty log message *** 2000-10-06 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** Use `values\' and `call-with-values\'. 2000-09-29 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** Create *.i from *.c and include them. 2000-09-28 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** Indirect threaded. Performance is the same as before. Wow\! 2000-09-22 Keisuke Nishida <kxn30@po.cwru.edu> ChangeLog * src/vm.c: SCM_CHARS -> SCM_SYMBOL_CHARS. *** empty log message *** * src/vm_system.c (call): Call return-hook before reinstating a continuation. (tail_call): Call return-hook before a proper tail call. 2000-09-20 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** * src/vm_system.c (br_if_not_null): Set ac = SCM_BOOL_F if not null. *** empty log message *** * src/vm_number.c (FUNC2): New macro. (add2, sub2): Use FUNC2. (remainder): New instruction. * vm/bytecomp.scm (translate-ref): Combined translate-local-ref, translate-external-ref, and translate-top-level-ref. (translate-set): Combined translate-local-set, translate-external-set, and translate-top-level-ref. Set a name to the object. (translate-and, translate-or): Bug fixed. * vm/shell.scm (vm-frame->call): Updated. * src/vm_system.c (name): New instruction. (savet): Don't set name. * src/vm.c (scm_name_property): New variable. (scm_name, scm_set_name_x): New procedures. (scm_smob_print_with_name, init_name_property): New functions. (print_program, scm_program_name): Removed. (init_program_type, init_vm_type): Use scm_smob_print_with_name. (scm_init_vm): Call init_name_property. *** empty log message *** * src/vm_scheme.c (cons): Bug fixed. * src/vm_system.c (br_if_null): Set ac = SCM_BOOL_T if null. 2000-09-11 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** * autogen.sh: Run aclocal with check where guile.m4 is installed. *** empty log message *** * src/vm_system.c (push_list): New instruction. * src/vm_engine.c (VM_NAME): Don\'t validate VM and PROGRAM. * src/vm.c (scm_vm_apply): New procedure. (apply_program): New function. (init_program_type): Set the apply function for the program type. * src/vm.c (lookup_variable): Use scm_eval_closure_lookup. 2000-09-04 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** * src/vm_system.c (tail_call): Use SCM_TICK at the beginning. 2000-09-02 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** * src/vm_engine.c (VM_NAME): Renamed the variable `an\' to `nargs\'. Removed the variables `a2\' and `a3\'. * src/vm_engine.h (VM_SETUP_ARGS2, VM_SETUP_ARGS3): Setup local variables. (VM_SETUP_ARGS4): Removed. * src/vm_system.c, src/vm_scheme.c, src/vm_number.c: Updated. 2000-08-25 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** * src/vm.c (lookup_variable): New function. (scm_make_bytecode): Call lookup_variable for top-level variables. * src/vm_engine.h (VM_VARIABLE_REF, VM_VARIABLE_SET): New macros. * src/vm_system.c (TOPLEVEL_VAR, TOPLEVEL_VAR_SET): Removed. Use VM_VARIABLE_REF and VM_VARIABLE_SET instead. 2000-08-22 Keisuke Nishida <kxn30@po.cwru.edu> *** empty log message *** Use frame-external-link. Create external frames dynamically. (compile-file): Output "(use-modules (vm vm))". (make-code): Check argument types. (make-code:and, make-code:or): Pass env to make-code. (translate-and, translate-or): Don't branch on the last expression. types.scm (env-variable-address): Reverted the last change. Add guile-compile. Initial import. Initial revision