bpt/guile.git
13 years agoSwitch to 2.1.0.
Ludovic Courtès [Wed, 23 Feb 2011 10:05:54 +0000 (11:05 +0100)]
Switch to 2.1.0.

* GUILE-VERSION (GUILE_MAJOR_VERSION, GUILE_MINOR_VERSION,
  GUILE_MINOR_VERSION): Switch to 2.1.0.

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 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 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 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.

13 years agoUse all the LDFLAGS from Gnulib.
Ludovic Courtès [Tue, 15 Feb 2011 11:07:49 +0000 (12:07 +0100)]
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.

13 years agoRemove Gnulib's `sockets' module from the import list.
Ludovic Courtès [Tue, 15 Feb 2011 10:52:43 +0000 (11:52 +0100)]
Remove Gnulib's `sockets' module from the import list.

* m4/gnulib-cache.m4: Remove `sockets', which we don't directly depend
  on.

13 years agoImport Gnulib's `log1p' and `round' modules.
Ludovic Courtès [Tue, 15 Feb 2011 10:28:10 +0000 (11:28 +0100)]
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.

13 years agoremove 1.9 changes from NEWS (leaving only 2.0)
Andy Wingo [Tue, 15 Feb 2011 08:29:54 +0000 (09:29 +0100)]
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.

13 years agoUse trunc instead of scm_c_truncate
Mark H Weaver [Mon, 14 Feb 2011 22:10:03 +0000 (17:10 -0500)]
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.

13 years agoFix minor errors in docs of division operators
Mark H Weaver [Sun, 13 Feb 2011 21:28:34 +0000 (16:28 -0500)]
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'.

13 years agonews tweak
Andy Wingo [Mon, 14 Feb 2011 22:27:50 +0000 (23:27 +0100)]
news tweak

* NEWS: Tweak

13 years agoadd more NEWS
Andy Wingo [Mon, 14 Feb 2011 22:26:18 +0000 (23:26 +0100)]
add more NEWS

* NEWS: Add new NEWS and fold into main text.

13 years agofold new NEWS items into main text
Andy Wingo [Mon, 14 Feb 2011 22:03:11 +0000 (23:03 +0100)]
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.

13 years agoupdate THANKS
Andy Wingo [Mon, 14 Feb 2011 21:03:37 +0000 (22:03 +0100)]
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.

13 years agotweak to internal scm_i_extract_values_2
Andy Wingo [Mon, 14 Feb 2011 19:39:31 +0000 (20:39 +0100)]
tweak to internal scm_i_extract_values_2

* libguile/values.c (scm_i_extract_values_2): Make nvalues check more
  robust.

13 years agoAllow GOOPS getters to add methods to primitive generics
Mark H Weaver [Sat, 12 Feb 2011 10:43:17 +0000 (05:43 -0500)]
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.

13 years agoMake SCM_NUMP and SCM_NUMBERP more extensible
Mark H Weaver [Fri, 11 Feb 2011 00:04:05 +0000 (19:04 -0500)]
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.

13 years agoSlight optimization for scm_equal_p
Mark H Weaver [Fri, 11 Feb 2011 00:38:49 +0000 (19:38 -0500)]
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.

13 years agoReduce code size of division operators
Mark H Weaver [Sun, 13 Feb 2011 12:25:28 +0000 (07:25 -0500)]
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?'.

13 years agoOptimize truncate, round, floor, and ceiling
Mark H Weaver [Sun, 13 Feb 2011 12:14:57 +0000 (07:14 -0500)]
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.

13 years agoAdd four new sets of fast quotient and remainder operators
Mark H Weaver [Sun, 13 Feb 2011 14:16:27 +0000 (09:16 -0500)]
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.

13 years agoOptimize division operators handling of fractions
Mark H Weaver [Sun, 13 Feb 2011 11:04:52 +0000 (06:04 -0500)]
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.

13 years agoMake divide functions return values via (SCM *) output arguments
Mark H Weaver [Sun, 13 Feb 2011 10:47:33 +0000 (05:47 -0500)]
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.

13 years agoAdded internal C function to extract from values object
Mark H Weaver [Thu, 10 Feb 2011 23:03:14 +0000 (18:03 -0500)]
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.

13 years agoupdate thanks
Andy Wingo [Mon, 14 Feb 2011 19:23:43 +0000 (20:23 +0100)]
update thanks

* THANKS: Add Ian Price

13 years agoadd vector-move test cases
Andy Wingo [Mon, 14 Feb 2011 19:21:04 +0000 (20:21 +0100)]
add vector-move test cases

* test-suite/tests/vectors.test ("vector-move-left!")
  ("vector-move-right!"): Add test cases for recent bug.

13 years agofix fencepost error in vector-move-left! and -right!
Ian Price [Mon, 14 Feb 2011 03:44:31 +0000 (03:44 +0000)]
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.

13 years agoPass all the flags when building `gen-scmconfig' in a cross-compile setup.
Ludovic Courtès [Mon, 14 Feb 2011 12:48:08 +0000 (13:48 +0100)]
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.

13 years agoLeave the default `*current-warning-prefix*' at the REPL.
Ludovic Courtès [Mon, 14 Feb 2011 12:47:20 +0000 (13:47 +0100)]
Leave the default `*current-warning-prefix*' at the REPL.

* module/system/repl/common.scm (repl-compile): Leave the default
  `*current-warning-prefix*'.

13 years agoTemporarily fix `unistr.in.h' to allow compilation with `-Wundef'.
Ludovic Courtès [Tue, 7 Dec 2010 21:49:46 +0000 (22:49 +0100)]
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.

13 years agoUpdate Gnulib; add new modules.
Ludovic Courtès [Mon, 14 Feb 2011 10:36:25 +0000 (11:36 +0100)]
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>.

13 years agoThank Ralf
Neil Jerram [Mon, 14 Feb 2011 08:30:33 +0000 (08:30 +0000)]
Thank Ralf

* THANKS: Thank Ralf.

13 years agoTypo fix
Neil Jerram [Sun, 13 Feb 2011 22:34:12 +0000 (22:34 +0000)]
Typo fix

* doc/ref/api-modules.texi (R6RS Libraries): "libraries
  implementation" -> "library implementation".

13 years agoProcedure/macro index includes Autoconf macros
Neil Jerram [Sun, 13 Feb 2011 22:28:25 +0000 (22:28 +0000)]
Procedure/macro index includes Autoconf macros

* doc/ref/indices.texi (Procedure Index): Make explicit that the
  procedure/macro index includes Autoconf macros.

13 years agoMisc textual editing
Neil Jerram [Sun, 13 Feb 2011 22:13:33 +0000 (22:13 +0000)]
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.".

13 years agoAvoid uses of "resp. signed"
Neil Jerram [Sun, 13 Feb 2011 21:50:35 +0000 (21:50 +0000)]
Avoid uses of "resp. signed"

* doc/ref/api-data.texi (Bytevectors as Integers, Bytevectors and
  Integer Lists): Split signed and unsigned deffns.

13 years agoReword intro of `Accessing Arrays from C'
Neil Jerram [Sun, 13 Feb 2011 21:49:31 +0000 (21:49 +0000)]
Reword intro of `Accessing Arrays from C'

* doc/ref/api-compound.texi (Accessing Arrays from C): Reword to avoid
  awkward "rectangularily organized".

13 years agodocs: fix typos in manual, and a couple in code comments.
Ralf Wildenhues [Tue, 8 Feb 2011 20:20:57 +0000 (21:20 +0100)]
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.".

13 years agodocs: fix markup in api-options.texi.
Ralf Wildenhues [Tue, 8 Feb 2011 19:52:02 +0000 (20:52 +0100)]
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.

13 years agoSet sockaddr_in.sin_len field when it exists.
Noah Lavine [Sun, 13 Feb 2011 20:31:32 +0000 (15:31 -0500)]
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.

13 years agobump objcode version to 2.0; introduce minor-version compatibility
Andy Wingo [Sun, 13 Feb 2011 21:02:01 +0000 (22:02 +0100)]
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.

13 years agozero newly allocated sockaddrs
Noah Lavine [Sun, 13 Feb 2011 02:05:34 +0000 (21:05 -0500)]
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.

13 years agoAdd `%auto-compilation-options', used by `compile-file' when auto-compiling.
Ludovic Courtès [Sun, 13 Feb 2011 18:18:02 +0000 (19:18 +0100)]
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.

13 years agoAdd `*current-warning-prefix*'.
Ludovic Courtès [Sun, 13 Feb 2011 18:13:36 +0000 (19:13 +0100)]
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.

13 years agoprimitive-load defaults to utf-8, not latin-1
Andy Wingo [Sun, 13 Feb 2011 17:19:00 +0000 (18:19 +0100)]
primitive-load defaults to utf-8, not latin-1

* libguile/load.c (scm_primitive_load): Default to utf-8.

13 years agoHave `the-scm-module' be its own public interface (bug #30623).
Ludovic Courtès [Sun, 13 Feb 2011 14:36:52 +0000 (15:36 +0100)]
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.

13 years agoautocompile -> auto-compile
Andy Wingo [Sun, 13 Feb 2011 09:41:44 +0000 (10:41 +0100)]
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.

13 years ago`load' is a macro (!) that resolves paths relative to source file dir
Andy Wingo [Sat, 12 Feb 2011 22:50:56 +0000 (23:50 +0100)]
`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.

13 years agoread-enable 'positions by default
Andy Wingo [Sun, 13 Feb 2011 14:04:08 +0000 (15:04 +0100)]
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.

13 years agouse scm_c_make_struct in scm_values
Andy Wingo [Sat, 12 Feb 2011 21:19:28 +0000 (22:19 +0100)]
use scm_c_make_struct in scm_values

* libguile/values.c (scm_values): Micro-optimization.

13 years agoAdd `scm_t_subr' typedef (fix bug #23681).
Ludovic Courtès [Sun, 13 Feb 2011 13:50:05 +0000 (14:50 +0100)]
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.

13 years agoChange `scm_ramapc' prototype to avoid empty declarators (bug #23681).
Ludovic Courtès [Sun, 13 Feb 2011 13:47:33 +0000 (14:47 +0100)]
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.

13 years agoFix prototype of `scm_the_vm'.
Ludovic Courtès [Sun, 13 Feb 2011 13:45:47 +0000 (14:45 +0100)]
Fix prototype of `scm_the_vm'.

* libguile/vm.h (scm_the_vm): Use `(void)' instead of `()'.

13 years agofix syntax-error printing
Andy Wingo [Sat, 12 Feb 2011 15:38:02 +0000 (16:38 +0100)]
fix syntax-error printing

* module/ice-9/boot-9.scm: Fix to make "extra" a rest arg.

13 years agofix scm-error invocation on SIGINT in top-repl.scm
Andy Wingo [Sat, 12 Feb 2011 14:58:21 +0000 (15:58 +0100)]
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.

13 years agoFixes and improvements to number-theoretic division operators
Mark H Weaver [Thu, 10 Feb 2011 20:40:57 +0000 (15:40 -0500)]
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.

13 years agoAdd comment about handling of exactness specifiers
Mark H Weaver [Thu, 10 Feb 2011 19:35:02 +0000 (14:35 -0500)]
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.

13 years agoFix extensibility of 1-argument atan
Mark H Weaver [Thu, 10 Feb 2011 19:24:39 +0000 (14:24 -0500)]
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.

13 years agoFix mistake in comment in tags.h
Mark H Weaver [Thu, 10 Feb 2011 19:15:52 +0000 (14:15 -0500)]
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.

13 years agoBump copyright date in REPL version string
Mark H Weaver [Thu, 10 Feb 2011 19:12:12 +0000 (14:12 -0500)]
Bump copyright date in REPL version string

* module/system/repl/common.scm (*version*): Add 2011 to copyright
  date range.

13 years agoMake sure we don't override the user's extension search path.
Ludovic Courtès [Sat, 12 Feb 2011 11:25:18 +0000 (12:25 +0100)]
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'.

13 years agoSave config.cache before tests which are likely to fail.
Ralf Wildenhues [Sat, 12 Feb 2011 09:56:20 +0000 (10:56 +0100)]
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.

13 years agoinstall r6rs exception printer
Andreas Rottmann [Fri, 11 Feb 2011 15:07:14 +0000 (16:07 +0100)]
install r6rs exception printer

* module/rnrs/exceptions.scm: Install an exception printer for R6RS
  exceptions.

13 years agobetter narrowing in catch-all handlers in throw.c
Andy Wingo [Fri, 11 Feb 2011 14:30:25 +0000 (15:30 +0100)]
better narrowing in catch-all handlers in throw.c

* libguile/throw.c (handler_message): Narrow away the catch-closure and
  throw frames.

13 years agopre-boot lookup of print-exception works
Andy Wingo [Fri, 11 Feb 2011 14:21:58 +0000 (15:21 +0100)]
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.

13 years agoscm_handle_by_message uses scm_print_exception
Andy Wingo [Fri, 11 Feb 2011 14:16:25 +0000 (15:16 +0100)]
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.

13 years agoscm_display_error_message, display-error use print-exception
Andy Wingo [Fri, 11 Feb 2011 14:03:38 +0000 (15:03 +0100)]
scm_display_error_message, display-error use print-exception

* libguile/backtrace.c (scm_display_error_message)
  (scm_i_display_error): Use scm_print_exception.

13 years agoprint-exception gets a c binding
Andy Wingo [Fri, 11 Feb 2011 12:13:26 +0000 (13:13 +0100)]
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.

13 years agorepl.scm: use print-exception
Andy Wingo [Fri, 11 Feb 2011 11:53:02 +0000 (12:53 +0100)]
repl.scm: use print-exception

* module/system/repl/repl.scm: Remove custom exception printers in favor
  of print-exception.

13 years ago(system repl error-handling) uses print-exception
Andy Wingo [Fri, 11 Feb 2011 11:45:48 +0000 (12:45 +0100)]
(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.

13 years agoadd set-exception-printer!, print-exception to boot-9
Andy Wingo [Fri, 11 Feb 2011 11:44:33 +0000 (12:44 +0100)]
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.

13 years agoframe-source available in default environment
Andy Wingo [Fri, 11 Feb 2011 11:43:05 +0000 (12:43 +0100)]
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.

13 years agodeprecate primitive properties
Andy Wingo [Thu, 10 Feb 2011 22:07:03 +0000 (23:07 +0100)]
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.

13 years agoports.c safely accesses the port weak hash table
Andy Wingo [Thu, 10 Feb 2011 21:28:19 +0000 (22:28 +0100)]
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.

13 years agopre-deprecate scm_ptobs
Andy Wingo [Thu, 10 Feb 2011 20:56:46 +0000 (21:56 +0100)]
pre-deprecate scm_ptobs

* libguile/ports.h (scm_t_ptob_descriptor): Add comment about impending
  ptob deprecation.

13 years agofix potential concurrency bugs in port-for-each
Andy Wingo [Thu, 10 Feb 2011 20:40:25 +0000 (21:40 +0100)]
fix potential concurrency bugs in port-for-each

* libguile/ports.c (scm_c_port_for_each): Simplify to avoid concurrency-
  and gc-related bugs.

13 years agocomment on scm_pre_modules_obarray re threadsafety
Andy Wingo [Thu, 10 Feb 2011 20:19:33 +0000 (21:19 +0100)]
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.

13 years agoinstructions.c: threadsafe static var
Andy Wingo [Thu, 10 Feb 2011 20:11:47 +0000 (21:11 +0100)]
instructions.c: threadsafe static var

* libguile/instructions.c (fetch_instruction_table): Lock access to the
  static, lazily-generated table.

13 years agomake static hash table access thread-safe in foreign.c
Andy Wingo [Thu, 10 Feb 2011 20:06:55 +0000 (21:06 +0100)]
make static hash table access thread-safe in foreign.c

* libguile/foreign.c (register_weak_reference): Wrap static hash table
  access in a mutex.

13 years agofix potential deadlock in issue-deprecation-warning
Andy Wingo [Thu, 10 Feb 2011 20:06:14 +0000 (21:06 +0100)]
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.

13 years ago"latin1" -> "Latin-1".
Ludovic Courtès [Thu, 10 Feb 2011 21:56:37 +0000 (22:56 +0100)]
"latin1" -> "Latin-1".

Reported by Ralf Wildenhues.

* doc/ref/vm.texi (Loading Instructions): Use "Latin-1", not "latin1".

13 years agoAdd `scm_i_set_default_port_encoding' and `scm_i_default_port_encoding'.
Ludovic Courtès [Thu, 10 Feb 2011 21:50:51 +0000 (22:50 +0100)]
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'.

13 years agoSimplify `scm_i_set_port_encoding_x'.
Ludovic Courtès [Thu, 10 Feb 2011 21:27:37 +0000 (22:27 +0100)]
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.

13 years agoAdd `read-delimited' tests.
Ludovic Courtès [Thu, 10 Feb 2011 22:01:34 +0000 (23:01 +0100)]
Add `read-delimited' tests.

* test-suite/tests/rdelim.test ("read-delimited", "read-delimited!"):
  New test prefixes.

13 years agogetopt-long: arg parsing errors cause print and exit, not backtrace
Andy Wingo [Thu, 10 Feb 2011 11:09:18 +0000 (12:09 +0100)]
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.

13 years agogetopt-long cleanups
Andy Wingo [Thu, 10 Feb 2011 10:40:24 +0000 (11:40 +0100)]
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.

13 years agogetopt-long cleanup
Andy Wingo [Thu, 10 Feb 2011 10:31:30 +0000 (11:31 +0100)]
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.

13 years agogetopt-long cleanup
Andy Wingo [Thu, 10 Feb 2011 10:25:22 +0000 (11:25 +0100)]
getopt-long cleanup

* module/ice-9/getopt-long.scm (looks-like-an-option): Remove obtuse use
  of "some".

13 years agogetopt-long uses match:substring from (ice-9 regex)
Andy Wingo [Thu, 10 Feb 2011 10:22:17 +0000 (11:22 +0100)]
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.

13 years agomatch-lambda in getopt-long
Andy Wingo [Thu, 10 Feb 2011 10:19:02 +0000 (11:19 +0100)]
match-lambda in getopt-long

* module/ice-9/getopt-long.scm (parse-option-spec): Use match-lambda to
  parse the grammar.

13 years agogetopt-long uses srfi-9 records internally
Andy Wingo [Thu, 10 Feb 2011 10:04:31 +0000 (11:04 +0100)]
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.

13 years agovolatile locals in bootstrap evaluator
Andy Wingo [Thu, 10 Feb 2011 09:40:57 +0000 (10:40 +0100)]
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.

13 years agomore robust fallback error printer
Andy Wingo [Wed, 9 Feb 2011 22:34:36 +0000 (23:34 +0100)]
more robust fallback error printer

* libguile/throw.c (pre_init_throw): Deal with errors printing the
  exception.