summaryrefslogtreecommitdiffstats
path: root/eval.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Indexing in variable subst applies to any sequence.Kaz Kylheku2017-04-051-9/+18
| | | | | | | | | | | | | | | | | | | | The @{a [3]} syntax in quasiliterals and @(output) now indexes into the original object a if it is any sequence kind, not specifically a list. Otherwise it indexes into its string representation. * eval.c (format_field): Combine the elements of the object with the separator if it is any sequence type other than a string. Subject to compat option. (subst_vars): Avoid converting any kind of sequence to string, rather than just lists. After any field formatting is applied, if the object is any sequence (not just alist), combine the elements with a space. All subect to compat option. * match.c (tx_subst_vars): Same treatment as subst_vars. * txr.1: Compatibility notes added.
* New time-parse-local and time-parse-utc functions.Kaz Kylheku2017-04-041-0/+2
| | | | | | | | | | | | | | | * eval.c (eval_init): Register intrinsic functions time-parse-local and time-parse-utc. * lib.c (strptime_wrap): New static function. (time_parse): Now implemented as by call to strptime_wrap. (time_parse_local, time_parse_utc): New functions. These get the time_t time from struct tm without constructing the intermediate Lisp structure. * lib.h (time_parse_local, time_parse_utc): Declared. * txr.1: Documented new functions.
* apply and iapply bugfix: split sequences into args.Kaz Kylheku2017-04-031-2/+17
| | | | | | | | | | | | | | | | | | | | | These functions don't conform with the documentation. For instance [apply list "abc"] yields "abc". It is supposed to yield (#\a #\b #\c), since the characters of "abc" must become individual arguments to list. Part of the fix is in the apply_frob_args logic; however, we have to clone that function because it is used for implementing other things which will break: we cannot, for for example, have (list* 1 "ab") producing (1 #\a #\b). * eval.c (apply_intrisic_frob_args): New static function. Differs from apply_frob_args in that it calls tolist on the final element. (apply_intrinsic): Use apply_intrinsic_frob_args instead of apply_frob_args. (iapply): Invoke tolist on the value assigned to last_arg. * txr.1: Add a clarifying note for iapply that the terminating atom is not split into arguments if it is a sequence.
* Important improvement in opip: support slot access.Kaz Kylheku2017-03-291-1/+1
| | | | | | | | | | * eval.c (me_opip): Just like dwim forms are left untransformed, we also leave untransformed (uref ...) and (qref ...) forms. Otherwise they get wrapped in the (do ...) syntax and don't work right. This treatment is so broken/useless that no compatibility switch is needed here. * txr.1: Documentation for opip/oand updated.
* Short-circuit lisp-1 expander for atoms.Kaz Kylheku2017-03-241-0/+3
| | | | | | * eval.c (expand_lisp1): if the form is an atom that is not a bindable symbol, just return it; don't wastefully call into expand which has to save and restore some context.
* bugfix: neglected unbound warnings in DWIM syntax.Kaz Kylheku2017-03-241-0/+4
| | | | | | | | | | | DWIM expressions like [a b c] are not raising expansion-time warnings about a, b, c being unbound. * eval.c (expand_lisp1): The problem is that here we just return in the case that the symbol is bindable and has no macro expansion! Before returning, we must check whether the symbol has a binding in the variable or function space. If not, raise a warning.
* Sandboxing support via *package-alist*.Kaz Kylheku2017-03-171-0/+1
| | | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register *package-alist* variable, taking on the contents of the packages variable. * lib.c (package_alist_s): New symbol variable. (make_package, packagep, find_package, package_alist); Work with dynamic package alist variable via cur_package_alist_loc macro. (get_current_package_alist_loc): New function. * lib.h (cur_package_alist_loc): New macro. (packages, package_alist_s, get_current_package_alist_loc): Declared. * txr.1: Documented *package-alist* along with notes about sandboxing. Documented that the package-alist function is now obsolescent.
* Rename badly named default_bool_argKaz Kylheku2017-03-171-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib.h (default_bool_arg): Inline function renamed to default_null_arg. * eval.c (if_fun, pad, ginterate, giterate, range_star, range, constantp, macroexpand_1, macro_form_p, expand_with_free_refs, do_expand, eval_intrinsic, func_get_name, make_env_intrinsic): Follow rename. * arith.c (lognot): Likewise. * gc.c (gc_finalize): Likewise. * glob.c (glob_wrap): Likewise. * hash.c (group_reduce, gethash_n): Likewise. * lib.c (print, multi_sort, lazy_str, vector, iff, tok_str, split_str_keep, search_str, remove_if, val): Likewise. * match.c (match_fun): Likewise. * parser.c (lisp_parse_impl, regex_parse): Likewise. * rand.c (make_random_state): Likewise. * regex.c (read_until_match, search_regex, regex_compile): Likewise. * socket.c (sock_accept, sock_connect): Likewise. * stream.c (open_files_star, open_files, run, open_process, open_tail, get_string, record_adapter): Likewise. * struct.c (static_slot_ensure, static_slot_ens_rec, clear_struct, make_struct_type): Likewise. * sysif.c (exec_wrap, errno_wrap, cobj_ops_init): Likewise. * unwind.c (uw_capture_cont, uw_find_frames_impl): Likewise.
* trace: implement redefinition checks.Kaz Kylheku2017-03-171-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The tracing module should warn when traced functions or methods are being redefined, and stop tracing the original methods. * eval.c (trace_check): New function. Calls sys:trace-redefined-check if the trace module has been loaded, otherwise does nothing. (op_defun, op_defmacro): Call trace_check to have a warning issued for a redefined traced function or macro. * eval.h (trace_check): Declared. * lisplib.c (trace_loaded): New global variable. (trace_instantiate): Flip trace_loaded to t. * lisplib.h (trace_loaded): Declared. * share/txr/stdlib/trace.tl (sys:trace-redefine-check): New function. Checks two situations: traced function or method is redefined (neither old nor new is traced any longer), and traced method is overridden (base method continues to be traced, override is not traced). * struct.c (static_slot_ensure): Do a trace check here, taking care of defmeth.
* Fix missing nao terminator in formatted printing.Kaz Kylheku2017-03-131-2/+2
| | | | | | | | | | | | | | * arith.c (trunc1, trunc, floorf, ceili): Add missing nao terminator to uw_throwf calls. * debug.c (debug): Missing nao terminator in format call. * eval.c (expand_opt_params_rec, me_equot): Missing nao terminator in eval_error call. * lib.c (use_sym): Missing nao in uw_throw call. * regex.c (reg_derivative): Missing nao in uw_throwf.
* New functions starts-with and ends-with.Kaz Kylheku2017-03-121-0/+2
| | | | | | | | | | | * eval.c (eval_init): Register starts-with and ends-with intrinsics. * lib.c (starts_with, ends_with): New functions. * lib.c (starts_with, ends_with): Declared. * txr.1: Documented.
* New rmismatch function.Kaz Kylheku2017-03-121-0/+1
| | | | | | | | | | * eval.c (eval_init): Register rmismatch intrinsic. * lib.c (rmismatch): New function. * lib.h (rmismatch): Declared. * txr.1: Documented
* match-fun: make last two args optional.Kaz Kylheku2017-03-121-1/+1
| | | | | | | | * eval.c (eval_init): Update registration of match-fun. * match.c (match_fun): Do defaulting on third and fourth arg. * txr.1: Documenation updated.
* uref: the a.b.c syntax extended to .a.b.cKaz Kylheku2017-03-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now it is possible to use a leading dot on the referencing dot syntax. This is the is the "unbound reference dot". It expands to the uref macro, which denotes an unbound-reference: it produces a function which takes an object as the argument, and curries the reference implied by the remaining arguments. * eval.c (uref_s): New global symbol variable. (eval_init): Intern uref symbol and init uref_s. * eval.h (uref_s): Declared. * lib.c (simple_qref_args_p): A qref expression is now also not simple if it contains an embedded uref, meaning that it cannot be rendered into the dot notation without ambiguity. (obj_print_impl): Support printing (uref a b c) as .a.b.c. * lisplib.c (struct_set_entries): Add uref to the list of autoload triggers for struct.tl. * parser.l (DOTDOT): Consume any leading whitespace as part of recognizing the DOTDOT token. Otherwise the new rule for UREFDOT, which matches (mandatory) leading space will take precedence, causing " .." to be scanned wrong. (UREFDOT): Rule for new kind of dot token, which is preceded by mandatory whitespace, and isn't consing dot (which has mandatory trailing whitespace too, matched by an earlier rule). * parser.y (UREFDOT): New token type. (i_dot_expr, n_dot_expr): New grammar rules. (list): Handle a leading dot on the first element of a list as a special case. Things are done this way because trying to work a UREFDOT into the grammar otherwise causes intractable conflicts. (i_expr): The ^, ' and , punctuators are now followed by an i_dot_expr, so that the expression can be an unbound dot. (n_expr): Same change as in i_expr, but using n_dot_expr. Plus new UREFDOT n_expr production. * share/txr/stdlib/struct.tl (uref): New macro. * txr.1: Documented.
* New floor-rem, ceil-rem and round-rem.Kaz Kylheku2017-02-261-1/+4
| | | | | | | | | | | | * arith.c (trunc_rem): Move function to below round function. Make second argument optional, defaulting to one. (floor_rem, ceil_rem, round_rem): New functions. * eval.c (eval_init): Registration of trunc-rem altered for optional argument. New registrations for floor-rem, ceil-rem, round=rem. * txr.1: Documented for new functions folded with trunc-rem.
* Second argument optional in trunc.Kaz Kylheku2017-02-251-1/+1
| | | | | | | | | | | | | | * arith.c (trunc1): New static function. (trunc): Detect a missing second argument and call func1. * eval.c (eval_init): Update registration of trunc intrinsic to make second arg optional. * txr.1: Describe optional argument of trunc. Trunc documentation is merged with the floor, ceil and round section. The mod and trunc-rem functions are split off into their own sections, leaving the / function described by itself. The documentation of / is substantially revised.
* Adding round function.Kaz Kylheku2017-02-251-0/+1
| | | | | | | | | | | * arith.c (round1): New static function. (roundiv): New function. * configure: New test for C99 round function. * eval.c (eval_init): Register round intrinsic. * txr.1: Documented.
* floor and ceil do division, with optional second arg.Kaz Kylheku2017-02-241-2/+2
| | | | | | | | | | | | | | | Also, with one argument, these functions handle ranges. * arith.c (floordiv, ceildiv): New functions. (floorf, ceili): Handle ranges. * eval.c (eval_init): Register floor and ceil to new functions. * lib.h (floordiv, ceildiv): Declared. * txr.1: Documentation updated.
* Add rassoc and rassql functions.Kaz Kylheku2017-02-111-0/+2
| | | | | | | | | | | * eval.c (eval_init): Register rassoc and rassql intrinsics. * lib.c (rassoc, rassql): New functions. * lib.h (rassoc, rassql): Declared. * txr.1: Documented rassoc and rassql, with small fixes to assql and assoc.
* consistency: treat members of struct env in order.Kaz Kylheku2017-02-101-2/+2
| | | | | | | * eval.c (make_env, copy_env): Assign to vbindings, then to fbindings. The members are in that order and elsewhere, wherever we treat both bindings, we treat the variables first.
* Use non-hacky representation for deferrable warnings.Kaz Kylheku2017-02-101-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deferrable warnings now get their own subtype, defr-warning. The tag is a regular argument: no funny dotted argument list. * eval.c (eval_defr_warn): Throw new style deferrable warning. (me_op, no_warn_expand): Catch defr-warning rather than warning. Use uw_muffle_warning to suppress it. (gather_free_refs): Parse new representation of deferrable warning. (expand_with_free_refs): Catch defr-warning rather than warning. * lib.c (defr_warning_s): New symbol variable defined. (obj_init): Initialize defr_warning_s. * lib.h (defr_warning_s): Declared. * share/txr/stdlib/error.tl (compile-defr-warning): Throw new-style deferrable warning. * unwind.c (uw_muffle_deferrable_warning): Function removed. (uw_throw): Bugfix: handle warnings by checking by subtype rather than exactly for the warning type. Distinguish deferrable warnings by subtype rather than argument list shape. (uw_defer_warning): Take the new style args and reconstruct the (msg . tag) representation for a deferred warning, so the other functions don't have to change. (uw_late_init): Register defr-warning as exception subtype of warning. * unwind.h (uw_muffle_deferrable_warning): Decl removed. * txr.1: Adjusted all documentation touching on the subject of the representation of deferrable warnings.
* Properly default arguments in expand_with_free_refs.Kaz Kylheku2017-02-101-1/+3
| | | | | * eval.c (expand_with_free_refs): Properly handle defaulting of the two optional arguments.
* Better way for releasing deferred warnings.Kaz Kylheku2017-02-101-3/+3
| | | | | | | | | | | | | | | | | | | | We should be re-throwing deferred warnings as ordinary warnings, not dumping them to a stream. * eval.c (eval_exception): Use uw_release_deferred_warnings instead of uw_dupm_deferred_warnings. (load): Likewise. * parser.c (read_eval_ret_last): Likewise. * txr.c (txr_main): Likewise. * unwind.c (uw_release_deferred_warnings): New function. * unwind.h (uw_release_deferred_warnings): Declared. * txr.1: Documented release-deferred-warnings and updated documentation for dump-deferred-warnings.
* Extend functionality of sys:expand-with-free-refs.Kaz Kylheku2017-02-091-5/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function's return list now has two additional elements. The first two elements give, respectively, the free variables and functions which occur in the form: variables and functions which have no lexical binding. As before, these lists omit the variables which do have bindings in the specified environment that is passed as an argument. The two new elements give, respectively, all variable and function references emanating out of the form, regardless of whether they have bindings in the form's surrounding lexical environment or whether they are free. The function also takes a new argument: an additional environment beyond which the erasure of bindings doesn't take place. * eval.c (squash_menv_deleting_range): New static function. (gather_free_refs): Do not intercept non-deferrable warnings. (gather_free_refs_nw): New static function. (expand_with_free_refs): Expand the form twice, the second time with a collapsed environment which has been stripped of all macros and of all var shadowing entries in a specified range, using the squash_menv_deleting_range function. The second pass yields the extra variables and functions. Also take a second env argument for this purpose. (eval_init): Register sys:expand-with-free-refs as a three argument function with one optional argument.
* sys:op: don't warn about @var targets.Kaz Kylheku2017-02-091-5/+11
| | | | | | | | * eval.c (do_expand): The previous commit exposes this false warning. Basically, the (sys:var <sym>) place expander generates a (sys:setq (sys:var <sym>) <val>) form. That is valid, and the expander shoud not warn that sys:var form is an unbound variable.
* Suppress only deferrable warnings in op expander.Kaz Kylheku2017-02-091-1/+1
| | | | | * eval.c (me_op): Switch from uw_muffle_warning to uw_muffle_deferrable_warning.
* Muffle only deferrable warnings in sys:expand.Kaz Kylheku2017-02-091-1/+1
| | | | | | | | | | | | | | | | | The problem is that if some macrology is performing its own expansion with sys:expand, and if all warnings are muffled in sys:expand, it means that some warnings will never be seen. Expansion is the last chance to produce warnings issued by macros. Once they are expanded, a redundant expansion pass won't issue the warnings any more. * eval.c (no_warn_expand); Use the uw_muffle_deferrable_warning handler isntead of uw_muffle_warnings. * unwind.c (uw_muffle_deferrable_warning): New function. * unwind.h (uw_muffle_deferrable_warning): Declared.
* New system function: expand-with-free-refs.Kaz Kylheku2017-02-081-0/+35
| | | | | | | | | | | | | | | | This interface to the expander returns not only the expanded form, but also a list of the free variables and functions occurring in that form. This interface to the expander works by installing a handler which intercepts and muffles warnings. When a warning occurs indicating an unbound variable or function, the information is retained. The expander then returns the information along with the expanded form. * eval.c (gather_free_refs): New static function. (expand_with_free_refs): New function. (eval_init): Register sys:expand-with-free-refs intrinsic.
* Expose rlcp_tree function.Kaz Kylheku2017-02-041-0/+1
| | | | | | | * eval.c (eval_init): Register rlcp-tree intrinsic. * txr.1: Documented rlcp-tree. Also documented that rlcp doesn't overwrite location info.
* bugfix: "expansion at nil" in error trace.Kaz Kylheku2017-02-031-1/+1
| | | | | * eval.c (error_trace): Wrong variable was checked as basis for selecting one of two variants of diagnostic.
* Dump deferred warnings when eval exception thrown.Kaz Kylheku2017-02-031-0/+2
| | | | | | | | * eval.c (eval-exception): Call uw_dump_deferred_warnings before throwing exception. The warnings could provide valuable clues about the cause of the error. * share/txr/stdlib/error.tl (compile-error): Likewise.
* Expand sys:setqf separately, with better accuracy.Kaz Kylheku2017-02-031-1/+25
| | | | | | | * eval.c (expand_setqf): New static function. (do_expand): Handle sys:setqf via new function, which avoids expanding the symbol, checks that it isn't a lexical function, and warns about an unbound function.
* Forbid lexical function mutation.Kaz Kylheku2017-02-031-1/+39
| | | | | | | | | | | * eval.c (expand_lisp1_setq): New static function. (op_setqf): Check that the function binding which was found is the global one. If not, throw an error that lexical functions can't be mutated. (do_expand): Handle sys:lisp1-setq operator expansion seprately from the other setq operators, via the new function, which enforces an expansion-time check against mutation of lexical functions.
* Expander check for macro destination in setq forms.Kaz Kylheku2017-02-031-0/+4
| | | | | * eval.c (do_expand): Throw an error if the destination is a symbol macro which requires expanding.
* When expanding sys:lisp1-value, check for bad form.Kaz Kylheku2017-02-031-1/+5
| | | | | * eval.c (expand_lisp1_value): If the first argument is an object other than a bindable symbol, throw an error.
* More accurate error wording from Lisp-1 operators.Kaz Kylheku2017-02-031-2/+2
| | | | | | | * eval.c (op_lisp1_setq, op_lisp1_value): If a Lisp-1 binding is not found, this is because it is neither a function nor variable, not because it is not a variable. The error message now reflects this.
* Expose expand_params as sys:expand-params.Kaz Kylheku2017-01-291-0/+1
| | | | | * eval.c (eval_init): Register sys:expand-params intrinsic bound to expand_params.
* bugfix: :filter not handled right in output var.Kaz Kylheku2017-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This issue was fixed in quasiliterals only. Because of the implementation duplicity between output vars and quasiliteral vars, we have to fix it in two places. When the parser handles quasiliterals, it builds vars without expanding the contents. The quasiliteral expander takes care of recognzing (sys:var ...) forms and properly handles them and their attributes, avoiding expanding the argument of a :filter keyword. When the parser handles an o_var that is a braced variable, it calls expand on its contents right there, then builds the (sys:var ...) form from the expanded contents. Why don't we just call expand_quasi in the o_var rule to have a single (sys:var ...) form expanded exactly how it is done in quasiliterals. * eval.c (expand_quasi): Change static function to external. * eval.c (expand_quasi): Declared. * parser.y (o_var): Construct an unexpanded (sys:var ...) form, and then wrap it in a one-element list. This is a de-facto quasi-items list, which can be expanded by expand_quasi. Then we pull the car of the expansion to get our expanded var.
* New catch*, giving access to exception symbol.Kaz Kylheku2017-01-251-1/+4
| | | | | | | | | | | | | | | | | | * eval.c (op_catch): The sys:catch operator now passes the exception symbol as the first argument of each clause. This means the catch macro must be adjusted. * share/txr/stdlib/except.tl (catch): Macro now inserts a gensym dummy first argument into each clause to take the symbol passed by the sys:catch operator. (catch*): New macro, which is identical to the previous catch macro, and thus exposes the symbol passed as the first argument. * txr.1: Documented catch*. * tests/012/struct.tl: Some gensym numbers need adjusting in one test case.
* bugfix: wrong context form in mac-param-bind.Kaz Kylheku2017-01-251-1/+1
| | | | | | | * eval.c (do_expand): Expander for mac-param-bind is redundantly expanding the main expression and taking that as the epanded context form, rather than expanding the context form.
* Expose plist to alist functions.Kaz Kylheku2017-01-241-0/+2
| | | | | | | | * eval.c (eval_init): Register plist-to-alist and improper-plist-to-alist intrinsics. * txr.1: Documented improper plist concept and new functions.
* New memp function for searching a plist.Kaz Kylheku2017-01-241-0/+1
| | | | | | | | | | * eval.c (eval_init): Register memp intrinsic. * lib.c (memp): New function. * lib.h (memp): Declared. * txr.1: Documented.
* bugfix: wrong macro env across param expansion.Kaz Kylheku2017-01-241-10/+22
| | | | | | | | | | | | | | | | The issue is that optional argument init forms have visibility to prior arguments. However, they are being expanded in the original macro environment which doesn't take into account any preceding variable bindings. This is wrong: the preceding variables must shadow any symbol macros in the outer environment. * eval.c (expand_opt_params_rec, expand_params_rec): Create a var shadowing macro environment for every parameter name (or destructuring parameter list) that is traversed, and use that macro environment to process the remaining parameters. (make_var_shadowing_env): Allow the function to take a single symbol instead of a list of symbols.
* Support keyword params via :key param list macro.Kaz Kylheku2017-01-231-3/+7
| | | | | | | | | | | | | | | | | | * eval.c (expand_param_macro): Use lisplib_try_load to retry failed parameter macro lookup, thereby supporting auto-loading of modules that define parameter macros. * lisplib.c (keyparams_set_entries, keyparams_instantiate): New static functions. (lisplib_init): Support autoloading of keyparams.tl via new functions. * share/txr/stdlib/keyparams.tl: New file. * txr.1: Documented :key param list macro. * checkman.txr: Support "Parameter list macro" documentation section type.
* diagnose (:whole . blah) as dangling :whole.Kaz Kylheku2017-01-231-1/+1
| | | | | * eval.c (bind_macro_params): Test that the rest of the param list after the keyword is consp, not just non-nil.
* bugfix: :whole and :form allow destructuring.Kaz Kylheku2017-01-231-13/+13
| | | | | | | | | | | | | | In bind_macro_params allow the argument of :whole and :form to be a destructuring pattern. Yet, in expand_params, we are wrongly requiring it to be a bindable symbol, thus blocking the feature. * eval.c (expand_opt_params_rec): Only require the argument of a keyword to be a bindable symbol if that keyword is :env. (expand_params_rec): Some refactoring here not to recursively expand keyword as parameters, removing a hacky test in the atom case. Also car_ex is renamed to param_ex. Other than that, same fix as in expand_opt_params_rec.
* Bump copyright year to 2017.Kaz Kylheku2017-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/except.tl, share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl: Add 2017 to all copyright headers and strings.
* bugfix: expansion order in face of param macros.Kaz Kylheku2017-01-221-27/+33
| | | | | | | | | | | | | | | | | | | | | | | We are following an incorrect expansion order for parameters and bodies in the face of parameter macros. We are expanding the body first, using the raw, untransformed parameters, which is wrong. Secondly, we then neglect to expand the body which emerges from param expansion. The fix is to pass the unexpanded body to expand_params. Then expand the body which emerges. This also fixes another bug: the macro env passed to param expanders is documented as excluding the parameters. This is now actually true. * eval.c (expand_macrolet, expand_tree_cases, expand_catch_clause): Rearrange expansion logic surrounding call to expand_params. (do_expand): Likewise, and also introduce expansion for the sys:with-dyn-rebinds operator. This is now needed because under the new order, with-dyn-rebinds is now introduced into unexpanded code. If it isn't expanded, then it then wrongly protects its enclosed forms from expansion.
* Don't expand arg in @{var :filter arg}.Kaz Kylheku2017-01-221-1/+27
| | | | | | | * eval.c (expand_var_mods): New static function. (expand_quasi): Use expand_var_mods to expand variable modifies, rather than expand_forms. The new expand_var_mods avoids expanding the argument of the :filter keyword.
* Muffle expansion warning in op macro.Kaz Kylheku2017-01-181-2/+6
| | | | | * eval.c (me_op): Install handler to intercept warnings and route them to uw_muffle_warning.