| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_eval_stream): New boolean argument
to request hash bang support.
* parser.h (read_eval_stream): Declaration updated.
* eval.c (sys_load): Pass new thid argument to read_eval_stream,
to decline hash bang support.
* match.c (v_load): Likewise.
* txr.c (txr_main): Request hash bang support from
read_eval_stream. Thus files referenced from the txr
command line can have a #! line, which is ignored.
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_quasi): When the modifiers argument of a var
item is expanded, the expansion incorrectly places it as the
fourth item rather than third. This is effectively a continuation
of the incomplete regression fix that was applied on 2014-08-29.
The breakage is that `@{(expr) modifier}` ignores modifier
whenever (expr) is an expression that undergoes expansion.
|
|
|
|
|
|
|
|
|
| |
* hash.h (hash_from_pairs, hash_list): Declared.
* eval.c (eval_init): Registered hash-from-pairs and hash-list
intrinsic.
* txr.1: Documented new functions.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register hash-subset and hash-proper-subset
intrinsics.
* hash.c (hash_subset, hash_proper_subset): New functions.
* hash.h (hash_subset, hash_proper_subset): Declared.
* txr.1: New functions documented.
|
|
|
|
| |
* txr.1: Document have.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (install): Install .tl files present in stdlib directory.
(INSTALL): Handle argument 2 being a list.
* eval.c (load): New function.
* eval.h (load): Declared.
* lisplib.c (ifa_set_entries, ifa_instantiate): New functions
to lazily load ifa.tl.
(lisplib_init): Register new functions.
* txr.c (stdlib_path): New variable.
(sysroot_init): Store the stdlib path in stdlib_path.
* txr.h (stdlib_path): Declared.
* share/txr/stdlib/ifa.tl: New file.
|
|
|
|
|
|
|
| |
* eval.c (sys_load_s): New symbol variable.
(sys_load, me_load): New static functions.
(eval_init): Initialize sys_load_s, register
sys:load intrinsic function and load macro.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (bindings_helper): In the parallel binding case, only allocate
a new dynamic env when it is needed (because a special variable is
being bound), rather than unconditionally.
Consequently, only modify dyn_env when the dynamic environment actually
needs to be extended. Constructs that use bindings_helper are only
wrapped in the dynamic environment save/restore form
sys:with-saved-vars if they bind special variables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This speeds up the TXR Lisp interpreter, because do_eval
sets up a debug frame and uses debug_return.
* debug.c (debug_block_s): Symbol removed.
(debug_init): Remove initialization of debug_block_s.
* debug.h (debug_block_s): Declaration removed.
(debug_enter): Do not establish a named block or a catch block;
no time-wasting unwind stack manipulation at all.
The debug_depth variable is managed by the extended setjmp
context now. Provide a return value variable, and a well-defined name to
branch to to exit from the debug block.
(debug_return): Do not use heavy-weight uw_block_return;
simply set the return variable and branch to debug_return_out
label.
* signal.h (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST,
EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): New macros.
(extended_jmp_buf): Define optional global state
variables using EJ_OPT_MEMB.
(extended_setjmp): Save and restore optional
globals using EJ_OPT_SAVE and EJ_OPT_RESTORE.
Now debug_depth is saved and restored if
debugging support is compiled in.
* match.c (open_data_source): Remove bogus debug_return
invocations which were uncovered here by changes to the macro.
* eval.c (do_eval, expand_macro): debug_return must now be after
debug_end, because it won't dynamically clean up frames that it doesn't
know about. The set_dyn_env is no longer unreachable in expand_macro;
it is now necessary because debug_return isn't doing the longjmp
that previously restored dyn_env.
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_setqf): New function.
(eval_init): Register sys:setqf operator. Also expose
global variable hash tables via sys:top-vb and sys:top-fb.
* place.tl (sys:get-fb, sys:get-vb): New functions.
(fun, symbol-function, symbol-value): New places defined.
|
|
|
|
|
|
|
|
| |
* eval.c (me_defparm): New function.
(eval_init): Register defparm.
* txr.1: Documented defparm together with defvar.
defvar documentation is revised.
|
|
|
|
|
|
|
|
|
|
| |
macro also.
(boundp): Return t for symbol macros.
(makunbound, fmakunbound): New functions.
(eval_init): Register makunbound and fmakunbound.
* txr.1: Document changes to symbol-value and boundp,
and add dialect notes about the different semantics of binding.
|
|
|
|
| |
case occurs when (flet () ...) is expanded.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This really only affects code which does something like
(set [f x] y) and f resolves as a function. (The TXR Program
bent over backwards to install a mutable object into a function
binding.) In this situation, we need to update the function binding
f, rather than some variable f.
* eval.c (op_lisp1_setq, op_lisp1_value): New static functions.
(eval_init): Register sys:lisp1-setq and sys:lisp1-value
special forms.
* place.tl (sys:*lisp1*): New special variable.
(sys:sym-place-update-expander, sys:sym-place-clobber-expander):
React to sys:*lisp1* variable by doing symbol access using Lisp-1
semantics, with help of newly introduced special forms.
(dwim): Bind sys:*lisp1* to true, if main argument is a symbolic place,
so that the update is done using Lisp-1 semantics. Use the
sys:lisp1-value operator when evaluating arguments.
|
|
|
|
|
|
|
| |
reimplementation of lookup_var.
(op_setq): Use lookup_var instead of lookup_var_l.
Now only outside modules use the lookup_var_l interface.
Error message fix: sys:setq, not setvar.
|
|
|
|
|
|
| |
* eval.c (apply): Revert some changes from 2015-03-13
which cause the too many arguments case not to be
diagnosed.
|
|
|
|
|
| |
* eval.c (expand_qquote): Corrected awkward error message text
which was saying that a splice "cannot occur as an atom".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (builtin, eval_initing): New global variable.
(op_defun, op_defmacro): During initialization, record functions
and macros in builtin hash.
(builtin_reject_test): New static function.
(expand_macrolet): Perform builtin reject test for fbind, lbind,
and macrolet.
(regfun, reg_mac): Add symbol to builtin hash.
(eval_init): GC-protect new hash table variable and initialize it.
Set eval_initing to true over eval initialization.
The flip function is renamed fo flipargs.
(eval_compat_fixup): New function, for dealing with the
operator/function conflict over flip.
* eval.h (eval_compat_fixup): Declared.
* lib.c (compat_fixup): Call eval_compat_fixup.
* tests/011/macros-2.txr: This test was defining a macro called
while which is now illegal. Renamed to whilst.
* tests/011/macros-2.expected: Regenerated.
* txr.1: Function flip renamed to flipargs and documented in
Compatibility section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
so line numbers don't change.
* eval.c (eval_init): Fix registrations of lisp-parse and read.
* lisplib.c (place_instantiate): Give name to parsed string stream
using new lisp_parse argument.
* parser.c (lisp_parse): Takes new argument to override name.
* parser.h (lisp_parse): Declaration updated.
* txr.c (txr_main): Call lisp_parse with four args, defaulting
the new one.
* txr.1: Documented new argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The operators set, inc, dec, pop and others are now macros
which generate code, rather than built-in special forms
that use "C magic". Moreover, new such macros are easy to write, and
several new ones are already available. Moreover, new kinds of
assignable places are easy to create.
* place.tl: New file.
* lisplib.c, lisplib.h: New files.
* Makefile (OBJS): New target, lisplib.o.
(GEN_HDRS): New variable.
(LISP_TO_C_STRING): New recipe macro, with rule.
(clean): Remove generated headers named in $(GEN_HDRS).
* eval.c (dec_s, push_s, pop_s, flip_s, del_s): Variables removed.
(setq_s): New variable.
(lookup_var, lokup_sym_lisp_1, lookup_var_l, lookup_fun, lookup_mac,
lookup_symac, lookup_symac_lisp1): Trigger the delayed loading of
libraries for undefined global symbols, and re-try the lookup.
(op_modplace, dwim_loc, force_l): Static functions removed.
(op_setq): New static function.
(eval_init): Initialize setq_s; remove initializations of
removed variables; remove registrations for op_modplace;
add registration for sys:setq, sys:rplaca, sys:rplacd,
sys:dwim-set and sys:dwim-del intrinsics.
Call lisplib_init to initialize the dynamic library loading module.
* lib.c (sys_rplaca, sys_rplacd): New functions, differing
in return value from rplaca and rplacd.
(ref, refset): Handle hash table.
(dwim_set, dwim_del): New functions.
* lib.h (sys_rplaca, sys_rplacd, dwim_set, dwim_del): Declared.
* genvim.txr: Include place.tl in scan.
* tests/010/seq.txr: The del operator test
case no longer throws at run-time but at macro-expansion time, so the
test case is simply removed.
* tests/010/seq.expected: Updated output.
* tests/011/macros-2.txr: Reset *gensym-counter* to zero, because
the textual output of the test case includes gensyms, whose numberings
fluctuate with the content of the new Lisp library material.
* tests/011/macros-2.expected: Updated output.
|
|
|
|
|
|
| |
* eval.c (expand_progn): New function.
(do_expand): Use expand_progn for constructs
which have an implicit progn body.
|
|
|
|
|
|
|
| |
* eval.c (op_quote): Throw error on bad syntax.
* lib.c (obj_print, obj_pprint): Do not hide bad quote syntax
using ' notation; print it using ordinary notation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (check_lambda_list): New static function.
(op_defun): Argument list checking moved into
check_lambda_list, which is called for defun out of
do_expand. Name checks moved into do_expand.
Thus, defun is checked earlier, at expansion time.
(me_flet_labels): Check the lambda list of each lexical function
with check_lambda_list.
(do_expand): Check the syntax of the lambda form, and
the validity of its argument list.
Check the name of a defun or defmacro for validity.
Check the validity of the defun argument list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows mlet variables to be assignable.
* eval.c (force_s): New global variable.
(op_modplace): Handle force form.
(me_mlet): Use force_s symbol.
(force_l): New static function.
(eval_init): Initialize force_s variable. Use it in registration
of force function.
* txr.1: Remove text in mlet definition that variables
are not assignable. Replace with note about an unspecified behavior.
|
|
|
|
|
|
|
| |
* eval.c (me_mlet): New static function.
(eval_init): Registered mlet macro.
* txr.1: Documented mlet.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (promise_forced_s, promise_inprogress_s): New symbol
variables.
(me_delay): Change representation of promises so that the
original delay form is stashed there for better reporting
in the force function. Also, propagate the debug info
from the second argument of the form to the entire form;
otherwise it will inherit it from elsewhere.
(force): Rewritten to follow new three-state representation
to detect the recursive case and diagnose it.
(eval_init): Register new symbol variables.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fix prevents certain situations when an inappropriate form
is reported, in the default unhandled exception handler, as pertaining
to an error.
* eval.c (do_eval): Save and restore the last_form_evaled,
in an exception-unsafe way. If we successfully evaluate a form or
subform, we can restore the previous one.
(expand): Save and restore last_form_expanded similarly. We don't
need the unwind block and counter.
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_lcons): New function.
(eval_init): Registered lcons macro.
* txr.1: Documented lcons.
* tl.vim, txr.vim: Regenerated.
|
|
|
|
|
|
|
| |
* eval.c (me_dotimes): New function.
(eval_init): Registering dotimes macro.
* txr.1: Documented dotimes.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (while_star_s, until_star_s): New symbol variables.
(me_while_star, me_until_star): New static functions.
(eval_init): Initialize new variables. Register while* and
until* macros.
* txr.1: Documented while* and until*.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
| |
no need to intern the symbol when registering me_until.
|
|
|
|
|
|
|
|
|
|
|
| |
(me_iflet_whenlet): New static function.
(eval_init): Initialize when_s, iflet_s. Use
when_s for registering me_when.
Register me_iflet_whenlet.
* txr.1: Documented iflet and whenlet.
* tl.vim, txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (while_s): New symbol variable.
(me_whilet): New static function.
(eval_init): Initialize while_s. Use while_s in registration
of while macro. Register new whilet macro.
* txr.1: whilet is documented.
* tl.vim, txr.vim: Regenerated.
|
|
|
|
|
|
|
|
| |
* eval.c (zap_s): New global variable.
(op_modplace): Support zap.
(eval_init): Initialize zap_s, and register as operator.
* txr.1: Documented zap.
|
|
|
|
|
|
|
|
|
| |
* eval.c (APPLY_ARGS): New preprocessor symbol, replaces
hard-coded 32 inside apply.
(apply): Use APPLY_ARGS for argument array.
Fix overrun of args array in non-variadic function case when
list has more than APPLY_ARGS elements.
Eliminate superflous "variadic" local variable.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.h (zap): New inline function.
(z): New macro.
* lib.c (generic_funcall, funcall1, funcall2, funcall4, do_not,
do_dup, do_iff): Use z macro to burn funargs with no next use.
* eval.c (apply, apply_frob_args, iapply, call, do_eval,
op_dwim, mapcarv, mappendv, lazy_mapcarv_func, mapdov, do_apf,
do_ipf, callf): Use z macro to burn funargs with no next use.
|
|
|
|
|
|
|
|
|
|
|
| |
(tprint): New function.
(eval_init): Register tprint as intrinsic.
* eval.h (prinl, pprinl, tprint): Declared.
* txr.c (txr_main): New option, -t.
* txr.1: Documented tprint and -t option.
|
|
|
|
|
|
|
|
| |
argument.
* lib.c (lazy_stream_cons): Default the argument to std_input.
* txr.1: Document that the stream is optional in get-lines.
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_ignerr): New static function.
(eval_init): Registered ignerr macro.
* txr.1: Documented.
* tl.vim, txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (last_form_expanded): New variable.
(do_expand): New static function; contains previous expand
function.
(expand): Becomes a wrapper for do_expand, with re-entry
counting.
(eval_init): GC-protect last_form_expanded.
* eval.h (last_form_expanded): Declared.
* parser.l (regex_parse, lisp_parse): Just use a simple word for
the name of the regex or string parse location, not the entire
expression itself.
* unwind.c (uw_throw): Check whether expansion was going on
when the unhandled exception was thrown and print additional
information.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register search-regst, match-regst
and match-regst-right intrinsics.
* regex.c (search_regst, match_regst, match_regst_right): New functions.
* regex.h (search_regst, match_regst, match_regst_right): Declared.
* txr.1: Documented new variants.
|
|
|
|
|
|
|
|
| |
* eval.c (pad_func, pad, weave_while, weave_gen, weavev):
New static functions.
(eval_init): Registered pad and weave intrisics.
* txr.1: Documented pad and weave.
|
|
|
|
|
|
|
|
|
|
| |
(lexical_lisp1_binding): New static function.
(eval_init): Initialize symacro_k and fun_k; register
new intrinsic function lexical-lisp1-binding.
* match.h (var_k): Existing external name declared.
* txr.1: Documented lexical-lisp1-binding.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register trunc-rem intrinsic.
* lib.h (trunc_rem): Declared.
* txr.1: Documented trunc-rem.
* tl.vim, txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One upshot of all this is that (throw 'foo "msg") now
does exactly the same thing as (throwf 'foo "msg").
A message-only exception really is a one-string exception argument
list ("message ..."), like the documentation says.
* unwind.h (struct uw_catch): exception member renamed to args.
(uw_catch): Macro follows structure member rename.
* eval.c (op_catch): Removed now unnecessary kludge of turning non-list
exception argument list into a one-element argument list.
* match.c (v_try): Similar hack to the one in op_catch
removed here.
* unwind.c (uw_unwind_to_exit_point, uw_push_catch): Follows rename of
exception member.
(uw_throw): The exception parameter is renamed to args. The kludge
removed from op_catch re-appears here, because numerous calls
to uw_throw just pass a string as args. It's less of a kludge here
because this is the master entry point to exception processing,
and it straightens out the representation right away.
The exception arguments or message are printed in a clearer way.
|
|
|
|
|
|
|
|
|
|
|
| |
the handling of missing meta-numbers (for
instance (op ... @1 .. @3): 1 and 3 occur, but not 2.
* eval.c (supplement_op_syms): Bugfix: loop was testing
and updating the wrong variable, causing it to be looking at the first
element of the syms list in every iteration.
Not a regression: this was implemented wrong when the function
was introduced on October 6, 2013.
|
|
|
|
|
|
|
|
|
|
|
| |
occurs in the quasi syntax (which is the result of substitution
of metanums like @1 by the op macro), if that variable
evaluated to a list form, it was not being converted to
a string. The resulting form was then examined for variable
substitutions as if it were part of the quasi syntax.
This was introduced at the same time as the feature of being
able to use metanums in a quasiliteral (Feb 13, 2012:
last change before Version 57).
|
|
|
|
|
|
|
| |
like @1, @2, preserve the (sys:var X args ..) structure
if there are args (but of course with X replaced by the appropriate
gensym). This allows syntax like `@{1 10}` to work in quasiliterals: in
other words, modifiers on interpolated metas, on par with @{a 10}.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (lookup_symac_lisp1, expand_lisp1,
expand_forms_lisp1): New static functions.
(expand): Handle dwim's arguments via
expand_forms_lisp1, rather than as a generic
compound form.
* txr.1: Revised text in several places to clarify
this expansion rule.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c, arith.h, combi.c, combi.h, debug.c, debug.h, eval.c, eval.h,
filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h,
match.c, match.h, parser.h, rand.c, rand.h, regex.c, regex.h,
signal.c, signal.h, stream.c, stream.h, sysif.c, sysif.h, syslog.c,
syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h:
Update.
* LICENSE, METALICENSE: Likewise.
|