summaryrefslogtreecommitdiffstats
path: root/share
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* Bump copyright year to 2017.Kaz Kylheku2017-01-2321-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* defstruct: use warning for bad baseKaz Kylheku2017-01-161-4/+4
| | | | | * share/txr/stdlib/struct.tl (defstruct): Making nonexistent base type a deferrable warning.
* defstruct uses new error reporting functions.Kaz Kylheku2017-01-161-35/+32
| | | | | | | * share/txr/stdlib/struct.tl (sys:bad-slot-syntax): Takes form argument. Uses compile-error function. (defstruct): Use modified form of sys:bad-slot-syntax and compile-error instead of throw.
* defmeth uses new error reporting.Kaz Kylheku2017-01-161-6/+9
| | | | | | | * share/txr/stdlib/struct.tl (sys:defmeth): Removing checks from here. (defmeth): Add checks here with new functions which provide location info and warning deferral/supression.
* defstruct registers tentative definition.Kaz Kylheku2017-01-161-0/+1
| | | | | * share/txr/stdlib/struct.tl (defstruct): Register the struct ame as a tentative definition.
* Functions for error reporting out of macros.Kaz Kylheku2017-01-151-0/+46
| | | | | | | | | | | | | | | | | * eval.c (eval_init): Register sys:ctx-form and sys:ctx-name intrinsics. * lisplib.c (error_set_entries, error_instantiate): New static functions. (lisplib_init): Register autoloading of error.tl via new functions. * share/txr/stdlib/error.tl: New file. * struct.c (make_struct_type): Purge deferred warnings. * unwind.c (uw_late_init): Register purge-deferred-warning intrinsic.
* Version 165.txr-165Kaz Kylheku2017-01-101-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New Lisp feature: param list expander.Kaz Kylheku2017-01-041-0/+34
| | | | | | | | | | | | | | | | | | | | | * eval.c (pm_table): New static variable. (expand_param_macro): New static function. (expand_params): Expand parameter list macros via expand_param_macro. (eval_init): gc-protect pm_table and initialize it. Register *param-macro* variable. * lisplib.v (pmac_set_entries, pmac_instantiate): New static functions. (lisplib_init): Register autoloading of pmac.tl via new functions. * share/txr/stdlib/pmac.tl: New file. * txr.1: Notes under defun, lambds, flet/labels and defmacro about the existence of parameter macros which add to the syntax. New Parameter List Macros section. Documented *param-macro* and define-param-expander.
* Version 164.txr-164Kaz Kylheku2017-01-011-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Bugfix: repeated expansion of catch unstable.Kaz Kylheku2016-12-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out we have a silly problem: catch is a special operator, which undergoes a macro-like expansion which alters its syntax, but uses the same operator symbol. We turn catch into a macro which expands to a sys:catch operator. * eval.c (sys_catch_s): New symbol variable. (expand_catch): Function now expands sys:catch forms without altering any syntax. (do_expand): Check for sys:catch rather than catch. Call expand_catch differently: it takes the form now instead of just the arguments, so it can return the original form if no expansion takes place. (eval_init): Initialize sys_catch_s variable. Change registration of op_catch to sys:catch symbol. * lisplib.c (except_set_entries): Add catch to the list of autoload symbols for except.tl. * share/txr/stdlib/except.tl (catch): New macro for transforming catch to sys:catch. * txr.1: Reclassify catch operator as a macro.
* New awk variable fw for fixed-width delimiting.Kaz Kylheku2016-12-261-0/+23
| | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): New slots fw, fw-prev and fw-ranges. (sys:awk-state rec-to-f): New logic to handle self.fw. (sys:awk-let): New local fw symacro. * txr.1: Documented fw.
* Version 163.txr-163Kaz Kylheku2016-12-201-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* tagbody bugfix: env not passed to expander.Kaz Kylheku2016-12-201-1/+1
| | | | | | * share/txr/stdlib/tagbody.tl (tagbody): When calling sys:expand, env was left out due to wrong parenthesis placement.
* awk macro: endpont-exclusive ranges.Kaz Kylheku2016-12-201-3/+20
| | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-mac-let): Local macro sys:rng generalized to support code generation for ranges that exclude either endpoint. Local rng macro adjusted to target this new form. Local macros rng-, -rng, and -rng- added. * txr.1: Documented.
* Adding prog and prog* macros.Kaz Kylheku2016-12-131-0/+9
| | | | | | | | | * lisplib.c (tagbody_set_entries): Add prog and prog* to autoload list. * share/txr/stdlib/tagbody.tl (prog, prog*): New macros. * txr.1: Documented.
* Version 162.txr-162Kaz Kylheku2016-12-071-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Awk macro prn becomes function.Kaz Kylheku2016-12-011-39/+47
| | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-let): Renamed to sys:awk-mac-let. Macrolet prn removed from here. (sys:awk-fun-let): New macro, provides awk functions. The prn function removed from sys:awk-mac-let is generated here. (sys:awk-fun-shadowing-env): New function. (awk): Follow rename of sys:awk-let. When expanding p-action forms, use only sys:awk-mac-let; do not include the awk functions, which do not "vaporize" unlike local macros. To compensate for not including the functions, extend the macro environment with one that shadows the functions, so that during this expansion, any global macros of the same name as awk local functions are properlly hidden. In the final expansion, include the awk functions. * txr.1: Updated documentation to consistently call prn an awk function everywhere.
* bugfix: previous loop elision fix in awk.Kaz Kylheku2016-12-011-1/+2
| | | | | | | | | | * share/txr/stdlib/awk.tl (awk): We must generate the code to bind the awk-fun under the same conditions that control whether the loop call is generated to which it is an argument. Otherwise we end up with an unbound var reference: the loop isn't elided because begin/end actions are present, but the call refers to a nonexistent variable.
* bugfix: awk must consume *args*.Kaz Kylheku2016-11-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | This problem happens when awk is issued from the command line followed by one or more arguments as exemplified by the usage txr -e '(awk ...) arg ... . In this case, after awk processes the args as input sources and completes, TXR resumes processing the command line arguments and wants to open arg as a script file! To address this problem, when awk defaults on using *args* as input sources, it consumes *args* by clearing the variable to nil. TXR's command line processing already reacts to changes in *args* by evaluated forms. Code that wants *args* to be left alone by awk can explicitly pass them in using (awk (:inputs *args*) ...). * share/txr/stdlib/awk.tl (sys:awk-state): Move default initialization of inputs into :postinit. If there are no inputs by :postinit time, then take *args* or *stdin*. If *args* is used in this default manner, then consume *args*. * txr.1: Documented.
* bugfix: awk elides loop despite begin/end clauses.Kaz Kylheku2016-11-291-1/+2
| | | | | | | | * share/txr/stdlib/awk.tl (awk): The macro must not elide the processing loop if there are :begin-file, :end-file or :end actions. All these actions must be missing, not only the, cond-actions for that elision to be valid.
* conformance: handle macro wrong clause syntax.Kaz Kylheku2016-11-291-1/+4
| | | | | | | | | | | | | | | | Contrary to the documentation, handle doesn't in fact have the same syntax as catch. It passes the exception symbol to clauses as the leftmost argument, followed by the exception arguments, whereas catch passes only the exception arguments. * share/txr/stdlib/except.tl (handle): Do not pass the exception sybmol as the leftmost argument, unless operating in TXR 161 or earlier compatibility. * tests/012/except.tl: drop exception symbol argument from handle clause. * txr.1: Compatibility note added.
* Awk: assignment to f doesn't yield new value.Kaz Kylheku2016-11-291-2/+2
| | | | | | * share/txr/stdlib/struct.tl (sys:rslotset): Return the new value that comes out of slotset, rather than the value of the method call. Also, we don't need macro-time wrapping.
* Version 161.txr-161Kaz Kylheku2016-11-271-1/+1
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* bugfix: awk macro spews warnings.Kaz Kylheku2016-11-281-8/+5
| | | | | | | | | | | | | | Rather than fix this in the awk macro, let's just have sys:expand block warnings. * eval.c (warning_continue, no_warn_expand): New static function. (eval_init): Change registration of sys:expand to point to no_warn_expand. * share/txr/stdlib/place.tl (call-update-expander, call-clobber-expander, call-delete-expander, sys:placelet-1): Remove ignwarn wrapping from sys:expand calls.
* Version 160.txr-160Kaz Kylheku2016-11-271-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Warn about unbound functions.Kaz Kylheku2016-11-271-20/+21
| | | | | | | | | | | | | | * eval.c (do_expand): If a compound form doesn't expand into anything, then let us check whether it calls an unbound function, and issue a warning. * share/txr/stdlib/place.tl (sys:pl-expand): Move function definition ahead of first use to suppress unbound function warning. Eventually we will have a relaxed model of deferred warning about this. (sys:placelet-1): Suppress warnings around call to sys:expand because we are expanding a body into which we inserted function calls without inserting their definitions.
* Expander warns about unbound variables.Kaz Kylheku2016-11-262-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (eval_exception): New static function. (eval_error): Reduced to wrapper around eval_exception. (eval_warn): New function. (me_op): Bind the rest symbol in a shadowing env to suppress watnings about unbound rest. (do_expand): Throw a warning when a bindable symbol is traversed that has no binding. (expand): Don't install atoms as last_form_expanded. * lib.c (warning_s, restart_s, continue_s): New symbol variables. (obj_init): Initialize new symbol variables. * lib.h (warning_s, restart_s, continue_s): Declared. * lisplib.c (except_set_entries): New entries for ignwarn and macro-time-ignwarn. * parser.c (repl_warning): New static function. (repl): Use repl_warning function as a handler for warning exceptions: to print their message and then continue by throwing a continue exception. * parser.y (warning_continue): New static function. (parse_once): Use warning_continue to ignore warnings. In other words, we suppress warnings from Lisp that is mixed into TXR pattern language code, because this produces too many false positives. * share/txr/stdlib/except.tl (ignwarn, macro-time-ignwarn): New macros. * share/txr/stdlib/place.tl (call-update-expander, call-clobber-expander, call-delete-expander): Ignore warnings around calls to sys:expand, because of some gensym-related false positives (we expand code into which we inserted some gensyms, without having inserted the constructs which bind them. * tests/011/macros-2.txr: Suppress unbound variable warnings from a test case. * tests/012/ifa.tl: Bind unbound x y variables in one test case. * tests/012/struct.tl: Suppress unbound variable warnings in some test cases. * uwind.c (uw_throw): If a warning is unhandled, then print its message with a "warning" prefix and then throw a continue exception. (uw_register_subtype): Eliminate the check for sub already being a subtype of sup. This allows us to officially register new types against t. (uw_late_init): Register continue exception type as a subtype of the restart type. Formally register warning type. * txr.1: Documented ignwarn.
* bugfix: unbound var in IP-slash-notation functions.Kaz Kylheku2016-11-251-6/+6
| | | | | | * share/txr/stdlib/socket.tl (sys:str-inaddr-net-impl): Use let* so that calculation of we can see dependent w variable.
* bugfix: broken test-inc macro.Kaz Kylheku2016-11-241-1/+1
| | | | | * share/txr/stdlib/place.tl (test-inc): Expander refers to unbound variable.
* Version 159.txr-159Kaz Kylheku2016-11-211-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Diagnose undefined functions in trace.Kaz Kylheku2016-11-191-1/+3
| | | | | | | | | * share/txr/stdlib/trace.tl (sys:trace): If symbol-function returns nil, throw exception. * txr.1: Document the behavior, along with return values of trace and untrace, and the tolerance of untrace to bad arguments.
* Allow global macros to be denoted by (macro sym).Kaz Kylheku2016-11-191-0/+8
| | | | | | | | | | | | | | | | | In this patch we allow (symbol-function '(macro sym)), (defun (macro sym) (form env) ...), and (trace (macro sym)). * eval.c (macro_s): New symbol variable. (lookup_fun, func_get_name, op_defun): Support (macro sym) syntax. (builtin_reject_test): Pass through (macro sym) syntax. (eval_init); Initialize macro_s. * share/txr/stdlib/place.tl (sys:get-fun-getter-setter): Support macro place. * txr.1: Documented verything.
* Bugfix: cannot untrace individual method.Kaz Kylheku2016-11-191-1/+1
| | | | | * share/txr/stdlib/trace.tl (sys:*trace-hash*): Hash must be equal-based to correctly support compound places.
* Adding a tagbody macro to the language.Kaz Kylheku2016-11-181-0/+75
| | | | | | | | | | | | | | | | | | | | | | | This is a "disciplined goto" feature of Common Lisp. This uses a new sys:switch operator, which could also be used for optimizing case and cond forms. * eval.c (switch_s): New symbol variable. (op_switch, expand_list_of_form_lists, expand_switch): New static functions. (do_expand): Hook in the expansion of the sys:switch operator. (eval_init): Initialize switch_s special variable to sys:switch symbol. Register sys:switch special op. * lisplib.c (tagbody_set_entries, tagbody_instantiate): New static functions. (lisplib_init): Register autoloading of tagbody module via new functions. * share/txr/stdlib/tagbody.tl: New file. * txr.1: Documented.
* Completion of fallback list implementation.Kaz Kylheku2016-11-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | * lib.c (find_symbol): New function. (symbol_present): Search the fallback list also to determine whether the symbol is visible. * lib.h (find_symbol): Declared. * parser.y (sym_helper): Implement a new behavior for qualified symbols. Interning new symbols is only allowed for packages that have an empty fallback list. * parser.c (get_visible_syms): New static function. (find_matching_syms): Use get_visible_syms to get the list of eligible symbols. This way the fallback list of the package is included if it is the current package. * share/txr/stdlib/package.tl (defpackage): Do not insert a default (:use usr) if there is no :usr clause. Since defpackage is very new, no need for backward compatibility; the amount of code depending on this is likely zero. * txr.1: Documented fallback list feature.
* Start of fallback package list implementation.Kaz Kylheku2016-11-161-0/+3
| | | | | | | | | | | | | | | | | | | | * eval.c (eval_init): Register package-fallback-list and set-package-fallback-list intrinsics. * lib.c (package_fallback_list, set_package_fallback_list, intern_fallback): New functions * lib.h (package_fallback_list, set_package_fallback_list, intern_fallback): Declared. * parser.y (sym_helper): Slightly restructure function so that the symbol interning is done separately in the various cases. In the unqualified symbol case, use intern_fallback to search the fallback list of the current package. * share/txr/stdlib/package.tl (defpackage): Implement :fallback clause.
* Version 158.txr-158Kaz Kylheku2016-11-151-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New in-package macro.Kaz Kylheku2016-11-141-0/+7
| | | | | | | | | * lisplib.c (package_set_entries): Add in-package symbol name to autload list. * share/txr/stdlib/package.tl (in-package): New macro. * txr.1: Documented.
* Version 157.txr-157Kaz Kylheku2016-11-141-1/+1
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Fix spectacular bug in number of syntactic places.Kaz Kylheku2016-11-131-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test case: (symacrolet ((f g)) (set [f x] y)) fails to expand. The root cause is that f is not expanded, because a nil environment is passed down to with-update-expander macro. This problem affects not only the dwim place, but nthcdr, sub and others. This bug was surprising at first because the Awk macro establishes the field array f via symbol macro. But assignments like (set [f 0] ...) worked! The thing is, they only worked by fluke due to the way expansions are handled in the Awk macro. That fluke came to an end in the November 4 commit 157fd76ee20125f409929b95b768b931268b43cf, just before 156 was released. The changes there don't cause this problem, but they remove the circumstances which protect the awk macro from the problem. So yes, that commit effectively caused another regression in 156: assignment to awk fields not working. * share/txr/stdlib/place.tl (nthcdr, nthlast, ref, sub, dwim): Do not pass an environment value of nil to with-update-expander! Pass the value of the special variable sys:*pl-env* which is there exactly for this purpose: to give to place expanders like these the original macro environment where the form occurs, so they can expand embedded places.
* New functions for command or file I/O in one call.Kaz Kylheku2016-11-131-0/+83
| | | | | | | | | | | | | | | | * lisplib.c (getput_set_entries, getput_instantiate): New static functions. (dlt_register): Register auto-loading for getput module via new functions. * share/txr/stdlib/getput.tl: New file. * txr.1: Documented new functions file-get, file-put, file-append, file-get-string, file-put-string, file-append-string, file-get-lines, file-put-lines, file-append-lines, command-get, command-put, command-get-string, command-put-string, command-get-lines, and command-put-lines.
* New :use-from clause in defpackage.Kaz Kylheku2016-11-111-1/+23
| | | | | | | | * share/txr/stdlib/package.tl (defpackage): Implemented new :use-from clause. * txr.1: Documented :use-from and made some improvements to the defpackage documentation.