summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* sum and prod take keyfun argument.Kaz Kylheku2019-02-021-13/+23
| | | | | | | | | | | | | * eval.c (eval_init): Adjust registrations of sum and prod to be binary functions with an optional argument. * lib.c (nary_op_keyfun, sumv, prodv): New static functions. (sum, prod): Implement optional keyfun argument via sumv and prodv helpers. * lib.h (sum, prod): Declarations updated. * txr.1: Documentation updated.
* compiler: new dump-compiled-objects function.Kaz Kylheku2019-02-011-0/+93
| | | | | | | | | | | | | * lisplib.c (compiler_set_entries): Register dump-compiled-objects for auto-loading. * share/txr/stdlib/compiler.tl (usr:dmp-to-tlo): New function. (compile-file): Code to be shared with dump-compiled-objects moved into dump-to-tlo function. (usr:dump-compiled-objects): New function. * txr.1: Documented.
* doc: document string and bignum merging.Kaz Kylheku2019-01-311-0/+55
| | | | * txr.1: New section on Treatment of literals.
* Version 208.txr-208Kaz Kylheku2019-01-281-2/+2
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* command line: support -f in Hash Bang Null Hack.Kaz Kylheku2019-01-281-0/+58
| | | | | | | | | | | | * txr.c (txr_main): In processing the -f option, if there is already an input source, but its name exactly matches the argument of the -f option, then ignore the -f and its option intead of terminating with a diagnostic. This allows the user to use -f in the Null Hack to achieve the usual trick of allowing the script to take options passed through to the interpreter. * txr.1: Documented.
* Version 207.txr-207Kaz Kylheku2019-01-261-3/+3
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* doc: review of Lisp CompilationKaz Kylheku2019-01-201-3/+14
| | | | | | | | * txr.1: eval mistakenly referred to instead of compile-file under Compile File. Spurious pluralization of literals fixed. New "Bound symbols in dwim" heading to separate text from discussion of unbound symbols in dwim. Clarifying text added about compile-toplevel's treatment of form.
* Version 206.txr-206Kaz Kylheku2019-01-181-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* carray: fix vec/list conversion bug.Kaz Kylheku2019-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | If a zero-length carray is converted with vec-carray or list-carray and the null-term-p argument is t, there is an exception about a negative index. An empty vector or list should be returned in this case, and the documentation says exactly that. Also, if a carray of unknown length is converted, there is an exception from vec-carray, as documented, but it's an uninformative one that is incidentally produced when -1 is passed to the vec function. The list-carray just returns nil, contravening the documentation. * ffi.c (vec_carray, list_carray): Fix the problems described above. * txr.1: Reviewing the documentation for these functions, an improperly terminated sentence was found.
* Copyright year bump 2019.Kaz Kylheku2019-01-161-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.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/asm.tl, share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl, share/txr/stdlib/compiler.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/trace.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.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, vm.c, vm.h, vmop.h, win/cleansvg.txr: Extended Copyright line to 2018.
* doc: with-dyn-lib mention other deffi-* macros.Kaz Kylheku2019-01-161-4/+18
| | | | | * txr.1: with-dyn-lib relates not only to deffi but also deffi-var and deffi-sym.
* Version 205.txr-205Kaz Kylheku2019-01-151-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* ffi: arrays: be more forgiving of length mismatches.Kaz Kylheku2019-01-151-0/+4
| | | | | | | | | | * ffi.c (min): New macro. (ffi_array_put_common): Tolerate sequences which are shorter than the array. Use seq_info to classify the sequence and use separate code for the vector and list case, avoiding taking the length of the list. * txr.1: Documented.
* New function: square.Kaz Kylheku2019-01-051-0/+20
| | | | | | | | | | | | | The square function calulates (* x x) but is faster for bignum integers by taking advantage of mp_sqr. * arith.c (square): New function. * eval.c (eval_init): Register square as intrinsic. * lib.h (square): Declared. * txr.1: Documented.
* doc: formatting under lop.Kaz Kylheku2018-12-241-2/+2
| | | | | | * txr.1: Closing quote didn't come out in .codn; we must use the \(dq code in this context. Let's make the opening quote \(dq also for consistency.
* doc: grammar fixes under registeer-tentative-def.Kaz Kylheku2018-12-241-4/+2
| | | | | * txr.1: Wrong tense/person of "to expect"; spurious occurrence of foo identifier deleted.
* doc: formatting under caseql*.Kaz Kylheku2018-12-241-1/+1
| | | | * txr.1: .meti should be used to typeset code inline.
* Version 204.txr-204Kaz Kylheku2018-12-171-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* nzerop: new function.Kaz Kylheku2018-12-131-1/+24
| | | | | | | | | | * arith.c (nzerop): New function. * eval.c (eval_init): Register nzerop intrinsic. * lib.h (nzerop): Declared. * txr.1: Documented.
* Version 203.txr-203Kaz Kylheku2018-11-291-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* doc: bad formatting under --noninteractiveKaz Kylheku2018-11-281-1/+3
| | | | * txr.1: Fix .code macro occurring in middle of line.
* New range testing functions.Kaz Kylheku2018-11-271-0/+52
| | | | | | | | | | | * eval.c (eval_init): Register in-range and in-range* intrinsics. * lib.c (in_range, in_range_star): New functions. * lib.h (in_range, in_range_star): Declared. * txr.1: Documented.
* doc: caseql* macro expands cases in global envKaz Kylheku2018-11-271-1/+1
| | | | | | * txr.1: Use the correct term "global environment" rather than "dynamic environment" to desribe the scope in which caseq*, caseql* and casequal* expand the key forms.
* doc: avoid "empty lexical environment".Kaz Kylheku2018-11-271-4/+5
| | | | | | | | | * txr.1: Replace the term "empty lexical environment" with "global environment" in a few places. In one case, it is removed, and the surrounding wording is adjusted. The "empty lexical environment" term is poor because the situations which it describes retain visibility of the "global lexical" variables.
* doc: clarify pretty printing.Kaz Kylheku2018-11-251-3/+34
| | | | | * txr.1: adding more details to description of the effect of pretty printing.
* print: keep colon in keyword symsKaz Kylheku2018-11-251-1/+9
| | | | | | | | * lib.c (obj_print_impl): Always include leading colon when printing keyword symbols, regardless of pretty flag. Subject to backward compatibility. * txr.1: Compat note added.
* doc: refresh documentation of make-lazy-consKaz Kylheku2018-11-251-8/+34
| | | | | | * txr.1: Documentation of make-lazy-cons revised with important clarifications and details, and removal of some overly informal language.
* logxor: fix seriously broken function.Kaz Kylheku2018-11-251-0/+7
| | | | | | | | | | | | | Reported by Guillaume le Vaillant. * arith.c (logxor): Fix broken behavior when the arguments are the same nonzero fixnum, or the same bignum object. (logxor_old): New function: verbatim copy of previous logxor. * eval.c (eval_init): Register logxor intrinsic to the broken function if compatibility is 202 or less. * txr.1: Compat note added.
* Version 202.txr-202Kaz Kylheku2018-11-221-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* doc: clarify delimited continuation compiled semanticsKaz Kylheku2018-11-181-10/+30
| | | | | | | | | | * txr.1: Text describing the changes in behavior, under delmited continuations, of compiled code that mutates variables seemed unclear; it is revised. Also, in the section that discusses compiled versus interpreted differences under Lisp Compilation, a paragraph is added mentioning delimited continuations, referring the reader to this detailed section.
* doc: move functionpKaz Kylheku2018-11-171-14/+14
| | | | | * txr.1: functionp belongs under Functions, not Global Environment.
* doc: use bulleted list under copy.Kaz Kylheku2018-11-171-56/+29
| | | | | * txr.1: Present the type cases of the copy function using a more compact and visually appealing bulleted list.
* copy: call copy-fun for functions.Kaz Kylheku2018-11-171-0/+6
| | | | | | * lib.c (copy): Handle FUN type through copy_fun. * txr.1: Documented.
* compile: handle functions that have environments.Kaz Kylheku2018-11-131-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch, the compile function can handle interpreted function objects that have captured environments. For instance, if the following expression is evaluated (let ((counter 0)) (labels ((bm () (bump)) (bump () (inc counter))) (lambda () (bm)))) then a function object emerges. We can now feed this function object to the compile function; the environment will now be handled. Of course, the above expression is already compileable; compile-toplevel handles it and so does the file compiler. This patch allows the expression to be interpreted and then the function object to be compiled, without access to the surrounding expression. The compiled function will contain a compiled version of the environment, carrying compiled versions of the captured variables and their contents. * eval.c (env_vbindings, env_fbindings, env_next): New static functions. (eval_init): Register env-vbinding, env-fbindings and env-next intrinsics. * share/txr/stdlib/compiler.tl (sys:env-to-let): New function. (usr:compile): Wrap the interpreted lambda terms with let bindings carefully reconstructed from their captured environments. * txr.1: Documented new intrinsic functions.
* copy-fun: duplicate a function, with own environment.Kaz Kylheku2018-11-131-0/+36
| | | | | | | | | | | | | | | | | * eval.c (deep_copy_env): New function. (eval_init): Register copy-fun intrinsic. * eval.h (deep_copy_env): Declared. * lib.c (copy_fun): New function. * lib.h (copy_fun): Declared. * vm.c (vm_copy_closure): New function. * vm.h (vm_copy_closure): Declared. * txr.1: Documented copy-fun.
* doc: corrections under Referencing DotKaz Kylheku2018-11-111-6/+9
| | | | | * txr.1: Don't start sentence with And. Revise and correct description of associativity of referencing dot.
* doc: changes to introKaz Kylheku2018-11-111-27/+39
| | | | | | * txr.1: Substantially revising introductory paragraphs. Mentioning compiling and stand-alone application deployment. Mention licensing freedom.
* doc: listener suspend doesn't "depend" on job controlKaz Kylheku2018-11-111-2/+6
| | | | | | | * txr.1: Revise wording implying that the Ctrl-Z suspend depends on POSIX job control. Job control is required for it to allow TXR to be foregrounded after it suspends. That is not our problem.
* doc: listener: remove irrelvant historic notesKaz Kylheku2018-11-111-9/+2
| | | | | | * txr.1: In descriptions of multi-line mode, remove notes about behavior changes between TXR 178 and 179. This doesn't affect TXR program and is probably of no interest to anyone.
* doc: fixes under Null Hack description.Kaz Kylheku2018-11-111-9/+11
| | | | | * txr.1: Fix awkward wording about env's dispatch of txr, and references to wrong user name in examples.
* Version 201.Kaz Kylheku2018-11-071-3/+3
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* doc: load: document hash bang treatment.Kaz Kylheku2018-11-061-0/+8
| | | | | * txr.1: Document that the load function ignores the hash bang line in both compiled and source files.
* doc: split/split*: formatting of syntaxKaz Kylheku2018-11-061-2/+2
| | | | * txr.1: Fix funny formatting.
* compiler: bugfix: handle defpackage and such properly.Kaz Kylheku2018-11-051-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is that the file compiler is emitting one big form that contains all of the compiled top-level forms. For obvious reasons, this doesn't work when that form contains symbols that are in a package which is defined by one of those forms; the compiled file will not load due to qualified symbols referencing a nonexistent package. The solution is to break up that big form when it contains forms that manipulate the package system in ways that possibly affect the read time of subsequent forms. * lib.c (delete_package): Use a non-destructive deletion on the *package-alist*, because we are going to be referring to this variable in the compiler to detect whether the list of packages has changed. * share/txr/stdlib/compiler.tl (%package-manip%): New global variable. This is a list of functions that manipulate the package system in suspicious ways. (user:compile-file): When compiling a form which is a call to any of the suspicious functions, add a :fence symbol into the compiled form list. Also do this if the evaluation of the compiled form modifies the *package-alist* variable. When emitting the list of forms into the output file, remove the :fence symbols and break it up into multiple lists along these fence boundaries. * txr.1: Documented the degenerate situation that can arise.
* Version 200.txr-200Kaz Kylheku2018-11-051-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* buffers: implement copy-buf.Kaz Kylheku2018-11-041-0/+22
| | | | | | | | | | | * buf.c (copy_buf): New function. (buf_init): Register copy-buf intrinsic. * buf.h (copy_buf): Declared. * lib.c (copy): Handle BUF via copy_buf. * txr.1: Documented.
* compiler: optimize dwim.Kaz Kylheku2018-11-041-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * share/txr/stdlib/asm.tl (op-getf): Rename to op-oldgetf. This opcode becomes obsolescent. (op-getf): New opcode. * share/txr/stdlib/compiler.tl (assumed-fun): New global variable. (compiler comp-fun): Use the new getf instruction which takes a function table index instead of a data table index. (compiler comp-lisp1-value): Don't use getl1 opcode any more for dynamic lisp1-style lookup. Instead, we bake the behavior at compile time perform a function lookup if the symbol is completely unbound, a variable lookup if it is bound to a variable (where we decide at compile tie whether it is lexical or dynamic) or else a function if a function binding exists at compile time. Also, if we assume that an unbound symbol is a function, put it on the assumed-fun list. (compiler comp-dwim): If the first argument is a symbol with no lexical binding, and is not bound as a variable, then treat it as a function by transforming the form into a function call form with that symbol in the car position. Put the symbol on the assumed-fun list. (compiler-emit-warnings): New function. (with-compilation-unit): Call compiler-emit-warnings when bailing out of most enclosing compilation unit. (%tlo-ver%): Bump compiled file version to 4, since we added an opcode. * vm.c (vm_execute): Follow rename of GETF to OLDGETF. Implement the new GETF. * parser.c (read_file_common): Extend version range to allow version 4 compiled files. * txr.1: Documented everything.
* The code expander becomes a public API.Kaz Kylheku2018-11-021-0/+291
| | | | | | | | | | | | | | | | | | | | | | | The functions sys:expand, sys:expand* and sys:expand-with-free-refs are now in the usr package and documented for public use. * eval.c (eval_init): Move registrations of the symbools expand, expand* and expand-with-free-refs from the system package to the user package. * share/txr/stdlib/awk.tl (sys:awk-mac-let, awk): Uses of sys:expand drop the sys: prefix. * share/txr/stdlib/op.tl (sys:op-alpha-rename): Likewise. * share/txr/stdlib/place.tl (call-upudate-expander, call-clobber-expander, call-delete-expander, sys:placelet-1): Likewise. * tests/011/macros-2.txr, tests/012/struct.tl: Likewise. * txr.1: Documented expand, expand* and expand-with-free-refs.
* doc: lexical-fun-p: mistake in code example.Kaz Kylheku2018-11-021-2/+2
| | | | * txr.1: Fix misnamed references to macro parameter.
* Hide deprecated, undocumented variables.Kaz Kylheku2018-10-301-0/+4
| | | | | | | | | | * arith.c (arith_init): Do not define *flo-dig*, *flo-max*, *flo-min*, *flo-epsilon*, *pi* and *e* unless compatibility with TXR 199 or earlier is requested. * txr.c (txr_main): Likewise for *self-path*. * txr.1: Compat note added.