bpt/guile.git
13 years agoOptimize `vlist-fold-right'.
Ludovic Courtès [Sun, 8 May 2011 16:15:10 +0000 (18:15 +0200)]
Optimize `vlist-fold-right'.

* module/ice-9/vlist.scm (vlist-fold-right): Avoid `vlist-reverse' and
  instead `vlist-ref' individual elements.  The result is about twice
  faster.  Thanks Andy for suggesting it indirectly.  :-)

13 years agoadd map and for-each benchmarks
Andy Wingo [Sun, 8 May 2011 15:27:41 +0000 (17:27 +0200)]
add map and for-each benchmarks

* benchmark-suite/benchmarks/srfi-1.bm ("map", "for-each"): Add
  benchmarks.

13 years agoFix small integer return value packing on big endian machines.
Ludovic Courtès [Sun, 8 May 2011 15:21:59 +0000 (17:21 +0200)]
Fix small integer return value packing on big endian machines.

* libguile/foreign.c (pack): Add `return_value_p' parameter.  Update
  callers.
  When RETURN_VALUE_P is true, assume LOC points to an `ffi_arg', and
  cast its results to the relevant type.  This fixes packing of integer
  return values smaller than `int' on SPARC64 and PowerPC64.  Reported
  by Nelson H. F. Beebe <beebe@math.utah.edu>.

13 years agoMake the definition of `scm_read_shebang' match its declaration.
Ludovic Courtès [Sun, 8 May 2011 14:25:01 +0000 (16:25 +0200)]
Make the definition of `scm_read_shebang' match its declaration.

* libguile/read.c (scm_read_shebang): Remove the `inline' keyword.

13 years agocompile-assembly: cleanup
Andy Wingo [Sun, 8 May 2011 14:38:32 +0000 (16:38 +0200)]
compile-assembly: cleanup

* module/language/glil/compile-assembly.scm: Clean up code for
  subprograms (not needed, we just cache the glil) and object alists
  (replaced by constants tables).

13 years agocompile-assembly: use file-level constants table
Andy Wingo [Sun, 8 May 2011 14:37:47 +0000 (16:37 +0200)]
compile-assembly: use file-level constants table

* module/language/glil/compile-assembly.scm (compile-assembly): Rework
  to handle toplevel-specific code generation here, instead of in
  glil->assembly.  Specifically, here we build a global constant table,
  and arrange for it to be the objtable of the toplevel thunk.

  (compile-program): New helper, compiles a <glil-program> and returns
  just the (load-program ...) form.

  (compile-objtable): New helper, generates assembly to build an object
  table, using some other constants table, and possibly recursing to
  `compile-program' for cached GLIL programs.

  (glil->assembly): Simplify, removing the toplevel? argument, and
  replacing the object alist with an objtable computed in a previous
  pass.  Adapt to the new form of the objtable, and to use
  compile-program and compile-objtable.

13 years agocompile-assembly: add dump-constants, a new helper
Andy Wingo [Sun, 8 May 2011 14:31:18 +0000 (16:31 +0200)]
compile-assembly: add dump-constants, a new helper

* module/language/glil/compile-assembly.scm (dump-constants): New
  helper.  Generates bytecode that will result in a vector for the
  global object table being pushed on the stack.  The items in the
  global object table will share state as much as possible.

13 years agocompile-assembly: add build-constant-store, build-object-table
Andy Wingo [Sun, 8 May 2011 14:15:25 +0000 (16:15 +0200)]
compile-assembly: add build-constant-store, build-object-table

* module/language/glil/compile-assembly.scm (immediate?): New helper.
  (build-constant-store): New helper.  Walks the GLIL tree and builds up
  a constant table, as a vhash.
  (build-object-table): Another helper, builds a constant table for a
  given GLIL program.

13 years agocompile-assembly: make-meta refactor
Andy Wingo [Sun, 8 May 2011 14:13:41 +0000 (16:13 +0200)]
compile-assembly: make-meta refactor

* module/language/glil/compile-assembly.scm (make-meta): Avoid going
  through the compiler.

13 years agocompile-assembly: add traversal helpers
Andy Wingo [Sun, 8 May 2011 14:09:22 +0000 (16:09 +0200)]
compile-assembly: add traversal helpers

* module/language/glil/compile-assembly.scm (vhash-fold-right2):
  (fold2, vector-fold2): Add some traversal helpers that we'll use in
  the next commit.

13 years agofix `hash' for inf and nan
Andy Wingo [Sun, 8 May 2011 14:05:27 +0000 (16:05 +0200)]
fix `hash' for inf and nan

* libguile/hash.c (scm_hasher): Fix to work on inf and nan.
* test-suite/tests/hash.test ("hash"): Add tests.

13 years agoMake the R6RS simple I/O library use conditions
Andreas Rottmann [Sat, 7 May 2011 21:40:14 +0000 (23:40 +0200)]
Make the R6RS simple I/O library use conditions

* module/rnrs/io/ports.scm (display): Implement as an
  exception-converting wrapper around Guile's core display.
* module/rnrs/io/simple.scm: Don't export Guile's corresponding core
  procedures, but use `(rnrs io ports)' instead.  This way, we get the
  conditions required by R6RS raised.

* doc/ref/r6rs.texi (rnrs io simple): Mention that these procedures are
  supposed to raise R6RS conditions.

13 years agoFix `get_utf8_codepoint' to not consume valid starting bytes.
Ludovic Courtès [Sat, 7 May 2011 20:46:38 +0000 (22:46 +0200)]
Fix `get_utf8_codepoint' to not consume valid starting bytes.

Thanks to Mark H. Weaver for pointing this out.

* libguile/ports.c (CONSUME_PEEKED_BYTE): New macro.
  (get_utf8_codepoint): New variable `pt'.  Use
  `scm_peek_byte_or_eof'/`CONSUME_PEEKED_BYTE' pairs instead of
  `scm_get_byte_or_eof'.

* test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42, #xe0 #xa0
  #x41 #x42, #xf0 #x88 #x88 #x88]: Fix to conform to Unicode 6.0.0.
  [#xe0 #x88 #x88]: Remove test.
  [#xf0 #x80 #x80 #x41]: New test.

13 years agoAdd `scm_peek_byte_or_eof'.
Ludovic Courtès [Sat, 7 May 2011 20:41:32 +0000 (22:41 +0200)]
Add `scm_peek_byte_or_eof'.

* libguile/inline.h (scm_get_byte_or_eof): Add `SCM_UNLIKELY' for EOF.
  (scm_peek_byte_or_eof): New function.

* libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_peek_byte_or_eof'.

13 years agoMore completely document the `(rnrs io ports)' library
Andreas Rottmann [Sat, 7 May 2011 20:30:40 +0000 (22:30 +0200)]
More completely document the `(rnrs io ports)' library

* doc/ref/api-io.texi (R6RS I/O Ports): Transcribe missing parts from
  the R6RS document.

13 years agofix srfi-1 map-in-order definition
Andy Wingo [Sat, 7 May 2011 09:31:38 +0000 (11:31 +0200)]
fix srfi-1 map-in-order definition

* module/srfi/srfi-1.scm (map-in-order): As we are not extending the
  core `map' binding, actually make a new `map-in-order' alias here.
  Fixes fresh builds.

13 years agoSpecial-case UTF-8 ports to bypass `iconv' entirely.
Ludovic Courtès [Fri, 6 May 2011 15:54:09 +0000 (17:54 +0200)]
Special-case UTF-8 ports to bypass `iconv' entirely.

* libguile/ports.c (update_port_lf): Handle EOF.
  (get_utf8_codepoint, get_iconv_codepoint): New functions.
  (get_codepoint): Use them.
  (scm_i_set_port_encoding_x): Don't open conversion descriptors when
  ENCODING is "UTF-8".

* libguile/print.c (display_string_as_utf8, display_string_using_iconv):
  New functions.
  (display_string): Use them.

* test-suite/tests/ports.test ("string ports")[#xc2 #x41 #x42]: Add a
  note that this is not the wrong behavior per Unicode 6.0.0.

13 years agoFix `foreign.test' for big endian machines.
Ludovic Courtès [Fri, 6 May 2011 15:43:37 +0000 (17:43 +0200)]
Fix `foreign.test' for big endian machines.

* test-suite/tests/foreign.test ("pointer<->bytevector")["pointer from
  bits", "dereference-pointer"]: Fix iteration order for big endian
  machines.

13 years agoavoid tls gets when handling interrupts in the vm
Andy Wingo [Thu, 5 May 2011 22:17:35 +0000 (00:17 +0200)]
avoid tls gets when handling interrupts in the vm

* libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a
  scm_i_thread* as well.  OK to do because it's within a
  BUILDING_LIBGUILE block.

* libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of
  the dynstate, so we can use the thread for ticks.

* libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the
  scm_i_thread* local var, to avoid excessive tls calls.

* libguile/vm-i-system.c: Fix dynstate users to use
  current_thread->dynamic_state.

13 years agomap and for-each in scheme
Andy Wingo [Thu, 5 May 2011 21:07:23 +0000 (23:07 +0200)]
map and for-each in scheme

* module/ice-9/boot-9.scm (map, for-each): Implement in Scheme instead
  of C.  There are boot versions before `cond' is defined.
  (map-in-order): Define this alias here instead of in evalext.h.

* libguile/eval.c: Stub out the map and for-each definitions to just
  call into Scheme.

* libguile/evalext.c: Remove map-in-order definition.

* module/srfi/srfi-1.scm: Replace all calls to map1 with calls to map.
  (map, for-each): Define implementations here, in Scheme, instead of in
  C.

* test-suite/tests/eval.test (exception:wrong-length, "map"): Update the
  expected exception for mapping over lists of different lengths.

* libguile/srfi-1.h:
* libguile/srfi-1.c: Remove map and for-each definitions.  Remove the
  bit that extended the core `map' primitive with another method: the
  right way to do that is with modules.

13 years agopsyntax simplification
Andy Wingo [Thu, 5 May 2011 14:28:28 +0000 (16:28 +0200)]
psyntax simplification

* module/ice-9/psyntax.scm (strip): Inline the and-map* definition to
  its one call site.

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

13 years agoscm_mem[qv] optimization
Andy Wingo [Thu, 5 May 2011 13:13:08 +0000 (15:13 +0200)]
scm_mem[qv] optimization

* libguile/list.c (scm_memq, scm_memv): Inline the tortoise/hare check
  that scm_ilength does, via SCM_VALIDATE_LIST, into the memq/memv
  bodies.  Avoids traversing these lists twice.

13 years agoGenerate `escape' and `substitute' port decoding tests.
Ludovic Courtès [Thu, 5 May 2011 15:56:47 +0000 (17:56 +0200)]
Generate `escape' and `substitute' port decoding tests.

13 years agoVM tweaks
Andy Wingo [Thu, 5 May 2011 12:04:23 +0000 (14:04 +0200)]
VM tweaks

* libguile/vm-engine.c (VM_CHECK_OBJECT, VM_CHECK_FREE_VARIABLES): Set
  to 0 for both engines.  These are really internal debugging variables,
  which don't affect user-visible features, provided that the compiler
  is correct of course.
  (VM_CHECK_UNDERFLOW): New var, also off by default: whether to check
  for stack underflow when popping values.
  (vm_engine): Don't declare object_count if we are not checking object
  table accesses.

* libguile/vm-engine.h (CACHE_PROGRAM): Don't muck with object_count
  if we are not checking object table accesses.
  (CHECK_UNDERFLOW, PRE_CHECK_UNDERFLOW): Nop out if we are not checking
  underflow.
  (POP2, POP3): New macros which check for underflow before popping more
  than one value.

* libguile/vm-i-loader.c (load_array):
* libguile/vm-i-scheme.c (set_car, set_cdr, vector_set, slot_set)
  (BV_SET_WITH_ENDIANNESS, BV_FIXABLE_INT_SET, BV_INT_SET)
  (BV_FLOAT_SET):
* libguile/vm-i-system.c (partial_cont_call, fix_closure, prompt)
  (fluid_set): Use POP2 / POP3.
  (local_set, long_local_set): Pop to locals instead of using values on
  the stack then dropping; allows for underflow to be checked before the
  value is accessed.
  (BR): Don't NULLSTACK or DROP after the operation.
  (br_if, br_if_not, br_if_eq, br_if_not_eq, br_if_null)
  (br_if_not_null): Pop to locals before doing the compare and jump.

13 years agosrfi-1 `member' in scheme, inlines to memq / memv in some cases
Andy Wingo [Thu, 5 May 2011 10:59:07 +0000 (12:59 +0200)]
srfi-1 `member' in scheme, inlines to memq / memv in some cases

* libguile/srfi-1.c:
* libguile/srfi-1.h (scm_srfi1_member): Move implementation to Scheme.

* module/srfi/srfi-1.scm (member): Implement here, with the inlining
  cases for eq? and eqv?.  Speeds up a compiled bootstrap of
  psyntax.scm, because lset-adjoin inlines to the memq case.
  (lset<=): Reindent.

  (lset-adjoin, lset-union): If the comparator is eq? or eqv?, just pass
  it through to `member', so we inline to memq / memv.  Use something
  closer to the reference implementations.

13 years agospeed up compile-bytecode
Andy Wingo [Thu, 5 May 2011 09:22:42 +0000 (11:22 +0200)]
speed up compile-bytecode

* module/language/assembly/compile-bytecode.scm (compile-bytecode):
  Rewrite to fill a bytevector directly, instead of using bytevector
  ports.  `write-bytecode' itself is still present and almost the same
  as before; it's just that `write-byte' et al now inline the effect of
  writing a byte to a binary port.

* test-suite/tests/asm-to-bytecode.test (comp-test): Refactor to use
  public interfaces.

13 years agosilly "optimization" in (language assembly)
Andy Wingo [Thu, 5 May 2011 08:09:48 +0000 (10:09 +0200)]
silly "optimization" in (language assembly)

* module/language/assembly.scm (byte-length): Silly, minor tweak: put
  the fixed-length instruction case first.  Seems to shave some 10% off
  the time compiling psyntax.scm (when the whole rest of the system is
  compiled, of course).

13 years agoadd gcprof
Andy Wingo [Thu, 5 May 2011 08:08:29 +0000 (10:08 +0200)]
add gcprof

* module/statprof.scm (gcprof): New variant of statprof; instead of
  being driven by setitimer, this one is driven by the after-gc-hook.

13 years agominor statprof tweaks
Andy Wingo [Thu, 5 May 2011 07:59:59 +0000 (09:59 +0200)]
minor statprof tweaks

* module/statprof.scm (statprof-reset): Make full-stacks? into an
  optional arg instead of doing the rest arg dance.
  (statprof-display): Format gc-time-taken appropriately.

13 years agoAutomatically generate `peek-char' decoding error tests.
Ludovic Courtès [Wed, 4 May 2011 21:52:53 +0000 (23:52 +0200)]
Automatically generate `peek-char' decoding error tests.

* test-suite/tests/ports.test ("string ports")[make-peek+read-checks]:
  New macro.
  [test-decoding-error]: Change to take a list of expected characters or
  conditions.  Use `make-peek+read-checks' to generate a `peek-char'
  test.
  [(#xc2 #x41 #x42), (#xe0 #xa0 #x41 #x42)]: New tests.

13 years agomeasure time spent in gc
Andy Wingo [Wed, 4 May 2011 16:48:02 +0000 (18:48 +0200)]
measure time spent in gc

* libguile/gc.c (scm_gc_stats): Set the gc-time-taken entry to our
  recorded value.
  (start_gc_timer, accumulate_gc_timer, scm_init_gc): Arrange to record
  a conservative estimate of time spent in GC.

13 years agoscm_c_get_internal_run_time is more precise
Andy Wingo [Wed, 4 May 2011 18:15:23 +0000 (20:15 +0200)]
scm_c_get_internal_run_time is more precise

* libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C
  variable instead of being a pure preprocessor thing.  This has the
  possibility to break existing compiled C extensions' interpretation of
  the internal-time-units-per-second, but hopefully there's no too much
  of that code out there, and in the worst case they can just
  recompile.  Scheme code will get it right without the need to
  recompile.

* libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and
  increase to nanosecond resolution if we are on a system in which this
  is useful and practical.
  (time_from_seconds_and_nanoseconds): New helper.
  (get_internal_real_time, get_internal_run_time): New global vars:
  function pointers.
  (get_internal_real_time_posix_timer):
  (get_internal_run_time_posix_timer):
  (get_internal_real_time_gettimeofday):
  (get_internal_run_time_times):
  (get_internal_real_time_fallback): Various implementations.
  (scm_get_internal_real_time): Return the get_internal_real_time()
  result.
  (scm_c_get_internal_run_time): Likewise.
  (scm_gettimeofday): No need for a critical section, and remove
  obsolete ftime block.
  (scm_init_stime): Init all of the new time bases, and decide on
  implementations of real time and run time accessors.

13 years agobuild support for detecting clock_gettime, with -lrt if needed
Andy Wingo [Wed, 4 May 2011 18:16:55 +0000 (20:16 +0200)]
build support for detecting clock_gettime, with -lrt if needed

* acinclude.m4 (gl_CLOCK_TIME):
* configure.ac: Locally include gl_CLOCK_TIME.  To be fixed properly
  when gnulib updates their license to reflect the actual BSD state of
  things.
* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
  Add -lrt for clock_gettime, if needed.
* meta/guile-2.0-uninstalled.pc.in:
* meta/guile-2.0.pc.in: Likewise, in Libs.private.

13 years agoFix call-with-input-file & relatives for multiple values
Daniel Llorens [Mon, 2 May 2011 18:36:33 +0000 (20:36 +0200)]
Fix call-with-input-file & relatives for multiple values

* module/ice-9/r4rs.scm (call-with-input-file, call-with-output-file): Rewrite
  with call-with-values.
  (with-input-from-file): use call-with-input-file.
  (with-output-to-file, with-error-to-file): use call-with-output-file.
  Update docstrings to make clear that multiple values may be yielded.

13 years agodeprecate scm_struct_table
Andy Wingo [Sun, 1 May 2011 21:00:55 +0000 (23:00 +0200)]
deprecate scm_struct_table

* libguile/goops.h:
* libguile/goops.c (scm_i_define_class_for_vtable): New internal helper,
  defines a class for a vtable, relying on the name slot being set
  correctly.
  (scm_class_of, create_struct_classes): Use the local vtable-to-class
  map instead of scm_struct_table.

* libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME)
  (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table)
  (scm_struct_create_handle): Deprecate these internals of the map
  between structs and classes.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_struct_create_handle): Deprecated code over
  here now.

13 years agodisallow get-handle / create-handle! of weak hash tables
Andy Wingo [Sun, 1 May 2011 18:34:47 +0000 (20:34 +0200)]
disallow get-handle / create-handle! of weak hash tables

* libguile/hashtab.c (scm_hashq_get_handle, scm_hashq_create_handle_x)
  (scm_hashv_get_handle, scm_hashv_create_handle_x)
  (scm_hash_get_handle, scm_hash_create_handle_x)
  (scm_hashx_get_handle, scm_hashx_create_handle_x): Don't allow these
  functions to be called on weak hash tables, as we have no idea when
  the GC will null out fields of the handle, and set-cdr! won't register
  disappearing links, and set-car! would never work of course.

13 years ago(ice-9 poe) does not get handles from weak hash tables
Andy Wingo [Sun, 1 May 2011 19:43:04 +0000 (21:43 +0200)]
(ice-9 poe) does not get handles from weak hash tables

* module/ice-9/poe.scm (pure-funcq, perfect-funcq): Reimplement to not
  use get-handle.

13 years agoboot-9 fixme note
Andy Wingo [Sun, 1 May 2011 19:01:29 +0000 (21:01 +0200)]
boot-9 fixme note

* module/ice-9/boot-9.scm (module-replace!): Add a fixme about using
  something other than object properties here.

13 years agofix scm_object_property_set_x for handles and weak tables
Andy Wingo [Sun, 1 May 2011 19:00:54 +0000 (21:00 +0200)]
fix scm_object_property_set_x for handles and weak tables

* libguile/objprop.c (scm_object_property_set_x): Use ref and set!
  instead of create-handle and set-cdr!, as it is a weak hash table.
  (scm_set_object_properties_x): Likewise.

13 years agodeprecated primitive-properties don't get handles from weak hash tables
Andy Wingo [Sun, 1 May 2011 18:32:28 +0000 (20:32 +0200)]
deprecated primitive-properties don't get handles from weak hash tables

* libguile/deprecated.c (scm_primitive_property_ref)
  (scm_primitive_property_set_x): Avoid getting handles to elements in a
  weak hash table, as that's not going to work very well.

13 years agodeprecate scm_whash API
Andy Wingo [Sun, 1 May 2011 18:30:54 +0000 (20:30 +0200)]
deprecate scm_whash API

* libguile/deprecated.h:
* libguile/deprecated.c (scm_whash_get_handle, SCM_WHASHFOUNDP)
  (SCM_WHASHREF, SCM_WHASHSET, scm_whash_create_handle)
  (scm_whash_lookup, scm_whash_insert): Deprecate this API.

* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/read.c (scm_read_sexp): Use the hashq API instead of the
  whash API.

13 years agofix hash-set! in weak-value table from non-immediate to immediate
Andy Wingo [Sun, 1 May 2011 16:01:42 +0000 (18:01 +0200)]
fix hash-set! in weak-value table from non-immediate to immediate

* libguile/hashtab.c (set_weak_cdr, scm_hash_fn_set_x): If we have a
  weak-value hash table with a previous non-immediate value for a given
  key, and we are setting an immediate as the new value, we were not
  unregistering the disappearing link.  Fixed.

13 years agopsyntax simplification
Andy Wingo [Fri, 29 Apr 2011 09:11:26 +0000 (11:11 +0200)]
psyntax simplification

* module/ice-9/psyntax.scm (id-var-name): Just rely on multiple-values
  truncation.

13 years agoMV truncation in the boot evaluator
Andy Wingo [Fri, 29 Apr 2011 09:10:38 +0000 (11:10 +0200)]
MV truncation in the boot evaluator

* libguile/eval.c (truncate_values): New helper.
  (EVAL1): New macro, does an eval then truncates the values.
  (eval, prepare_boot_closure_env_for_apply)
  (prepare_boot_closure_env_for_eval): Use EVAL1 in appropriate places
  to get multiple-values truncation even here in the boot evaluator.

eval.c fixen

13 years agolatin1 strings in vm error messages
Andy Wingo [Fri, 29 Apr 2011 09:07:25 +0000 (11:07 +0200)]
latin1 strings in vm error messages

* libguile/vm-engine.c: Use latin1 strings here for the string
  literals.

13 years agocheck for iconveh values at configure-time
Andy Wingo [Tue, 12 Apr 2011 11:12:56 +0000 (13:12 +0200)]
check for iconveh values at configure-time

* configure.ac: Check for the iconveh values here, instead of relying on
  gen-scmconfig to know them.  That doesn't work in general because
  gen-scmconfig runs on the build machine, not the target machine.

* libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the
  revision before 533d8212.

* libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR):
  (SCM_I_GSC_ICONVEH_QUESTION_MARK):
  (SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE):
* libguile/gen-scmconfig.c: Use configure-time substitutions to set
  SCM_ICONVEH_ERROR_HANDLER et al.

13 years ago-x error message fix
Andy Wingo [Thu, 28 Apr 2011 19:45:02 +0000 (21:45 +0200)]
-x error message fix

* module/ice-9/command-line.scm (compile-shell-switches): Fix error
  message for -x switch.

13 years agofix double-loading of script in -ds case
Andy Wingo [Thu, 28 Apr 2011 19:43:01 +0000 (21:43 +0200)]
fix double-loading of script in -ds case

* module/ice-9/command-line.scm (compile-shell-switches): In the -ds
  case, we were erroneously loading the script twice.  Fix that.

13 years agofix break example
Andy Wingo [Thu, 28 Apr 2011 19:33:12 +0000 (21:33 +0200)]
fix break example

* doc/ref/api-control.texi (while do): Fix a break example.

13 years agoallow while as an expression
Andy Wingo [Thu, 28 Apr 2011 11:08:22 +0000 (13:08 +0200)]
allow while as an expression

* module/ice-9/boot-9.scm (while): Specify the return value as #f under
  normal conditions, #t under (break), and arg... under (break arg...).
* test-suite/tests/syntax.test ("while"): Test.
* doc/ref/api-control.texi (while do): Document.

13 years agoadd reset and shift
Andy Wingo [Thu, 28 Apr 2011 10:17:56 +0000 (12:17 +0200)]
add reset and shift

* module/ice-9/control.scm (reset, shift): Add implementations of these
  operators from Wolfgang J Moeller, derived from implementations by
  Oleg Kiselyov.
  (reset*, shift*): Procedural variants.

* test-suite/tests/control.test ("shift and reset"): Add tests,
  originally from Oleg Kiselyov.

13 years agoFix typo in `NEWS'.
Ludovic Courtès [Wed, 27 Apr 2011 20:48:20 +0000 (22:48 +0200)]
Fix typo in `NEWS'.

13 years agoBump version number for 2.0.1.
Ludovic Courtès [Wed, 27 Apr 2011 20:39:38 +0000 (22:39 +0200)]
Bump version number for 2.0.1.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions
  such as `scm_c_public_ref' and `scm_from_latin1_keyword'.
  (LIBGUILE_INTERFACE_AGE): Increment.

13 years agoUpdate `NEWS'.
Ludovic Courtès [Wed, 27 Apr 2011 20:30:20 +0000 (22:30 +0200)]
Update `NEWS'.

13 years agoKeep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).
Ludovic Courtès [Wed, 27 Apr 2011 20:26:05 +0000 (22:26 +0200)]
Keep a 2.0.0-compatible `define-inlinable' macro in (srfi srfi-9).

Partially reverts 165b10ddfaaa8ecc72d45a9be7d29e7537dc2379 and
531c9f1dc51c4801c4d031ee80a31f15285a6b85.

* module/srfi/srfi-9.scm (define-inlinable): New macro.

13 years agoDocument `(ice-9 binary-ports)'.
Ludovic Courtès [Wed, 27 Apr 2011 20:14:31 +0000 (22:14 +0200)]
Document `(ice-9 binary-ports)'.

* doc/ref/api-io.texi (R6RS I/O Ports): Mention `(ice-9 binary-ports)'.

* NEWS: Update.

13 years agoAdd tests for UTF-8 ill-formed sequence handling.
Ludovic Courtès [Wed, 27 Apr 2011 19:55:42 +0000 (21:55 +0200)]
Add tests for UTF-8 ill-formed sequence handling.

* test-suite/tests/ports.test ("string ports"): Add for
  `test-decoding-error' tests for ill-formed UTF-8 sequences.  Thanks
  to Mark H Weaver <mhw@netris.org> for pointing this out.

13 years agoGracefully handle unterminated UTF-8 sequences instead of hitting an `assert'.
Ludovic Courtès [Wed, 27 Apr 2011 18:34:08 +0000 (20:34 +0200)]
Gracefully handle unterminated UTF-8 sequences instead of hitting an `assert'.

* libguile/ports.c (get_codepoint): Return EILSEQ when OUTPUT_SIZE == 0.

* test-suite/tests/ports.test ("string ports"): Add 2 tests for
  unterminated sequences.

13 years agoAdd a couple more Unicode I/O tests.
Ludovic Courtès [Wed, 27 Apr 2011 14:26:26 +0000 (16:26 +0200)]
Add a couple more Unicode I/O tests.

* test-suite/tests/ports.test ("string ports")["%default-port-encoding
  is honored"]: Make sure `(port-encoding p)' is as expected.
  ["peek-char [utf-16]"]: New test.

13 years agoRewrite port decoding error tests using a mini DSL.
Ludovic Courtès [Wed, 27 Apr 2011 14:28:29 +0000 (16:28 +0200)]
Rewrite port decoding error tests using a mini DSL.

* test-suite/tests/ports.test ("string ports")[test-decoding-error]: New
  macro.
  ["read-char, wrong encoding, error", "read-char, wrong encoding,
  escape", "read-char, wrong encoding, substitute", "peek-char, wrong
  encoding, error"]: Rewrite using `test-decoding-error'.

13 years agoGracefully handle `setlocale' errors at the REPL.
Ludovic Courtès [Tue, 26 Apr 2011 22:57:16 +0000 (00:57 +0200)]
Gracefully handle `setlocale' errors at the REPL.

* module/ice-9/top-repl.scm (top-repl): Catch exceptions from
  `setlocale'.  Reported by CRLF0710 <crlf0710@gmail.com>.

13 years agoRemove the `sizeof (mpz_t)' check.
Ludovic Courtès [Mon, 25 Apr 2011 22:03:44 +0000 (00:03 +0200)]
Remove the `sizeof (mpz_t)' check.

* libguile/numbers.c: Remove `sizeof (mpz_t)' check, which wasn't need
  anymore since `make_bignum' doesn't make any such assumption.

13 years agoUse `scm_with_guile' in `test-pthread-create'.
Ludovic Courtès [Mon, 25 Apr 2011 21:59:12 +0000 (23:59 +0200)]
Use `scm_with_guile' in `test-pthread-create'.

* test-suite/standalone/test-pthread-create.c (inner_main): New
  function.
  (main): Call it within `scm_with_guile', instead of using
  `scm_init_guile'.  This improves portability--e.g.,
  `GC_get_stack_base', used by `scm_init_guile', failed on Darwin
  up to BDW-GC 7.1alpha4 included (thanks, Mark, for the hint.)

13 years agoUpdate Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'.
Ludovic Courtès [Mon, 25 Apr 2011 21:27:31 +0000 (23:27 +0200)]
Update Gnulib to v0.0-5158-g7d06b32; remove `strcase' and `version-etc-fsf'.

* m4/gnulib-cache.m4: Remove `strcase' and `version-etc-fsf'.

* configure.ac (POTENTIAL_GCC_CFLAGS): Remove `-Wundef'.

* libguile/script.c: Don't include <version-etc.h>.

13 years agoFix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.
Ludovic Courtès [Mon, 25 Apr 2011 21:54:47 +0000 (23:54 +0200)]
Fix `#ifdef HAVE_CONFIG_H' stanza in some stand-alone tests.

* test-suite/standalone/test-asmobs-lib.c,
  test-suite/standalone/test-extensions-lib.c,
  test-suite/standalone/test-ffi-lib.c,
  test-suite/standalone/test-list.c,
  test-suite/standalone/test-num2integral.c,
  test-suite/standalone/test-with-guile-module.c: Change `#ifndef
  HAVE_CONFIG_H' to `#ifdef HAVE_CONFIG_H' (!).

13 years agoCompile more file system related procedures when `--disable-posix'.
Ludovic Courtès [Mon, 25 Apr 2011 20:52:00 +0000 (22:52 +0200)]
Compile more file system related procedures when `--disable-posix'.

* libguile/filesys.c (scm_tc16_dir, scm_directory_stream_p, scm_opendir,
  scm_readdir, scm_rewinddir, scm_closedir, scm_dir_print,
  scm_dir_free, scm_lstat): Compile unconditionally.

13 years agoMove `{total,current}-processor-count' outside of `posix.c'.
Ludovic Courtès [Mon, 25 Apr 2011 20:41:58 +0000 (22:41 +0200)]
Move `{total,current}-processor-count' outside of `posix.c'.

* libguile/posix.c (scm_total_processor_count,
  scm_current_processor_count): Move to...
* libguile/threads.c: ... here.

* libguile/posix.h (scm_total_processor_count,
  scm_current_processor_count): Move declarations to...
* libguile/threads.h: ... here.

* test-suite/tests/posix.test ("nproc"): Move tests to...
* test-suite/tests/threads.test: ... here.

13 years agoMake the `sizeof (mpz_t)' check at compile-time.
Ludovic Courtès [Mon, 25 Apr 2011 20:36:30 +0000 (22:36 +0200)]
Make the `sizeof (mpz_t)' check at compile-time.

* libguile/init.c (scm_i_init_guile): Remove the `sizeof (mpz_t)'
  run-time check.

* libguile/numbers.c: Add a compile-time check for `sizeof (mpz_t)'.

13 years agoAdd pthread-related tests.
Ludovic Courtès [Fri, 22 Apr 2011 10:29:50 +0000 (12:29 +0200)]
Add pthread-related tests.

* test-suite/standalone/Makefile.am (test_scm_spawn_thread_CFLAGS,
  test_scm_spawn_thread_LDADD, test_pthread_create_CFLAGS,
  test_pthread_create_LDADD, test_pthread_create_secondary_CFLAGS,
  test_pthread_create_secondary_LDADD): New variables.
  (check_PROGRAMS)[BUILD_PTHREAD_SUPPORT]: Add `test-scm-spawn-thread',
  `test-pthread_create', `test-pthread_create-secondary'.
  (TESTS)[BUILD_PTHREAD_SUPPORT]: Likewise.

* test-suite/standalone/test-scm-spawn-thread.c,
  test-suite/standalone/test-pthread-create.c,
  test-suite/standalone/test-pthread-create-secondary.c: New files.

13 years agoMake `scm_i_ensure_signal_delivery_thread' call in Guile mode.
Ludovic Courtès [Mon, 25 Apr 2011 14:44:54 +0000 (16:44 +0200)]
Make `scm_i_ensure_signal_delivery_thread' call in Guile mode.

* libguile/threads.c (on_thread_exit): Move
  `scm_i_ensure_signal_delivery_thread' call...
  (do_thread_exit): ... here.

13 years agoMake sure binary ports pass `binary-port?' regardless of the locale.
Ludovic Courtès [Fri, 22 Apr 2011 21:55:37 +0000 (23:55 +0200)]
Make sure binary ports pass `binary-port?' regardless of the locale.

* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop):
  Set `c_port->encoding' to NULL.

* test-suite/tests/r6rs-ports.test ("7.2.7 Input
  Ports")["bytevector-input-port is binary"]: New test.
  ("7.2.7 Input Ports")["make-custom-binary-input-port"]: Make sure PORT
  passes `binary-port?' and `input-port?'.
  ("8.2.10 Output ports")["bytevector-output-port is binary"]: New test.
  ["make-custom-binary-output"]: Rename to...
  ["make-custom-binary-output-port"]: ... this.

* test-suite/tests/ports.test ("string ports")["read-char, wrong
  encoding, error", "read-char, wrong encoding, escape", "read-char,
  wrong encoding, substitute", "peek-char, wrong encoding, error"]: Use
  `set-port-encoding!' instead of `%default-port-encoding' to set the
  encoding of bytevector input ports.

* test-suite/tests/rdelim.test ("read-line")["decoding error", "decoding
  error, substitute"]: Likewise.

* doc/ref/api-io.texi (R6RS Port Manipulation): Document `binary-port?'
  and `textual-port?'.

* doc/ref/r6rs.texi (R6RS Incompatibilities): Mention the soft
  distinction between textual and binary ports.

13 years agoTurn the libunistring/iconv configure check into a macro.
Ludovic Courtès [Fri, 22 Apr 2011 14:58:18 +0000 (16:58 +0200)]
Turn the libunistring/iconv configure check into a macro.

* acinclude.m4 (GUILE_LIBUNISTRING_WITH_ICONV_SUPPORT): New macro.

* configure.ac: Use it.

13 years agoFix typo in `configure.ac'.
Ludovic Courtès [Fri, 22 Apr 2011 14:40:58 +0000 (16:40 +0200)]
Fix typo in `configure.ac'.

* configure.ac: Add missing comma in `AC_RUN_IFELSE' invocation.

13 years agoIncrease the timeout of timing-sensitive thread tests.
Ludovic Courtès [Fri, 22 Apr 2011 14:18:14 +0000 (16:18 +0200)]
Increase the timeout of timing-sensitive thread tests.

* test-suite/tests/threads.test ("timed locking succeeds if mutex
  unlocked within timeout", "timed unlocking returns #t if condition
  signaled", "timed joining succeeds if thread exits within timeout"):
  Increase the timeout.  Reported by Dale P. Smith <dsmich@roadrunner.com>.

13 years agoadd test that libunistring was built with iconv support
Andy Wingo [Thu, 21 Apr 2011 10:27:49 +0000 (12:27 +0200)]
add test that libunistring was built with iconv support

* configure.ac: Add check that libunistring was built with iconv
  support.  Thanks to Mark Weaver for the debugging and test program.

13 years agoClarify units of string length in decription of scm_from_stringn
Mark H Weaver [Thu, 21 Apr 2011 13:56:11 +0000 (09:56 -0400)]
Clarify units of string length in decription of scm_from_stringn

* doc/ref/api-data.texi (Conversion to/from C): In description of
  scm_from_stringn, clarify that the length is specified in bytes.

13 years agoClarify the units of returned lengths in string conversion functions
Mark H Weaver [Wed, 20 Apr 2011 03:59:17 +0000 (23:59 -0400)]
Clarify the units of returned lengths in string conversion functions

* doc/ref/api-data.texi (Conversion to/from C): In descriptions of
  scm_to_stringn and scm_to_{latin1,utf8,utf32}, clarify that the
  returned length is in units of bytes or code points, not characters.
  Also change NULL to @code{NULL} in a few places.

13 years agofix pre-GC_set_start_callback compilation
Andy Wingo [Fri, 15 Apr 2011 16:41:34 +0000 (16:41 +0000)]
fix pre-GC_set_start_callback compilation

* libguile/gc.c: Move declaration of run_before_gc_hook up.

13 years agopre-GC_set_start_callback compatibility
Andy Wingo [Fri, 15 Apr 2011 16:31:06 +0000 (18:31 +0200)]
pre-GC_set_start_callback compatibility

* configure.ac: Add a check for GC_set_start_callback.

* libguile/gc.c (scm_i_gc): If we don't have GC_set_start_callback, run
  the before-gc hook manually here.
  (scm_init_gc): Otherwise set it as a start callback.

* libguile/hashtab.c (weak_gc_callback, weak_gc_hook)
  (weak_gc_finalizer, scm_c_register_weak_gc_callback): Fix to work
  either way, with or without GC_set_start_callback.

13 years agoweak hash table vacuum on before-gc C hook
Andy Wingo [Fri, 15 Apr 2011 16:05:23 +0000 (18:05 +0200)]
weak hash table vacuum on before-gc C hook

* libguile/hashtab.c (weak_gc_callback)
  (scm_c_register_weak_gc_callback): Change implementation to use the
  before-gc C hook instead of the after-gc finalizers.

13 years agouse gc_start_callback + asyncs for after-gc-hook, instead of finalizers
Andy Wingo [Fri, 15 Apr 2011 15:45:52 +0000 (17:45 +0200)]
use gc_start_callback + asyncs for after-gc-hook, instead of finalizers

* libguile/gc.c (run_before_gc_c_hook, scm_storage_prehistory)
  (after_gc_async_thunk, queue_after_gc_hook, scm_init_gc): Instead of
  playing our finalizer trick, connect to the GC start callback, and use
  it to queue an async after-gc-hook.  Seems to fix the after-gc-hook on
  non-threaded builds.  Though this does re-enable the before-gc C hook,
  we don't wire up the Scheme hook because we're in the alloc lock; and
  indeed, a before-GC scheme hook isn't a great idea...

13 years agoadd --fresh-auto-compile
Andy Wingo [Fri, 15 Apr 2011 09:27:27 +0000 (11:27 +0200)]
add --fresh-auto-compile

* doc/ref/api-evaluation.texi (Compilation): Add discussion of
  --fresh-auto-compile.
* doc/ref/scheme-scripts.texi (Invoking Guile): Add --fresh-auto-compile
  option.

* NEWS: Add entry.

* libguile/load.c: Define %fresh-auto-compile.
  (scm_primitive_load_path): Use it here.
  (scm_init_load_should_auto_compile): Init from GUILE_AUTO_COMPILE env
  var, with a value of "fresh".

* module/ice-9/boot-9.scm (load-in-vicinity): Auto-compilation cache is
  stale if %fresh-auto-compile is true.

* module/ice-9/command-line.scm (compile-shell-switches): Parse out
  --fresh-auto-compile.

13 years agoBuild `filesys.x'.
Ludovic Courtès [Fri, 15 Apr 2011 07:09:30 +0000 (09:09 +0200)]
Build `filesys.x'.

* libguile/Makefile.am (DOT_X_FILES): Add `filesys.x'.

13 years agoAllow compilation with `--disable-posix'.
Ludovic Courtès [Thu, 14 Apr 2011 21:42:28 +0000 (23:42 +0200)]
Allow compilation with `--disable-posix'.

Reported by Dmitry Dzhus <dima@dzhus.org>.

* configure.ac: Remove `AC_LIBOBJ([filesys])'.  Document
  `--disable-posix' as omitting non-essential POSIX interfaces.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
  Add `filesys.c'.
  (DOT_DOC_FILES): Add `filesys.doc'.
  (EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): Remove
  `filesys.c'.

* libguile/posix.c (scm_mkstemp, scm_access): Move to `filesys.c'.
  (scm_init_posix): Move `R_OK' etc. to `filesys.c'.

* libguile/filesys.c (scm_chown, scm_chmod, scm_umask, scm_open_fdes,
  scm_open, scm_close, scm_close_fdes, scm_link, scm_tc16_dir,
  scm_directory_stream_p, scm_opendir, scm_readdir, scm_rewinddir,
  scm_closedir, scm_dir_print, scm_dir_free, scm_chdir, scm_getcwd,
  set_element, fill_select_type, get_element, retrieve_select_type,
  scm_select, scm_fcntl, scm_fsync, scm_symlink, scm_readlink,
  scm_lstat, scm_copy_file): Conditionalize on HAVE_POSIX.
  (scm_mkstemp, scm_access): New functions.
  (scm_init_filesys): Conditionalize `scm_tc16_dir', `O_RDONLY', etc. on
  HAVE_POSIX.  Define `R_OK', `W_OK', etc.

* libguile/fports.c (fport_print): Use `scm_ttyname' only when
  HAVE_POSIX.

* libguile/i18n.c (lock_locale_mutex, unlock_locale_mutex): New
  functions.  Update users of `scm_i_locale_mutex' to use them.

* libguile/init.c (scm_i_init_guile): Always call `scm_init_filesys'.

* meta/guile-tools.in (main): Use `setlocale' only when it is defined.

* module/ice-9/boot-9.scm: Always load `ice-9/posix'.

13 years agoInclude <sched.h> in `posix.c'.
Ludovic Courtès [Thu, 14 Apr 2011 21:16:21 +0000 (23:16 +0200)]
Include <sched.h> in `posix.c'.

* configure.ac: Check for <sched.h>.

* libguile/posix.c [HAVE_SCHED_H]: Include <sched.h>, for
  `sched_setaffinity' & co.
  Reported by Marco Maggi <marco.maggi-ipsu@poste.it>.

13 years agoAdd tests for `-Wformat' and gettext.
Ludovic Courtès [Thu, 14 Apr 2011 21:14:14 +0000 (23:14 +0200)]
Add tests for `-Wformat' and gettext.

* test-suite/tests/tree-il.test ("warnings")["non-literal format string
  using gettext", "one missing argument, gettext"]: New tests.

13 years agofix analyze.scm literal string warnings
Andy Wingo [Thu, 14 Apr 2011 14:53:18 +0000 (16:53 +0200)]
fix analyze.scm literal string warnings

* module/language/tree-il/analyze.scm (const-fmt): Return any literal
  value, not just strings.  The string case is checked later.

13 years agofix embarrassing bugs in (ice-9 command-line)
Andy Wingo [Thu, 14 Apr 2011 14:46:49 +0000 (16:46 +0200)]
fix embarrassing bugs in (ice-9 command-line)

* module/ice-9/command-line.scm (compile-shell-switches): Whoops, fix a
  few cases that forgot to loop back to the beginning.

13 years agoguile -v prints LGPLv3+.
Andy Wingo [Thu, 14 Apr 2011 14:18:56 +0000 (16:18 +0200)]
guile -v prints LGPLv3+.

* module/ice-9/command-line.scm (compile-shell-switches): Though Guile
  may be distributed under the GPLv3, Guile is actually LGPLv3+.

13 years agoscript.c calls out to (ice-9 command-line)
Andy Wingo [Thu, 14 Apr 2011 14:15:47 +0000 (16:15 +0200)]
script.c calls out to (ice-9 command-line)

* libguile/script.c (scm_shell_usage): Call (ice-9 command-line)'s
  shell-usage.
  (scm_compile_shell_switches): Likewise, call (ice-9 command-line)'s
  compile-shell-switches.

13 years agoadd packager info to %build-info
Andy Wingo [Thu, 14 Apr 2011 14:06:40 +0000 (16:06 +0200)]
add packager info to %build-info

* libguile/load.c (init_build_info): Add packager, packager-version, and
  packager-bug-reports to %build-info, if they are available.

13 years agoadd (ice-9 command-line)
Andy Wingo [Thu, 14 Apr 2011 14:06:07 +0000 (16:06 +0200)]
add (ice-9 command-line)

* module/ice-9/command-line.scm: New module for parsing Guile's command
  line, ported from script.c.  Includes local eval-string implementation
  to make `guile -c 1' faster, by not having to load the compiler.
* module/Makefile.am: Add to build.

13 years agodon't warn about non-literal fmt strings for e.g. (_ "foo")
Andy Wingo [Thu, 14 Apr 2011 14:04:18 +0000 (16:04 +0200)]
don't warn about non-literal fmt strings for e.g. (_ "foo")

* module/language/tree-il/analyze.scm (const-fmt, format-analysis):
  Allow format strings to be gettexted, using the conventional _ name.

13 years agoupdate NEWS
Andy Wingo [Wed, 13 Apr 2011 12:07:22 +0000 (14:07 +0200)]
update NEWS

* NEWS: Update for 2.0.1.

13 years ago(rnrs arithmetic fixnums) fixnum? export a procedure again
Andy Wingo [Wed, 13 Apr 2011 10:50:16 +0000 (12:50 +0200)]
(rnrs arithmetic fixnums) fixnum? export a procedure again

* module/rnrs/arithmetic/fixnums.scm (fixnum?): Restore this export to
  be a procedure, not syntax.
  (inline-fixnum?): This is what fixnum? was.  Use it internally.

13 years agorevert 4a2ac0623c3dabb2c8b9d38c27b837dcb2c7fe4e
Andy Wingo [Wed, 13 Apr 2011 10:16:00 +0000 (12:16 +0200)]
revert 4a2ac0623c3dabb2c8b9d38c27b837dcb2c7fe4e

* module/ice-9/popen.scm (open-pipe*): No need to pump the pipes
  guardian here, now that hooks are working again.

13 years ago--disable-threads fix
Andy Wingo [Wed, 13 Apr 2011 10:03:50 +0000 (12:03 +0200)]
--disable-threads fix

* libguile/threads.c (do_thread_exit_trampoline, on_thread_exit):
  (scm_i_init_thread_for_guile): Only register and unregister threads
  with bdw-gc when we are building with threads support.  Thanks to
  Marijn for the report.

13 years agoFix fencepost error in bip_seek
Ian Price [Fri, 8 Apr 2011 01:49:20 +0000 (02:49 +0100)]
Fix fencepost error in bip_seek

* libguile/r6rs-ports.c (bip_seek): Fix to allow seeking to end of port.

* test-suite/tests/r6rs-ports.test ("bytevector input port can seek to
  very end"): Add tests.

13 years agofix assert to return true value.
Ian Price [Wed, 6 Apr 2011 12:51:44 +0000 (13:51 +0100)]
fix assert to return true value.

* module/rnrs/base.scm (assert): returns value instead of void.

* test-suite/tests/r6rs-base.test ("assert"): add test cases.

13 years agoAdded optional second arg to R6RS log function
Ian Price [Wed, 6 Apr 2011 00:53:38 +0000 (01:53 +0100)]
Added optional second arg to R6RS log function

* module/rnrs/base.scm (log): now takes a base argument, using the
  change of base formula for logs.
* test-suite/tests/r6rs-base.test ("log (2nd arg)"): Add test cases.