bpt/guile.git
13 years agofix-letrec tweaks
Andy Wingo [Wed, 9 Mar 2011 21:37:53 +0000 (22:37 +0100)]
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.

13 years agoDon't mix definitions and expressions in SRFI-9
Andreas Rottmann [Wed, 9 Mar 2011 20:36:54 +0000 (21:36 +0100)]
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.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoAdd scm_from_latin1_keyword and scm_from_utf8_keyword
Mark H Weaver [Wed, 9 Mar 2011 06:14:43 +0000 (01:14 -0500)]
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'.

13 years agoImprove docs of string and symbol conversions from C strings
Mark H Weaver [Tue, 8 Mar 2011 18:13:54 +0000 (13:13 -0500)]
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.

13 years agoWithin `while', `continue' takes zero arguments
Mark H Weaver [Fri, 4 Mar 2011 18:44:02 +0000 (13:44 -0500)]
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 ...))'.

13 years agoQuotient, remainder and modulo accept inexact integers
Mark H Weaver [Mon, 7 Mar 2011 01:27:40 +0000 (20:27 -0500)]
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.

13 years agoRemove incorrect footnote from GOOPS manual
Mark H Weaver [Tue, 1 Mar 2011 18:46:08 +0000 (13:46 -0500)]
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.

13 years agoUpdate comments regarding GMP earlier than 4.2.
Mark H Weaver [Wed, 23 Feb 2011 02:39:37 +0000 (21:39 -0500)]
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.

13 years agoFix description of the R6RS `finite?' in manual
Mark H Weaver [Tue, 1 Mar 2011 17:37:01 +0000 (12:37 -0500)]
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?'.

13 years agoFix bytevectors VALIDATE_REAL to test for reals, not rationals
Mark H Weaver [Tue, 1 Mar 2011 17:46:38 +0000 (12:46 -0500)]
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.

13 years agoscm_public_ref et al docs
Andy Wingo [Tue, 8 Mar 2011 21:34:53 +0000 (22:34 +0100)]
scm_public_ref et al docs

* doc/ref/api-modules.texi (Accessing Modules from C): Add docs for the
  new C procedures.

13 years agoeval-string docs
Andy Wingo [Tue, 8 Mar 2011 20:53:02 +0000 (21:53 +0100)]
eval-string docs

* doc/ref/api-evaluation.texi (Fly Evaluation): Update eval-string
  documentation.

13 years agodocument scm_call_{5,6,n}
Andy Wingo [Tue, 8 Mar 2011 20:06:12 +0000 (21:06 +0100)]
document scm_call_{5,6,n}

* doc/ref/api-evaluation.texi (Fly Evaluation): Document
  scm_call_{5,6,n}.

13 years agoadd scm_call_{5,6}
Andy Wingo [Tue, 8 Mar 2011 19:57:41 +0000 (20:57 +0100)]
add scm_call_{5,6}

* libguile/eval.h:
* libguile/eval.c (scm_call_5, scm_call_6): New scm_call functions; why
  not.

13 years agofix scm_setter
Andy Wingo [Tue, 8 Mar 2011 08:30:33 +0000 (09:30 +0100)]
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.

13 years agocore eval-string uses (ice-9 eval-string)
Andy Wingo [Tue, 8 Mar 2011 08:29:24 +0000 (09:29 +0100)]
core eval-string uses (ice-9 eval-string)

* libguile/strports.c (scm_eval_string_in_module): Use eval-string from
  (ice-9 eval-string).

13 years agoadd scm_c_public_ref et al
Andy Wingo [Tue, 8 Mar 2011 08:27:23 +0000 (09:27 +0100)]
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.

13 years agoHandle `letrec*' like `letrec' in simple cases.
Ludovic Courtès [Sun, 6 Mar 2011 22:02:57 +0000 (23:02 +0100)]
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))'.

13 years agoHave `gc-profile.scm' make sure it's on a Linux-based system.
Ludovic Courtès [Sun, 6 Mar 2011 21:27:53 +0000 (22:27 +0100)]
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-".

13 years agoAdd `gc-benchmarks/' to the distribution.
Ludovic Courtès [Sun, 6 Mar 2011 21:26:49 +0000 (22:26 +0100)]
Add `gc-benchmarks/' to the distribution.

* gc-benchmarks/Makefile.am: New file.

* configure.ac: Produce it.

* Makefile.am (SUBDIRS): Add `gc-benchmarks'.

13 years agoMake `object->string' explicitly close its string output port.
Ludovic Courtès [Sun, 6 Mar 2011 21:13:10 +0000 (22:13 +0100)]
Make `object->string' explicitly close its string output port.

* libguile/strports.c (scm_object_to_string): Close PORT before
  returning the resulting string.

13 years agoSlightly optimize `gensym'.
Ludovic Courtès [Sun, 6 Mar 2011 20:47:48 +0000 (21:47 +0100)]
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.

13 years agoSimply grow string port buffers geometrically.
Ludovic Courtès [Sun, 6 Mar 2011 13:31:28 +0000 (14:31 +0100)]
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.

13 years agoLet `scm_mkstrport' allocate buffers on the caller's behalf.
Ludovic Courtès [Sun, 6 Mar 2011 10:42:37 +0000 (11:42 +0100)]
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.

13 years agoUse a bytevector as the backing buffer of string ports.
Ludovic Courtès [Sat, 5 Mar 2011 19:15:09 +0000 (20:15 +0100)]
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.

13 years agoadd ice-9 eval-string
Andy Wingo [Sat, 5 Mar 2011 22:16:11 +0000 (23:16 +0100)]
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.

13 years agoremove obsolete comments
Andy Wingo [Sat, 5 Mar 2011 20:48:47 +0000 (21:48 +0100)]
remove obsolete comments

* libguile/eval.c (scm_nconc2last):
* libguile/strports.c (scm_c_read_string): Remove some obsolete
  comments.

13 years agoUpdated Guile manual page.
Mark Harig [Sat, 5 Mar 2011 00:36:28 +0000 (19:36 -0500)]
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.

13 years agoguile-snarf: allow multiple init actions on one line
BT Templeton [Tue, 22 Feb 2011 18:15:31 +0000 (13:15 -0500)]
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.

13 years agoadd guile-snarf tests
BT Templeton [Tue, 22 Feb 2011 20:15:33 +0000 (15:15 -0500)]
add guile-snarf tests

* test-suite/standalone/test-guile-snarf: New file.
* test-suite/standalone/Makefile.am: Add `test-guile-snarf'.

13 years agorepl: terminal-width by default
Andy Wingo [Fri, 4 Mar 2011 10:16:15 +0000 (11:16 +0100)]
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.

13 years agoAdd ,width meta-command to set screen width in debug output
Michael Gran [Mon, 21 Feb 2011 05:53:46 +0000 (21:53 -0800)]
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

13 years agofix ,stat
Andy Wingo [Fri, 4 Mar 2011 09:33:51 +0000 (10:33 +0100)]
fix ,stat

* module/system/repl/command.scm (statistics): Fix for BDW-GC.
  Unfortunately we still don't have mallocation or time taken.

13 years agorepl.scm understands comments
Andy Wingo [Thu, 3 Mar 2011 22:51:20 +0000 (23:51 +0100)]
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.

13 years agorepl.scm refactor
Andy Wingo [Thu, 3 Mar 2011 22:19:35 +0000 (23:19 +0100)]
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.

13 years agofix encoding scanning for non-seekable ports
Andy Wingo [Thu, 3 Mar 2011 11:46:49 +0000 (12:46 +0100)]
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.

13 years agomore module-use-interfaces! tweaks
Andy Wingo [Thu, 3 Mar 2011 10:29:27 +0000 (11:29 +0100)]
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.

13 years agoUse module identity to filter for existing modules
Andreas Rottmann [Thu, 3 Mar 2011 10:09:54 +0000 (11:09 +0100)]
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.

13 years agoRemove extra comma after `SCM_ARRAY_ELEMENT_TYPE_LAST'.
Ludovic Courtès [Wed, 2 Mar 2011 23:13:30 +0000 (00:13 +0100)]
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.

13 years agoImprove the documentation for `dynamic-link'.
Ludovic Courtès [Wed, 2 Mar 2011 21:12:56 +0000 (22:12 +0100)]
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.

13 years agoPortability fixes for popen.test (for when /bin/sh is not bash)
Mark H Weaver [Wed, 2 Mar 2011 11:02:58 +0000 (06:02 -0500)]
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.

13 years agoHave `read' update line/column numbers when reading SCSH block comments.
Ludovic Courtès [Mon, 28 Feb 2011 22:33:47 +0000 (23:33 +0100)]
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.

13 years agoupdate port-filename docs
Andy Wingo [Mon, 28 Feb 2011 19:53:40 +0000 (20:53 +0100)]
update port-filename docs

* doc/ref/api-io.texi (File Ports):
* libguile/ports.c (scm_port_filename): Fix docs to match
  implementation.

13 years agoLink stand-alone tests against libgc.
Ludovic Courtès [Sun, 27 Feb 2011 23:40:45 +0000 (00:40 +0100)]
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.

13 years agoStrip any CPPFLAGS other than `-I' from `guile-2.0.pc'.
Ludovic Courtès [Sun, 27 Feb 2011 23:21:48 +0000 (00:21 +0100)]
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>.

13 years agoflush all input on a read error
Andy Wingo [Sun, 27 Feb 2011 22:26:08 +0000 (23:26 +0100)]
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.

13 years agoscm-error-printer resilience
Andy Wingo [Sun, 27 Feb 2011 22:15:13 +0000 (23:15 +0100)]
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 ("?.*"))

13 years agoupdate R6RS incompatibilities
Andy Wingo [Sun, 27 Feb 2011 12:07:04 +0000 (13:07 +0100)]
update R6RS incompatibilities

* doc/ref/r6rs.texi (R6RS Incompatibilities): Update.

13 years agoregenerate psyntax-pp
Andy Wingo [Sun, 27 Feb 2011 11:59:44 +0000 (12:59 +0100)]
regenerate psyntax-pp

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

13 years agoadd syncase test
Andy Wingo [Sun, 27 Feb 2011 11:58:54 +0000 (12:58 +0100)]
add syncase test

* test-suite/tests/syncase.test ("top-level expansions"): New test.

13 years agochi-top-sequence defines macros before expanding other exps
Andy Wingo [Sun, 27 Feb 2011 11:48:23 +0000 (12:48 +0100)]
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.

13 years agopsyntax: fold chi-top-sequence into chi-top
Andy Wingo [Sun, 27 Feb 2011 11:07:48 +0000 (12:07 +0100)]
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.

13 years agoFix `gc-profile.scm'.
Ludovic Courtès [Fri, 25 Feb 2011 13:54:36 +0000 (14:54 +0100)]
Fix `gc-profile.scm'.

* gc-benchmarks/gc-profile.scm (memory-mappings)[mapping-line-rx]: Fix
  and give an example.
  (total-heap-size): Fix docstring.

13 years agomake-weak-key-hash-table vacuuming
Andy Wingo [Fri, 25 Feb 2011 09:48:35 +0000 (10:48 +0100)]
make-weak-key-hash-table vacuuming

* libguile/hashtab.c (scm_make_weak_key_hash_table): Whoops, fix the
  case I actually cared about.

13 years agoRevert ""latin1" -> "Latin-1"."
Ludovic Courtès [Thu, 24 Feb 2011 22:17:23 +0000 (23:17 +0100)]
Revert ""latin1" -> "Latin-1"."

This reverts commit c2c550ca9d2442d070f79ed8bacb8db173c72df3.

The name "latin1" is standardized by IANA, unlike the other one.
Reported by Bruno Haible.

13 years agoMake `locale-digit-grouping' more robust.
Ludovic Courtès [Thu, 24 Feb 2011 22:17:06 +0000 (23:17 +0100)]
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>.

13 years agoFix README.
Ludovic Courtès [Thu, 24 Feb 2011 22:13:54 +0000 (23:13 +0100)]
Fix README.

* README: Remove mention of an alpha release.  Reported by
  Mark H. Weaver.

13 years agoweak hash tables vacuum stale entries after a gc
Andy Wingo [Thu, 24 Feb 2011 16:00:30 +0000 (17:00 +0100)]
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.

13 years agore-enable the after-gc-hook
Andy Wingo [Thu, 24 Feb 2011 15:30:08 +0000 (16:30 +0100)]
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.

13 years agopointerless backing buffers for string ports
Andy Wingo [Thu, 24 Feb 2011 12:12:58 +0000 (13:12 +0100)]
pointerless backing buffers for string ports

* libguile/strports.c (scm_mkstrport): String port string buffer
  allocated atomically.

13 years agoerrno saving in display_string
Andy Wingo [Thu, 24 Feb 2011 12:10:16 +0000 (13:10 +0100)]
errno saving in display_string

* libguile/print.c (display_string): Fix a case in which perhaps `errno'
  could have been stompled.

13 years agoweb server more assiduous about closing ports
Andy Wingo [Thu, 24 Feb 2011 10:10:19 +0000 (11:10 +0100)]
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.

13 years agoopen-pipe* pumps pipes guardian
Andy Wingo [Wed, 23 Feb 2011 20:04:26 +0000 (21:04 +0100)]
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.

13 years agoGC dead links in weak hash tables before a possible rehash
Andy Wingo [Wed, 23 Feb 2011 10:59:38 +0000 (11:59 +0100)]
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))

13 years agoPortability fix for new log and log10
Mark H Weaver [Wed, 16 Feb 2011 00:29:41 +0000 (19:29 -0500)]
Portability fix for new log and log10

* libguile/numbers.c: Define M_LN2 if it's not already defined.
  Fix error in comment.

13 years agoFix a bug in `vhash-delete'.
Ludovic Courtès [Mon, 21 Feb 2011 23:32:00 +0000 (00:32 +0100)]
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.

13 years agoUse `vhash-delq' in `(language tree-il analyze)'.
Ludovic Courtès [Mon, 21 Feb 2011 23:31:00 +0000 (00:31 +0100)]
Use `vhash-delq' in `(language tree-il analyze)'.

* module/language/tree-il/analyze.scm (unbound-variable-analysis): Use
  `vhash-delq' instead of `vhash-delete'.

13 years agoOptimize `vhash-delete'.
Ludovic Courtès [Mon, 21 Feb 2011 23:08:39 +0000 (00:08 +0100)]
Optimize `vhash-delete'.

* module/ice-9/vlist.scm (vhash-delete): Check whether KEY is in VHASH
  and return VHASH if it's not.

13 years agoAdd omitted exports from `(ice-9 vlist)'.
Ludovic Courtès [Mon, 21 Feb 2011 23:07:48 +0000 (00:07 +0100)]
Add omitted exports from `(ice-9 vlist)'.

* module/ice-9/vlist.scm: Export `vhash-delq' and `vhash-delv'.

13 years agoCompile `(rnrs)' after all other RNRS modules, potentially.
Ludovic Courtès [Mon, 21 Feb 2011 23:05:05 +0000 (00:05 +0100)]
Compile `(rnrs)' after all other RNRS modules, potentially.

* module/Makefile.am (RNRS_SOURCES): Move `rnrs.scm' last.

13 years agoMake `(rnrs base)' independent of other rnrs modules.
Ludovic Courtès [Mon, 21 Feb 2011 23:32:13 +0000 (00:32 +0100)]
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.

13 years agoupdate examples in manual to use PKG_CHECK_MODULES
Andy Wingo [Sun, 20 Feb 2011 21:08:27 +0000 (22:08 +0100)]
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.

13 years agopkg-config instead of guile-config in manuals
Andy Wingo [Sun, 20 Feb 2011 20:43:19 +0000 (21:43 +0100)]
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.

13 years agotour.texi compilation fix
Andy Wingo [Sun, 20 Feb 2011 14:01:37 +0000 (15:01 +0100)]
tour.texi compilation fix

* doc/ref/tour.texi (Writing Guile Extensions): Fix compilation
  example.

13 years ago@value{EFFECTIVE-VERSION} instead of 2.0 in some places in the manual
Andy Wingo [Sun, 20 Feb 2011 12:15:34 +0000 (13:15 +0100)]
@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.

13 years agoguile.m4: Add support for linking against guile with rpath.
Bruno Haible [Sun, 20 Feb 2011 10:49:48 +0000 (11:49 +0100)]
guile.m4: Add support for linking against guile with rpath.

* guile.m4 (GUILE_FLAGS): Also set GUILE_LIBS and GUILE_LTLIBS. Fix
  documentation.

13 years agoFix typos in (web ...) doc
Neil Jerram [Fri, 21 Jan 2011 19:34:01 +0000 (19:34 +0000)]
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.

13 years agoLast (for a little while) GOOPs doc fix
Neil Jerram [Fri, 18 Feb 2011 23:10:54 +0000 (23:10 +0000)]
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.

13 years agoRemove unneeded fixme
Neil Jerram [Fri, 18 Feb 2011 22:53:57 +0000 (22:53 +0000)]
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.

13 years agoTidy up remaining bits of the MOP section
Neil Jerram [Fri, 18 Feb 2011 22:46:02 +0000 (22:46 +0000)]
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.

13 years agoClean up doc on class redefinition and instance class changing
Neil Jerram [Fri, 18 Feb 2011 22:15:11 +0000 (22:15 +0000)]
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.

13 years agoMerge orphan Class Options section into Class Definition
Neil Jerram [Fri, 18 Feb 2011 20:50:55 +0000 (20:50 +0000)]
Merge orphan Class Options section into Class Definition

* doc/ref/goops.texi (Class Definition): Move material from later
  `Class Options' section to here.

13 years agoDoc of MOP for instance and class creation
Neil Jerram [Fri, 18 Feb 2011 19:47:05 +0000 (19:47 +0000)]
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.

13 years agoSummarize class definition protocol
Neil Jerram [Thu, 17 Feb 2011 22:09:13 +0000 (22:09 +0000)]
Summarize class definition protocol

* doc/ref/goops.texi (Class Definition Protocol): Add tree summary
  diagram.

13 years agoWork on GOOPS MOP documentation
Neil Jerram [Thu, 17 Feb 2011 21:36:10 +0000 (21:36 +0000)]
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'.

13 years agoRewording for "make an intervention".
Neil Jerram [Wed, 16 Feb 2011 00:17:14 +0000 (00:17 +0000)]
Rewording for "make an intervention".

* doc/ref/compiler.texi (Extending the Compiler): Rephrase first sentence.

13 years agoNo sublimated desires
Neil Jerram [Tue, 15 Feb 2011 23:49:48 +0000 (23:49 +0000)]
No sublimated desires

* doc/ref/compiler.texi: Delete "subliminated".

13 years agofix a couple leaks in ports.c. thanks valgrind!
Andy Wingo [Fri, 18 Feb 2011 18:28:33 +0000 (19:28 +0100)]
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.

13 years agocore modules use (ice-9 binary-ports) instead of (rnrs io ports)
Andy Wingo [Fri, 18 Feb 2011 14:57:27 +0000 (15:57 +0100)]
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.

13 years agoadd (ice-9 binary-ports)
Andy Wingo [Fri, 18 Feb 2011 14:52:02 +0000 (15:52 +0100)]
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.

13 years agoupdate extension example in manual
Andy Wingo [Fri, 18 Feb 2011 08:38:04 +0000 (09:38 +0100)]
update extension example in manual

* doc/ref/libguile-extensions.texi (A Sample Guile Extension): Fix use
  of deprecated functions.

13 years agoChange tag naming convention to `vX.Y.Z'.
Ludovic Courtès [Wed, 16 Feb 2011 09:25:23 +0000 (10:25 +0100)]
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.

13 years agoImprovements to `log' and `log10'
Mark H Weaver [Tue, 15 Feb 2011 15:37:03 +0000 (10:37 -0500)]
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.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoFix comment above number-theoretic division tests
Mark H Weaver [Mon, 14 Feb 2011 23:18:52 +0000 (18:18 -0500)]
Fix comment above number-theoretic division tests

* test-suite/tests/numbers.test: Fix comment.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoSwitch to 2.0.0.
Ludovic Courtès [Tue, 15 Feb 2011 15:45:20 +0000 (16:45 +0100)]
Switch to 2.0.0.

* GUILE-VERSION (GUILE_MAJOR_VERSION, GUILE_MINOR_VERSION,
  GUILE_MINOR_VERSION): 2.0.0!

13 years agoIncrement `LIBGUILE_INTERFACE_CURRENT'.
Ludovic Courtès [Tue, 15 Feb 2011 15:44:00 +0000 (16:44 +0100)]
Increment `LIBGUILE_INTERFACE_CURRENT'.

* GUILE-VERSION (LIBGUILE_INTERFACE_CURRENT): Set to 22, i.e.,
  Guile 1.8.8 + 1.

13 years agoUpdate `doc/example-smob'.
Ludovic Courtès [Tue, 15 Feb 2011 15:40:27 +0000 (16:40 +0100)]
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'.

13 years agoUse trunc in scm_i_inexact_truncate_divide
Mark H Weaver [Tue, 15 Feb 2011 11:10:06 +0000 (06:10 -0500)]
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.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
13 years agoDocument `%auto-compilation-options'.
Ludovic Courtès [Tue, 15 Feb 2011 11:31:02 +0000 (12:31 +0100)]
Document `%auto-compilation-options'.

* doc/ref/api-evaluation.texi (Compilation): Emphasize
  auto-compilation.  Document `%auto-compilation-options'.

13 years agoFix compilation of `c-tokenize.c' in a cross-compile setup.
Ludovic Courtès [Tue, 15 Feb 2011 11:15:02 +0000 (12:15 +0100)]
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.