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

11 years agoguild: Gracefully handle failures to install the locale.
Ludovic Courtès [Fri, 1 Feb 2013 17:19:27 +0000 (18:19 +0100)]
guild: Gracefully handle failures to install the locale.

* meta/guild.in (main): Catch `system-error' when calling `setlocale',
  and gracefully handle any error.

11 years agoSkip FFI tests that rely on `-export-dynamic' behavior when not available.
Ludovic Courtès [Fri, 1 Feb 2013 17:17:09 +0000 (18:17 +0100)]
Skip FFI tests that rely on `-export-dynamic' behavior when not available.

* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
  finalizer", "equal? modulo finalizer (set-pointer-finalizer!)"]: Skip
  when `scm_is_pair' cannot be found, as is the case on Cygwin.
  Reported by "objc" <objcjohn@hotmail.com>.

11 years agoDo not defer expansion of internal define-syntax forms.
Mark H Weaver [Wed, 23 Jan 2013 22:49:38 +0000 (17:49 -0500)]
Do not defer expansion of internal define-syntax forms.

* module/ice-9/psyntax.scm (expand-body): As required by R6RS, evaluate
  the right-hand-sides of internal 'define-syntax' forms and add their
  transformers to the compile-time environment immediately, so that the
  newly-defined keywords may be used in definition context within the
  same lexical contour.  Fixes #13509.

11 years agoBump copyright year to 2013 in REPL greeting.
Mark H Weaver [Thu, 31 Jan 2013 05:32:57 +0000 (00:32 -0500)]
Bump copyright year to 2013 in REPL greeting.

* module/system/repl/common.scm: Add not only 2013, but also 2012 to the
  copyright notice at the top of the file, since the file was changed in
  2012.
  (*version*): Bump copyright year to 2013 in REPL greeting.

11 years agoRevert "detect and consume byte-order marks for textual ports"
Andy Wingo [Wed, 30 Jan 2013 14:30:31 +0000 (15:30 +0100)]
Revert "detect and consume byte-order marks for textual ports"

This reverts commit b2cb557d75e4daf8c7c8cd43313f4cc51d9a3f1b, which was
pushed accidentally.

11 years agoadd #:doctype-handler to xml->sxml
Andy Wingo [Wed, 30 Jan 2013 14:29:18 +0000 (15:29 +0100)]
add #:doctype-handler to xml->sxml

* module/sxml/simple.scm (read-internal-doctype-as-string): New helper.
  (xml->sxml): Add #:doctype-handler argument.

* doc/ref/sxml.texi (Reading and Writing XML): Document
  #:doctype-handler.  Fix some other examples, and fix the default value
  of #:declare-namespaces?.

* test-suite/tests/sxml.simple.test: Add all tests from the manual
  here.

11 years agoquick fix to ssax.scm
Andy Wingo [Wed, 30 Jan 2013 12:55:59 +0000 (13:55 +0100)]
quick fix to ssax.scm

* module/sxml/ssax.scm: Fix previous commit.

11 years agofix ssax:warn to work as intended
Andy Wingo [Wed, 30 Jan 2013 12:52:47 +0000 (13:52 +0100)]
fix ssax:warn to work as intended

* module/sxml/ssax.scm (ssax:warn): Fix to make more sense.

11 years agodetect and consume byte-order marks for textual ports
Andy Wingo [Wed, 30 Jan 2013 09:17:25 +0000 (10:17 +0100)]
detect and consume byte-order marks for textual ports

* libguile/ports.h:
* libguile/ports.c (scm_consume_byte_order_mark): New procedure.

* libguile/fports.c (scm_open_file): Call consume-byte-order-mark if we
  are opening a file in "r" mode.

* libguile/read.c (scm_i_scan_for_encoding): Don't do anything about
  byte-order marks.

* libguile/load.c (scm_primitive_load): Add a note about the duplicate
  encoding scan.

* test-suite/tests/filesys.test: Add tests for UTF-8, UTF-16BE, and
  UTF-16LE BOM handling.

11 years agorequire automake 1.12 for `serial-tests'.
Andy Wingo [Wed, 30 Jan 2013 10:59:37 +0000 (11:59 +0100)]
require automake 1.12 for `serial-tests'.

* configure.ac: Require automake 1.12 for `serial-tests'.

11 years agobuild: Allow use of Automake 1.13.
Ludovic Courtès [Mon, 28 Jan 2013 21:28:00 +0000 (22:28 +0100)]
build: Allow use of Automake 1.13.

Fixes <http://bugs.gnu.org/13558>.
Reported by DNS <dns@rbose.org>.

* configure.ac: Use the `serial-tests' Automake option to cope with
  Automake 1.13, which uses `parallel-tests' by default.

11 years agoRemove unneeded SMOB mark procedure in `memoize.c'.
Ludovic Courtès [Mon, 28 Jan 2013 20:54:21 +0000 (21:54 +0100)]
Remove unneeded SMOB mark procedure in `memoize.c'.

* libguile/memoize.c (scm_init_memoize): Remove unnecessary call to
  `scm_set_smob_mark'.

11 years agoFix argument count for various format string escape sequences.
Ian Price [Sat, 19 Jan 2013 17:05:27 +0000 (17:05 +0000)]
Fix argument count for various format string escape sequences.

* module/language/tree-il/analyze.scm (format-string-argument-count):
  Handle ~t and ~k options case-insensitively.
  ~! ~| ~/ ~q and ~Q should not update the min-count or max-count.
  ~^ returns the min-count and 'any
  + - # and ' should not increase the argument count.
* test-suite/tests/tree-il.test (*): Tests for new parameters.

11 years agoxml->sxml argument can be a port or a string
Andy Wingo [Mon, 28 Jan 2013 11:01:16 +0000 (12:01 +0100)]
xml->sxml argument can be a port or a string

* module/sxml/simple.scm (xml->sxml): Allow the optional arg to be a
  port or a string.
* doc/ref/sxml.texi (Reading and Writing XML): Update docs.

11 years agomake (sxml simple)'s xml->sxml more capable
Andy Wingo [Sun, 27 Jan 2013 20:56:07 +0000 (21:56 +0100)]
make (sxml simple)'s xml->sxml more capable

* module/sxml/simple.scm (xml->sxml): Add #:namespaces,
  #:declare-namespaces?, #:entities, #:default-entity-handler, and
  #:trim-whitespace? arguments.

* doc/ref/sxml.texi (Reading and Writing XML): Document the new
  options.

11 years agossax: treat *DEFAULT* as a fallback handler in entity alist
Andy Wingo [Sun, 27 Jan 2013 21:20:02 +0000 (22:20 +0100)]
ssax: treat *DEFAULT* as a fallback handler in entity alist

* module/sxml/upstream/SSAX.scm (ssax:handle-parsed-entity):
  Interpret *DEFAULT* as being a default handler procedure for parsed
  entities.  Includes test.

11 years agobegin rewriting SXML docs
Andy Wingo [Mon, 28 Jan 2013 09:48:42 +0000 (10:48 +0100)]
begin rewriting SXML docs

* doc/ref/sxml.texi (SXML): Reorder and begin rewriting.  Fix formatting
  throughout, provide a new introduction, and the beginning of proper
  SSAX documentation.

* doc/ref/sxml-match.texi:
* doc/ref/texinfo.texi:
* doc/ref/web.texi: Update references to new node names.

11 years agocurrent-ssax-error-port is a parameter
Andy Wingo [Sun, 27 Jan 2013 20:53:49 +0000 (21:53 +0100)]
current-ssax-error-port is a parameter

* module/sxml/ssax.scm (current-ssax-error-port): Change to be a
  parameter.

11 years agoFix source annotation bug in psyntax 'expand-body'.
Mark H Weaver [Wed, 23 Jan 2013 22:27:50 +0000 (17:27 -0500)]
Fix source annotation bug in psyntax 'expand-body'.

* module/ice-9/psyntax.scm (expand-body): Apply source-annotation to an
  expression, not to the expression's compile-time environment.

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

11 years agoAdd 'for-humans?' flag to <language> specifications.
Mark H Weaver [Sun, 27 Jan 2013 15:10:21 +0000 (10:10 -0500)]
Add 'for-humans?' flag to <language> specifications.

* module/system/base/language.scm (<language>): Add 'for-humans?'
  field, and export new 'language-for-humans?' predicate.

* doc/ref/compiler.texi (Compiler Tower): Document.

* module/language/assembly/spec.scm, module/language/bytecode/spec.scm,
  module/language/glil/spec.scm, module/language/objcode/spec.scm,
  module/language/tree-il/spec.scm, module/language/value/spec.scm:
  Mark these languages as 'for-humans?'.

11 years agoAdd tests for `--language'.
Ludovic Courtès [Sat, 26 Jan 2013 20:49:17 +0000 (21:49 +0100)]
Add tests for `--language'.

* test-suite/standalone/Makefile.am (top_srcdir): Add `top_srcdir'.
  (check_SCRIPTS, TESTS): Add `test-language'.
  (EXTRA_DIST): Add `test-language.el' and `test-language.js'.
* test-suite/standalone/test-language,
  test-suite/standalone/test-language.el,
  test-suite/standalone/test-language.js: New files.

11 years agoecmascript: Fix conversion to boolean for non-numbers.
Ludovic Courtès [Sat, 26 Jan 2013 18:18:31 +0000 (19:18 +0100)]
ecmascript: Fix conversion to boolean for non-numbers.

* module/language/ecmascript/base.scm (->boolean): Call `zero?' and
  `nan?' only when X is a number.
* test-suite/tests/ecmascript.test ("compiler"): Add test case.

11 years agoClarify the copyright status of GOOPS.
Ludovic Courtès [Sat, 26 Jan 2013 14:41:05 +0000 (15:41 +0100)]
Clarify the copyright status of GOOPS.

* module/oop/goops.scm, module/oop/goops/active-slot.scm,
  module/oop/goops/composite-slot.scm, module/oop/goops/describe.scm:
  Add a copyright line for Érick Gallesio.  Mention the STk version
  GOOPS was derived from.  Remove mentions of the ‘COPYRIGHTS’ file.
  Thanks to Karl Berry <karl@freefriends.org> for pointing it out, and
  to Michael Djurfeldt <mikael@djurfeldt.com>.

11 years agoRegenerate psyntax-pp.scm.
Mark H Weaver [Wed, 23 Jan 2013 22:25:18 +0000 (17:25 -0500)]
Regenerate psyntax-pp.scm.

* module/ice-9/psyntax-pp.scm: Regenerate.  This should have been done
  in commit 84f5a8251710c7d2a01590aa083d9dd409a56279 (`include' relative
  paths relative to including file).

11 years agooop goops save: fix compile-time availability of write-component
Andy Wingo [Wed, 23 Jan 2013 15:53:54 +0000 (16:53 +0100)]
oop goops save: fix compile-time availability of write-component

* module/oop/goops/save.scm (write-component)
  (write-component-procedure): Move definitions up so that syntax
  definition is available when compiling the rest of the file.

11 years agofix regression in -l
Andy Wingo [Wed, 23 Jan 2013 15:11:31 +0000 (16:11 +0100)]
fix regression in -l

* module/ice-9/command-line.scm (compile-shell-switches): Fix regression
  with -l argument, which was loading arg0 instead.

11 years agoload files from the command line relative to the cwd
Andy Wingo [Wed, 23 Jan 2013 15:05:13 +0000 (16:05 +0100)]
load files from the command line relative to the cwd

* module/ice-9/command-line.scm (load/lang): Load files from the command
  line relative to the current working directory (fixes regression).

11 years agoadd --language argument
Andy Wingo [Mon, 21 Jan 2013 11:28:22 +0000 (12:28 +0100)]
add --language argument

* module/ice-9/command-line.scm (*usage*): Make usage of capitalization
  and sentences consistent (lower-case and semicolons, as in ls
  --help).
  Be less specific about languages (Scheme is the default but not the
  only language).
  Document --language.
  (load/lang, eval-string/lang): New helpers.
  (compile-shell-switches): Parse a --language argument, and use it to
  set (current-language).

11 years agofix dynamic-call doc
Andy Wingo [Wed, 23 Jan 2013 08:37:59 +0000 (09:37 +0100)]
fix dynamic-call doc

* doc/ref/api-foreign.texi (Foreign Functions): Fix doc: interrupts are
  not deferred in a dynamic-call.

11 years agopaameterize in read-and-compile
Andy Wingo [Tue, 22 Jan 2013 14:40:08 +0000 (15:40 +0100)]
paameterize in read-and-compile

* module/system/base/compile.scm (read-and-compile): Use
  current-language parameter.

11 years agodocstring in rdelim
Andy Wingo [Tue, 22 Jan 2013 14:39:37 +0000 (15:39 +0100)]
docstring in rdelim

* module/ice-9/rdelim.scm: Update docstring.

11 years agocurrent-language is a parameter in boot-9
Andy Wingo [Mon, 21 Jan 2013 10:21:19 +0000 (11:21 +0100)]
current-language is a parameter in boot-9

* module/ice-9/boot-9.scm (current-language): New parameter.

* module/system/base/language.scm (*current-language*): Pull fluid from
  parameter.
  (current-language): Now a re-exported parameter.

* doc/ref/compiler.texi: Update reference from *current-language* fluid
  to current-language parameter.

* module/system/base/compile.scm (compile-and-load):
* module/ice-9/top-repl.scm (top-repl): Default to the current language,
  not to Scheme.

* module/ice-9/eval-string.scm:
* module/system/base/language.scm:
* module/system/repl/command.scm:
* module/system/repl/repl.scm: Update to use current-language parameter
  and parameterize.

11 years agoadd fluid->parameter
Andy Wingo [Mon, 21 Jan 2013 10:16:29 +0000 (11:16 +0100)]
add fluid->parameter

* module/ice-9/boot-9.scm (make-parameter): Add a docstring.
  (fluid->parameter): New interface.  Use it when turning port fluids
  into parameters.

* doc/ref/api-scheduling.texi (Parameters): Deffn instead of defun for
  make-parameter documentation.  Add docs for fluid->parameter.

11 years agoadd read-string and read-string! to (ice-9 rdelim)
Andy Wingo [Tue, 22 Jan 2013 09:12:59 +0000 (10:12 +0100)]
add read-string and read-string! to (ice-9 rdelim)

* module/ice-9/rdelim.scm (read-string!, read-string): New functions.
* test-suite/tests/rdelim.test: Add tests.
* doc/ref/api-io.texi: Add docs.

* module/ice-9/iconv.scm:
* module/rnrs/io/ports.scm:
* module/web/uri.scm: Use the new functions.

11 years ago`include' relative paths relative to including file
Andy Wingo [Sun, 20 Jan 2013 19:26:59 +0000 (20:26 +0100)]
`include' relative paths relative to including file

* module/ice-9/psyntax.scm (include): Like `load', interpret relative
  paths as being relative to the file that does the `include'.

* doc/ref/api-evaluation.texi: Update docs.

11 years agolibguile examples use scm_c_vector functions instead of SCM_SIMPLE_VECTOR_*
Andy Wingo [Tue, 22 Jan 2013 10:48:47 +0000 (11:48 +0100)]
libguile examples use scm_c_vector functions instead of SCM_SIMPLE_VECTOR_*

* doc/ref/libguile-concepts.texi (Multi-Threading): Use functions in the
  example instead of macros.  Performance is really not a concern with
  this interface, especially now that scm_car and scm_cdr are inline
  functions.

11 years agodocumentation recommends scm_new_smob instead of SCM_NEWSMOB
Andy Wingo [Tue, 22 Jan 2013 10:35:25 +0000 (11:35 +0100)]
documentation recommends scm_new_smob instead of SCM_NEWSMOB

* doc/ref/api-smobs.texi (Smobs): Document scm_new_smob and
  scm_new_double_smob instead of the SCM_NEWSMOB / SCM_RETURN_NEWSMOB
  family of macros.

* doc/ref/libguile-smobs.texi (Creating Smob Instances): Use
  scm_new_smob.

11 years agofix compilation of glil to assembly
Andy Wingo [Tue, 22 Jan 2013 08:19:39 +0000 (09:19 +0100)]
fix compilation of glil to assembly

* libguile/vm-i-scheme.c (VM_VALIDATE_STRUCT): Fix the error message if
  the value was not a struct.

* module/system/base/compile.scm (find-language-joint): Default to
  joining at the target language.
  (default-language-joiner): Allow sequences of one compiled expression
  to pass through.  Otherwise error as before.
  (read-and-parse): New helper; actually parses.
  (read-and-compile): Use read-and-parse, and fall back to
  default-language-joiner.

Thanks to Nala Ginrut for the report.

11 years agoFix http-get* deprecation note
Andy Wingo [Mon, 21 Jan 2013 21:13:16 +0000 (22:13 +0100)]
Fix http-get* deprecation note

* module/web/client.scm (http-get*): Fix deprecation warning.  Thanks to
  Daniel Hartwig for the report.

11 years agoadd dynl.x dep on libpath.h
Andy Wingo [Mon, 21 Jan 2013 21:10:28 +0000 (22:10 +0100)]
add dynl.x dep on libpath.h

* libguile/Makefile.am (dynl.x): Add dep on libpath.h.  Thanks to Bogdan
  Marinescu for the report.

11 years agoread-and-compile closes input file after seeing EOF
Andy Wingo [Mon, 21 Jan 2013 18:07:19 +0000 (19:07 +0100)]
read-and-compile closes input file after seeing EOF

* module/system/base/compile.scm (read-and-compile): Close the input
  port after we read all of its data.  Perhaps this cleans up some NFS
  ghosts that David Pirotte was seeing.

11 years agofix try-module-autoload, which did not detect failure to find the file
Andy Wingo [Sun, 20 Jan 2013 18:33:42 +0000 (19:33 +0100)]
fix try-module-autoload, which did not detect failure to find the file

* libguile/load.c (scm_primitive_load_path): If the second argument is a
  procedure, call it like a thunk.

* doc/ref/api-evaluation.texi (Load Paths): Update docs.

* module/ice-9/boot-9.scm (resolve-interface): Use `unless'.
  (try-module-autoload): Use the new primitive-load-path to detect
  failure to find an appropriate file.  Fixes a bug reported by Diogo
  F. S. Ramos.  Thanks to Noah Lavine for tracking it down.

11 years agoFix attempt to get handle of weak table in (oop goops save)
Andy Wingo [Sun, 20 Jan 2013 12:28:31 +0000 (13:28 +0100)]
Fix attempt to get handle of weak table in (oop goops save)

* module/oop/goops/save.scm (readable?): Fix.  Thanks to Andrew Gaylard
  for the report.

11 years agowarn on multithreaded fork
Andy Wingo [Thu, 17 Jan 2013 11:38:56 +0000 (12:38 +0100)]
warn on multithreaded fork

* libguile/posix.c (scm_fork): Issue a warning on a multithreaded fork.
* doc/ref/posix.texi (Processes): Add note about multithreaded fork.

* test-suite/tests/00-socket.test: Moved here, from socket.test, so as
  to run before any threads are created.
* test-suite/Makefile.am: Adapt.

11 years agotrace: limit length of "| | | "... prefix
Andy Wingo [Wed, 16 Jan 2013 12:20:54 +0000 (13:20 +0100)]
trace: limit length of "| | | "... prefix

* module/system/vm/trace.scm (build-prefix): New helper.
  (print-application, print-return): Use the helper.
  (trace-calls-to-procedure, trace-calls-in-procedure):
  (trace-instructions-in-procedure, call-with-trace): Add #:max-indent
  argument, defaulting to the terminal width less 40 characters.

* doc/ref/scheme-using.texi: Update `trace' docs.

Based on a patch by Nala Ginrut.

11 years agopeval-introduced gensyms infix " "
Andy Wingo [Wed, 16 Jan 2013 12:27:55 +0000 (13:27 +0100)]
peval-introduced gensyms infix " "

* module/language/tree-il/peval.scm (peval): Gensyms use whitespace as
  an infix, not a dash.  Helps gensym?-like procedures like those in the
  unused lexical analysis.

11 years agoan end to the generated-documentation experiment
Andy Wingo [Wed, 16 Jan 2013 09:03:44 +0000 (10:03 +0100)]
an end to the generated-documentation experiment

* doc/ref/statprof.texi:
* doc/ref/sxml.texi:
* doc/ref/texinfo.texi: New files, containing the documentation that was
  previously generated from source and rendered into
  standard-library.texi.  The documentation is still horrible, but at
  least now it is user-editable.

11 years agodoc/ref/hierarchy.png: conform to hierarchy.txt and manual
Greg Benison [Sat, 24 Dec 2011 19:27:12 +0000 (11:27 -0800)]
doc/ref/hierarchy.png: conform to hierarchy.txt and manual

hierarchy.png (and .pdf, .eps) were changed to add one node
to the graph, getting them in sync with hierarchy.txt
(and the GOOPS section of the manual).

Also added hierarchy.dot, a file to generate said figure
using graphviz.

11 years agofix string->bytevector for utf-8 and non-error conversion strategies
Andy Wingo [Tue, 15 Jan 2013 14:08:20 +0000 (15:08 +0100)]
fix string->bytevector for utf-8 and non-error conversion strategies

* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Only call string->utf8 and
  utf8->string if the conversion strategy is `error'.

11 years agocase-lambda* clauses fail to match if too many positionals
Andy Wingo [Mon, 14 Jan 2013 10:38:09 +0000 (11:38 +0100)]
case-lambda* clauses fail to match if too many positionals

* doc/ref/api-procedures.texi (Case-lambda): Expand case-lambda*
  documentation.

* module/ice-9/eval.scm (primitive-eval):
* libguile/eval.c (prepare_boot_closure_env_for_apply): Dispatch to the
  next case-lambda clause if there are too many positionals.

* doc/ref/vm.texi (Function Prologue Instructions):
* libguile/vm-i-system.c (bind-optionals/shuffle-or-br): New
  instruction, like bind-optionals/shuffle but can dispatch to the next
  clause if there are too many positionals.

* module/language/assembly/disassemble.scm (code-annotation):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (compile-bytecode): Add
  case for bind-optionals/shuffle-or-br.
* module/language/glil/compile-assembly.scm (glil->assembly): If there
  is an alternate, use bind-optionals/shuffle-or-br instead of
  bind-optionals/shuffle.

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

11 years agoDocstrings in (ice-9 iconv)
Andy Wingo [Fri, 11 Jan 2013 20:28:51 +0000 (21:28 +0100)]
Docstrings in (ice-9 iconv)

* module/ice-9/iconv.scm: Add docstrings.

11 years agoChange iconv procedures to take optional instead of keyword arg
Andy Wingo [Fri, 11 Jan 2013 20:15:28 +0000 (21:15 +0100)]
Change iconv procedures to take optional instead of keyword arg

* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Take an optional instead of
  a keyword argument.

* doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to
  change, and fix a number of errors.  Thanks to Ludovic Courtès for the
  pointers.

* test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for
  the 'substitute path.

11 years agoAdd http-post, http-put, et cetera
Andy Wingo [Fri, 11 Jan 2013 10:15:28 +0000 (11:15 +0100)]
Add http-post, http-put, et cetera

* module/web/client.scm (ensure-uri): New helper.
  (open-socket-for-uri): Accept a URI as a string or as a URI object.
  (extend-request, sanitize-request): New helpers, like the
  corresponding functions in (web server).
  (decode-response-body): Add a reference to the HTTP/1.1 spec, and
  use (ice-9 iconv).
  (request): New helper, factoring all aspects of sending an HTTP
  request and getting a response.
  (http-get): Redefine in terms of http-get.  Deprecate the
  #:extra-headers argument in favor of #:headers.  Allow a body.  Add a
  #:streaming? argument, subsuming the functionality of http-get*.
  (http-get*): Deprecate.
  (http-head, http-post, http-put, http-delete, http-trace)
  (http-options): Define interfaces for all HTTP verbs.

* test-suite/tests/web-client.test: Add tests.

* doc/ref/web.texi: Update documentation.

Thanks to Gregory Benison for the initial patch.

11 years agoread-response-body always returns bytevector or #f
Andy Wingo [Fri, 11 Jan 2013 10:30:29 +0000 (11:30 +0100)]
read-response-body always returns bytevector or #f

* module/web/response.scm (read-response-body): Fix to always return
  either a bytevector or #f.  Previously, reading a 0-length body could
  return the EOF object.