bpt/guile.git
14 years agoInline SRFI-9 constructors too.
Ludovic Courtès [Sat, 30 Jan 2010 21:54:20 +0000 (22:54 +0100)]
Inline SRFI-9 constructors too.

* module/srfi/srfi-9.scm (define-record-type)[constructor]: Use
  `define-inlinable' instead of `define'.

* test-suite/lib.scm (exception:syntax-pattern-unmatched): New variable.

* test-suite/tests/srfi-9.test ("constructor")["foo 0 args (inline)",
  "foo 2 args (inline)"]: New tests.
  ["foo 0 args", "foo 2 args"]: Adjust to constructor inlining.

* testsuite/t-records.scm: Remove wrong-arg-count case.

14 years agoSRFI-9: Fix `define-inlinable'.
Ludovic Courtès [Fri, 29 Jan 2010 10:26:17 +0000 (11:26 +0100)]
SRFI-9: Fix `define-inlinable'.

* module/srfi/srfi-9.scm (define-inlinable): Fix the catch-all case of
  the generated macro.

14 years agoadd (ice-9 control)
Andy Wingo [Sat, 30 Jan 2010 23:02:00 +0000 (00:02 +0100)]
add (ice-9 control)

* module/language/tree-il/primitives.scm (define-primitive-expander):
  Allow quoted datums. Allow all self-evaluating expressions to be
  constants.
  (prompt, control): Add primitive expanders to turn these into @prompt
  and @control.

* module/ice-9/control.scm: New module, for delimited continuation
  operators.

* module/Makefile.am: Add.

14 years agoadd @control and @prompt stub primitives
Andy Wingo [Sat, 30 Jan 2010 23:01:11 +0000 (00:01 +0100)]
add @control and @prompt stub primitives

* libguile/Makefile.am:
* libguile/control.c:
* libguile/control.h:
* libguile/init.c: Add stub @control and @prompt primitives, for use
  when bootstrapping (ice-9 control).

14 years agoGLIL and assembly support for prompt compilation
Andy Wingo [Sat, 30 Jan 2010 14:09:41 +0000 (15:09 +0100)]
GLIL and assembly support for prompt compilation

* module/language/glil/compile-assembly.scm (glil->assembly): Compile
  <glil-prompt> appropriately.

* module/language/assembly/disassemble.scm (code-annotation):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (write-bytecode):
  Assemble and disassemble `prompt' appropriately.

14 years agotree-il -> glil compilation of prompt, dynamic-wind, control
Andy Wingo [Sat, 30 Jan 2010 14:52:48 +0000 (15:52 +0100)]
tree-il -> glil compilation of prompt, dynamic-wind, control

* module/language/tree-il/compile-glil.scm (flatten): Compile <prompt>,
  <dynamic-wind>, and <control>.

14 years agoadd return/nvalues
Andy Wingo [Sun, 31 Jan 2010 09:44:44 +0000 (10:44 +0100)]
add return/nvalues

* libguile/vm-i-system.c (return/nvalues): New instruction, like
  call/nargs.

14 years agoGLIL support for <prompt>
Andy Wingo [Sat, 30 Jan 2010 14:51:44 +0000 (15:51 +0100)]
GLIL support for <prompt>

* module/language/glil.scm (<glil>): Add <glil-prompt>, with
  handler-label and escape-only? fields.

14 years agotree-il analyzer and inliner handle <prompt>
Andy Wingo [Sat, 30 Jan 2010 14:49:50 +0000 (15:49 +0100)]
tree-il analyzer and inliner handle <prompt>

* module/language/tree-il/analyze.scm (analyze-lexicals): Add cases for
  <prompt>, <dynamic-wind>, and <control>. If a continuation is not
  referenced in the body of a prompt handler, mark the prompt as
  escape-only.
* module/language/tree-il/inline.scm (inline!): Inline the handler of a
  prompt if it is a simple lambda.

14 years agodynamic-wind compilation to VM ops
Andy Wingo [Sun, 31 Jan 2010 19:30:46 +0000 (20:30 +0100)]
dynamic-wind compilation to VM ops

* module/language/tree-il/primitives.scm: Resolve calls to dynamic-wind
  to <dynamic-wind>, thereby inlining the dynwind to VM ops, and
  allowing inline allocation of the body thunk.

14 years agonew tree-il for prompt, control, and dynamic-wind
Andy Wingo [Sat, 30 Jan 2010 14:47:44 +0000 (15:47 +0100)]
new tree-il for prompt, control, and dynamic-wind

* module/language/tree-il.scm: Initial tree-il support for <prompt>,
  <control>, and <dynamic-wind>.

14 years agoinitial VM support for delimited continuations and dynamic-wind
Andy Wingo [Sat, 30 Jan 2010 14:45:37 +0000 (15:45 +0100)]
initial VM support for delimited continuations and dynamic-wind

* libguile/vm-i-system.c (prompt, wind, throw, unwind):
  New instructions, for implementing dynamic-wind and delimited
  continuations.
* libguile/vm.c: Add some stub support for the new instructions.
* libguile/vm-engine.c: Some new error conditions.

14 years agoadd a test for ffi and pointers
Andy Wingo [Wed, 27 Jan 2010 21:25:29 +0000 (22:25 +0100)]
add a test for ffi and pointers

* test-suite/standalone/test-ffi:
* test-suite/standalone/test-ffi-lib.c: Add a pointer test.

14 years agoadd simple foreign finalization, and pointer support
Andy Wingo [Wed, 27 Jan 2010 21:12:58 +0000 (22:12 +0100)]
add simple foreign finalization, and pointer support

* libguile/foreign.h:
* libguile/foreign.c (scm_foreign_set_finalizer_x): New function, for a
  limited form of finalization (like `free').
  (scm_alignof, scm_sizeof, parse_ffi_type, fill_ffi_type): For the
  purposes of make-foreign-function, treat '* (the asterisk symbol) as a
  pointer.

* module/system/foreign.scm: Export foreign-set-finalizer!.

14 years agostatprof bugfixes
Andy Wingo [Wed, 27 Jan 2010 20:52:05 +0000 (21:52 +0100)]
statprof bugfixes

* module/statprof.scm (get-call-data): For closures, get call data by
  the program's objcode.
  (statprof-start, statprof-stop): Fix bug in which all statprof runs
  were enabling the apply hook regardless of the setting of
  #:count-calls?. The result was distorted timings, where procedure
  calls were unfairly penalized.
  (procedure=?): Streamline.

14 years agoinline calls to variable-bound?
Andy Wingo [Wed, 27 Jan 2010 20:48:06 +0000 (21:48 +0100)]
inline calls to variable-bound?

* module/language/tree-il/compile-glil.scm (*primcall-ops*):
* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Actually resolve calls to
  `variable-bound?' to the opcode that we have for it.

14 years agofix to variable-bound? instruction prototype
Andy Wingo [Wed, 27 Jan 2010 20:47:01 +0000 (21:47 +0100)]
fix to variable-bound? instruction prototype

* libguile/vm-i-system.c (variable-bound?): Correctly declare as popping
  one item.

14 years agoremove incremental NEWS entries in preparation for 1.9.8
Andy Wingo [Wed, 27 Jan 2010 20:45:47 +0000 (21:45 +0100)]
remove incremental NEWS entries in preparation for 1.9.8

* NEWS

14 years agoadd a test for foreign functions taking struct args
Andy Wingo [Tue, 26 Jan 2010 21:55:58 +0000 (22:55 +0100)]
add a test for foreign functions taking struct args

* test-suite/standalone/test-ffi (f-sum-struct):
* test-suite/standalone/test-ffi-lib.c (test_ffi_sum_struct): Add a
  struct test. Wheee....

14 years agoturn asserts into exceptions in foreign.c
Andy Wingo [Tue, 26 Jan 2010 21:55:13 +0000 (22:55 +0100)]
turn asserts into exceptions in foreign.c

* libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x)
  (scm_i_foreign_print, fill_ffi_type, cif_to_procedure, unpack): Turn a
  number of asserts into proper errors.

14 years agoadd make-c-struct, parse-c-struct
Andy Wingo [Tue, 26 Jan 2010 21:18:42 +0000 (22:18 +0100)]
add make-c-struct, parse-c-struct

* module/system/foreign.scm: Export alignof and sizeof.
  (make-c-struct, parse-c-struct): New public functions.

14 years agoadd `alignof' and `sizeof' Scheme functions
Andy Wingo [Tue, 26 Jan 2010 21:16:35 +0000 (22:16 +0100)]
add `alignof' and `sizeof' Scheme functions

* libguile/foreign.h:
* libguile/foreign.c (scm_alignof, scm_sizeof): New functions.

14 years agoadd ffi tests
Andy Wingo [Mon, 25 Jan 2010 22:45:15 +0000 (23:45 +0100)]
add ffi tests

* test-suite/standalone/Makefile.am:
* test-suite/standalone/test-ffi:
* test-suite/standalone/test-ffi-lib.c: Add some tests for the ffi.

14 years agoimplement foreign-call
Andy Wingo [Mon, 25 Jan 2010 17:04:45 +0000 (18:04 +0100)]
implement foreign-call

* libguile/foreign.h:
* libguile/foreign.c (scm_i_foreign_call): New internal function,
  actually implementing foreign calls. Untested.

* libguile/vm-i-system.c (foreign-call): Wire up the call to
  scm_i_foreign_call.

14 years agofirst pass at implementing low-level foreign functions
Andy Wingo [Mon, 25 Jan 2010 17:15:35 +0000 (18:15 +0100)]
first pass at implementing low-level foreign functions

* libguile/Makefile.am (AM_CPPFLAGS): Move LIBFFI_CFLAGS here (from
  AM_CFLAGS), allowing snarfing to work.

* libguile/foreign.h (scm_make_foreign_function): New public function.

* libguile/foreign.c: Flesh out an implementation of foreign functions.
  (scm_take_foreign_pointer): Bugfix for the case in which we have a
  finalizer.

* module/system/foreign.scm: Export `make-foreign-function'.

14 years agorenumber VM opcodes
Andy Wingo [Mon, 25 Jan 2010 00:59:19 +0000 (18:59 -0600)]
renumber VM opcodes

* libguile/vm-i-loader.c:
* libguile/vm-i-scheme.c:
* libguile/vm-i-system.c: Renumber ops. Add a foreign-call op stub.
  Rearrange some ops.

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump

14 years agobyte access to foreigns via bytevectors
Andy Wingo [Mon, 18 Jan 2010 13:36:23 +0000 (14:36 +0100)]
byte access to foreigns via bytevectors

* libguile/foreign.h:
* libguile/foreign.c (scm_foreign_ref, scm_foreign_set_x): Remove all
  bits about offsets and aliasing; bytevectors are much better at that.
  (scm_foreign_to_bytevector, scm_bytevector_to_foreign): New functions
  for getting at the bytes of a memory region.

* module/system/foreign.scm (foreign->bytevector, bytevector->foreign):
  Export these.

14 years agomove foreign function interface to its own module
Andy Wingo [Mon, 18 Jan 2010 11:16:13 +0000 (12:16 +0100)]
move foreign function interface to its own module

* libguile/foreign.h:
* libguile/init.c: Change so that init just registers an extension,
  later called by foreign.scm.

* libguile/foreign.c (scm_init_foreign): Define constants for the
  various foreign types.

* module/Makefile.am:
* module/system/foreign.scm: New module, for the foreign function
  interface.

14 years agoforeign.h presents a more pointer-centric interface
Andy Wingo [Mon, 18 Jan 2010 10:42:35 +0000 (11:42 +0100)]
foreign.h presents a more pointer-centric interface

* libguile/foreign.c:
* libguile/foreign.h: Rework interface to be more pointer-centric.
  Details are:
  (SCM_FOREIGN_TYPE_STRUCT, SCM_FOREIGN_TYPE_POINTER): Removed; now the
  pointer in a foreign is first-class. If it points to a native type
  like uint32, then it still has a tag; but if it points to something
  else, like a struct or a pointer or something, then its type is VOID
  (i.e., void*).
  (SCM_FOREIGN_POINTER): Rename from SCM_FOREIGN_OBJECT.
  (SCM_FOREIGN_VALUE_REF, SCM_FOREIGN_VALUE_SET): Rename from
  SCM_FOREIGN_OBJECT_REF and SCM_FOREIGN_OBJECT_SET, to indicate that
  they only work with value types.
  (SCM_FOREIGN_HAS_FINALIZER): Reserve a bit to indicate if the foreign
  pointer in question has a finalizer registered.
  (SCM_FOREIGN_LEN): For void* pointers, optionally store the length in
  bytes of the associated memory region.
  (SCM_FOREIGN_VALUE_P): Rename from SCM_FOREIGN_SIMPLE_P.
  (SCM_VALIDATE_FOREIGN_VALUE): Rename from SCM_VALIDATE_FOREIGN_SIMPLE.
  (scm_take_foreign_pointer): Rename from scm_c_take_foreign. Remove
  scm_c_from_foreign.
  (scm_foreign_type): New accessor.
  (scm_foreign_ref, scm_foreign_set_x): Take some optional args, used
  when dereferencing void pointers.

* libguile/dynl.h:
* libguile/dynl.c (scm_dynamic_pointer): New function, used by
  scm_dynamic_func. Adapt code to foreign.h changes.

* libguile/goops.c (scm_enable_primitive_generic_x)
  (scm_set_primitive_generic_x): Use the SCM_SET_SUBR_GENERIC macro.

* libguile/gsubr.c (create_gsubr): Adapt to API change.
* libguile/gsubr.h (SCM_SUBRF, SCM_SUBR_GENERIC): Store the pointer
  directly, not indirected.

* libguile/snarf.h (SCM_DEFINE, SCM_IMMUTABLE_FOREIGN): Store subr
  pointers directly. Adapt to SCM_FOREIGN_TYPE_VOID change.

* libguile/vm-i-system.c (subr-call): Access the void* directly.

14 years agoadd libffi dependency
Andy Wingo [Fri, 15 Jan 2010 21:55:11 +0000 (22:55 +0100)]
add libffi dependency

* configure.ac:
* libguile/Makefile.am (AM_CFLAGS, libguile_la_LDFLAGS): Add a libffi
  dependency, for making a dynamic FFI.

14 years agoRecognize structs with both "pr" and "pw" flags as simple.
Ludovic Courtès [Mon, 25 Jan 2010 23:00:58 +0000 (00:00 +0100)]
Recognize structs with both "pr" and "pw" flags as simple.

* libguile/struct.c (set_vtable_layout_flags): Keep the
  `SCM_VTABLE_FLAG_SIMPLE' flag when VTABLE has a mixture of `r' and `w'
  fields.

* libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE): Adjust comment.

14 years agoAdd ASCII art representing the basic struct layout.
Ludovic Courtès [Mon, 25 Jan 2010 22:43:41 +0000 (23:43 +0100)]
Add ASCII art representing the basic struct layout.

* libguile/struct.h: Add ASCII art version of the basic struct layout as
  shown in Andy's diagrams.

14 years agoReinstate 2-word displacement for structs.
Ludovic Courtès [Mon, 25 Jan 2010 22:41:27 +0000 (23:41 +0100)]
Reinstate 2-word displacement for structs.

* libguile/struct.c (scm_init_struct): Reinstate 2-word displacement
  removed by 01e74380f6170b5cb1105e5df9a368ab257420ef.

14 years agoR6RS string escapes broken on string output
Michael Gran [Sat, 23 Jan 2010 17:15:10 +0000 (09:15 -0800)]
R6RS string escapes broken on string output

scm_to_stringn failed to do the necessary escape conversion for
R6RS hex escapes

* libguile/strings.c (unistring_escapes_to_r6rs_escapes): new function
  (scm_to_stringn): use new function when r6rs hex escapes are enabled

* test-suite/tests/reader.test: new test for string display

14 years agoRevert "Install `standard-library.info'."
Ludovic Courtès [Sat, 23 Jan 2010 16:03:11 +0000 (17:03 +0100)]
Revert "Install `standard-library.info'."

This reverts commit 0e64cbea3d22411564af302a63b670fe0617ccf3.

14 years agoAdd `struct-ref' and `struct-set' VM opcodes.
Ludovic Courtès [Sat, 23 Jan 2010 15:43:50 +0000 (16:43 +0100)]
Add `struct-ref' and `struct-set' VM opcodes.

* libguile/vm-i-scheme.c (make_struct): Optimize the
  `SCM_VTABLE_FLAG_SIMPLE' case.
  (struct_ref, struct_set): New opcodes.

* module/language/tree-il/compile-glil.scm (*primcall-ops*): Add
  `struct-ref' and `struct-set!'.

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Likewise.
  (*effect-free-primitives*): Add `struct-ref'.

14 years agoSlightly improve comments and style in `struct.c'.
Ludovic Courtès [Sat, 23 Jan 2010 15:41:28 +0000 (16:41 +0100)]
Slightly improve comments and style in `struct.c'.

* libguile/struct.c (scm_i_struct_inherit_vtable_magic): Comment.
  Punctuate comments within the body, have them follow GCS.
  (scm_make_vtable_vtable): Clarify comments.

14 years agoClarify GC-registered displacements for structs.
Ludovic Courtès [Sat, 23 Jan 2010 15:39:14 +0000 (16:39 +0100)]
Clarify GC-registered displacements for structs.

* libguile/struct.c (scm_init_struct): Remove unneeded
  `GC_REGISTER_DISPLACEMENT ()' call.  Comment the remaining one.

14 years agoOptimize struct initialization and accessors for the common case.
Ludovic Courtès [Sat, 23 Jan 2010 15:21:13 +0000 (16:21 +0100)]
Optimize struct initialization and accessors for the common case.

* libguile/struct.c (set_vtable_layout_flags): New function.
  (scm_i_struct_inherit_vtable_magic): Use it.
  (scm_struct_init): Optimize the case where HANDLE's vtable has the
  `SCM_VTABLE_FLAG_SIMPLE' flag.
  (scm_struct_ref): Likewise.
  (scm_struct_ref): Likewise, when `SCM_VTABLE_FLAG_SIMPLE_RW' is also set.

* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Update comment for the
  next-to-last hidden field.
  (scm_vtable_index_reserved_6): Rename to...
  (scm_vtable_index_size): ... this.
  (SCM_VTABLE_FLAG_RESERVED_0): Rename to...
  (SCM_VTABLE_FLAG_SIMPLE): ... this.
  (SCM_VTABLE_FLAG_RESERVED_1): Rename to...
  (SCM_VTABLE_FLAG_SIMPLE_RW): ... this.

* test-suite/tests/structs.test ("low-level struct
  procedures")["struct-ref", "struct-set!", "struct-ref out-of-range",
  "struct-set! out-of-range"]: New tests.

14 years agoInstall `standard-library.info'.
Ludovic Courtès [Fri, 22 Jan 2010 15:55:24 +0000 (16:55 +0100)]
Install `standard-library.info'.

* doc/ref/Makefile.am (BUILT_SOURCES): Move `standard-library.texi'
  to...
  (nodist_info_TEXINFOS): ... here.  New variable.

14 years agoFix `uniform-vector-read!' and `uniform-vector-write'.
Ludovic Courtès [Wed, 20 Jan 2010 22:58:39 +0000 (23:58 +0100)]
Fix `uniform-vector-read!' and `uniform-vector-write'.

* libguile/deprecated.c (scm_uniform_vector_read_x,
  scm_uniform_vector-write): Account for optional arguments.  Make sure
  the former always returns an integer.

* libguile/deprecated.h (scm_uniform_vector_read_x,
  scm_uniform_vector_write, scm_uniform_array_read_x,
  scm_uniform_array_write): Mark as `SCM_DEPRECATED'.

14 years agoBump version number for 1.9.7.
Ludovic Courtès [Tue, 19 Jan 2010 22:28:59 +0000 (23:28 +0100)]
Bump version number for 1.9.7.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

14 years agoUpdate `NEWS'.
Ludovic Courtès [Tue, 19 Jan 2010 21:29:13 +0000 (22:29 +0100)]
Update `NEWS'.

14 years agoDocument `guile-tools compile'.
Ludovic Courtès [Tue, 19 Jan 2010 21:28:38 +0000 (22:28 +0100)]
Document `guile-tools compile'.

* doc/ref/api-evaluation.texi (Compilation): Document `guile-tools
  compile'.

14 years agoReinstate `scm_is_bool ()' as a function.
Ludovic Courtès [Tue, 19 Jan 2010 20:41:41 +0000 (21:41 +0100)]
Reinstate `scm_is_bool ()' as a function.

* libguile/boolean.c (scm_is_bool): New function.

* libguile/boolean.h (scm_is_bool): New function declaration.

14 years agoMake `sockets.test' more robust.
Ludovic Courtès [Tue, 19 Jan 2010 17:49:06 +0000 (18:49 +0100)]
Make `sockets.test' more robust.

* test-suite/tests/socket.test ("AF_INET6/SOCK_STREAM"): Gracefully
  handle cases where this combination is not supported.

14 years agoDocument modal encodings problem in ref doc
Michael Gran [Tue, 19 Jan 2010 16:42:44 +0000 (08:42 -0800)]
Document modal encodings problem in ref doc

* doc/ref/api-io.texi (Ports): note that modal encodings are not
  supported

14 years agoFix use of utimensat(2).
Ludovic Courtès [Mon, 18 Jan 2010 23:23:33 +0000 (00:23 +0100)]
Fix use of utimensat(2).

* libguile/posix.c (scm_utime): Use "#ifdef HAVE_UTIMENSAT", not "#if
  HAVE_UTIMENSAT".  Fix GCC warning around call to utimensat(2):
  "passing argument 3 of 'utimensat' from incompatible pointer type".

* test-suite/tests/posix.test ("utime"): New test prefix.

14 years agoMove string internals description in ref doc
Michael Gran [Mon, 18 Jan 2010 15:07:34 +0000 (07:07 -0800)]
Move string internals description in ref doc

* doc/ref/api-data.texi: move string internals section

14 years agoString ref doc updates for case and conversion
Michael Gran [Mon, 18 Jan 2010 04:10:15 +0000 (20:10 -0800)]
String ref doc updates for case and conversion

* doc/ref/api-data.texi: clarifications on Alphabetic Case Mapping and
  Conversion To/From C.

14 years agoDocument string-bytes-per-char and %string-dump
Michael Gran [Sun, 17 Jan 2010 23:25:40 +0000 (15:25 -0800)]
Document string-bytes-per-char and %string-dump

* doc/ref/api-data.texi (String Internals): new subsubsection.  Document
  string-bytes-per-char and %string-dump.

14 years agoobject->assembly shouldn't presume existence of %nil
Michael Gran [Sun, 17 Jan 2010 21:41:14 +0000 (13:41 -0800)]
object->assembly shouldn't presume existence of %nil

The %nil constant only exists if SCM_ENABLE_ELISP is defined.

* module/language/assembly (object->assembly): check for existence of %nil

14 years agoreader options macros incorrect when SCM_ENABLE_ELISP undefined
Michael Gran [Sun, 17 Jan 2010 21:40:18 +0000 (13:40 -0800)]
reader options macros incorrect when SCM_ENABLE_ELISP undefined

When compiled with SCM_ENABLE_ELISP undefined, the reader options
macros SCM_R6RS_ESCAPES_P and SCM_SQUARE_BRACKETS_P point past
the end of the scm_read_opts struct.

*libguile/private-options.h (SCM_R6RS_ESCAPES_P) [!SCM_ENABLE_ELISP]: modified
 (SCM_SQUARE_BRACKETS_P) [!SCM_ENABLE_ELISP]: modified
 (SCM_N_READ_OPTIONS): modified

14 years agofix doc snarfing with fedora 12
Andy Wingo [Sun, 17 Jan 2010 17:22:51 +0000 (18:22 +0100)]
fix doc snarfing with fedora 12

* module/scripts/snarf-check-and-output-texi.scm
  (process-multiline-directive): Be more accepting of source location
  markers in the preprocessed source, by adding a couple cases in which
  they can appear. Not foolproof, but it does adapt to what new GCCs are
  putting out (e.g. cpp (GCC) 4.4.2 20091222 (Red Hat 4.4.2-20)).

14 years agonanosecond timestamp support in stat and utime
Andy Wingo [Sun, 17 Jan 2010 15:56:21 +0000 (16:56 +0100)]
nanosecond timestamp support in stat and utime

* libguile/posix.h:
* libguile/posix.c (scm_utime): Add optional nanosecond arguments. This
  is an incompatible change on the C level, but it's unlikely people are
  using this POSIX wrapper function, because they would just use the
  POSIX function directly. Hopefully, anyway.

* module/system/base/compile.scm (call-with-output-file/atomic):
  Propagate source timestamps to targets with nanosecond precision, if
  available. Fixes build on systems with ext4 filesystems.

* libguile/filesys.c (scm_stat2scm):
* module/ice-9/posix.scm (stat:atimensec, stat:mtimensec)
  (stat:ctimensec): Add three new elements to Scheme stat structures,
  for nanosecond-level timestamps.

* configure.ac: Add checks for utimensat, and for nanosecond fields in
  struct stat. We should switch to using Gnulib things for these,
  though.

* doc/ref/posix.texi (File System): Add documentation for utime's
  additional arguments, and nanosecond stat timestamp accessors.

14 years agofix (class-of #u32())
Andy Wingo [Fri, 15 Jan 2010 21:33:49 +0000 (22:33 +0100)]
fix (class-of #u32())

* libguile/goops.c (scm_class_of, create_standard_classes): Return
  <bytevector> or <uvec> for bytevectors, as appropriate.

14 years agoadd reader option for parsing [] as ().
Andy Wingo [Fri, 15 Jan 2010 21:24:31 +0000 (22:24 +0100)]
add reader option for parsing [] as ().

* libguile/private-options.h:
* libguile/read.c (scm_read_opts, SCM_SQUARE_BRACKETS_P): Add an option
  for treating [ and ] as parentheses, on by default. Note that this
  makes them delimiters also, so [ and ] cannot appear in a symbol name,
  with this read option on.
  (scm_read_sexp): If we start with [, we end with ].
  (scm_read_expression): Add case for [.

14 years agofix call counting in statprof, enhance repl support
Andy Wingo [Thu, 14 Jan 2010 21:52:07 +0000 (22:52 +0100)]
fix call counting in statprof, enhance repl support

* module/statprof.scm: Use VM modules, instead of using @ hacks.
  (statprof): New public export, a functional interface to the profiler.
  (profile-signal-handler, count-call, statprof-start, statprof-stop):
  Fix call counting with the VM.
  (statprof-call-data->stats): Hack around a case in which a call could
  be sampled but not counted, if you get my drift.
  (procedure=?): Update for current API.
  (with-statprof): Use `statprof'.

* module/system/repl/command.scm (profile): Use the `statprof'
  procedural interface.

14 years agovm.c uses scm_c_take_bytevector instead of scm_take_u8vector
Andy Wingo [Thu, 14 Jan 2010 12:55:50 +0000 (13:55 +0100)]
vm.c uses scm_c_take_bytevector instead of scm_take_u8vector

* libguile/vm.c (really_make_boot_program): Use scm_c_take_bytevector to
  avoid loading srfi-4 at boot time.

14 years ago1.8 compat in ice-9 syncase
Andy Wingo [Wed, 13 Jan 2010 23:40:20 +0000 (00:40 +0100)]
1.8 compat in ice-9 syncase

* module/ice-9/syncase.scm: Export datum->syntax-object and
  syntax-object->datum as aliases of datum->syntax and syntax->datum.
  Thanks to Daniel Llorens del Río for the suggestion.

14 years agovm-trace prints return values
Andy Wingo [Wed, 13 Jan 2010 23:09:54 +0000 (00:09 +0100)]
vm-trace prints return values

* module/system/vm/trace.scm (vm-trace): Add a #:width argument. Print
  return values, as Chez Scheme does.

14 years agoRETURN_HOOK communicates the number of returned values
Andy Wingo [Wed, 13 Jan 2010 22:14:12 +0000 (23:14 +0100)]
RETURN_HOOK communicates the number of returned values

* libguile/vm-engine.h (RUN_HOOK1): Add some machinery whereby a hook
  can push an arg on the stack, run the hook, then drop the value.
  (RETURN_HOOK): Use it here, so we push the number of returned values.

* libguile/vm-i-system.c (return, return-values): Adapt to RETURN_HOOK
  changes.

14 years agovm-trace only traces execution of its thunk
Andy Wingo [Wed, 13 Jan 2010 21:49:14 +0000 (22:49 +0100)]
vm-trace only traces execution of its thunk

* module/system/vm/trace.scm (vm-trace): Change to just export the one
  procedure, vm-trace. This way it's threadsafe and more robust. Also
  refactor to not print any of Guile's internal bits. Hopefully Neil
  will be happier :)

* module/system/repl/command.scm (option): Adapt to removal of
  vm-trace-on! and vm-trace-off!, as those are unlikely to DTRT.

14 years agoremove unused var in read.c
Andy Wingo [Wed, 13 Jan 2010 20:08:54 +0000 (21:08 +0100)]
remove unused var in read.c

* libguile/read.c (scm_read_character): Remove unused var.

14 years agoUse `mkstemp' instead of `mktemp'.
Thien-Thi Nguyen [Wed, 13 Jan 2010 08:49:44 +0000 (09:49 +0100)]
Use `mkstemp' instead of `mktemp'.

* test-suite/standalone/test-unwind.c (check_ports):
Use `mkstemp' instead of `mktemp'.

Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
14 years agoUpdate configure script hints wrt precious env vars.
Thien-Thi Nguyen [Sat, 9 Jan 2010 09:07:48 +0000 (10:07 +0100)]
Update configure script hints wrt precious env vars.

* README: Don't suggest setting vars before running configure.
Instead, suggest specifying them on the configure command-line.

Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
14 years agoDocument R6RS hex escapes
Michael Gran [Wed, 13 Jan 2010 15:26:10 +0000 (07:26 -0800)]
Document R6RS hex escapes

* doc/ref/api-data.texi (Characters, String Syntax): document r6rs hex
  escapes

* doc/ref/api-options.texi (Reader Options): document r6rs-hex-escapes
  reader option

14 years agoDisable \u and \U escapes when r6rs-hex-escapes enabled
Michael Gran [Wed, 13 Jan 2010 15:02:07 +0000 (07:02 -0800)]
Disable \u and \U escapes when r6rs-hex-escapes enabled

When the reader option 'r6rs-hex-escapes is enabled, the \uNNNN and
\UNNNNNN string escape sequences should be disabled.

* libguile/read.c (scm_read_string): added checks for SCM_R6RS_ESCAPES_P

14 years agoMove r6rs-hex-escape tests into reader.test
Michael Gran [Wed, 13 Jan 2010 05:27:30 +0000 (21:27 -0800)]
Move r6rs-hex-escape tests into reader.test

* test-suite/tests/reader.test (r6rs-hex-escapes): new tests

* test-suite/tests/chars.test (R6RS Hex escapes): remove tests by reverting
  to previous version

* test-suite/tests/strings.test (R6RS Hex escapes): remove tests by
  reverting to previous version

14 years agoReader option for R6RS hex escapes
Michael Gran [Wed, 13 Jan 2010 05:02:41 +0000 (21:02 -0800)]
Reader option for R6RS hex escapes

This adds a reader option 'r6rs-hex-escapes that modifies the
behavior of numeric escapes in characters and strings.  When enabled,
variable-length character hex escapes (#\xNNN) are allowed and become
the default output format for numerically-escaped characters.  Also,
string hex escapes switch to a semicolon terminated hex escape (\xNNNN;).

* libguile/print.c (PRINT_CHAR_ESCAPE): new macro
  (iprin1): use new macro PRINT_CHAR_ESCAPE

* libguile/private-options.h (SCM_R6RS_ESCAPES_P): new #define

* libguile/read.c (scm_read_opts): add new option r6rs-hex-escapes
  (SCM_READ_HEX_ESCAPE): modify to take a terminator parameter
  (scm_read_string): parse R6RS hex string escapes
  (scm_read_character): parse R6RS hex character escapes

* test-suite/tests/chars.test (with-read-options): new procedure
  (R6RS hex escapes): new tests

* test-suite/tests/strings.test (with-read-options): new procedure
  (R6RS hex escapes): new tests

14 years agofix texinfo reflection for procedures
Andy Wingo [Tue, 12 Jan 2010 21:50:10 +0000 (22:50 +0100)]
fix texinfo reflection for procedures

* module/system/vm/program.scm (program-arguments-alist): Rename from
  program-arguments, a name shadowed by features.c
  (arglist->arguments-alist, arity->arguments-alist)
  (arguments-alist->lambda-list, program-lambda-list, write-program):
  Adapt callers.

* module/system/vm/frame.scm (frame-lookup-binding): Return #f if the
  binding is not found, not an error.
  (frame-binding-set!, frame-binding-ref): Adapt to error appropriately.
  (frame-arguments): Dispatch to frame-call-representation.
  (frame-call-representation): Refactor a bit.

* module/ice-9/session.scm (procedure-arguments): Adapt to
  program-arguments name change.

* module/texinfo/reflection.scm (get-proc-args): Refactor to actually
  work with VM procedures.

14 years agoallow simple value definitions with define*-public
Andy Wingo [Tue, 12 Jan 2010 19:15:36 +0000 (20:15 +0100)]
allow simple value definitions with define*-public

* module/ice-9/optargs.scm (define*-public): Allow (define*-public ID
  VAL).

14 years agohopefully fix shared c32 / c64 uniform arrays
Andy Wingo [Tue, 12 Jan 2010 19:14:06 +0000 (20:14 +0100)]
hopefully fix shared c32 / c64 uniform arrays

* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Add a width parameter,
  indicating the number of sizeof(ctype) entries comprised by one
  element of the uniform; normally 1, but 2 for c32 and c64.

14 years agomake-array bugfix
Andy Wingo [Mon, 11 Jan 2010 23:21:16 +0000 (00:21 +0100)]
make-array bugfix

* libguile/vm-i-scheme.c (make-array): Fix terrible stack corruption
  bug.

14 years agoinspector integration in debugger
Andy Wingo [Mon, 11 Jan 2010 23:20:50 +0000 (00:20 +0100)]
inspector integration in debugger

* module/system/vm/debug.scm: Integrate with the inspector. Add a
  "procedure" command.

14 years agofix srfi-4 shared vector access from c
Andy Wingo [Mon, 11 Jan 2010 23:20:10 +0000 (00:20 +0100)]
fix srfi-4 shared vector access from c

* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix
  elements/writable_elements for shared vectors. Thanks to Daniel
  Llorens del Río for the info.

14 years agoprograms print as #<procedure ...>
Andy Wingo [Mon, 11 Jan 2010 23:19:18 +0000 (00:19 +0100)]
programs print as #<procedure ...>

* module/system/vm/program.scm (write-program): Print as #<procedure
  ...>. Fix stdin printing.

* doc/ref/vm.texi: Update a little bit.

14 years agoadd a silly inspector
Andy Wingo [Mon, 11 Jan 2010 23:18:24 +0000 (00:18 +0100)]
add a silly inspector

* module/Makefile.am:
* module/system/vm/inspect.scm: Add a very simple and stupid inspector.

14 years agoremove section on enclose-array
Andy Wingo [Mon, 11 Jan 2010 21:29:38 +0000 (22:29 +0100)]
remove section on enclose-array

* doc/ref/api-compound.texi (Array Procedures): Remove section on
  `enclose-array', as it doesn't exist any more.

14 years agofix compilation of #2((1 2 3) (4 5 6))
Andy Wingo [Mon, 11 Jan 2010 21:21:18 +0000 (22:21 +0100)]
fix compilation of #2((1 2 3) (4 5 6))

* module/language/glil/compile-assembly.scm (dump-object): Whoops,
  really fix for multidimensional arrays.

14 years agoallow (define* SYM VAL)
Andy Wingo [Mon, 11 Jan 2010 21:08:07 +0000 (22:08 +0100)]
allow (define* SYM VAL)

* module/ice-9/psyntax.scm (define*): Allow (define* SYM VAL), as 1.8
  did. Thanks to Patrick McCarty for the report.

14 years agoallow compilation of #@2(1 2 3)
Andy Wingo [Mon, 11 Jan 2010 20:47:10 +0000 (21:47 +0100)]
allow compilation of #@2(1 2 3)

* libguile/arrays.h:
* libguile/arrays.c (scm_from_contiguous_array): New public function,
  like scm_from_contiguous_typed_array but for arrays of generic Scheme
  values.

* libguile/vm-i-scheme.c (make-struct): Sync regs before making the
  struct, so if we get a GC the regs are on the heap.
  (make-array): New instruction, makes an generic (untyped) Scheme
  array.

* module/language/glil/compile-assembly.scm (dump-object): Correctly
  compile arrays.

14 years agofix erroneous compilation of #@2(1 2 3) as #(1 2 3)
Andy Wingo [Mon, 11 Jan 2010 19:45:52 +0000 (20:45 +0100)]
fix erroneous compilation of #@2(1 2 3) as #(1 2 3)

* module/language/glil/compile-assembly.scm (dump-object): Fix the
  vector case to only match 0-indexed, vectors, not arrays like #@2(1 2
  3).

14 years agoEvaluate the `export' and `re-export' forms at compile-time.
Ludovic Courtès [Mon, 11 Jan 2010 17:30:13 +0000 (18:30 +0100)]
Evaluate the `export' and `re-export' forms at compile-time.

* module/ice-9/boot-9.scm (export, re-export): Evaluate at compile-time
  in addition to load/eval.

* test-suite/tests/tree-il.test ("warnings")["unused-toplevel"]("unused
  but define-public"): Remove throw to `unresolved'.

14 years agoThe reference graph in `-Wunused-toplevel' may contain cycles.
Ludovic Courtès [Mon, 11 Jan 2010 17:28:19 +0000 (18:28 +0100)]
The reference graph in `-Wunused-toplevel' may contain cycles.

* module/language/tree-il/analyze.scm (<reference-graph>,
  dag-reachable-nodes, dag-reachable-nodes*, unused-toplevel-analysis):
  Replace occurrences of "dag" by "graph".

14 years agoRefactor repeated code in scm_read_string
Michael Gran [Mon, 11 Jan 2010 02:24:23 +0000 (18:24 -0800)]
Refactor repeated code in scm_read_string

* libguile/read.c (SCM_READ_HEX_ESCAPE): new macro
  (scm_read_string): use new macro SCM_READ_HEX_ESCAPE

14 years agoMove `feature?' to `deprecated.scm'.
Ludovic Courtès [Sun, 10 Jan 2010 23:25:20 +0000 (00:25 +0100)]
Move `feature?' to `deprecated.scm'.

* module/ice-9/boot-9.scm (feature?): Move to...

* module/ice-9/deprecated.scm (feature?): ... here.

14 years agoMake `(ice-9 deprecated)' a module of its own.
Ludovic Courtès [Sun, 10 Jan 2010 23:23:12 +0000 (00:23 +0100)]
Make `(ice-9 deprecated)' a module of its own.

* module/ice-9/boot-9.scm: Load `deprecated.scm' with
  `resolve-interface' instead of `primitive-load-path'.

* module/ice-9/deprecated.scm: Turned into a module, `(ice-9
  deprecated)'.

14 years agoMake `boot-9.scm' more friendly with `-Wunused-toplevel'.
Ludovic Courtès [Sun, 10 Jan 2010 22:58:48 +0000 (23:58 +0100)]
Make `boot-9.scm' more friendly with `-Wunused-toplevel'.

* module/ice-9/boot-9.scm: Switch back to the `(guile)' modules at the
  end when compiling.

14 years agoFix SRFI-19 exports.
Ludovic Courtès [Sun, 10 Jan 2010 22:57:01 +0000 (23:57 +0100)]
Fix SRFI-19 exports.

* module/srfi/srfi-19.scm: Export `time-monotonic->julian-day' and
  `time-monotonic->modified-julian-day'.  Remove obscure `current-time'
  hack.  Use `(define-module :export ...)' instead of `(export ...)'.

14 years agoRemove unused top-level variables.
Ludovic Courtès [Sun, 10 Jan 2010 22:52:15 +0000 (23:52 +0100)]
Remove unused top-level variables.

* module/ice-9/runq.scm (fork-strips): Remove.

* module/language/assembly.scm (*block-alignment*): Remove.

* module/language/assembly/disassemble.scm (disassemble-objects,
  simplify): Remove.

* module/srfi/srfi-18.scm (mutex-owners): Remove.

* module/srfi/srfi-19.scm (leap-year?): Remove.

* module/system/base/compile.scm (dsu-sort): Remove.

* module/texinfo.scm (ascii->char): Remove.

* module/texinfo/html.scm (ignored?): Remove.

* module/texinfo/indexing.scm (def-name): Remove.

* module/texinfo/plain-text.scm (ignore): Remove.

14 years agoHave "guile-tools compile" use the current locale.
Ludovic Courtès [Sun, 10 Jan 2010 22:48:43 +0000 (23:48 +0100)]
Have "guile-tools compile" use the current locale.

* meta/guile-tools.in (main): Install the user's locale.

14 years agoProvide Guile-friendly `coding:' meta-data.
Ludovic Courtès [Sun, 10 Jan 2010 22:47:55 +0000 (23:47 +0100)]
Provide Guile-friendly `coding:' meta-data.

* module/ice-9/i18n.scm, module/rnrs/bytevector.scm,
  module/rnrs/io/ports.scm, module/scripts/compile.scm,
  module/srfi/srfi-35.scm, module/srfi/srfi-88.scm: Write `coding:'
  comment at the top.

14 years agoAdd `-Wunused-toplevel' compiler warning.
Ludovic Courtès [Mon, 11 Jan 2010 00:19:16 +0000 (01:19 +0100)]
Add `-Wunused-toplevel' compiler warning.

* module/language/tree-il/analyze.scm (<reference-dag>): New record
  type.
  (dag-reachable-nodes, dag-reachable-nodes*, unused-variable-analysis):
  New variables.
  (unbound-variable-analysis): Slightly simplify the `up' procedure.

* module/language/tree-il/compile-glil.scm (%warning-passes): Add
  `unused-toplevel'.

* module/system/base/message.scm (%warning-types): Likewise.

* test-suite/tests/tree-il.test (%opts-w-unused-toplevel): New variable.
  ("warnings")["unused-toplevel"]: New test prefix.

14 years agoMerge branch 'master' of git.sv.gnu.org:/srv/git/guile
Michael Gran [Sun, 10 Jan 2010 23:41:55 +0000 (15:41 -0800)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/guile

14 years agoAdd R6RS backspace string escape
Michael Gran [Sun, 10 Jan 2010 23:41:37 +0000 (15:41 -0800)]
Add R6RS backspace string escape

R6RS suggests that '\b' should be a string escape for the backspace
character.

* libguile/read.c (scm_read_string): parse backspace escape

* test-suite/tests/strings.test (R6RS backslash escapes): new test
  (Guile extensions backslash escapes): remove R6RS escapes from test.

* doc/ref/api-data.texi (Strings): document new string escape

14 years agoAdd R6RS backslash string escape
Michael Gran [Sun, 10 Jan 2010 23:39:55 +0000 (15:39 -0800)]
Add R6RS backslash string escape

R6RS suggests that '\b' should be a string escape for the backslash
character.

* libguile/read.c (scm_read_string): parse backspace escape

* test-suite/tests/strings.test (R6RS backslash escapes): new test
  (Guile extensions backslash escapes): remove R6RS escapes from test.

* doc/ref/api-data.texi (Strings): document new string escape

14 years agoAdd R6RS character names
Michael Gran [Sun, 10 Jan 2010 23:08:19 +0000 (15:08 -0800)]
Add R6RS character names

R6RS adds new names for some of the control characters.

* libguile/chars.c (scm_r6rs_charnames, scm_r6rs_charnums)
  (SCM_N_R6RS_CHARNAMES): new character name constants
  (scm_alt_charnames, scm_alt_charnums): modified to remove duplicates
  (scm_i_charname, scm_i_charname_to_char): use new constants

* test-suite/tests/chars.test (R5RS character names, R6RS character names):
  new tests

* doc/ref/api-data.texi (Characters): updated

14 years agofix properties disassembly
Andy Wingo [Sun, 10 Jan 2010 22:24:19 +0000 (23:24 +0100)]
fix properties disassembly

* module/language/assembly/disassemble.scm (disassemble-meta):
  Properties start with the fourth element, not the third. (The third is
  the set of arities.)

14 years agoshow args to subr calls in backtraces
Andy Wingo [Sun, 10 Jan 2010 22:10:24 +0000 (23:10 +0100)]
show args to subr calls in backtraces

* module/system/vm/frame.scm (frame-arguments): For subrs, we don't get
  names in the lambda-list, we get #f instead. But still, parse out the
  args in that case, assuming they are on the stack in that order.