1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

2036 commits

Author SHA1 Message Date
Andy Wingo
04ec290f8b Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/deprecation.c
	libguile/load.c
	libguile/print.c
2011-12-06 19:14:50 +01:00
Andy Wingo
679eea4f0e allow URIs of the form file:///etc/hosts
* module/web/uri.scm (parse-authority): Allow empty authorities, so that
  we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.
2011-12-06 11:47:41 +01:00
Andy Wingo
fe0c202c0e Update a comment in (web client)
* module/web/client.scm: Update a comment.
2011-12-06 11:46:58 +01:00
Andy Wingo
2c27dd57c7 warnings written to warning port
* libguile/deprecation.c (scm_c_issue_deprecation_warning):
* libguile/load.c (auto_compile_catch_handler):
  (scm_sys_warn_auto_compilation_enabled, scm_primitive_load_path):
* module/ice-9/boot-9.scm (warn, %load-announce, duplicate-handlers)
  (load-in-vicinity):
* module/system/base/message.scm (warning): Write to the warning port.
  (*current-warning-port*): Alias the warning port.
2011-12-05 18:11:24 +01:00
Andy Wingo
3972de7675 add current-warning-port
* libguile/ports.h:
* libguile/ports.c (scm_current_warning_port)
  (scm_set_current_warning_port): New functions, wrapping the Scheme
  parameter.

* module/ice-9/boot-9.scm (current-warning-port): New parameter,
  defining a port for warnings.
2011-12-05 18:07:06 +01:00
Andy Wingo
13dd74c8ea setting a parameter returns the previous value
* module/ice-9/boot-9.scm (make-parameter): Setting a parameter by
  invoking it with an argument now returns the previous value.
2011-12-05 17:49:26 +01:00
Andy Wingo
90de5c4c2e add srfi-39 parameters to boot-9
* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
  (parameter-fluid, parameter-converter, parameterize): New top-level
  bindings, implementing SRFI-39 parameters.  Currently,
  current-input-port and similar procedures are not yet parameters.

* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
  tests.
2011-12-05 14:25:25 +01:00
Andy Wingo
6d346bb61a ice-9/poll: verify sizeof(struct pollfd)
* libguile/poll.c (scm_init_poll): Define %sizeof-struct-pollfd.
* module/ice-9/poll.scm: Check %sizeof-struct-pollfd.
2011-12-04 22:45:03 +01:00
Andy Wingo
2aef6c2ba9 ,language at REPL sets current-language
* module/system/repl/command.scm (language): Set the
  *current-language*.
* module/system/repl/repl.scm (start-repl): Create a new dynamic scope
  for *current-language*.
2011-12-04 21:56:13 +01:00
Andy Wingo
b2208d2e98 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/fluids.c
	libguile/gc.c
	libguile/gc.h
	libguile/objcodes.c
	libguile/procprop.c
	libguile/vm.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2011-12-01 23:31:50 +01:00
Andy Wingo
5139b7b928 simplify %condition-type-vtable
* module/srfi/srfi-35.scm (%condition-type-vtable): Use make-vtable
  instead of make-vtable-vtable.
2011-11-24 11:47:36 +01:00
Andy Wingo
f7bbc75d04 record-type-vtable is not a new root of the vtable hierarchy
* module/ice-9/boot-9.scm (record-type-vtable): Simplify to use
  make-vtable instead of make-vtable-vtable.
2011-11-24 11:47:36 +01:00
Daniel Hartwig
69b8c5df14 fix validators for various list-style headers
* module/web/http.scm (default-val-validator): Valid with no value.
  (key-value-list?): Keys are always symbols, do not accept strings.
  (validate-param-list): Apply `valid?' to list elements.
  (validate-credentials): Validate param for Basic scheme, which
  is parsed as a string.
  (declare-symbol-list-header!): `list-of?' args were in wrong order.
  ("Cache-Control"): Replace `default-val-validator' with more
  specific procedure.
  ("Accept"): Validate on first param which has no value.
2011-11-23 23:35:20 +01:00
Ludovic Courtès
f701287497 Allow $GUILE_FOR_BUILD to use its own environment when cross-compiling.
* am/guilec (.scm.go): Use `-L' to specify the search path.
* module/Makefile.am (ice-9/psyntax-pp.go): Likewise.

* meta/uninstalled-env.in (top_builddir): Leave $GUILE_LOAD_PATH,
  $GUILE_SYSTEM_PATH, and $GUILE_SYSTEM_EXTENSIONS_PATH unchanged when
  cross-compiling.
2011-11-23 15:29:18 +01:00
Andy Wingo
9447207f0c Use default value for make-fluid in Scheme files
* module/ice-9/boot-9.scm (%exception-handler)
  (%running-exception-handlers, read-eval?, *repl-stack*)
  (make-mutable-parameter):
* module/ice-9/getopt-long.scm (%program-name):
* module/language/elisp/runtime.scm (built-in-macro, defspecial):
* module/srfi/srfi-39.scm (make-parameter/helper):
* module/system/base/language.scm (*current-language*):
* module/system/base/message.scm (*current-warning-port*):
  (*current-warning-prefix*):
* module/system/base/target.scm (%target-type, %target-endianness)
  (%target-word-size):
* module/texinfo/plain-text.scm (*indent*, *itemizer*):
* benchmark-suite/lib.scm (prefix-fluid):
* test-suite/lib.scm (prefix-fluid): Give fluids a useful default
  value.
2011-11-23 12:54:09 +01:00
Andy Wingo
aafb4ed724 optional default-value arg to make-fluid
* libguile/fluids.c (grow_dynamic_state, new_fluid): Arrange for the
  default value in the dynamic-state vector to be SCM_UNDEFINED instead
  of SCM_BOOL_F.  If the value in the dynamic-state is #f, default to a
  value attached to the fluid instead.  This allows useful default
  values.
  (scm_make_fluid_with_default): New function, allows the user to
  specify a default value for the fluid.  Defaults to #f.  Bound to
  `make-fluid' on the Scheme side.
  (scm_make_unbound_fluid): Use SCM_UNDEFINED as the default in all
  threads.
  (scm_fluid_unset_x): Also unset the default value.  Not sure if this
  is the right thing.
  (fluid_ref): Update to the new default-value strategy.

* libguile/threads.c (scm_i_reset_fluid): Reset to SCM_UNDEFINED.
* libguile/threads.h: Remove extra arg to scm_i_reset_fluid.
* libguile/vm-i-system.c (fluid-ref): Update to new default-value
  strategy.

* module/ice-9/vlist.scm (block-growth-factor): Default to 2 in all
  threads.  Fixes http://debbugs.gnu.org/10093.
2011-11-23 12:53:38 +01:00
BT Templeton
6937c7aa8b 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.
2011-11-22 15:06:12 -05:00
BT Templeton
5d351f0b9b 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.
2011-11-22 15:04:12 -05:00
Ludovic Courtès
a0a8dd6254 Build psyntax-pp.go' with --target=$(host)'.
* module/Makefile.am (ice-9/psyntax-pp.go): Pass `--target=$(host)'.
2011-11-22 09:07:25 +01:00
Ludovic Courtès
d4b8894520 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.
2011-11-22 00:22:46 +01:00
Ludovic Courtès
de2c0a10fe 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.
2011-11-22 00:22:46 +01:00
Ludovic Courtès
e0a9f02224 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.
2011-11-22 00:22:46 +01:00
Andy Wingo
dceb78294d 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.
2011-11-16 23:13:55 +01:00
Andy Wingo
440ac793c4 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.
2011-11-16 20:15:26 +01:00
Andy Wingo
78a474558a 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.
2011-11-16 20:08:40 +01:00
Andy Wingo
46e0923d35 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.
2011-11-16 19:49:50 +01:00
Andy Wingo
ee15aa46e3 set names of functions defined at the toplevel from `eval'
* module/ice-9/eval.scm (primitive-eval): Set the name of
  toplevel-defined functions.
2011-11-15 23:41:51 +01:00
Andy Wingo
f3cf9421cb 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.
2011-11-15 23:36:07 +01:00
Andy Wingo
16371014d6 Merge remote-tracking branch 'origin/stable-2.0' 2011-11-11 16:27:30 +01:00
Andy Wingo
fb135e12a4 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.
2011-11-09 23:45:53 +01:00
Andy Wingo
880e794812 inline dynwind guards for normal control flow
* module/language/tree-il.scm (<tree-il>): Add `pre' and `post' fields
  to <dynwind>, so that we can inline the guard bodies in the normal
  control-flow case.  It also avoids duplicating code in compile-glil,
  which probably hides more bugs in 2.0.
  (parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold)
  (make-tree-il-folder, post-order!, pre-order!): Update.

* module/language/tree-il/analyze.scm (analyze-lexicals): Update.

* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update
  to use `pre' and `post' instead of compiling code twice.

* module/language/tree-il/debug.scm (verify-tree-il): Update.

* module/language/tree-il/peval.scm (peval): Update.  Instead of doing
  complicated things in <dynwind>, handle 'dynamic-wind primcalls.

* module/language/tree-il/primitives.scm (*primitive-expand-table*):
  Remove 'dynamic-wind mess.  Adapt '@dynamic-wind.

* test-suite/tests/tree-il.test ("partial evaluation"): Update tests.
2011-11-09 19:38:44 +01:00
Andy Wingo
2f4aae6bce Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	module/language/tree-il/peval.scm
	module/language/tree-il/primitives.scm
	test-suite/tests/tree-il.test
2011-11-09 17:04:44 +01:00
Andy Wingo
acdf4fcc05 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.
2011-11-09 16:54:43 +01:00
Andy Wingo
8ee0b28b4d 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.
2011-11-09 16:54:30 +01:00
Andy Wingo
5e9b9059a3 fix <dynwind> serialization.
* module/language/tree-il.scm (unparse-tree-il): Fix <dynwind>
  serialization.
2011-11-09 16:54:30 +01:00
Andy Wingo
16d3e0133d 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.
2011-11-09 16:29:46 +01:00
Andy Wingo
0f9f51a153 regenerate psyntax-pp
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-11-07 11:48:30 +01:00
Andy Wingo
de41e56492 hygienically rename macro-introduced bindings, reproducibly
* module/ice-9/psyntax.scm (chi-top-sequence): Detect bindings to
  identifiers introduced by macros.  In that case, in order to preserve
  hygiene, uniquify the variable's name, but in a way that is
  reproduceable (i.e., yields the same uniquified name after a
  recompile).
2011-11-07 11:45:15 +01:00
Andy Wingo
49689a3f2d fix scope bug in <module> definition in boot-9
* module/ice-9/boot-9.scm (define-record-type): Fix scope bug when
  generating identifiers.
2011-11-07 11:45:15 +01:00
Andy Wingo
47e9919d22 resolve-identifier for toplevel definitions resolves by module
* module/ice-9/psyntax.scm (id-var-name): For mapping identifiers to
  toplevel definitions, also compare against the module.
  (resolve-identifier): Pass the module to id-var-name when looking up
  identifiers.
  (free-id=?): Adapt to id-var-name change.
  (chi-top-sequence): When adding a mapping from the given identifier
  to a toplevel definition, make the name be a pair.
2011-11-07 11:42:29 +01:00
Andy Wingo
19ef14f9b8 defined identifiers scoped in the current module
* ice-9/psyntax.scm (chi-top-sequence): Wrap defined identifiers with
  the current module.  Fixes http://savannah.gnu.org/bugs/?31472.
2011-11-07 11:39:05 +01:00
Andy Wingo
5b36d6034b syntax parameters implemented properly
* module/ice-9/psyntax.scm (resolve-identifier): Take an additional
  argument, indicating whether syntax parameters should be resolved or
  not.  Just return three values: the binding type and value, and the
  module for resolving toplevels.
  (chi-install-global): Take an extra arg, the type.  If we are defining
  a syntax parameter, construct a pair for the binding.
  (chi-body): Syntax parameters now use a per-parameter unique value (a
  pair) as a key in the expansion-time environment `r'.
  (syntax-parameterize): Don't allow parameterization of
  non-parameters.  This is an incompatible change, but it is for the
  better; you don't want to allow users to parameterize `lambda', after
  all.
2011-11-07 11:39:04 +01:00
Andy Wingo
ea3ca4e4d0 syntax-parameterize, not fluid-let-syntax
* module/ice-9/psyntax.scm (syntax-parameterize): Rename from
  fluid-let-syntax.

* module/ice-9/boot-9.scm (define-inlinable): Use syntax-parameterize
  (and define-syntax-parameter).
2011-11-07 11:38:47 +01:00
Andy Wingo
c2d822de19 add define-syntax-parameter, same as define-syntax
* module/ice-9/psyntax.scm (define-syntax-parameter): New toplevel form.
  Will be used to implement syntax parameters, following Barzilay,
  Culpepper, and Flatt's 2011 SFP workshop paper, "Keeping it Clean with
  syntax-parameterize".  Adds a new binding type and definition form.
2011-11-07 11:38:47 +01:00
Andy Wingo
c070de6345 psyntax: resolve-identifier refactor
* module/ice-9/psyntax.scm (id-var-name): Add a nice long comment.
  (lookup): Remove, as it is no longer used.
  (resolve-identifier): New helper, replaces most uses of id-var-name
  then `lookup'.
  (syntax-type, syntax, set!, fluid-let-syntax): Adapt to use
  resolve-identifier.
  (free-id=?): Adapt to id-var-name returning syntax objects.
2011-11-07 11:38:40 +01:00
Andy Wingo
45f584674a chi-top-sequence refactor
* module/ice-9/psyntax.scm (chi-top-sequence): Reimplement, more like
  chi-body.  Instead of adding empty definitions to the toplevel, add
  toplevel definitions to the wrap shared by all forms in the sequence.
2011-11-04 15:52:40 +01:00
Andy Wingo
f698b7286f minor psyntax refactors
* module/ice-9/psyntax.scm (syntax-type): Remove redundant lexical
  case.
  (syntax-rules, define-syntax-rule): Use `_' instead of `dummy' for the
  keyword.

* module/ice-9/boot-9.scm (define-syntax-rule): Remove redundant
  definition.
2011-11-04 14:12:35 +01:00
Andy Wingo
ef9ffe5efd peval doesn't resolve primitives
* module/language/tree-il/peval.scm (peval): Don't resolve primitives,
  as resolve-primitives! handles that already.

* test-suite/tests/tree-il.test (pass-if-peval): Always resolve and
  expand primitives.
  ("partial evaluation"): Update tests to assume expanded primitives.
2011-11-04 14:12:25 +01:00
Andy Wingo
14b208185c resolve-primitives! does not primitivize local definitions
* module/language/tree-il/primitives.scm (resolve-primitives!): Don't
  resolve toplevels defined in the same compilation unit to primitives,
  as it could be that the module doesn't have those bindings yet.
2011-11-04 13:37:58 +01:00
Ian Price
d825841db0 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>
2011-11-01 01:11:46 +01:00