bpt/guile.git
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.

11 years agoArray documentation fixes
Daniel Llorens [Wed, 23 Jan 2013 08:59:58 +0000 (09:59 +0100)]
Array documentation fixes

* libguile/generalized-arrays.c: Fix wording of docstring for array-length.
* doc/ref/api-compund.texi:
  - Document scm_array_type(), scm_array_ref(), array-length,
    scm_array_length(), scm_c_array_length().
  - Fix wording of documentation for array-in-bounds?

11 years agodeprecate generalized vectors in favor of arrays
Andy Wingo [Mon, 21 Jan 2013 16:04:09 +0000 (17:04 +0100)]
deprecate generalized vectors in favor of arrays

* libguile/generalized-arrays.h:
* libguile/generalized-arrays.c (scm_c_array_length):
  (scm_array_length): New functions.

* module/ice-9/deprecated.scm:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_generalized_vector_p)
  (scm_generalized_vector_length, scm_generalized_vector_ref)
  (scm_generalized_vector_set_x, scm_generalized_vector_to_list):
  Deprecate.

* libguile/uniform.c (scm_uniform_vector_to_list): Use
  scm_array_to_list.

* module/ice-9/boot-9.scm (case): Arrays are generalized vectors.

* module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array
  functions instead of the generalized-vector functions.

* test-suite/tests/arrays.test: Remove generalized-vector->list test;
  covered by array->list test.

* test-suite/tests/bitvectors.test:
* test-suite/tests/bytevectors.test:
* test-suite/tests/srfi-4.test: Adapt to test using array interfaces
  instead of generalized-vector interfaces.

* doc/ref/api-compound.texi: Remove generalized vector docs.
* doc/ref/api-data.texi:
* doc/ref/srfi-modules.texi: Adapt.

11 years agooptimize access to arrays of rank 1 or 2
Andy Wingo [Mon, 18 Feb 2013 15:38:24 +0000 (16:38 +0100)]
optimize access to arrays of rank 1 or 2

* libguile/array-handle.c (scm_array_handle_pos_1):
  (scm_array_handle_pos_2): New functions.

* libguile/generalized-arrays.c (scm_c_array_ref_1, scm_c_array_ref_2):
  (scm_c_array_set_1_x, scm_c_array_set_2_x): New functions.
  (scm_i_array_ref, scm_i_array_set_x): New subr bindings for array-ref
  and array-set! that avoid consing for arrays of rank 1 or 2.

* test-suite/tests/arrays.test ("array-set!"): Fix expected exception
  for wrong number of indices.

11 years agoarray handle inline functions defined in array-handle.h.
Andy Wingo [Mon, 18 Feb 2013 11:46:00 +0000 (12:46 +0100)]
array handle inline functions defined in array-handle.h.

* libguile/inline.h:
* libguile/array-handle.h (scm_array_handle_ref):
  (scm_array_handle_set): Move definitions here from inline.h.

* libguile/inline.c: Include array-handle.h.

11 years agoadd hash-count for native tables
Daniel Hartwig [Sun, 17 Feb 2013 08:38:31 +0000 (16:38 +0800)]
add hash-count for native tables

* libguile/hashtab.c (scm_hash_count): New function.  Count the number
  of elements in a hash table.

* doc/ref/api-compound.texi (Hash Tables): Update examples and
  reference.

* test-suite/tests/hash.test (hash-count): New test.

11 years agoFix `getgroups' for when zero supplementary group IDs exist.
Ludovic Courtès [Sat, 16 Feb 2013 17:40:39 +0000 (18:40 +0100)]
Fix `getgroups' for when zero supplementary group IDs exist.

* libguile/posix.c (scm_getgroups): Return the empty vector when NGROUPS
  is zero.  Reported by Mike Gran <spk121@yahoo.com>.

11 years agolocal rewrite for apply to a let-bound rest list
Andy Wingo [Fri, 15 Feb 2013 14:20:40 +0000 (15:20 +0100)]
local rewrite for apply to a let-bound rest list

* module/language/tree-il/peval.scm (peval): Add a special-case inlining
  pattern for apply to a let-bound rest arg that preserves effect
  ordering.

* test-suite/tests/peval.test ("partial evaluation"): Add a test, and
  update an older test with a better result.

11 years agoinline call-with-values consumers with optional and/or rest args
Andy Wingo [Fri, 15 Feb 2013 13:21:21 +0000 (14:21 +0100)]
inline call-with-values consumers with optional and/or rest args

* module/language/tree-il/peval.scm (peval): Inline call-with-values
  whose consumers have optional and rest arguments.

* test-suite/tests/peval.test ("partial evaluation"): Add test.

11 years agomore rest argument inlining improvements
Andy Wingo [Fri, 15 Feb 2013 13:15:15 +0000 (14:15 +0100)]
more rest argument inlining improvements

* module/language/tree-il/peval.scm (peval): Correct comment on
  find-definition, and allow a find-definition to fall back on a source
  expression.  Avoid copying non-constant expressions.

* test-suite/tests/peval.test ("partial evaluation"): Add a test that
  inlining rest arguments works with complicated argument expressions,
  and a test that order of effects in rest args is preserved.

11 years agobetter inlining of `apply' with rest arguments
Andy Wingo [Fri, 15 Feb 2013 11:11:29 +0000 (12:11 +0100)]
better inlining of `apply' with rest arguments

* module/language/tree-il/peval.scm (peval): Move up the find-definition
  helper.  Use it to speculatively destructure conses and lists into the
  tail position of an `apply' form.

* test-suite/tests/peval.test ("partial evaluation"): Add tests.

11 years agoprocedures with rest arguments can get inlined
Andy Wingo [Fri, 15 Feb 2013 10:19:10 +0000 (11:19 +0100)]
procedures with rest arguments can get inlined

* module/language/tree-il/peval.scm (peval): Allow inlining of
  procedures with rest arguments.

* test-suite/tests/peval.test ("partial evaluation"): Add a test.

11 years agopeval can inline let-bound lambdas
Andy Wingo [Thu, 14 Feb 2013 16:33:40 +0000 (17:33 +0100)]
peval can inline let-bound lambdas

* module/language/tree-il/peval.scm (peval): Better inlining of
  complicated operators.

* test-suite/tests/peval.test ("partial evaluation"): Add a couple
  tests.

11 years agoupdate old references in FFI doc
Daniel Hartwig [Thu, 14 Feb 2013 03:23:51 +0000 (11:23 +0800)]
update old references in FFI doc

* doc/ref/api-foreign.texi (Foreign Types): Replace references to the
  old foreign->bytevector and bytevector->foreign with the new procedure
  names using pointer.

11 years agoallow (define-macro name (lambda ...))
Andy Wingo [Tue, 12 Feb 2013 08:40:55 +0000 (09:40 +0100)]
allow (define-macro name (lambda ...))

* module/ice-9/boot-9.scm (define-macro): Allow define-macro NAME
  LAMBDA.  A bugfix.  Thanks to Akop Pogosian.

11 years ago(texinfo): add a command-spec for @math{}.
Andy Wingo [Sat, 9 Feb 2013 17:19:28 +0000 (18:19 +0100)]
(texinfo): add a command-spec for @math{}.

* module/texinfo.scm (texi-command-specs): Add `math' as inline-text.

11 years ago(texinfo docbook): informaltable is a block element.
Andy Wingo [Sat, 9 Feb 2013 17:19:06 +0000 (18:19 +0100)]
(texinfo docbook): informaltable is a block element.

* module/texinfo/docbook.scm (*sdocbook-block-commands*): informaltable
  is a block element.

11 years ago(texinfo plain-text): Pass @math{} through as-is.
Andy Wingo [Sat, 9 Feb 2013 17:18:28 +0000 (18:18 +0100)]
(texinfo plain-text): Pass @math{} through as-is.

* module/texinfo/plain-text.scm (tag-handlers): Pass `math' through
  as-is.

11 years ago(texinfo serialize): don't break words when wrapping
Andy Wingo [Sat, 9 Feb 2013 17:17:48 +0000 (18:17 +0100)]
(texinfo serialize): don't break words when wrapping

* module/texinfo/serialize.scm (wrap): Don't break long words by
  default; that could break @-commands.

11 years agoAdd copyright notice to gen-scmconfig.c.
Mark H Weaver [Sat, 2 Feb 2013 13:55:04 +0000 (08:55 -0500)]
Add copyright notice to gen-scmconfig.c.

* libguile/gen-scmconfig.c: Add copyright notice.

11 years agoAdd foreign types: ssize_t and ptrdiff_t.
Mark H Weaver [Sat, 2 Feb 2013 09:04:49 +0000 (04:04 -0500)]
Add foreign types: ssize_t and ptrdiff_t.

* libguile/foreign.c (sym_ssize_t, sym_ptrdiff_t): New symbols.
  (scm_init_foreign): Add bindings for ssize_t and ptrdiff_t.

* module/system/foreign.scm: Export ssize_t and ptrdiff_t.

* doc/ref/api-foreign.texi (Foreign Types): Add docs.

11 years agoAdd scm_from_ptrdiff_t and scm_to_ptrdiff_t.
Mark H Weaver [Sat, 2 Feb 2013 09:02:24 +0000 (04:02 -0500)]
Add scm_from_ptrdiff_t and scm_to_ptrdiff_t.

* libguile/numbers.h (scm_from_ptrdiff_t, scm_to_ptrdiff_t):
  New macros (function aliases).

* doc/ref/api-data.texi: Add docs.

11 years agoFix typo in comment generated by gen-scmconfig.c.
Mark H Weaver [Sat, 2 Feb 2013 08:57:17 +0000 (03:57 -0500)]
Fix typo in comment generated by gen-scmconfig.c.

* libguile/gen-scmconfig.c (main): Fix typo in generated comment.