bpt/guile.git
14 years agoUse explicit guile-primitive forms in the macro expansion of dotimes and dolist.
Daniel Kraft [Thu, 30 Jul 2009 19:49:00 +0000 (21:49 +0200)]
Use explicit guile-primitive forms in the macro expansion of dotimes and dolist.

14 years agoImplement some elisp constructs in macros instead of hard-coded compiler code.
Daniel Kraft [Thu, 30 Jul 2009 19:43:24 +0000 (21:43 +0200)]
Implement some elisp constructs in macros instead of hard-coded compiler code.

* module/language/elisp/compile-tree-il.scm: Remove implementation of prog1,
  and, or, cond, dolist.
* module/language/elisp/runtime/macro-slot.scm: Implement them here instead.

14 years agoSwitch use of guile-primitive to now available funcall in test.
Daniel Kraft [Thu, 30 Jul 2009 11:54:07 +0000 (13:54 +0200)]
Switch use of guile-primitive to now available funcall in test.

14 years agowithout-void-checks as new extension for fine-control
Daniel Kraft [Thu, 30 Jul 2009 11:51:45 +0000 (13:51 +0200)]
without-void-checks as new extension for fine-control

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Handle without-void-checks.
* test-suite/tests/elisp-compiler.test: Test it.

14 years agofuncall, apply and eval built-ins.
Daniel Kraft [Wed, 29 Jul 2009 14:27:45 +0000 (16:27 +0200)]
funcall, apply and eval built-ins.

* module/language/elisp/README: Document new features.
* module/language/elisp/runtime/function-slot.scm: Implement funcall, apply and
  eval by using the existing compiler code.
* test-suite/tests/elisp-compiler.test: Test those.

14 years agoAdded guile-primitive construct for references to primitives from Elisp.
Daniel Kraft [Wed, 29 Jul 2009 12:25:33 +0000 (14:25 +0200)]
Added guile-primitive construct for references to primitives from Elisp.

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement guile-primitive.
* test-suite/tests/elisp-compiler.test: Switched a usage of guile-ref to
  the now available guile-primitive.

14 years agoAdded length built-in.
Daniel Kraft [Wed, 29 Jul 2009 11:45:40 +0000 (13:45 +0200)]
Added length built-in.

* module/language/elisp/runtime/function-slot.scm: Add length built-in.
* test-suite/tests/elisp-compiler.test: Test length.

14 years agoImplemented lexical-let and lexical-let* for elisp.
Daniel Kraft [Wed, 29 Jul 2009 10:09:43 +0000 (12:09 +0200)]
Implemented lexical-let and lexical-let* for elisp.

* module/language/elisp/README: Document it.
* module/language/elisp/bindings.scm: New fields in bindings data structure
  to keep track of lexical bindings for symbols.
* module/language/elisp/compile-tree-il.scm: Implement lexical-let(*).
* test-suite/tests/elisp-compiler.test: Test lexical scoping with lexical-let.

14 years agoIn elisp-compiler.test, check that let* works without values given, too.
Daniel Kraft [Mon, 27 Jul 2009 08:55:23 +0000 (10:55 +0200)]
In elisp-compiler.test, check that let* works without values given, too.

14 years agoCompiler option to disable void-checks in elisp.
Daniel Kraft [Fri, 24 Jul 2009 09:09:57 +0000 (11:09 +0200)]
Compiler option to disable void-checks in elisp.

* module/language/elisp/README: Document the change.
* module/language/elisp/compile-tree-il.scm: Add disable-void-check option.
* test-suite/tests/elisp-compiler.test: Test it.

14 years agoDon't pass the bindings-data all around in compile-tree-il, but use fluids for this...
Daniel Kraft [Fri, 24 Jul 2009 08:40:07 +0000 (10:40 +0200)]
Don't pass the bindings-data all around in compile-tree-il, but use fluids for this dynamic binding.

* module/language/elisp/compile-tree-il.scm: Use fluid for bindings-data.

14 years agoImplemented the flet and flet* extensions.
Daniel Kraft [Fri, 24 Jul 2009 07:56:13 +0000 (09:56 +0200)]
Implemented the flet and flet* extensions.

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement flet and flet*.
* test-suite/tests/elisp-compiler.test: Test flet and flet*.

14 years agoImplemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...)
Daniel Kraft [Thu, 23 Jul 2009 12:09:55 +0000 (14:09 +0200)]
Implemented dynamic symbol access built-ins (set, fset, symbol-value, makunbound...)

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function.
* module/language/elisp/runtime.scm: Runtime functions to support dynamic value access.
* module/language/elisp/runtime/function-slot.scm: Defined the built-ins.
* test-suite/tests/elisp-compiler.test: Test them.

14 years agoAdded guile-ref extension construct, change throw implementation to easier one using...
Daniel Kraft [Wed, 22 Jul 2009 10:50:56 +0000 (12:50 +0200)]
Added guile-ref extension construct, change throw implementation to easier one using a built-in function and implement unwind-protect.

* module/language/elisp/README: Document the changes.
* module/language/elisp/compile-tree-il.scm: Implement unwind-protect.
* module/language/elisp/runtime/function-slot.scm: throw as built-in.
* test-suite/tests/elisp-compiler.test: Test unwind-protect.

14 years agoImplemented catch and throw in elisp.
Daniel Kraft [Wed, 22 Jul 2009 10:23:03 +0000 (12:23 +0200)]
Implemented catch and throw in elisp.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement catch and throw.
* test-suite/tests/elisp-compiler.test: Test catch/throw.

14 years agoDon't ensure fluids all over the place but scan for variables needed and ensure just...
Daniel Kraft [Tue, 21 Jul 2009 14:45:10 +0000 (16:45 +0200)]
Don't ensure fluids all over the place but scan for variables needed and ensure just before the compiled code all those.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement it here, pass bindings all around the compilation.
* module/language/elisp/bindings.scm: New module with symbol-tracking abilities needed for this.

14 years agoMerge branch 'master' of git://git.savannah.gnu.org/guile into elisp
Daniel Kraft [Tue, 21 Jul 2009 09:59:14 +0000 (11:59 +0200)]
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp

14 years agoImplemented prog1, prog2, dotimes, dolist control structures.
Daniel Kraft [Mon, 20 Jul 2009 18:52:00 +0000 (20:52 +0200)]
Implemented prog1, prog2, dotimes, dolist control structures.

* module/language/elisp/README: Document it and some further ideas written down.
* module/language/elisp/compile-tree-il.scm: Implement prog1, dolist.
* module/language/elisp/runtime/macro-slot.scm: prog2 and dotimes.
* test-suite/tests/elisp-compiler.test: Test prog1, prog2, dotimes, dolist.

14 years agoImplemented some important list built-ins.
Daniel Kraft [Sat, 18 Jul 2009 18:10:24 +0000 (20:10 +0200)]
Implemented some important list built-ins.

* module/language/elisp/runtime.scm: Updated/added convenience macros.
* module/language/elisp/runtime/function-slot.scm: Implement list built-ins.
* module/language/elisp/runtime/macro-slot.scm: Implement list built-ins.
* test-suite/tests/elisp-compiler.test: Test the implemented built-ins.

14 years agoImplemented unless, when and dotimes using built-in macros.
Daniel Kraft [Sat, 18 Jul 2009 16:38:42 +0000 (18:38 +0200)]
Implemented unless, when and dotimes using built-in macros.

* module/language/elisp/README: Document that.
* module/language/elisp/runtime.scm: Defined built-in-macro macro.
* module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes.
* test-suite/tests/elisp-compiler.test: Test for those constructs.

14 years agoReturn correct value for setq form.
Daniel Kraft [Sat, 18 Jul 2009 15:58:01 +0000 (17:58 +0200)]
Return correct value for setq form.

* module/language/elisp/compile-tree-il.scm: Fix implementation of setq.
* test-suite/tests/elisp-compiler.test: Check for value of setq form.

14 years agoImplemented real quotation (added support for backquotation).
Daniel Kraft [Sat, 18 Jul 2009 15:32:59 +0000 (17:32 +0200)]
Implemented real quotation (added support for backquotation).

* module/language/elisp/README: Document that.
* module/language/elisp/compile-tree-il.scm: Implement backquote.
* test-suite/tests/elisp-compiler.test: Test quotation and backquotes.

14 years agoImplemented eq and equal built-in predicates.
Daniel Kraft [Sat, 18 Jul 2009 15:21:55 +0000 (17:21 +0200)]
Implemented eq and equal built-in predicates.

* module/language/elisp/runtime/function-slot.scm: Implement eq and equal.
* test-suite/tests/elisp-compiler.test: Test them.

14 years agoImplemented macros in elisp compiler.
Daniel Kraft [Thu, 16 Jul 2009 13:23:38 +0000 (15:23 +0200)]
Implemented macros in elisp compiler.

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement defmacro and expansion.
* module/language/elisp/runtime/macro-slot.scm: New module to keep definitions.
* test-suite/Makefile.am: Add elisp-compiler.test to list of tests.
* test-suite/tests/elisp-compiler.test: Basic macro tests.

14 years agoExtended test-suite to cover already implemented built-ins and fixed errors found.
Daniel Kraft [Thu, 16 Jul 2009 12:28:07 +0000 (14:28 +0200)]
Extended test-suite to cover already implemented built-ins and fixed errors found.

* module/language/elisp/runtime/function-slot.scm: Fixed errors in number preds.
* test-suite/tests/elisp-compiler.test: Test built-ins already implemented.

14 years agoBump version number for 1.9.1.
Ludovic Courtès [Wed, 15 Jul 2009 21:57:18 +0000 (23:57 +0200)]
Bump version number for 1.9.1.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.

14 years agoMake the non-integrated VM test-suite less verbose.
Ludovic Courtès [Wed, 15 Jul 2009 21:56:27 +0000 (23:56 +0200)]
Make the non-integrated VM test-suite less verbose.

* testsuite/run-vm-tests.scm (run-vm-tests): Don't display the number of
  tests passed since it's always 1 or 0.

14 years agoAdd FIXMEs about misaligned objcode-metas.
Ludovic Courtès [Wed, 15 Jul 2009 21:53:22 +0000 (23:53 +0200)]
Add FIXMEs about misaligned objcode-metas.

* libguile/objcodes.c (scm_c_make_objcode_slice): Add comment about
  misaligned `objcode-meta'.

* module/language/assembly/compile-bytecode.scm (write-bytecode):
  Likewise.

14 years agoFix unaligned access in the VM code.
Ludovic Courtès [Wed, 15 Jul 2009 21:51:42 +0000 (23:51 +0200)]
Fix unaligned access in the VM code.

* libguile/vm.c (struct t_32bit_aligned): New.
  (really_make_boot_program)[bytes]: Use it.  This fixes possibly
  unaligned accesses, which cause a "bus error" on some platforms (e.g.,
  sparc-*).

14 years agoConst-qualify buffers passed to `scm_c_make_objcode_slice ()'.
Ludovic Courtès [Wed, 15 Jul 2009 21:12:43 +0000 (23:12 +0200)]
Const-qualify buffers passed to `scm_c_make_objcode_slice ()'.

* libguile/objcodes.c (scm_c_make_objcode_slice): Add `const' qualifier
  for PTR and DATA.

* libguile/objcodes.h: Update accordingly.

14 years agoSwitch remaining GPLv2+ Guile-VM headers to LGPLv3+.
Ludovic Courtès [Wed, 15 Jul 2009 20:46:54 +0000 (22:46 +0200)]
Switch remaining GPLv2+ Guile-VM headers to LGPLv3+.

* module/system/base/compile.scm, module/system/base/syntax.scm,
  module/system/repl/common.scm, module/system/repl/describe.scm,
  module/system/vm/instruction.scm, module/system/vm/objcode.scm,
  module/system/vm/profile.scm, module/system/vm/program.scm,
  module/system/vm/trace.scm: Switch header from GPLv2+ to LGPLv3+.

14 years agoTest-suite for elisp compiler so far, excluding the built-ins.
Daniel Kraft [Wed, 15 Jul 2009 20:08:36 +0000 (22:08 +0200)]
Test-suite for elisp compiler so far, excluding the built-ins.

* test-suite/tests/elisp-compiler.test: Tests for compiler so far.

14 years agoRemoved wrong not in zerop built-in.
Daniel Kraft [Wed, 15 Jul 2009 11:51:19 +0000 (13:51 +0200)]
Removed wrong not in zerop built-in.

* module/language/elisp/runtime/function-slot.scm: Fix zerop.

14 years agoFix typo in the compile-type verification of `OBJCODE_COOKIE'.
Ludovic Courtès [Tue, 14 Jul 2009 23:17:32 +0000 (01:17 +0200)]
Fix typo in the compile-type verification of `OBJCODE_COOKIE'.

* libguile/objcodes.c: Fix `sizeof (OBJCODE_COOKIE)' assertion: the
  trailing 0 must not be taken into account, and multiple of 8 means the
  3 LSBs are clear.

14 years agoMake sure at compile-time that `OBJCODE_COOKIE' has the right size.
Ludovic Courtès [Tue, 14 Jul 2009 23:03:35 +0000 (01:03 +0200)]
Make sure at compile-time that `OBJCODE_COOKIE' has the right size.

* libguile/objcodes.c: Use `verify' to assert that the size of
  `OBJCODE_COOKIE' is a multiple of 8.

14 years agoExplicitly use Gnulib's `verify' module.
Ludovic Courtès [Tue, 14 Jul 2009 22:58:01 +0000 (00:58 +0200)]
Explicitly use Gnulib's `verify' module.

* m4/gnulib-cache.m4: Add `verify'.

14 years agoAugment `OBJCODE_COOKIE' to detect wrong endianness or word size.
Ludovic Courtès [Tue, 14 Jul 2009 22:55:33 +0000 (00:55 +0200)]
Augment `OBJCODE_COOKIE' to detect wrong endianness or word size.

* libguile/objcodes.c (OBJCODE_ENDIANNESS, _OBJCODE_STRINGIFY,
  OBJCODE_STRINGIFY, OBJCODE_WORD_SIZE): New macros.
  (OBJCODE_COOKIE): Use them.  The intent is that `.go' files compiled
  for a different endianness or word size are detected.

14 years agoRemove the `long_long' and `ulong_long' types.
Ludovic Courtès [Tue, 14 Jul 2009 22:32:05 +0000 (00:32 +0200)]
Remove the `long_long' and `ulong_long' types.

* libguile/gen-scmconfig.c (main): Don't emit typedefs for `long_long'
  and `ulong_long'.  This was already deprecated in 1.8 and known to
  cause conflicts with other libraries such as HDF5, as reported by Mark
  Patterson <mpatterson@physics.queensu.ca>
  (http://lists.gnu.org/archive/html/bug-guile/2009-02/msg00003.html).

14 years agoupdate NEWS
Andy Wingo [Tue, 14 Jul 2009 20:55:35 +0000 (22:55 +0200)]
update NEWS

* NEWS: Update.

14 years agoNEWS has info on 1.9.N to 1.9.N+1 in addition to 1.8 to 2.0
Andy Wingo [Thu, 2 Jul 2009 15:46:23 +0000 (17:46 +0200)]
NEWS has info on 1.9.N to 1.9.N+1 in addition to 1.8 to 2.0

* NEWS: Update to have an incremental section in addition to a
  comprehensive 1.8->2.0 section.

14 years agofix race in which some instruction name symbols could go unmarked
Andy Wingo [Thu, 2 Jul 2009 15:46:23 +0000 (17:46 +0200)]
fix race in which some instruction name symbols could go unmarked

* libguile/instructions.c: In loops, replace scm_op_last with
  SCM_VM_NUM_INSTRUCTIONS.
  (fetch_instruction_table): Protect the instruction symbols from
  collection. Before they were only marked by the name->opcode hash
  table, leading to races in which they could be collected.
  (scm_lookup_instruction_by_name): Protect the hash table earlier, as
  it's not actually a stack variable, since it's static.

14 years agofix bounds checks for the last element of bv-*-{ref,set}
Andy Wingo [Thu, 2 Jul 2009 15:43:07 +0000 (17:43 +0200)]
fix bounds checks for the last element of bv-*-{ref,set}

* libguile/vm-i-scheme.c (BV_FIXABLE_INT_REF, BV_INT_REF):
  (BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET): Fix the
  bounds check for the last element.

14 years agoImplemented defconst, defvar, defun special forms for elisp.
Daniel Kraft [Tue, 14 Jul 2009 19:18:07 +0000 (21:18 +0200)]
Implemented defconst, defvar, defun special forms for elisp.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement defconst/defvar/defun.

14 years agoMerge branch 'master' of git://git.savannah.gnu.org/guile into elisp
Daniel Kraft [Tue, 14 Jul 2009 18:20:03 +0000 (20:20 +0200)]
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp

14 years agoRemove potential "uninitialized variable" GCC warnings.
Ludovic Courtès [Tue, 14 Jul 2009 15:12:04 +0000 (17:12 +0200)]
Remove potential "uninitialized variable" GCC warnings.

* libguile/vm-i-scheme.c (vector_ref, vector_set, BV_FIXABLE_INT_REF,
  BV_INT_REF, BV_FLOAT_REF, BV_FIXABLE_INT_SET, BV_INT_SET,
  BV_FLOAT_SET): Explicitly initialize all locals, to make some versions
  of GCC happier.  Patch by Dale P. Smith <dsmich@roadrunner.com>.

14 years agoFix tests that assumed little endian.
Ludovic Courtès [Tue, 14 Jul 2009 14:07:13 +0000 (16:07 +0200)]
Fix tests that assumed little endian.

* test-suite/tests/asm-to-bytecode.test (u32->u8-list): New procedure.
  ("compiler")[(load-program 3 2 1 0 () 3 #f (make-int8 3) (return)),
  (load-program 3 2 1 0 () 3 (load-program 3 2 1 0 ...))]: Make these
  tests work on hosts whose endianness is not little endian.

14 years agoSome bug fixes on the way and mainly implemented some built-ins (arithmetic).
Daniel Kraft [Mon, 13 Jul 2009 16:35:57 +0000 (18:35 +0200)]
Some bug fixes on the way and mainly implemented some built-ins (arithmetic).

* module/language/elisp/README: Document changes.
* module/language/elisp/compile-tree-il.scm: Bug fixes to fluid-creation.
* module/language/elisp/runtime.scm: Some helping definitions for built-ins.
* module/language/elisp/runtime/function-slot.scm: Defined artihmetic built-ins.

14 years agoAutomatically create fluids when necessary.
Daniel Kraft [Mon, 13 Jul 2009 15:26:07 +0000 (17:26 +0200)]
Automatically create fluids when necessary.

* module/language/elisp/README: Document that.
* module/language/elisp/compile-tree-il.scm: Create fluids when necessary.
* module/language/elisp/runtime/function-slot.scm: Fix module name.

14 years agoFixed lambda expressions and implemented function calls using the basic list notation.
Daniel Kraft [Mon, 13 Jul 2009 14:51:05 +0000 (16:51 +0200)]
Fixed lambda expressions and implemented function calls using the basic list notation.

* module/language/elisp/README: Document that.
* module/language/elisp/compile-tree-il.scm: Implement function calls.

14 years agoMerge branch 'master' of git://git.savannah.gnu.org/guile into elisp
Daniel Kraft [Mon, 13 Jul 2009 13:46:46 +0000 (15:46 +0200)]
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp

14 years agoLambda expressions in elisp, but not yet function calls.
Daniel Kraft [Mon, 13 Jul 2009 13:43:53 +0000 (15:43 +0200)]
Lambda expressions in elisp, but not yet function calls.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement lambda expressions.

14 years agoImplemented let and let* in elisp.
Daniel Kraft [Tue, 7 Jul 2009 17:38:25 +0000 (19:38 +0200)]
Implemented let and let* in elisp.

* module/language/elisp/README: Document it.
* module/language/elisp/compile-tree-il.scm: Implement let and let*.

14 years agoImplemented while construct in elisp.
Daniel Kraft [Tue, 7 Jul 2009 15:26:22 +0000 (17:26 +0200)]
Implemented while construct in elisp.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement while construct.

14 years agoUse Gnulib's `vsnprintf' module.
Ludovic Courtès [Sun, 5 Jul 2009 21:57:37 +0000 (23:57 +0200)]
Use Gnulib's `vsnprintf' module.

* m4/gnulib-cache.m4: Use `vsnprintf', needed by `deprecation.c'.

14 years agoUpdate `NEWS'.
Ludovic Courtès [Sun, 5 Jul 2009 20:19:30 +0000 (22:19 +0200)]
Update `NEWS'.

* NEWS: Update.

14 years agoEnclose `bit-operations.test' in its own module.
Ludovic Courtès [Sun, 5 Jul 2009 19:13:51 +0000 (21:13 +0200)]
Enclose `bit-operations.test' in its own module.

* test-suite/tests/bit-operations.test: Use the `define-module' clause.

14 years agoFix the `BUILD_PTHREAD_SUPPORT' Automake conditional when not using pthread.
Ludovic Courtès [Sun, 5 Jul 2009 19:10:35 +0000 (21:10 +0200)]
Fix the `BUILD_PTHREAD_SUPPORT' Automake conditional when not using pthread.

* configure.in: Set $build_pthread_support to "no" when thread support
  isn't built.  This fixes the `BUILD_PTHREAD_SUPPORT' Automake
  conditional.

14 years agoMerge branch 'master' of git://git.savannah.gnu.org/guile into elisp
Daniel Kraft [Sat, 4 Jul 2009 09:09:38 +0000 (11:09 +0200)]
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp

14 years agoImplemented fluid-based variable references and setting using setq.
Daniel Kraft [Fri, 3 Jul 2009 21:00:12 +0000 (23:00 +0200)]
Implemented fluid-based variable references and setting using setq.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement variable references, setq
* module/language/elisp/runtime.scm: New file for runtime definitions.
* module/language/elisp/runtime/function-slot.scm: Ditto.
* module/language/elisp/runtime/value-slot.scm: Ditto.

14 years agofix error message for bad objcode cookie
Andy Wingo [Thu, 2 Jul 2009 19:55:28 +0000 (21:55 +0200)]
fix error message for bad objcode cookie

* libguile/objcodes.c: Whoop-dee :)

14 years agoImplemented elisp's or form.
Daniel Kraft [Thu, 2 Jul 2009 19:22:25 +0000 (21:22 +0200)]
Implemented elisp's or form.

* module/language/elisp/README: Document this.
* module/language/elisp/compile-tree-il.scm: Implement or.

14 years agoFor elisp's (cond ...) and (condition) forms without body, return the condition as...
Daniel Kraft [Thu, 2 Jul 2009 19:10:38 +0000 (21:10 +0200)]
For elisp's (cond ...) and (condition) forms without body, return the condition as value.

* compile-tree-il.scm: Fix compilation of (cond ...) for bodyless conditions.

14 years agoRead complex numbers where both parts are inexact decimals
Neil Jerram [Wed, 1 Jul 2009 00:39:24 +0000 (01:39 +0100)]
Read complex numbers where both parts are inexact decimals

Thanks to Bill Schottstaedt for reporting this problem!

* libguile/numbers.c (mem2ureal): Don't be misled by *p_exactness
  being INEXACT on entry (as is possible when reading a complex
  number): use local exactness variable x which starts as EXACT.
  Call mem2decimal_from_point () with &x instead of p_exactness.

* test-suite/tests/numbers.test ("string->number"): Add complex number
  tests suggested by Bill.

14 years agoCorrection to doc on Accessing Arrays from C
Neil Jerram [Tue, 30 Jun 2009 22:56:40 +0000 (23:56 +0100)]
Correction to doc on Accessing Arrays from C

Thanks to Ludovic for the new wording!

* doc/ref/api-compound.texi (Accessing Arrays from C): Correct text to
  reflect the current implementation of scm_array_get_handle and
  scm_array_handle_release - which don't actuall do any dynwind stuff.

14 years agoAdded make-nil instruction to VM and use it for Emacs' nil in the compiler.
Daniel Kraft [Mon, 29 Jun 2009 11:16:27 +0000 (13:16 +0200)]
Added make-nil instruction to VM and use it for Emacs' nil in the compiler.

* doc/ref/vm.texi: Document new instruction.
* libguile/vm-i-system.c: Add it to the VM.
* module/language/assembly.scm: Compile (const %nil) to (make-nil) assembly.
* module/language/glil/decompile-assembly.scm: Handle (make-nil)
* module/language/elisp/compile-tree-il.scm: Use (const %nil) for nil.

14 years agoRemove seek/truncate shortcuts to file ports.
Ludovic Courtès [Sun, 28 Jun 2009 21:33:17 +0000 (23:33 +0200)]
Remove seek/truncate shortcuts to file ports.

Suggested by Neil.

* libguile/fports.c (fport_seek_or_seek64): Rename to `fport_seek ()'.
  (fport_seek, scm_i_fport_seek, scm_i_fport_truncate): Remove.

* libguile/fports.h (scm_i_fport_seek, scm_i_fport_truncate): Remove
  declarations.

* libguile/ports.c (scm_seek): Remove shortcut that would call out to
  `scm_i_fport_seek ()'.
  (scm_truncate_file): Likewise.

14 years agoMerge branch 'master' of git://git.savannah.gnu.org/guile into elisp
Daniel Kraft [Sat, 27 Jun 2009 18:07:11 +0000 (20:07 +0200)]
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp

14 years agobytevector ops now compile down to low-level VM ops
Andy Wingo [Fri, 26 Jun 2009 10:41:34 +0000 (12:41 +0200)]
bytevector ops now compile down to low-level VM ops

* libguile/instructions.c (scm_instruction_list): Fix a longstanding bug
  in this humble function.

* libguile/vm-i-scheme.c (BV_FIXABLE_INT_SET, BV_INT_SET, BV_FLOAT_SET):
  Fix some bugs in these macros -- now the bytevector ops work.

* module/language/tree-il/compile-glil.scm (*primcall-ops*): Compile
  bytevector calls to VM ops.

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Resolve bytevector calls to primitive
  calls.

14 years agorun bytevectors tests under the compiler and evaluator
Andy Wingo [Fri, 26 Jun 2009 09:12:37 +0000 (11:12 +0200)]
run bytevectors tests under the compiler and evaluator

* test-suite/tests/bytevectors.test: Run a number of tests under the
  compiler/vm and the evaluator.

14 years agovector-ref and vector-set! now have opcodes
Andy Wingo [Thu, 25 Jun 2009 22:15:37 +0000 (00:15 +0200)]
vector-ref and vector-set! now have opcodes

* module/language/tree-il/primitives.scm
  (*interesting-primitive-names*): Resolve vector-ref and vector-set!.

* module/language/tree-il/compile-glil.scm (*primcall-ops*): And compile
  vector-ref and vector-set! to their opcodes.

* libguile/vm-i-scheme.c (vector-ref, vector-set): New opcodes, placed
  before the bytevector ops. The renumbering shouldn't affect anyone,
  given that the bytevector ops were not yet used. Fix a few bugs in the
  bytevector ops.

14 years agoadd bytevector ops to the vm
Andy Wingo [Wed, 24 Jun 2009 21:49:11 +0000 (23:49 +0200)]
add bytevector ops to the vm

* libguile/instructions.h (SCM_VM_NUM_INSTRUCTIONS): Enlarge to 255. Not
  sure what performance effects this will have.

* libguile/vm-engine.c: Add new error case, vm_error_not_a_bytevector.

* libguile/vm-engine.h: Don't assign specific registers for i386. Having
  added the new VM vector ops, GCC 4.4 is erroring for me now.

* libguile/vm-i-scheme.c: Add bytevector-specific ops to the VM.
  We don't actually use them yet, though.

14 years agobytevectors provide scm_i_native_endianness to the vm
Andy Wingo [Wed, 24 Jun 2009 21:46:42 +0000 (23:46 +0200)]
bytevectors provide scm_i_native_endianness to the vm

* libguile/bytevectors.h (scm_i_native_endianness): Allow the VM to use
  scm_i_native_endianness, but still keep it marked as internal.

* libguile/bytevectors.c: Adjust to use scm_i_native_endianness instead
  of native_endianness. Define it at bootstrap time.

14 years agominor doc tweaks
Andy Wingo [Wed, 24 Jun 2009 21:44:03 +0000 (23:44 +0200)]
minor doc tweaks

* doc/ref/api-compound.texi: Generalized vector doc fixups.

* doc/ref/api-data.texi: Minor fixes to bytevector docs.

14 years agoRevert "* FAQ: New file."
Neil Jerram [Thu, 25 Jun 2009 22:24:57 +0000 (23:24 +0100)]
Revert "* FAQ: New file."

This reverts commit d53f85dd859fa69af8a0b67482774d2a88aaf407.

It was a confusing mistake to create an FAQ file in the Guile
repository/distribution, because there was already an FAQ page on the
Guile web site.  The information that was in the FAQ file is now in
the FAQ web page.

14 years agoAdd `scm_t_off' type so that `scm_t_port' has a fixed layout.
Ludovic Courtès [Thu, 25 Jun 2009 21:32:44 +0000 (23:32 +0200)]
Add `scm_t_off' type so that `scm_t_port' has a fixed layout.

* libguile/gen-scmconfig.c (main): Produce a definition for
  `scm_t_off'.

* libguile/ports.h (scm_t_port)[read_buf_size, saved_read_buf_size,
  write_buf_size, seek, truncate]: Use `scm_t_off' instead of `off_t' so
  that the layout and size of the structure does not depend on the
  application's `_FILE_OFFSET_BITS' value.  Reported by Bill
  Schottstaedt, see
  http://lists.gnu.org/archive/html/bug-guile/2009-06/msg00018.html.
  (scm_set_port_seek, scm_set_port_truncate): Update.

* libguile/ports.c (scm_set_port_seek, scm_set_port_truncate): Use
  `scm_t_off' and `off_t_or_off64_t'.

* libguile/fports.c (fport_seek, fport_truncate): Use `scm_t_off'
  instead of `off_t'.

* libguile/r6rs-ports.c (bip_seek, cbp_seek, bop_seek): Use `scm_t_off'
  instead of `off_t'.

* libguile/rw.c (scm_write_string_partial): Likewise.

* libguile/strports.c (st_resize_port, st_seek, st_truncate): Likewise.

* doc/ref/api-io.texi (Port Implementation): Update prototype of
  `scm_set_port_seek ()' and `scm_set_port_truncate ()'.

* NEWS: Update.

14 years agoFix `load-objcode' FD/mapping leak occurring upon failure.
Ludovic Courtès [Thu, 25 Jun 2009 20:45:12 +0000 (22:45 +0200)]
Fix `load-objcode' FD/mapping leak occurring upon failure.

* libguile/objcodes.c (make_objcode_by_mmap): Close FD and unmap ADDR
  upon failure.

14 years agoallow primcall ops to push 0 values
Andy Wingo [Wed, 24 Jun 2009 13:14:00 +0000 (15:14 +0200)]
allow primcall ops to push 0 values

* libguile/objcodes.c (OBJCODE_COOKIE): Bump the objcode cookie. We'll
  be doing this on incompatible changes until 2.0.

* libguile/vm-i-scheme.c (set_car, set_cdr, slot_set): These
  instructions don't have natural return values -- so declare them that
  way, that they push 0 values.

* module/language/tree-il/compile-glil.scm (flatten): When compiling
  primitive calls, check `(instruction-pushes op)' to see how many
  values that instruction will push, and do something appropriate,
  instead of just assuming that all primcall ops push 1 value.

14 years agoremove lambda wrap hack of brainfuck tree-il compiler
Andy Wingo [Wed, 24 Jun 2009 11:42:59 +0000 (13:42 +0200)]
remove lambda wrap hack of brainfuck tree-il compiler

* module/language/brainfuck/compile-tree-il.scm (compile-tree-il):
  Remove the hack where we wrapped the compiled code in a `lambda',
  because not only should the tree-il compiler optimize that away, it
  was really papering around other inefficiencies, and obtuse to boot.

14 years agoRemove AC_SYS_RESTARTABLE_SYSCALLS and related code
Neil Jerram [Thu, 18 Jun 2009 19:35:45 +0000 (20:35 +0100)]
Remove AC_SYS_RESTARTABLE_SYSCALLS and related code

As the Autoconf documentation says, "These days portable programs
[...] should not rely on `HAVE_RESTARTABLE_SYSCALLS', since nowadays
whether a system call is restartable is a dynamic issue, not a
configuration-time issue."

In other words, if we ever rely on HAVE_RESTARTABLE_SYSCALLS, we are
at the mercy of any code that Guile happens to be linked with, because
that code could install a signal handler without the SA_RESTART flag,
and then a Guile system call could unexpectedly return EINTR.

The readline part of this goes back to this problem report:
http://sources.redhat.com/ml/guile/2000-05/msg00177.html; and is an
excellent example of the above paragraph.  It was noted during the
discussion that undefining HAVE_RESTARTABLE_SYSCALLS would fix the
problem, but that solution wasn't adopted - I guess because Guile was
still using cooperative threads then (not pthreads) and so there was a
significant concern (whether founded or not) that not using
restartable syscalls (where available) could lead to a loss of
performance.

Now Guile's default mode of operation is with pthreads, where we
already don't assume that HAVE_RESTARTABLE_SYSCALLS is reliable, so
there is no possible further performance loss.  And in any case we
really have no choice, if we want correct operation.

Thanks to Sylvain Beucler for reporting this and suggesting the fix.

* configure.in (AC_SYS_RESTARTABLE_SYSCALLS): Removed.

* doc/ref/posix.texi (Signals): Remove statement that Guile always
  sets SA_RESTART flag.

* guile-readline/configure.in (GUILE_SIGWINCH_SA_RESTART_CLEARED):
  Remove this setting, together with its test code.
  (HAVE_RL_PRE_INPUT_HOOK): Remove this setting and its code, as no
  longer needed.

* guile-readline/readline.c (sigwinch_enable_restart): Removed.
  (scm_init_readline): Remove setting of rl_pre_input_hook.

* libguile/_scm.h (SCM_SYSCALL): Remove the definition that relies on
  HAVE_RESTARTABLE_SYSCALLS.

* libguile/scmsigs.c (scm_sigaction_for_thread): Don't always set the
  SA_RESTART flag if available.  Update docstring accordingly.
  (scm_init_scmsigs): Remove code that sets SA_RESTART flag for all
  signals.

* THANKS: Add Sylvain.

14 years agoflush whitespace from the repl input buffer *before* evaluation
Andy Wingo [Mon, 22 Jun 2009 20:57:48 +0000 (22:57 +0200)]
flush whitespace from the repl input buffer *before* evaluation

* module/system/repl/repl.scm (start-repl): Given that the input port of
  the repl is line-buffered, it's likely we have #\newline in the input
  that is strictly extraneous, an in-band indicator to the repl that it
  should begin reading now. So flush out that newline, so that you can
  (read-char) at the repl, and it actually does wait for you to type in
  a char instead of just returning #\newline.

  While it's not an overriding concern, this does fix some brainfuck
  programs that want to input from the user.

14 years agomore docs to brainfuck->tree-il compiler
Andy Wingo [Mon, 22 Jun 2009 20:44:34 +0000 (22:44 +0200)]
more docs to brainfuck->tree-il compiler

* module/language/brainfuck/compile-tree-il.scm (compile-tree-il): Wrap
  the result in a ((lambda () ...)), so we can use toplevel-ref. Add
  lots more comments.

14 years agometa-commands read off their own arguments
Andy Wingo [Mon, 22 Jun 2009 18:45:01 +0000 (20:45 +0200)]
meta-commands read off their own arguments

* module/system/repl/command.scm: Update copyright.
  (meta-command): Rework so that it's the various meta-commands that do
  the reading for their arguments. This way you can compile forms that
  span more than one line, and forms that need to be read with another
  language's reader.
  (define-meta-command): New helper macro. Update commands to use it.
  (help): Allow ,help on commands too.

* module/system/repl/repl.scm: Update copyright.
  (start-repl): Adjust to give meta-command what it wants.

14 years agoAlways create the bytevector SMOB type.
Ludovic Courtès [Sun, 21 Jun 2009 22:56:00 +0000 (00:56 +0200)]
Always create the bytevector SMOB type.

* libguile/bytevectors.c (scm_tc16_bytevector, print_bytevector,
  bytevector_equal_p, free_bytevector): Don't use the snarfing macros.
  (scm_bootstrap_bytevectors): New.
  (scm_init_bytevectors): No longer initialize SCM_NULL_BYTEVECTOR,
  which is done by `scm_bootstrap_bytevectors ()'.

* libguile/bytevectors.h (scm_bootstrap_bytevectors): New declaration.
  (scm_init_bytevectors): Made internal.  This can be done because we
  explicitly register it with `scm_c_register_extension ()' in
  `scm_bootstrap_bytevectors ()'.

* libguile/init.c (scm_i_init_guile): Call `scm_bootstrap_bytevectors ()'.
  This is so that expressions like "(generalized-vector-length #vu8())"
  work even when `(rnrs bytevector)' hasn't been loaded.

14 years agoMake bytevectors accessible using the generalized-vector API.
Ludovic Courtès [Sun, 21 Jun 2009 22:51:08 +0000 (00:51 +0200)]
Make bytevectors accessible using the generalized-vector API.

As a side effect, this allows compilation of literal bytevectors
("#vu8(...)"), which gets done by the generic array handling
of the GLIL->assembly compiler.

* doc/ref/api-compound.texi (Generalized Vectors): Mention bytevectors.
  (Arrays, Array Syntax): Likewise.

* doc/ref/api-data.texi (Bytevectors as Generalized Vectors): New node.

* libguile/bytevectors.c (scm_i_bytevector_generalized_set_x): New.

* libguile/bytevectors.h (scm_i_bytevector_generalized_set_x): New
  declaration.

* libguile/srfi-4.c (scm_i_generalized_vector_type,
  scm_array_handle_uniform_element_size,
  scm_array_handle_uniform_writable_elements): Add support for
  bytevectors.

* libguile/unif.c (type_creator_table): Add `vu8'.
  (bytevector_ref, bytevector_set): New functions.
  (memoize_ref, memoize_set): Add support for bytevectors.

* libguile/vectors.c (scm_is_generalized_vector,
  scm_c_generalized_vector_length, scm_c_generalized_vector_ref,
  scm_c_generalized_vector_set_x): Add support for bytevectors.

* test-suite/tests/bytevectors.test ("Generalized Vectors"): New test
  set.

14 years agobytevectors: Add a C-friendly API.
Ludovic Courtès [Sun, 21 Jun 2009 21:16:57 +0000 (23:16 +0200)]
bytevectors: Add a C-friendly API.

* doc/ref/api-data.texi (Bytevector Manipulation): Add
  `scm_is_bytevector ()', `scm_c_bytevector_length ()',
  `scm_c_bytevector_length ()', and `scm_c_bytevector_set_x ()'.

* libguile/bytevectors.c (scm_is_bytevector, scm_c_bytevector_length,
  scm_c_bytevector_ref, scm_c_bytevector_set_x): New functions.
  (scm_bytevector_p): Use `scm_is_bytevector ()'.
  (scm_bytevector_length): Use `scm_c_bytevector_length ()'.

* libguile/bytevectors.h (scm_is_bytevector, scm_c_bytevector_length,
  scm_c_bytevector_ref, scm_c_bytevector_set_x): New declarations.

14 years agobytevectors: Use `size_t' rather than `unsigned' for sizes.
Ludovic Courtès [Sun, 21 Jun 2009 14:55:58 +0000 (16:55 +0200)]
bytevectors: Use `size_t' rather than `unsigned' for sizes.

* doc/ref/api-data.texi (Bytevector Manipulation): Update.

* libguile/bytevectors.c (INTEGER_ACCESSOR_PROLOGUE,
  make_bytevector_from_buffer, scm_c_make_bytevector,
  scm_c_take_bytevector, scm_i_shrink_bytevector): Use `size_t' for
  bytevector lengths.

14 years agoFix documentation of `make-bytevector'.
Ludovic Courtès [Sun, 21 Jun 2009 21:32:19 +0000 (23:32 +0200)]
Fix documentation of `make-bytevector'.

* doc/ref/api-data.texi (Bytevector Manipulation): Fix documentation of
  the FILL argument of `make-bytevector'.

14 years agoadd brainfuck->tree-il compiler
Andy Wingo [Sun, 21 Jun 2009 12:53:33 +0000 (14:53 +0200)]
add brainfuck->tree-il compiler

* module/Makefile.am (BRAINFUCK_LANG_SOURCES): Compile at the end. Add
  compile-tree-il.scm.

* module/language/brainfuck/compile-tree-il.scm: New compiler, compiles
  to tree-il instead of scheme. I thought it would be more illustrative,
  though there are some uncommented bits.

* module/language/brainfuck/parse.scm: Modify not to put a header on the
  scheme representation. After all, we don't put <scheme> before scheme
  code, do we? :)

* module/language/brainfuck/spec.scm: Add tree-il compiler.

* module/language/tree-il.scm: Understand (set! (lexical foo) ...).

* module/system/base/language.scm: Update license. Actually, updates
  licenses on all these.

14 years agoformatting changes to (language brainfuck compile-scheme)
Andy Wingo [Sun, 21 Jun 2009 11:36:39 +0000 (13:36 +0200)]
formatting changes to (language brainfuck compile-scheme)

* module/language/brainfuck/compile-scheme.scm: Standalone comments
  should have more than one semicolon, and update copyright to LGPLv3+.

14 years agolink to brainfuck wikipedia page
Andy Wingo [Sun, 21 Jun 2009 11:10:56 +0000 (13:10 +0200)]
link to brainfuck wikipedia page

* doc/ref/compiler.texi: Point to more info on Brainfuck. Patch by
  Daniel Kraft.

14 years agoadded documenting comments to the brainfuck compiler and mention it in the VM documen...
Daniel Kraft [Sat, 23 May 2009 07:58:54 +0000 (09:58 +0200)]
added documenting comments to the brainfuck compiler and mention it in the VM documentation.

* doc/ref/compiler.texi: Mention the new brainfuck compiler as an example.
* module/language/brainfuck/compile-scheme.scm: Add a lot of documentation comments.
* module/language/brainfuck/parse.scm: Ditto.
* module/language/brainfuck/spec.scm: Ditto.

14 years agobasic brainfuck -> scheme example compiler.
Daniel Kraft [Sat, 23 May 2009 07:58:54 +0000 (09:58 +0200)]
basic brainfuck -> scheme example compiler.

* module/Makefile.am: Install the brainfuck compiler modules.
* module/language/brainfuck/spec.scm: New file.
* module/language/brainfuck/parse.scm: New file.
* module/language/brainfuck/compile-scheme.scm: New file.

14 years agoremove obsolete guile-vm.texi
Andy Wingo [Sun, 21 Jun 2009 10:57:55 +0000 (12:57 +0200)]
remove obsolete guile-vm.texi

* doc/guile-vm.texi: Remove, has been folded into the Guile manual for a
  while now.

* doc/Makefile.am: Remove guile-vm.texi.

14 years agoupdate .gitignore
Andy Wingo [Sun, 21 Jun 2009 10:51:16 +0000 (12:51 +0200)]
update .gitignore

* .gitignore: Update.

14 years agoDeterministic test for the r6rs-ports.test segmentation fault
Neil Jerram [Sun, 21 Jun 2009 12:31:20 +0000 (13:31 +0100)]
Deterministic test for the r6rs-ports.test segmentation fault

* test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Add (gc), to
  test the (ex-)bug in cbp_mark () when marking a closed port.

14 years agoFix crash when marking closed custom bytevector port
Andy Wingo [Sun, 21 Jun 2009 10:41:46 +0000 (12:41 +0200)]
Fix crash when marking closed custom bytevector port

* libguile/r6rs-ports.c (cbp_mark): A closed port will have had its
  stream destroyed, so don't dereference the stream in that case. Patch by
  Mike Gran.

14 years agoput autocompiled files into ~/.cache or $XDG_CACHE_HOME
Andy Wingo [Sat, 20 Jun 2009 12:26:54 +0000 (14:26 +0200)]
put autocompiled files into ~/.cache or $XDG_CACHE_HOME

* module/system/base/compile.scm (compiled-file-name): Remove unneeded
  path separator.

* libguile/load.c (scm_init_load_path): Change so the default cache path
  is ~/.cache/guile/ccache/1.9, and respect $XDG_CACHE_HOME.

14 years agofix source information lossage for (define (foo) ...) lambda sugar
Andy Wingo [Sat, 20 Jun 2009 10:41:11 +0000 (12:41 +0200)]
fix source information lossage for (define (foo) ...) lambda sugar

* module/ice-9/psyntax.scm (source-wrap): Use decorate-source, for
  clarity.
  (syntax-type): When turning the RHS of (define (foo) ...) into a
  lambda, decorate the resulting lambda expression with source
  information, as the RHS later goes to chi-expr, which receives no
  source information. Perhaps that is a bug. In any case, fixes some
  source location lossage, reported by Jao.

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

14 years agobetter error in make_objcode_by_mmap
Andy Wingo [Sat, 20 Jun 2009 09:41:50 +0000 (11:41 +0200)]
better error in make_objcode_by_mmap

* libguile/objcodes.c (make_objcode_by_mmap): Better error when the
  object header is incorrect.

14 years agosource information for the interpreter
Andy Wingo [Sat, 20 Jun 2009 08:47:37 +0000 (10:47 +0200)]
source information for the interpreter

* module/ice-9/psyntax.scm: Try to propagate source information when
  generating output for the interpreter.

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