bpt/guile.git
11 years agomore NEWS
Andy Wingo [Fri, 15 Mar 2013 21:21:34 +0000 (22:21 +0100)]
more NEWS

* NEWS: Update.

11 years agoincremental NEWS work
Andy Wingo [Fri, 15 Mar 2013 20:13:27 +0000 (21:13 +0100)]
incremental NEWS work

* NEWS: Checkpoint.

11 years agofix doc build
Andy Wingo [Fri, 15 Mar 2013 18:22:18 +0000 (19:22 +0100)]
fix doc build

* doc/ref/api-data.texi (Bitwise Operations): Don't use @-commands in
  @math.  Fixes doc build.
* doc/ref/api-macros.texi (Syntax Rules): Fix example result.

11 years agovery beginnings of NEWS
Andy Wingo [Wed, 13 Mar 2013 22:22:34 +0000 (23:22 +0100)]
very beginnings of NEWS

* NEWS: A very very very rough start at 2.0.8 news

11 years agoallow for spurious wakeups from pthread_cond_wait
Andy Wingo [Wed, 13 Mar 2013 10:01:38 +0000 (11:01 +0100)]
allow for spurious wakeups from pthread_cond_wait

* libguile/threads.c (scm_call_with_new_thread, scm_spawn_thread): Allow
  for spurious wakeups while waiting on cond variables.  Should fix bug
  10641.

11 years agofailing to load module in psyntax indicates an identifier is not macro
Andy Wingo [Tue, 12 Mar 2013 21:07:50 +0000 (22:07 +0100)]
failing to load module in psyntax indicates an identifier is not macro

* module/ice-9/boot-9.scm (false-if-exception): Add optional #:warning
  TEMPLATE ARG... tail, which indicates that we should print a warning
  on failure.
  (load-in-vicinity): Use the new #:warning.
  (make-autoload-interface): Surround the bits that load modules with a
  false-if-exception with #:warning.  Fixes
  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12202.

* test-suite/tests/syncase.test ("missing autoloads do not foil
  psyntax"): Add a test.

11 years agoReimplement 'inexact->exact' to avoid mpq functions.
Mark H Weaver [Mon, 4 Mar 2013 23:42:27 +0000 (18:42 -0500)]
Reimplement 'inexact->exact' to avoid mpq functions.

* libguile/numbers.c (scm_inexact_to_exact): Implement conversion of a
  double to an exact rational without using the mpq functions.

* test-suite/tests/numbers.test (dbl-mant-dig): Simplify initializer.
  (dbl-epsilon, dbl-min-exp): New variables.
  ("inexact->exact"): Add tests.  Fix broken "2.0**i to exact and back"
  test, and change it to "2.0**i to exact", to avoid use of
  'exact->inexact'.

11 years agoOptimize logarithms using scm_i_big2dbl_2exp
Mark H Weaver [Sun, 3 Mar 2013 10:02:53 +0000 (05:02 -0500)]
Optimize logarithms using scm_i_big2dbl_2exp

* libguile/numbers.c (log_of_exact_integer_with_size): Removed.

  (log_of_exact_integer): Handle bignums too large to fit in a double
  using 'scm_i_big2dbl_2exp' instead of 'scm_integer_length' and
  'scm_ash'.

  (log_of_fraction): Use 'log_of_exact_integer' instead of
  'log_of_exact_integer_with_size'.

11 years agoSimplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp
Mark H Weaver [Sun, 3 Mar 2013 09:58:55 +0000 (04:58 -0500)]
Simplify and improve scm_i_big2dbl, and add scm_i_big2dbl_2exp

* libguile/numbers.c (scm_i_big2dbl_2exp): New static function.
  (scm_i_big2dbl): Reimplement in terms of 'scm_i_big2dbl_2exp',
  with proper rounding.

* test-suite/tests/numbers.test ("exact->inexact"): Add tests.

11 years agoAdd 'round-ash', a rounding arithmetic shift operator
Mark H Weaver [Sun, 3 Mar 2013 09:35:09 +0000 (04:35 -0500)]
Add 'round-ash', a rounding arithmetic shift operator

* libguile/numbers.c (left_shift_exact_integer,
  floor_right_shift_exact_integer, round_right_shift_exact_integer): New
  static functions.

  (scm_round_ash): New procedure.

  (scm_ash): Reimplement in terms of 'left_shift_exact_integer' and
  'floor_right_shift_exact_integer'.

* libguile/numbers.h: Add prototype for scm_round_ash.  Rename the
  second argument of 'scm_ash' from 'cnt' to 'count'.

* test-suite/tests/numbers.test (round-ash, ash): Add new unified
  testing framework for 'ash' and 'round-ash'.  Previously, the tests
  for 'ash' were not very comprehensive; for example, they did not
  include a single test where the number to be shifted was a bignum.

* doc/ref/api-data.texi (Bitwise Operations): Add documentation for
  'round-ash'.  Improve documentation for `ash'.

11 years agoOptimize and simplify fractions code.
Mark H Weaver [Sun, 3 Mar 2013 09:34:50 +0000 (04:34 -0500)]
Optimize and simplify fractions code.

* libguile/numbers.c (scm_exact_integer_quotient,
  scm_i_make_ratio_already_reduced): New static functions.

  (scm_i_make_ratio): Rewrite in terms of
  'scm_i_make_ratio_already_reduced'.

  (scm_integer_expt): Optimize fraction case.

  (scm_abs, scm_magnitude, scm_difference, do_divide): Use
  'scm_i_make_ratio_already_reduced'.

* test-suite/tests/numbers.test (expt, integer-expt): Add tests.

11 years agoAdd standalone test for smob marking
Mike Gran [Mon, 11 Mar 2013 02:43:38 +0000 (19:43 -0700)]
Add standalone test for smob marking

* test-suite/standalone/Makefile.am (TESTS, check_PROGRAMS): add test-smob-mark
  (test_smob_mark_SOURCES, test_smob_mark_CFLAGS, test_smob_mark_LDADD): new variables
* test-suite/standalone/test-smob-mark.c: new file

11 years agorely on gnulib for `poll'
Jason Earl [Sun, 10 Mar 2013 22:44:23 +0000 (23:44 +0100)]
rely on gnulib for `poll'

* configure.ac:
* libguile/fports.c (fport_input_waiting):
* libguile/poll.c (scm_primitive_poll): Rely on gnulib to provide poll
  for us.

11 years agoimport `poll' from gnulib
Jason Earl [Sun, 10 Mar 2013 22:40:13 +0000 (23:40 +0100)]
import `poll' from gnulib

* lib/Makefile.am:
* lib/poll.c:
* lib/poll.in.h:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4:
* m4/poll.m4:
* m4/poll_h.m4: Add poll gnulib module.

11 years agoguile.m4 allows selection of guile 2.0, 1.8, etc.
Andy Wingo [Fri, 30 Mar 2012 18:04:16 +0000 (20:04 +0200)]
guile.m4 allows selection of guile 2.0, 1.8, etc.

* meta/guile.m4 (GUILE_PKG): New macro, chooses a version of Guile
  against which to compile.
  (GUILE_FLAGS, GUILE_PROGS): Rewrite to call GUILE_PKG as necessary, to
  respect any previous call to GUILE_PKG, and to not require
  guile-tools.

11 years agoadd %site-ccache-dir
Jason Earl [Sun, 10 Mar 2013 22:20:22 +0000 (23:20 +0100)]
add %site-ccache-dir

* libguile/load.h:
* libguile/load.c (scm_sys_site_ccache_dir): New procedure.

* doc/ref/scheme-using.texi (Installing Site Packages):
* doc/ref/api-options.texi (Build Config): Add docs.

Fixes bug 10326.

11 years agoexcise use of "iff" in the manual
Jason Earl [Sun, 10 Mar 2013 21:29:18 +0000 (22:29 +0100)]
excise use of "iff" in the manual

* doc/ref/api-compound.texi:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-smobs.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/api-utility.texi:
* doc/ref/compiler.texi:
* doc/ref/intro.texi:
* doc/ref/scheme-using.texi:
* doc/ref/sxml.texi:
* doc/ref/web.texi: Change uses of "iff" to "if, otherwise".  Fixes bug
  10302.

11 years agofix AC_CHECK_DECLS for `alarm'
Jason Earl [Sun, 10 Mar 2013 19:20:49 +0000 (20:20 +0100)]
fix AC_CHECK_DECLS for `alarm'

* configure.ac: Fix decl check for `alarm'.

11 years agouse chmod portably in (system base compile)
Jason Earl [Sun, 10 Mar 2013 19:12:05 +0000 (20:12 +0100)]
use chmod portably in (system base compile)

* module/system/base/compile.scm (call-with-output-file/atomic): Call
  chmod with the file name instead of the port.

11 years agofix response-body-port for responses without content-length
Jason Earl [Sun, 10 Mar 2013 18:23:31 +0000 (19:23 +0100)]
fix response-body-port for responses without content-length

* module/web/response.scm (response-body-port): Correctly handle cases
  in which EOF terminates the body.

11 years agoprovide getlogin declaration if needed.
Andy Wingo [Sat, 9 Mar 2013 22:55:01 +0000 (23:55 +0100)]
provide getlogin declaration if needed.

* configure.ac: Check for getlogin decl.
* libguile/posix.c: Declare getlogin if needed.

11 years agofix mingw issues with posix.c
Andy Wingo [Sat, 9 Mar 2013 22:12:51 +0000 (23:12 +0100)]
fix mingw issues with posix.c

* libguile/posix.c (scm_execl, scm_execlp, scm_execle)
  (scm_open_process): Remove casts for ancient mingw.
  (scm_utime): If we fall back to utime, assert that flags is 0.
  (scm_getlogin): Rely on gnulib.

11 years agoadd getlogin from gnulib
Andy Wingo [Sat, 9 Mar 2013 22:09:36 +0000 (23:09 +0100)]
add getlogin from gnulib

* lib/Makefile.am:
* lib/getlogin.c:
* m4/getlogin.m4:
* m4/gnulib-cache.m4: Add getlogin module.

11 years agodon't provide scm_std_select on mingw and similar platforms
Andy Wingo [Sat, 9 Mar 2013 21:45:33 +0000 (22:45 +0100)]
don't provide scm_std_select on mingw and similar platforms

* libguile/iselect.h: If we do not have sys/select.h, don't provide
  scm_std_select, SELECT_TYPE, FD_SET, FD_ZERO, FD_ISSET, or FD_CLR.
  Guile should not be setting these macros in public API.  This is an
  incompatible change on mingw, but oh well.

* libguile/threads.c: Rely on gnulib's select, and use that to implement
  scm_std_select.

* libguile/deprecated.h:
* libguile/deprecated.c: Only provide scm_internal_select if we have
  sys/select.h.

11 years agosimplify posix.c
Andy Wingo [Sat, 9 Mar 2013 21:42:17 +0000 (22:42 +0100)]
simplify posix.c

* libguile/posix.c: Reorder includes to fix mingw include-order
  problem.  Remove ttyname shims; gnulib is the place to fix that.
  Remove winsock2 include, as gnulib seems to handle that OK.  Rely on
  the new pipe-posix gnulib module.  Don't bother shimming getlogin, etc
  on mingw; gnulib is the place for shims.

11 years agosimplify readline.c
Andy Wingo [Sat, 9 Mar 2013 21:40:18 +0000 (22:40 +0100)]
simplify readline.c

* guile-readline/readline.c: Remove all mingw special-casing, relying
  instead on mingw / gnulib doing the right thing.

11 years agosimplify stime back-compat shims for tzname
Andy Wingo [Sat, 9 Mar 2013 21:39:27 +0000 (22:39 +0100)]
simplify stime back-compat shims for tzname

* libguile/stime.c: Remove tzname declarations for ancient mingw and SGI
  RS6000.

11 years agomingw include order for socket.c
Andy Wingo [Sat, 9 Mar 2013 21:38:21 +0000 (22:38 +0100)]
mingw include order for socket.c

* libguile/socket.c: Reorder includes to fix include order on mingw.

11 years agofix include-order problem in net_db.c for mingw
Andy Wingo [Sat, 9 Mar 2013 21:37:29 +0000 (22:37 +0100)]
fix include-order problem in net_db.c for mingw

* libguile/net_db.c: Reorder includes to avoid include-order problem on
  mingw.

11 years agosilence mingw32 warning in i18n.c
Andy Wingo [Sat, 9 Mar 2013 21:34:06 +0000 (22:34 +0100)]
silence mingw32 warning in i18n.c

* libguile/i18n.c (scm_make_locale): Silence a warning.

11 years agofports uses gnulib's select
Andy Wingo [Sat, 9 Mar 2013 21:33:24 +0000 (22:33 +0100)]
fports uses gnulib's select

* libguile/fports.c: Reorder includes to put system includes first;
  fixes windows/winsock2 include error problem.  Rely on Gnulib's
  select module.
  (fport_input_waiting): Use select instead of scm_std_select.

11 years agosimplify filesys.c via gnulib's select and fstat modules
Andy Wingo [Sat, 9 Mar 2013 21:30:26 +0000 (22:30 +0100)]
simplify filesys.c via gnulib's select and fstat modules

* libguile/filesys.c: Instead of using scm_std_select, just use select,
  relying on gnulib to provide it to us.  Likewise, rely on fstat.

11 years agoif we have threads on windows, we have pthreads; inform bdw-gc of that
Andy Wingo [Sat, 9 Mar 2013 21:27:59 +0000 (22:27 +0100)]
if we have threads on windows, we have pthreads; inform bdw-gc of that

* libguile/bdw-gc.h: If we have threads enabled on mingw32, explicitly
  mark GC_WIN32_PTHREADS.  See
  http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/5564
  for more info.

11 years agoremove init.c iselect include
Andy Wingo [Sat, 9 Mar 2013 21:26:16 +0000 (22:26 +0100)]
remove init.c iselect include

* libguile/init.c: Remove iselect include.

11 years agoportability simplification with scmsigs.c and alarm
Andy Wingo [Sat, 9 Mar 2013 21:25:35 +0000 (22:25 +0100)]
portability simplification with scmsigs.c and alarm

* configure.ac (alarm): Check for decl.
* libguile/scmsigs.c: Reorder includes to put system includes first.
  Fixes include order on mingw.  Remove #define for alarm, as we will
  use HAVE_DECL_ALARM.  Remove #defines for sleep and usleep, as they
  are not used.
  (scm_alarm): Only define if HAVE_DECL_ALARM.

11 years agoadd gnulib fstat module explicitly
Andy Wingo [Sat, 9 Mar 2013 20:06:07 +0000 (21:06 +0100)]
add gnulib fstat module explicitly

* lib/Makefile.am:
* m4/gnulib-cache.m4: Explicitly add fstat module.

11 years agoImport `pipe-posix' module from gnulib.
Andy Wingo [Sat, 9 Mar 2013 18:08:51 +0000 (19:08 +0100)]
Import `pipe-posix' module from gnulib.

* lib/Makefile.am:
* lib/pipe.c:
* m4/gnulib-cache.m4:
* m4/gnulib-comp.m4:
* m4/pipe.m4: Add pipe-posix module.

11 years agosquish remove some mingw-specific code that is covered by gnulib
Andy Wingo [Sat, 9 Mar 2013 15:39:47 +0000 (16:39 +0100)]
squish remove some mingw-specific code that is covered by gnulib

* libguile/socket.c (scm_init_socket): Remove mingw-specific code.

* libguile/fports.c: Remove ftruncate redefine; mingw is fine.
  (scm_i_fdes_to_port): If we have no F_GETFL, just do an fstat.  The
  right place for an F_GETFL replacement would be in gnulib.
  (fport_input_waiting): Remove an outdated comment.

* libguile/error.c (SCM_I_STRERROR, SCM_I_ERRNO): Remove, replacing uses
  with strerror and errno.

* libguile/win32-socket.c:
* libguile/win32-socket.h: Remove.  Mingw has suitable replacements.

* configure.ac:
* libguile/Makefile.am (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  (noinst_HEADERS): Update for win32-socket removal.

11 years agoremove mingw32 implementations of {get,end,set}{serv,proto}ent
Andy Wingo [Sat, 9 Mar 2013 14:56:30 +0000 (15:56 +0100)]
remove mingw32 implementations of {get,end,set}{serv,proto}ent

* libguile/win32-socket.h:
* libguile/win32-socket.c (getservent, endservent, setservent)
  (getprotoent, endprotoent, setprotoent): Remove mingw32 wrappers.
  Their place is in gnulib, if anywhere.

11 years agoadd check for struct pollfd
Andy Wingo [Sat, 9 Mar 2013 10:56:46 +0000 (11:56 +0100)]
add check for struct pollfd

* configure.ac: Add check for struct pollfd.

* libguile/fports.c (fport_input_waiting):
* libguile/poll.c (scm_primitive_poll): Require struct pollfd.  Fixes
  bug 13903.

11 years agoallow case-lambda expressions with no clauses
Andy Wingo [Sat, 2 Mar 2013 18:04:47 +0000 (19:04 +0100)]
allow case-lambda expressions with no clauses

* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm (case-lambda, case-lambda*): Allow 0
  clauses.

* module/language/scheme/decompile-tree-il.scm (do-decompile):
  (choose-output-names):
* module/language/tree-il.scm (unparse-tree-il):
  (tree-il-fold, post-order!, pre-order!):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/cse.scm (cse):
* module/language/tree-il/debug.scm (verify-tree-il):
* module/language/tree-il/peval.scm (peval): Allow for lambda-body to be
  #f.

* libguile/memoize.c (memoize):
* module/language/tree-il/canonicalize.scm (canonicalize!): Give a body
  to empty case-lambda before evaluating it or compiling it,
  respectively.

* test-suite/tests/optargs.test ("case-lambda", "case-lambda*"): Add
  tests.

11 years agofix in-tree guile reference
Andy Wingo [Sat, 9 Mar 2013 09:29:57 +0000 (10:29 +0100)]
fix in-tree guile reference

* meta/guile.in (GUILE): Add @EXEEXT@ for libguile/guile reference, for
  MinGW compiles.

11 years agoImprove standards conformance of string->number.
Mark H Weaver [Wed, 6 Mar 2013 17:52:39 +0000 (12:52 -0500)]
Improve standards conformance of string->number.

Fixes <http://bugs.gnu.org/11887>.

* libguile/numbers.c (mem2ureal): New argument 'allow_inf_or_nan'.
  Accept infinities and NaNs only if 'allow_inf_or_nan' is true and "#e"
  is not present.  Check for "inf.0" or "nan." case-insensitively.  Do
  not accept rationals with zero divisors.

  (mem2complex): Pass new 'allow_inf_or_nan' argument to 'mem2ureal',
  which is set if and only if a explicit sign was present.

* test-suite/tests/numbers.test ("string->number"): Add tests.

11 years agoadd GUILE_STACK_SIZE environment variable
Stefan Israelsson Tampe [Wed, 12 Dec 2012 16:37:44 +0000 (17:37 +0100)]
add GUILE_STACK_SIZE environment variable

* libguile/vm.c (initialize_default_stack_size): New helper.
  (scm_bootstrap_vm): Call initialize_default_stack_size.

* doc/ref/guile-invoke.texi (Environment Variables): Add docs.

Based on a patch by Stefan Israelsson Tampe.

11 years agosupport calls and tail-calls with more than 255 formals
Andy Wingo [Thu, 7 Mar 2013 12:59:18 +0000 (13:59 +0100)]
support calls and tail-calls with more than 255 formals

* module/language/tree-il/compile-glil.scm (flatten-lambda-case):
  Support calls and tail-calls with more than 255 formals.

* test-suite/tests/tree-il.test ("many args"): Add a test.

11 years ago,option evaluates its right-hand-side
Andy Wingo [Thu, 7 Mar 2013 10:29:01 +0000 (11:29 +0100)]
,option evaluates its right-hand-side

* doc/ref/scheme-using.texi (System Commands): Better documentation for
  ,option.

* module/system/repl/command.scm (option): Evaluate the RHS when setting
  an option.  Fixes bug 13076.

11 years agoGUILE_INSTALL_LOCALE=1 during build
Andy Wingo [Thu, 7 Mar 2013 10:02:33 +0000 (11:02 +0100)]
GUILE_INSTALL_LOCALE=1 during build

* doc/ref/Makefile.am (autoconf-macros.texi):
* libguile/Makefile.am (snarf2checkedtexi):
* module/Makefile.am (ice-9/psyntax-pp.scm.gen, ice-9/psyntax-pp.go):
* test-suite/Makefile.am (GUILE_AUTO_COMPILE):
* test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE):
* test-suite/vm/Makefile.am (TESTS_ENVIRONMENT):
* am/guilec (.scm.go): Set GUILE_INSTALL_LOCALE to 1 during the build.
  Fixes bug 12887.

11 years agoInstall the current locale if GUILE_INSTALL_LOCALE is nonzero.
Ludovic Courtès [Tue, 22 Nov 2011 11:11:48 +0000 (12:11 +0100)]
Install the current locale if GUILE_INSTALL_LOCALE is nonzero.

* libguile/guile.c (get_integer_from_environment)
  (should_install_locale): New functions.
  (main): Add `setlocale' call.

* doc/ref/guile-invoke.texi (Environment Variables): Add documentation.

11 years agostructs with tail arrays are not simple
Andy Wingo [Tue, 5 Mar 2013 17:22:11 +0000 (18:22 +0100)]
structs with tail arrays are not simple

* libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE, SCM_VTABLE_FLAG_SIMPLE_RW):
* libguile/struct.c (set_vtable_layout_flags): Vtable whose layouts
  include a tail array are not simple.  Fixes bug 12808.

11 years agofix compilation under mingw
Andy Wingo [Tue, 5 Mar 2013 13:42:32 +0000 (14:42 +0100)]
fix compilation under mingw

* libguile/load.c (is_absolute_file_name, search_path): Fix compilation
  under mingw.

11 years agoMake `SCM_LONG_BIT' usable in preprocessor conditionals.
Ludovic Courtès [Wed, 6 Mar 2013 23:05:23 +0000 (00:05 +0100)]
Make `SCM_LONG_BIT' usable in preprocessor conditionals.

Reported by Jan Schukat <shookie@email.de>.
Partly fixes <http://bugs.gnu.org/13848>.

* libguile/__scm.h (SCM_LONG_BIT)[!defined LONG_BIT]: Use
  SCM_SIZEOF_LONG since `sizeof' cannot be used in #if directives as
  found in numbers.c.

11 years agoUse `scm_is_eq' in load.c.
Ludovic Courtès [Wed, 6 Mar 2013 23:03:36 +0000 (00:03 +0100)]
Use `scm_is_eq' in load.c.

* libguile/load.c (is_file_name_separator): Use `scm_is_eq' instead of `=='.

11 years agodoc: Allow compilation of r5rs.texi with Texinfo 5.0.
Ludovic Courtès [Mon, 4 Mar 2013 20:24:52 +0000 (21:24 +0100)]
doc: Allow compilation of r5rs.texi with Texinfo 5.0.

* doc/r5rs/r5rs.texi: Remove extraneous @author.  Change @unnumbered to
  @majorheading within @titlepage.

11 years agoVerify that FLT_RADIX is 2.
Mark H Weaver [Mon, 4 Mar 2013 23:37:23 +0000 (18:37 -0500)]
Verify that FLT_RADIX is 2.

* libguile/numbers.c: Trigger a compilation error if FLT_RADIX is not 2.
  This has long been assumed by code in numbers.c.

11 years agoImprove code in scm_gcd for inum/inum case
Mark H Weaver [Sun, 3 Mar 2013 09:34:17 +0000 (04:34 -0500)]
Improve code in scm_gcd for inum/inum case

* libguile/numbers.c (scm_gcd): Improve implementation of inum/inum case
  to be more clear and efficient.

11 years agoFix thread-unsafe lazy initializations.
Mark H Weaver [Thu, 28 Feb 2013 22:56:58 +0000 (17:56 -0500)]
Fix thread-unsafe lazy initializations.

* libguile/debug.c (scm_local_eval):
  libguile/ports.c (scm_current_warning_port):
  libguile/strports.c (scm_eval_string_in_module): Perform
  lazy-initialization while holding a mutex.  Use SCM_UNDEFINED as the
  uninitialized value.  Use 'scm_c_*_variable'.

* doc/ref/api-modules.texi (Accessing Modules from C): Fix
  'my_eval_string' example to be thread-safe.

11 years agodoc: Rename "Texinfo" node to "Texinfo Processing".
Ludovic Courtès [Mon, 4 Mar 2013 08:04:16 +0000 (09:04 +0100)]
doc: Rename "Texinfo" node to "Texinfo Processing".

* doc/ref/texinfo.texi (Texinfo): Rename to...
  (Texinfo Processing): ... this.
* doc/ref/guile.texi (Guile Modules): Update menu.

11 years agoUse `scm_is_eq' in filesys.c.
Ludovic Courtès [Mon, 4 Mar 2013 07:56:47 +0000 (08:56 +0100)]
Use `scm_is_eq' in filesys.c.

* libguile/filesys.c (is_file_name_separator): Use `scm_is_eq' instead
  of `=='.  Fixes <http://hydra.nixos.org/build/4261579>.

11 years agoImprove keyword notation of Texinfo function definitions.
Bake Timmons [Sat, 2 Mar 2013 19:33:56 +0000 (20:33 +0100)]
Improve keyword notation of Texinfo function definitions.

* doc/ref/api-debug.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-modules.texi:
* doc/ref/compiler.texi:
* doc/ref/web.texi: Make Texinfo function headers more consistent.
  Change lesser used keyword notation to the predominant form.

* doc/ref/api-procedures.texi: Fix an argument name in a header that should
  use repeated argument notation.

* doc/ref/srfi-modules.texi: Update references in Texinfo function
  definition body to match previously updated variable notation in
  definition header.

11 years agodoc: Fix build with Texinfo 5.0.
Ludovic Courtès [Fri, 1 Mar 2013 16:49:24 +0000 (17:49 +0100)]
doc: Fix build with Texinfo 5.0.

* doc/ref/api-control.texi (Handling Errors): Move misplaced description
  for `scm_memory_error' & co.
* doc/ref/r6rs.texi (rnrs base): Change `deffnx' of `let-syntax' and
  `letrec-syntax' to fit on one line.

11 years agoAllow the SMOB mark procedures to be called when libgc uses parallel markers.
Ludovic Courtès [Fri, 1 Mar 2013 16:45:17 +0000 (17:45 +0100)]
Allow the SMOB mark procedures to be called when libgc uses parallel markers.

Fixes <http://bugs.gnu.org/13611>.
Reported by Mike Gran <spk121@yahoo.com>.

* libguile/smob.c (current_mark_stack_pointer,
  current_mark_stack_limit): New variables.
  (smob_mark): Use CURRENT_MARK_STACK_POINTER and
  CURRENT_MARK_STACK_LIMIT instead of the same-named fields of
  `SCM_I_CURRENT_THREAD'.
  (scm_gc_mark): Likewise.
  (scm_smob_prehistory): Initialize CURRENT_MARK_STACK_LIMIT and
  CURRENT_MARK_STACK_POINTER.
* libguile/threads.h (scm_i_thread): Add comment that
  `current_mark_stack_ptr' and `current_mark_stack_limit' are no longer
  used.

11 years agoUse accessors instead of symbols deprecated in libgc 7.3.
Ludovic Courtès [Fri, 1 Mar 2013 16:36:21 +0000 (17:36 +0100)]
Use accessors instead of symbols deprecated in libgc 7.3.

* configure.ac: Check for `GC_set_all_interior_pointers',
  `GC_get_gc_no', and `GC_set_java_finalization'.
* libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'.
  (scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use
  `GC_set_all_interior_pointers'.
* libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]:
  Use `GC_set_java_finalization'.

11 years agotest-suite: eq-ness of numbers, characters is unspecified
Daniel Hartwig [Tue, 19 Feb 2013 01:55:14 +0000 (09:55 +0800)]
test-suite: eq-ness of numbers, characters is unspecified

* test-suite/tests/00-socket.test:
* test-suite/tests/alist.test:
* test-suite/tests/elisp.test:
* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/hash.test:
* test-suite/tests/i18n.test:
* test-suite/tests/modules.test:
* test-suite/tests/ports.test:
* test-suite/tests/srfi-35.test: Make tests use eqv? instead of eq? when
  comparing numbers, characters.  Checked also for similar uses of
  assq[-ref].

* test-suite/tests/vlist.test ("vhash-delete honors HASH"): Change test
  to use eqv-ness, not eq-ness, which should not impact its purpose as
  these two are equivalent for strings.

11 years agoFix later-bindings-win logic in with-fluids.
Mark H Weaver [Thu, 28 Feb 2013 23:43:09 +0000 (18:43 -0500)]
Fix later-bindings-win logic in with-fluids.

Based on a patch by David Kastrup <dak@gnu.org>.
Fixes <http://bugs.gnu.org/13843>.

* libguile/fluids.c (scm_i_make_with_fluids): Reverse direction of inner
  loop that checks for duplicates, to properly handle more than two
  bindings to the same fluid.

11 years agoFix duplicate removal of with-fluids.
Mark H Weaver [Thu, 28 Feb 2013 11:26:22 +0000 (06:26 -0500)]
Fix duplicate removal of with-fluids.

Based on a patch by David Kastrup <dak@gnu.org>.
Fixes <http://bugs.gnu.org/13838>.

* libguile/fluids.c (scm_i_make_with_fluids): Remove the duplicate
  binding instead of the last binding.

* test-suite/tests/fluids.test: Add test, and fix existing duplicate
  tests.

* THANKS: Thanks David Kastrup.

11 years agoSupport calling foreign functions of 10 arguments or more.
Mark H Weaver [Tue, 26 Feb 2013 22:25:51 +0000 (17:25 -0500)]
Support calling foreign functions of 10 arguments or more.

* libguile/foreign.c (OBJCODE_HEADER, META_HEADER, META): Change these
  into higher-order macros.
  (GEN_CODE): New higher-order macro based on 'CODE'.
  (M_STATIC, M_DYNAMIC): New macros.
  (CODE): Reimplement using 'GEN_CODE' and 'M_STATIC'.
  (make_objcode_trampoline): New static function.
  (large_objcode_trampolines, large_objcode_trampolines_mutex): New
  static variables.
  (get_objcode_trampoline): New static function.
  (cif_to_procedure): Use 'get_objcode_trampoline'.

* test-suite/standalone/test-ffi-lib.c (test_ffi_sum_many):
  New function.

* test-suite/standalone/test-ffi: Add test.

11 years agoFix handling of the *-gnux32 target.
Ludovic Courtès [Thu, 28 Feb 2013 08:42:31 +0000 (09:42 +0100)]
Fix handling of the *-gnux32 target.

* module/system/base/target.scm (triplet-pointer-size): Fix typo in the
  x32 triplet name.
* test-suite/tests/asm-to-bytecode.test (native-os): New procedure.
  (test-target): Use (native-word-size) only when both the CPU and OS
  match.

11 years agoLet reverse! accept arbitrary types as second argument (new_tail)
David Kastrup [Thu, 28 Feb 2013 01:45:08 +0000 (20:45 -0500)]
Let reverse! accept arbitrary types as second argument (new_tail)

* libguile/list.c (scm_reverse_x): remove typecheck for 2nd arg.

Signed-off-by: Mark H Weaver <mhw@netris.org>
11 years agoRecognize the `x86_64.*-gnux32' triplet.
Ludovic Courtès [Wed, 27 Feb 2013 19:39:51 +0000 (20:39 +0100)]
Recognize the `x86_64.*-gnux32' triplet.

* module/system/base/target.scm (triplet-pointer-size): Add case for
  "^x64_64-.*-gnux32".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation"):
  ["x86_64-unknown-linux-gnux32"]: New test.

11 years agoCheck whether a triplet's OS part specifies an ABI.
Ludovic Courtès [Wed, 27 Feb 2013 19:36:52 +0000 (20:36 +0100)]
Check whether a triplet's OS part specifies an ABI.

* module/system/base/target.scm (cpu-word-size): Rename to...
  (triplet-pointer-size): ... this.  Update caller.  Take a triplet as
  the argument.  Check the `triplet-os' part when checking for equality
  with the host.  Add support "mips64.*-gnuabi64".
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")
  [ "mips64el-unknown-linux-gnuabi64"]: New test.

11 years agoRecognize mips64* as having 32-bit pointers by default.
Ludovic Courtès [Wed, 27 Feb 2013 19:07:12 +0000 (20:07 +0100)]
Recognize mips64* as having 32-bit pointers by default.

* module/system/base/target.scm (cpu-word-size): Consider MIPS64 to
  default to n32 or o32.
* test-suite/tests/asm-to-bytecode.test ("cross-compilation")
  ["mips64el-unknown-linux-gnu"]: New test.

11 years agotests: Avoid missing missing-prototype warning with <fenv.h> on glibc 2.17.
Ludovic Courtès [Wed, 27 Feb 2013 18:59:09 +0000 (19:59 +0100)]
tests: Avoid missing missing-prototype warning with <fenv.h> on glibc 2.17.

* test-suite/standalone/test-round.c: Avoid missing-prototype warning
  with <fenv.h> on glibc 2.17.

11 years agoFix cross-compilation of `c-tokenize.o'.
Ludovic Courtès [Wed, 27 Feb 2013 18:25:39 +0000 (19:25 +0100)]
Fix cross-compilation of `c-tokenize.o'.

* libguile/Makefile.am (c-tokenize.$(OBJEXT)): Pass -I$(top_builddir)
  when cross-compiling.

11 years agoUpdate copyright dates on random.c
Mark H Weaver [Tue, 26 Feb 2013 03:14:41 +0000 (22:14 -0500)]
Update copyright dates on random.c

* libguile/random.c: Add 2012 and 2013 to the copyright notice.

11 years agorandom_state_of_last_resort: use getpid directly, instead of scm_getpid
Mark H Weaver [Mon, 25 Feb 2013 18:38:55 +0000 (13:38 -0500)]
random_state_of_last_resort: use getpid directly, instead of scm_getpid

* libguile/random.c: Include <sys/types.h> and <unistd.h> (if present).
  (random_state_of_last_resort): Use getpid directly.

11 years agoRevert "random_state_of_last_resort doesn't rely on HAVE_POSIX"
Mark H Weaver [Mon, 25 Feb 2013 18:33:28 +0000 (13:33 -0500)]
Revert "random_state_of_last_resort doesn't rely on HAVE_POSIX"

This reverts commit eaf21539d4afb8df5d1b549215fd397b23004947.

11 years agoRevert "random-state-from-platform: simplify pid conditional, and clarify docs."
Mark H Weaver [Mon, 25 Feb 2013 18:33:14 +0000 (13:33 -0500)]
Revert "random-state-from-platform: simplify pid conditional, and clarify docs."

This reverts commit 08904661a2b1c6d461b2f5abfe3226a4023453fb.

11 years agorandom-state-from-platform: simplify pid conditional, and clarify docs.
Mark H Weaver [Mon, 25 Feb 2013 00:57:00 +0000 (19:57 -0500)]
random-state-from-platform: simplify pid conditional, and clarify docs.

* libguile/random.c (random_state_of_last_resort): Simplify optional
  inclusion of PID in the random state.  Clarify in the comments that
  the PID is only included where scm_getpid is present.

* doc/ref/api-data.texi (Random): Clarify that
  'random-state-from-platform' includes the PID in the random state only
  if scm_getpid is present.

11 years agoremove language/glil/decompile-assembly.scm
Andy Wingo [Sun, 24 Feb 2013 14:45:26 +0000 (15:45 +0100)]
remove language/glil/decompile-assembly.scm

* module/language/glil/decompile-assembly.scm: Remove.  This module
  never worked, and even failed to compile.

* module/language/glil/spec.scm:
* module/Makefile.am: Remove references to (language glil
  decompile-assembly).

11 years agodeprecate (ice-9 mapping)
Andy Wingo [Sun, 24 Feb 2013 14:11:14 +0000 (15:11 +0100)]
deprecate (ice-9 mapping)

* module/ice-9/mapping.scm: Add deprecation warning.

11 years agofix and update (ice-9 mapping)
Daniel Hartwig [Wed, 28 Nov 2012 16:17:26 +0000 (00:17 +0800)]
fix and update (ice-9 mapping)

* module/ice-9/mapping.scm (mapping-create-handle!): INIT is required.
  (mapping-ref): Rewrite.  Fix problem with DFLT.
  (hash-table-mapping-hooks): Drop DELETE-PROC, hash-table accessors
  only use ASSOC-PROC.  Add INIT to create-handle hook.  Use correct
  hash-table accessors.
  (make-hash-table-mapping): Drop DELETE-PROC.
  (hash-table-mapping): Rewrite.  Drop DELETE-PROC.

11 years agocleanup to filesys.c's handling of file name separators
Andy Wingo [Sun, 24 Feb 2013 13:15:06 +0000 (14:15 +0100)]
cleanup to filesys.c's handling of file name separators

* libguile/filesys.c (is_file_name_separator): New helper, as in
  load.c.
  (scm_dirname, scm_basename, scm_i_relativize_path): Use
  is_file_name_separator.

11 years agosimplify scm_stat on mingw
Andy Wingo [Sun, 24 Feb 2013 13:07:13 +0000 (14:07 +0100)]
simplify scm_stat on mingw

* libguile/filesys.c (scm_stat): Don't munge the filename on MinGW;
  gnulib does that for us.

11 years agoload.c uses same logic as boot-9 for file names
Andy Wingo [Sun, 24 Feb 2013 12:48:02 +0000 (13:48 +0100)]
load.c uses same logic as boot-9 for file names

* libguile/load.c (is_file_name_separator, is_drive_letter):
  (is_absolute_file_name): New helpers, like the ones in boot-9.
  Perhaps we should just define them in C.
  (search_path, scm_try_auto_compile, canonical_suffix): Rewrite using
  the new helpers.

11 years agoallow '/' in the prefix of UNC file names on windows
Andy Wingo [Sun, 24 Feb 2013 12:03:42 +0000 (13:03 +0100)]
allow '/' in the prefix of UNC file names on windows

* module/ice-9/boot-9.scm (absolute-file-name?) [WINDOWS]: Allow '/' as
  well as '\' when detecting UNC names.
  (load-in-vicinity): Add a comment about the purpose of
  canonical->suffix.

11 years agorandom_state_of_last_resort doesn't rely on HAVE_POSIX
Andy Wingo [Sun, 24 Feb 2013 11:46:48 +0000 (12:46 +0100)]
random_state_of_last_resort doesn't rely on HAVE_POSIX

* libguile/random.c (random_state_of_last_resort): Add the PID as a seed
  only if we have scm_getpid().

11 years agoUpdate predefined character sets to Unicode 6.2
Mike Gran [Thu, 21 Feb 2013 14:44:42 +0000 (06:44 -0800)]
Update predefined character sets to Unicode 6.2

* libguile/srfi-14.i.c (cs_graphic_ranges, cs_printing_ranges, cs_symbol_ranges)
  (cs_designated_ranges): modified

11 years agonet_db.c doesn't import winsock2.h
Andy Wingo [Wed, 20 Feb 2013 21:57:02 +0000 (22:57 +0100)]
net_db.c doesn't import winsock2.h

* libguile/net_db.c: Don't include winsock2.h; gnulib handles this for
  us as necessary.

11 years agomkstemp uses O_BINARY
Andy Wingo [Wed, 20 Feb 2013 20:20:55 +0000 (21:20 +0100)]
mkstemp uses O_BINARY

* libguile/mkstemp.c (mkstemp): Add O_BINARY.  Since temp files are
  empty at the beginning, we're not changing the behavior for reading
  files.  For writing files `newline' and ~% can add \r elements as
  needed.  So this is a reasonable thing to do, and it prevents mangling
  of temp files for the compiler.

11 years agofix compilation of functions with more than 255 local variables.
Andy Wingo [Wed, 20 Feb 2013 15:02:30 +0000 (16:02 +0100)]
fix compilation of functions with more than 255 local variables.

* module/language/glil/compile-assembly.scm (glil->assembly): Fix case
  where there are more than 255 local variables.  Whoops!

11 years agofix an error message loading invalid bytecode
Andy Wingo [Tue, 19 Feb 2013 22:03:19 +0000 (23:03 +0100)]
fix an error message loading invalid bytecode

* libguile/objcodes.c (make_objcode_from_file): Add correct error
  message if full_read failed without an errno.

11 years agocopy-file and load-objcode use O_BINARY
Andy Wingo [Tue, 19 Feb 2013 21:36:22 +0000 (22:36 +0100)]
copy-file and load-objcode use O_BINARY

* libguile/filesys.c (scm_copy_file):
* libguile/objcodes.c (scm_load_objcode): Use O_BINARY.  Thanks to Eli
  Zaretskii for the patch.

11 years agoFix startup of guile.exe on MS-Windows.
Eli Zaretskii [Tue, 19 Feb 2013 15:34:32 +0000 (16:34 +0100)]
Fix startup of guile.exe on MS-Windows.

* module/system/base/compile.scm (call-with-output-file/atomic):  Call
  close-port before deleting the temporary file name, otherwise deletion
  fails on MS-Windows (cannot delete a file that is still open).

11 years agoadd link to doc about UNC names
Andy Wingo [Tue, 19 Feb 2013 14:09:32 +0000 (15:09 +0100)]
add link to doc about UNC names

* module/ice-9/boot-9.scm (compile-time-case): Add link to docs about
  UNC names.

11 years agobetter handling of windows file name conventions
Andy Wingo [Tue, 19 Feb 2013 10:41:44 +0000 (11:41 +0100)]
better handling of windows file name conventions

* libguile/filesys.c (scm_system_file_name_convention): New function.
  Exported to Scheme only.

* module/ice-9/boot-9.scm (file-name-separator?, absolute-file-name?):
  New predicates.
  (file-name-separator-string): New global variable.
  (in-vicinity): Use the new procedures.
  (load-user-init, try-module-autoload): Use file-name-separator-string.
  (load-in-vicinity): Update canonical->suffix.  Consistently use the
  term "file name" throughout.

* module/ice-9/psyntax.scm (include): Use global `absolute-file-name?'.

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

11 years agoRemove flawed test that assumed (eq? 1/2 2/4) would return false.
Mark H Weaver [Mon, 18 Feb 2013 23:44:15 +0000 (18:44 -0500)]
Remove flawed test that assumed (eq? 1/2 2/4) would return false.

* test-suite/tests/hash.test ("hash-count"): Remove flawed test.

11 years agobuild: Fix compilation of `c-tokenize.c' with latest Gnulib.
Ludovic Courtès [Mon, 18 Feb 2013 20:43:30 +0000 (21:43 +0100)]
build: Fix compilation of `c-tokenize.c' with latest Gnulib.

* libguile/c-tokenize.lex: Include <config.h>, to pull in Gnulib macro
  definitions now required.

11 years agoadd gnulib `times' module
Andy Wingo [Mon, 18 Feb 2013 18:06:34 +0000 (19:06 +0100)]
add gnulib `times' module

* lib: Add `times' module.  Should fix socket.c on MinGW.  Thanks to Eli
  Zaretskii for the report.

11 years agoAdd gnulib `select' module.
Andy Wingo [Mon, 18 Feb 2013 17:53:46 +0000 (18:53 +0100)]
Add gnulib `select' module.

Should fix fport_input_waiting when neither poll nor select nor FIONREAD
are available, which is the case on MinGW.  Thanks to Eli Zaretskii for
the report.

11 years agoUpdate to gnulib 0.0.7865-a828.
Andy Wingo [Mon, 18 Feb 2013 17:48:48 +0000 (18:48 +0100)]
Update to gnulib 0.0.7865-a828.