| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If sizeof is given an extra argument (an expression which
evaluates to an object), it can calculate the dynamic size of
the FFI type in relation to representing that object.
* ffi.c (dyn_size): New static function.
(ffi_init): Register sys:dyn-size intrinsic.
* share/txr/stdlib/ffi.tl (sizeof): Support additional
argument, avoiding run-time compilation of the type expression
with the help of load-time.
* txr.1: Update documentation for sizeof macro.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): If a
top-level form is compiled that is an atom, don't emit the
translation, since it has no effect (beyond interning the
symbol).
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): do not
silently ignore forms that (after macroexpansion) are atoms;
treat them like any other forms. This is mostly useless, but
if unbound variables are used as top-level forms, it is
diagnosed, and keeps the file compilation behavior closer to
interpreted semantics.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/except.tl (catch**): Obtain macro
environment and pass to constantp.
* share/txr/stdlib/place.tl (last, butlast): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the keyword parameter list contains a mixture of constant
and non-constant default value expressions, the order of the
extracted keys is scrambled, so values go to the wrong
variables.
* share/txr/stdlib/keyparams.tl (sys:build-key-list): Renamed
to build-key-list-expr and rewritten to preserve the key
order.
(:key): Follow rename of build-key-list.
|
|
|
|
|
|
| |
* share/txr/stdlib/keyparams.tl (sys:build-key-list): Take
macro environment parameter, and pass to constantp.
(:key): Pass macro environment to sys:build-key-list.
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Move
with-gensyms to outermost scope so we can include nvsym in it,
avoiding the explicit (nvnsm (gensym)) binding.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Users of defset no longer have to ensure that in the store
form, the symbol which gives the new value to be stored is
inserted only once.
* share/txr/stdlib/defset.tl (defset-expander): Transform the
store form by inserting a temporary variable using alet.
(sub-list, sub-vec, sub-str): These place forms no longer
require a local gensym.
* txr.1: Updated doc.
* tests/012/defset.tl: The expected output for the inc case
now incorporates a gensym that comes from the compiled
defset macro. Since we can't control that by means of the
gensym counter, we resort to extracting it from the expansion
itself, then check the test case against a template which
incorporates that gensym. We check that the extracted item
really is a gensym: it's a symbol with no home package whose
name starts with "g".
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:new-expander): The
syntax (lnew (type boa args ...)) is not being handled
at all due a typo in the case. Moreover, the
syntax (lnew type slot0 val0 slot1 val1 ...) is broken
due to a missing unquote on the type gensym in the
output template.
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:dump-to-tlo): This
function has no reason to be named by a usr package symbol.
Renaming to sys:dump-to-tlo.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_instantiate): Add sub-list, sub-vec and
sub-str symbols as autoload triggers for defset.tl.
* share/txr/stdlib/defset.tl (sub-list, sub-vec, sub-str): New
syntactic places defined with defset.
* txr.1: sub-list, sub-vec and sub-str documented as
accessors.
|
|
|
|
|
|
| |
* share/txr/stdlib/ffi.tl (carray-sub, sub-buf):
Unfortunately, defset doesn't arrange for the new value to
be evaluated once; we must do it.
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander):
Reduce (,*params) to ,params, which is parallel with the ,args
that it matches.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): In code that
binds user-supplied variables and contains a user-supplied
form that refers to those variables, we can't use code like
(op list (gensym)) or [mapcar car ...]. These are susceptible
to capture of the symbols list and car.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): In a scope
where we are binding the user-supplied params, we cannot be
binding variables like gpf-pairs that don't have anonymized
names. All these locals must be gensymed, otherwise they are
visible to the store form.
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (ffi_set_entries): Register autoload for sub-buf
symbol.
* share/txr/stdlib/ffi.tl (sub-buf): Syntactic place
defined via defset.
* txr.1: Updated sub-buf documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/ffi.tl (carray-sub): We use defset to
define a carray-sub place that updates via carray-replace,
rather than using a place macro to defer to the
generic sub accessor. This results in a more efficient
implementation. This new accessor doesn't require the carray
argument to be a place; unlike sub, it doesn't have to capture
the return value of carray-replace and store it back into
the carray variable.
* txr.1: Updated doc.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (usr:compile-file): Edit the
hash-bang line to replace the --lisp option with --compiled.
This supports the situation when a TXR Lisp hash bang script
that is unsuffixed is compiled to an unsuffixed compiled
script.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:pl-expand): At each expansion
round, repeatedly expand the form as a place macro until that
can no longer be done and only then try macroexpand-1,
instead of just trying one place macro expansion.
* txr.1: Updated and revised description of expansion under
define-place-macro.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/path-test.tl (path-private-to-me,
path-strictly-private-to-me): These functions were neglecting
to trust the root user, as documented. If the file is owned
by root, we treat it as if it were owned by the caller.
Furthermore, if we have to process the group membership, we
allow the group to contain the superuser's name.
* txr.1: Documentation improved, and the treatment of
groups documented.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:placelet-1): Adding
comment explaining why the explicit expansion and temporary
proxy place are necessary, even though in most cases
it can work fine without them.
|
|
|
|
|
| |
* share/txr/stdlib/asm.tl (%oc-list%): Unused global symbol
macro removed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (open-compile-streams): The
input file is now determined in a manner similar to the load
function. If the path is relative and there is a *load-path*
binding, then it is now considered relative to *load-path*.
It is considered suffixed only if ending in .tl or
.txr. If unsuffixed, then it is first tried with the .tl
suffix.
(usr:compile-file): Bind *load-path* to the actual path used
for loading the file, rather than the input path.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (struct_set_entries): Add autoload entries for
new* and lnew* symbols.
* share/txr/stdlib/struct.tl (sys:new-type, sys:new-expander):
New functions.
(new, lnew): Macros now implemented using sys:new-expander.
(new*, lnew*): New macros.
* txr.1: Documented.
|
|
|
|
|
|
| |
* share/txr/stdlib/debugger.tl (print-backtrace): Use the new
window-mapdo instead of window-map, to avoid consing a list
that is throw away.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds special unwind frames for backtracing
expansions. With this, we can get rid of the global variable
last_form_expanded, since to get the last form expanded, we
just search for the most enclosing expand frame.
* eval.c (last_form_expanded): Global variable removed.
(error_trace): Use uw_last_form_expanded() instead of
last_form_expanded.
(expand_eval): No need to save and restore
last_form_expanded any more.
(expand_lisp_setq, expand_setqf, expand_lisp1, do_expand): Use
uw_last_form_expanded().
(expand, do_macroexpand_1): Push and pop expand frame.
This fixes a bug: do_macroexpand_1 was not recording
last_form_expanded. Evaluation of top-level forms uses
explicit macroexpansion, therefore top-level evaluation was
neglecting to set last_form_expanded.
This explains weird behavior I saw in the listener from
time to time, when errors would report against the expansion
of the wrong form.
(eval_init): Remove reference to last_form_expanded variable.
* eval.h (last_form_expanded): Declaration removed.
* share/txr/stdlib/debug.tl (expand-frame print-trace,
expand-frame loc): New methods.
(print-backtrace): Include uw-expand frames in the backtrace.
* unwind.c (expand_frame_type): New static variable.
(uw_find_frames_by_mask): Handle UW_EXPAND.
(uw_last_form_expanded, uw_push_expand): New functions.
(uw_late_init): Register expand-frame struct type.
* unwind.h (enum uw_frtype): New enum member, UW_EXPAND.
(uw_last_form_expanded, uw_push_expand): Declared.
|
|
|
|
|
| |
* share/txr/stdlib/debug.tl (fcall-frame print-trace): Don't
invoke .(loc) method on nx-fr, if it is nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce evaluation tracking frames. The backtrace
function can use these to deduce the line from which
a function is called (if called from interpreted code).
Eventually we will have analogous virtual machine
frames to do this for compiled code.
* eval.c (do_eval): If backtraces are enabled, then push
and pop an eval frame, which holds the two key pieces: the
form and environment.
* share/txr/stdlib/debug.tl ((fcall-frame loc), (fcall-frame
print-trace), (eval-frame loc), (eval-frame print-trace)):
New methods.
(print-backtrace): Loop reduced to just dispatching
frame-specific print-trace methods. It gives the previous and
next frame to each method.
The (fcall-frame print-trace) method prints function frames,
using the previous form to deduce the location from which
the function is called. The (eval-frame print-trace) method
mostly suppresses the printing of eval frames. We print
an eval frame if it is the parent of an internal function
frame, and if it is the topmost frame (to identify the
toplevel form at the root of the backtrace).
* unwind.c (form_s): New symbol variable.
(eval_frame_type): New static variable.
(uw_find_frames_by_mask): Handle UW_EVAL case, producing
eval-frame struct.
(uw_push_eval): New function.
(uw_late_init): Allocate eval-frame struct type, storing it in
eval_frame_type, and gc-protect that new variable.
Register uw-eval variable evaluating to a one bit mask
with the UW_EVAL-th bit set.
* unwind.h (enum uw_frtype): New enum constant UW_EVAL.
(struct uw_eval): New struct type.
(union uw_frame): New member, el.
(uw_push_eval): Declared.
|
|
|
|
|
|
| |
* share/txr/stdlib/debug.tl (print-backtrace): Force
indentation and formatting off, and set maximum length and
depth to condense the backtrace output.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (debug_state): Switch to unsigned, since this is now
a bitmask.
(sys_print_backtrace_s): New symbol variable.
(dbg_clear, dbg_set, dbg_restore): New static functions.
(debug_init): Initialize sys_print_backtrace_s. Register
dbg-clear, dbg-set, dbg-restore intrinsics. Register
dbg-enable, dbg-step, dbg-backtrace and dbg-all bitmask
variables, Lisp equivalents of DBG_ENABLE, DBG_SETP,
DBG_BACKTRACE and DBG_ALL.
(debug_dump_backtrace): New function.
* debug.h (opt_debugger): Declaration removed.
(debug_state): Declaration updated.
(DBG_ENABLE, DBG_STEP, DBG_BACKTRACE, DBG_ALL): New
preprocessor symbols.
(debug_set_state): Inline function removed.
(debug_clear, debug_set, debug_restore): New inline functions.
(dbg_backtrace, dbg_fcall_begin, dbg_fcall_end): New macros.
(debug_dump_backtrace): Declared.
* eval.c (error_trace): Invoke debug_dump_backtrace if support
is compiled in and backtraces are enabled.
* lib.c (do_generic_funcall): New function, copy of
generic_funcall.
(generic_funcall): Now a wrapper for do_generic_funcall which
registers fcall frames if backtrace support is enabled.
(funcall, funcall1, funcall2, funcall3, funcall4): Route to
slow generic_funcall path if backtraces are enabled.
* lisplib.c (debugger_instantiate, debugger_set_entries):
New static functions.
(lisplib_init): Autload support for debug module via above
new functions.
(lisplib_try_load): Save and restore debugger state in new
way using debug_set and debug_restore, with specific mask
values.
* parser.y (parse_once): Disable debugging in new way.
* share/txr/stdlib/debug.tl New file.
* sighal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST): New
macros for saving/restoring debug state.
(EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): Reference the above
macros to include debug state in extended jump context.
* txr.c (help): Document --backtrace and that that -d
implies --backtrace.
(txr_main): Enable debugger using debug_set.
Provide new --backtrace option to enable backtraces only.
* unwind.c (args_s): New symbol variable.
(fcall_frame_type): New static variable.
(unwind_to_exit_point): Save pointer to original frame stack
and restore it when calling error_trace. This is so that
error_trace can walk the stack to collect a backtrace.
(uw_find_frames_by_mask, uw_push_fcall): New functions.
(uw_late_init): Initialize args_s and fcall_frame_type.
gc-protect fcall_frame_type. Register uw-* variables
corresponding to the UW_* frame types.
* unwind.h (uw_frtype_t): New enum constant UW_FCALL.
(struct uw_fcall): New frame structure.
(union uw_frame): New member fc.
(uw_push_fcall, uw_find_frames_by_mask): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Repro test case:
(defvar v)
(defun f (: (v v)))
(call (compile 'f)) ;; blows up
* share/txr/stdlib/compiler.tl (compiler comp-lambda): The
specials variable is wrongly used as a Boolean to decide
whether we need an extra environment level for specials.
The problem occurs when all of the specials are optional
parameters. Optionals are handled specially and removed from
the specials list. If all the specials are optional
parameters, then the special list becomes empty. This cannot
be intepreted as "there are no specials". The correct Boolean
which indicates "there are specials" is need-dframe.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-lambda): Stray
prinl removed, issued in the rare case when the present
flag parameter of an optional parameter is present and is
a special var.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (except_set_entries): Autoload for catch** symbol.
* share/txr/stdlib/except.tl (catch**): New macro.
* txr.1: Document catch** macro, and the desc slot of
the catch-frame struct.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_catch): Extra argument in sys:catch syntax
specifies an expression that evaluates to a description
field.
(expand_catch): Expand the desc expression in sys:catch
syntax.
* parser.c (read_file_common): Increase acceptance of compiled
files from versions 1-4 to 1-5, since we are now marking
compiled files with version 5.0 rather than 4.0.
* share/txr/stdlib/asm.tl (op-catch catch): Support new
argument in the opcode syntax. Turns out we have a spare field
in the instruction format which was previously set to zero
We can use that for the description. Thus, the instruction
set and VM remain backward compatible: old code works.
* share/txr/stdlib/compiler.tl (compiler comp-catch): Handle
the desc argument introduced into the sys:catch form.
We must compile it as an expression, then inject the code into
the instruction template, and reference the output register of
that code block in the catch instruction.
(%tlo-ver%): Bump up the compiled file version to 5.0.
* share/txr/stdlib/except.tl (usr:catch, catch*): Add desc
argument to generated sys:catch form, specifying it as nil.
* unwind.c (desc_s): New symbol variable.
(uw_find_frames_impl): Set the desc member of the extracted
catch structure from the corresponding field in the catch
frame.
(uw_late_init): Initialize desc_s with interned symbol.
Add desc slot to catch-frame type.
* unwind.h (struct uw_catch): New member, desc.
(uw_catch_begin_w_desc): New macro.
* vm.c (vm_catch): Extract the desc field from the catch
instruction, and use uw_catch_begin_w_desc to propagate that
to the catch frame.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-switch): The
shared test here is both inaccurate and O(n^2). It tests that
all the remaining branches of the code are tails of the first
branch. However, this is not strict enough: we need to also
test that the tails are in their order of appearance. We can
do that in O(n) time.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Drop getform
argument. Obtain the arguments of the place in a variable
called args, which is then explicitly destructured with
tree-case to match the params list. Having all of the original
arguments in args, we can work backwards to replace some of
them with gensyms. The resulting gensym-ized list is used
to generate the access call to the operator named by name.
* txr.1: Update doc to get rid of get-form. Updated and
corrected the long form example.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Check for
restpar being an atom and handle differently. We still don't
handle the case where (b . c) is matched against a rest
parameter; in this case the mapcar will process an improper
list. I.e. the improper form must have an atom which matches
the position of the rest parameter.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* defset.tl (defset-expander): Add logic to expand parameter
list to determine additional paramters that may come out of
the expansion, as well as additional symbols that may be
visible as a result as a result of processing in the expanded
body. These symbols are included in the same way as original
the original parameters.
* txr.1: Documented defset's support for parameter list macros.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_instantiate, defset_set_entries): New
static functions.
(lisplib_init): Register auto-load of defset.tl, keyed on
defset symbol.
* share/txr/stdlib/defset.tl: New file.
* share/txr/stdlib/paramt.tl (param-parser-base opt-syms):
New method.
* txr.1: Documented.
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl: use load-for macro to
load the param module.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/compiler.tl (compiler comp-fun): Recognize
a lambda expression argument. The neglect to do this is
causing a miscompilation of (fun (lambda ...)) to a single
getf instruction that processes raw syntax at run time and
yields an interpreted lambda.
|