Rob Browning [Sat, 23 Apr 2011 19:57:50 +0000 (14:57 -0500)]
Define _GNU_SOURCE to fix the GNU/kFreeBSD build.
Author: Petr Salinger <Petr.Salinger@seznam.cz>
Closes: #401168
Rob Browning [Sat, 23 Apr 2011 19:57:49 +0000 (14:57 -0500)]
Fix the SRFI 60 copy-bit documentation.
Andy Wingo [Mon, 9 Jan 2012 14:38:51 +0000 (15:38 +0100)]
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.
Mark H Weaver [Mon, 9 Jan 2012 01:02:09 +0000 (20:02 -0500)]
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.
Andy Wingo [Sun, 8 Jan 2012 16:55:01 +0000 (17:55 +0100)]
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.
Andy Wingo [Sun, 8 Jan 2012 15:37:22 +0000 (16:37 +0100)]
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.
Ludovic Courtès [Sun, 8 Jan 2012 15:08:45 +0000 (16:08 +0100)]
Fix typo in `test-num2integral.c'.
* test-suite/standalone/test-num2integral.c (out_of_range_handler): Use
`scm_is_eq' when comparing KEY.
Ludovic Courtès [Sun, 8 Jan 2012 15:06:35 +0000 (16:06 +0100)]
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.
Andy Wingo [Sun, 8 Jan 2012 15:01:28 +0000 (16:01 +0100)]
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.
Andy Wingo [Sun, 8 Jan 2012 13:36:17 +0000 (14:36 +0100)]
syntax parameters doc formatting
* doc/ref/api-macros.texi (Syntax Parameters): Some copy-editing on
Ian's lovely syntax-parameters documentation.
Andy Wingo [Sun, 8 Jan 2012 13:27:03 +0000 (14:27 +0100)]
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.
Ian Price [Sat, 7 Jan 2012 01:59:33 +0000 (01:59 +0000)]
document syntax parameters
* doc/ref/api-macros.texi (Macros): Add subsection for "Syntax Parameters"
Mark H Weaver [Wed, 4 Jan 2012 22:59:27 +0000 (17:59 -0500)]
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.
Mark H Weaver [Fri, 6 Jan 2012 23:39:04 +0000 (18:39 -0500)]
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.
Andy Wingo [Sat, 7 Jan 2012 01:07:09 +0000 (02:07 +0100)]
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!
Ian Price [Thu, 29 Sep 2011 02:12:00 +0000 (03:12 +0100)]
`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.
Andy Wingo [Sat, 7 Jan 2012 00:26:00 +0000 (01:26 +0100)]
remove duplicate write-uri definition
* module/web/http.scm: Remove duplicate write-uri definition.
Andy Wingo [Fri, 6 Jan 2012 23:45:44 +0000 (00:45 +0100)]
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.
Andy Wingo [Sat, 5 Nov 2011 12:53:33 +0000 (13:53 +0100)]
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.
Andy Wingo [Sat, 5 Nov 2011 11:40:58 +0000 (12:40 +0100)]
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
Ludovic Courtès [Thu, 5 Jan 2012 22:49:01 +0000 (23:49 +0100)]
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'.
Ludovic Courtès [Thu, 5 Jan 2012 22:38:10 +0000 (23:38 +0100)]
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
Ludovic Courtès [Thu, 5 Jan 2012 22:10:02 +0000 (23:10 +0100)]
Regenerate `psyntax-pp.scm'.
* module/ice-9/psyntax-pp.scm: Regenerate.
Ludovic Courtès [Thu, 5 Jan 2012 21:51:07 +0000 (22:51 +0100)]
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>.
Ludovic Courtès [Thu, 5 Jan 2012 21:38:06 +0000 (22:38 +0100)]
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.
Mark H Weaver [Wed, 4 Jan 2012 18:43:47 +0000 (13:43 -0500)]
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.
Mike Gran [Wed, 4 Jan 2012 16:02:05 +0000 (08:02 -0800)]
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
Ludovic Courtès [Tue, 3 Jan 2012 22:31:30 +0000 (23:31 +0100)]
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.
Mark H Weaver [Sat, 31 Dec 2011 04:26:32 +0000 (23:26 -0500)]
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.
Mark H Weaver [Sat, 31 Dec 2011 04:11:30 +0000 (23:11 -0500)]
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.
Mark H Weaver [Sat, 31 Dec 2011 04:07:15 +0000 (23:07 -0500)]
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
Daniel Llorens [Thu, 22 Dec 2011 22:13:07 +0000 (17:13 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 22:03:04 +0000 (17:03 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 15:30:45 +0000 (10:30 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 15:28:23 +0000 (10:28 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 14:54:24 +0000 (09:54 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 14:32:09 +0000 (09:32 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 13:18:05 +0000 (08:18 -0500)]
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.
Daniel Hartwig [Sun, 27 Nov 2011 14:37:24 +0000 (22:37 +0800)]
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.
Andy Wingo [Thu, 22 Dec 2011 03:04:18 +0000 (22:04 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 01:15:57 +0000 (20:15 -0500)]
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.
Andy Wingo [Thu, 22 Dec 2011 01:10:42 +0000 (20:10 -0500)]
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.
Ludovic Courtès [Mon, 19 Dec 2011 21:25:30 +0000 (22:25 +0100)]
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.
Andy Wingo [Mon, 19 Dec 2011 14:55:07 +0000 (15:55 +0100)]
fix scm_protects deprecation warning
* libguile/gc.c: Fix warning about scm_protects being deprecated.
Andy Wingo [Mon, 19 Dec 2011 14:51:54 +0000 (15:51 +0100)]
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).
Ludovic Courtès [Mon, 19 Dec 2011 08:18:42 +0000 (09:18 +0100)]
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.
Ludovic Courtès [Mon, 19 Dec 2011 08:11:43 +0000 (09:11 +0100)]
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.
Christian Persch [Thu, 24 Nov 2011 22:10:21 +0000 (23:10 +0100)]
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.
Andreas Schwab [Sat, 3 Dec 2011 11:17:46 +0000 (12:17 +0100)]
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.
Ludovic Courtès [Sun, 18 Dec 2011 20:27:56 +0000 (21:27 +0100)]
doc: Add link from `opendir' to (ice-9 ftw).
* doc/ref/posix.texi (File System): Add link to "File Tree Walk".
Ludovic Courtès [Sun, 18 Dec 2011 20:25:24 +0000 (21:25 +0100)]
doc: Use `@deffn {Scheme Procedure}' in `misc-modules.texi'.
* doc/ref/misc-modules.texi: Use `@deffn {Scheme Procedure}' instead of
`@defun'.
Ludovic Courtès [Sun, 18 Dec 2011 20:14:33 +0000 (21:14 +0100)]
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'.
Ludovic Courtès [Thu, 15 Dec 2011 22:32:24 +0000 (23:32 +0100)]
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.
Ludovic Courtès [Thu, 15 Dec 2011 00:23:23 +0000 (01:23 +0100)]
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.
Ludovic Courtès [Thu, 15 Dec 2011 00:31:16 +0000 (01:31 +0100)]
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.
Ludovic Courtès [Wed, 14 Dec 2011 22:33:24 +0000 (23:33 +0100)]
Augment `.gitignore'.
Ludovic Courtès [Wed, 14 Dec 2011 22:02:29 +0000 (23:02 +0100)]
Update Gnulib to
v0.0-6703-g4e0358a.
Ludovic Courtès [Wed, 14 Dec 2011 22:44:30 +0000 (23:44 +0100)]
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.
Ludovic Courtès [Wed, 14 Dec 2011 21:26:15 +0000 (22:26 +0100)]
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.
Ludovic Courtès [Tue, 13 Dec 2011 22:54:26 +0000 (23:54 +0100)]
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'.
Andy Wingo [Mon, 12 Dec 2011 22:42:04 +0000 (23:42 +0100)]
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.
Andy Wingo [Sat, 10 Dec 2011 19:04:27 +0000 (20:04 +0100)]
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.
Chris K. Jester-Young [Thu, 8 Dec 2011 20:13:30 +0000 (21:13 +0100)]
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.
Ludovic Courtès [Tue, 6 Dec 2011 20:43:12 +0000 (21:43 +0100)]
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.
Ludovic Courtès [Tue, 6 Dec 2011 20:36:49 +0000 (21:36 +0100)]
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.
Andy Wingo [Tue, 6 Dec 2011 10:47:41 +0000 (11:47 +0100)]
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.
Andy Wingo [Tue, 6 Dec 2011 10:46:58 +0000 (11:46 +0100)]
Update a comment in (web client)
* module/web/client.scm: Update a comment.
Andy Wingo [Mon, 5 Dec 2011 14:43:18 +0000 (15:43 +0100)]
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.
Andy Wingo [Tue, 28 Jun 2011 21:24:43 +0000 (23:24 +0200)]
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.
Andy Wingo [Mon, 5 Dec 2011 15:37:17 +0000 (16:37 +0100)]
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.
Andy Wingo [Mon, 5 Dec 2011 13:20:09 +0000 (14:20 +0100)]
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.
Andy Wingo [Sun, 4 Dec 2011 21:45:03 +0000 (22:45 +0100)]
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.
Andy Wingo [Sun, 4 Dec 2011 21:37:27 +0000 (22:37 +0100)]
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.
Andy Wingo [Sun, 4 Dec 2011 20:56:13 +0000 (21:56 +0100)]
,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*.
Andy Wingo [Fri, 2 Dec 2011 18:18:05 +0000 (19:18 +0100)]
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.
Andy Wingo [Fri, 2 Dec 2011 18:07:21 +0000 (19:07 +0100)]
scm_gc_register_collectable_memory calls scm_gc_register_allocation
* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Call
scm_gc_register_allocation.
Andy Wingo [Fri, 2 Dec 2011 10:22:46 +0000 (11:22 +0100)]
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>.
Andy Wingo [Thu, 1 Dec 2011 11:57:49 +0000 (12:57 +0100)]
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.
Andy Wingo [Tue, 29 Nov 2011 20:36:31 +0000 (21:36 +0100)]
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.
Andy Wingo [Tue, 29 Nov 2011 19:26:40 +0000 (20:26 +0100)]
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.
Andy Wingo [Tue, 29 Nov 2011 19:24:23 +0000 (20:24 +0100)]
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.
Andy Wingo [Tue, 29 Nov 2011 12:43:52 +0000 (13:43 +0100)]
fix uninitialized variable in gc.c
* libguile/gc.c (get_image_size): Fix use of uninitialized variable.
Andy Wingo [Tue, 29 Nov 2011 09:17:07 +0000 (10:17 +0100)]
switch off debugging flag that was mistakenly left on
* libguile/gc.c (HEURISTICS_DEBUG): Whoops, switch this off.
Andy Wingo [Mon, 28 Nov 2011 23:48:56 +0000 (00:48 +0100)]
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.
Andy Wingo [Mon, 28 Nov 2011 18:58:53 +0000 (19:58 +0100)]
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.
Ludovic Courtès [Sat, 26 Nov 2011 21:27:32 +0000 (22:27 +0100)]
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.
Daniel Hartwig [Wed, 23 Nov 2011 19:56:30 +0000 (20:56 +0100)]
web-http.test validates headers
* test-suite/tests/web-http.test (pass-if-parse): Validate header values
as well.
Daniel Hartwig [Wed, 23 Nov 2011 19:56:10 +0000 (20:56 +0100)]
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.
Ludovic Courtès [Wed, 23 Nov 2011 21:19:40 +0000 (22:19 +0100)]
Update cross-compilation instructions.
* README (Cross building Guile): Update.
Ludovic Courtès [Wed, 23 Nov 2011 21:05:53 +0000 (22:05 +0100)]
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'.
Ludovic Courtès [Wed, 23 Nov 2011 14:29:18 +0000 (15:29 +0100)]
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.
Andy Wingo [Wed, 23 Nov 2011 11:40:33 +0000 (12:40 +0100)]
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.
Andy Wingo [Wed, 23 Nov 2011 11:21:22 +0000 (12:21 +0100)]
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.
Andy Wingo [Wed, 23 Nov 2011 11:13:12 +0000 (12:13 +0100)]
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.
Ludovic Courtès [Tue, 22 Nov 2011 09:09:27 +0000 (10:09 +0100)]
Leave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling.
* meta/uninstalled-env.in: Don't define $GUILE_LOAD_COMPILED_PATH when
cross-compiling.
Ludovic Courtès [Tue, 22 Nov 2011 08:07:25 +0000 (09:07 +0100)]
Build `psyntax-pp.go' with `--target=$(host)'.
* module/Makefile.am (ice-9/psyntax-pp.go): Pass `--target=$(host)'.
Ludovic Courtès [Mon, 21 Nov 2011 23:21:39 +0000 (00:21 +0100)]
Run `guild compile' with `--target=$(host)'.
* am/guilec (.scm.go): Run `guild compile' with `--target=$(host)'.
Ludovic Courtès [Mon, 21 Nov 2011 23:19:03 +0000 (00:19 +0100)]
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.
Ludovic Courtès [Mon, 21 Nov 2011 23:09:22 +0000 (00:09 +0100)]
Add missing implicit `SCM_API' for `scm_c_make_objcode_slice'.
* libguile/objcodes.h (scm_c_make_objcode_slice): Add implicit `SCM_API'.
Ludovic Courtès [Mon, 21 Nov 2011 21:08:22 +0000 (22:08 +0100)]
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.