bpt/guile.git
15 years agoRewrite SRFI-35 macros using `syntax-rules'.
Ludovic Courtès [Fri, 22 May 2009 21:44:43 +0000 (23:44 +0200)]
Rewrite SRFI-35 macros using `syntax-rules'.

* module/srfi/srfi-35.scm: Use `(ice-9 syncase)'.
  (define-condition-type, condition): Rewritten using `syntax-rules'.
  (compound-condition, condition-instantiation): New helper internal
  macros.  Thanks to Andy Wingo for his help!

15 years agoMake use of Gnulib's `flock' module.
Ludovic Courtès [Wed, 20 May 2009 23:24:01 +0000 (01:24 +0200)]
Make use of Gnulib's `flock' module.

* libguile/posix.c: Always use <sys/file.h>, which is provided by
  Gnulib.
  (flock)[__MINGW32__]: Remove.
  (scm_flock): Compile unconditionally.  Always use Gnulib's flock(2).

15 years agoMake use of Gnulib's `putenv' module.
Ludovic Courtès [Wed, 20 May 2009 23:17:00 +0000 (01:17 +0200)]
Make use of Gnulib's `putenv' module.

* libguile/posix.c: Include <stdlib.h> since the putenv(3) declaration
  is there (POSIX and Gnulib).
  (scm_putenv): Rely on Gnulib's `putenv' module.

15 years agoAdd Gnulib portability modules; update Gnulib files.
Ludovic Courtès [Wed, 20 May 2009 23:00:41 +0000 (01:00 +0200)]
Add Gnulib portability modules; update Gnulib files.

* m4/gnulib-cache.m4 (gl_MODULES): Add `flock' (provides flock(2)
  declaration and implementation), `fpieee' (fixes floating point
  behavior on Alpha and SH), `stdlib' (provides an unsetenv(3)
  declaration, among others), `putenv' (provides a putenv(3) declaration
  and implementation with the semantics we need).

15 years agoUpdate `NEWS'.
Ludovic Courtès [Mon, 11 May 2009 22:12:18 +0000 (00:12 +0200)]
Update `NEWS'.

15 years agoSymbols longer than 128 chars can cause an exception. Also, the terminating colon...
Michael Gran [Sat, 25 Apr 2009 05:23:13 +0000 (22:23 -0700)]
Symbols longer than 128 chars can cause an exception.  Also, the terminating colon of long postfix keywords are not handled correctly.

* test-suite/tests/reader.test ("read-options"): Add test
for long postfix keywords.

* libguile/read.c (scm_read_mixed_case_symbol): Fix
exception on symbols are greater than 128 chars.  Also,
colons are not stripped from long postfix keywords.

15 years agoUpdate `NEWS' wrt. `branch_release-1-8'.
Ludovic Courtès [Wed, 20 May 2009 22:16:47 +0000 (00:16 +0200)]
Update `NEWS' wrt. `branch_release-1-8'.

15 years agoFix compilation of `test-round.c' on BSD.
Ludovic Courtès [Mon, 11 May 2009 20:13:29 +0000 (22:13 +0200)]
Fix compilation of `test-round.c' on BSD.

* test-suite/standalone/test-round.c (HAVE_MACHINE_FPU_H): Include
  <sys/types.h> when available.  This fixes compilation on NetBSD.
  Reported by Greg Toxel.

15 years agoUpdate `NEWS'.
Ludovic Courtès [Thu, 23 Apr 2009 22:44:43 +0000 (00:44 +0200)]
Update `NEWS'.

15 years agoDon't use raw divisions by zero in `test-conversion.c'.
Ludovic Courtès [Thu, 23 Apr 2009 21:20:59 +0000 (23:20 +0200)]
Don't use raw divisions by zero in `test-conversion.c'.

* test-suite/standalone/test-conversion.c (ieee_init): New function.
  (guile_Inf, guile_NaN): New variables.
  (test_from_double, test_to_double): Use them.  Divisions by zero made
  `cc' on Tru64 5.1b ("Compaq C V6.5-011") bail out and led to a
  floating point exception when compiled with GCC on the same platform.
  (main): Call `ieee_init ()'.

15 years agoUse <machine/fpu.h> instead of <fenv.h> when needed (e.g., Tru64 5.1b).
Ludovic Courtès [Thu, 23 Apr 2009 20:51:27 +0000 (22:51 +0200)]
Use <machine/fpu.h> instead of <fenv.h> when needed (e.g., Tru64 5.1b).

* configure.in: Look for <machine/fpu.h>.

* test-suite/standalone/test-round.c: Use <machine/fpu.h> if available.

15 years agoWork around lack of cuserid(3) declaration on Tru64 5.1b.
Ludovic Courtès [Thu, 23 Apr 2009 20:24:32 +0000 (22:24 +0200)]
Work around lack of cuserid(3) declaration on Tru64 5.1b.

* configure.in: Check for a cuserid(3) declaration.

* libguile/posix.c [HAVE_CUSERID][!HAVE_DECL_CUSERID]: Provide a
  declaration.

15 years agoWork around the lack of hstrerror(3) declaration on Tru64.
Ludovic Courtès [Wed, 22 Apr 2009 22:28:32 +0000 (00:28 +0200)]
Work around the lack of hstrerror(3) declaration on Tru64.

* configure.in: Look for the declaration of hstrerror(3).

* libguile/net_db.c: Add hstrerror(3) declaration if
  `HAVE_DECL_HSTRERROR' is undefined.

15 years agoRemove extraneous semicolons from `test-conversion.c'.
Ludovic Courtès [Wed, 22 Apr 2009 21:53:52 +0000 (23:53 +0200)]
Remove extraneous semicolons from `test-conversion.c'.

* test-suite/standalone/test-conversion.c: Remove extraneous semicolon
  following `DEF[SU]TST' invocations since that made Compaq C
  V6.5-011 (`cc' on Tru64 5.1b) bail out.

15 years agoFix compilation of `numbers.c' on Tru64.
Ludovic Courtès [Tue, 21 Apr 2009 20:37:45 +0000 (22:37 +0200)]
Fix compilation of `numbers.c' on Tru64.

* libguile/numbers.c (scm_c_make_polar): Don't use sincos(3) on non-GNU
  platforms.  Reported by Didier Godefroy <ldg@ulysium.net>.

15 years agoFix compilation of `gcc_os_dep.c' on Tru64.
Ludovic Courtès [Tue, 21 Apr 2009 20:34:54 +0000 (22:34 +0200)]
Fix compilation of `gcc_os_dep.c' on Tru64.

* libguile/gc_os_dep.c [OSF1](_end): Specify the type.
  (scm_get_stack_base): Suitably cast RESULT.  Reported by Didier
  Godefroy <ldg@ulysium.net>.

15 years agoUpdate `NEWS' and `THANKS'.
Ludovic Courtès [Tue, 21 Apr 2009 20:27:38 +0000 (22:27 +0200)]
Update `NEWS' and `THANKS'.

15 years agoAvoid "no duplicate" popen tests leaving zombie processes
Neil Jerram [Sun, 7 Sep 2008 15:29:05 +0000 (16:29 +0100)]
Avoid "no duplicate" popen tests leaving zombie processes

On the one hand we want the child process in these tests to exit.  On
the other, we don't want it to exit before the parent Guile code has
tested the relevant condition (EOF in the first test, broken pipe in
the second) - because these conditions would obviously be true if the
child had already exited, and that's not what we're trying to test
here.  We're trying to test getting EOF and broken pipe while the
child process is still alive.

* test-suite/tests/popen.test (open-input-pipe:no duplicate): Add
  another pipe from parent to child, so that the child can finish by
  reading from this.  Then the parent controls the child lifetime by
  writing to this pipe.

* test-suite/tests/popen.test (open-output-pipe:no duplicate): Add
  another pipe from child to parent, and have the child finish by
  endlessly writing into this.  Then the parent controls the child
  lifetime by closing its end of the pipe, causing a broken pipe in
  the child.

15 years agoFix `explicitely' typos, should be `explicitly'
Neil Jerram [Wed, 20 May 2009 17:50:52 +0000 (18:50 +0100)]
Fix `explicitely' typos, should be `explicitly'

15 years agomerge ice-9, srfi, oop makfiles into module makefile
Andy Wingo [Fri, 24 Apr 2009 17:16:06 +0000 (19:16 +0200)]
merge ice-9, srfi, oop makfiles into module makefile

* configure.in: No longer output the Makefile.ins.

* module/Makefile.am: Include the contents of ice-9/, srfi/, and oop/.

* module/ice-9/Makefile.am:
* module/ice-9/debugger/Makefile.am:
* module/ice-9/debugging/Makefile.am:
* module/oop/Makefile.am:
* module/oop/goops/Makefile.am:
* module/srfi/Makefile.am: Removed.

15 years agoI ain't broke, but brother I'm badly bent
Andy Wingo [Thu, 23 Apr 2009 09:25:22 +0000 (11:25 +0200)]
I ain't broke, but brother I'm badly bent

* module/ice-9/expand-support.scm (strip-expansion-structures): If, when
  producing @/@@ forms, we find that an @@ variable is not bound in its
  module, just serialize the symbol. This bends hygiene, in that it can
  introduce a global (but not lexical) reference in the expanded module,
  but it seems necessary to not produce (@@ (foo) else) in forms like
  ((@@ (foo) cond) ((test then) ((@@ (foo) else) bar))).

15 years agofix erroneous #:use-syntax clausen
Andy Wingo [Wed, 22 Apr 2009 20:27:50 +0000 (22:27 +0200)]
fix erroneous #:use-syntax clausen

* module/system/repl/command.scm:
* module/system/repl/common.scm:
* module/system/repl/repl.scm:
* module/system/vm/debug.scm:
* module/system/vm/trace.scm: Change #:use-syntax to #:use-module, as
  that's really what we want to do.

15 years agomove pk, peek, and warn to the beginning of boot-9
Andy Wingo [Wed, 22 Apr 2009 20:23:43 +0000 (22:23 +0200)]
move pk, peek, and warn to the beginning of boot-9

* module/ice-9/boot-9.scm (peek, pk, warn): Move these helpers up to the
  top. I like them!
  (load-compiled): Don't define within an if, syncase doesn't like that.

15 years agomodule-name before syncase is booted
Andy Wingo [Tue, 21 Apr 2009 22:17:22 +0000 (00:17 +0200)]
module-name before syncase is booted

* module/ice-9/boot-9.scm (module-name): Give psyntax a module-name
  definition, even before psyntax is booted (in a future commit).

15 years agofix begin-deprecated
Andy Wingo [Mon, 9 Mar 2009 21:01:27 +0000 (22:01 +0100)]
fix begin-deprecated

* module/ice-9/boot-9.scm (begin-deprecated): Fix to output source code,
  doh.

15 years agotweaks to boot-9
Andy Wingo [Mon, 9 Mar 2009 20:40:30 +0000 (21:40 +0100)]
tweaks to boot-9

* module/ice-9/boot-9.scm: Move the r4rs init up to the top.
  (try-module-autoload): Don't use with-fluids before it's defined.

15 years agoallow eval to be called before modules are booted
Andy Wingo [Mon, 9 Mar 2009 20:09:22 +0000 (21:09 +0100)]
allow eval to be called before modules are booted

* libguile/eval.c (scm_eval): If the module system isn't booted, assert
  not on the module argument.

15 years agocommit some tweaks to expand.scm, likely obviated by syncase though
Andy Wingo [Mon, 9 Mar 2009 19:52:45 +0000 (20:52 +0100)]
commit some tweaks to expand.scm, likely obviated by syncase though

* module/language/scheme/expand.scm (re-annotate, expand): A couple of
  speculative cases for dealing with syncase better -- but all of this
  code is likely to go.

15 years agoscm_[current_]module_transformer returns the %pre-modules-transformer, if set
Andy Wingo [Mon, 9 Mar 2009 19:49:54 +0000 (20:49 +0100)]
scm_[current_]module_transformer returns the %pre-modules-transformer, if set

* libguile/modules.c (scm_module_transformer)
  (scm_current_module_transformer): So, if the module system hasn't yet
  booted, take the current transformer from a variable named
  %pre-modules-transformer from the %pre-modules-obarray. This is a
  prequel to booting syncase early in boot-9.

15 years agomake syncase aware of (set! (@ (foo) bar) baz)
Andy Wingo [Tue, 21 Apr 2009 20:56:51 +0000 (22:56 +0200)]
make syncase aware of (set! (@ (foo) bar) baz)

* module/ice-9/psyntax.scm (set!): Handle (set! (@ (foo ..) bar) val)
  inside syncase. Heh heh heh.

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

15 years agosyncase knows about @ / @@
Andy Wingo [Tue, 21 Apr 2009 20:26:27 +0000 (22:26 +0200)]
syncase knows about @ / @@

* module/ice-9/psyntax.scm (syntax-type): Handle a new type, module-ref.
  Like external-macro, it also has a procedure as a binding.
  (chi-expr): module-ref forms -- that is to say, (@ (foo ...) bar) -- as
  expressions they are global references, but with respect to a specific
  module.
  (@, @@): Define module-ref syntax handlers.

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

* module/ice-9/syncase.scm: Mark as primitive syntax so we don't clobber
  their definitions.

The reason I'm doing things like this is so as to support (set! (@@ ...)
...) sensibly, which will be the next patch.

15 years agodistcheck fixen
Andy Wingo [Tue, 21 Apr 2009 10:41:19 +0000 (12:41 +0200)]
distcheck fixen

* examples/Makefile.am: Fix the installed guile-config invocation to set
  PKG_CONFIG_PATH.

* meta/Makefile.am (EXTRA_DIST): Dist the bin_SCRIPTS.

* meta/guile-config (pkg-config): Better error messages if pkg-config
  invocation fails.

* meta/uninstalled-env.in (PATH): Now that guile-config and guile-tools
  are not generated, make it the srcdir/meta instead of the builddir.
  (Guile itself will be picked up from libguile.)

15 years agoMerge branch 'syncase'
Andy Wingo [Mon, 20 Apr 2009 20:26:02 +0000 (22:26 +0200)]
Merge branch 'syncase'

15 years agofix guile.m4 for sitedir change
Andy Wingo [Mon, 20 Apr 2009 16:23:11 +0000 (18:23 +0200)]
fix guile.m4 for sitedir change

* meta/guile.m4

15 years agoscripts take rest args
Andy Wingo [Mon, 20 Apr 2009 16:20:01 +0000 (18:20 +0200)]
scripts take rest args

* meta/guile-tools: Instead of fixing scripts I should have been fixing
  the script runner.

* module/scripts/compile.scm:
* module/scripts/snarf-guile-m4-docs.scm: Fix to take rest args.

15 years agosome more build fixes for bugs that I introduced
Andy Wingo [Mon, 20 Apr 2009 15:42:35 +0000 (17:42 +0200)]
some more build fixes for bugs that I introduced

* meta/guile-1.8.pc.in: Include a pkgdatadir, which will map down to
  `guile-config info pkgdatadir', used in existing guile.m4 files.

* meta/guile-config: Fix guile-config info varname. Facepalm.

* meta/guile.m4: Make GUILE_SITE_DIR use the sitedir variable instead.
  Really it should use pkg-config directly, though.

15 years agofix build errors on fresh checkout
Andy Wingo [Mon, 20 Apr 2009 15:23:40 +0000 (17:23 +0200)]
fix build errors on fresh checkout

* meta/guile-tools: We can't use srfi-1, because on a fresh checkout
  the srfi-1 shlib isn't built yet. Bummer.

* meta/uninstalled-env.in: Fix up the DYLD lines for BSDen.

* module/scripts/snart-guile-m4-docs.scm: Fix expected arguments.

15 years agofix m4->texi snarfage after the guile-tools change
Andy Wingo [Mon, 20 Apr 2009 09:42:24 +0000 (11:42 +0200)]
fix m4->texi snarfage after the guile-tools change

* doc/ref/Makefile.am: Fix to work after a make clean with the recent
  guile-tools changes.

15 years agono positions when reading psyntax-pp, validation in @/@@, cleanups
Andy Wingo [Wed, 15 Apr 2009 15:02:33 +0000 (17:02 +0200)]
no positions when reading psyntax-pp, validation in @/@@, cleanups

* module/ice-9/syncase.scm (old-debug): Re-disable position recording
  when reading psyntax-pp.

* libguile/eval.c (scm_m_at, scm_m_atat): More input validation.

* libguile/debug.c (scm_procedure_module): Use scm_env_module. Remove
  extraneous docstring.

15 years agofix hygiene + modules + local macros
Andy Wingo [Tue, 7 Apr 2009 05:48:03 +0000 (22:48 -0700)]
fix hygiene + modules + local macros

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

* module/ice-9/psyntax.scm (syntax-type): Look up the type of the car of
  a form relative to its module, if it is a syntax object. Fixes hygiene
  wrt modules and private macros.

* module/ice-9/syncase.scm (sc-macro): Add a comment.

* module/system/base/pmatch.scm: The big test case: just export pmatch,
  not ppat too.

15 years agofix handling of pre-modules errors in the vm
Andy Wingo [Mon, 9 Mar 2009 19:32:05 +0000 (20:32 +0100)]
fix handling of pre-modules errors in the vm

* libguile/vm-i-system.c (toplevel-ref, toplevel-set): Correct situation
  whereby we would not throw when toplevel vars were unbound, before
  modules had booted.

15 years ago@ and @@ as primitive macros
Andy Wingo [Mon, 9 Mar 2009 20:26:44 +0000 (21:26 +0100)]
@ and @@ as primitive macros

* libguile/eval.h:
* libguile/eval.c (error_unbound_variable, error_defined_variable):
  Move these prototypes up earlier.
  (scm_m_at, scm_m_atat): New functions, provide the @ and @@
  functionality. Moved here from defmacros because they are
  "special", inasmuch as syncase doesn't really understand them in
  interpreted code.

* module/ice-9/boot-9.scm (@, @@): Don't define as defmacros, as
  defmacros have to actually return source now.

15 years agohygienic compilation
Andy Wingo [Sun, 5 Apr 2009 18:52:22 +0000 (11:52 -0700)]
hygienic compilation

* module/language/scheme/compile-ghil.scm (lookup-transformer): Recognize
  macros as initial (@ ...) or (@@ ...) forms, enabling hygienic
  compilation.

15 years agohouston, we have hygiene
Andy Wingo [Tue, 31 Mar 2009 07:00:04 +0000 (00:00 -0700)]
houston, we have hygiene

* module/ice-9/expand-support.scm (strip-expansion-structures): Enable
  @/@@ substitution.

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

* module/ice-9/psyntax.scm: Since syntax objects are quotable, make the
  module field the module name, not the module itself. Scope the operand
  of global calls appropriately. Thread modules through syntax-dispatch
  destructuring. Houston, we have hygiene.

* module/ice-9/syncase.scm: Adapt to module / module-name changes.

15 years agomore work on modules and hygiene, not finished yet, alas.
Andy Wingo [Tue, 31 Mar 2009 05:06:35 +0000 (22:06 -0700)]
more work on modules and hygiene, not finished yet, alas.

* module/ice-9/compile-psyntax.scm: No more expansion-eval-closure.

* module/ice-9/expand-support.scm (strip-expansion-structures): Only @@
  names whose module is not the current module. Actually @@ serialization
  is disabled for this commit, just to get this one in and keep things
  working.

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

* module/ice-9/psyntax.scm (put-global-definition-hook)
  (get-global-definition-hook): Instead of going through that stupid
  getprop/putprop interface, let's just inline Guile-specific code here.
  (build-global-reference, build-global-assignment): Fix a bug where the
  module and public? were switched, which happily allowed things to
  compile. (We reintroduce a similar bug above in expand-support.)
  (lookup): Add a module argument.
  (global-extend): Adapt for put-global-definition-hook invocation.
  (syntax-type): Lookup with mod. Return mod even for lexicals and
  define-form -- why not.
  (chi-top, fluid-let-syntax, syntax, set!): Lookup with mod. Wrap with
  mod.

* module/ice-9/syncase.scm (expansion-eval-closure)
  (current-eval-closure, env->eval-closure): OK! So the idea is: module
  hygiene is syncase's business, not ours. So lose the eval-closure
  fluid. Also, eval closures are so 1990s.
  (sc-macro): But, we have to take the module from the env, sadly. In the
  future this will be different.
  Remove the rest of the eval-closure bits. Enable source reporting,
  while we're debugging.

* module/language/scheme/compile-ghil.scm (lookup-transformer): Adapt for
  eval closure fluid changes.

15 years agoeval-closure-module, here hopefully not for long
Andy Wingo [Tue, 31 Mar 2009 04:20:44 +0000 (21:20 -0700)]
eval-closure-module, here hopefully not for long

* libguile/modules.h:
* libguile/modules.c (scm_eval_closure_module): Define a
  new-yet-deprecated accessor, to ease a transition.

15 years agothread the module through syntax-case's expansion
Andy Wingo [Mon, 30 Mar 2009 00:15:25 +0000 (17:15 -0700)]
thread the module through syntax-case's expansion

* libguile/debug.h:
* libguile/debug.c (scm_procedure_module): New procedure, returns the
  module that was current when the given procedure was defined. Used by
  syncase to scope free identifiers.

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

* module/ice-9/psyntax.scm: Thread the module through the syntax
  expansion. This is harder than it would appear because in many places
  the different components of syntax objects are destructured.

* module/ice-9/syncase.scm (guile-macro): Adapt to new signature for
  syntax transformer functions.

15 years agofinish bootstrap to syntax-objects with modules
Andy Wingo [Sun, 29 Mar 2009 18:41:02 +0000 (11:41 -0700)]
finish bootstrap to syntax-objects with modules

* module/ice-9/psyntax.scm: Now that we have gone through the
  intermediate step (in which both representations of syntax-object had
  to coexist), change all callers to make-syntax-object to pass the third
  argument, and restore the define-structure definition of syntax
  objects.

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

15 years agoadd modules to syntax objects (part 1, intermediate step)
Andy Wingo [Sun, 29 Mar 2009 18:35:55 +0000 (11:35 -0700)]
add modules to syntax objects (part 1, intermediate step)

* module/ice-9/psyntax.scm (make-syntax-object): As an intermediate step
  to adding modules to syntax objects, replace the definition of
  syntax-object as a structure with an expanded-out definition that has
  (1) a constructor that takes 2 or 3 arguments, and (2) a predicate that
  works with vectors of length 3 or 4. I couldn't just redefine
  make-syntax-object, for example, because these are internal
  definitions, and we can't have duplicate bindings in a letrec.

15 years agoserialize module information into syncase's output -- getting ready for hygiene
Andy Wingo [Sun, 29 Mar 2009 17:41:27 +0000 (10:41 -0700)]
serialize module information into syncase's output -- getting ready for hygiene

* module/ice-9/Makefile.am: Replace annotate.scm with expand-support.scm.

* module/ice-9/annotate.scm: Removed; subsumed into expand-support.scm.

* module/ice-9/compile-psyntax.scm: Strip out expansion structures before
  writing to disk.

* module/ice-9/expand-support.scm: New file. Provides annotation support,
  and other compound data types for use by the expander. Currently the
  only one that is used is the toplevel reference, <module-ref>, but we
  will record lexicals this way soon.

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

* module/ice-9/psyntax.scm (build-global-reference)
  (build-global-assignment): Instead of expanding out global references
  as symbols, expand them as <module-ref> structures, with space to
  record the module that they should be scoped against. This is in
  anticipation of us actually threading the module info through the
  syntax transformation, so that we can get hygiene with respect to
  modules.

* module/ice-9/syncase.scm: Replace eval-when. Since sc-expand will give
  us something that isn't Scheme because we put the <module-ref>
  structures in it, strip that info whenever we actually do need scheme.

* module/language/scheme/compile-ghil.scm (lookup-transformer): Strip
  expansion structures here too.

* module/language/scheme/expand.scm (language): Swap annotate for
  expand-support. But this file will die soon, I think.

15 years agofix a tricky GC bug in scm_c_make_subr
Andy Wingo [Fri, 17 Apr 2009 13:18:46 +0000 (15:18 +0200)]
fix a tricky GC bug in scm_c_make_subr

* libguile/procs.c (scm_c_make_subr): Fix a really tricky bug!!! If
  scm_double_cell caused GC, the symbolic name wouldn't be marked. But
  the symptom wouldn't appear until you accessed that symbol much later,
  for example during tab completion / apropos grovelling. Not sure why we
  didn't see this earlier.

15 years agoguile-tools is a scheme script that loads scheme modules
Andy Wingo [Fri, 17 Apr 2009 09:19:42 +0000 (11:19 +0200)]
guile-tools is a scheme script that loads scheme modules

* meta/guile-tools: Changed to be a scheme script. Instead of looking for
  executables in a "scripts dir", we just look for modules in (scripts),
  and load the modules directly.

* module/Makefile.am:
* module/scripts/: Move the scripts into module/ so they can be compiled.
  Rename scripts from `foo' to `foo.scm'.

* libguile/Makefile.am: Invoke the snarf->texi code via guile-tools.

* configure.in:
* .gitignore: Update for changes.

15 years agofix a couple gc-related continuations bugs
Andy Wingo [Fri, 17 Apr 2009 07:27:32 +0000 (09:27 +0200)]
fix a couple gc-related continuations bugs

Thanks to Juhani Rantanen for the report.

* libguile/continuations.c (scm_make_continuation): Delay making the smob
  until the data is fully initialized. Fixes a bug whereby a GC in
  scm_vm_capture_continuations would catch the us with an undefined
  continuation->vm_conts, leading to marking badness.

* libguile/vm.c (vm_cont_free): Report the correct size to scm_gc_free.

15 years agosupport expression-by-expression compilation
Andy Wingo [Thu, 16 Apr 2009 15:49:59 +0000 (17:49 +0200)]
support expression-by-expression compilation

* module/language/ghil.scm (unparse-ghil): Fix unparsing of quasiquoted
  expressions.

* module/language/ghil/spec.scm (join): Define a joiner for GHIL.

* module/language/scheme/compile-ghil.scm (cenv-ghil-env): Expand the
  definition of a CENV so it can have an actual ghil-env, if available.
  (compile-ghil): Return the actual ghil env in the cenv.

* module/system/base/compile.scm (compile-file): Rewrite. `output-file'
  is now a keyword argument, along with the new kwargs `env' and `from'.
  We now allow exceptions to propagate up, and instead of printing the
  output file to the console, we return a string corresponding to its
  location.
  (compile-and-load): Use read-and-compile.
  (compile-fold): Thread around the cenv as well. Return all three
  values.
  (find-language-joint, read-and-compile): New exciting helpers. The idea
  is that compiling a file should be semantically equivalent to compiling
  each expression in it, one by one. Compilation can have side effects,
  e.g. affecting the current language or the current reader. So what we
  do is find a point in the compilation path at which different
  expressions of a given language can be joined into one. Expressions
  from the source language are compiled to the joint language, then
  joined and compiled to the target.
  (compile): Just return the first value from compile-fold.

* module/system/base/language.scm (language-joiner): New optional field.

* scripts/compile: Rework for changes to compile-file.

15 years agocompilation passes return third value: the continuation environment
Andy Wingo [Thu, 16 Apr 2009 13:20:40 +0000 (15:20 +0200)]
compilation passes return third value: the continuation environment

* module/system/base/compile.scm: Expect compile passes to produce three
  values, not two. The third is the "continuation environment", the
  environment that can be used to compile a subsequent expression from
  the same source language. For example, expansion-time side effects can
  set the current module, which would be reflected appropriately in the
  continuation environment.

* module/language/assembly/compile-bytecode.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/compile-ghil.scm:
* module/language/ghil/compile-glil.scm:
* module/language/glil/spec.scm:
* module/language/objcode/spec.scm:
* module/language/scheme/compile-ghil.scm:
* module/system/base/compile.scm: Update compile passes to return a
  continuation environment.

15 years agoguile-config rebased on top of pkg-config
Andy Wingo [Mon, 6 Apr 2009 18:07:22 +0000 (11:07 -0700)]
guile-config rebased on top of pkg-config

* configure.in:
* meta/Makefile.am (EXTRA_DIST): Remove guile-config.in bits.

* meta/guile-config: Reimplement to work on top of pkg-config. This lets
  guile-config not be substed by configure.

* meta/uninstalled-env.in: Remove the path to guile-config, belatedly.
  Set the pkg-config path correctly.

15 years agoAvoid uses of deprecated forms in the VM code.
Ludovic Courtès [Sun, 5 Apr 2009 18:15:11 +0000 (20:15 +0200)]
Avoid uses of deprecated forms in the VM code.

Reported by Daniel Kraft <d@domob.eu>.

* libguile/frames.c, libguile/vm.c: Include <stdlib.h>, use `size_t'
  instead of `scm_sizet'.

* libguile/objcodes.c, libguile/programs.c, libguile/vm-engine.c,
  libguile/vm-i-loader.c, libguile/vm-i-system.c: Use `scm_list_X ()'
  instead of the deprecated `SCM_LISTX ()'.

15 years agoMake `--disable-deprecated' work.
daniel [Fri, 13 Feb 2009 13:27:41 +0000 (14:27 +0100)]
Make `--disable-deprecated' work.

* configure.in (enable_deprecated): Set SCM_WARN_DEPRECATED_DEFAULT
  even when --disable-deprecated is passed.
* libguile/deprecation.h: Declare deprecation-issuing methods even
  if SCM_ENABLE_DEPRECATED is not set.
* libguile/deprecation.c: Ditto.
  (scm_init_deprecation): Include full body even for unset
  SCM_ENABLE_DEPRECATED.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
15 years agoImproved handling of callers cache in (system xref).
Jose A. Ortega Ruiz [Sat, 4 Apr 2009 09:59:57 +0000 (11:59 +0200)]
Improved handling of callers cache in (system xref).

  * We cache callees in each module, and keep a list of modified
    ('tainted') modules, which is used to reconstruct the callers
    database incrementally.
  * `procedure-callers' now returns an a-list, keyed by module name.

15 years agofix nondeterminism in vm-i-system.c
Andy Wingo [Sat, 4 Apr 2009 18:36:18 +0000 (11:36 -0700)]
fix nondeterminism in vm-i-system.c

* libguile/vm-i-system.c (br-if-eq, br-if-not-eq): Fix some
  nondeterminism caught by GCC 4.4.

15 years agono hard-coded stack limitations if the user has getrlimit
Andy Wingo [Fri, 3 Apr 2009 17:38:30 +0000 (10:38 -0700)]
no hard-coded stack limitations if the user has getrlimit

* libguile/debug.c (init_stack_limit): Instead of "1 MB or 80% of rlimit,
  whichever is lower", just use 80% of the rlimit, if set.

15 years agoadd test case for load-extension bug, fix gdb-uninstalled-guile
Andy Wingo [Tue, 31 Mar 2009 03:28:30 +0000 (20:28 -0700)]
add test case for load-extension bug, fix gdb-uninstalled-guile

* test-suite/standalone/test-extensions:
* test-suite/standalone/test-extensions-lib.c:
* test-suite/standalone/Makefile.am: Add a test case for the
  load-extension bug.

* meta/gdb-uninstalled-guile.in: Fix the path to include meta/.

15 years agoMerge branch 'wingo'
Andy Wingo [Sun, 29 Mar 2009 05:31:20 +0000 (22:31 -0700)]
Merge branch 'wingo'

15 years agofix duplicates in procedure-callers
Andy Wingo [Sun, 29 Mar 2009 05:21:00 +0000 (22:21 -0700)]
fix duplicates in procedure-callers

* module/system/xref.scm (ensure-callers-db): OK! Since we can see the
  same variable twice, e.g. in different modules, keep a unified hash of
  seen vars and modules. Prevents duplicates in procedure-callers.

15 years agofix spurious duplicates in procedure-callees and callers
Andy Wingo [Sun, 29 Mar 2009 04:57:26 +0000 (21:57 -0700)]
fix spurious duplicates in procedure-callees and callers

* module/system/xref.scm (program-callee-rev-vars): It's possible to get
  duplicates when combining callees of inner procedures, so ignore dups.
  Quadratic, boo.

15 years agobugfix: don't dynamic link if we found a registered extension
Andy Wingo [Sat, 28 Mar 2009 01:47:13 +0000 (18:47 -0700)]
bugfix: don't dynamic link if we found a registered extension

* libguile/extensions.c (load_extension): Don't do dynamic linking if we
  actually did find an extension in the list.

15 years agoframe, program, objcode, etc inits use load-extension
Andy Wingo [Sat, 28 Mar 2009 01:40:15 +0000 (18:40 -0700)]
frame, program, objcode, etc inits use load-extension

* libguile/extensions.h: Define a scm_t_extension_init_func.

* libguile/frames.c:
* libguile/instructions.c:
* libguile/objcodes.c:
* libguile/programs.c:
* libguile/vm.c: Register extension init funcs. Should play nicer with a
  static Guile, in addition to working on Darwin with non-default
  installation prefixes without munging DYLD_LIBRARY_PATH.

* module/system/vm/frame.scm:
* module/system/vm/instruction.scm:
* module/system/vm/objcode.scm:
* module/system/vm/program.scm:
* module/system/vm/vm.scm: Use load-extension.

15 years agofix distcheck hopefully, by cleaning the vm-i-*.i files
Andy Wingo [Fri, 27 Mar 2009 23:21:20 +0000 (16:21 -0700)]
fix distcheck hopefully, by cleaning the vm-i-*.i files

* libguile/Makefile.am (CLEANFILES): Clean vm-i-*.i.

15 years agofix "linking" of guile-config
Andy Wingo [Fri, 27 Mar 2009 23:11:43 +0000 (16:11 -0700)]
fix "linking" of guile-config

* meta/guile-config.in: Adjust "linking"; @bindir@ doesn't get fully
  expanded. So instead use a shell trampoline.

15 years agofix check for guile-tools running uninstalled
Andy Wingo [Fri, 27 Mar 2009 23:01:12 +0000 (16:01 -0700)]
fix check for guile-tools running uninstalled

* meta/guile-tools.in (mydir): Fix check for running uninstalled.

15 years agorely on getrlimit to DTRT, don't make stack calibration file
Andy Wingo [Fri, 27 Mar 2009 22:51:16 +0000 (15:51 -0700)]
rely on getrlimit to DTRT, don't make stack calibration file

* libguile/measure-hwm.scm: Remove.

* .gitignore: Update for removal.

* test-suite/standalone/test-fast-slot-ref.in:
* test-suite/standalone/test-use-srfi.in:
* am/guilec:
* check-guile.in: Revert back to normal guile invocation.

* libguile/Makefile.am: Don't make a stack calibration file, as the
  getrlimit-based limit setting should work fine.

15 years agogetrlimit-based stack limits
Andy Wingo [Fri, 27 Mar 2009 22:44:17 +0000 (15:44 -0700)]
getrlimit-based stack limits

* libguile/debug.c (init_stack_limit): Initialize the stack limit based
  on operating system limits (via getrlimit(2)), or 1 MB -- whichever is
  smaller.

15 years agoadd getrlimit and setrlimit wrappers
Andy Wingo [Fri, 27 Mar 2009 22:06:41 +0000 (15:06 -0700)]
add getrlimit and setrlimit wrappers

* README: Some rewording.

* configure.in: Check for getrlimit and setrlimit.

* libguile/posix.h:
* libguile/posix.c: Add some getrlimit and setrlimit wrappers. They're
  documented, but I suspect something else has to be done to get them
  into the manual.

15 years agoallow building against uninstalled guile; move some things to meta/
Andy Wingo [Fri, 27 Mar 2009 21:03:03 +0000 (14:03 -0700)]
allow building against uninstalled guile; move some things to meta/

* README: Add more info about building against an uninstalled Guile.

* meta/: New directory. The proximate cause of its creation is that I
  want to be able to build external packages against uninstalled Guile,
  and to do that I need guile-tools in the PATH, but I don't want
  $top_builddir/libtool in the path. But it seems like a good
  reorganization, for things that are /about/ Guile: pkg-config files, m4
  files, guile-config... then we also include uninstalled info: the
  environment, the pre-inst-guile script, etc.

* meta/guile-1.8-uninstalled.pc.in: New pkg-config template. pkg-config
  prefers -uninstalled pkg-config files, if they are in its path.

* meta/Makefile.am:
* meta/ChangeLog-2008:
* meta/gdb-uninstalled-guile.in:
* meta/guile-1.8.pc.in:
* meta/guile-config.in:
* meta/guile.m4:
* meta/guile-tools.in: Moved to meta/.

* meta/guile.in: This is the new name of pre-inst-guile.in.

* meta/uninstalled-env.in: And this, pre-inst-guile-env.in.

* Makefile.am:
* am/guilec:
* am/pre-inst-guile:
* check-guile.in:
* configure.in:
* doc/ref/Makefile.am:
* gc-benchmarks/run-benchmark.scm:
* test-suite/standalone/Makefile.am:
* test-suite/standalone/README:
* testsuite/Makefile.am: Adapt to meta/ change.

15 years agoImprove wording in `libguile/Makefile.am' regarding stack calibration.
Ludovic Courtès [Fri, 27 Mar 2009 08:50:06 +0000 (09:50 +0100)]
Improve wording in `libguile/Makefile.am' regarding stack calibration.

* libguile/Makefile.am (stack-limit-calibration.scm): Improve wording of
  the comment.  Suggested by Neil Jerram.

15 years agoRun the stack calibration script before running the compiler.
Ludovic Courtès [Thu, 26 Mar 2009 18:17:26 +0000 (19:17 +0100)]
Run the stack calibration script before running the compiler.

* am/guilec (.scm.go): Use `pre-inst-guile' and load
  `stack-limit-calibration.scm'.  This is particularly useful when
  building the first `.go' files where the compiler is run using the
  interpreter, which may end up using a lot of stack space.

* libguile/Makefile.am (BUILT_SOURCES): Add
  `stack-limit-calibration.scm'.
  (TESTS, TESTS_ENVIRONMENT): Remove.
  (stack-limit-calibration.scm): Prepend `-' so that any errors during
  the calibration are ignored.

15 years agoRemove multiple definition of `scm_i_marking'.
Ludovic Courtès [Thu, 26 Mar 2009 17:47:28 +0000 (18:47 +0100)]
Remove multiple definition of `scm_i_marking'.

* libguile/private-gc.h (scm_i_marking): Turn definition into a
  declaration.
  (scm_mark_all): Mark as `SCM_INTERNAL'.

* libguile/gc-mark.c (scm_i_marking): New definition.

15 years agoFix `testsuite/Makefile.am' for `distcheck'.
Ludovic Courtès [Tue, 24 Mar 2009 23:23:23 +0000 (00:23 +0100)]
Fix `testsuite/Makefile.am' for `distcheck'.

* testsuite/Makefile.am (check_SCRIPTS): Remove, renamed to `TESTS'.
  (EXTRA_DIST): Add $(TESTS).

15 years agoAggregate `Makefile.am' files under `examples/'.
Ludovic Courtès [Fri, 20 Mar 2009 00:11:16 +0000 (01:11 +0100)]
Aggregate `Makefile.am' files under `examples/'.

* configure.in: Don't produce `examples/*/Makefile'.

* examples/Makefile.am (SUBDIRS): Remove.
  (EXTRA_DIST, AM_CFLAGS, AM_LIBS): New.
  (box/box, box/box.o, box-module/box, box-module/box.o, libbox.la,
  box-dynamic/box.lo, libbox-module.la, box-dynamic-module/box.lo,
  installcheck, CLEANFILES, clean-local): New targets, aggregated from
  `Makefile.am' files formerly in sub-directories.

* examples/check.test: New file, aggregated from `check.test' files in
  sub-directories.

15 years agoInclude <alloca.h> in `gsubr.c'.
Ludovic Courtès [Tue, 24 Mar 2009 22:37:41 +0000 (23:37 +0100)]
Include <alloca.h> in `gsubr.c'.

* libguile/gsubr.c: Include <alloca.h>.  Reported by Carlo Bramini
  <carlo.bramix@libero.it>.

15 years agospeed up goops rehashing
Andy Wingo [Fri, 20 Mar 2009 12:20:28 +0000 (13:20 +0100)]
speed up goops rehashing

* module/oop/goops/dispatch.scm (cache-try-hash!): Speed up goops
  rehashing, in theory. I haven't measured, though.

15 years agofix interpreted methods with empty bodies
Andy Wingo [Fri, 20 Mar 2009 11:52:24 +0000 (12:52 +0100)]
fix interpreted methods with empty bodies

* module/oop/goops.scm (method): If a method has no body, subst in `(if
  #f #f)' instead of `(begin)', to please the memoizer.

15 years agoadd generic method-formals; fixes to method-source
Andy Wingo [Fri, 20 Mar 2009 11:06:10 +0000 (12:06 +0100)]
add generic method-formals; fixes to method-source

* module/oop/goops.scm (method-source): Don't throw an error if this
  method has no source.
  (method-formals): New generic function, the complement of
  method-specializers for introspection.

15 years agofix casts to unsigned long in objcodes.c
Andy Wingo [Thu, 19 Mar 2009 10:46:22 +0000 (11:46 +0100)]
fix casts to unsigned long in objcodes.c

* libguile/objcodes.c (scm_c_make_objcode_slice): Fix casts to unsigned
  long.

15 years agoHave `scm_take_locale_symbol ()' return an interned symbol (fixes bug #25865).
Ludovic Courtès [Wed, 18 Mar 2009 21:28:37 +0000 (22:28 +0100)]
Have `scm_take_locale_symbol ()' return an interned symbol (fixes bug #25865).

* libguile/symbols.c (intern_symbol): New function, with code formerly
  duplicated in `scm_i_c_mem2symbol ()' and `scm_i_mem2symbol ()'.
  (scm_i_c_mem2symbol, scm_i_mem2symbol): Use it.
  (scm_take_locale_symboln): Use `intern_symbol ()'.  This fixes
  bug #25865.

* test-suite/standalone/Makefile.am
  (test_scm_take_locale_symbol_SOURCES,
  test_scm_take_locale_symbol_CFLAGS,
  test_scm_take_locale_symbol_LDADD): New variables.
  (check_PROGRAMS, TESTS): Add `test-scm-take-locale-symbol'.

15 years agorework procedure-callers to stay correct as callees are redefined
Andy Wingo [Wed, 18 Mar 2009 00:49:28 +0000 (01:49 +0100)]
rework procedure-callers to stay correct as callees are redefined

* module/system/xref.scm (procedure-callers): Rework to calculate the
  callers of a *variable*, not of a value. This is because the
  module-observers only get fired when the module changes, not with the
  variables change values. Also accept either a variable, a symbol
  (resolved in the current module), or a modname . symname pair.

15 years agodoubly-weak callers db
Andy Wingo [Tue, 17 Mar 2009 23:46:16 +0000 (00:46 +0100)]
doubly-weak callers db

* module/system/xref.scm (ensure-callers-db): Store the callers db as a
  doubly-weak hash table.

15 years agoimplement procedure-callers
Andy Wingo [Tue, 17 Mar 2009 23:44:26 +0000 (00:44 +0100)]
implement procedure-callers

* module/system/xref.scm: Implement procedure-callers, as the inverse of
  procedure-callees, with a cache invalidated by changes in modules.

* module/ice-9/boot-9.scm (module-use!): Don't poke module observers when
  module-use! is called for an already-used module.

15 years agoadd xref stub for interpreted procedures
Andy Wingo [Tue, 17 Mar 2009 22:16:35 +0000 (23:16 +0100)]
add xref stub for interpreted procedures

* module/system/xref.scm (hacky-procedure-callees): Add a
  procedure-callees implementation for procedures with source, that
  currently does nothing. Not sure what to do, going into the future.

15 years agoadd xref.scm
Andy Wingo [Tue, 17 Mar 2009 22:11:56 +0000 (23:11 +0100)]
add xref.scm

* module/system/xref.scm: New module, will provide callers/callees info.

* module/Makefile.am (SOURCES): Add xref.scm.

15 years agotweaks to the un-integrated test cases
Andy Wingo [Mon, 16 Mar 2009 22:45:07 +0000 (23:45 +0100)]
tweaks to the un-integrated test cases

* testsuite/Makefile.am: Sortof turn these VM tests into more
  automake-like tests. Needs further work.

15 years agonon-srcdir build fixes
Andy Wingo [Mon, 16 Mar 2009 22:39:29 +0000 (23:39 +0100)]
non-srcdir build fixes

* guile-tools.in: Fix the checks to account for non-srcdir builds.

* libguile/frames.c:
* libguile/objcodes.c:
* libguile/programs.c:
* libguile/instructions.c:
* libguile/vm.c: Fix snarf-includes to cope with non-srcdir builds.

* libguile/instructions.h:
* libguile/instructions.c: Fix the stubs inclusion to be non-srcdir
  compatible.

* libguile/vm-expand.h (VM_DEFINE_INSTRUCTION): Fix some things so as not
  to require the instructions.h defintitions, since we have the codes
  already. Not important tho :)

* pre-inst-guile-env.in: Minor tweak that should have no effect.

* test-suite/standalone/Makefile.am (all-local): Remove a chmod +x step,
  the configure.ac rule should do that if necessary.

15 years agotry a new way of checking byte order
Andy Wingo [Mon, 16 Mar 2009 21:41:50 +0000 (22:41 +0100)]
try a new way of checking byte order

15 years agodecompile source info into <glil-source> annotations.
Andy Wingo [Sat, 14 Mar 2009 15:24:34 +0000 (16:24 +0100)]
decompile source info into <glil-source> annotations.

* module/language/glil/decompile-assembly.scm (decompile-load-program):
  Decompile source information into <glil-source> annotations.

15 years agofix bug serializing filenames in source locations
Andy Wingo [Sat, 14 Mar 2009 15:03:34 +0000 (16:03 +0100)]
fix bug serializing filenames in source locations

* module/language/glil/compile-assembly.scm (limn-sources): Fix bug
  whereby filename was serialized as a ("foo") instead of "foo".

15 years agotweaks to asm->glil decompiler, perhaps fix a (program-source p 0) bug
Andy Wingo [Sat, 14 Mar 2009 14:54:19 +0000 (15:54 +0100)]
tweaks to asm->glil decompiler, perhaps fix a (program-source p 0) bug

* module/language/ghil/compile-glil.scm (codegen): Push a program's
  source locations before copying external args to heap -- perhaps fixes
  (program-source p 0) for some programs.

* module/language/glil/decompile-assembly.scm (decompile-load-program):
  Take another arg, the object vector. Emit <glil-bind> and <glil-unbind>
  correctly. Properly unparse properties. Just have to deal with source
  locations now.

15 years agoadd assembly->glil decompiler
Andy Wingo [Sat, 14 Mar 2009 12:59:57 +0000 (13:59 +0100)]
add assembly->glil decompiler

* module/language/glil/decompile-assembly.scm: A first pass at an
  assembly->glil decompiler. Works for a small subset of programs.

* module/Makefile.am (GLIL_LANG_SOURCES):
* module/language/glil/spec.scm (glil): Add the decompiler.

15 years agoupdate disassembler for changes to decompiler
Andy Wingo [Sat, 14 Mar 2009 11:07:04 +0000 (12:07 +0100)]
update disassembler for changes to decompiler

* module/language/assembly/disassemble.scm (disassemble-load-program)
  (code-annotation): And update the disassembler for changes to
  decompiler.

15 years agoparse jumps as labels when decompiling bytecode->assembly
Andy Wingo [Sat, 14 Mar 2009 11:01:56 +0000 (12:01 +0100)]
parse jumps as labels when decompiling bytecode->assembly

* module/language/assembly/decompile-bytecode.scm (decode-load-program):
  Parse out jumps as labels.

15 years agoprocedure-arity on vm-compile apply: verily, unresolved.
Andy Wingo [Fri, 13 Mar 2009 22:55:51 +0000 (23:55 +0100)]
procedure-arity on vm-compile apply: verily, unresolved.

* test-suite/tests/procprop.test ("procedure-arity"): Procedure-property
  'arity on "apply" will fail if "apply" is a program. I suggest that
  procedure-property is actually the wrong interface for this; if we even
  want to preseve the old arity forms, we should have an accessor for
  arity directly that the VM can implement. But in the meantime throw
  this nasty error while we decide.