summaryrefslogtreecommitdiffstats
path: root/share
Commit message (Collapse)AuthorAgeFilesLines
* Version 177.txr-177Kaz Kylheku2017-06-071-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* ffi: functions and macros for basic type properties.Kaz Kylheku2017-06-021-0/+15
| | | | | | | | | | | | | | | | | | * ffi.c (ffi_alignof, ffi_offsetof, ffi_arraysize, ffi_elemsize, ffi_elemtype): New functions. (ffi_init): Registered intrinsics ffi-alignof, ffi-offsetof, ffi-arraysize, ffi-elemsize, ffi-elemtype. * ffi.h (ffi_alignof, ffi_offsetof, ffi_arraysize, ffi_elemsize, ffi_elemtype): Declared. * lisplib.c (ffi_set_entries): New autoload entries alignof, offsetof, arraysize, elemsize, elemtype. * share/txr/stdlib/ffi.tl (alignof, offsetof, arraysize, elemsize, elemtype): New macros. * txr.1: Documented new functions and macros.
* Version 176.txr-176Kaz Kylheku2017-05-211-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* ffi: new macro, deffi-var.Kaz Kylheku2017-05-201-0/+15
| | | | | | | | * lisplib.c (ffi_set_entries): Autload entry for "deffi-var". * share/txr/stdlib/ffi.tl (deffi-var): New macro. * txr.1: Documented.
* ffi: deffi generates fixed-arg defun.Kaz Kylheku2017-05-201-10/+10
| | | | | | | * share/txr/stdlib/ffi.tl (deffi): Since the arity of a foreign function is fixed, generate a fixed-argument defun. This provides a better check on the number of arguments than letting ffi-call detect it.
* ffi: overhaul ffi-call API and document it.Kaz Kylheku2017-05-201-1/+1
| | | | | | | | | | | | | | | * ffi.c (ffi_call_wrap): Take struct args * parameters rather than a list. Check that number of arguments matches required number from call desc. No need to build argument array any more; we just refer to the one in args. Also, the first two parameters are reversed for consistency with other functions. (ffi_init): Update registration of ffi-call to reflect type change. * ffi.h (ffi_call_wrap): Declaration updated. * txr.1: Documented ffi-call.
* ffi: turn carray-ref into accessor.Kaz Kylheku2017-05-201-0/+2
| | | | | | | | | | * lisplib.c (ffi_set_entries): Add carray-ref to list of autoload names. * share/txr/stdlib/ffi.tl (carray-ref, carray-refset): Registered function pair as a simple accessor. * txr.1: Updated carray-ref doc.
* awk: new feature: again operator.Kaz Kylheku2017-05-191-3/+3
| | | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state loop): Wrap a loop around around the two forms that split the record into fields and dispatch the main rule function. The loop repeats if the named block returns :awk-again. (sys:awk-mac-let): New local macro (again) which bails out of the :awk-rec block just like (next) does, but specifies :awk-again as the return value. * txr.1: Documented.
* ffi: macro named ffi for type compiling shorthand.Kaz Kylheku2017-05-171-0/+3
| | | | | | | | | * lisplib.c (ffi_set_entries): Add "ffi" to autoload name list. * share/txr/stdlib/ffi.tl (ffi): New macro. * txr.1: Documented.
* ffi: typedef macro instead of deffi-type.Kaz Kylheku2017-05-171-0/+3
| | | | | | | | | | * share/txr/stdlib/ffi.tl (typedef): New macro. * lisplib.c (ffi_set_entries): Add typedef to autoload name list. * txr.1: Doc update. Remove mentions of deffi-type, though it continues to work.
* Version 175.txr-175Kaz Kylheku2017-05-151-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* ffi: support programmable abort return value.Kaz Kylheku2017-05-111-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | * ffi.c (stuct txr_ffi_closure): New member, abort_retval. (ffi_closure_mark_op): Mark the new member. (ffi_closure_dispatch_safe): Implement the abort_retval. If it is not nil, use put to place the value into the return buffer. There is a risk that this could also throw an exception, which is no longer protected: programer's problem. (ffi_make_closure): New abort_ret_in argument, which is defaulted and stored. (ffi_init): Update registration of ffi-make-closure to reflect new argument. * ffi.h (ffi_make_closure): Declaration updated. * share/txr/stdlib/ffi.tl (sys:deffi-cb-expander): Add abort-retval parameter; insert into ffi-make-closure call. (deffi-cb): Take optional abort-retval expression; pass it down to the expander function. (deffi-cb-unsafe): Pass nil as abort-retval down to expander. * txr.1: Documented.
* ffi: a measure of safety for callbacks.Kaz Kylheku2017-05-111-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want, by default, for callbacks to capture delimited continuations across foreign code, or perpetrate non-local transfers across foreign code. Here, we take an approach similar for what was done in ftw_wrap. * ffi.c (s_exit_point): New global variable with internal linkage. (ffi_call_wrap): If s_exit_point isn't nil, then it means that the callback intercepted a nonlocal transfer and stored its exit point. We resume the transfer to that exit point instead of returning normally. (ffi_closure_dispatch_safe): New static function. (ffi_make_closure): Support a new argument which indicates whether to make a closure which uses ffi_closure_dispatch_safe, or ffi_closure_dispatch. (ffi_init): Update registration of ffi-make-closure intrinsic. * ffi.h (ffi_make_closure): Declaration updated. * share/txr/stdlib/ffi.tl (sys:deffi-cb-expander): New function. (deffi-cb): Macro internals replaced by call to new function. (deffi-cb-safe): New macro. * txr.1: Documentation of ffi-make-closure updated. New deffi-cb-unsafe macro documented.
* ffi: add macro language.Kaz Kylheku2017-05-061-0/+91
| | | | | | | | * lisplib.c (ffi_set_entries, ffi_instantiate): New static functions. (lisplib_init): Register auto-loading of ffi.tl. * share/txr/stdlib/ffi.tl: New file.
* structs: check existence of type in new and lnew.Kaz Kylheku2017-05-041-9/+23
| | | | | | | | | | | | | | | | | | | | | This achieves two objectives. The obvious one is that we get a diagnostic for new expressions that name a nonexistent type, due to a typo, before those expressions are executed. However, this also fixes an annoying issue: spurious warnings about nonexistent slots, related to structs which have not yet been autoloaded. A test case for this is an expression like (let ((b (new list-builder))) b.(add 42)). Because list-builder is auto-loaded, the add slot doesn't exist. But (new list-builder) doesn't trigger that auto-load; so the deferred warning about the nonexistent slot isn't suppressed. With this change, the existence check in (new list-builder) will trigger the auto-load for the module which defines list-builder, causing the add slot to exist before the b.(add 42) expression is visited by the expander. * share/txr/stdlib/struct.tl (sys:check-struct): New function. (new, lnew): Issue warning if the type doesn't exist.
* Bugfix: incorrect substitution in suspend macro.Kaz Kylheku2017-04-151-1/+1
| | | | | | * share/txr/stdlib/yield.tl (suspend): The body forms must be inserted into a progn, because sys:abscond-from just takes one optional value to evaluate.
* Version 174.txr-174Kaz Kylheku2017-04-041-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Version 173.txr-173Kaz Kylheku2017-03-251-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* termios: broken go-cbreak method.Kaz Kylheku2017-03-251-1/+1
| | | | | * share/txr/stdlib/termios.tl (termios go-raw): Fix call to nonexistent method.
* trace: wrong function printed in traces.Kaz Kylheku2017-03-241-3/+4
| | | | | | | | | | | | When tracing for two or more functions is enabled in a single trace form, the the function tracing hooks print the wrong name for all but the rightmost function. * share/txr/stdlib/trace.tl (sys:trace): Fix code which assumes that the each operator binds fresh lexical variables on each iteration. Bind a fresh lexical variable lex-n which copies the current value of the loop variable n, and refer to this lexical out of the tracing lambda.
* Warn when a nonexistent slot is referenced.Kaz Kylheku2017-03-231-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing warning for the situaton when the qref, uref, usl and umeth macro operators are asked to refer to a slot that doesn't exist in any struct type. This won't catch errors referencing a slot on the wrong type, but it will catch slots that are misspelled in such a way that the typo doesn't land on any slot. * share/txr/stdlib/struct.tl (defstruct): Register tenative slot definitions for all slots to nuke warnings. (sys:check-slot): New function. (qref, usl, umeth): Check slots with sys:check-slot. (uref): Drop :whole argument, which is unused. (defmeth): Register tentative definition for slot. * struct.c (slot_s, static_slot_s): New symbol variables. (slot_type_hash, static_slot_type_hash): New hash tables, associating symbols with lists of struct type names in which they are defined. (struct_init): Initialize and gc-protect hashes. Initialize new symbols, interning in system package. Register new intrinsic funtions sys:slot-types and sys:static-slot-types. (make_struct_type): Register slots in new hashes. (static_slot_ens_rec): Register new slow in static slot hash. (slot_types, static_slot_types): New functions, registered as intrinsics. (slot_type_reg, static_slot_type_reg): New functions. * struct.h (print_s): Declared. (slot_s, static_slot_s): Declared. (slot_types, static_slot_types, slot_type_reg, static_slot_type_reg): Declared.
* Version 172.txr-172Kaz Kylheku2017-03-191-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* 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.
* trace: detect inheritance, change name and warn.Kaz Kylheku2017-03-171-10/+32
| | | | | | | | | | | | When a method is traced that is actually derived from another struct type, we convert the (meth ...) name to refer to that type and issue a warning. * share/txr/stdlib/trace.tl (sys:trace-canonicalize-name): New function. (sys:trace): Canonicalize name, and trace the canonicalized name. Warn if it is different from the original name. (sys:untrace): Likewise for untracing.
* Version 171.txr-171Kaz Kylheku2017-03-141-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* uref: the a.b.c syntax extended to .a.b.cKaz Kylheku2017-03-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Version 170.txr-170Kaz Kylheku2017-02-281-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Version 169.txr-169Kaz Kylheku2017-02-111-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Use non-hacky representation for deferrable warnings.Kaz Kylheku2017-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* awk macro: warn about invalid function use in rng.Kaz Kylheku2017-02-101-11/+26
| | | | | | | | | | | | | Improving the new feature to handle functions also, and improve the diagnostic by reporting the specific to or from subform of which contains the reference. * share/txr/stdlib/awk.tl (sys:awk-code-move-check): Take a an argument indicating the kinds of bindings being checked, symbols or functions, and an extra form argument. (sys:awk-mac-let): Pass new arguments to sys:awk-code-move-check and also call it two more times to report on functions also.
* awk macro: warn about invalid var use in rng forms.Kaz Kylheku2017-02-091-30/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The awk macro abruptly relocates rng forms out of their apparent scope. Therefore, code like this is wrong: (awk ((let ((x t)) (rng t x)) (action))) The rng form is transformed and relocated to a scope in which the let is not visible. This is a problem worth warning about. In the above case, there will also be a warning about the variable x being unbound, which might alerts the programmer to the problem. However, in cases where there is yet another binding of x introduced via :let or outside of awk, that warning wll not occur: the code motion will silently cause x to refer to the wrong x: (awk (:let (x nil)) ((let ((x t)) (rng 1 x)) ;; refers to the (x nil) binding!!! (action))) (let ((x nil)) (awk ((let ((x t)) (rng 1 x)) ;; refers to the (x 4) binding!!! (action)))) Now there is a warning for this situation. * share/txr/stdlib/awk.tl (sys:awk-compile-time): New slot, outer-env. (sys:awk-expander): Takes an env parameter, which is stored into the new slot of the awk-compile-time structure. (sys:awk-code-move-check): New function. (sys:awk-mac-let): Use sys:expand-with-free-refs to expand the rng forms, capturing the extra information which enables the implementation of the warning. The rng variants are refactored to pass the original form to the sys:rng expander. This allows the diagnostic to display the original rng form. (awk): Parameter e renamed to outer-env, and passed to sys:awk-expander.
* bugfix: no restart catch in compile-warning.Kaz Kylheku2017-02-091-1/+3
| | | | | | * share/txr/stdlib/error.tl (compile-warning): Wrap throw in a catch with a continue handler to properly implement the warning protocol.
* Version 168.txr-168Kaz Kylheku2017-02-021-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Adding whena macro.Kaz Kylheku2017-02-051-0/+3
| | | | | | | | | | We have ifa and conda; whena is conspicuously absent. * lisplib.c (ifa_set_entries): Add autoload entry for whena. * share/txr/stdlib/ifa.tl (whena): New macro. * txr.1: Documented whena.
* Improve diagnostic of error during place expansion.Kaz Kylheku2017-02-041-0/+3
| | | | | | | | | | | * share/txr/stdlib/place.tl (call-update-expander, call-clobber-expander, call-delete-expander): On entry into these functions, propagaet the ancestry info to the original unexpanded body, not only into the final expanded body. This way, if errors go off during the expansion of the original, the diagnostic will have access to the info. Test case: (flet ((f ())) (set (fun f) 4)). With this patch we trace to (fun 4) and its location.
* Replace sys:cp-origin with smarter function.Kaz Kylheku2017-02-041-17/+10
| | | | | | | | | | | | | | | | sys:cp-origin blindly propagates macro origin into a tree structure, and has to perform a complicated circularity check to avoid introducing cycles We replace it with a new function which looks only for invocations of the local setter, getter or deleter macros within the tree structure and sets the macro origin only into those forms. * share/txr/stdlib/place.tl (sys:cp-origin): Function removed. (sys:propagate-ancestor): New function. (call-update-expander, call-clobber-expander, call-delete-expander): Use new function.
* Dump deferred warnings when eval exception thrown.Kaz Kylheku2017-02-031-0/+1
| | | | | | | | * 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.
* Remove sys:*lisp1* hack from place expansion.Kaz Kylheku2017-02-031-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | Instead of using a special variable hack to pass down the request to treat a form as Lisp-1 if it happens to be a symbol, we now wrap the form in ^(sys:l1-val ,form). We define sys:l1-val as a place. In the case when form is a symbol with no lexical binding, requiring the special Lisp-1 treatment, sys:l1-val produces ^(sys:lisp1-value, form). We define that as a place also, and that takes care of everything. * share/txr/stdlib/place.tl (sys:*lisp1*): Special variable removed. (sys:sym-update-expander, sys:sym-clobber-expander): Do not test sys:*lisp1*; just produce a sys:setq form for updating a symbolic place. (call-update-expander, call-clobber-expander, call-delete-expander): Drop the bugfix in the previous commit: re-binding of sys:*lisp1* to nil (defplace sys:l1-val, defplace sys:lisp1-value): New places. (defplace dwim): Do not bind sys:*lisp1*. Wrap obj-place in a sys:l1-val form, thereby annotating it so that it receives the right sort of place expander.
* bugfix: limit depth of Lisp-1 treatment of places.Kaz Kylheku2017-02-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This underscores why sys:*lisp1* is so hacky and should be removed. When we obtain the update, clobber or delete expander of a place which is the argument of a DWIM, requiring Lisp-1 treatment, we bind the sys:*lisp1* special. This alters the behavior of obtaining an expander for a symbolic place. Unfortunately, because call-update-expander (and friends) use sys:expand, all levels of the form are subject to place expansion with sys:*lisp1* bound to t. Example: (set [(car (inc a 2)) 10] "foo") Here, the (car ...) form is the place operand of the DWIM operator, and so sys:*lisp1* is set up around getting its expander. But then, oops, the a in (inc a 2) is also treated as Lisp-1, wrongly. These changes band-aid the situation. * share/txr/stdlib/place.tl (call-udpate-expander, call-clobber-expander, call-delete-expander): After retrieving the expander, bind sys:*lisp1* to nil so that its effect does not spill over into the sys:expand call which we apply to the expansion; i.e. reset sys:*lisp1* to nil around recursive expansion so that the Lisp-1 treatment is confined to depth 1.
* Version 167.txr-167Kaz Kylheku2017-02-021-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* awk: support list of string as input source.Kaz Kylheku2017-01-291-1/+4
| | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state loop): Allow an input source to be a list of strings, which is converted to a stream. * txr.1: Documented.
* catch: expand param macros before inserting arg.Kaz Kylheku2017-01-291-2/+5
| | | | | | | * share/txr/stdlib/except.tl (catch): Expand the parameters and body of each clause with sys:expand-params to get rid of parameter macros. Then insert the leftmost gensym. This now allows parameter macros to be used in cach clauses.
* Version 166.txr-166Kaz Kylheku2017-01-261-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* awk macro: provide name of current input via fname.Kaz Kylheku2017-01-261-0/+5
| | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): New slot, file-name. (sys:awk-state loop): Set file-name from current input name, or else from the stream name property if the current input is a stream object. (sys:awk-mac-let): New awk macro, fname. * txr.1: Documented fname.
* awk macro: bind *stdin* to current input stream.Kaz Kylheku2017-01-261-5/+5
| | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state loop): Instead of using the lexical variable stin, use *stdin*, so that the standard input stream is re-bound. * txr.1: Documented binding and scope of *stdin*.
* Local macrolets in build become functions.Kaz Kylheku2017-01-251-5/+5
| | | | | | | | | | * share/txr/stdlib/build.tl (sys:list-builder-macrolets): Function renamed to sys:list-builder-flets. Builds local functions instead of macrolets. (build): Follow rename of sys:list-builder-macrolets. * txr.1: Documentation updated and example added of use of add as a higher order function.
* New handle* macro, analogous to catch*.Kaz Kylheku2017-01-251-4/+12
| | | | | | | | | | | * share/txr/stdlib/except.tl (sys:expand-handle): New function. (handle): Use sys:expand-handle to expand arguments. The previously unused :whole form argument is now put to use, and correctly captured using :form rather than :whole. (handle*): New macro. * txr.1: Documented.
* New catch*, giving access to exception symbol.Kaz Kylheku2017-01-251-3/+10
| | | | | | | | | | | | | | | | | | * 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: use proper plist lookup in new :key macro.Kaz Kylheku2017-01-241-2/+2
| | | | | | | | * share/txr/stdlib/keyparams.tl (sys:extract-keys, sys:extract-keys-p): Use the brand new memp function rather than memq. memq is not correct for plist lookup because of ambiguities like (:foo :bar :bar 3) where memq retrieves (:bar :bar 3) for :bar rather than (:bar 3).
* Support keyword params via :key param list macro.Kaz Kylheku2017-01-231-0/+96
| | | | | | | | | | | | | | | | | | * 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.