summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* Stand-alone application support.Kaz Kylheku2016-05-251-0/+107
| | | | | | | | | | | | | | | | | | | * txr.c (sysroot_init): Don't print "unable to calculate sysroot" error message in the fallback case, and use the absolute path of the executable directory as the sysroot in this case. (txr_main): Define static area prefixed by @(txr): header. If a string is present in this data area then process it as an argument. Treat the *args* variable carefully. If we use the stored string as the argument, save the args in orig_args variable, then later bind *args* to that. In the -e, -p and related options processing, we bind *args* to the original list so args are available to the expression being evaluated. If the expression mutates *args* then we keep the mutated args whether or not we are processing the stored string. * txr.1: Documented in new sction, STAND-ALONE APPLICATION SUPPORT.
* New variable: txr-path.Kaz Kylheku2016-05-251-0/+5
| | | | | | | * txr.c (dirname): New static function. (sysroot_init): Register txr-path variable. * txr.1: documented txr-path.
* Allow whitespace between @ and ; in comments.Kaz Kylheku2016-05-231-1/+1
| | | | | | | * parser.l (grammar): Recognize {WS}* between @ and ; (or the legacy #) in comments. * txr.1: Documentation updated.
* Optional argument on remove-path.Kaz Kylheku2016-05-231-2/+9
| | | | | | | | | | * stream.c (remove_path): New parameter, throw_on_error. (stream_init): Update registratino of remove_path intrinsic. * stream.h (remove_path): Declaration updated. * txr.1: Updated remove-path documentation to describe throw-on-error-p parameter.
* Neglected documentation about @(next).Kaz Kylheku2016-05-231-3/+8
| | | | | txr.1: It wasn't documented that expr in @(next expr) can produce a stream.
* Version 141.txr-141Kaz Kylheku2016-05-201-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* No such word: expressivity.Kaz Kylheku2016-05-201-1/+1
| | | | * txr.1: Replace Expressivity with Expressiveness.
* Capitalize Boolean.Kaz Kylheku2016-05-201-23/+23
| | | | * txr.1: Capitalize Boolean everywhere.
* Implement listener variable for selection style.Kaz Kylheku2016-05-191-15/+44
| | | | | | | | | | | * parser.c (listener_sel_inclusive_p_s): New symbol variable. (repl): Install current value of *listener-sel-inclusive-p* variable into linenoise. (parse_init): Initialize the symbol variable and register the Lisp special variable. * txr.1: Documented special variable and selection mode semantics.
* Grammar under Dot Position in Function Calls.Kaz Kylheku2016-05-181-2/+2
| | | | * txr.1: maybe -> may be.
* Streamline text about where Lisp is evaluated.Kaz Kylheku2016-05-181-16/+14
| | | | | | * txr.1: Just list directives that take Lisp; drop the details. Point out that no @ is needed for access to Lisp variable.
* Fix outdated example.Kaz Kylheku2016-05-181-1/+1
| | | | | * txr.1: @ is not required on Lisp variables.
* Formatting fix under make-random-stateKaz Kylheku2016-05-181-1/+1
| | | | * txr.1: Mistake in syntax markup.
* New feature: self-load-path symbol macro.Kaz Kylheku2016-05-181-0/+35
| | | | | | | | | | | | | | | | | | | | | * eval.c (self_load_path_s): New symbol variable. (sys_load): Save, set-up and restore self-load-path around load. (set_get_symacro): New function. (eval_init): Register load function using sys_load_s instead of redundant intern. * eval.h (set_get_symacro): Declared. * match.c (v_load): Save, set-up and restore self-load-path macro. * parser.c (load_rcfile): Likewise. * txr.c (txr_main: Set up self-load-path when opening file. * txr.1: Documented self-load-path.
* Add notes about cursor shape and selection semantics.Kaz Kylheku2016-05-181-0/+23
| | | | | | | * txr.1: In Interactive Listener sections, note what "character under the cursor" means when a vertical cursor is in effect, and add notes about how the selection semantics pairs well with that style of cursor.
* New functions: at-exit-call and at-exit-do-not-call.Kaz Kylheku2016-05-181-0/+38
| | | | | | | | | | | | | | * sysif.c (at_exit_list): New static variable. (at_exit_call, at_exit_do_not_call): New functions. (at_exit_handler): New static function. (sysif_init): GC-protect at_exit_list. Register at_exit_handler with C atexit function. Register intrinsic functions at-exit-call and at-exit-do-not-call. * sysif.h (at_exit_call, at_exit_do_not_call): Registered. * txr.1: Documented.
* Adding termios support.Kaz Kylheku2016-05-181-0/+710
| | | | | | | | | | | | | | | | * Makefile (termios.o): New object file. * lib.c (init): Call termios_init. * lisplib.c (termios_set_entries, termios_instantiate): New functions. (lisplib_init): Register new functions in autoload table. * share/txr/stdlib/termios.tl: New file. * termios.c, termios.h: New files. * txr.1: Documented termios.
* Bugfix in checkman leading to doc improvements.Kaz Kylheku2016-05-171-38/+17
| | | | | | | | | | | * checkman.txr: Check against blank line after .desc. Fix incorrect pattern, failing to match one-symbol Function/Operator/Macro headings. This exposes errors in the document that were previously undetected. * txr.1: Fix numerous occurrences of blank lines after .desc, missing .desc, incorrect headings and other problems.
* Version 140.txr-140Kaz Kylheku2016-05-071-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Argument of flush-stream now optional.Kaz Kylheku2016-05-071-1/+7
| | | | | | | | | * stream.c (flush_stream): Default the argument to std_output. (stream_init): Register flush-stream as having one optional arg. * txr.1: Updated flush-stream description.
* New: standard stream redirection for subprocesses.Kaz Kylheku2016-05-071-0/+74
| | | | | | | | | | | | | | | | | | | When subprocesses are created using open-command, open-process, run or sh, any streams not bound by those functions are obtained from *stdin*, *stdout* or *stderr*, as appropriate. Thus manipulating these variables has the effect of redirecting not only local output within the program but over coprocesses as well. * stream.c (struct save_fds): New type. (FDS_IN, FDS_OUT, FDS_ERR): New macros. (fds_init, fds_subst, fds_swizzle, fds_restore): New static functions. (open_command, open_process, run): "Swizzle" and restore the standard file descriptors. * txr.1: Updated documentation of affected function.
* New --reexec option.Kaz Kylheku2016-05-051-0/+28
| | | | | | | | | | | | | | | | | This helps with setuid hash bang scripting on Mac OS, and other plaforms where the interpreter executed out of a hash bang script runs with orinary privilege, even if marked setuid. * sysif.c (exec_wrap): Static function turns extern. * sysif.h (exec-wrap): Declared. * txr.1: Documented --reexec. Added notes about setuid under Hash Bang Support. * txr.c (help): List --reexec option. (txr_main): Implement --reexec option.
* Somew new path access testing functions.Kaz Kylheku2016-05-041-27/+79
| | | | | | | | | | | | | | * lisplib.c (path_test_set_entries): New elements in the list for path-readable-to-me-p, path-read-writable-to-me-p, and path-strictly-private-to-me-p. * share/txr/stdlib/path-test.pl (sys:path-access): Test bitwise combinations of permissions, so read+write can be tested in one call. (path-readable-to-me-p, path-read-writable-to-me-p, path-strictly-private-to-me-p): New functions. * txr.1: Documented.
* Implement setgid script support.Kaz Kylheku2016-05-021-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TXR now notices that it's running setgid, and implements setgid logic for scripts. * sysif.c (orig_egid, real_gid, is_setgid): New static variables. (repress_privilege): Treat real and effective group ID similarly to user ID. Save them in global variables, and set the is_setgid flag. (drop_privilege): Drop setgid privilege similarly to setuid. Operate selectively: if neither setuid nor setgid is in effect, do nothing, but if just one is in effect, don't do anything for the other. (simulate_setuid): Function renamed to simulate_setuid_setgid. A small change is made here: if the fstat fails, just drop privilege, don't abort. Implement setgid operation independently of setuid. The is_setgid and is_setuid flags are manipulated here now to get the drop_privileges function to selectively drop setuid if we are running a script which is only segid, or drop setgid if we are running a setuid only script. * sysif.h (simulate_setuid): Declaration name change to simulate_setuid_setgid. * txr.c (txr_main): Follow rename of simulate_setuid. * txr.1: SETUID OPERATION section changed to SETUID/SETGID operation, and setgid description worked into the text.
* Fix somewhat broken setuid privilege dropping.Kaz Kylheku2016-05-011-43/+62
| | | | | | | | | | | | | | | | | | | | | | * sysif.c (repress_privilege): Eliminate redundant getuid call. (drop_privilege): On some platforms, setuid(getuid()) will not drop setuid non-root privilege. This is fixed by using setresuid, if we have it, which we do on Linux. On platforms where we don't have setresuid, we try setuid(getuid()). Then after that if we are able to change our effective user ID to the one we dropped, we conclude that it didn't work and abort. (simulate_setuid): Call drop_privilege instead of repeating the naive privilege-dropping logic. Check the result of seteuid; if it fails, then drop privilege! Otherwise a txr that is setuid bob will continue running as bob, if it fails to enact setuid on a script owned by alice. * txr.1: Rewrite SETUID OPERATION section in an attempt to clarify the wording, fix formatting issues, and describe the current implemenation of privilege dropping.
* Adding getresuid, getresuid, getresgid and setresgid.Kaz Kylheku2016-05-011-0/+36
| | | | | | | | | | | * configure: Test for these functions. * sysif.c (getresuid_wrap, getresgid_wrap, setresuid_wrap, setresgid_wrap): New static function. (sysif_init): Registered getresuid, setresgid, setresuid and setresgid intrinsics. * txr.1: Documented all four functions.
* Adding setgroups function.Kaz Kylheku2016-05-011-12/+32
| | | | | | | | | | | * configure: Test for setgroups. New HAVE_SETGROUPS preprocessor symbol for config/config.h. * sysif.c (setgroups_wrap): New static function. (sysif_init): Register intrinsic setgroups function. * txr.1: Documented setgroups. Rearranged sections so getgroups and setgroups descriptions are consecutive.
* Use random padding in PRNG rather than 0xAA.Kaz Kylheku2016-04-281-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | The purpose is to eliminate any biases in the PRNG arising out of the regularity of that pattern, so that the behavior of successive values is good from the beginning. This doesn't solve the problem that a short warm-up period leads to a poor distribution of initial values relative to the seed space. In other words, that similar seeds lead to initially similar sequences. * rand.c (rand_tab): New static array. (make_random_state): Set uninitialized parts of state from the corresponding elements in rand_tab, rather than to the 0xAAAAAAAA values. (rand_compat_fixup): In 139 compatibility mode, clobber rand_tab with 0xAA bytes. * tests/013/maze.expected: Updated. * txr.1: Added some PRNG implementation notes, and also compatibility notes.
* Clean-up rand code; implement configurable warmup.Kaz Kylheku2016-04-281-4/+56
| | | | | | | | | | | | | | | | | | | | | * lib.c (copy): Pass new second argument to make_random_state. * rand.c (random_warmup): New macro. (random_warmup_s): New symbol variable. (make_random_state): New warmup argument. Code restructured to avoid copy flag. Fill code and initialization of r->cur made common. (rand_compat_fixup): Pass second argument to make_random_state. (rand_init): Pass second argument to make_random_state. Initialize random_warmup_s with interned symbol. Register *random-warmup* special variable. Fix registration of make-random-state to two-argument function type. * rand.h (make_random_state): Declaration updated. * txr.1: Document *random-warmup* variable and warup argument of make-random-state.
* Simple indirection on pattern functions: @(call).Kaz Kylheku2016-04-271-0/+90
| | | | | | | | | | * eval.h (call_s): Declared. * match.c (h_call, v_call): New static function. (dir_tables_init): Register v_call in v_directive_table under call symbol. Likewise h_call in h_directive_table. * txr.1: Documented.
* Adding fixnum-min and fixnum-max variables.Kaz Kylheku2016-04-271-0/+15
| | | | | | | * arith.c (arith_init): Registered fixnum-min and fixnum-max variables. * txr.1: Documented.
* Check .metn similarly to .codn and fix.Kaz Kylheku2016-04-261-27/+28
| | | | | | * checkman.txr: Check .metn using logic shared with .codn. * txr.1: Numerous errors fixed.
* Change .meta to single-argument.Kaz Kylheku2016-04-261-8/+8
| | | | | | | | * checkman.txr: Check .meta similarly to .code. * txr.1: Change .meta macro to take only one argument, so that text with spaces must be quoted. Errors found and fixed.
* Check that arg 2 of .codn starts with punctuation.Kaz Kylheku2016-04-261-5/+5
| | | | | | | | * checkman.txr: Constraint on first character of second argument coded as a require constraint, enforced with assert. * txr.1: Newly discovered errors fixed.
* Change .codn and .code to fixed arity.Kaz Kylheku2016-04-261-427/+455
| | | | | | | | | | | | | | | | | | | In the manual, the .code and .codn macros are no longer variadic. They take one an two arguments, respectively. Multiple arguments have to be quoted now. This makes it easier to detect errors in usage, using support in checkman.txr. Numerous errors were found, in fact. * checkman.txr (check-code): New pattern function for doing some checks on .code, codn, cod2 and cod3 macro usage. * txr.1: code and codn macro are no longer variadic. All variadic uses fixes with quotes. Numerous errors discovered and corrected.
* Fix errors found by new checkman.txr.Kaz Kylheku2016-04-261-21/+21
| | | | | | * txr.1: Fix incorrect function and variable description headings with spurious commas and inappropriate plurals. Fix missing .mets in syntax blocks.
* Version 139.txr-139Kaz Kylheku2016-04-221-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Spring cleaning: find wrong wrong troff macros.Kaz Kylheku2016-04-221-60/+61
| | | | | | * txr.1: Hunted down and fixed incorrect .code, .codn, .meta and .metn invocations. Added missing .desc macros after .coNP Variables ...
* Support list of paths in ftw.Kaz Kylheku2016-04-221-0/+47
| | | | | | | * ftw.c (ftw_wrap): Handle case when dirpath is a list, by recursion. * txr.1: Documented.
* Integrating fnmatch.Kaz Kylheku2016-04-201-0/+54
| | | | | | | | | | | | * configure: new test for fnmatch, introducing HAVE_FNMATCH configure variable into config/config.h. * sysif.c (fnmatch_wrap): New function. (sysif_init): Register intrinsic variables fnm-pathname, fnm-noescape, fnm-period, fnm-leading-dir, fnm-casefold and fnm-extmatch. Register intrinsic function fnmatch. * txr.1: Documented.
* read-until-match can optionally keep matched text.Kaz Kylheku2016-04-201-12/+24
| | | | | | | | | | | | | | | | | | | | * regex.c (read_until_match): New argument, include_match. Three times repeated termination code refactored into block reached by forward goto. (regex_init): Registration of read-until-match updated. * regex.h (read_until_match): Declaration updated. * stream.c (struct record_adapter_base): New member, include_match. (record_adapter_get_line): Pass match to read_until_match as new argument. (record_adapater): New argument, include_match. (stream_init): Update registration of record-adapter. * stream.h (record_adapter): Declaration updated. * txr.1: Updated.
* Allow unlimited character pushback in unget-char.Kaz Kylheku2016-04-191-1/+16
| | | | | | | | | | | | | | | | Fixing read_until_match will require this feature. * socket.c (dgram_get_char): Treat unget_c as a cons-based stack; pop a character from it if available. (dgram_unget_char): Push the character onto unget_c rather than storing the characer into unget_c. * stream.c (stdio_get_char, stdio_unget_char): Closely analogous changes to the ones in dgram_get_char and dgram_unget_char, respectively. * txr.1: Documentation improved and updated.
* Fix inconsistency of Lisp var visibility in TXR.Kaz Kylheku2016-04-171-12/+35
| | | | | | | | | | | | | | | | | | | Numerous places in match.c are using assoc(sym, bindings) logic to access a variable, which doesn't see the Lisp globals, as we would like. For example, if foo is defined using (defvar foo), @(set foo "A") doesn't work. This is subject to the compatibility option. * match.c (tx_lookup_var): New static function. (dest_set, h_var, h_coll, h_parallel, h_fun, v_next, v_parallel, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter, v_fun, match_filter): Use tx_lookup_var instead of assoc for all lookups that see the full variable scope. Only variable lists known to be locally consed up are scanned with just assoc. * txr.1: Documented new rules and added compatibility notes.
* Version 138.txr-138Kaz Kylheku2016-04-161-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Improve sock-peer documentation.Kaz Kylheku2016-04-161-19/+20
| | | | | | * txr.1: Remove factually incorrect statements that only sockets connected with sock-connect or sock-accept have a peer address. Broadly revise wording.
* Doc for sys:abscond* references nonexistent sym.Kaz Kylheku2016-04-161-1/+1
| | | | | * txr.1: Incorrect reference to sys:return* should of course be to sys:abscond*.
* Notes on glob and exceptions.Kaz Kylheku2016-04-151-0/+19
| | | | | | * txr.1: Document that glob's error-func callback can be terminated by a non-local exit, but may not capture continuations across glob.
* Glob-related variables wrongly documented as special.Kaz Kylheku2016-04-151-1/+1
| | | | | * txr.1: glob-err, glob-mark and others are global lexical variables, not special.
* Adding ftw function.Kaz Kylheku2016-04-151-0/+194
| | | | | | | | | | | | | | * Makefile (ftw.o): Add to OBJS-y conditionally. * configure (have_ftw): New variable. New configure test for nftw. (gen_config_make): Set up have_ftw make variable. * ftw.c, ftw.h: New files. * lib.c (init): Call ftw_init, if compiled in. * txr.1: Documented.
* Macros obtain* and obtain*-block.Kaz Kylheku2016-04-151-0/+76
| | | | | | | | | | * lisplib.c (yield_set_entries): Add obtain* and obtain*-block to autoload list. * share/txr/stdlib/yield.tl (obtain*, obtain*-block): New macros. * txr.1: Documented.