summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* Copyright year bump 2021.Kaz Kylheku2021-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * METALICENSE: 2020 copyrights bumped to 2021. Added note about SHA-256 routines from Colin Percival. * LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.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, lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.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/copy-file.tl, share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl, share/txr/stdlib/each-prod.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/param.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl, share/txr/stdlib/save-exe.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, time.c, time.h, tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year bumped to 2021.
* doc: stray functions in heading and syntaxKaz Kylheku2021-01-051-3/+1
| | | | | | | | * txr.1: The documentation section for makunbound also erroneously lists the fmakunbound and mmakunbound functions in the heading and syntax block. They are not documented there, but in their own section which follows and has its own heading, so these references to them must be removed.
* progn, prog1, prog2: now also functions.Kaz Kylheku2021-01-011-5/+28
| | | | | | | | | | | | * eval.c (progn_fun, prog1_fun, prog2_fun): New static functions. (eval_init): Wire progn, prog1 and prog2 function bindings to new functions. * txr.1: Documented. * checkman.txr (check-func): Recognize Macro/function and Operators/functions heading.
* New macro: prog2Kaz Kylheku2021-01-011-4/+45
| | | | | | | | | | | | * eval.c (prog2_s): New symbol variable. (me_prog2): New macro expander function. (eval_init): Initialize prog2_s variable with interned symbol. Register prog2 macro expander. * txr.1: Maintain the documentation for progn and prog1, improving the wording and adding a dialect note . Document prog2.
* gc: do finalizers completely on one phase.Kaz Kylheku2021-01-011-6/+24
| | | | | | | | | | | | | | | | | | | | | | * gc.c (call_finalizers_impl): Iterate over the finalizer registrations until no more finalizers are identified, performing additional rounds, as necessary. Thus if finalizers register more finalizers that are eligible for processing according to the criteria of he current phase, those are done in the current phase. (gc_finalize): We must now carefully set the reachable flag to 1 for a new finalization entry. This was always the right thing to do and is logically correct: if an object is being passed to finalize, it is necessarily reachable. Leaving the 0 initialization would do bad things now, as follows. If any object whatsoever has a finalizer registered against it during GC-driven finalization, its finalizer will be called. This is bad if the object isn't garbage. Secondly, the object may be moved into generation 0, and put into the freshobj list. This is extremely bad if the object is reachable by generation 1 objects, which is now a wrong-way reference. * txr.1: Updated.
* Version 246txr-246Kaz Kylheku2020-12-311-3/+3
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* gc: add finalization count to objects.Kaz Kylheku2020-12-311-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | With the finalization count, we don't have to scan the freshobj array for duplicates when calling finalizers. However, the limited range of the counter limits how many times we can register a finalizer against an object. * gc.c (make_obj): Reset the new fincount field to zero for a newly minted object. (call_finalizers_impl): Decrement the fincount for each object. Only run the freshobj-related logic when the count hits zero. (gc_finalize): Bump the fincount of a registered object. If the counter overflows, throw an exception. * lib.h (obj_common): Add new field fincount for the finalization count. * tree.c (tr_rebuild): Fix up dummy object initializer to accommodate the new member. * txr.1: Document that there is a limit on the number of times an object can be registered for finalization.
* doc: improve awk fconv documenation.Kaz Kylheku2020-12-311-0/+16
| | | | | | * txr.1: List the no-conversion - operator among the shortcuts, so it is easier to discover. Add a note that that fconv is potentially applicable to non-string fields.
* doc: note for awk macro fconv.Kaz Kylheku2020-12-291-0/+11
| | | | * txr.1: Add usage note to the fconv macro.
* shuffle/nshuffle: take optional random state argument.Kaz Kylheku2020-12-291-3/+5
| | | | | | | | | | | | | * eval.c (eval_init): Register shuffle and nshuffle as two-argument functions with optional argument. * lib.c (nshuffle): Take random-state argument, defaulting to value of random_state special variable. (shuffle): Take random-state argument, pass down to nshuffle. * lib.h (shuffle, nshuffle): Declarations updated. * txr.1: Updated.
* doc: correction in dialect notes for symbol-macroKaz Kylheku2020-12-271-3/+5
| | | | | * doc: Common Lisp has a function like symbol-macro function; it is called macro-function.
* Version 245txr-245Kaz Kylheku2020-10-101-7/+7
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. Fixed repeated word in documentation under env-hash. * share/txr/stdlib/ver.tl: Bumped from incorrect 243 value to 245.
* env-hash: now persistent and synced with setenv.Kaz Kylheku2020-10-161-3/+63
| | | | | | | | | | | | | | * sysif.c (env_hash): Function renamed to get_env_hash and a static variable named env_hash introduced. Function returns a previously allocated hash table, if it exists, except in compat mode. (getenv_wrap): Stash the result into the hash also. (setenv_wrap): Keep the hash up-to-date with the action of setenv. (unsetenv_wrap): Also delete from the hash. (sysif_init): Protect the env_hash variable from gc. * txr.1: Documented, with compat notes.
* doc: add missing detail to env function.Kaz Kylheku2020-10-161-0/+8
| | | | | | * txr.1: The env function actually returns a cached list. Spell out that the function is not required to construct a new list.
* Version 244txr-244Kaz Kylheku2020-10-101-3/+7
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* doc: missing info about compiled file version 5.Kaz Kylheku2020-10-091-1/+3
| | | | | * txr.1: TXR 216 bumped the compiled file version from 4 to 5, but this was not documented.
* New function: time-nsec.Kaz Kylheku2020-10-071-1/+16
| | | | | | | | | | | | * configure: Test for clock_gettime, generating HAVE_CLOCK_GETTIME symbol in config.h. * time.c (time_sec_nsec): New function. (time_init): time-nsec intrinsic registered. * time.h (time_sec_nsec): Declared. * txr.1: Documented.
* random: correctly refer to WELL512a everywhere.Kaz Kylheku2020-10-071-5/+5
| | | | | | * rand.c: Refer to "WELL512a" in comment, not "WELL 512". * txr.1: Replace "WELL 512" with "WELL512a" everywhere.
* random: bugfix: incorrect WELL512a.Kaz Kylheku2020-10-071-0/+8
| | | | | | | | | | | | | | | | | | | * rand.c (rand32_bug): New static function formed by renaming the original buggy rand32. (rand32_good): Copy of rand32 with two bugfixes. The term involving variable r2 must be only left shifted by 28 bits, and not xor-ed with the original value. The order of operations is wrong in the term that contains the & operation. (rand32): New static function pointer variable, serving as the rand32 function. Points to rand32_good by default. (rand_compat_fixup): Test for 243 or lower compatibility, under which rand32 is made point to rand32_bug. This is done before the call to make_random_state for replacing *random-state*, which has to use the old function. * txr.1: compat note added. * tests/013/maze.expected: Updated.
* doc: out of order compat entries.Kaz Kylheku2020-10-071-6/+6
| | | | * txr.1: Fix out-of-order compatibility 247 and 242 entries.
* New functions trim-left and trim-right.Kaz Kylheku2020-10-051-0/+71
| | | | | | | | | * regex.c (trim_left, trim_right): New static functions. (regex_init): New intrinsics registered. * tests/015/trim.tl, tests/015/trim.expected: New files. * txr.1: Documented.
* New: quip function for random humor.Kaz Kylheku2020-10-041-0/+31
| | | | | | | | | | | | Add this to your .txr_profile startup file. * lisplib.c (quips_instantiate, quips_set_entries): New static functions. (lisplib_init): Register autoloading of quip. * share/txr/stdlib/quips.tl: New file. * txr.1: Documented.
* Version 243txr-243Kaz Kylheku2020-09-011-3/+3
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New function: reject.Kaz Kylheku2020-09-011-0/+70
| | | | | | | | | | | * eval.c (eva_init): Register reject intrinsic. * lib.c (appendl): New static function. (reject): New function. * lib.h (reject): Declared. * txr.1: Documented.
* doc: minor flaw in select syntax markup.Kaz Kylheku2020-08-301-1/+1
| | | | * txr.1: remove space between | and "function".
* doc: rewrite multiple inheritance intro paragraph.Kaz Kylheku2020-08-281-9/+3
| | | | | | * txr.1: Simplify the paragraph, and eliminate the introduction of the unnecessary term "strict single inheritance".
* doc: :fini also affected by diamond problem.Kaz Kylheku2020-08-281-4/+25
| | | | | | * txr.1: Document that the change in behavior to initialize a duplicate base just once also affects :fini, not only initialization. Example expanded.
* structs: deal with initialization diamond problem.Kaz Kylheku2020-08-271-2/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now it has been documented that if a struct type inherits a supertype two or more times, then the supertype initialization occurs that many times. This change fixes the behavior: bases are initialized once. * struct.c (struct struct_type): New members, ndsupers, dsus providing a flat array for tracking duplicate supertypes. (get_all_supers, get_duplicate_supers): New static functions. (make_struct_type): Calculate the duplicate supers, and store them in the dsus array. Under 242 or lower compat mode, pretend there are duplicates, which defeats the duplicate detecting mechanism (struct_type_destroy): Free the dsus array. (call_inittfun_chain, call_postinitfun_chain): Take new arguments: the root type from which the recursion started, and a stack-allocated bit vector indicating which duplicate bases have already been initialized. If the given type appears in the duplicate bases list of the root type, and its bit is already set, then skip all initialization for it. Otherwise set its bit and proceed. (alloc_seen, clear_seen): New macros to help with allocating the bitvector of duplicate bases. (make_struct_impl, lazy_struct_init, reset_struct): Use alloc_seen and clear_seen macros to manage the bitvector of duplicate bases for calling call_initfun_chain and call_postinitfun_chain. * txr.1: Updated doc with new paragraph about duplicated supertypes, and compat note added.
* ffi/doc: bugfixes to bitfield alignment.Kaz Kylheku2020-08-241-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Three issues issues. The documentation is wrong about the concept of a "leading bitfield" whose alignment matters. The alignment of all named bitfields matters. Secondly, the alignment of unnamed bitfields doesn't matter. Thirdly, there is a flaw in the treatment of bitfields in unions, from both alignment and sizing. * ffi.c (make_ffi_type_struct): A bitfield member contributes to alignment regardless of its offset within an allocation unit: no bits_alloc == 0 check should be applied. Secondly, a bitfield member that is unnamed has an alignment of 1, otherwise the alignment of its declared type. (make_ffi_type_union): The size and alignment of a bitfield member is not simply that of its type. The size of a bitfield is the number of bytes required to store all of the bits. The alignment is 1 if it is unnamed, otherwise that of its type. The sizing of bitfields now means that alignment can add padding to a union. For instance, a uint32_t x : 17 bitfield has size 3, but alignment 4, requiring one byte of alignment padding in the union so that its size is 4. This means that we must now do the padding alignment calculation for unions to adjust the size, just like we do for structures.
* doc: ffi: struct size with only zero-width field.Kaz Kylheku2020-08-241-1/+2
| | | | | * txr.1: Document that the size of a struct that contains nothing but a zero-width field is zero.
* doc: clarify *load-path* treatment under @(load)Kaz Kylheku2020-08-191-1/+3
| | | | | | * txr.1: Make it clear that pure-rel-path-p is applied to the target path coming from the @(load) directive, and not to the value in *load-path*.
* txr: repeat ferrets out Lisp-embedded vars.Kaz Kylheku2020-08-171-44/+80
| | | | | | | | | | | | | | | Gone is the need for :vars to inform @(repeat)/@(rep) about variable references buried in Lisp. * eval.c (expand_with_free_refs): Change to external linkage. * eval.h (expand_with_free_refs): Declared. * parser.y (extract_vars): Handle sys:expr forms, which are embedded Lisp via expand_with_free_refs to uncover their free variables. * txr.1: Redocumented this area.
* Version 242txr-242Kaz Kylheku2020-08-141-3/+3
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* doc: listener: undo over history clarifications.Kaz Kylheku2020-08-141-6/+12
| | | | | | * txr.1: Document that all the edits done to a history line are committed as a single undo item when navigating away from it. Clarify some text related to undo over a history line.
* Version 241txr-241Kaz Kylheku2020-08-071-3/+3
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* doc: fix under define-option-structKaz Kylheku2020-08-071-1/+1
| | | | * txr.1: Clarifying comma and number agreement.
* New inaddr-str and in6addr-str functions.Kaz Kylheku2020-07-241-1/+121
| | | | | | | | | | | | | | | | | * lisplib.c (sock_set_entries): Register autoload entries for inaddr-str and in6addr-str. Register prefix symbol to be interned. * share/txr/stdlib/socket.tl (sockaddr-in, sockaddr-in6): Both structs get a new member, prefix, defaulting to the respective number of bits in the address. (inaddr-str, in6addr-str): New functions. * tests/014/iaddr-str, tests/014/inaddr-str.expected, tests/014/in6addr-str.tl, tests/014/in6addr-str.expected: New files * txr.1: Documented.
* New sspl function.Kaz Kylheku2020-07-221-1/+10
| | | | | | | | | | | * eval (eval_init): Register sspl, an argument-reversed interface to split-str-set. * lib.c (sspl): New function. * lib.h (sspl): Declared. * txr.1: Documented.
* distat: bugfix: use lstat.Kaz Kylheku2020-07-201-8/+7
| | | | | | | | | | * sysif.c (dirstat): Call lstat_wrap, rather than stat_wrap. This function must report about the directory entry itself, not about what that entry points to if it happens to be a symlink. The d-type member of the dirent structure representing a symlink must be set to dt-lnk. * txr.1: Updated.
* stat, lstat and dirstat now take struct param.Kaz Kylheku2020-07-201-7/+25
| | | | | | | | | | | | | | | * ftw.c (ftw_callback): Pass nil to new parameter of stat_to_struct, to have a new stat struct allocated as before. * sysif.c (stat_to_struct, stat_impl, stat_wrap, lstat_wrap dirstat): New optional parameter that lets caller specify an existing struct object to fill. (sysif_init): Adjust registrations of stat, fstat, lstat and dirstat for new optional parameter. * sysif.h (stat_to_struct, stat_wrap): Declarations updated. * txr.1: Documented.
* doc: add an implementation note for exceptions.Kaz Kylheku2020-07-171-0/+24
| | | | | | * txr.1: Add remarks on the differences between how TXR Lisp and ANSI CL deal with unhandled exceptions/conditions of type error and warning.
* doc: exception handling wording improvements.Kaz Kylheku2020-07-171-9/+19
| | | | | * txr.1: Improved wording and fixed some grammar issues in the the paragraphs that introduce TXR Lisp exception handling.
* doc: wrong symbol under cptr-buf.Kaz Kylheku2020-07-131-1/+1
| | | | * txr.1: cptr-buf syntax wrongly refers to cptr-obj.
* doc: spurious word under Variables.Kaz Kylheku2020-07-131-1/+1
| | | | | * txr.1: "two three" should be three. Found thanks to the keen eyes of Ivor Horton.
* doc: fix some mistakes in ffi-get and ffi-out.Kaz Kylheku2020-07-131-9/+7
| | | | | | * txr.1: Fix repeated "this this", and an an incorrect insinuation that the ffi-get has an obj argument. Rather, it returns an object.
* cptr: new cptr-get and cptr-out functions.Kaz Kylheku2020-07-131-0/+131
| | | | | | | | | | | | | | | | | These functions are quite helpful in dealing with semi-opaque types, like the xmlNode type of libxml2. Such types must be treated as an opaque handle when passed to and returned from the API, and not subject to any encoding or decoding, which means that the appropriate representation for them is via the cptr family of types. However, semi-opaque types also have client-visible members that must be accessed directly. These new functions provide for that access in a convenient way. * ffi.c (ffi_type_lookup_checked): New static function. (cptr_getobj, cptr_out): New static functions. (ffi_init): Register cptr-get and cptr-out. * txr.1: Documented.
* Support weak semantics in symbol packages.Kaz Kylheku2020-07-121-1/+19
| | | | | | | | | | | | | | | | | | | | | A package is weak if it holds weak references to symbols, meaning that if there are no references to a symbol other than its entry in a weak package, it can be removed from the package and reclaimed by the garbage collector. * eval.c (eval_init): Update registrations for make-package and sys:make-anon-package to reflect new optional argument. * lib.c (make_package_common): New argument weak. If it is true then both the hashes will have weak values. (make_package, make_anon_package): New optional argument weak. (obj_init): Add nil argument to calls to make_package. All the standard packages are regular, not weak. * lib.h (make_package, make_anon_package): Declarations updated. * txr.1: Documented.
* listener: new *-1, *-2 ... *-20 macros.Kaz Kylheku2020-07-111-0/+19
| | | | | | | | | | | | * arith.h (minus_s): Declared. * eval.c (reg_symacro): Changing to external linkage. * eval.h (macro_time_s, reg_symacro): Declared. * parser.c (repl): Bind the *-1 to *-20 symbol macros. * txr.1: Documented.
* Add dirstat function.Kaz Kylheku2020-07-091-5/+84
| | | | | | | | | | | | | | | | | | | This function back-fills the missing d-type information in a dirent on platforms that don't provide d_type in the native dirent. * sysif.c (DT_FIFO, DT_CHR, DT_DIR, DT_BLK, DT_REG, DT_LNK, DT_SOCK): Define all these preprocessor symbols to their Linux values on platforms where DT_DIR is not defined. (DT_UNKNOWN): Make sure this symbol is #undef-d if DT_DIR is not defined, so the corresponding dt-unknown variable does not exist. (dirstat): New static function. (sysif_init): Register dirstat intrinsic. Register dt-fifo and the rest unconditionally now. Changing their order to increasing numeric. * txr.1: Documented.
* Add missing closedir.Kaz Kylheku2020-07-091-1/+36
| | | | | | | | | | | | | * sysif.c (opendir_free): Since d->dir may now be null, avoid calling closedir on it in that situation. Also, set d->dir to null after closedir. (closedir_wrap): New static function. (readdir_wrap): If the d->dir is null, safely treat that as a directory entry not being available; do not pass a null DIR pointer to readdir. (sysif_init): Register intrinsic function closedir. * txr.1: Documented, plus spelling error fix under readdir.