| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (fun_k): Global definition removed.
(eval_init): Do not initialize fun_k here.
* filter.c (fun_k): Definition removed.
(filter_init): Do not initialize fun_k.
* filter.h (fun_k): Declaration removed.
* lib.c (fun_k): Defined in this file now.
(obj_init): Initialize fun_k here.
* lib.h (fun_k): Declare here.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_meta_error): New static function.
(eval_init): Register sys:var and sys:expr as operators
that throw error.
* parser.y (sym_helper): Take parser_t instead of scanner_t
argument so we have access to the name and line number.
Obtain scanner internally from parser. Add source location
info to (sys:var ...) form.
(symhlpr): Retarget macro to pass parser rather than scanner to
sm_helper.
|
|
|
|
|
| |
saved and restored around the execution of a special operator,
it is never set the current form.
|
|
|
|
|
|
|
| |
of multi-line context form.
(apply): Use ~! for proper indentation of function code.
* unwind.c (uw_throw): Use ~! for proper indentation of code.
|
|
|
|
|
|
|
|
|
|
|
|
| |
(bind_args): Include the entire context form in argument
mismatch errors.
(apply): Include the function name, or else source code
if it has no name, in argument mismatch erors.
(eval_init): Register func-get-name intrinsic.
* eval.h (func_get_name): Declared.
* txr.1: Documented func-get-name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(eval_error): Derive location of error from
the last_form_evaled, if form doesn't have it.
(eval_init): Re-register source-loc-str as binary with an optional arg.
* match.c (debuglf, sem_error, file_err, typed_error): Default new
argument of source_loc_str.
* parser.h (source_loc_str): Declaration updated.
* parser.l (source_loc_str): Take second argument which specifies
alternative value if the source loc info is not found.
* unwind.c (uw_throw): Simplify code thanks to source_loc_str
default argument.
* txr.1: Document new argument of source-loc-str.
|
|
|
|
|
|
|
|
| |
* hash.h (hash_revget): Declared.
* eval.c (eval_init): Registered hash-revget intrinsic.
* txr.1: Documented hash-revget.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (arith-init): Changing *flo-...* from special to
lexical, and adding un-earmuffed variants. The earmuffed
versions are obsolescent.
Adding %pi% and %e% global lexicals. Earmuffed versions are
also made global lexical, and obsolescent.
* eval.c (lookup_global_var, lookup_global_var_l): New functions.
(lookup_var): Uses lookup_global_var.
(reg_varl): New function.
(reg_var): Uses reg_var.
(eval_init): Register global lexicals user-package, system-package
and keyword-package. Old symbols with earmuffs are obsoleted,
and also turned into global lexicals.
(top-vb, top-fb): Changed to lexical.
* eval.h (lookup_global_var, lookup_global_var_l, reg_varl):
Declared.
* genvim.txr: Scan ver.tl so that the lib-version variable
is included. Extract reg_varl calls.
* glob.c (glob_init): glob-err and other variables made lexical.
* lib.c (get_user_package, get_system_package, get_keyword_package):
Use lookup_global_var_l to avoid searching dynamic scope for
lexicals which cannot be dynamically rebound.
* share/txr/stdlib/ver.tl (lib-version): New global lexical variable.
(*lib-version*): Turned lexical. Obsolescent.
* signal.c (sig-init): sig-* variables turned lexical.
* sysif.c (sysif-init): s-*, poll-* and w-* variables turned lexical.
* syslog.c (syslog-init): log-* variables turned lexical.
* txr.c (sysroot-init): stdlib and *txr-version* variables turned
lexical. txr-version variable added, and *txr-version* is
obsolescent.
(txr-main): self-path variable added. *self-path* turns lexical
and is obsolescent.
* txr.1: Documentation updated. Lexical variables not referred
to as special. Special variables referred to as special.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (defvarl_s, defparm_s, defparml_s, sys_mark_special_s): New
symbol variables.
(mark_special): Return val rather than void, since it's hoisted
into Lisp domain now with func_n1.
(op_defvar): Renamed to op_defvarl, and doesn't call mark_special.
defvarl is now the special form for defining variables, and special
marking is an embellishment added by macros.
(me_defparm): Renamed to me_def_variable. Handles defvar, defparm
and defparml.
(do_expand): Expand defvarl, rather than defvar.
(eval_init): Intern defvarl, defparm, defparml and mark-special
symbols, and initialize corresponding globals.
Register defvarl special operator, retiring defvar.
Register defparm to me_def_variable, and register defvar and
defparml to the same.
* txr.1: Document support for global lexical scopes and the
new macros.
|
|
|
|
|
|
|
|
| |
(expand_opt_params_rec, expand_vars): Follow rename of special_p.
(eval_init): Register special-operator-p and special-var-p
intrinsics.
* txr.1: Document special-operator-p and special-var-p.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_error): New static function.
(macro_form_p, fboundp): Static to external.
(special_operator_p): New function.
(eval_init): Register macrolet and symacrolet to op_error.
These are recognized and processed by expand, but we want
them in the op table so they are reported by special_operator_p.
* eval.h (fboundp, macro_form_p, special_operator_p): Declared.
* hash.c (print_key_val): Break long lines on spaces
between pairs with stream_width_check.
(hash_print_op): Implement split and indented printing.
* lib.c (obj_print_impl): New static function, resulting
from a merge of obj_print and obj_pprint. Fixes some
wrong-way recursion bugs: obj_pprint recursed into obj_print
in some places. Adds support for multi-line printing of
vectors and lists, with indentation using the new
interfaces in streams.
* stream.c (strm_base_init): Update initializer.
(put_indent, indent_mode_put_string): New static functions.
(put_string): Use indent_mode_put_string in either of the
two indent modes.
(put_char): Implement indent mode.
(get_indent_mode, test_set_indent_mode,
set_indent_mode, get_indent, set_indent,
inc_indent, width_check): New functions.
* stream.h (enum indent_mode): New.
(struct strm_base): indent_on member becomes indent_mode.
New members data_width and code_width.
(get_indent_mode, test_set_indent_mode,
set_indent_mode, get_indent, set_indent,
inc_indent, width_check): Declared.
* tests/009/json.expected: Updated.
* tests/010/seq.expected: Likewise.
* tests/011/macros-2.expected: Likewise.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register nthcdr function.
* lib.c (nthcdr): New function.
* lib.h (nthcdr): Declared.
* share/txr/stdlib/place.tl (nthcdr): New defplace.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (op_mac_param_bind): New static function.
(eval_init): Register mac-param-bind operator.
* share/txr/stdlib/place.tl (define-place-macro): Use
mac-param-bind inside a lambda instead of tb macro.
* txr.1: Document mac-param-bind.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register second through tenth as intrinsic.
* gencadr.txr: New cadr.c changes encoded.
* lib.c (second, third, fourth, fifth, sixth): Functions
reimplemented using ref, so they are much more efficient
for vectors and strings.
(seventh, eighth, ninth, tenth): New functions.
* lib.h (seventh, eighth, ninth, tenth): Declared.
* share/txr/stdlib/place.tl: place macros defined for
second through tenth.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (split_func): New static function.
(partition_split_common): New static function, based on
on contents of partition function.
(partition): Now a wrapper around partition_split_common.
(split): New function.
* lib.h (split): Documented.
* txr.1: Documented split.
|
|
|
|
|
|
|
| |
* eval.c (sys_lisp1_value_s): New global symbol variable.
(expand_lisp1_value): New static function.
(do_expand): Use expand_lisp1_value.
(eval_init): Initialize sys_lisp1_value_s.
|
|
|
|
| |
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|