Andy Wingo [Fri, 15 Jan 2010 21:33:49 +0000 (22:33 +0100)]
fix (class-of #u32())
* libguile/goops.c (scm_class_of, create_standard_classes): Return
<bytevector> or <uvec> for bytevectors, as appropriate.
Andy Wingo [Fri, 15 Jan 2010 21:24:31 +0000 (22:24 +0100)]
add reader option for parsing [] as ().
* libguile/private-options.h:
* libguile/read.c (scm_read_opts, SCM_SQUARE_BRACKETS_P): Add an option
for treating [ and ] as parentheses, on by default. Note that this
makes them delimiters also, so [ and ] cannot appear in a symbol name,
with this read option on.
(scm_read_sexp): If we start with [, we end with ].
(scm_read_expression): Add case for [.
Andy Wingo [Thu, 14 Jan 2010 21:52:07 +0000 (22:52 +0100)]
fix call counting in statprof, enhance repl support
* module/statprof.scm: Use VM modules, instead of using @ hacks.
(statprof): New public export, a functional interface to the profiler.
(profile-signal-handler, count-call, statprof-start, statprof-stop):
Fix call counting with the VM.
(statprof-call-data->stats): Hack around a case in which a call could
be sampled but not counted, if you get my drift.
(procedure=?): Update for current API.
(with-statprof): Use `statprof'.
* module/system/repl/command.scm (profile): Use the `statprof'
procedural interface.
Andy Wingo [Thu, 14 Jan 2010 12:55:50 +0000 (13:55 +0100)]
vm.c uses scm_c_take_bytevector instead of scm_take_u8vector
* libguile/vm.c (really_make_boot_program): Use scm_c_take_bytevector to
avoid loading srfi-4 at boot time.
Andy Wingo [Wed, 13 Jan 2010 23:40:20 +0000 (00:40 +0100)]
1.8 compat in ice-9 syncase
* module/ice-9/syncase.scm: Export datum->syntax-object and
syntax-object->datum as aliases of datum->syntax and syntax->datum.
Thanks to Daniel Llorens del Río for the suggestion.
Andy Wingo [Wed, 13 Jan 2010 23:09:54 +0000 (00:09 +0100)]
vm-trace prints return values
* module/system/vm/trace.scm (vm-trace): Add a #:width argument. Print
return values, as Chez Scheme does.
Andy Wingo [Wed, 13 Jan 2010 22:14:12 +0000 (23:14 +0100)]
RETURN_HOOK communicates the number of returned values
* libguile/vm-engine.h (RUN_HOOK1): Add some machinery whereby a hook
can push an arg on the stack, run the hook, then drop the value.
(RETURN_HOOK): Use it here, so we push the number of returned values.
* libguile/vm-i-system.c (return, return-values): Adapt to RETURN_HOOK
changes.
Andy Wingo [Wed, 13 Jan 2010 21:49:14 +0000 (22:49 +0100)]
vm-trace only traces execution of its thunk
* module/system/vm/trace.scm (vm-trace): Change to just export the one
procedure, vm-trace. This way it's threadsafe and more robust. Also
refactor to not print any of Guile's internal bits. Hopefully Neil
will be happier :)
* module/system/repl/command.scm (option): Adapt to removal of
vm-trace-on! and vm-trace-off!, as those are unlikely to DTRT.
Andy Wingo [Wed, 13 Jan 2010 20:08:54 +0000 (21:08 +0100)]
remove unused var in read.c
* libguile/read.c (scm_read_character): Remove unused var.
Thien-Thi Nguyen [Wed, 13 Jan 2010 08:49:44 +0000 (09:49 +0100)]
Use `mkstemp' instead of `mktemp'.
* test-suite/standalone/test-unwind.c (check_ports):
Use `mkstemp' instead of `mktemp'.
Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Thien-Thi Nguyen [Sat, 9 Jan 2010 09:07:48 +0000 (10:07 +0100)]
Update configure script hints wrt precious env vars.
* README: Don't suggest setting vars before running configure.
Instead, suggest specifying them on the configure command-line.
Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Michael Gran [Wed, 13 Jan 2010 15:26:10 +0000 (07:26 -0800)]
Document R6RS hex escapes
* doc/ref/api-data.texi (Characters, String Syntax): document r6rs hex
escapes
* doc/ref/api-options.texi (Reader Options): document r6rs-hex-escapes
reader option
Michael Gran [Wed, 13 Jan 2010 15:02:07 +0000 (07:02 -0800)]
Disable \u and \U escapes when r6rs-hex-escapes enabled
When the reader option 'r6rs-hex-escapes is enabled, the \uNNNN and
\UNNNNNN string escape sequences should be disabled.
* libguile/read.c (scm_read_string): added checks for SCM_R6RS_ESCAPES_P
Michael Gran [Wed, 13 Jan 2010 05:27:30 +0000 (21:27 -0800)]
Move r6rs-hex-escape tests into reader.test
* test-suite/tests/reader.test (r6rs-hex-escapes): new tests
* test-suite/tests/chars.test (R6RS Hex escapes): remove tests by reverting
to previous version
* test-suite/tests/strings.test (R6RS Hex escapes): remove tests by
reverting to previous version
Michael Gran [Wed, 13 Jan 2010 05:02:41 +0000 (21:02 -0800)]
Reader option for R6RS hex escapes
This adds a reader option 'r6rs-hex-escapes that modifies the
behavior of numeric escapes in characters and strings. When enabled,
variable-length character hex escapes (#\xNNN) are allowed and become
the default output format for numerically-escaped characters. Also,
string hex escapes switch to a semicolon terminated hex escape (\xNNNN;).
* libguile/print.c (PRINT_CHAR_ESCAPE): new macro
(iprin1): use new macro PRINT_CHAR_ESCAPE
* libguile/private-options.h (SCM_R6RS_ESCAPES_P): new #define
* libguile/read.c (scm_read_opts): add new option r6rs-hex-escapes
(SCM_READ_HEX_ESCAPE): modify to take a terminator parameter
(scm_read_string): parse R6RS hex string escapes
(scm_read_character): parse R6RS hex character escapes
* test-suite/tests/chars.test (with-read-options): new procedure
(R6RS hex escapes): new tests
* test-suite/tests/strings.test (with-read-options): new procedure
(R6RS hex escapes): new tests
Andy Wingo [Tue, 12 Jan 2010 21:50:10 +0000 (22:50 +0100)]
fix texinfo reflection for procedures
* module/system/vm/program.scm (program-arguments-alist): Rename from
program-arguments, a name shadowed by features.c
(arglist->arguments-alist, arity->arguments-alist)
(arguments-alist->lambda-list, program-lambda-list, write-program):
Adapt callers.
* module/system/vm/frame.scm (frame-lookup-binding): Return #f if the
binding is not found, not an error.
(frame-binding-set!, frame-binding-ref): Adapt to error appropriately.
(frame-arguments): Dispatch to frame-call-representation.
(frame-call-representation): Refactor a bit.
* module/ice-9/session.scm (procedure-arguments): Adapt to
program-arguments name change.
* module/texinfo/reflection.scm (get-proc-args): Refactor to actually
work with VM procedures.
Andy Wingo [Tue, 12 Jan 2010 19:15:36 +0000 (20:15 +0100)]
allow simple value definitions with define*-public
* module/ice-9/optargs.scm (define*-public): Allow (define*-public ID
VAL).
Andy Wingo [Tue, 12 Jan 2010 19:14:06 +0000 (20:14 +0100)]
hopefully fix shared c32 / c64 uniform arrays
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Add a width parameter,
indicating the number of sizeof(ctype) entries comprised by one
element of the uniform; normally 1, but 2 for c32 and c64.
Andy Wingo [Mon, 11 Jan 2010 23:21:16 +0000 (00:21 +0100)]
make-array bugfix
* libguile/vm-i-scheme.c (make-array): Fix terrible stack corruption
bug.
Andy Wingo [Mon, 11 Jan 2010 23:20:50 +0000 (00:20 +0100)]
inspector integration in debugger
* module/system/vm/debug.scm: Integrate with the inspector. Add a
"procedure" command.
Andy Wingo [Mon, 11 Jan 2010 23:20:10 +0000 (00:20 +0100)]
fix srfi-4 shared vector access from c
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix
elements/writable_elements for shared vectors. Thanks to Daniel
Llorens del Río for the info.
Andy Wingo [Mon, 11 Jan 2010 23:19:18 +0000 (00:19 +0100)]
programs print as #<procedure ...>
* module/system/vm/program.scm (write-program): Print as #<procedure
...>. Fix stdin printing.
* doc/ref/vm.texi: Update a little bit.
Andy Wingo [Mon, 11 Jan 2010 23:18:24 +0000 (00:18 +0100)]
add a silly inspector
* module/Makefile.am:
* module/system/vm/inspect.scm: Add a very simple and stupid inspector.
Andy Wingo [Mon, 11 Jan 2010 21:29:38 +0000 (22:29 +0100)]
remove section on enclose-array
* doc/ref/api-compound.texi (Array Procedures): Remove section on
`enclose-array', as it doesn't exist any more.
Andy Wingo [Mon, 11 Jan 2010 21:21:18 +0000 (22:21 +0100)]
fix compilation of #2((1 2 3) (4 5 6))
* module/language/glil/compile-assembly.scm (dump-object): Whoops,
really fix for multidimensional arrays.
Andy Wingo [Mon, 11 Jan 2010 21:08:07 +0000 (22:08 +0100)]
allow (define* SYM VAL)
* module/ice-9/psyntax.scm (define*): Allow (define* SYM VAL), as 1.8
did. Thanks to Patrick McCarty for the report.
Andy Wingo [Mon, 11 Jan 2010 20:47:10 +0000 (21:47 +0100)]
allow compilation of #@2(1 2 3)
* libguile/arrays.h:
* libguile/arrays.c (scm_from_contiguous_array): New public function,
like scm_from_contiguous_typed_array but for arrays of generic Scheme
values.
* libguile/vm-i-scheme.c (make-struct): Sync regs before making the
struct, so if we get a GC the regs are on the heap.
(make-array): New instruction, makes an generic (untyped) Scheme
array.
* module/language/glil/compile-assembly.scm (dump-object): Correctly
compile arrays.
Andy Wingo [Mon, 11 Jan 2010 19:45:52 +0000 (20:45 +0100)]
fix erroneous compilation of #@2(1 2 3) as #(1 2 3)
* module/language/glil/compile-assembly.scm (dump-object): Fix the
vector case to only match 0-indexed, vectors, not arrays like #@2(1 2
3).
Ludovic Courtès [Mon, 11 Jan 2010 17:30:13 +0000 (18:30 +0100)]
Evaluate the `export' and `re-export' forms at compile-time.
* module/ice-9/boot-9.scm (export, re-export): Evaluate at compile-time
in addition to load/eval.
* test-suite/tests/tree-il.test ("warnings")["unused-toplevel"]("unused
but define-public"): Remove throw to `unresolved'.
Ludovic Courtès [Mon, 11 Jan 2010 17:28:19 +0000 (18:28 +0100)]
The reference graph in `-Wunused-toplevel' may contain cycles.
* module/language/tree-il/analyze.scm (<reference-graph>,
dag-reachable-nodes, dag-reachable-nodes*, unused-toplevel-analysis):
Replace occurrences of "dag" by "graph".
Michael Gran [Mon, 11 Jan 2010 02:24:23 +0000 (18:24 -0800)]
Refactor repeated code in scm_read_string
* libguile/read.c (SCM_READ_HEX_ESCAPE): new macro
(scm_read_string): use new macro SCM_READ_HEX_ESCAPE
Ludovic Courtès [Sun, 10 Jan 2010 23:25:20 +0000 (00:25 +0100)]
Move `feature?' to `deprecated.scm'.
* module/ice-9/boot-9.scm (feature?): Move to...
* module/ice-9/deprecated.scm (feature?): ... here.
Ludovic Courtès [Sun, 10 Jan 2010 23:23:12 +0000 (00:23 +0100)]
Make `(ice-9 deprecated)' a module of its own.
* module/ice-9/boot-9.scm: Load `deprecated.scm' with
`resolve-interface' instead of `primitive-load-path'.
* module/ice-9/deprecated.scm: Turned into a module, `(ice-9
deprecated)'.
Ludovic Courtès [Sun, 10 Jan 2010 22:58:48 +0000 (23:58 +0100)]
Make `boot-9.scm' more friendly with `-Wunused-toplevel'.
* module/ice-9/boot-9.scm: Switch back to the `(guile)' modules at the
end when compiling.
Ludovic Courtès [Sun, 10 Jan 2010 22:57:01 +0000 (23:57 +0100)]
Fix SRFI-19 exports.
* module/srfi/srfi-19.scm: Export `time-monotonic->julian-day' and
`time-monotonic->modified-julian-day'. Remove obscure `current-time'
hack. Use `(define-module :export ...)' instead of `(export ...)'.
Ludovic Courtès [Sun, 10 Jan 2010 22:52:15 +0000 (23:52 +0100)]
Remove unused top-level variables.
* module/ice-9/runq.scm (fork-strips): Remove.
* module/language/assembly.scm (*block-alignment*): Remove.
* module/language/assembly/disassemble.scm (disassemble-objects,
simplify): Remove.
* module/srfi/srfi-18.scm (mutex-owners): Remove.
* module/srfi/srfi-19.scm (leap-year?): Remove.
* module/system/base/compile.scm (dsu-sort): Remove.
* module/texinfo.scm (ascii->char): Remove.
* module/texinfo/html.scm (ignored?): Remove.
* module/texinfo/indexing.scm (def-name): Remove.
* module/texinfo/plain-text.scm (ignore): Remove.
Ludovic Courtès [Sun, 10 Jan 2010 22:48:43 +0000 (23:48 +0100)]
Have "guile-tools compile" use the current locale.
* meta/guile-tools.in (main): Install the user's locale.
Ludovic Courtès [Sun, 10 Jan 2010 22:47:55 +0000 (23:47 +0100)]
Provide Guile-friendly `coding:' meta-data.
* module/ice-9/i18n.scm, module/rnrs/bytevector.scm,
module/rnrs/io/ports.scm, module/scripts/compile.scm,
module/srfi/srfi-35.scm, module/srfi/srfi-88.scm: Write `coding:'
comment at the top.
Ludovic Courtès [Mon, 11 Jan 2010 00:19:16 +0000 (01:19 +0100)]
Add `-Wunused-toplevel' compiler warning.
* module/language/tree-il/analyze.scm (<reference-dag>): New record
type.
(dag-reachable-nodes, dag-reachable-nodes*, unused-variable-analysis):
New variables.
(unbound-variable-analysis): Slightly simplify the `up' procedure.
* module/language/tree-il/compile-glil.scm (%warning-passes): Add
`unused-toplevel'.
* module/system/base/message.scm (%warning-types): Likewise.
* test-suite/tests/tree-il.test (%opts-w-unused-toplevel): New variable.
("warnings")["unused-toplevel"]: New test prefix.
Michael Gran [Sun, 10 Jan 2010 23:41:55 +0000 (15:41 -0800)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/guile
Michael Gran [Sun, 10 Jan 2010 23:41:37 +0000 (15:41 -0800)]
Add R6RS backspace string escape
R6RS suggests that '\b' should be a string escape for the backspace
character.
* libguile/read.c (scm_read_string): parse backspace escape
* test-suite/tests/strings.test (R6RS backslash escapes): new test
(Guile extensions backslash escapes): remove R6RS escapes from test.
* doc/ref/api-data.texi (Strings): document new string escape
Michael Gran [Sun, 10 Jan 2010 23:39:55 +0000 (15:39 -0800)]
Add R6RS backslash string escape
R6RS suggests that '\b' should be a string escape for the backslash
character.
* libguile/read.c (scm_read_string): parse backspace escape
* test-suite/tests/strings.test (R6RS backslash escapes): new test
(Guile extensions backslash escapes): remove R6RS escapes from test.
* doc/ref/api-data.texi (Strings): document new string escape
Michael Gran [Sun, 10 Jan 2010 23:08:19 +0000 (15:08 -0800)]
Add R6RS character names
R6RS adds new names for some of the control characters.
* libguile/chars.c (scm_r6rs_charnames, scm_r6rs_charnums)
(SCM_N_R6RS_CHARNAMES): new character name constants
(scm_alt_charnames, scm_alt_charnums): modified to remove duplicates
(scm_i_charname, scm_i_charname_to_char): use new constants
* test-suite/tests/chars.test (R5RS character names, R6RS character names):
new tests
* doc/ref/api-data.texi (Characters): updated
Andy Wingo [Sun, 10 Jan 2010 22:24:19 +0000 (23:24 +0100)]
fix properties disassembly
* module/language/assembly/disassemble.scm (disassemble-meta):
Properties start with the fourth element, not the third. (The third is
the set of arities.)
Andy Wingo [Sun, 10 Jan 2010 22:10:24 +0000 (23:10 +0100)]
show args to subr calls in backtraces
* module/system/vm/frame.scm (frame-arguments): For subrs, we don't get
names in the lambda-list, we get #f instead. But still, parse out the
args in that case, assuming they are on the stack in that order.
Andy Wingo [Sun, 10 Jan 2010 12:00:41 +0000 (13:00 +0100)]
update NEWS
* NEWS: Update for 1.9.7, and fold new entries into the main text.
Andy Wingo [Sun, 10 Jan 2010 10:11:47 +0000 (11:11 +0100)]
fold 1.9.6 NEWS into the main text
* NEWS: Incorporate 1.9.6 NEWS items into the main text.
Thien-Thi Nguyen [Sat, 9 Jan 2010 14:12:47 +0000 (15:12 +0100)]
Fix bug: Use correct `FUNC_NAME' for `scm_macro_binding'.
* libguile/macros.c (scm_macro_binding): Use correct FUNC_NAME.
Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Thien-Thi Nguyen [Sat, 9 Jan 2010 14:06:20 +0000 (15:06 +0100)]
Add cast in `make_vm' to silence compiler warning.
* libguile/vm.c (make_vm): Add cast for .stack_base assignment.
Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Thien-Thi Nguyen [Sat, 9 Jan 2010 10:01:42 +0000 (11:01 +0100)]
Fix bug: Init auto var to unrandomize `stack_depth' rv.
* libguile/stacks.c (stack_depth): Init `n'.
Signed-off-by: Thien-Thi Nguyen <ttn@gnuvola.org>
Andy Wingo [Sat, 9 Jan 2010 22:11:23 +0000 (23:11 +0100)]
fix SCM_STACK_OVERFLOW_P bug
* libguile/stackchk.h (SCM_STACK_OVERFLOW_P): Fix a potential overflow,
depending on the absolute values of the thread base and the stack
limit. Thanks to Ivan Shcherbakov for the report.
Andy Wingo [Sat, 9 Jan 2010 20:53:04 +0000 (21:53 +0100)]
slight tweak to stack narrowing in the debugger
* module/system/vm/debug.scm: Really narrow two frames and not by
function, so it works in the evaluator.
Andy Wingo [Sat, 9 Jan 2010 20:48:16 +0000 (21:48 +0100)]
fix bug in subr-call and smob-call
* libguile/vm-i-system.c (subr-call, smob-call): Unlike the previous
situation, in which a call to a subr or a smob didn't actually build a
frame, we no longer need to explicitly pop the procedure and its
arguments. Indeed the procedure and its arguments must remain on the
stack, for hooks and ticks and such always to see frames with valid
procedures. Two lines out, two bugs less, and faster to boot.
Andy Wingo [Sat, 9 Jan 2010 19:40:36 +0000 (20:40 +0100)]
Narrow one more frame in debug.scm:debug-pre-unwind-handler
* module/system/vm/debug.scm (debug-pre-unwind-handler): Narrow two
frames instead of stack-reffing past one. The second frame is
necessary, now that make-stack itself is on the stack.
Andy Wingo [Sat, 9 Jan 2010 19:31:35 +0000 (20:31 +0100)]
print the error more nicely when we enter the debugger
* module/system/vm/debug.scm (debug-pre-unwind-handler): Nicer printing
of the error.
Andy Wingo [Sat, 9 Jan 2010 19:21:37 +0000 (20:21 +0100)]
make backtraces prettier
* module/system/vm/debug.scm (print-frames): Clean up a bit, reverting
part of the previous change. (The problem was that in the else branch
of the conditional, it didn't consume an arg.)
In the future I would like to preserve the clean look of the
backtraces. It's easier to read that way.
Andy Wingo [Sat, 9 Jan 2010 18:21:09 +0000 (19:21 +0100)]
port-encoding returns #f if port encoding not set
* libguile/ports.c (scm_port_encoding): Instead of returning "NONE" if
we don't know the encoding, return #f. Allows truncated-print to work
if you don't have a locale set.
Andy Wingo [Sat, 9 Jan 2010 15:42:27 +0000 (16:42 +0100)]
allocate free variables inline to closures
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/programs.h (SCM_PROGRAM_FREE_VARIABLES)
(SCM_PROGRAM_FREE_VARIABLE_REF, SCM_PROGRAM_FREE_VARIABLE_SET)
(SCM_PROGRAM_NUM_FREE_VARIABLES):
* libguile/programs.c (scm_make_program, scm_program_num_free_variables)
(scm_program_free_variable_ref, scm_program_free_variable_set_x):
Allocate free variables inline with programs, instead of being in a
vect. Should improve locality, and require fewer local variables in
the VM.
* libguile/vm-engine.c (vm_engine): Remove free_vars and free_vars_count
variables.
* libguile/vm-engine.h (CACHE_PROGRAM): No need to muck with free_vars
and free_vars_count.
(CHECK_FREE_VARIABLE): Update for inline free vars.
* libguile/vm-i-system.c (FREE_VARIABLE_REF): Update for inline free
vars.
(make-closure, fix-closure): Take the closure vals as separate stack
args, and copy or fix them inline into the appropriate closure.
* module/language/objcode/spec.scm (program-free-variables): Define a
local version of this removed function.
* module/language/tree-il/compile-glil.scm (flatten): Adjust to not make
a vector when making closures.
* module/system/vm/program.scm: Export program-num-free-variables,
program-free-variable-ref, program-free-variable-set!, and remove
program-free-variables.
* test-suite/tests/tree-il.test ("lambda"): Update to not make vectors
when making closures.
Andy Wingo [Sat, 9 Jan 2010 13:12:47 +0000 (14:12 +0100)]
smobs are applied with vm trampoline procedures
* libguile/smob.c: Instead of having special evaluator support for
applying smobs, we use the same strategy that gsubr uses, that smob
application should happen via a trampoline VM procedure, which uses a
special opcode (smob-apply). So statically allocate all of the desired
trampoline procedures here.
(scm_i_smob_apply_trampoline): Unfortunately there's no real place to
put the trampoline, so instead use a weak-key hash. It's nasty, but I
think the benefits of speeding up procedure calls in the general case
are worth it.
* libguile/smob.h (scm_smob_descriptor): Remove fields apply_0, apply_1,
apply_2, and apply_3; these were never public. Also remove the
gsubr_type field. Instead cache the trampoline objcode here.
(SCM_SMOB_APPLY_0, SCM_SMOB_APPLY_1, SCM_SMOB_APPLY_2,
SCM_SMOB_APPLY_3): Just go through scm_call_0, etc here.
* libguile/vm-i-system.c (call, tail-call, mv-call): Simplify. All
procedure calls are VM calls now.
(smob-call): New instruction, used in smob trampoline procedures.
* libguile/vm.c (apply_foreign): Remove. Yay!
* libguile/procprop.c (scm_i_procedure_arity): Refactor a bit for the
smob changes.
Andy Wingo [Sat, 9 Jan 2010 12:08:06 +0000 (13:08 +0100)]
re-add SCM_GSUBR_MAX
* libguile/gsubr.h (SCM_GSUBR_MAX): Restore this define, which specifies
the max number of args to a gsubr.
* libguile/smob.c: Remove local SCM_GSUBR_MAX define.
Ludovic Courtès [Fri, 8 Jan 2010 15:12:12 +0000 (16:12 +0100)]
Fix frame printing in the debugger.
* module/system/vm/debug.scm (location-string): New procedure.
(print-frames): Use it. This fixes cases where LINE is #f and makes a
distinction between FILE = stdin and FILE is unknown.
Ludovic Courtès [Fri, 8 Jan 2010 11:02:00 +0000 (12:02 +0100)]
Factorize the location stack handling in warning analyses.
* module/language/tree-il/analyze.scm (analyze-tree)[traverse]: New
argument UPDATE-LOCS. Update users.
[keep-locs, extend-locs, shrink-locs]: New procedures.
(<binding-info>, <toplevel-info>): Remove `locs' field.
(unused-variable-analysis, unbound-variable-analysis): Update
accordingly.
Ludovic Courtès [Fri, 8 Jan 2010 09:57:32 +0000 (10:57 +0100)]
Use `HORIZONTAL ELLIPSIS' when available in `truncated-print'.
* module/ice-9/pretty-print.scm (truncated-print): Set
`%default-port-encoding' to the encoding of PORT. Choose either
U+2026 or "..." depending on PORT's encoding.
* test-suite/tests/print.test ("truncated-print")[tprint]: New ENCODING
argument. Update existing tests accordingly. Add UTF-8 tests.
* doc/ref/misc-modules.texi (Pretty Printing): Mention the possible use
of U+2026.
Andy Wingo [Wed, 6 Jan 2010 21:16:57 +0000 (22:16 +0100)]
remove scm_tc7_gsubr
* libguile/tags.h (scm_tc7_gsubr): Return to the pool of unused tc7s, as
there are no more gsubrs. Yay :)
* libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE):
(SCM_PROGRAM_IS_PRIMITIVE): New flag and accessor.
* libguile/gsubr.c (create_gsubr):
* libguile/snarf.h (SCM_STATIC_PROGRAM): Give subrs a PRIMITIVE flag.
* libguile/smob.h:
* libguile/smob.c (scm_i_smob_arity): New internal procedure. Uses the
old GSUBR type macros, local to the file.
* libguile/procprop.c (scm_i_procedure_arity): Call out to
scm_i_smob_arity, and remove a gsubr case.
* libguile/gc.c (scm_i_tag_name):
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/goops.c (scm_class_of):
* libguile/vm.c (apply_foreign):
* libguile/hash.c (scm_hasher):
* libguile/debug.c (scm_procedure_name):
* libguile/print.c (iprin1): Remove gsubr cases.
* libguile/gsubr.h (SCM_PRIMITIVE_P): Fix to work with the new VM
program regimen.
(SCM_GSUBR_TYPE, SCM_GSUBR_MAKTYPE, SCM_GSUBR_MAX, SCM_GSUBR_REQ)
(SCM_GSUBR_OPT, SCM_GSUBR_REST): Remove these macros, that are no
longer useful.
* libguile/gsubr.c (scm_i_gsubr_apply, scm_i_gsubr_apply_list)
(scm_i_gsubr_apply_array): Remove internal gsubr application
functions.
Andy Wingo [Wed, 6 Jan 2010 20:45:48 +0000 (21:45 +0100)]
fix procedure-name on applicable structs
* libguile/debug.c (scm_procedure_name): Fix for applicable structs.
Andy Wingo [Wed, 6 Jan 2010 19:11:33 +0000 (20:11 +0100)]
subrs are now VM trampoline procedures
* libguile/_scm.h: Add foreign.h and programs.h to the private include
list, as snarfing subrs with static allocation now needs access to
some of their enums and macros.
* libguile/gsubr.c (create_gsubr): Instead of creating a tc7_gsubr
object, create a VM program with the call-subr opcode, so that the
representation of subrs is now gsubrs. CPP and elisp, together at
last.
(scm_subr_objcode_trampoline): New function, used by the SCM_DEFINE
snarf macro.
* libguile/gsubr.h (SCM_SUBR_META_INFO, SCM_SUBR_PROPS)
(SCM_SET_SUBR_GENERIC_LOC, SCM_SUBR_ARITY_TO_TYPE): Remove these
macros. They were never deprecated, but hopefully people aren't using
them.
(SCM_SUBRF, SCM_SUBR_NAME, SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC):
Update to work on the new subr representation.
* libguile/objcodes.h (SCM_F_OBJCODE_IS_STATIC): New flag, indicates
that the "backing store" of the objcode is statically allocated.
* libguile/procprop.c (scm_sym_name): Define here instead of in gsubr.c.
* libguile/snarf.h (SCM_DEFINE): If we are doing static allocation,
statically allocate the foreign object, the object table, and the
program, and use some SCM_SNARF_INITtery to fix things up.
Unfortunately I have not been able to make this immutable. It might be
possible, though.
(SCM_IMMUTABLE_CELL, SCM_STATIC_DOUBLE_CELL, SCM_IMMUTABLE_FOREIGN):
(SCM_STATIC_SUBR_OBJVECT, SCM_STATIC_PROGRAM): New helper macros.
Andy Wingo [Wed, 6 Jan 2010 10:09:56 +0000 (11:09 +0100)]
better scm_subr_p deprecation
* libguile/deprecated.h (scm_subr_p): Dispatch instead to scm_i_subr_p so we get
link-time and run-time warnings.
* libguile/deprecated.c (scm_i_subr_p): Here we call SCM_PRIMITIVE_P.
Andy Wingo [Wed, 6 Jan 2010 10:06:37 +0000 (11:06 +0100)]
provide missing prototypes
* libguile/array-map.c:
* libguile/chars.c:
* libguile/eq.c:
* libguile/strorder.c: Provide declarations missing after the asubrs/rpsubrs ->
gsubr conversion.
Andy Wingo [Tue, 5 Jan 2010 18:49:18 +0000 (19:49 +0100)]
boot the VM very early in init.c
* libguile/init.c (scm_i_init_guile): Now that the VM doesn't depend on
smobs, we can boot it before anything.
Andy Wingo [Tue, 5 Jan 2010 18:45:56 +0000 (19:45 +0100)]
tc7 tags for vm-related data
* libguile/tags.h (scm_tc7_frame, scm_tc7_objcode, scm_tc7_vm)
(scm_tc7_vm_cont): Take more tc7s for VM-related data structures.
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc.c (scm_i_tag_name):
* libguile/goops.c (scm_class_of, create_standard_classes):
* libguile/print.c (iprin1): Add cases for the new tc7s.
* libguile/frames.c:
* libguile/frames.h:
* libguile/objcodes.c:
* libguile/objcodes.h:
* libguile/vm.c:
* libguile/vm.h: Desmobify.
* libguile/vm.c (scm_vm_apply): Export to Scheme, because VM objects are
no longer applicable.
* module/system/repl/command.scm (profile):
* module/system/vm/trace.scm (vm-trace):
* module/system/vm/vm.scm (vm-load): Call vm-apply to run a program in a
VM instead of treating the VM as applicable.
Andy Wingo [Tue, 5 Jan 2010 17:50:17 +0000 (18:50 +0100)]
properly integrate vm bootstrapping into init.c
* libguile/Makefile.am (modinclude_HEADERS):
* libguile/vm-bootstrap.h: Remove vm-bootstrap.h.
* libguile/frames.c: No more vm-bootstrap.h.
* libguile/instructions.c (scm_init_instructions):
* libguile/objcodes.c (scm_init_objcodes):
* libguile/programs.c (scm_init_programs): No need to call
scm_bootstrap_vm, init.c does that for us.
* libguile/vm.c (scm_bootstrap_vm): No need call e.g.
scm_bootstrap_frames, init.c does that. Remove a twice-calling guard,
should be unnecessary. Don't define the load-compiled subr here.
* libguile/load.c (scm_init_load): Define the load-compiled subr here.
* libguile/vm.h: Declare scm_bootstrap_vm here.
* libguile/init.c (scm_i_init_guile): Properly integrate VM
bootstrapping into this file.
Andy Wingo [Tue, 5 Jan 2010 17:36:27 +0000 (18:36 +0100)]
boot bytevectors earlier
* libguile/init.c (scm_i_init_guile): It turns out generalized-vectors
and generalized-arrays don't actually block anyone in the dependency
graph, so punt those back to the end. Bootstrap bytevectors earlier,
though, which don't actually depend on smobs.
Andy Wingo [Thu, 7 Jan 2010 22:40:59 +0000 (23:40 +0100)]
inline srfi-4 vector accessors
* module/language/tree-il/primitives.scm
(*interesting-primitive-names*): Inline srfi-4 vector accessors.
Andy Wingo [Thu, 7 Jan 2010 22:30:02 +0000 (23:30 +0100)]
update uniform vector docs
* doc/ref/api-compound.texi (Uniform Numeric Vectors): Make a subsection
of "Vectors", and link out to SRFI-4, where the main text has been
moved.
* doc/ref/api-data.texi (Bytevectors as Uniform Vectors): New section.
* doc/ref/srfi-modules.texi (SRFI-4): Move body of uniform vector docs
here. Discuss new module separation. Discuss relation to bytevectors.
Andy Wingo [Sun, 19 Jul 2009 13:35:33 +0000 (15:35 +0200)]
reimplement srfi-4 vectors on top of bytevectors
* libguile/srfi-4.h:
* libguile/srfi-4.c (scm_make_srfi_4_vector): New function, exported by
(srfi srfi-4 gnu).
* libguile/srfi-4.i.c: Removed.
* module/srfi/srfi-4.scm:
* module/srfi/srfi-4/gnu.scm: Reimplement srfi-4 vectors on top of
bytevectors. The implementation is mostly in Scheme now.
* test-suite/tests/unif.test: Update to use (srfi srfi-4 gnu).
* libguile/bytevectors.c (bytevector_ref_c32, bytevector_ref_c64)
(bytevector_set_c32, bytevector_set_c64): Fix some embarrassing bugs.
Still need to do an upper bounds check.
* libguile/deprecated.h: Remove deprecated array functions:
scm_i_arrayp, scm_i_array_ndim, scm_i_array_mem, scm_i_array_v,
scm_i_array_base, scm_i_array_dims, and the deprecated macros:
SCM_ARRAYP, SCM_ARRAY_NDIM, SCM_ARRAY_CONTP, SCM_ARRAY_MEM,
SCM_ARRAY_V, SCM_ARRAY_BASE, SCM_ARRAY_DIMS.
* libguile/deprecated.c (scm_uniform_vector_read_x)
(scm_uniform_vector_write, scm_uniform_array_read_x)
(scm_uniform_array_write): Newly deprecated functions.
* libguile/generalized-arrays.c (scm_array_type): Remove the bytevector
hack.
* libguile/objcodes.c (scm_bytecode_to_objcode, scm_objcode_to_bytecode):
Rework to operate on bytevectors, as scm_make_u8vector now causes a
module lookup, which can't be done e.g. when loading the VM boot
program for psyntax-pp.go on a fresh bootstrap.
* libguile/objcodes.h (SCM_F_OBJCODE_IS_BYTEVECTOR):
(SCM_OBJCODE_IS_BYTEVECTOR): s/U8VECTOR/BYTEVECTOR/.
* module/ice-9/boot-9.scm (the-scm-module): A terrible hack to pull in
(srfi srfi-4), as the bindings are primarily there now. We'll worry
about this later.
Andy Wingo [Tue, 5 Jan 2010 16:25:53 +0000 (17:25 +0100)]
Revert "Remove unused internal bytevector functions."
This reverts commit
c4daa519107798d06ae96d2f69dc211fc57cc8a3.
Andy Wingo [Sat, 18 Jul 2009 17:08:43 +0000 (19:08 +0200)]
clean up includes in vectors.[ch]
* libguile/vectors.h:
* libguile/vectors.c: Clean up the includes... mostly.
Andy Wingo [Thu, 7 Jan 2010 15:40:13 +0000 (16:40 +0100)]
fix array->list
* libguile/generalized-arrays.c (array_to_list): Fix buggy
implementation. Thanks to Daniel Llorens del Río for the bug repor.
Ludovic Courtès [Wed, 6 Jan 2010 22:55:13 +0000 (23:55 +0100)]
Enclose hooks tests in their own module.
* test-suite/tests/hooks.test: Enclose in `(test-suite test-hooks)'
module.
Ludovic Courtès [Wed, 6 Jan 2010 22:54:21 +0000 (23:54 +0100)]
Fix 1.8-compatibility of `scm_search_path ()'.
* libguile/load.c (scm_search_path): Handle the 1.8-compatibility case
where REST is `SCM_UNDEFINED'. Reported by Dale P. Smith.
Ludovic Courtès [Thu, 7 Jan 2010 09:41:17 +0000 (10:41 +0100)]
Use Gnulib's `full-write' instead of custom code.
* libguile/fports.c (write_all): Remove.
(fport_write): Use `full_write ()' instead of `write_all ()'.
Ludovic Courtès [Wed, 6 Jan 2010 23:37:10 +0000 (00:37 +0100)]
Use `encoding-error' instead of `misc-error' for string encoding errors.
* libguile/strings.c (scm_encoding_error): New function.
(scm_from_stringn, scm_to_stringn): Use it instead of `scm_misc_error ()'.
* test-suite/lib.scm (exception:encoding-error): Adjust accordingly.
* test-suite/tests/encoding-escapes.test (exception:conversion):
Remove. Use `exception:encoding-error' instead.
* test-suite/tests/encoding-iso88591.test: Likewise.
* test-suite/tests/encoding-iso88597.test: Likewise.
* test-suite/tests/encoding-utf8.test: Likewise.
Ludovic Courtès [Thu, 7 Jan 2010 10:00:37 +0000 (11:00 +0100)]
Have string ports honor `%default-port-encoding'.
* libguile/strports.c (scm_i_mkstrport): Remove.
(scm_mkstrport): Don't change the port's encoding to UTF-8; convert
STR to the default port encoding.
(scm_strport_to_string): Fix documentation & indentation.
* libguile/strports.h (scm_i_mkstrport): Remove.
* test-suite/lib.scm (exception:encoding-error): New variable.
(format-test-name): Set `%default-port-encoding' to "UTF-8".
* test-suite/tests/ports.test ("string ports")["%default-port-encoding
is honored", "suitable encoding [latin-1]", "suitable encoding
[latin-3]", "wrong encoding"]: New tests.
* test-suite/tests/r6rs-ports.test ("7.2.11 Binary
Output")["put-bytevector with UTF-16 string port", "put-bytevector
with wrong-encoding string port"]: New tests.
* test-suite/tests/reader.test (read-string): Set
`%default-port-encoding' to `#f'.
("reading")["unprintable symbol"]: Use a string that doesn't contain
zeros.
* doc/ref/api-io.texi (String Ports): Document encoding issues with
`call-with-output-string' and `with-output-to-string'.
Ludovic Courtès [Wed, 6 Jan 2010 22:52:40 +0000 (23:52 +0100)]
Add in-source documentation of `scm_to_stringn ()'.
* libguile/strings.c (scm_to_stringn): Add documentation comment.
Andy Wingo [Thu, 7 Jan 2010 09:40:38 +0000 (10:40 +0100)]
fix compiler warnings in foreign.c
* libguile/foreign.c (scm_c_from_foreign, scm_c_take_foreign): Fix
compiler warnings on 64-bit machines.
Andy Wingo [Tue, 5 Jan 2010 15:51:58 +0000 (16:51 +0100)]
add subr-call VM op
* libguile/vm-i-system.c (subr_call): Add subr-call VM op.
Andy Wingo [Tue, 5 Jan 2010 15:50:58 +0000 (16:50 +0100)]
add SCM_PROGRAM_IS_PRIMITIVE_GENERIC flag and checker
* libguile/programs.h (SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC)
(SCM_PROGRAM_IS_PRIMITIVE_GENERIC): Add a primitive-generic flag and
accessor, for when we switch primitives to be implemented using VM
trampolines.
Andy Wingo [Tue, 5 Jan 2010 15:50:39 +0000 (16:50 +0100)]
program-meta procedures get their program's objtable
* libguile/programs.c (scm_program_meta): Give the program meta
procedure the same object table as the main procedure. Will allow for
easier hand-crafting of meta programs. Of course when compiling a
metadata procedure from Scheme, one still wants to avoid preallocating
the heap objects needed by the metadata...
Julian Graham [Thu, 7 Jan 2010 04:01:05 +0000 (23:01 -0500)]
Attempt to narrow normalized strings.
* libguile/strings.c (normalize_str): Clean up indentation. Add call to
scm_i_try_narrow_string.
Andy Wingo [Tue, 5 Jan 2010 15:31:12 +0000 (16:31 +0100)]
remove unused snarf macros
* libguile/snarf.h (SCM_DEFINE1, SCM_PRIMITIVE_GENERIC_1, SCM_PROC1)
(SCM_GPROC1): Remove, as these deal in the removed typed subr
constructors.
* libguile/tags.h (scm_tcs_subrs): Remove this. Use scm_tc7_gsubr
instead, though hopefully that will go too, soon.
Andy Wingo [Tue, 5 Jan 2010 15:15:14 +0000 (16:15 +0100)]
move subr implementation details to gsubr.[ch]
* libguile/procs.h: Move subr macros to gsubr.h.
* libguile/procs.c (scm_c_make_subr, scm_c_make_subr_with_generic)
(scm_c_define_subr, scm_c_define_subr_with_generic): Remove these,
because they deal in subr types, and now there is only one subr type.
The body of this code is now in gsubr.c.
* libguile/deprecated.h (scm_subr_p): Remove from procs.[ch] and define
as a deprecated macro. Only used internally, but who knows who's out
there.
* libguile/goops.c (scm_generic_capability_p)
(scm_enable_primitive_generic_x, scm_set_primitive_generic_x)
(scm_primitive_generic_generic): Use the new SCM_PRIMITIVE_GENERIC_P
macro instead of calling scm_subr_p.
* libguile/gsubr.h (SCM_PRIMITIVE_P, SCM_PRIMITIVE_GENERIC_P): New
macros, to replace scm_subr_p and hacky checking for generic
capability.
(SCM_SUBR_META_INFO, SCM_SUBR_NAME, SCM_SUBRF, SCM_SUBR_PROPS)
(SCM_SUBR_GENERIC, SCM_SET_SUBR_GENERIC, SCM_SET_SUBR_GENERIC_LOC)
(SCM_SUBR_ARITY_TO_TYPE): Moved here from procs.h.
* libguile/gsubr.c (create_gsubr): Inline the
scm_c_make_subr definition here, and work for generics too. Removed a
scm_remember_upto_here_1 that was added earlier in the year when
meta_info was not being traced by the GC. Adapt callers.
Andy Wingo [Tue, 5 Jan 2010 14:20:47 +0000 (15:20 +0100)]
clean up macros.[ch]
There are some incompatible changes here, but only to interfaces that
were introduced earlier in 1.9, or interfaces which have been broken
since early in 1.9.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, as the macro
changes affect the interface that is called by psyntax-generated macro
definitions.
* libguile/inline.h (scm_words): New function, allocates a variable
number of contiguous scm_t_bits locations, with a given value in the
0th word, and 0 in the rest of the words.
* libguile/macros.h: Rework interface to correspond more closely, and
minimally, to the needs of memoize.c and psyntax.
(SCM_ASSYNT, SCM_MACRO_TYPE_BITS, SCM_MACRO_TYPE_MASK)
(SCM_F_MACRO_EXTENDED, SCM_MACROP, SCM_MACRO_TYPE)
(SCM_MACRO_IS_EXTENDED, SCM_BUILTIN_MACRO_P, SCM_SYNCASE_MACRO_P)
(SCM_MACRO_CODE, scm_tc16_macro): Remove CPP macros related to the
representation of Scheme macros.
(scm_i_make_primitive_macro): Renamed from scm_i_makbimacro.
(scm_i_macro_primitive): New accessor so that memoize.c can get to the
primitive syntax transformer.
(scm_make_syncase_macro, scm_make_extended_syncase_macro)
(scm_syncase_macro_type, scm_syncase_macro_binding): Removed these
functions, replaced by make-syntax-transformer and its accessors.
(scm_macro_binding): New accessor, the same as what
scm_syncase_macro_binding was.
* libguile/macros.c: All representation details of syntax transformers
are private to this file now.
(macro_print): Print macros as #<syntax-transformer ...>, or
#<primitive-syntax-transformer ...> if psyntax has not attached a
transformer of its own.
(scm_i_make_primitive_macro): Represent macros as 5-word smobs.
(scm_make_syntax_transformer): New constructor for syntax transformers
(macros), exported to scheme. Takes a name, and looks it up in the
current module to determine the previous primitive transformer, if
any.
(scm_macro_type): Instead of returning 'builtin-macro!, etc, return
the type as set by psyntax, or #f if it's a primitive.
(scm_macro_name): Return the stored macro name.
(scm_macro_transformer): Return the psyntax-set syntax transformer.
Hacky, but should help introspection somewhat.
* libguile/memoize.c (memoize_env_ref_transformer): Use the new
scm_i_macro_primitive, and adapt to other macro API changes.
* module/ice-9/psyntax.scm (put-global-definition-hook)
(get-global-definition-hook, chi-install-global): Call (and generate
calls to) the new macro constructors and accessors.
* module/ice-9/psyntax-pp.scm: Doubly regenerated.
* module/ice-9/debugging/traps.scm (trap-here): Comment out this
definition and export, while it's not working.
Andy Wingo [Tue, 5 Jan 2010 10:05:12 +0000 (11:05 +0100)]
remove mmacros, SCM_SYNTAX snarf macro
* libguile/snarf.h (SCM_SYNTAX): Remove snarf macro, users can't define
primitive syntax any more.
* libguile/memoize.c (SCM_SYNTAX): Define locally, and just call
scm_i_makbimacro as there's no difference between that and
scm_makmmacro. Alter invocations to suit.
* libguile/macros.h:
* libguile/macros.c (scm_i_makmmacro): Remove; users can't define
primitive syntax any more. Use define-syntax instead.
(scm_make_synt): Remove, this was only used by the SCM_SYNTAX snarf
macro.
(scm_i_makbimacro): Change prototype of this internal function to make
the gsubr on behalf of the caller.
(macro_print, scm_macro_type): Remove cases for mmacros.
Andy Wingo [Tue, 5 Jan 2010 09:39:40 +0000 (10:39 +0100)]
remove scm_makacro and scm_makmacro
* libguile/macros.h:
* libguile/macros.c (scm_makacro): Remove this function for making
"acros", as it is unused and won't work with the compiler.
(scm_makmacro): Remove this deprecated function for making
non-memoizing macros, as they won't work with the compiler.
(macro_print, scm_macro_type): Remove a couple of cases for macros
that can't be created any more.
Andy Wingo [Tue, 5 Jan 2010 09:17:41 +0000 (10:17 +0100)]
fix include paths in foreign.c
* libguile/foreign.c: Fix include paths.
Andy Wingo [Tue, 5 Jan 2010 09:16:45 +0000 (10:16 +0100)]
remove the deprecatd scm_make_subr_*
* libguile/deprecated.h:
* libguile/deprecated.c (scm_make_subr, scm_make_subr_with_generic)
(scm_make_subr_opt): Remove these functions that were deprecated in
2003, as they explicitly reference subr types.
Andy Wingo [Mon, 4 Jan 2010 11:21:02 +0000 (12:21 +0100)]
dynamic-func returns foreign objects, not bignums
* libguile/dynl.c (scm_dynamic_func, scm_dynamic_call)
(scm_dynamic_args_call): Change the representation of dynamic
functions to be foreign objects. Shouldn't affect any users, as people
should be treating the return value of dynamic-func as an opaque
object.
Andy Wingo [Mon, 4 Jan 2010 11:11:33 +0000 (12:11 +0100)]
add foreign value wrapper
* libguile/foreign.h:
* libguile/foreign.c: New files, implementing simple wrappers around
foreign values, such as those that one might link in dynamically from
a library.
* libguile/tags.h (scm_tc7_foreign): Take a tc7 for foreign values.
* libguile.h:
* libguile/init.c: Add foreign.h to headers and init.
* libguile/print.c (iprin1): Add printer for foreign values.
* libguile/gc.c (scm_i_tag_name): Case for foreign values.
* libguile/goops.c (scm_class_of, create_standard_classes): Add a class
for foreign values.
* libguile/evalext.c (scm_self_evaluating_p): Add case for foreign
values.
* libguile/Makefile.am: Add foreign.[ch] to the build.
Ludovic Courtès [Sun, 3 Jan 2010 18:15:42 +0000 (19:15 +0100)]
Update `.gitignore'.
Ludovic Courtès [Sun, 3 Jan 2010 18:15:05 +0000 (19:15 +0100)]
Add per-directory Emacs local variables.