bpt/guile.git
12 years agomore define-syntax-rule usage
Andy Wingo [Fri, 2 Sep 2011 09:36:14 +0000 (11:36 +0200)]
more define-syntax-rule usage

* module/ice-9/boot-9.scm:
* module/ice-9/control.scm:
* module/ice-9/futures.scm:
* module/ice-9/optargs.scm:
* module/ice-9/poll.scm:
* module/ice-9/receive.scm:
* module/ice-9/threads.scm:
* module/ice-9/vlist.scm:
* module/language/assembly/compile-bytecode.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/tree-il.scm:
* module/oop/goops.scm:
* module/oop/goops/simple.scm:
* module/oop/goops/stklos.scm:
* module/srfi/srfi-1.scm:
* module/srfi/srfi-35.scm:
* module/srfi/srfi-39.scm:
* module/srfi/srfi-45.scm:
* module/srfi/srfi-67/compare.scm:
* module/sxml/match.scm:
* module/system/repl/error-handling.scm:
* module/system/repl/repl.scm:
* module/system/vm/inspect.scm:
* module/texinfo.scm:
* module/web/server.scm: Use define-syntax-rule, where it makes sense.

12 years agopsyntax uses define-syntax-rule
Andy Wingo [Fri, 2 Sep 2011 09:34:00 +0000 (11:34 +0200)]
psyntax uses define-syntax-rule

* module/ice-9/psyntax.scm: Use define-syntax-rule.

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

12 years agoadd define-syntax-rule
Andy Wingo [Fri, 2 Sep 2011 09:28:11 +0000 (11:28 +0200)]
add define-syntax-rule

* module/ice-9/psyntax.scm (define-syntax-rule): Add this new helper
  macro, to define a syntax-rules macro with one clause.

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

12 years agofix scm_gc_strdup invocation
Andy Wingo [Mon, 29 Aug 2011 20:20:39 +0000 (22:20 +0200)]
fix scm_gc_strdup invocation

* libguile/i18n.c (get_current_locale): Fix scm_gc_strdup invocation.

12 years agotexinfo: add paragraphindent
Andy Wingo [Mon, 29 Aug 2011 20:20:19 +0000 (22:20 +0200)]
texinfo: add paragraphindent

* module/texinfo.scm (texi-command-specs): Add paragraphindent.

12 years agomodule-stexi-documentation #:docs-resolver keyword arg
Andy Wingo [Tue, 23 Aug 2011 16:00:02 +0000 (18:00 +0200)]
module-stexi-documentation #:docs-resolver keyword arg

* module/texinfo/reflection.scm (module-stexi-documentation): Make
  #:docs-resolver a keyword argument.  Provide back compat with
  docs-resolver as an optional argument, though.

12 years agotexinfo: alias `url' to `uref'.
Andy Wingo [Tue, 23 Aug 2011 10:47:51 +0000 (12:47 +0200)]
texinfo: alias `url' to `uref'.

* module/texinfo.scm (texi-command-specs, complete-start-command):
  Upstream texinfo has aliased `url' to `uref'.  Let's do the same.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test.

12 years agobetter guild help FOO
Andy Wingo [Fri, 19 Aug 2011 10:04:46 +0000 (12:04 +0200)]
better guild help FOO

* module/scripts/help.scm (show-help, show-summary, show-usage): Grovel
  for %synopsis and %help variables as well, and show them
  appropriately.  Export these routines for other script modules to
  use.  Needs documentation.

12 years agofix order of importing modules and resolving duplicates handlers
Andy Wingo [Thu, 18 Aug 2011 10:56:14 +0000 (12:56 +0200)]
fix order of importing modules and resolving duplicates handlers

* module/ice-9/boot-9.scm (define-module*): Resolve duplicates handlers
  only after importing modules.  Fixes a bug in which a module with
  #:use-module (oop goops) but whose merge-generics handler got resolved
  to noop instead of the real merge-generics handler.  I can't think of
  an easy way to test this, though.

  Thanks to David Pirotte for the report!

12 years agofix a couple of leaks
Andy Wingo [Thu, 18 Aug 2011 09:54:20 +0000 (11:54 +0200)]
fix a couple of leaks

* libguile/bytevectors.h:
* libguile/bytevectors.c (scm_c_take_gc_bytevector): Rename this
  internal function, from scm_c_take_bytevector.  This indicates that
  unlike the other scm_take_* functions, this one takes GC-managed
  memory.

* libguile/objcodes.c (scm_objcode_to_bytecode):
* libguile/vm.c (really_make_boot_program): Use
  scm_gc_malloc_pointerless, not scm_malloc.  Thanks to Stefan
  Israelsson Tampe!

* libguile/r6rs-ports.c:
* libguile/strings.c: Adapt to renames.

12 years agoreword open-file docs
Andy Wingo [Thu, 18 Aug 2011 09:13:34 +0000 (11:13 +0200)]
reword open-file docs

* doc/ref/api-io.texi (File Ports): Refactor open-file docs.  Thanks to
  Bake Timmons for the report.

12 years agofix scm_tmpfile leak
Andy Wingo [Wed, 17 Aug 2011 21:54:58 +0000 (23:54 +0200)]
fix scm_tmpfile leak

* libguile/posix.c (scm_tmpfile): Fix to actually close the new
  tmpfile, causing its deletion, while keeping an fd to the file open.
  Fixes a leak both in memory and disk space on POSIX systems; MINGW
  systems will leak however.  A FIXME for later.

12 years agofix r6rs `map'
Andy Wingo [Wed, 17 Aug 2011 21:24:20 +0000 (23:24 +0200)]
fix r6rs `map'

* module/rnrs/base.scm (map): Define a version of map that is safe for
  multiple returns, though slower.

12 years agocheck that srfi-1 procedure arguments are procedures
Andy Wingo [Wed, 17 Aug 2011 21:09:39 +0000 (23:09 +0200)]
check that srfi-1 procedure arguments are procedures

* module/srfi/srfi-1.scm (check-arg, wrong-type-arg): Refactor arg type
  checkers to be macros, and do the minimal amount of work in the
  functions themselves.  Use these checkers consistently for all
  procedure arguments in this module.  This catches user errors early;
  see bug 33628.

12 years agofix recursive define-inlinable expansions
Andy Wingo [Wed, 17 Aug 2011 20:35:24 +0000 (22:35 +0200)]
fix recursive define-inlinable expansions

* module/ice-9/boot-9.scm (define-inlinable): Prevent expansion from
  diverging by using fluid-let-syntax, as Dybvig suggests.

12 years agosrfi-9 record compatibility with boot-9 records
Andy Wingo [Wed, 17 Aug 2011 08:47:04 +0000 (10:47 +0200)]
srfi-9 record compatibility with boot-9 records

* module/srfi/srfi-9.scm (define-record-type): Instead of defining the
  RTD using make-vtable, use make-struct with the record-type-vtable,
  and record the type name and fields names in the vtable.  This way
  SRFI-9 records are compatible with boot-9 records.  Also we use a
  generic printer, instead of generating one anew.

12 years agofix leak in get_current_locale()
Andy Wingo [Tue, 16 Aug 2011 11:16:21 +0000 (13:16 +0200)]
fix leak in get_current_locale()

* libguile/i18n.c (get_current_locale): Hold the locale name in a
  GC-managed string, not a mallocated string.  Thanks to Stefan
  Israelsson Tampe for the report.

12 years agofix take-right and drop-right for improper lists
Andy Wingo [Fri, 12 Aug 2011 21:26:15 +0000 (23:26 +0200)]
fix take-right and drop-right for improper lists

* libguile/srfi-1.h:
* libguile/srfi-1.c (scm_srfi1_drop_right, scm_srfi1_take_right): Remove
  these internal functions, replacing with Scheme implementations.

* module/srfi/srfi-1.scm (take-right, drop-right): Add these impls from
  the reference code.  They do the right thing for improper lists,
  according to the spec, but they diverge for circular lists.  Oh well.

* test-suite/tests/srfi-1.test ("drop-right", "take-right"): Add more
  tests.

12 years agofix tree-il->scheme test
Andy Wingo [Thu, 4 Aug 2011 17:23:49 +0000 (19:23 +0200)]
fix tree-il->scheme test

* module/language/tree-il.scm (tree-il->scheme): Fix incorporation of
  `lambda' in a `case-lambda'.

* test-suite/tests/tree-il.test ("tree-il->scheme"): Add a test.

12 years ago(web http): locale-independent parsing and serialization of dates
Andy Wingo [Thu, 4 Aug 2011 13:07:27 +0000 (15:07 +0200)]
(web http): locale-independent parsing and serialization of dates

* module/web/http.scm (parse-month, parse-rfc-822-date):
  (parse-rfc-850-date, parse-asctime-date, parse-date):
  (write-date): Parse and write dates without regard to the current
  locale, using a custom parser.  Also permits parsing of the deprecated
  RFC 850 and asctime() date formats.

12 years agosrfi-19 refactor
Andy Wingo [Thu, 4 Aug 2011 10:53:07 +0000 (12:53 +0200)]
srfi-19 refactor

* module/srfi/srfi-19.scm (priv:locale-number-separator, priv:locale-am)
  (priv:locale-am): Inline definitions.

  Strip priv: prefix from module vars, as it's unnecessary, except for
  in a couple cases.

12 years agoavoid duplicate stats when searching for files in a path
Andy Wingo [Wed, 3 Aug 2011 10:36:55 +0000 (12:36 +0200)]
avoid duplicate stats when searching for files in a path

* libguile/load.c (search_path): Extract from scm_search_path, to
  give the caller the stat buffer of the found path.
  (scm_search_path, scm_sys_search_load_path): Adapt accordingly.
  (compiled_is_fresh): Take the stat buffers directly.
  (scm_primitive_load_path, scm_init_eval_in_scheme): Adapt to
  search_path / compiled_is_fresh changes to avoid duplicate states in
  search-path.

12 years agofix unnecessary call to canonicalize_path in load-path fast case
Andy Wingo [Wed, 3 Aug 2011 09:46:56 +0000 (11:46 +0200)]
fix unnecessary call to canonicalize_path in load-path fast case

* libguile/load.c (scm_primitive_load_path): Don't canonicalize the
  filename unless we need to look in the fallback path.  Fixes a stat
  explosion; see http://savannah.gnu.org/bugs/?33815.

12 years agosimplify narrow_stack.
Andy Wingo [Fri, 29 Jul 2011 07:17:47 +0000 (09:17 +0200)]
simplify narrow_stack.

* libguile/stacks.c (narrow_stack): Simplify outer narrowing by a number
  of frames.  Thanks to
  http://article.gmane.org/gmane.lisp.guile.devel/12685.

12 years agostyle fix in read.c
Andy Wingo [Fri, 29 Jul 2011 07:14:04 +0000 (09:14 +0200)]
style fix in read.c

* libguile/read.c (scm_read_sexp): No need to assign to tmp here.

12 years agominor style fix in bytevectors.c
Andy Wingo [Fri, 29 Jul 2011 07:11:24 +0000 (09:11 +0200)]
minor style fix in bytevectors.c

* libguile/bytevectors.c (SCM_BYTEVECTOR_HEADER_BYTES): Use sizeof
  scm_t_bits, not sizeof SCM.  It's the same, but it seems like the
  right thing.

12 years agofix a leak on startup from script.c
Andy Wingo [Thu, 28 Jul 2011 17:12:07 +0000 (19:12 +0200)]
fix a leak on startup from script.c

* libguile/script.c (scm_get_meta_args): Free nargv.  Thanks to
  http://article.gmane.org/gmane.lisp.guile.devel/12685.  We leak narg
  though.

12 years agofix read beyond end of hashtable size array in hashtab.c
Andy Wingo [Thu, 28 Jul 2011 17:07:53 +0000 (19:07 +0200)]
fix read beyond end of hashtable size array in hashtab.c

* libguile/hashtab.c (make_hash_table): Fix read beyond end of
  hashtable_size array.  Thanks to
  http://article.gmane.org/gmane.lisp.guile.devel/12685.

12 years agofix write beyond array end in arrays.c
Andy Wingo [Thu, 28 Jul 2011 17:04:38 +0000 (19:04 +0200)]
fix write beyond array end in arrays.c

* libguile/arrays.c (scm_i_read_array): Fix write past end of array
  while reading array type tag.  Fix non-ascii type tag elements.
  Thanks to http://article.gmane.org/gmane.lisp.guile.devel/12685.

12 years agofix list validation bug in @abort
Andy Wingo [Thu, 28 Jul 2011 16:17:45 +0000 (18:17 +0200)]
fix list validation bug in @abort

* libguile/control.c (scm_at_abort): Fix to ensure that we store the
  return of scm_ilength in a signed integer, even if later we copy it to
  an unsigned.  See
  http://article.gmane.org/gmane.lisp.guile.devel/12685.

12 years agoremove dead code in scm_ceiling_quotient
Andy Wingo [Thu, 28 Jul 2011 15:59:56 +0000 (17:59 +0200)]
remove dead code in scm_ceiling_quotient

* libguile/numbers.c (scm_ceiling_quotient): Remove dead code.  See
  http://article.gmane.org/gmane.lisp.guile.devel/12685.

12 years agofix scm_i_tag_name
Andy Wingo [Thu, 28 Jul 2011 15:47:31 +0000 (17:47 +0200)]
fix scm_i_tag_name

* libguile/gc.c (scm_i_tag_name): Fix to work as intended, though it was
  not called.  See http://article.gmane.org/gmane.lisp.guile.devel/12685.

12 years agoguild: Close over `$bindir/guile'.
Ludovic Courtès [Sat, 23 Jul 2011 20:23:59 +0000 (22:23 +0200)]
guild: Close over `$bindir/guile'.

* configure.ac: Substitute `guile_program_name'.

* meta/guild.in: Use `@bindir@/@guile_program_name@' by default.

* meta/uninstalled-env.in: Define $GUILE.

12 years agoChange `guild --help' and `--version' output to be more GNUish.
Ludovic Courtès [Sat, 23 Jul 2011 20:43:08 +0000 (22:43 +0200)]
Change `guild --help' and `--version' output to be more GNUish.

* meta/guild.in (display-version): Display the version, not the
  effective version.

* module/scripts/help.scm (list-commands)[help]: Add proper footer, as
  per the GCS.

12 years agodoc: Remove redundant footnote about the former name of `guild'.
Ludovic Courtès [Sat, 23 Jul 2011 17:25:28 +0000 (19:25 +0200)]
doc: Remove redundant footnote about the former name of `guild'.

* doc/ref/scheme-using.texi (Using Guile Tools): Remove redundant
  footnote introduced in e108c961fed2ffdedddcd10bad9c6aae44491b1e.
  Mention the version where the new name was introduced.

12 years agoExport `main' from (scripts help).
Ludovic Courtès [Sat, 23 Jul 2011 20:42:09 +0000 (22:42 +0200)]
Export `main' from (scripts help).

* module/scripts/help.scm: Export `main'.

12 years agoadd support for guild help FOO
Andy Wingo [Sat, 23 Jul 2011 16:50:22 +0000 (18:50 +0200)]
add support for guild help FOO

* module/scripts/help.scm (main): Add support for guild help FOO.

12 years agoadd (scripts help)
Andy Wingo [Sat, 23 Jul 2011 16:24:16 +0000 (18:24 +0200)]
add (scripts help)

* meta/guild.in (display-version): Use (ice-9 command-line)'s
  version-etc.
  (main): Dispatch --help to guild help.

* module/scripts/help.scm: New file, a copy of list.scm, but with a
  better name.

* module/Makefile.am: Add help.scm to the list.

* module/scripts/list.scm: Change to be an alias to "help".
  (list-scripts): Restore this API.

12 years agomore work on "guild list"
Andy Wingo [Sat, 23 Jul 2011 15:50:37 +0000 (17:50 +0200)]
more work on "guild list"

* module/scripts/: Add %summary entries, and in many cases,
  %include-in-guild-list entries to inhibit a script from appearing in
  "guild list".  Update list.scm to respect this new variable.

12 years agoremove scripts PROGRAM
Andy Wingo [Sat, 23 Jul 2011 11:54:28 +0000 (13:54 +0200)]
remove scripts PROGRAM

* module/scripts/PROGRAM.scm: Remove this useless template, which was
  cluttering `guild list'.  We'll perhaps cull the list a bit more in
  2.2.

* module/Makefile.am: Adapt.

12 years agoa prettier `guild list'
Andy Wingo [Sat, 23 Jul 2011 11:52:51 +0000 (13:52 +0200)]
a prettier `guild list'

* module/scripts/list.scm (strip-extensions): Don't list programs
  without extensions.
  (main): Be prettier.  Parse out a %summary from modules, for a brief
  synopsis.

12 years agoadd a site dir to %load-compiled-path
Andy Wingo [Thu, 21 Jul 2011 08:36:13 +0000 (10:36 +0200)]
add a site dir to %load-compiled-path

* libguile/Makefile.am (libpath.h): Define SCM_SITE_CCACHE_DIR.  Defined
  as site-ccache/ instead of site/ccache/ to indicate that we don't expect
  further subdirectories, and also to avoid confusion about whether
  extensions/ is a site-specific or not.

* libguile/load.c (scm_init_load_path): Add SCM_SITE_CCACHE_DIR to the
  default load-compiled path.

12 years agoopen-socket-for-url returns port in latin1 encoding
Andy Wingo [Thu, 21 Jul 2011 07:42:20 +0000 (09:42 +0200)]
open-socket-for-url returns port in latin1 encoding

* module/web/client.scm (open-socket-for-uri): Set port encoding to
  latin1, to see if this fixes Nalin Garut's problems.

12 years agofix web-request.test
Andy Wingo [Mon, 18 Jul 2011 08:37:46 +0000 (10:37 +0200)]
fix web-request.test

* test-suite/tests/web-request.test ("example-1"): Fix expected format
  of `host' header.

12 years agoensure presence of Host header in HTTP/1.1 requests
Andy Wingo [Fri, 15 Jul 2011 11:08:45 +0000 (13:08 +0200)]
ensure presence of Host header in HTTP/1.1 requests

* module/web/request.scm (build-request): Make sure that HTTP/1.1
  requests have the Host header set, per RFC 2616 section 9.

* test-suite/tests/web-request.test ("example-1"): Add test.

12 years agoadd (web client)
Andy Wingo [Fri, 15 Jul 2011 10:49:46 +0000 (12:49 +0200)]
add (web client)

* module/web/client.scm: New module, a simple synchronous web client.

* module/Makefile.am (WEB_SOURCES): Add to the build.

12 years agoFix `open' mode bits on GNU/Hurd.
Ludovic Courtès [Tue, 12 Jul 2011 21:57:57 +0000 (23:57 +0200)]
Fix `open' mode bits on GNU/Hurd.

* libguile/filesys.c (scm_open): Fix check for read-write flags for
  systems such as GNU/Hurd, where O_RDWR == (O_WRONLY | O_RDONLY)
  and O_RDONLY != 0.

12 years agoDefine `O_NOTRANS' on GNU/Hurd.
Ludovic Courtès [Tue, 12 Jul 2011 21:08:42 +0000 (23:08 +0200)]
Define `O_NOTRANS' on GNU/Hurd.

* libguile/filesys.c (scm_init_filesys): Define `O_NOTRANS' when
  available.

12 years agoDisable TLS on NetBSD up to 5.x included.
Ludovic Courtès [Tue, 12 Jul 2011 07:26:32 +0000 (09:26 +0200)]
Disable TLS on NetBSD up to 5.x included.

* acinclude.m4 (GUILE_THREAD_LOCAL_STORAGE): Disable TLS on
  `x86_64-unknown-netbsd5.1' too.

12 years agoAdd document describing the release process.
Ludovic Courtès [Tue, 12 Jul 2011 07:24:14 +0000 (09:24 +0200)]
Add document describing the release process.

* doc/release.org: New file.

12 years agofix CPL of <extended-generic-with-setter> and <extended-accessor>
Andy Wingo [Thu, 7 Jul 2011 10:45:30 +0000 (12:45 +0200)]
fix CPL of <extended-generic-with-setter> and <extended-accessor>

* libguile/goops.c (fix_cpl): Fix bug in placement of debug assertion.
  (create_standard_classes): Put <extended-generic> before
  <generic-with-setter> in <extended-generic-with-setter>'s direct
  supers, so that the slot allocation is a superset of
  <generic-with-setter>, which results in the `setter' being allocated
  in the same place.

  Likewise fix <extended-accessor> to place <extended-generic> before
  <generic-with-setter>, not just <generic>.

12 years agofix invocation of duplicate handlers for merge-generics
Andy Wingo [Thu, 7 Jul 2011 10:21:48 +0000 (12:21 +0200)]
fix invocation of duplicate handlers for merge-generics

* libguile/modules.c (resolve_duplicate_binding): Fix unbound -> #f
  conversion for the imported bindings.  Pass the existing entry in the
  import obarray as the resolved var (7th arg), and properly pass #f as
  the value (8th arg) if there is no such binding.  Fixes
  merge-generics; before, the <boolean> type test (indicating no
  previous value) was not being triggered.  This bug has been present
  since 2007 at least, though it was not in 1.8.

* test-suite/tests/modules.test ("duplicate bindings"): Add a test that
  the var and val are both #f.  These types are used by GOOPS.

12 years agogoops.scm cleanups
Andy Wingo [Thu, 7 Jul 2011 10:17:08 +0000 (12:17 +0200)]
goops.scm cleanups

* module/oop/goops.scm (make-generic, make-extended-generic):
  (ensure-generic, make-accessor, ensure-accessor): Use optional
  arguments for #:name.  `make-extended-generic' also accepts empty
  extension lists.

12 years agomore precision for ,time
Andy Wingo [Wed, 6 Jul 2011 12:01:03 +0000 (14:01 +0200)]
more precision for ,time

* module/system/repl/command.scm (time): Use the high-precision timers
  instead of stime(2).  Changes the output format of `,time' too;
  perhaps there is a better way.

12 years agodoc: Fix `merge-generics' example.
Ludovic Courtès [Wed, 6 Jul 2011 16:21:07 +0000 (18:21 +0200)]
doc: Fix `merge-generics' example.

* doc/ref/goops.texi (Merging Generics): Change (my-module) example to
  use (oop goops) and use the right syntax for #:duplicates.  Reported
  by David Pirotte <david@altosw.be>.

12 years agoconfigure: Build a `tar.xz' in addition to `tar.gz'.
Ludovic Courtès [Wed, 6 Jul 2011 14:01:22 +0000 (16:01 +0200)]
configure: Build a `tar.xz' in addition to `tar.gz'.

* configure.ac: Explicitly require Automake 1.11.  Add Automake option
  `dist-xz'.

12 years agoVM: Keep jump table address in a register.
Ludovic Courtès [Mon, 4 Jul 2011 21:56:16 +0000 (23:56 +0200)]
VM: Keep jump table address in a register.

* libguile/vm-engine.c (VM_NAME)[HAVE_LABELS_AS_VALUES]: Rename
  `jump_table' to `jump_table_pointer'.  Add `jump_table' as a local
  variable, initialize it.

* libguile/vm-engine.h (JT_REG): New macro.

12 years agoBump version number for 2.0.2.
Ludovic Courtès [Fri, 1 Jul 2011 21:54:10 +0000 (23:54 +0200)]
Bump version number for 2.0.2.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C function
  `scm_peek_byte_or_eof'.
  (LIBGUILE_INTERFACE_AGE): Increment.

12 years agoUpdate `NEWS'.
Ludovic Courtès [Fri, 1 Jul 2011 20:49:50 +0000 (22:49 +0200)]
Update `NEWS'.

12 years agoRevert "Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'."
Ludovic Courtès [Fri, 1 Jul 2011 20:43:01 +0000 (22:43 +0200)]
Revert "Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'."

This reverts commit ccb80964cd7cd112e300c34d32f67125a6d6da9a, which
introduced a race condition, with a small window during which a mutex
could be held by a thread without being part of its `mutexes' list,
thereby violating the invariant tested at line 667.

12 years agoUpdate Gnulib to v0.0-5874-g7170ee0.
Ludovic Courtès [Fri, 1 Jul 2011 20:34:29 +0000 (22:34 +0200)]
Update Gnulib to v0.0-5874-g7170ee0.

12 years agoType-check the OWNER argument of `lock-mutex'.
Ludovic Courtès [Fri, 1 Jul 2011 17:10:18 +0000 (19:10 +0200)]
Type-check the OWNER argument of `lock-mutex'.

* libguile/threads.c (scm_lock_mutex_timed): Type-check OWNER.

12 years agoAdd type and range checks to the complex generalized vector accessors.
Ludovic Courtès [Fri, 1 Jul 2011 17:09:29 +0000 (19:09 +0200)]
Add type and range checks to the complex generalized vector accessors.

* libguile/bytevectors.c (COMPLEX_ACCESSOR_PROLOGUE, COMPLEX_NATIVE_REF,
  COMPLEX_NATIVE_SET): New macros.
  (bytevector_ref_c32, bytevector_ref_c64): Defined in terms of
  `COMPLEX_NATIVE_REF'.
  (bytevector_set_c32, bytevector_set_c64): Defined in terms of
  `COMPLEX_NATIVE_SET'.
  (bytevector_ref_fns): Make `static'.

* test-suite/tests/srfi-4.test ("c32 vectors")["generalized-vector-ref",
  "generalized-vector-set!", "generalized-vector-ref, out-of-range",
  "generalized-vector-set!, out-of-range"]: New tests.
  ("c64 vectors")["generalized-vector-ref", "generalized-vector-set!",
  "generalized-vector-ref, out-of-range",
  "generalized-vector-set!, out-of-range"]: New tests.

12 years agoFix unaligned accesses for bytevectors of complex numbers.
Ludovic Courtès [Fri, 1 Jul 2011 14:21:21 +0000 (16:21 +0200)]
Fix unaligned accesses for bytevectors of complex numbers.

* libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64,
  bytevector_set_c32, bytevector_set_c64): Use `memcpy' to avoid
  unaligned accesses.  This fixes SIGBUS on SPARC and possibly other
  alignment-sensitive platforms.

12 years agoi18n: Don't use `!=' to compare SCMs.
Ludovic Courtès [Fri, 1 Jul 2011 13:29:51 +0000 (15:29 +0200)]
i18n: Don't use `!=' to compare SCMs.

* libguile/i18n.c (install_locale)[!USE_GNU_LOCALE_API]: Use
  `SCM_UNBNDP' instead of `!='.

12 years agofix '(a #{.} b)
Andy Wingo [Fri, 1 Jul 2011 10:20:52 +0000 (12:20 +0200)]
fix '(a #{.} b)

* libguile/read.c (scm_read_sexp): Don't confuse `#{.}#' with `.' for
  the purpose of reading dotted pairs.  Thanks to CRLF0710 for the
  report.

* test-suite/tests/reader.test ("#{}#"): Add test.

12 years agoFix `on_thread_exit' for canceled threads.
Ludovic Courtès [Thu, 30 Jun 2011 20:58:07 +0000 (22:58 +0200)]
Fix `on_thread_exit' for canceled threads.

* libguile/threads.c (on_thread_exit): Clear `t->guile_mode' upon
  entry.  This fixes a bug whereby `t->base' would be incorrect for
  canceled threads, leading to a misdiagnosed VM stack overflow.
  See <http://lists.gnu.org/archive/html/bug-guile/2011-06/msg00068.html>
  for details.
  (scm_leave_guile_cleanup): Remove because it's unused.

12 years agoAdd `guile-invoke.texi' to the distribution.
Ludovic Courtès [Thu, 30 Jun 2011 14:36:03 +0000 (16:36 +0200)]
Add `guile-invoke.texi' to the distribution.

* doc/ref/Makefile.am (guile_TEXINFOS): Add `guile-invoke.texi'.

12 years agofix generation of auto-compiled file names on mingw systems
Andy Wingo [Thu, 30 Jun 2011 14:07:17 +0000 (16:07 +0200)]
fix generation of auto-compiled file names on mingw systems

* libguile/load.c (canonical_to_suffix, scm_primitive_load_path):
* module/ice-9/boot-9.scm (load-in-vicinity):
* module/system/base/compile.scm (compiled-file-name): If the canonical
  path of a file is a DOS-style path with a drive letter, turn it into a
  path suffix it by removing the colon and prefixing a "/".

Inspired by a patch from Jan Nieuwenhuizen.

12 years agobetter invocation documentation
Mark Harig [Mon, 25 Apr 2011 15:33:22 +0000 (11:33 -0400)]
better invocation documentation

* doc/ref/guile.texi (Programming in Scheme):
* doc/ref/scheme-scripts.texi (Guile Scripting): Moved "Invoking Guile"
  to its own file.

* doc/ref/guile-invoke.texi (Invoking Guile): Initial revision. This
  file contains the former section "Invoking Guile" that was included in
  the chapter "Programming in Scheme" as a subsection named
  "Command-line Options." It also includes a new subsection "Environment
  Variables," which describes those variables that can be set in the
  operating system before Guile is started and which affect Guile's
  run-time behavior.

12 years ago%load-hook not just for primitive-load
Andy Wingo [Thu, 30 Jun 2011 10:56:12 +0000 (12:56 +0200)]
%load-hook not just for primitive-load

* libguile/load.c (scm_primitive_load_path):
* module/ice-9/boot-9.scm (load-in-vicinity): Call %load-hook as needed.

12 years agofix --disable-modules build
Andy Wingo [Thu, 30 Jun 2011 10:26:31 +0000 (12:26 +0200)]
fix --disable-modules build

* configure.ac (HAVE_MODULES): Define HAVE_MODULES iff
  --enable-modules.

* libguile/deprecated.c (scm_dynamic_args_call)
* libguile/extensions.c (load_extension):
* libguile/init.c (scm_i_init_guile): Use HAVE_MODULES in a few places.

12 years agoHAVE_POSIX warning fix
Andy Wingo [Thu, 30 Jun 2011 09:32:09 +0000 (11:32 +0200)]
HAVE_POSIX warning fix

* libguile/filesys.c (scm_dir_free, scm_dir_print): Don't compile when
  not HAVE_POSIX.

12 years agoFix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'.
Ludovic Courtès [Tue, 28 Jun 2011 13:25:22 +0000 (15:25 +0200)]
Fix lock ordering in `fat_mutex_lock' to match that of `do_thread_exit'.

Original Helgrind report:

==14160== Thread #57: lock order "0x47F6B90 before 0x7C25A28" violated
==14160==    at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==14160==    by 0x4EFF87E: do_thread_exit (threads.c:664)
==14160==    by 0x4E87B89: c_body (continuations.c:512)
==14160==    by 0x4F16C21: vm_regular_engine (vm-i-system.c:960)
==14160==    by 0x4E90F92: scm_call_4 (eval.c:506)
==14160==    by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450)
==14160==    by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546)
==14160==    by 0x51CA3AF: GC_call_with_gc_active (pthread_support.c:1128)
==14160==    by 0x4EFF2E0: with_guile_and_parent (threads.c:206)
==14160==    by 0x51C46B4: GC_call_with_stack_base (misc.c:1505)
==14160==    by 0x4EFF447: scm_with_guile (threads.c:917)
==14160==    by 0x51C46B4: GC_call_with_stack_base (misc.c:1505)
==14160==   Required order was established by acquisition of lock at 0x47F6B90
==14160==    at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==14160==    by 0x4F00262: fat_mutex_lock (threads.c:1362)
==14160==    by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462)
==14160==    by 0x4F16C09: vm_regular_engine (vm-i-system.c:898)
==14160==    by 0x4E90F4D: scm_call_3 (eval.c:499)
==14160==    by 0x4EFFA4C: really_launch (threads.c:975)
==14160==    by 0x4E87B89: c_body (continuations.c:512)
==14160==    by 0x4F16C21: vm_regular_engine (vm-i-system.c:960)
==14160==    by 0x4E90F92: scm_call_4 (eval.c:506)
==14160==    by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450)
==14160==    by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546)
==14160==    by 0x4EFF289: with_guile_and_parent (threads.c:874)
==14160==   followed by a later acquisition of lock at 0x7C25A28
==14160==    at 0x4C27730: pthread_mutex_lock (in /.../valgrind-3.6.0/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
==14160==    by 0x4F00352: fat_mutex_lock (threads.c:1374)
==14160==    by 0x4F004DA: scm_lock_mutex_timed (threads.c:1462)
==14160==    by 0x4F16C09: vm_regular_engine (vm-i-system.c:898)
==14160==    by 0x4E90F4D: scm_call_3 (eval.c:499)
==14160==    by 0x4EFFA4C: really_launch (threads.c:975)
==14160==    by 0x4E87B89: c_body (continuations.c:512)
==14160==    by 0x4F16C21: vm_regular_engine (vm-i-system.c:960)
==14160==    by 0x4E90F92: scm_call_4 (eval.c:506)
==14160==    by 0x4E88372: scm_i_with_continuation_barrier (continuations.c:450)
==14160==    by 0x4E88424: scm_c_with_continuation_barrier (continuations.c:546)
==14160==    by 0x4EFF289: with_guile_and_parent (threads.c:874)

* libguile/threads.c (fat_mutex_lock): In the `m->level == 0' case,
  release M's lock before taking T's `admin_mutex'.

13 years agopsyntax: enable dotted tail patterns
Stefan Israelsson Tampe [Fri, 17 Jun 2011 21:11:29 +0000 (23:11 +0200)]
psyntax: enable dotted tail patterns

* module/ice-9/psyntax.scm (syntax-case): enabled the use of a
  general last cdr instead of just '() in matching with both
  a ellipsis (p ...) and a last rest pattern (. q)

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

13 years agoupdate stack growth direction check
Andy Wingo [Mon, 20 Jun 2011 08:03:22 +0000 (10:03 +0200)]
update stack growth direction check

* configure.ac: Pull stack growth direction check from upstream
  autoconf.  See
  http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00035.html
  for a discussion.

13 years agoPlacate GCC in `test-ffi-lib.c'.
Ludovic Courtès [Sun, 19 Jun 2011 22:45:18 +0000 (00:45 +0200)]
Placate GCC in `test-ffi-lib.c'.

This fixes warnings saying "this decimal constant is unsigned only in
ISO C90".

* test-suite/standalone/test-ffi-lib.c (test_ffi_u32_, test_ffi_u32_u8,
  test_ffi_u32_s64, test_ffi_s64_s64, test_ffi_u64_u8,
  test_ffi_u64_s64): Mark constants as unsigned.

13 years agoFix hygiene issues with `define-record-type'
Ian Price [Sat, 11 Jun 2011 01:43:08 +0000 (02:43 +0100)]
Fix hygiene issues with `define-record-type'

* module/rnrs/records/syntactic.scm (define-record-type0, process-fields):
  Preserve hygiene of record clauses.

* test-suite/tests/r6rs-records-syntactic.test ("record hygiene"):
  Add tests.

13 years agoComment on the Gnulib `clock-gettime' workaround.
Ludovic Courtès [Sun, 19 Jun 2011 14:39:22 +0000 (16:39 +0200)]
Comment on the Gnulib `clock-gettime' workaround.

* acinclude.m4: Remove `clock_time.m4' serial.

* configure.ac: Add URL of the discussion about `clock-gettime'.

13 years agoconfigure: Factorize code checking for `iconveh_' constants; use the cache.
Ludovic Courtès [Sun, 19 Jun 2011 14:30:56 +0000 (16:30 +0200)]
configure: Factorize code checking for `iconveh_' constants; use the cache.

* configure.ac: Remove code that determines the values of the `iconveh_'
  constants.  Use `GUILE_UNISTRING_ICONVEH_VALUES'. instead.

* acinclude.m4 (GUILE_UNISTRING_CONSTANT,
  GUILE_UNISTRING_ICONVEH_VALUES): New macros.

13 years agocurrent-language really defaults to Scheme.
Andy Wingo [Fri, 17 Jun 2011 17:57:24 +0000 (19:57 +0200)]
current-language really defaults to Scheme.

* module/system/base/language.scm (current-language): Default to 'scheme
  here, rather than relying on *current-language* always being bound.

Thanks to 亚光唐 <texnician@gmail.com> for the report.

13 years agofix invalid transformation of (values x) -> x, (+ x) -> x, etc
Andy Wingo [Fri, 17 Jun 2011 17:30:31 +0000 (19:30 +0200)]
fix invalid transformation of (values x) -> x, (+ x) -> x, etc

* module/language/tree-il/primitives.scm (+, *, cons*): In the case of
  just one argument (the identity case), expand to (values x) instead of
  just x.  Fixes values truncation in that case.
  (values): Likewise remove (values x) -> x translation, as the compiler
  will do it for us, and this fixes (values (values 1 2)).

* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Handle
  `values' in a push context here.

* test-suite/tests/tree-il.test ("values"): Add some tests.

13 years agoadd -Wformat to %auto-compilation-options
Andy Wingo [Fri, 17 Jun 2011 17:16:16 +0000 (19:16 +0200)]
add -Wformat to %auto-compilation-options

* module/ice-9/boot-9.scm (%auto-compilation-options): Add -Wformat to
  the default warning set.

13 years agobetter messages on failed autocompilation
Andy Wingo [Fri, 17 Jun 2011 16:08:06 +0000 (18:08 +0200)]
better messages on failed autocompilation

* libguile/load.c (auto_compile_catch_handler):
* module/ice-9/boot-9.scm (load-in-vicinity): Nicer messages when
  autocompilation fails.

13 years agofix self tail recursion to different case-lambda clauses
Andy Wingo [Fri, 17 Jun 2011 15:08:06 +0000 (17:08 +0200)]
fix self tail recursion to different case-lambda clauses

http://savannah.gnu.org/bugs/?33362

* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Rename
  from flatten, as it really just takes a particular case.  Instead of
  iteratively compiling lambda cases through `comp', tail-call through
  flatten-lambda-case.  This allows code to see which case it's being
  compiled in.  Take advantage of that to limit the self-tail-call
  optimization to self-calls to the same case -- otherwise we might be
  jumping to a label without having reserved the right number of
  locals.
  (flatten-lambda): Adapt the caller.

* test-suite/tests/compiler.test ("case-lambda"): Add a test.

13 years agofix AC_LANG_SOURCE warnings
Andy Wingo [Fri, 17 Jun 2011 09:37:11 +0000 (11:37 +0200)]
fix AC_LANG_SOURCE warnings

* configure.ac: Fix annoying AC_LANG_SOURCE warnings.

13 years agocheck for clock_getcpuclockid in gl_CLOCK_TIME
Andy Wingo [Fri, 20 May 2011 16:48:33 +0000 (18:48 +0200)]
check for clock_getcpuclockid in gl_CLOCK_TIME

* acinclude.m4 (gl_CLOCK_TIME): It could be that clock_gettime is in
  libc but clock_getcpuclockid is not, so check for that explicitly.

13 years agoSilence warnings for variables created by `generate-temporaries'
Andreas Rottmann [Fri, 17 Jun 2011 08:38:47 +0000 (10:38 +0200)]
Silence warnings for variables created by `generate-temporaries'

* module/ice-9/psyntax.scm (generate-temporaries): Give temporaries the
  current module, so that they may be bound at the top level.

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

13 years agoremove win32-dirent.[ch]
Andy Wingo [Thu, 16 Jun 2011 22:20:56 +0000 (00:20 +0200)]
remove win32-dirent.[ch]

* libguile/win32-dirent.c:
* libguile/win32-dirent.h: Remove these files.  MinGW has opendir and
  readdir support, I hear.

* configure.ac:
* libguile/filesys.c:
* libguile/Makefile.am: Adapt.

13 years agomingw: use $APPDATA as a possible root for cachedir.
Jan Nieuwenhuizen [Tue, 15 Feb 2011 15:35:03 +0000 (16:35 +0100)]
mingw: use $APPDATA as a possible root for cachedir.

* libguile/load.c (scm_init_load_path) [MINGW32]: Fall back to using
$LOCALAPPDATA or $APPDATA if $XDG_CACHE_HOME and $HOME aren't set.

13 years agoadd `rename' gnulib module
Andy Wingo [Thu, 16 Jun 2011 21:43:44 +0000 (23:43 +0200)]
add `rename' gnulib module

This should fix `rename' on mingw32.

13 years agoFix several POSIX functions to use the locale encoding
Mark H Weaver [Thu, 16 Jun 2011 19:07:30 +0000 (15:07 -0400)]
Fix several POSIX functions to use the locale encoding

* libguile/strings.c (scm_i_allocate_string_pointers): Encode strings
  using the current locale.  Previously, Latin-1 was used.  Indirectly,
  this affects the encoding of strings in `system*', `execl', `execlp',
  `execle', `environ', and `dynamic-args-call'.

  (scm_makfromstrs): In header comment, clarify that the C strings are
  interpreted according to the current locale encoding.

* NEWS: Add NEWS entry.

13 years agoO_CLOEXEC usage
Andy Wingo [Thu, 16 Jun 2011 16:27:57 +0000 (18:27 +0200)]
O_CLOEXEC usage

* libguile/objcodes.c (scm_load_objcode):
* libguile/scmsigs.c (start_signal_delivery_thread):
* libguile/threads.c (guilify_self_1): Use O_CLOEXEC.

13 years agognulib update
Andy Wingo [Thu, 16 Jun 2011 16:22:50 +0000 (18:22 +0200)]
gnulib update

Added pipe2 and open modules, to get O_CLOEXEC.

* libguile/Makefile.am (guile_filter_doc_snarfage$(EXEEXT)): Add gnulib
  here, in the native build case, for rpl_fflush if needed.

foo

13 years agofix initial values of reallocated fluids
Andy Wingo [Thu, 16 Jun 2011 17:35:14 +0000 (19:35 +0200)]
fix initial values of reallocated fluids

* libguile/threads.h:
* libguile/threads.c (scm_i_reset_fluid): New internal function, resets
  the binding of a fluid for all threads.  Needed for fluid GC.

* libguile/fluids.c (new_fluid): Call scm_i_reset_fluid here.

13 years agomore NEWS
Andy Wingo [Thu, 16 Jun 2011 13:59:19 +0000 (15:59 +0200)]
more NEWS

* NEWS: More updates.

13 years agoupdate NEWS
Andy Wingo [Thu, 16 Jun 2011 11:29:17 +0000 (13:29 +0200)]
update NEWS

* NEWS: Update for 2.0.2.

13 years agoadd docs for shift and reset
Andy Wingo [Thu, 16 Jun 2011 11:01:43 +0000 (13:01 +0200)]
add docs for shift and reset

* doc/ref/api-control.texi (Prompt Primitives): Break call-with-prompt
  and abort-to-prompt out into a subsubsection.
  (Shift and Reset): New subsubsection.

13 years agofix hash-set! on weak tables
Andy Wingo [Thu, 16 Jun 2011 10:06:43 +0000 (12:06 +0200)]
fix hash-set! on weak tables

* test-suite/tests/weaks.test: Add tests.
* libguile/hashtab.c (scm_hash_fn_set_x): Fix updates to weak-value hash
  tables to not deadlock inside the alloc lock.

13 years agoFix likely crash in `stable-sort!'
Andreas Rottmann [Thu, 9 Jun 2011 20:11:02 +0000 (22:11 +0200)]
Fix likely crash in `stable-sort!'

* libguile/sort.c (scm_stable_sort_x): Properly handle zero-length
  vectors.
* test-suite/tests/sort.test ("stable-sort"): Add test for this case.