bpt/guile.git
12 years agoMerge remote-tracking branch 'local-2.0/stable-2.0'
Andy Wingo [Fri, 17 Jun 2011 22:45:19 +0000 (00:45 +0200)]
Merge remote-tracking branch 'local-2.0/stable-2.0'

Conflicts:
module/ice-9/psyntax-pp.scm
module/language/tree-il/compile-glil.scm

12 years agofix tree-il->scheme bug for seq
Andy Wingo [Fri, 17 Jun 2011 22:38:52 +0000 (00:38 +0200)]
fix tree-il->scheme bug for seq

* module/language/tree-il.scm (tree-il->scheme): Fix bug for `seq'.

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

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

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

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

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

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

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

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

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

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

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

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

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

12 years agoMerge remote-tracking branch 'local-2.0/stable-2.0'
Andy Wingo [Thu, 16 Jun 2011 18:01:56 +0000 (20:01 +0200)]
Merge remote-tracking branch 'local-2.0/stable-2.0'

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

12 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

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

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

* NEWS: More updates.

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

* NEWS: Update for 2.0.2.

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

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

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

12 years agodoc: Mention the former name of `guild'.
Ludovic Courtès [Wed, 8 Jun 2011 21:19:37 +0000 (23:19 +0200)]
doc: Mention the former name of `guild'.

* doc/ref/scheme-using.texi (Using Guile Tools): Add a footnote
  mentioning that `guild' used to be `guile-tools'.

* doc/ref/tools.texi (Executable Modules): Nitpicks.

12 years agoMerge remote-tracking branch 'local-2.0/stable-2.0'
Andy Wingo [Thu, 2 Jun 2011 20:49:33 +0000 (22:49 +0200)]
Merge remote-tracking branch 'local-2.0/stable-2.0'

Conflicts:
meta/Makefile.am

12 years agosequence of expressions -> seq of head and tail
Andy Wingo [Thu, 2 Jun 2011 17:13:32 +0000 (19:13 +0200)]
sequence of expressions -> seq of head and tail

* libguile/expand.h:
* module/language/tree-il.scm: Rename "sequence" to "seq", and instead
  of taking a list of expressions, take a head and a tail.

* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/spec.scm:
* module/language/elisp/compile-tree-il.scm:
* module/ice-9/psyntax.scm:
* module/ice-9/psyntax-pp.scm:
* module/ice-9/eval.scm:
* libguile/memoize.h:
* libguile/memoize.c:
* libguile/expand.c:
* libguile/eval.c: Adapt to the new seq format.

12 years agoadd <primcall> to tree-il
Andy Wingo [Thu, 2 Jun 2011 15:41:45 +0000 (17:41 +0200)]
add <primcall> to tree-il

* libguile/expand.c:
* libguile/expand.h (SCM_EXPANDED_PRIMCALL_TYPE_NAME):
  (SCM_EXPANDED_PRIMCALL_FIELD_NAMES):
  (SCM_EXPANDED_PRIMCALL_SRC):
  (SCM_EXPANDED_PRIMCALL_NAME):
  (SCM_EXPANDED_PRIMCALL_ARGS):
  (SCM_MAKE_EXPANDED_PRIMCALL): Add "primcall" Tree-IL type.

* doc/ref/compiler.texi (Tree-IL): Update docs.

* libguile/memoize.c (memoize): Memoizer for primcalls.

* module/ice-9/psyntax.scm: Build primcalls, sometimes.  Also change
  build-primref to just make a primitive-ref.

* module/language/tree-il.scm: Add primcall to the exports, parsers,
  serializers, etc.

* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/inline.scm:
* module/language/tree-il/primitives.scm:
* module/language/elisp/compile-tree-il.scm: Add primcall support.

* test-suite/tests/tree-il.test: Use primcalls sometimes.

12 years agorename <application> to <call>
Andy Wingo [Thu, 2 Jun 2011 11:42:55 +0000 (13:42 +0200)]
rename <application> to <call>

* doc/ref/compiler.texi (The Scheme Compiler): Update docs.

* libguile/expand.h:
* libguile/expand.c:
* module/language/tree-il.scm: Rename <application> to <call>.  Change
  the external representation from (apply proc arg ...) to (call proc
  arg ...).

* libguile/memoize.c:
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm:
* module/language/brainfuck/compile-tree-il.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/inline.scm:
* module/language/tree-il/primitives.scm:
* test-suite/tests/tree-il.test: Update all callers.

12 years agoadd guild docs
Andy Wingo [Tue, 31 May 2011 20:36:52 +0000 (22:36 +0200)]
add guild docs

* doc/ref/scheme-using.texi (Using Guile Tools): Add some optimistic
  guild docs.

12 years agorename `guile-tools' to `guild'
Andy Wingo [Mon, 30 May 2011 21:02:03 +0000 (23:02 +0200)]
rename `guile-tools' to `guild'

* configure.ac: Look for ln -s.  Write out `guild' instead of
  `guile-tools'.

* meta/Makefile.am (install-data-hook): Link the installed `guild' to
  the backward-compatible `guile-tools' name.
  (bin_SCRIPTS, EXTRA_DIST): Fix up for guild change.

* meta/guild.in: Moved here from `guile-tools.in'.

* doc/ref/Makefile.am (autoconf-macros.texi):
* doc/ref/api-evaluation.texi (Compilation):
* doc/ref/autoconf.texi (Autofrisk, Using Autofrisk):
* doc/ref/mod-getopt-long.texi (getopt-long Reference):
* doc/ref/tools.texi (Miscellaneous Tools, Executable Modules): Minimal
  doc update.

* .gitignore:
* am/guilec (.scm.go):
* libguile/Makefile.am (snarf2checkedtexi):
* module/Makefile.am (ice-9/psyntax-pp.go): Update makefiles, etc.

* module/scripts/README:
* module/scripts/lint.scm:
* module/scripts/list.scm: Update commentaries.

12 years agowrite-objcode uses target-endianness, target-word-size
Andy Wingo [Mon, 30 May 2011 20:18:48 +0000 (22:18 +0200)]
write-objcode uses target-endianness, target-word-size

* libguile/_scm.h (SCM_OBJCODE_ENDIANNESS_OFFSET):
  (SCM_OBJCODE_WORD_SIZE_OFFSET): New defines.
* libguile/objcodes.c (scm_write_objcode): Use target-endianness and
  target-word-size when writing the objcode cookie.

12 years agocompile-bytecode uses target-endianness
Andy Wingo [Fri, 27 May 2011 11:29:45 +0000 (13:29 +0200)]
compile-bytecode uses target-endianness

* module/language/assembly/compile-bytecode.scm (compile-bytecode):
  Use target-endianness, from (system base target).

12 years agoadd (system base target)
Andy Wingo [Mon, 30 May 2011 19:28:30 +0000 (21:28 +0200)]
add (system base target)

* module/Makefile.am:
* module/system/base/target.scm: Add a minimal module to parameterize
  the target system type and inspect properties on it like cpu, vendor,
  os, endianness, and word size.

12 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Mon, 30 May 2011 09:50:38 +0000 (11:50 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

12 years agofix subtle and bad scm_internal_hash_fold bug for weak tables
Andy Wingo [Mon, 30 May 2011 09:33:10 +0000 (11:33 +0200)]
fix subtle and bad scm_internal_hash_fold bug for weak tables

* libguile/hashtab.c (scm_internal_hash_fold): Don't try to unlink
  deleted weak pairs.  Our previous code was buggy (`prev' should have
  only been updated in the case of a successful traversal), but more
  than that, we're not in the alloc lock.

  Thanks very much to Michael Wells for the report, and the debugging!

12 years agoTweak R6RS transcoded ports flushing
Andreas Rottmann [Fri, 27 May 2011 14:09:04 +0000 (16:09 +0200)]
Tweak R6RS transcoded ports flushing

* libguile/r6rs-ports.c (tp_flush): Only operate on the underlying port
  when it is open.

12 years agornrs io ports: fix port encoding when opening file ports
Andreas Rottmann [Fri, 27 May 2011 13:32:01 +0000 (15:32 +0200)]
rnrs io ports: fix port encoding when opening file ports

* module/rnrs/io/ports.scm (open-file-input-port)
  (open-file-output-port): Ensure the resulting ports are binary when no
  transcoder is specified.

* test-suite/tests/r6rs-ports.test: Remove superfluous global change of
  `%default-port-encoding' and accompanying comment.
  ("7.2.7 Input Ports"): Add test ensuring `open-file-input-port' opens
  a binary port when no transcoder is specified.
  ("8.2.10 Output ports"): Strengthen existing `open-file-output-port'
  binary-ness test by setting `%default-port-encoding' to "UTF-8".

12 years agoAdd some tests for the R6RS I/O libraries
Andreas Rottmann [Fri, 27 May 2011 12:48:31 +0000 (14:48 +0200)]
Add some tests for the R6RS I/O libraries

* test-suite/tests/r6rs-ports.test
  (call-with-bytevector-output-port/transcoded): New helper procedure.
  ("8.2.6 Input and output ports"): Use that helper procedure.
  (encoding-error-predicate): New helper procedure.
  ("8.2.12 Textual Output"): Add tests for `put-char' and `put-string'
  exception behavior on encoding errors.

12 years agoDoc for getopt-long's new stop-at-first-non-option option
Neil Jerram [Thu, 26 May 2011 21:02:16 +0000 (22:02 +0100)]
Doc for getopt-long's new stop-at-first-non-option option

* doc/ref/mod-getopt-long.texi (getopt-long): Mention optional keyword
  parameters.

  (getopt-long Reference): Document #:stop-at-first-non-option.

12 years agoRemove unused script-getopt.texi
Neil Jerram [Thu, 26 May 2011 20:30:05 +0000 (21:30 +0100)]
Remove unused script-getopt.texi

* doc/ref/Makefile.am (guile_TEXINFOS): Remove script-getopt.texi.

* doc/ref/script-getopt.texi: Deleted.  This file wasn't included in
  the manual, and its content is now duplicated identically in
  scheme-scripts.texi.

12 years agoEmit a 1-based line number in error messages
Neil Jerram [Thu, 12 May 2011 22:16:05 +0000 (23:16 +0100)]
Emit a 1-based line number in error messages

* module/ice-9/boot-9.scm (exception-printers): Add 1 to the 0-based
  line number.

12 years agoReveal guile-tools's inner simplicity...
Neil Jerram [Sun, 8 May 2011 21:51:07 +0000 (22:51 +0100)]
Reveal guile-tools's inner simplicity...

...by not using its own-rolled getopt, and moving the `list' function
to a separate script

* meta/guile-tools.in: Use (ice-9 getopt-long).

  (directory-files, strip-extensions, unique, find-submodules,
  list-scripts): Deleted (and moved to new `list.scm' file).

  (getopt): Deleted.

  (main): Use getopt-long.  Default to calling the `list' script if no
  script is specified.

* module/scripts/list.scm: New script.

* module/Makefile.am (SCRIPTS_SOURCES): Add list.scm.

12 years agoImplement #:stop-at-first-non-option option for getopt-long
Neil Jerram [Sun, 8 May 2011 21:21:51 +0000 (22:21 +0100)]
Implement #:stop-at-first-non-option option for getopt-long

(For use by guile-tools)

* module/ice-9/getopt-long.scm: Use (ice-9 optargs) so we can use
  define*.

  (process-options): Add stop-at-first-non-option parameter.  When
  this is true, stop processing when we hit a non-option (so long as
  that non-option isn't something that resulted from the unclumping of
  a short option group).

  (getopt-long): Add #:stop-at-first-non-option keyword; pass it on to
  process-options.

* test-suite/tests/getopt-long.test ("stop-at-first-non-option"): New
  test (for the above).

12 years agoHandle short option unclumping progressively, instead of all upfront
Neil Jerram [Thu, 26 May 2011 16:38:41 +0000 (17:38 +0100)]
Handle short option unclumping progressively, instead of all upfront

This is needed as a prerequisite for the following change that
introduces the stop-at-first-non-option option, because when that
option is used we don't know upfront how far through the command
line we should proceed with unclumping.

* module/ice-9/getopt-long.scm (expand-clumped-singles): Delete.

  (process-options): Add a loop variable to indicate how many elements
  at the start of `argument-ls' are known not to be clumped.  When we
  see a short option and this variable is <= 0, perform unclumping
  (using code that used to be in expand-clumped-singles) and loop with
  the variable > 0.

  (getopt-long): Don't call expand-clumped-singles upfront here.

12 years agoSimplify getopt-long handling of option values, esp with multiple occurrences
Neil Jerram [Sun, 8 May 2011 20:52:01 +0000 (21:52 +0100)]
Simplify getopt-long handling of option values, esp with multiple occurrences

Basically, accumulate values in the `process-options' loop variables,
instead of using set-option-spec-value!

* module/ice-9/getopt-long.scm (option-spec): Delete the `value' slot.

  (process-options): Delete `val!loop' and just use `loop' everywhere
  instead.  When adding an option spec to `found', add the
  corresponding value too; hence `found' becomes an alist, where it
  was previously a list of specs.

  (getopt-long): Use assq-ref to get values out of `found'.  Remove
  unhittable error condition for detecting an option that requires an
  explicit value, where a value wasn't supplied.  This condition is
  actually caught and handled in `process-options'.  Rewrite the end
  of the procedure much more simply.

12 years agoFix "occurrances" typos in getopt-long code and test
Neil Jerram [Sun, 8 May 2011 20:36:54 +0000 (21:36 +0100)]
Fix "occurrances" typos in getopt-long code and test

* module/ice-9/getopt-long.scm (process-options, getopt-long): Change
  to "occurrences".

* test-suite/tests/getopt-long.test ("multiple occurrences"): Same
  again.

12 years agoremove gc pthread redirects entirely
Andy Wingo [Thu, 26 May 2011 16:43:09 +0000 (18:43 +0200)]
remove gc pthread redirects entirely

* libguile/pthread-threads.h: As an experiment, just define
  scm_i_pthread_create et al to their pthread_* functions, instead of
  the GC_ ones.  It seems sufficient, given that all uses of Guile have
  to go through scm_with_guile anyway...  Passes tests on my machine.
  Committing to give buildbots a go at it.

12 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Thu, 26 May 2011 16:30:37 +0000 (18:30 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

12 years agoleave guile when reading signal pipe
Andy Wingo [Thu, 26 May 2011 16:29:05 +0000 (18:29 +0200)]
leave guile when reading signal pipe

* libguile/scmsigs.c (read_signal_pipe_data, signal_delivery_thread):
  Leave guile when reading from the signal pipe.  Hopefully that lets GC
  know not to wake up this thread.

12 years agolazily init futures worker pool
Andy Wingo [Thu, 26 May 2011 16:14:32 +0000 (18:14 +0200)]
lazily init futures worker pool

* module/ice-9/futures.scm (%workers, %create-workers!)
  (create-workers!): Define a mechanism to spawn off the future threads
  only when the first future is created.
  (make-future): Call create-workers! here.

12 years agoscm_new_smob, scm_new_double_smob inline functions
Andy Wingo [Thu, 26 May 2011 14:49:47 +0000 (16:49 +0200)]
scm_new_smob, scm_new_double_smob inline functions

* libguile/smob.h (scm_new_smob, scm_new_double_smob): New constructors,
  which do what SCM_NEWSMOB / SCM_NEWSMOB3 had done, but with inline
  functions instead of macros.  They also bail to scm_i_new_smob /
  scm_i_new_double_smob in either the mark or the free case, so that the
  inline definition doesn't reference other internal details like libgc
  stuff.
  (SCM_SMOB_TYPE_MASK et al): Move definitions up so the new_smob see
  them as already being declared.
  (SCM_NEWSMOB, SCM_RETURN_NEWSMOB, SCM_NEWSMOB2, SCM_RETURN_NEWSMOB2):
  (SCM_NEWSMOB3, SCM_RETURN_NEWSMOB3): Reimplement in terms of the new
  inline functions.
  (scm_i_finalize_smob): Remove declaration, as it's no longer needed or
  used.
  Remove now-unneeded bdw-gc include.

* libguile/smob.c (finalize_smob): Rename from scm_i_finalize_smob, and
  make static.
  (scm_i_new_smob, scm_i_new_double_smob): Slow-path allocators.

* libguile/inline.c: Include smob.h, so as to reify scm_new_smob and
  scm_new_double_smob.

12 years agoscm_cell, scm_double_cell, scm_words back to gc.h
Andy Wingo [Thu, 26 May 2011 14:08:02 +0000 (16:08 +0200)]
scm_cell, scm_double_cell, scm_words back to gc.h

* libguile/inline.h:
* libguile/gc.h (scm_cell, scm_double_cell, scm_words): Move
  declarations and definitions back here, from inline.h.  It's more
  natural.

* libguile/inline.c: Include gc.h as well.

12 years agosimplify inline function infrastructure
Andy Wingo [Thu, 26 May 2011 13:53:02 +0000 (15:53 +0200)]
simplify inline function infrastructure

* libguile/__scm.h (SCM_C_EXTERN_INLINE): Move this definition here,
  from inline.h.  We'd like to support inline function definitions in
  more header files: not just inline.h.
  (SCM_CAN_INLINE, SCM_INLINE, SCM_INLINE_IMPLEMENTATION): New
  definitions.

* libguile/gc.h (SCM_GC_MALLOC, SCM_GC_MALLOC_POINTERLESS): Define these
  wrappers, which redirect to the GC_MALLOC macros when building Guile,
  and the scm_gc_malloc functions otherwise.  A step towards getting
  BDW-GC out of Guile's API.

* libguile/inline.h: Simplify, using SCM_INLINE,
  SCM_INLINE_IMPLEMENTATION, and SCM_IMPLEMENT_INLINES.  Also use the
  new SCM_GC_MALLOC macros.

12 years agoMerge remote-tracking branch 'local-2.0/stable-2.0'
Andy Wingo [Thu, 26 May 2011 15:03:23 +0000 (17:03 +0200)]
Merge remote-tracking branch 'local-2.0/stable-2.0'

12 years agoremove scm_newcell_count, scm_newcell2_count
Andy Wingo [Thu, 26 May 2011 13:58:42 +0000 (15:58 +0200)]
remove scm_newcell_count, scm_newcell2_count

* libguile/inline.h:
* libguile/gc.c: Remove declaration and definition of unused
  "scm_newcell_count" and "scm_newcell2_count".  Since SCM_INTERNAL is
  "extern", these symbols were not externally visible anyway, at least
  under Linux or Windows.

12 years agodeprecate scm_immutable_{double_,}cell
Andy Wingo [Thu, 26 May 2011 10:34:30 +0000 (12:34 +0200)]
deprecate scm_immutable_{double_,}cell

* libguile/inline.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_immutable_cell, scm_immutable_double_cell):
  Deprecate these, as the GC_STUBBORN API doesn't do anything any more.

* libguile/strings.c (scm_i_c_make_symbol): Change the one use of
  scm_immutable_double_cell to scm_double_cell.

12 years agoClarify docs for SCM_UNSPECIFIED: used sometimes but not always
Mark H Weaver [Wed, 25 May 2011 16:31:21 +0000 (12:31 -0400)]
Clarify docs for SCM_UNSPECIFIED: used sometimes but not always

* doc/ref/data-rep.texi (Immediate objects): Clarify the description
  of SCM_UNSPECIFIED.  It is returned by some (but not all) expressions
  whose value is unspecified by the Scheme standard.

12 years agoMerge remote-tracking branch 'origin/stable-2.0'
Andy Wingo [Wed, 25 May 2011 08:32:19 +0000 (10:32 +0200)]
Merge remote-tracking branch 'origin/stable-2.0'

Conflicts:
libguile/procprop.c

12 years agoout-of-tree build fix
Andy Wingo [Wed, 25 May 2011 08:27:46 +0000 (10:27 +0200)]
out-of-tree build fix

* test-suite/standalone/Makefile.am (GUILE_AUTO_COMPILE): Add srcdir to
  the environment.
* test-suite/standalone/test-import-order: Look for the modules in the
  srcdir.  Fixes out-of-tree builds.

12 years agothreadsafe addition to the goops vtable_class_map
Andy Wingo [Tue, 24 May 2011 20:52:39 +0000 (22:52 +0200)]
threadsafe addition to the goops vtable_class_map

* libguile/goops.c (scm_i_define_class_for_vtable): Lock around
  additions to the vtable_class_map.  Use is unlocked though; solving
  GOOPS parallel-initialization would be a good thing.

12 years agothreadsafe access to source properties weak hash table
Andy Wingo [Tue, 24 May 2011 20:46:09 +0000 (22:46 +0200)]
threadsafe access to source properties weak hash table

* libguile/srcprop.c: Add a lock around scm_source_whash, and use it.

12 years agoread + source properties simplification
Andy Wingo [Tue, 24 May 2011 19:25:11 +0000 (21:25 +0200)]
read + source properties simplification

* libguile/srcprop.h: Remove internal scm_source_whash declaration.
* libguile/srcprop.c (scm_i_set_source_properties_x)
  (scm_i_has_source_properties): New helpers.
  (scm_source_whash): Make static.

* libguile/read.c (scm_read_sexp): Remove register declarations here;
  let's trust the compiler.  Remove code to incrementally build up a
  copy; instead let's let scm_i_set_source_properties_x handle copying
  the expression if needed.
  (scm_read_quote, scm_read_syntax): Use scm_i_set_source_properties_x.
  (recsexpr): Remove this helper from 1996.
  (scm_read_sharp_extension): Instead of trying to recursively label
  sharp-read subforms with source properties, just label the outside
  form and rely on the macro-expander to propagate it down.

12 years agosafely access the trampoline weak map
Andy Wingo [Tue, 24 May 2011 19:09:24 +0000 (21:09 +0200)]
safely access the trampoline weak map

* libguile/smob.c (scm_i_smob_apply_trampoline): Protect the trampoline
  weak map with a mutex.

12 years agoset-procedure-property! threadsafety issue
Andy Wingo [Mon, 23 May 2011 20:38:13 +0000 (22:38 +0200)]
set-procedure-property! threadsafety issue

* libguile/procprop.c (scm_set_procedure_property_x): Fix a threadsafety
  bug pointed out by Ken Raeburn.

12 years agoreally threadsafe access to symbol table
Andy Wingo [Mon, 23 May 2011 20:24:27 +0000 (22:24 +0200)]
really threadsafe access to symbol table

* libguile/symbols.c (symbols_lock): Rename from intern_lock.
  (lookup_interned_symbol, lookup_interned_latin1_symbol): Instead of
  faith-based programming, just use the mutex.  Though I haven't seen
  this break, Ken is right!

12 years agoDon't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type
Mark H Weaver [Sun, 22 May 2011 19:23:27 +0000 (15:23 -0400)]
Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type

* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void):
  New static functions that simply call scm_lock_mutex and
  scm_unlock_mutex, respectively, but return void instead of SCM.

  (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to
  scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to
  scm_dynwind_rewind_handler_with_scm.  Previously, we passed
  scm_unlock_mutex and scm_lock_mutex (which return SCM), but the
  scm_dynwind_* functions expect pointers to functions which return
  void.  When SCM is of type union, this changes the calling conventions
  of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).

12 years agoDon't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type
Mark H Weaver [Sun, 22 May 2011 19:23:27 +0000 (15:23 -0400)]
Don't call scm_lock_mutex and scm_unlock_mutex via pointer of wrong type

* libguile/threads.c (lock_mutex_return_void, unlock_mutex_return_void):
  New static functions that simply call scm_lock_mutex and
  scm_unlock_mutex, respectively, but return void instead of SCM.

  (scm_dynwind_lock_mutex): Pass unlock_mutex_return_void to
  scm_dynwind_unwind_handler_with_scm, and lock_mutex_return_void to
  scm_dynwind_rewind_handler_with_scm.  Previously, we passed
  scm_unlock_mutex and scm_lock_mutex (which return SCM), but the
  scm_dynwind_* functions expect pointers to functions which return
  void.  When SCM is of type union, this changes the calling conventions
  of the functions on some platforms (e.g. GCC 4.5.2 and 4.5.3 on x86).

12 years agofix define-module ordering
Andy Wingo [Sat, 21 May 2011 16:29:03 +0000 (18:29 +0200)]
fix define-module ordering

* module/ice-9/boot-9.scm (define-module): Fix to load the #:use-module
  clauses in the order in which they appear in the define-module form.
  Thanks to Jan Nieuwenhuizen for the report.

* test-suite/standalone/test-import-order: Add new test that
  define-module and use-modules resolve the interface in the right
  order.

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-import-order-a.scm:
* test-suite/standalone/test-import-order-b.scm:
* test-suite/standalone/test-import-order-c.scm:
* test-suite/standalone/test-import-order-d.scm: Aux files.

12 years ago(syntax foo) -> #'foo in goops
Andy Wingo [Sat, 21 May 2011 11:12:44 +0000 (13:12 +0200)]
(syntax foo) -> #'foo in goops

* module/oop/goops.scm: Change instances of (syntax foo) to #'foo.

12 years agoclocktime freebsd portability
Andy Wingo [Fri, 20 May 2011 15:41:06 +0000 (17:41 +0200)]
clocktime freebsd portability

* libguile/stime.c (HAVE_POSIX_CPUTIME): Hack around buggy FreeBSD
  implementation of _POSIX_CPUTIME.

12 years agofix compile error in mingw fstat socket detection
Andy Wingo [Fri, 20 May 2011 10:50:08 +0000 (12:50 +0200)]
fix compile error in mingw fstat socket detection

* libguile/filesys.c (fstat_Win32) [__MINGW32__]: Apparently there is no
  _S_IFSOCK on mingw32.  Thanks to Volker Grabsch for the report.

12 years agogen-scmconfig cross-compilation fix
Andy Wingo [Fri, 20 May 2011 10:26:53 +0000 (12:26 +0200)]
gen-scmconfig cross-compilation fix

* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Fix
  cross-compilation.  Thanks to Volker Grabsch for the report!

12 years agofix documentation for option-set! syntaxen
Andy Wingo [Fri, 20 May 2011 09:54:46 +0000 (11:54 +0200)]
fix documentation for option-set! syntaxen

* doc/ref/api-evaluation.texi (Scheme Read): Note that read-set! is
  syntax.
  (Scheme Write): Likewise for print-set!.

* doc/ref/api-io.texi (Writing): Remove reference to
  print-options-interface.

* doc/ref/repl-modules.texi (Readline Options): Update, and add entries
  for readline-options, readline-set! et al.

13 years agoregexp.test needed char-code-limit
Andy Wingo [Sun, 15 May 2011 15:29:46 +0000 (17:29 +0200)]
regexp.test needed char-code-limit

* test-suite/tests/regexp.test (char-code-limit): Define a local version
  of this recently removed definition.  Hopefully that's the only use
  of it though!

13 years agoremove SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE definitions
Andy Wingo [Sun, 15 May 2011 13:28:50 +0000 (15:28 +0200)]
remove SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE definitions

* libguile/__scm.h: Remove unused SCM_EXIT_SUCCESS and SCM_EXIT_FAILURE
  definitions.

13 years agouse of EXIT_SUCCESS and EXIT_FAILURE
Andy Wingo [Sun, 15 May 2011 13:27:30 +0000 (15:27 +0200)]
use of EXIT_SUCCESS and EXIT_FAILURE

* libguile/threads.c (scm_init_guile):
* libguile/throw.c (scm_exit_status): Use EXIT_SUCCESS and EXIT_FAILURE
  instead of 0 and 1.

13 years agoscm_wta_* procedures replace SCM_WTA_* macros
Andy Wingo [Sun, 15 May 2011 13:18:18 +0000 (15:18 +0200)]
scm_wta_* procedures replace SCM_WTA_* macros

* libguile/__scm.h: Move all the SCM_WTA and SCM_GASSERT macros out of
  here.  Also remove the scm_call_generic declarations.
* libguile/deprecated.h (SCM_WTA_DISPATCH_0, SCM_WTA_DISPATCH_1):
  (SCM_WTA_DISPATCH_2, SCM_WTA_DISPATCH_N): Deprecate.  See below for
  their replacements.
  (SCM_GASSERT0, SCM_GASSERT1, SCM_GASSERT2, SCM_GASSERTn): Deprecate
  these too.
  (SCM_WTA_DISPATCH_1_SUBR): Deprecate this strange thing.
  (scm_call_generic_0, scm_call_generic_1, scm_call_generic_2):
  (scm_call_generic_3, scm_apply_generic): Remove, indicating their
  replacements.

* libguile/print.c (iprin1):
* libguile/eq.c (scm_equal_p): Use scm_call_2 instead of
  scm_call_generic_2.

* libguile/goops.h:
* libguile/goops.c: Remove scm_{call,apply}_generic definitions.
  (scm_wta_dispatch_0, scm_wta_dispatch_1, scm_wta_dispatch_2):
  (scm_wta_dispatch_n): New procedures, replacing the SCM_WTA macros.

* libguile/numbers.c (scm_lcm):
* libguile/procs.c (scm_setter): Remove uses of SCM_GASSERT.

* libguile/numbers.c (scm_lcm):
* libguile/procs.c (scm_setter):
* libguile/vectors.c: Use the procedural scm_wta routines instead of the
  SCM_WTA macros.

13 years agoSCM_ASSERT to error.h
Andy Wingo [Sun, 15 May 2011 11:34:07 +0000 (13:34 +0200)]
SCM_ASSERT to error.h

* libguile/error.h (SCM_ASSERT, SCM_ASSERT_TYPE): Move definition here.
  Remove SCM_RECKLESS case.
* libguile/__scm.h: (From here.)

13 years agoremove SCM_ASRTGO
Andy Wingo [Sun, 15 May 2011 11:29:45 +0000 (13:29 +0200)]
remove SCM_ASRTGO

* libguile/__scm.h (SCM_ASRTGO): Remove unused macro.

13 years agoremove unused SCM_FENCE definition
Andy Wingo [Sun, 15 May 2011 11:22:25 +0000 (13:22 +0200)]
remove unused SCM_FENCE definition

* libguile/__scm.h (SCM_FENCE): Remove unused definition.

13 years agorename scm_async_click() to scm_async_tick(); privatize SCM_ASYNC_TICK
Andy Wingo [Sun, 15 May 2011 11:11:03 +0000 (13:11 +0200)]
rename scm_async_click() to scm_async_tick(); privatize SCM_ASYNC_TICK

* libguile/_scm.h (SCM_ASYNC_TICK, SCM_ASYNC_TICK_WITH_CODE): Make these
  definitions private.  Call the tick() function instead of click().

* libguile/__scm.h:
* libguile/async.h (scm_async_tick): Move declaration here.  Remove
  scm_async_click declaration.  Tick is the new (and old!) click, you
  see.
  (SCM_CRITICAL_SECTION_END): Call tick() instead of click().

* libguile/async.c (scm_async_tick): Remove old definition, and rename
  scm_async_click to scm_async_tick.
  (decrease_block): Adapt to click() -> tick() name change.

* libguile/deprecated.h (scm_async_click, SCM_ASYNC_TICK): Define some
  GONE macros.

* libguile/threads.c (fat_mutex_unlock): Tick() instead of click().

13 years agosimplify SCM_TICK
Andy Wingo [Sun, 15 May 2011 11:20:56 +0000 (13:20 +0200)]
simplify SCM_TICK

* libguile/__scm.h (SCM_TICK): Define to simply scm_async_tick (or
  SCM_ASYNC_TICK when building Guile).

13 years agoremove SCM_THREAD_SWITCHING_CODE
Andy Wingo [Sun, 15 May 2011 11:16:37 +0000 (13:16 +0200)]
remove SCM_THREAD_SWITCHING_CODE

* libguile/deprecated.h (SCM_THREAD_SWITCHING_CODE):
* libguile/threads.h: Remove SCM_THREAD_SWITCHING_CODE, adding in a
  deprecation note.

* libguile/__scm.h (SCM_TICK): Remove SCM_THREAD_SWITCHING_CODE.

13 years agomake SCM_I_SETJMP and SCM_I_LONGJMP private
Andy Wingo [Sun, 15 May 2011 10:28:55 +0000 (12:28 +0200)]
make SCM_I_SETJMP and SCM_I_LONGJMP private

* libguile/_scm.h (SCM_I_SETJMP, SCM_I_LONGJMP): Move to this private
  header.
* libguile/__scm.h (scm_i_jmp_buf): Only define the scm_i_jmp_buf type
  in this public header.

13 years agomove SCM_FLUSH_REGISTER_WINDOWS to continuations.c
Andy Wingo [Sun, 15 May 2011 10:09:20 +0000 (12:09 +0200)]
move SCM_FLUSH_REGISTER_WINDOWS to continuations.c

* libguile/continuations.c: Move SCM_FLUSH_REGISTER_WINDOWS define
  here...
* libguile/__scm.h: ...from here.

13 years agominor __scm.h cleanup
Andy Wingo [Sun, 15 May 2011 10:06:41 +0000 (12:06 +0200)]
minor __scm.h cleanup

* libguile/__scm.h: Clean up setjmp/longjmp portability defines.

13 years agoremove mention of cheap continuations
Andy Wingo [Sun, 15 May 2011 09:34:38 +0000 (11:34 +0200)]
remove mention of cheap continuations

* libguile/__scm.h: Inline an #ifndef CHEAP_CONTINUATIONS block for
  VMS, as we always have full continuations.

* libguile/feature.c (scm_init_feature): Don't bother defining the
  "full-continuation" feature.

13 years agoremove SCM_I_LLONG and SCM_I_ULLONG limit defines
Andy Wingo [Sun, 15 May 2011 09:27:52 +0000 (11:27 +0200)]
remove SCM_I_LLONG and SCM_I_ULLONG limit defines

* test-suite/standalone/test-num2integral.c (test_long_long):
  (test_ulong_long): Replace SCM_I_LLONG and SCM_I_ULLONG defines with
  their counterparts from limits.h.

* libguile/__scm.h: Remove SCM_I_LLONG and SCM_I_ULLONG limit defines.

13 years agoremove SCM_I_SIZE limits defines
Andy Wingo [Sun, 15 May 2011 09:23:22 +0000 (11:23 +0200)]
remove SCM_I_SIZE limits defines

* libguile/__scm.h: Remove defines for SCM_I_SIZE_MAX, SCM_I_SSIZE_MIN,
  and SCM_I_SSIZE_MAX, as there is no longer a scm_t_size / scm_size_t
  type.
* libguile/bytevectors.c (make_bytevector): Replace a use of
  SCM_I_SIZE_MAX with ((size_t) -1).

13 years agoremove SCM_CHAR_CODE_LIMIT define
Andy Wingo [Sun, 15 May 2011 09:13:03 +0000 (11:13 +0200)]
remove SCM_CHAR_CODE_LIMIT define

* libguile/__scm.h: Remove SCM_CHAR_CODE_LIMIT define.
* libguile/feature.c (scm_init_feature): Remove char-code-limit define,
  which was sure to be 256: a bogus value.

13 years agoremove more unused __scm.h options
Andy Wingo [Sun, 15 May 2011 09:10:06 +0000 (11:10 +0200)]
remove more unused __scm.h options

* libguile/__scm.h: Remove unused SCM_DEBUG_MARKING_API,
  SCM_DEBUG_INTERRUPTS, and SCM_DEBUG_DEBUGGING_SUPPORT defines.

13 years agoremove mention of GUILE_DEBUG_FREELIST
Andy Wingo [Sun, 15 May 2011 09:00:17 +0000 (11:00 +0200)]
remove mention of GUILE_DEBUG_FREELIST

* libguile/__scm.h: Remove commented-out GUILE_DEBUG_FREELIST define.
* libguile/gen-scmconfig.c: Remove mention of GUILE_DEBUG_FREELIST.

13 years agoremove #define STACK_CHECKING from __scm.h.
Andy Wingo [Sun, 15 May 2011 08:58:24 +0000 (10:58 +0200)]
remove #define STACK_CHECKING from __scm.h.

* libguile/__scm.h: Remove #define STACK_CHECKING and #undef
  NO_CEVAL_STACK_CHECKING.

* libguile/debug.c (scm_debug_options)
* libguile/init.c (scm_i_init_guile):
* libguile/stackchk.c (scm_report_stack_overflow):
* libguile/stackchk.h: Always enable stack checking.

13 years agoremove SICP from __scm.h
Andy Wingo [Sun, 15 May 2011 08:54:00 +0000 (10:54 +0200)]
remove SICP from __scm.h

* libguile/__scm.h: Remove #undef SICP.
* libguile/feature.c (scm_init_feature): Never add the sicp feature.

13 years agoremove ENGNOT from __scm.h
Andy Wingo [Sun, 15 May 2011 08:52:37 +0000 (10:52 +0200)]
remove ENGNOT from __scm.h

* libguile/__scm.h: Remove #undef ENGNOT.
* libguile/numbers.c (idbl2str): Remove #ifdef ENGNOT sections.

13 years agoSCM is either a union or scm_t_bits
Andy Wingo [Sun, 15 May 2011 08:49:44 +0000 (10:49 +0200)]
SCM is either a union or scm_t_bits

* libguile/tags.h: Elide the SCM_DEBUG_TYPING_STRICTNESS==1 case.
  Instead just have a flag, SCM_USING_PREHISTORIC_COMPILER, which if set
  uses what was SCM_DEBUG_TYPING_STRICTNESS==0.

* libguile/__scm.h: Remove SCM_DEBUG_TYPING_STRICTNESS block.

13 years agoSCM is a union
Andy Wingo [Fri, 13 May 2011 14:21:11 +0000 (16:21 +0200)]
SCM is a union

* libguile/tags.h (SCM): Change to simply be a union containing
  scm_t_bits.
  (SCM_PACK, SCM_UNPACK): Adapt accordingly.

13 years agofix type errors in test suite
Andy Wingo [Sun, 15 May 2011 13:32:50 +0000 (15:32 +0200)]
fix type errors in test suite

* test-suite/standalone/test-num2integral.c (out_of_range_handler): Fix
  SCM used as a truth value.
* test-suite/standalone/test-scm-spawn-thread.c (inner_main): Use
  SCM2PTR here.

13 years agoImprove R6RS conformance wrt. conditions in the I/O libraries
Andreas Rottmann [Sat, 14 May 2011 17:29:26 +0000 (19:29 +0200)]
Improve R6RS conformance wrt. conditions in the I/O libraries

* module/rnrs/io/ports.scm (open-file-output-port): Handle `no-fail'
  file option.
  (with-i/o-filename-conditions): Use `with-throw-handler' instead of `catch'.
  (with-i/o-port-error,
  with-textual-output-conditions. with-textual-input-conditions): New
  exception-conversion helpers.
  (put-char, put-datum, put-string, display): Use
  `with-textual-output-conditions' instead of `with-i/o-encoding-error'
  to get proper conditions in case of write errors.
  (get-char, get-datum, get-line, get-string-all, lookahead-char):
  Likewise, for the input case.

* test-suite/tests/r6rs-ports.test (pass-if-condition, test-file,
  make-failing-port): New helpers.
  ("8.2.10 Output ports"): Add some tests for `open-file-output-port'.
  ("8.2.9 Textual Input"): Add tests read error conditions.
  ("8.2.12 Textual Output"): Add tests for write error conditions.
  ("8.3 Simple I/O"): Add tests for conditions, `call-with-input-file'
  and `call-with-output-file'.

13 years agoBump default typing strictness to 2.
Andy Wingo [Fri, 13 May 2011 09:26:40 +0000 (11:26 +0200)]
Bump default typing strictness to 2.

* libguile/__scm.h (SCM_DEBUG_TYPING_STRICTNESS): Bump the default to
  2.