summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* Version 194.txr-194Kaz Kylheku2018-04-301-1/+1
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* Version 193.txr-193Kaz Kylheku2018-04-261-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* compiler: implement eliding of blocks.Kaz Kylheku2018-04-241-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is time-wasting to have a block in every function. In this patch we have the compiler eliminate blocks if it is obvious that they will not be the targets of any exits or continuation captures through any direct function calls. If a block contains only calls to library functions, and doesn't call certain functions, then it is removed. It is possible for this removal to be strictly wrong and different from interpreted code. This is true if the code enclosed in a block invokes a function indirectly or via a quoted symbol, and that function tries to return from the block or capture a continuation using that block as a prompt. Such a call doesn't prevent the block from being removed. For instance, this won't work in compiled code any more: (defun tricky (fun) (call fun)) (tricky (lambda () (return-from tricky 42))) The call function is considered safe; the (call fun) form doesn't prevent the block inside the tricky function from being removed. * share/txr/stdlib/compiler.tl (blockinfo): New struct. (env): New slot, bb. (env lookup-block, env extend-block): New methods. (%block-using-funs%): New global variable. (compiler comp-block): Implement the elision of the block based on what free functions are referenced in the body, and whether the block is referenced lexically. Also, bind the block in the environment using the bb member in the env structure. (comp-return-from): Lookup the block lexically and mark it as used. (system-symbol-p): New function. * txr.1: Document the rules for elision of blocks.
* New macro: load-time.Kaz Kylheku2018-04-231-0/+297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is similar to the ANSI CL load-time-value. * eval.c (load_time_s, load_time_lit_s): New symbol variables. (op_load_time_lit, me_load_time): New static functions. (eval_init): Intern load-time symbol and sys:load-time-lit. Register the sys:load-time-lit special operator and load-time macro. * share/txr/stdlib/asm.tl (assembler parse-args): We must now allow the d registers to be the targets of a mov instruction, because load-time depends on being able to mutate the data vector, in order to turn the result of a calculation into a de facto literal. * share/txr/stdlib/compiler.tl (compiler): New member, lt-frags. (compile-in-toplevel): New macro. (compiler alloc-dreg): New method. (compiler compile): Handle sys:load-time-lit special form via comp-load-time-lit method. (compiler comp-load-time-lit): New method. (usr:compile-toplevel): Prepend the load-time assembly code fragments to the compiled assembly code. * vm.c (vm_set, vm_sm_set): Do not reject an attempt to modify the static data, since load-time now generates mov instructions targetting the d registers. * txr.1: Document load-time.
* Version 192.txr-192Kaz Kylheku2018-04-191-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* doc: continuations: compiled vs interpreted.Kaz Kylheku2018-04-191-1/+38
| | | | | | | | * txr.1: Turn the comparison with lexical closures into a named subsection instead of Notes. Add subsection about mutated lexical variables and continuations: how the behavior can differ between interpreted and compiled code. Point user to the hlet and hlet* macros.
* new macros: hlet, hlet*.Kaz Kylheku2018-04-191-0/+22
| | | | | | | | | | * lisplib.c (yield_set_entries): Add hlet and hlet* to autoload list. * share/txr/stdlib/yield.tl (hlet-expand): New function (hlet, hlet*): New macros. * txr.1: Documented.
* compiler: don't expand top-level forms twice.Kaz Kylheku2018-04-181-1/+7
| | | | | | | | | | * share/txr/stdlib/compiler.tl (usr:compile-toplevel): Support optional parameter indicating that no expansion is required. (usr:compile-file): Call compile-toplevel with a t argument for the new expanded-p parameter, so no further expansion takes place. * txr.1: Document new optional parameter of compile-toplevel.
* Version 191.txr-191Kaz Kylheku2018-04-101-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* doc: new package fallback use by printer.Kaz Kylheku2018-04-101-1/+3
| | | | | * txr.1: Update the description of how the printer avoids ambiguity when making use of the packag fallback list.
* doc: document new pub package.Kaz Kylheku2018-04-091-11/+32
| | | | | | * txr.1: Fix places which say that *package* is initialized to the user package. Under *package*, describe the pub package. Compat notes added.
* doc: vm-fun-p described.Kaz Kylheku2018-04-091-0/+22
| | | | * txr.1: Document vm-fun-p.
* compiler: implement with-compilation-unit macro.Kaz Kylheku2018-04-091-0/+35
| | | | | | | | | | | | * lisp.c (compiler_set_entries): Add with-compilation-unit to autoload symbols for compile module. * share/txr/stdlib/compiler.tl (usr:with-compilation-unit): New macro. (usr:compile-file): Use with-compilation-unit macro to dump warnings if a file is processed alone. * txr.1: Documented.
* doc: document force-flag.Kaz Kylheku2018-04-091-5/+92
| | | | | | * txr.1: Documented force-break and the altered return value of width-check. The existence of a stream's force flag is mentioned under width check.
* doc: document disassemble.Kaz Kylheku2018-04-091-0/+51
| | | | * txr.1: Adding description of disassemble function.
* doc: describe new ldiff.Kaz Kylheku2018-04-091-87/+160
| | | | | * txr.1: ldiff documentation moved under Sequence Manipulation and rewritten. Compatibility note added.
* doc: copy-paste errors in structs.Kaz Kylheku2018-04-081-3/+3
| | | | | | * txr.1: Fixed syntax synopsis under struct-type using structp. Improved some wording here. Fixed static-slot-home's syntax synopsis wrongly referring to static-slot-ensure.
* doc: document more about file compilation.Kaz Kylheku2018-04-081-0/+143
| | | | | * txr.1: Add descriptions of compile-file, compile-only and eval-only.
* doc: starting to document compilation.Kaz Kylheku2018-04-081-7/+286
| | | | | * txr.1: Description of load includes treatment of .tlo files. New major section on Lisp compilation.
* macro param lists: remove colon hack.Kaz Kylheku2018-04-041-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Going forward, when : appears as the argument of an optional parameter in destructuring, it is treated as an ordinary object, and not as "this argument is missing". That is now a feature of function calls only. Rationale: interferes with macros. For instance, the pattern (test : then else) doesn't correctly express the arguments of if, because (if x y :) eats the semicolon. The defaulting behavior is not useful because usually there is no default value for optional structure, other than nil. * eval.c (bind_macro_params): Only implement the colon hack under compatibility with 190. * share/txr/stdlib/place.tl (defplace gethash, defplace fun, defplace symbol-function, defplace symbol-macro, defplace symbol-value): Remove uses of : for defaulting the ssetter argument. This illustrates how useless the feature is for macro destructuring; all these just replace with nil. * txr.1: Clarify that macro parameter lists don't implement the colon trick. It was never explicitly specified that this is the case, but could have been inferred from the statements which indicate that macro parameter lists copy the features of function parameter lists. Added compat notes.
* doc: codify infinite looping behavior of each.Kaz Kylheku2018-03-301-0/+6
| | | | | | | | | * txr.1: the each, append-each and all other variants of operators exhibit inifite looping if the list of bindings is empty. In that case, the terminating condition that at least one list is empty, is never true. The behavior is consistent under compilation and interpretation, so let's just document it.
* doc: null char in str out stream: incorrect.Kaz Kylheku2018-03-301-4/+8
| | | | | | | * txr.1: The described behavior regarding null bytes output into string output streams is incorrect. In fact they are effectively dropped by the put-char operation. Let's not commit to any specific behavior. Also mention pseudo-null.
* doc: incorrect text in rlet exampleKaz Kylheku2018-03-301-3/+2
| | | | * txr.1: Example isn't about swapping variables.
* doc: mistake in ldiff example.Kaz Kylheku2018-03-301-1/+1
| | | | * txr.1: A let in the example should be let*.
* doc: fix too-wide-for-80-cols syntax synopses.Kaz Kylheku2018-03-291-3/+6
| | | | | * txr.1: defmacro, macrolet and mac-param-bind syntax synopses are too wide under 80 column "man txr": breaking up.
* packages: drop no-fallback-list interning restriction.Kaz Kylheku2018-03-091-30/+6
| | | | | | | | | | | | | Removing the restriction that qualified pkg:sym syntax may not cause interning to take place if pkg has a nonempty fallback list. This serves no purpose, only hindering the flexibility of the package system. * parser.y (sym_helper): When processing a qualified symbol, if the package exists, just intern it. * txr.1: Revise all text which touched on the removed rule, to remove all traces of it from the documentation.
* New function: bignum-len.Kaz Kylheku2018-03-061-0/+32
| | | | | | | | | * arith.c (bignum_len): Wew function. (arith_init): Register bignum-len intrinsic. * arith.h (bignum_len): Declared. * txr.1: Documented.
* bugfix: missing actions in reset-struct.Kaz Kylheku2018-02-281-1/+30
| | | | | | | | | | | | * struct.c (reset_struct): Perform the post-init actions are performed, not only the init actions. Also, catch exceptions and call finalizers, just like in a new structure instantiation. * txr.1: Document the requirements for finalizers being called by reset-struct, and clarify the issue of possible duplicate finalization registration. Add compat notes.
* doc: wrong pluralizations of "function".Kaz Kylheku2018-02-271-3/+3
| | | | | | * txr.1: Fix three unrelated occurrences of the same mistake: "functions is", in reference to a single function.
* Version 190.txr-190Kaz Kylheku2018-02-181-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* New listener feature: greedy evaluation feature.Kaz Kylheku2018-02-171-0/+69
| | | | | | | | | | | | | | | | * eval.c (eval_intrinsic_noerr): New function. * eval.h (eval_intrinsic_noerr): Declared. * parser.c (listener_greedy_eval_s): New symbol variable. (repl): Implement greedy evaluation loop, enabled by the *listener-greedy-eval-p* special. (parse_init): Intern the *listener-greedy-eval-p* symbol, storing it in the listener_greedy_eval_s variable. Register the symbol as a special variable. * txr.1: Documented *listener-greedy-eval-p* variable and the greedy evaluation feature that it controls.
* Lisp load function supports .txr files.Kaz Kylheku2018-02-161-23/+78
| | | | | | | | | | | | * eval.c (load): Instead of throwing error when a .txr file is opened, process it according to sensible requirements. * match.c (v_load): Store bindings in the current environment frame before evaluating Lisp, and then update afterward. This allows .txr files loaded from Lisp to continue matching with the current bindings and extend those bindings. * txr.1: Update documentation of load.
* Copyright year bump 2018.Kaz Kylheku2018-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl, share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl, share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl, share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl, share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.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, signal.c, signal.h, socket.c, socket.h, stream.c, stream.h, struct.c, struct.h, strudel.c, strudel.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, win/cleansvg.txr: Extended Copyright line to 2018.
* doc: fix compat note 156, again.Kaz Kylheku2018-02-141-2/+4
| | | | | | * txr.1: Add missing text to compensate for text that was accidentally edited out, regarding the return value of the empty case of caseq/caseql/casequal.
* New listener variable: *listener-pprint-s*.Kaz Kylheku2018-02-121-0/+21
| | | | | | | | | | * parser.c (listener_pprint_s): New symbol variable. (repl): Check new variable after each evaluation and print accordingly. (parse_init): Initialize listener_print_s with interned symbol and register the variable. * txr.1: Document *listener-pprint-s*.
* Version 189.txr-189Kaz Kylheku2018-02-061-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* doc: write Equality Substitution section.Kaz Kylheku2018-02-051-0/+63
| | | | | | * txr.1: Several places in the document refer to a section called Equality Substitution which supposedly exists under the Structures section. As of now, it actually does!
* doc: clarify text under constantpKaz Kylheku2018-02-051-3/+3
| | | | | * txr.1: Restructure long sentence for readability, fixing awkward comma in the process.
* doc: more detail in ref/refset re: structs.Kaz Kylheku2018-01-311-5/+32
| | | | | | * txr.1: Describe fallback of ref and refset onto list-like operations if lambda/lambda-set are not supported.
* doc: grammatic agreement under equal method.Kaz Kylheku2018-01-301-1/+1
| | | | * txr.1: "behavior ... becomes" second person agreement.
* doc: bad formatting of lambda-set syntaxKaz Kylheku2018-01-301-1/+1
| | | | * txr.1: Fix run-on parenthesis.
* doc: clarification in :maxgap example.Kaz Kylheku2018-01-261-1/+1
| | | | | * txr.1: a :maxgap of zero also means that the collected items must match immediately.
* doc: fix "five lines" typo in :maxgap description.Kaz Kylheku2018-01-261-1/+3
| | | | | | Reported by Martin Dvořák. * txr.1: Word "five" should be "n".
* doc: fix mistake in summary of @(repeat)Kaz Kylheku2018-01-261-2/+2
| | | | | | | Reported by Martin Dvořák. * txr.1: In pattern matching clauses, repeat and rep are shorthands for collect and coll.
* doc: formatting of in directives intro.Kaz Kylheku2018-01-261-1/+3
| | | | * txr.1: use mono font for @(output).
* doc: some clarifications about dwim brackets.Kaz Kylheku2018-01-251-6/+13
| | | | | | txr.1: The equivalences between [x i] and some functions like ref are dynamic; they depend not only on the type ofx, but also whether i is a range or integer.
* doc: update car, cdr, rplaca, rplacd.Kaz Kylheku2018-01-081-26/+114
| | | | | | | | | | | * txr.1: Update the documentation to reflect the current handling of objects, eliminating some contradictions in the process, like text which says that rplacd is erroneous on anything but conses and lazy conses, followed by text which states other kinds of objects are allowed. The semantics of car and cdr forms as places is described strictly in terms of rplaca and rplacd, so the mechanism is then described in one place.
* sub and replace redirect to structure methods.Kaz Kylheku2018-01-011-0/+81
| | | | | | | | | | | | | * lib.c (replace_obj): New static function. (sub): Handle struct case via lambda method. (replace): Handle struct case via replace_obj. * txr.1: Documented. * tests/012/aseq.tl (add): The lambda method now has to handle a range argument. One test case uses the last function, which for non-lists relies on sub, which now calls the lambda method if the object has one.
* New methods rplaca and rplacd.Kaz Kylheku2017-12-301-0/+66
| | | | | | | | | | | | | | | * eval.c (eval_init): Register rplaca and rplacd using new rplaca_s and rplacd_s symbol variables. * lib.c (rplaca_s, rplacd_s): New symbol variables. (rplaca): Handle struct object via rplaca method, if it has one, otherwise lambda-set, if it has that, or else error out. (rplacd): Handle struct object via rplacd method. * lib.h (rplaca_s, rplacd_s): Declared. * txr.1: Documented rplaca and rplacd methods.
* doc: invoke-catch: no such function as get-framesKaz Kylheku2017-12-291-2/+3
| | | | | * txr.1: Fix wording under invoke-catch which refers to a nonexistent function called get-frames.