bpt/guile.git
12 years agodefine `flet' directly
BT Templeton [Tue, 9 Aug 2011 00:40:13 +0000 (20:40 -0400)]
define `flet' directly

* module/language/elisp/compile-tree-il.scm (compile-flet): Compile
  `flet' directly instead of using `generate-let'.

12 years agolexical binding macros
BT Templeton [Tue, 9 Aug 2011 00:20:16 +0000 (20:20 -0400)]
lexical binding macros

* module/language/elisp/boot.el (lexical-let, lexical-let*): New macros.

* module/language/elisp/compile-tree-il.scm (bind-lexically?): Remove
  the check for a `lexical' flag, since `lexical-let' and `lexical-let*'
  are no longer special operators.

  (compile-lexical-let, compile-lexical-let*): Remove.

* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

12 years agouse `lexical' declarations in "boot.el"
BT Templeton [Tue, 9 Aug 2011 00:15:06 +0000 (20:15 -0400)]
use `lexical' declarations in "boot.el"

* module/language/elisp/boot.el (prog1, cond, or, catch): Use `let' with
  `lexical' declarations instead of `lexical-let'.
  (%plist-put): Use `let' instead of `lexical-let', since "boot.el" now
  uses lexical binding by default.

12 years agoelisp `while' macro
BT Templeton [Mon, 8 Aug 2011 22:53:01 +0000 (18:53 -0400)]
elisp `while' macro

* module/language/elisp/compile-tree-il.scm (compile-while): Remove.

* module/language/elisp/boot.el (while): New macro.

* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

12 years agoelisp `labels'
BT Templeton [Mon, 8 Aug 2011 22:50:04 +0000 (18:50 -0400)]
elisp `labels'

* module/language/elisp/compile-tree-il.scm (compile-labels): New
  special operator.

* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

12 years agofix `flet' syntax
BT Templeton [Mon, 8 Aug 2011 22:18:41 +0000 (18:18 -0400)]
fix `flet' syntax

* module/language/elisp/compile-tree-il.scm (process-let-bindings):
  Remove.

  (parse-let-binding, parse-flet-binding): New procedures.

  (generate-let, generate-let*): Now takes an association list mapping
  symbols to values for the `bindings' argument.

  (compile-let, compile-let*, compile-lexical-let)
  (compile-lexical-let*): Parse the bindings list with
  `parse-let-binding'.

  (compile-flet): Parse the bindings list with `parse-flet-binding'.

12 years agoelisp binding declarations
BT Templeton [Mon, 8 Aug 2011 21:45:42 +0000 (17:45 -0400)]
elisp binding declarations

* module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a
  new `decls' argument and check it for `lexical' declarations.
  Establish the same kind of binding whether or not a lexical binding
  for `sym' exists, whereas previously the presence of a lexical binding
  would cause newly-established bindings to be lexical bindings as well.

  (split-let-bindings): Remove. All callers changed.

  (generate-let, generate-let*, compile-lambda): Pass the declarations
  list to `bind-lexically?'.

* test-suite/tests/elisp-compiler.test: Explicitly disable the
  lexical-binding mode. Add `lexical' declarations where necessary.

12 years agodeclaration parsing
BT Templeton [Fri, 5 Aug 2011 20:14:42 +0000 (16:14 -0400)]
declaration parsing

* module/language/elisp/compile-tree-il.scm (parse-body-1, parse-body)
  (parse-lambda-body, parse-declaration): New procedures.
  (generate-let, generate-let*): Use `parse-body'.
  (compile-lambda): Use `parse-lambda-body'.

12 years agoelisp lambda list parsing
BT Templeton [Sat, 6 Aug 2011 23:13:10 +0000 (19:13 -0400)]
elisp lambda list parsing

* module/language/elisp/compile-tree-il.scm (split-lambda-arguments):
  Remove.

  (parse-lambda-list, make-simple-lambda): New procedures.

  (compile-lambda): Use `parse-lambda-list' and `make-simple-lambda'.
  Set empty rest arguments to the empty list instead of `#nil'.

* test-suite/tests/elisp-compiler.test ("Lambda Expressions")["rest
  argument"]: Use Elisp `null' instead of a Scheme equality check.

12 years agoelisp function subrs
BT Templeton [Mon, 25 Jul 2011 17:21:55 +0000 (13:21 -0400)]
elisp function subrs

* module/language/elisp/boot.el (null, consp, listp, car, cdr)
  (make-symbol, signal): Use `%funcall' instead of `funcall' or `fset'.
  (symbolp, symbol-function, eval): Use `%funcall', since `funcall' now
  calls these functions.

  (functionp, %indirect-function): New functions.
  (funcall): Define in terms of `%funcall' and `%indirect-function'.
  (apply): New function. Previously defined in
  "module/language/elisp/runtime/subrs.scm".

  (fset): If `definition' is not a function, set the function cell of
  `symbol' to an falias for `definition'.

* module/language/elisp/falias.scm: New file.

* module/language/elisp/subrs.scm: Remove file.
  (apply): Remove. Now defined in "boot.el".
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

* module/Makefile.am: Update.

12 years agoremove dynamic function binding
BT Templeton [Sat, 30 Jul 2011 21:12:13 +0000 (17:12 -0400)]
remove dynamic function binding

* module/language/elisp/compile-tree-il.scm (find-operator): Assume that
  `name' is lexically bound.
* module/language/elisp/runtime.scm (symbol-fbound?, fmakunbound!):
  Assume that `symbol' is lexically bound.
  (defspecial): Bind special operators lexically.

12 years agoelisp nil equality
BT Templeton [Sat, 30 Jul 2011 04:22:15 +0000 (00:22 -0400)]
elisp nil equality

* module/language/elisp/boot.el (eq, equal): Return `#t' if both
  arguments are nil.
  (eql): New function.

12 years agouse lexical binding in boot.el
BT Templeton [Sat, 30 Jul 2011 04:16:50 +0000 (00:16 -0400)]
use lexical binding in boot.el

* module/language/elisp/boot.el: Use lexical binding.

12 years agoremove unused code
BT Templeton [Mon, 25 Jul 2011 19:04:34 +0000 (15:04 -0400)]
remove unused code

* module/language/elisp/compile-tree-il.scm (runtime-error): Remove.
* module/language/elisp/runtime.scm (macro-error, runtime-error,
  elisp-bool, prim): Remove.

12 years agonew elisp special form `%funcall'
BT Templeton [Mon, 25 Jul 2011 16:26:44 +0000 (12:26 -0400)]
new elisp special form `%funcall'

* module/language/elisp/compile-tree-il.scm (compile-%funcall): New
  procedure.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

12 years agorewrite `eval' and `load' in elisp
BT Templeton [Fri, 22 Jul 2011 16:09:59 +0000 (12:09 -0400)]
rewrite `eval' and `load' in elisp

* module/language/elisp/subrs.scm (eval, load): Rewrite in Elisp and
  move to...
* module/language/elisp/boot.el (eval, load): ...here.

12 years agoevaluate the function position correctly
BT Templeton [Thu, 14 Jul 2011 22:11:17 +0000 (18:11 -0400)]
evaluate the function position correctly

* module/language/elisp/compile-tree-il (compile-pair): Use `function'
  to perform functional evaluation. Previously, if the operator of a
  compound form was not a symbol, the operator would be evaluated as a
  normal expression. This happened to work only because there is a
  `lambda' macro. The compiler will now signal an error if the operator
  is neither a function name nor a lambda expression.

* test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional
  argument"]: Remove an erroneous use of `function' in the function
  position.

12 years agopurify elisp symbol cell modules
BT Templeton [Thu, 14 Jul 2011 21:07:21 +0000 (17:07 -0400)]
purify elisp symbol cell modules

* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/value-slot.scm: Define these as pure modules.

12 years agorecord elisp function names
BT Templeton [Thu, 14 Jul 2011 08:09:12 +0000 (04:09 -0400)]
record elisp function names

* language/elisp/compile-tree-il.scm (compile-lambda): Add a `meta'
  argument for the procedure's properties.

  (compile-function, compile-defmacro, compile-defun): Update
  accordingly, passing a `name' property to `compile-lambda' where
  possible.

12 years agoelisp variable aliases
BT Templeton [Wed, 13 Jul 2011 01:10:55 +0000 (21:10 -0400)]
elisp variable aliases

* module/language/elisp/boot.el (defvaralias): New function.

12 years agosimplify elisp symbol accessors
BT Templeton [Wed, 13 Jul 2011 00:56:38 +0000 (20:56 -0400)]
simplify elisp symbol accessors

* module/language/elisp/boot.el (fset, symbol-value, symbol-function)
  (set, makunbound, fmakunbound, boundp, fboundp): Use procedures in
  `(language elisp runtime)'.
  (symbolp): New function.

* module/language/elisp/compile-tree-il.scm (set-variable!): Use
  `set-symbol-function!'.

* module/language/elisp/runtime.scm (reference-variable, set-variable!):
  Remove.
  (symbol-fluid, set-symbol-fluid!): New procedure.
  (symbol-value, set-symbol-value!, symbol-function)
  (set-symbol-function!, symbol-bound?, symbol-fbound?, makunbound!)
  (fmakunbound!): Moved from `(language elisp subrs)' and updated to
  avoid using `reference-variable' and `set-variable!'.

* module/language/elisp/runtime/subrs.scm (symbol-value)
  (symbol-function, set, fset, makunbound, fmakunbound, boundp)
  (fboundp): Move to `(language elisp runtime)'.
  (apply): Use `symbol-function'.

12 years agoelisp property lists
BT Templeton [Sun, 10 Jul 2011 23:17:08 +0000 (19:17 -0400)]
elisp property lists

* module/language/elisp/boot.el (%plist-member, %plist-get, %plist-put)
  (plist-get, plist-put, plist-member, lax-plist-get, lax-plist-put)
  (symbol-plist, setplist, get, put): New functions.
  (plist-function): New variable.

12 years agosimplify `mark-global!'
BT Templeton [Sun, 10 Jul 2011 21:33:44 +0000 (17:33 -0400)]
simplify `mark-global!'

* module/language/elisp/bindings.scm (mark-global!): Use `lset-adjoin'.

12 years agoremove `flet*' elisp special form
BT Templeton [Sun, 10 Jul 2011 21:14:32 +0000 (17:14 -0400)]
remove `flet*' elisp special form

* module/language/elisp/compile-tree-il.scm (compile-flet*): Remove.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.
* test-suite/tests/elisp-compiler.test
  ("Lambda Expressions")["flet and flet*"]: Remove `flet*' test.

12 years agoremove `with-always-lexical' elisp special form
BT Templeton [Sun, 10 Jul 2011 21:07:42 +0000 (17:07 -0400)]
remove `with-always-lexical' elisp special form

* module/language/elisp/compile-tree-il.scm: (always-lexical): Remove.
  All uses changed.
  (with-added-symbols): Remove.
  (compile-with-always-lexical): Remove.
  (process-options!): Remove support for the `#:always-lexical' option.
* module/language/elisp/runtime/function-slot.scm: Update import and
  re-export lists.
* test-suite/tests/elisp-compiler.test: Remove or update tests using
  `with-always-lexical'.

12 years agoemacs-compatible lexical binding
BT Templeton [Sat, 9 Jul 2011 22:49:02 +0000 (18:49 -0400)]
emacs-compatible lexical binding

* module/language/elisp/bindings.scm (global?): New function.
* module/language/elisp/compile-tree-il.scm (lexical-binding): New
  variable.
  (bind-lexically?): If lexical binding is enabled, bind lexically
  unless a special binding exists.
  (compile-%set-lexical-binding-mode): New function.
* module/language/elisp/lexer.scm (lexical-binding-regexp): New
  variable.
  (lex): Return a `set-lexical-binding-mode!' token if a comment is
  found while reading the first line.
* module/language/elisp/parser.scm (get-expression): Add support for
  `set-lexical-binding-mode!' tokens.
* module/language/elisp/runtime/function-slot.scm: Import and re-export
  the `%set-lexical-binding-mode' special form.
* test-suite/tests/elisp-compiler.test
  ("Let and Let*")["lambda args inside lexical-let"]: Update.

12 years agoremove `bind-arg-lexical?'
BT Templeton [Sat, 9 Jul 2011 21:08:29 +0000 (17:08 -0400)]
remove `bind-arg-lexical?'

* module/language/elisp/compile-tree-il.scm (bind-arg-lexical?): Remove.
  All callers changed to use `bind-lexically?'.

12 years agofix elisp `catch'
BT Templeton [Fri, 8 Jul 2011 03:29:31 +0000 (23:29 -0400)]
fix elisp `catch'

* module/language/elisp/boot.el (catch): Only catch exceptions of type
  `elisp-exception'.

12 years agoimplement `throw' in elisp
BT Templeton [Fri, 8 Jul 2011 03:20:19 +0000 (23:20 -0400)]
implement `throw' in elisp

* module/language/elisp/runtime/subrs.scm (throw): Rewrite in Elisp and
  move to...
* module/language/elisp/boot.el (throw): ...here.

12 years agorewrite `map-globals'
BT Templeton [Fri, 8 Jul 2011 03:08:22 +0000 (23:08 -0400)]
rewrite `map-globals'

* module/language/elisp/bindings.scm (map-globals): Use `append-map' and
  `map' instead of explicit iteration with named `let'.

12 years agouse srfi-9 for elisp bindings records
BT Templeton [Thu, 7 Jul 2011 23:30:38 +0000 (19:30 -0400)]
use srfi-9 for elisp bindings records

* module/language/elisp/bindings.scm: Use `(srfi srfi-9)'.
  (bindings-type): Remove low-level record type definition and replace
  with...
  (bindings): ...this, an SRFI-9 record type. All uses changed.
  (mark-global-needed!): Rename to...
  (mark-global!): ...this. All callers changed.
  (map-globals-needed): Rename to...
  (map-globals): ...this. All callers changed.

12 years agofix compilation of elisp forms with empty bodies
BT Templeton [Tue, 21 Jun 2011 03:04:45 +0000 (23:04 -0400)]
fix compilation of elisp forms with empty bodies

* module/language/elisp/compile-tree-il.scm (generate-let)
  (generate-let*, compile-lambda, compile-with-added-symbols)
  (compile-progn, compile-if): Return nil if the form's body is empty.
* test-suite/tests/elisp-compiler.test ("Sequencing")["empty progn"]:
  New test.
  ("Conditionals")["if with no else"]: New test.
  ("Let and Let*")["empty let, empty let*"]: New test.
  ("Lambda Expressions")["empty lambda"]: New test.

12 years agorewrite elisp macros in elisp
BT Templeton [Mon, 20 Jun 2011 21:23:13 +0000 (17:23 -0400)]
rewrite elisp macros in elisp

* module/language/elisp/runtime/macros.scm: Remove.
  (macro-lambda, macro-prog1, macro-prog2, macro-cond, macro-and,
  macro-or, macro-catch, macro-unwind-protect): Rewrite in Elisp and
  move to...
* module/language/elisp/boot.el (lambda, prog1, prog2, cond, and, or,
  catch, unwind-protect): ...here.
  (eval-and-compile): New macro.
  (funcall, fset, null, consp, listp, car, cdr, make-symbol-signal):
  Wrap definitions in an `eval-and-compile' form so that they can be
  used by the rewritten macros.
* module/language/elisp/runtime.scm: Remove `built-in-macro'.
* module/language/elisp/Makefile.am: Remove
  module/language/elisp/runtime/macros.scm from `ELISP_LANG_SOURCES'.

12 years agonew elisp special form `eval-when-compile'
BT Templeton [Mon, 20 Jun 2011 21:08:56 +0000 (17:08 -0400)]
new elisp special form `eval-when-compile'

* module/language/elisp/compile-tree-il.scm (compile-eval-when-compile):
  New function.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

12 years agoremove unnecessary elisp macros
BT Templeton [Fri, 17 Jun 2011 06:10:55 +0000 (02:10 -0400)]
remove unnecessary elisp macros

* module/language/elisp/runtime/macros.scm (when, unless, dotimes)
  (dolist, pop, push): Remove. (They are not special forms in Emacs.)

* module/language/elisp/runtime/function-slot.scm: Update import and
  export lists.

* test-suite/tests/elisp-compiler.test ("Conditionals")["failing when"]
  ["succeeding when", "failing unless", "succeeding unless"]: Remove.
  ("Iteration")["dotimes", "dolist"]: Remove.
  ("List Built-Ins")["pop", "push"]: Remove.

12 years agoelisp test fixes
BT Templeton [Fri, 17 Jun 2011 05:29:49 +0000 (01:29 -0400)]
elisp test fixes

* test-suite/tests/elisp-compiler.test ("Exceptions")["catch and
  throw"]: Use a freshly-consed object instead of a literal object. This
  test previously assumed that similar literal objects are never
  identical, which no longer true.
  ("Equivalence Predifcates")["eq"]: Likewise.

12 years agonew `string' and `mapcar' elisp subrs
BT Templeton [Fri, 17 Jun 2011 04:56:34 +0000 (00:56 -0400)]
new `string' and `mapcar' elisp subrs

* module/language/elisp/boot.el (string, mapcar): New functions.

12 years agorewrite elisp subrs in elisp
BT Templeton [Fri, 17 Jun 2011 04:50:57 +0000 (00:50 -0400)]
rewrite elisp subrs in elisp

* module/language/elisp/runtime/subrs.scm (%, *, +, -, /=, 1+, 1-, <)
  (<=, =, >, >=, abs, append, atom, car, car-safe, cdr, cdr-safe, cons)
  (consp, eq, equal, fceiling, ffloor, float, floatp, fround, ftruncate)
  (funcall, integerp, length, list, listp, make-list, max, min, nlistp)
  (nth, nthcdr, null, numberp, reverse, setcar, setcdr, wholenump)
  (zerop): Rewrite in Elisp and move to...
* module/language/elisp/boot.el: ...here. Some functions have stricter
  type checking, and `elisp-bool' is not currently used (so some
  predicate functions now return `#f' instead of `#nil').
  (boundp, eval, fboundp, fmakunbound, fset, load, makunbound, set)
  (symbol-function, symbol-value, throw): New functions; they call their
  existing implementations in subrs.scm.
  (@): New macro.
* module/language/elisp/runtime.scm (built-in-func): Remove. All uses
  changed.
* module/language/elisp/runtime/function-slot.scm: Update module
  definition.

12 years agoremove unnecessary elisp subrs
BT Templeton [Fri, 17 Jun 2011 04:18:23 +0000 (00:18 -0400)]
remove unnecessary elisp subrs

* module/language/elisp/runtime/subrs.scm (copy-tree, number-sequence):
  Remove. (They are not subrs in Emacs.)

* test-suite/tests/elisp-compiler.test ("List Built-ins")["copy-tree",
  "number-sequence"]: Remove.

12 years ago`atomp' -> `atom'
BT Templeton [Fri, 17 Jun 2011 04:15:07 +0000 (00:15 -0400)]
`atomp' -> `atom'

* module/language/elisp/runtime/subrs.scm (atomp) Rename to...
  (atom): ...this. All callers changed.

12 years agouse `nil?' for elisp conditionals
BT Templeton [Thu, 16 Jun 2011 00:23:50 +0000 (20:23 -0400)]
use `nil?' for elisp conditionals

* module/language/elisp/compile-tree-il.scm (compile-if): Use the `nil?'
  primitive for conditionals.

12 years agoadd `nil?' primitive
BT Templeton [Thu, 16 Jun 2011 00:21:28 +0000 (20:21 -0400)]
add `nil?' primitive

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

* libguile/vm-i-scheme.c (nilp, not_nilp):
* libguile/vm-i-system.c (br_if_nil, br_if_not_nil): New instructions.
  Renumber other ops.

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Increment.

* module/language/assembly/compile-bytecode.scm (compile-bytecode): Add
  support for writing `br-if-nil' and `br-if-not-nil' instructions.

* module/language/assembly/disassemble.scm (code-annotation): Add
  `br-if-nil' and `br-if-not-nil' to the list of branch instructions.

* module/language/tree-il/compile-glil.scm: Add `nil?' to
  `*primcall-ops*'.
  (flatten): Use the new branch instructions for `nil?' conditionals.

* module/language/tree-il/primitives.scm: Add `nil?' to
  `*interesting-primitive-names*', `*effect-free-primitives', and
  `*effect+exception-free-primitives*'.

12 years agoload boot.el
BT Templeton [Sun, 12 Jun 2011 21:19:02 +0000 (17:19 -0400)]
load boot.el

* am/guilec: Add support for compiling Elisp files.
* module/Makefile.am: New variable ELISP_SOURCES.
* module/language/elisp/boot.el: New file.
* module/language/elisp/spec.scm: Load boot.el.

12 years agoremove void-checking cruft
BT Templeton [Sat, 11 Jun 2011 02:56:05 +0000 (22:56 -0400)]
remove void-checking cruft

* module/language/elisp/compile-tree-il.scm: Don't export
  `compile-without-void-checks', which was removed. Remove unused
  `disable-void-check' variable. Update comments.

12 years agoLeave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling.
Ludovic Courtès [Tue, 22 Nov 2011 09:09:27 +0000 (10:09 +0100)]
Leave $GUILE_LOAD_COMPILED_PATH unchanged when cross-compiling.

* meta/uninstalled-env.in: Don't define $GUILE_LOAD_COMPILED_PATH when
  cross-compiling.

12 years agoBuild `psyntax-pp.go' with `--target=$(host)'.
Ludovic Courtès [Tue, 22 Nov 2011 08:07:25 +0000 (09:07 +0100)]
Build `psyntax-pp.go' with `--target=$(host)'.

* module/Makefile.am (ice-9/psyntax-pp.go): Pass `--target=$(host)'.

12 years agoRun `guild compile' with `--target=$(host)'.
Ludovic Courtès [Mon, 21 Nov 2011 23:21:39 +0000 (00:21 +0100)]
Run `guild compile' with `--target=$(host)'.

* am/guilec (.scm.go): Run `guild compile' with `--target=$(host)'.

12 years agoAdd a `--target' option to `guild compile'.
Ludovic Courtès [Mon, 21 Nov 2011 23:19:03 +0000 (00:19 +0100)]
Add a `--target' option to `guild compile'.

* module/scripts/compile.scm (%options)["--target"]: New option.
  (show-version): Update copyright year.
  (compile): Use `with-target' to install the target.

* doc/ref/api-evaluation.texi (Compilation): Mention `--target' option.

12 years agoAdd missing implicit `SCM_API' for `scm_c_make_objcode_slice'.
Ludovic Courtès [Mon, 21 Nov 2011 23:09:22 +0000 (00:09 +0100)]
Add missing implicit `SCM_API' for `scm_c_make_objcode_slice'.

* libguile/objcodes.h (scm_c_make_objcode_slice): Add implicit `SCM_API'.

12 years agoComplete cross-compilation support.
Ludovic Courtès [Mon, 21 Nov 2011 21:08:22 +0000 (22:08 +0100)]
Complete cross-compilation support.

* module/system/base/target.scm (%target-endianness, %target-word-size):
  New fluids.
  (%native-word-size): New variable.
  (with-target): Set these fluids.
  (cpu-endianness, cpu-word-size, triplet-cpu, triplet-vendor,
  triplet-os): New procedures.
  (target-cpu, target-vendor, target-os): Use them.
  (target-endianness, target-word-size): Refer to the corresponding
  fluid.

* libguile/objcodes.c (target_endianness_var, target_word_size_var): New
  global variables.
  (NATIVE_ENDIANNESS): New macro.
  (target_endianness, target_word_size, to_native_order): New functions.
  (make_objcode_from_file): Use `scm_bytecode_to_native_objcode' instead
  of `scm_bytecode_to_objcode'.
  (bytecode_to_objcode): New function, based on `scm_bytecode_to_objcode',
  with the addition of an `endianness' and `word_size' parameters.
  (scm_bytecode_to_objcode): Use it.
  (scm_bytecode_to_native_objcode): New function.
  (scm_write_objcode): Use `target_word_size' and `target_endianness'.
  Convert OBJCODE's len and meta-len to native byte order.
  (scm_init_objcodes): Initialize `target_endianness_var' and
  `target_word_size_var'.

* libguile/objcodes.h (scm_bytecode_to_native_objcode): New declaration.

* libguile/vm.c (really_make_boot_program): Use
  `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'.

* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size): New
  variable.
  (test-target): New procedure.
  ("cross-compilation"): Add `test-target' calls and the "unknown
  target" test.

12 years agoFix `validate-target' in (system base target).
Ludovic Courtès [Mon, 21 Nov 2011 20:55:13 +0000 (21:55 +0100)]
Fix `validate-target' in (system base target).

* module/system/base/target.scm (validate-target): Accept any tuple with
  at least 3 parts.

* test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure.
  ("cross-compilation"): New test prefix.

12 years agodeprecate direct scm_protects access
Andy Wingo [Fri, 18 Nov 2011 10:09:48 +0000 (11:09 +0100)]
deprecate direct scm_protects access

* libguile/gc.h:
* libguile/gc.c: Deprecate direct access to scm_protects.

12 years agoAllow overlapping regions to be passed to `bytevector-copy!'.
Ludovic Courtès [Sun, 20 Nov 2011 00:10:58 +0000 (01:10 +0100)]
Allow overlapping regions to be passed to `bytevector-copy!'.

Reported by Dmitry Chestnykh <dmitry@codingrobots.com>.
Fixes <http://debbugs.gnu.org/10070>.

* libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not
  `memcpy'.

* test-suite/tests/bytevectors.test ("2.2 General
  Operations")["bytevector-copy! overlapping"]: New test.

* doc/ref/api-data.texi (Bytevector Manipulation): Mention possible
  overlapping.

12 years agoeval.test work
Andy Wingo [Thu, 17 Nov 2011 09:52:06 +0000 (10:52 +0100)]
eval.test work

* test-suite/tests/eval.test ("stacks"): Enable another test, fix to use
  with-throw-handler, and remove a duplicate test, now that there is no
  difference between subrs and gsubrs.

12 years agoFFI: Hold a weak reference to the CIF made by `procedure->pointer'.
Ludovic Courtès [Wed, 16 Nov 2011 22:53:58 +0000 (23:53 +0100)]
FFI: Hold a weak reference to the CIF made by `procedure->pointer'.

* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
  to CIF so that it is not reclaimed before POINTER.  Before that it
  could be reclaimed and typically reused to store the CIF of another
  procedure with the same arity, leading to obscure wrong-type-arg
  errors.

12 years agoFFI: Add a `procedure->pointer' test.
Ludovic Courtès [Wed, 16 Nov 2011 22:51:34 +0000 (23:51 +0100)]
FFI: Add a `procedure->pointer' test.

* test-suite/tests/foreign.test ("procedure->pointer")["procedures
  returning a pointer"]: New test.

12 years agofix urls in docs
Andy Wingo [Wed, 16 Nov 2011 22:21:59 +0000 (23:21 +0100)]
fix urls in docs

* doc/ref/intro.texi (Introduction):
* doc/ref/scheme-reading.texi (Further Reading):
* doc/ref/srfi-modules.texi (SRFI Support): Fix some urls.  Thanks to
  Henrik Sandklef for the report.

12 years agofix web.texi typo
Andy Wingo [Wed, 16 Nov 2011 22:17:51 +0000 (23:17 +0100)]
fix web.texi typo

* doc/ref/web.texi (HTTP Headers): Fix a typo.  Thanks to Brian Gough
  for the report.

12 years agohack the port-column of current-output-port after printing a prompt
Andy Wingo [Wed, 16 Nov 2011 22:13:55 +0000 (23:13 +0100)]
hack the port-column of current-output-port after printing a prompt

* module/ice-9/boot-9.scm (repl-reader): Reset the output-column to 0
  after printing the prompt.  Fixes bug 9664.

12 years agoeval-when tidying up
Andy Wingo [Wed, 16 Nov 2011 19:15:26 +0000 (20:15 +0100)]
eval-when tidying up

* module/ice-9/psyntax.scm: Rename expand-when-list to parse-when-list,
  and simplify to compare literal values.
* module/ice-9/psyntax-pp.scm: Regenerate.

12 years agopsyntax: s/chi/expand/g
Andy Wingo [Wed, 16 Nov 2011 19:08:40 +0000 (20:08 +0100)]
psyntax: s/chi/expand/g

* module/ice-9/psyntax.scm: Rename all instances of "chi" to "expand".
  Addded a hack to expand-eval-when that will be fixed later.
* module/ice-9/psyntax-pp.scm: Regenerated.

12 years agofix bug in make-repl when lang is actually a language
Andy Wingo [Wed, 16 Nov 2011 18:44:04 +0000 (19:44 +0100)]
fix bug in make-repl when lang is actually a language

* module/system/repl/common.scm (make-repl): Fix to accept language
  objects in addition to symbols.  Fixes http://debbugs.gnu.org/9857.
  Thanks to Tristan Colgate for the report.

12 years agoRe-enable a couple of evaluator tests.
Ludovic Courtès [Wed, 16 Nov 2011 14:11:55 +0000 (15:11 +0100)]
Re-enable a couple of evaluator tests.

These tests had been disabled as part of
b7742c6b7132544b9d6cd9cb32c09e2084ad9e52 ("new evaluator, y'all").

* test-suite/tests/eval.test ("define set procedure-name")["closure"]:
  Change to `pass-if' since it now works, as a result of
  ee15aa46e3fb29e609bd7c431e8f2676f6573d57 ("set names of functions
  defined at the toplevel from `eval'").
  ("stacks")["arguments of a gsubr stack frame"]: Remove (throw
  'unresolved).

12 years agomemoize: booleanify the rest arg
Andy Wingo [Wed, 16 Nov 2011 12:33:52 +0000 (13:33 +0100)]
memoize: booleanify the rest arg

* libguile/memoize.c (memoize): Turn the rest arg into a boolean.  Fixes
  an error when rest gets passed to set-procedure-minimum-arity!.

12 years agoset names of functions defined at the toplevel from `eval'
Andy Wingo [Tue, 15 Nov 2011 22:38:40 +0000 (23:38 +0100)]
set names of functions defined at the toplevel from `eval'

* module/ice-9/eval.scm (primitive-eval): Set the name of
  toplevel-defined functions.

12 years agobetter debuggability for interpreted procedures
Andy Wingo [Tue, 15 Nov 2011 22:36:07 +0000 (23:36 +0100)]
better debuggability for interpreted procedures

* libguile/procprop.c (scm_set_procedure_minimum_arity_x): New
  function, allows a user to override a function's arity.
  (scm_i_procedure_arity): Look up in the overrides table first.

* libguile/procprop.h: Add scm_set_procedure_minimum_arity_x.

* module/ice-9/eval.scm (primitive-eval): Override arity of "general
  closures".

* test-suite/tests/procprop.test ("procedure-arity"): Add tests.

Based on a patch from Stefan Israelsson Tampe.  Test based on work by
Patrick Bernaud.

12 years agoupdate letrec compilation test
Andy Wingo [Fri, 11 Nov 2011 15:39:28 +0000 (16:39 +0100)]
update letrec compilation test

* test-suite/tests/tree-il.test ("letrec"): Update to clear the
  temporary `let' bindings.

12 years agofix bit-set*! bug (!)
Andy Wingo [Thu, 10 Nov 2011 21:30:02 +0000 (22:30 +0100)]
fix bit-set*! bug (!)

* libguile/bitvectors.c (scm_bit_set_star_x): Fix a long-standing (since
  2005) bug in which instead of using the kv bitvector, we actually use
  the `v' bitvector.  Also, change to allow `kv' being shorter than
  `v'.

* test-suite/tests/bitvectors.test ("bit-set*!"): Add tests.

12 years agowhen leaving a non-tail let, allow bound vals to be collected
Andy Wingo [Wed, 9 Nov 2011 22:45:53 +0000 (23:45 +0100)]
when leaving a non-tail let, allow bound vals to be collected

* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Clear
  lexical stack slots at the end of a non-tail let, letrec, or fix.
  Fixes http://debbugs.gnu.org/9900.

* test-suite/tests/gc.test ("gc"): Add test.

12 years agosimplify primitives.scm for dynwind
Andy Wingo [Wed, 9 Nov 2011 15:44:59 +0000 (16:44 +0100)]
simplify primitives.scm for dynwind

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Remove a dynwind hack, as we have a good inliner now.

12 years agopeval: fix dynwind bug.
Andy Wingo [Wed, 9 Nov 2011 14:23:58 +0000 (15:23 +0100)]
peval: fix dynwind bug.

* module/language/tree-il/peval.scm (peval): The <dynwind> compiler will
  copy the winder and unwinder values, so make sure that they are
  constant, and if not, create lexical bindings.  Fixes
  http://debbugs.gnu.org/9844.

* test-suite/tests/tree-il.test ("partial evaluation"): Add a couple
  <dynwind> tests.

12 years agofix <dynwind> serialization.
Andy Wingo [Wed, 9 Nov 2011 15:41:56 +0000 (16:41 +0100)]
fix <dynwind> serialization.

* module/language/tree-il.scm (unparse-tree-il): Fix <dynwind>
  serialization.

12 years agopeval: don't copy assigned lexical bindings
Andy Wingo [Wed, 9 Nov 2011 14:22:01 +0000 (15:22 +0100)]
peval: don't copy assigned lexical bindings

* module/language/tree-il/peval.scm (peval): Since constant-expression?
  is used to determine whether to copy values, return #f if any lexical
  is assigned.

12 years agoFix R6RS `fold-left' so the accumulator is the first argument.
Ian Price [Wed, 26 Oct 2011 19:24:05 +0000 (20:24 +0100)]
Fix R6RS `fold-left' so the accumulator is the first argument.

* module/rnrs/lists.scm (fold-left): New procedure.

* module/rnrs/records/syntactic.scm (define-record-type): Fix to use
  corrected `fold-left'.

* test-suite/tests/r6rs-lists.test: Add tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
12 years agoUpdate `NEWS'.
Ludovic Courtès [Sat, 22 Oct 2011 14:53:43 +0000 (16:53 +0200)]
Update `NEWS'.

12 years agoFix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2.
Ludovic Courtès [Sat, 22 Oct 2011 14:48:46 +0000 (16:48 +0200)]
Fix compilation of `deprecated.c' with SCM_DEBUG_TYPING_STRICTNESS=2.

* libguile/deprecated.c (init_module_stuff,
  scm_primitive_make_property): Use `scm_is_false' instead of direct
  comparison to SCM_BOOL_F'.
  (maybe_close_port, scm_close_all_ports_except): Use `SCM2PTR' and
  `PTR2SCM' instead of wild casts.

12 years agoBump version number for 2.0.3.
Ludovic Courtès [Sat, 22 Oct 2011 14:29:20 +0000 (16:29 +0200)]
Bump version number for 2.0.3.

* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
  (LIBGUILE_INTERFACE_CURRENT): Increment to account for new C functions
  `scm_is_exact' etc.
  (LIBGUILE_INTERFACE_AGE): Increment.

12 years agoUpdate Gnulib to v0.0-6523-gb3609c1.
Ludovic Courtès [Sat, 22 Oct 2011 14:24:32 +0000 (16:24 +0200)]
Update Gnulib to v0.0-6523-gb3609c1.

12 years agodoc: Document the `sitedir' and `extensiondir' pkg-config variables.
Ludovic Courtès [Sat, 22 Oct 2011 14:11:01 +0000 (16:11 +0200)]
doc: Document the `sitedir' and `extensiondir' pkg-config variables.

* doc/ref/libguile-parallel.texi (Parallel Installations): Document the
  `sitedir' and `extensiondir' pkg-config variables.  This fixes
  <https://savannah.gnu.org/bugs/index.php?32515>, reported by
  Dale. P. Smith.

12 years agoFix compilation with `--enable-debug-malloc'.
Bake Timmons [Sat, 22 Oct 2011 11:28:53 +0000 (13:28 +0200)]
Fix compilation with `--enable-debug-malloc'.

* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Add the
  missing second argument in the call to scm_malloc_register.

12 years agoInitialize `get_internal_run_time' before it is used.
Ludovic Courtès [Sat, 22 Oct 2011 11:25:11 +0000 (13:25 +0200)]
Initialize `get_internal_run_time' before it is used.

* libguile/init.c (scm_i_init_guile): Call `scm_init_stime' before
  `scm_init_gc'.  Fixes <https://savannah.gnu.org/bugs/?34616> reported
  by Bake Timmons.

12 years agoset width for `,trace' command
BT Templeton [Fri, 22 Jul 2011 15:35:30 +0000 (11:35 -0400)]
set width for `,trace' command

* module/system/repl/command.scm (trace): Set trace width to terminal
  width by default.

12 years agofix segfault in goops if class fields are redefined
Andy Wingo [Thu, 20 Oct 2011 22:22:44 +0000 (00:22 +0200)]
fix segfault in goops if class fields are redefined

* libguile/goops.c (map, filter_cpl, remove_duplicate_slots): Use
  scm_is_pair instead of !scm_is_null, given that we use accessor
  macros.
  (check_cpl, build_slots_list): Check that descendents of <class> can't
  redefine slots of <class>.

* test-suite/tests/goops.test ("defining classes"): Add a test.

Patch originally by Stefan Israelsson Tampe.

12 years agofix misallocation of some <fix> procedures
Andy Wingo [Thu, 20 Oct 2011 21:50:05 +0000 (23:50 +0200)]
fix misallocation of some <fix> procedures

* module/language/tree-il/analyze.scm (analyze-lexicals): When stepping
  into a non-tail form, we know that labels allocation will be invalid,
  so use an empty labels set.  Fixes http://debbugs.gnu.org/9769.

* test-suite/tests/tree-il.test ("labels allocation"): Add a test.

12 years agoslight frames.h refactor
Andy Wingo [Wed, 19 Oct 2011 09:55:27 +0000 (11:55 +0200)]
slight frames.h refactor

* libguile/frames.h: Instead of doing a lot of nasty pointer match and
  casts here, simply define a struct that aliases the contents of a
  stack frame.  There are some naming issues here, that the SCM_FRAME
  macros access the scm_vm_frame structure, but SCM_VM_FRAME macros
  access scm_frame; oh well.

12 years agodoc: Add `libguile-parallel.texi' to the distribution.
Ludovic Courtès [Tue, 18 Oct 2011 16:47:09 +0000 (18:47 +0200)]
doc: Add `libguile-parallel.texi' to the distribution.

This is a followup to d32df1325dfe5f550cf1262dc7e90ba86b526a7c ("manual:
reorganize autoconf, pkg-config info").

* doc/ref/Makefile.am (guile_TEXINFOS): Add `libguile-parallel.texi'.

12 years agofix (web http) write-date for mondays
Andy Wingo [Mon, 17 Oct 2011 07:48:19 +0000 (09:48 +0200)]
fix (web http) write-date for mondays

* module/web/http.scm (write-date): Fix bug on Mondays.  Jeez!

12 years agodoc: Complete renaming of `autoconf.texi'.
Ludovic Courtès [Sun, 16 Oct 2011 19:55:29 +0000 (21:55 +0200)]
doc: Complete renaming of `autoconf.texi'.

This is a followup to d32df1325dfe5f550cf1262dc7e90ba86b526a7c ("manual:
reorganize autoconf, pkg-config info").

* doc/ref/Makefile.am: Replace references to `autoconf.texi' by
  `libguile-autoconf.texi'.

12 years agoUpdate (ice-9 match) from Chibi-Scheme.
Ludovic Courtès [Sun, 16 Oct 2011 16:36:20 +0000 (18:36 +0200)]
Update (ice-9 match) from Chibi-Scheme.

* module/ice-9/match.scm (match): Remove macro.

* module/ice-9/match.upstream.scm: Update from Chibi-Scheme, which fixes
  <http://debbugs.gnu.org/9567>.

* test-suite/tests/match.test.upstream: Likewise.

12 years agocoverage: Add tests for `case-lambda'.
Ludovic Courtès [Sat, 15 Oct 2011 15:05:23 +0000 (17:05 +0200)]
coverage: Add tests for `case-lambda'.

* test-suite/tests/coverage.test
  ("line-execution-counts")["case-lambda"]: New test.
  ("procedure-execution-count")["case-lambda"]: New test.

12 years agodoc: Mention the partial evaluator next to `define-inlinable'.
Ludovic Courtès [Sat, 15 Oct 2011 15:34:48 +0000 (17:34 +0200)]
doc: Mention the partial evaluator next to `define-inlinable'.

* doc/ref/api-procedures.texi (Inlinable Procedures): Mention inlining
  performed by the partial evaluator.

12 years agocoverage: Add test with `eval'.
Ludovic Courtès [Sat, 15 Oct 2011 14:46:29 +0000 (16:46 +0200)]
coverage: Add test with `eval'.

* test-suite/tests/coverage.test (test-procedure): New procedure.
  ("procedure-execution-count")["called from eval"]: New test.

12 years agoDefault to using poll(2) in `fport_input_waiting'.
Cedric Cellier [Sat, 15 Oct 2011 14:25:21 +0000 (16:25 +0200)]
Default to using poll(2) in `fport_input_waiting'.

* libguile/fports.c (fport_input_waiting): Use poll(2) instead of
  select(2) when possible.  Cosmetic changes by Ludovic Courtès.

12 years agoupdate NEWS for 2.0.3
Andy Wingo [Wed, 12 Oct 2011 15:12:14 +0000 (17:12 +0200)]
update NEWS for 2.0.3

* NEWS: Update.

12 years agoadd "Installing Site Packages"
Andy Wingo [Wed, 12 Oct 2011 14:20:51 +0000 (16:20 +0200)]
add "Installing Site Packages"

* doc/ref/scheme-using.texi (Installing Site Packages): Add a new
  section about where to install .scm, .go, and .so files.

* doc/ref/tour.texi: Reference it here.
* doc/ref/guile.texi: Add new section.

12 years agoupdate tour.texi for site modules and extensions
Andy Wingo [Wed, 12 Oct 2011 11:07:50 +0000 (13:07 +0200)]
update tour.texi for site modules and extensions

* doc/ref/tour.texi (Putting Extensions into Modules)
  (Writing new Modules): In the examples, show the files as being in the
  "site" dirs.

12 years agomanual: reorganize autoconf, pkg-config info
Andy Wingo [Wed, 12 Oct 2011 11:07:30 +0000 (13:07 +0200)]
manual: reorganize autoconf, pkg-config info

* doc/ref/libguile-parallel.texi: New file, documenting parallel
  installation and the use of pkg-config.

* doc/ref/libguile-linking.texi: Adapt.

* doc/ref/libguile-autoconf.texi: Rename from autoconf.texi.  Lower
  sections, and integrate in the "Programming in C" chapter.

* doc/ref/guile.texi: Adapt.

12 years agoremove documentation on autofrisk foo
Andy Wingo [Wed, 12 Oct 2011 09:51:33 +0000 (11:51 +0200)]
remove documentation on autofrisk foo

* doc/ref/autoconf.texi: Remove documentation on autofrisk facility,
  given that we do not ship those macros, and to my knowledge, never
  have.

12 years agoadd (web client) docs
Andy Wingo [Wed, 12 Oct 2011 09:24:58 +0000 (11:24 +0200)]
add (web client) docs

* doc/ref/web.texi (Web Client): New doc section.

12 years agofold constants with accessors
Andy Wingo [Mon, 10 Oct 2011 18:39:22 +0000 (20:39 +0200)]
fold constants with accessors

* module/language/tree-il/peval.scm (peval): Factor constant folding out
  to a helper.  Use it in the accessor case in addition to the normal
  effect-free-primitive case.

* test-suite/tests/tree-il.test: Add a test.