summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* defsymacro must remove special marking.Kaz Kylheku2016-06-111-1/+21
| | | | | | | | | | * eval.c (op_defsymacro): Remove sym from the special hash, unless compatibility 143 or lower is requested. * txr.1: Document effects of evaluating defsymacro if a global variable of the same name exists, and the behavior in lexical scopes where sym is bound. Added compatibility notes covering the code change.
* Implement :counter in collect/coll.Kaz Kylheku2016-06-091-0/+47
| | | | | | | | * match.c (h_coll, v_collect): Parse out :collect keyword specification, using code borrowed from do_output. Implement binding in collect loop. * txr.1: Documented.
* Restructure documentation of collect keywords.Kaz Kylheku2016-06-091-44/+73
| | | | | * txr.1: Use indented paragraphs to replace the ad-hoc introduction of keywords.
* Rewriting documentation for binding accessors.Kaz Kylheku2016-06-081-14/+47
| | | | | * txr.1: Largely rewrote description of symbol-function, symbol-macro and symbol-value.
* Fixing semantics of makunbound.Kaz Kylheku2016-06-081-31/+103
| | | | | | | | | | | | | | | | | | * eval.c (unbound_s): New symbol variable. (lookup_var): If a dynamic binding has the special sys:unbound symbol as its value, then return nil, so the behavior is as if there is no binding. (makunbound): If the symbol exists in a dynamic environment, then replace its value with sys:unbound, making it look unbound. (eval_init): Initialize unbound_s. * lib.h (us_car, us_cdr): New inline functions. * txr.1: New dialect notes under boundp. Updated the makunbound documentation. Separated makunbound documentation from fmakunbound and mmakunbound. Added compatibility notes.
* Note that txr-path includes trailing slash.Kaz Kylheku2016-06-051-3/+4
| | | | | * txr.1: Document that txr-path includes slash. Fix two incorrect examples which have an extra slash.
* The stdlib variable gets a trailing slash.Kaz Kylheku2016-06-051-1/+5
| | | | | | | | | | | | | | | | | | | * txr.c (sysroot_init): Add slash to stdlib_path. (sysroot_compat_fixup): Replace user-visible stdlib variable with a path that doesn't have a slash, if compatibility is 143 or lower. (compat): Call sysroot_compat_fixup. * lisplib.c (place_set_entries, ver_set_entries, ifa_set_entries, txr_case_set_entries, with_resources_set_entries, path_test_set_entries, struct_set_entries, with_stream_set_entries, hash_set_entries, except_set_entries, type_set_entries, yield_set_entries, sock_set_entries, termios_set_entries): Remove slash from format string since the directory includes it. * txr.1: Added note under stdlib about the slash, and also an entry COMPATIBILITY.
* Version 143.txr-143Kaz Kylheku2016-06-041-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Incorrect repeat directive example.Kaz Kylheku2016-06-031-1/+1
| | | | | * txr.1: Insufficient parenthesis nesting in :vars syntax with initializer.
* @(output) evaluates destination as Lisp.Kaz Kylheku2016-06-031-6/+16
| | | | | | | | | * match.c (v_output): Use txeval on the destination only if compatibility is 142 or lower, or it is a meta expression (so that @var and @(expr) still work without having to use the compatibility option). * txr.1: Documented and put in compatibility notes.
* Mistake in remq*, reqml* and remqual heading.Kaz Kylheku2016-06-031-1/+1
| | | | * txr.1: reqm was written instead of remq*.
* Adding special function from-list.Kaz Kylheku2016-06-011-0/+42
| | | | | | | | | | * lib.c (from_list_s): New symbol variable. (make_like): Handle a COBJ. If it's a structure with a from-list method, then use it, otherwise the default handling applies of returning the list. (obj_init): Initialize from_list_s. * txr.1: Documented.
* Describe special structure methods in new section.Kaz Kylheku2016-06-011-114/+158
| | | | | | | | * txr.1: Removing "Functors", "Equality Substitution", "Custom Pretty-Printing" and "Sequence Operations on Structures" paragraphs. Adding major section "Special Structure Functions" under which the special functions are described with syntax headings.
* ldiff uses equal for all non-list arguments.Kaz Kylheku2016-06-011-3/+3
| | | | | | | | | | | * lib.c (ldiff): Rather than checking specifically for strings and vectors to apply the special case behavior (comparison using equal), test specifically for lists and apply the traditional behavior. Every other object, not just strings and vectors, gets the altered behavior. * txr.1: Changed text in TXR Lisp introduction which touches on ldiff, and wording fix under ldiff.
* Methods for turning objects into sequences.Kaz Kylheku2016-06-011-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | Struct objects can now define methods car, cdr and nullify. With these, they can participate in operations on sequences. * eval.h (car_s, cdr_s): Declared. * lib.c (nullify_s): New symbol variable. (car, cdr): Implement for struct objects via, respectively, their car and cdr methods. (tolist): Handle objects by mapping through identity. (nullify): Implement for objects optionally: if an object is a struct with a nullify method, use it, otherwise go through default case of just returning the object. (empty): Implement for objects that have nullify method. (obj_init): Initialize nullify_s. * struct.c (maybe_slot): New function. * struct.h (maybe_slot): Declared. * txr.1: Documented car, cdr and nullify method convention.
* Print method on objects.Kaz Kylheku2016-06-011-0/+8
| | | | | | | | | * struct.c (print_s): New symbol variable. (struct_init): Initialize print_s. (struct_inst_print): If pretty-printing, try to look up object's print method and use it. * txr.1: Documented pretty-printing via print method.
* Eliminating the ! $ and - file-opening hacks.Kaz Kylheku2016-05-311-25/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Going forward, the "!command" and "$dir" are no longer recognized, except with the backward-compatibility -C option. The "-" string denoting standard input is only recognized from the command line, not in the @(next) directive; and "-" cannot be used in @(output) to denote standard output. The main problem is that these are hacks which intrude into the namespace. (What if a file is named "-", or begins with "!" or "$"?) Secondly, they are possible security holes. These prefixes are recognized even in computed strings, like "@(next var)" where var contains "!command". * Makefile (tst/tests/002/%): Run tests in this directory with the -C 142 option in TXR_OPTS, because they use the ! mechanism. * match.c (complex_open): New argument, from_cmdline, indicating whether the file name came from the command line or is internal. Function now only treats "-" as denoting standard input, if that came from the command line. The "!" and "$" prefixes are only recognized in compatibility with 142 or earlier. (v_next): Suppress old strategy of handling string sources by pushing them to the file list to let match_files open them. This is now done only under 142 compatibility. Instead, open directly, produce the list, and recurse into match_files with ready data. This is not only simpler, but also prevents "-" from being recognized in @(next), because complex_open is invoked directly, and the from_cmdline argument is specified as nil. (v_output): Don't rely on "-" denoting standard output; rather use the stream directly, which can be passed to complex_open. Pass nil to the new from_cmdline parameter of complex_open, so "-" isn't recognized. (open_data_source): Pass t for the from_cmdline parameter of complex_open, to have "-" recognized as denoting standard input. * txr.1: Removed documentation referring to !, and use of - in the @(next) and @(output) directives. Added notes to COMPATIBILITY section.
* Version 142.txr-142Kaz Kylheku2016-05-291-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Add a byte mode to stdio streams.Kaz Kylheku2016-05-281-7/+29
| | | | | | | | | | | | | | | | | * stream.c (byte_oriented_k): New keyword symbol variable. (struct stdio_handle): New member, is_byte_oriented. (stdio_get_prop): Retrieve the value of is_byte_oriented when the :byte-oriented property is inquired. (stdio_set_prop): Map :byte-oriented to the is_byte_oriented flag. (stdio_get_char): Do not decode UTF-8 if is_byte_oriented is set; just read one character. (make_stdio_stream_common): Initialize is_byte_oriented to 0. (stream_init): Initialize byte_oriented_k. * txr.1: Document :byte-oriented property, along with some clean-up and clarification in the description of properties.
* Check manual for .cblk/.cble pairing.Kaz Kylheku2016-05-261-4/+4
| | | | | | | | * checkman.txr (check-cblk): New pattern function, hooked into main scan. * txr.1: Fixed four instances of .cblk closed by .cblk instead of .cble.
* Provide the txr-embedded-arg.txr utility.Kaz Kylheku2016-05-251-1/+66
| | | | | | * txr-embedded-arg.txr: New file. * txr.1: Documented.
* 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.