summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix match-regex not conforming to documentation.Kaz Kylheku2016-09-221-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation says that match-regex returns the length. Actually, it returns the position after the last character matched. This makes a difference when the match doesn't begin at character zero. The actual behavior is that of the match_regex C function which has behaved that way since the dawn of TXR, and internals depend on it behaving that way. So the internal function is being retained, and a new function is being registered as the match-regex intrinsic. The choice of binding for match-regex is subject to the compatibility option. The behavior of match-regst is also being fixed since its return value is incorrect due to this issue. Since its return value makes no sense at all (does not represent the matched text), it is not subject to the compatibility option; it is just fixed to conform with the documentation. * regex.c (match_regex_len): New function. (match_regst): Keep using match_regex, but use its return value properly. This simplifies the range extraction code, which is why match_regex works that way in the first place. (regex_init): Register match-regex to match_regex_len, unless compatibility <= 150 is requested; then register to match_regex. * regex.h (match_regex_len): Declared. * txr.1: Compatibility notes added.
* doc: fix regex function not mentioned in heading.Kaz Kylheku2016-09-221-1/+1
| | | | | * txr.1: search-regst added to heading of section which describes it.
* Regexes now callable as functions.Kaz Kylheku2016-09-221-6/+94
| | | | | | | | * lib.c (generic_funcall): Add case for regexes. Handle arguments in such a way that the string is always rightmost, with a view to convenient partial application. * txr.1: Documented in multiple places.
* Support functional argument in regsub.Kaz Kylheku2016-09-221-4/+18
| | | | | | | | | * regex.c (regsub): Allow the second argument to be a function, which is called with str as an argument, and returns a range which indicates what part of the string is to be replaced, or else nil. * txr.1: Documented functional argument of regsub.
* Support negative positions in regex matching funs.Kaz Kylheku2016-09-211-1/+20
| | | | | | | | | * regex.c (match_regex, match_regex_right): Detect a negative start or end position, respectively, and add the string length to it. If it is still negative, bail with nil. * txr.1: Documented.
* doc: about assignment to nonexistent awk fields.Kaz Kylheku2016-09-211-0/+10
| | | | | * txr.1: Adding remark that assignment to nonexistent fields isn't permitted, unlike in Awk.
* doc: revised descrs of awk vars fs, ft an kfs.Kaz Kylheku2016-09-211-121/+65
| | | | | | | | * txr.1: fs and ft are described in one simplified section. The default behavior when they are both nil is described simply as token extraction, which is how it is now implemented. Some verbiage is reduced in the krs description.
* New library feature: imperative list building.Kaz Kylheku2016-09-201-0/+299
| | | | | | | | | | | * lisplib.c (build_set_entries, build_instantiate): New static functions. (dlt_register): Register dynamic loading of build.tl via the two new functions. * share/txr/stdlib/build.tl: New file. * txr.1: Documented everything.
* Version 150.txr-150Kaz Kylheku2016-09-181-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* New awk operator: fconv.Kaz Kylheku2016-09-181-0/+113
| | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-let): Add new symbol macro, fconv. * share/txr/stdlib/conv.tl: New file. * txr.1: Documented fconv.
* doc: typo in section on setuid operation.Kaz Kylheku2016-09-171-1/+1
| | | | * txr.1: "require user id" -> "required user id".
* doc: mention USERPROFILE.Kaz Kylheku2016-09-171-7/+14
| | | | | | | * txr.1: Document that on Windows, the home directory is determined from USERPROFILE for finding the ~/.txr_history file as well placing the temporary file for the edit-in-editor interactive feature.
* New awk variable: krs.Kaz Kylheku2016-09-171-4/+24
| | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): New slot, krs. (sys:awk-state loop): Use record-adapter if krs is true, even if the default fs is in effect. Pass value of krs to record-adapter function. (sys:awk-let): Provide krs "awk variable" symbol macro. * txr.1: Documented krs. Clarified semantics of rs being those of both separation and termination.
* New awk variables: ft and kfs.Kaz Kylheku2016-09-161-9/+152
| | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): New slots, ft and kfs. (sys:awk-state rec-to-f): Implement ft and kfs semantics. (sys:awk-let): Provide ft and kfs as "awk variable" via symbol macros. * txr.1: Documented ft and kfs.
* doc: fs variable.Kaz Kylheku2016-09-161-5/+17
| | | | | * txr.1: Improve some wording in the description of the awk fs variable.
* Bugfix in split-str: empty-match regexes.Kaz Kylheku2016-09-161-2/+7
| | | | | | | | | | | * lib.c (split_str_keep): In the regex case, changing to an infinite loop. The do/while is no longer needed because the if statement includes a test of the position having reached the end of the string. This is done before it is incremented by len, so we avoid wrongly keeping a separator. * txr.1: Clarified that an empty regex match behaves like an sep which is an empty string,
* split-str gains ability to keep separating pieces.Kaz Kylheku2016-09-161-1/+13
| | | | | | | | | | | | | | | * eval.c (eval_init): Register split-str to split_str_keep, with optional argument. * lib.c (split_str_keep): New function, formed from split_str, with third argument. (split_str): Reduced to wrapper around split_str_keep. Thus we don't have to update umpteen existing calls with an extra nil parameter. * lib.h (split_str_keep): Declared. * txr.1: Documented new optional argument of split-str.
* key function argument on remq, remql and remqual.Kaz Kylheku2016-09-151-7/+18
| | | | | | | | | | | | | | | | | * eval.c (weave_while): Pass third arg to remq as nil. (eval_init): Update registrations of remq, remql and remqual. * lib.c (remq, remql, remqual): Implement key function argument. * lib.h (remq, remql, remqual): Declarations updated. * sysif.c (at_exit_call): Pass third arg to remq as nil. * debug.c (debug): Pass third argument to remqual as nil. * txr.1: Documentation updated.
* New keepq, keepql and keepqual functions.Kaz Kylheku2016-09-151-0/+43
| | | | | | | | | * eval.c (eval_init): Register keepq, keepql and keepqual intrinsic functions. * lib.c (keepq, keepql, keepqual): New functions. * lib.h (keepq, keepql, keepqual): Declared.
* awk macro: don't bind *stdout* if :output missing.Kaz Kylheku2016-09-141-14/+5
| | | | | | | | * share/txr/stdlib/awk.tl (awk): Bind *stdout* only if awc.output is not nil; i.e. :output has been specified (with a non-nil argument). * txr.1: Revised :output documentation.
* New place-mutating macro: upd.Kaz Kylheku2016-09-141-0/+34
| | | | | | | | * lisplib.c (place_set_entries): Add upd to the auto-load list for place.tl. * share/txr/stdlib/place.tl (upd): New macro. * txr.1: Documented.
* doc: improve lset documentation.Kaz Kylheku2016-09-141-7/+15
| | | | | | | * txr.1: Add missing lset to summary of place-mutating macros. lset actually needs a sequence, not specifically a list: (lset a b c "123") works, and assigns characters. It is now documented accordingly.
* Version 149.txr-149Kaz Kylheku2016-09-121-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* awk macro: revise how implicit block works, and name.Kaz Kylheku2016-09-121-1/+9
| | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-expander): Check that :name designates a symbol, and that it isn't nil. (awk): Move the implicit block to the outermost scope so it encloses all of the clauses. Default to the name awk for the block, rather than nil. * txr.1: Document that the implicit awk block is called awk by default, and that nil is not allowed as a block name.
* awk macro: more Awk-like treatment of prn args.Kaz Kylheku2016-09-121-0/+14
| | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state prn): Use loop instead of simple interpolation, so that we we can individually interpolate each arg into a quasistring. This way if an arg is nil, it turns into nothing rather than the word "nil". * txr.1: Documented this behavior of prn.
* awk macro: fix: rebind *stdout* in broader scope.Kaz Kylheku2016-09-121-11/+42
| | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state loop): Do not bind *stdout* around the call to the main record-processing function. (awk): Re-bind *stdout* around all of the user code, just after the run-time awk state object is constructed. * txr.1: Correct the lies written about :output.
* doc: hyphenation of shorthand.Kaz Kylheku2016-09-121-2/+2
| | | | | * txr.1: Replace a few occurrences of short-hand with shorthand.
* awk macro: new local macros ff and mf.Kaz Kylheku2016-09-121-0/+63
| | | | | | | * share/txr/stdlib/awk.tl (sys:awk-let): New local macros. * txr.1: Documented.
* doc: fix some broken uses of .code and .metaKaz Kylheku2016-09-121-22/+14
| | | | | | | | | | * checkman.txr (check-code): Move match for space after code/meta after the assert, so it is an error if that is missing. * txr.1: Numerous inappropriate or misformatted instances of .code and .meta replaced, removed or adjusted.
* awk macro: field splitting more Awk-like.Kaz Kylheku2016-09-111-11/+44
| | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-state): Initialize fs to nil rather than the default regex. (sys:awk-state rec-to-f): If fs is nil then operate on a version of rec that is filtered through trim-str. Thus fs being nil is like the Awk special case when fs is a space. * txr.1: Description of fs updated.
* Semantics change in trim-str function.Kaz Kylheku2016-09-111-3/+6
| | | | | | | | | * lib.c (trim_str): Trim only newlines and blanks, not carriage returns, vertical tabs and form feeds. This is subject to the compatibility option * txr.1: Doc updated and compatibility note added.
* doc: italicize meta-identifers in nroff mode.Kaz Kylheku2016-09-111-7/+7
| | | | | | | | | | | * txr.1 (meta, metn, gets): In nroff mode, don't just add angle brackets around meta symbols, but also typeset them in italic using \fI...\fP. This is useful because the output of man can be colorized when viewed using the less pager. If these symbols are italicized, then they get colored differently from surrounding text. We keep the angle brackets because it helps these words stand out as "meta" in the absence of color.
* doc: spurious blank line.Kaz Kylheku2016-09-111-1/+0
| | | | * txr.1: Remove extra blank line above Macro flip section.
* New alet macro.Kaz Kylheku2016-09-111-0/+25
| | | | | | | | | * lisplib.c (place_set_entries): Add alet symbol to autoload list for place.tl. * share/txr/stdlib/place.tl (alet): New macro. * txr.1: Documented alet.
* awk macro: implement :begin-file and :end-file.Kaz Kylheku2016-09-101-16/+82
| | | | | | | | | | | | | | | | | | * share/txr/stdlib/awk.tl (sys:awk-compile-time): New slots, begin-file-actions and end-file-actions. (sys:awk-state loop): Take two additional functional arguments for the begin file and end file actions, and do the calls in the right places. unwind-protect triggers the end file function. (sys:awk-expander): Parse out :begin-file and :end-file actions. (awk): Generate lambdas for begin-file and end-file actions, if they are defined. Pass these to the loop method. The code is refactored here to do one big sys:awk-let around everything. * txr.1: Documented :begin-file and :end-file, revising the :begin and :end documentation in the process.
* doc: awk macroKaz Kylheku2016-09-101-0/+696
| | | | * txr.1: New section on the awk macro.
* New slet macro.Kaz Kylheku2016-09-081-6/+27
| | | | | | | | | | | | | | | | * lisplib.c (place_set_entries): Add slet symbol to autoload list for place.tl. * share/txr/stdlib/place.tl (sys:r-s-let-expander): New function. (rlet): Replace body with call to sys:r-s-let-expander. (slet): New macro. * txr.1: Clarification and corrections in rlet description and example. rlet will in fact handle the three-variable rotation case because, since a is not a constant expression, (rlet ((temp a)) ...) reduces to let. Documented new slet.
* New place-mutating operators.Kaz Kylheku2016-09-081-0/+234
| | | | | | | * share/txr/stdlib/place.tl (pinc, pdec, test-set, test-clear, compare-swap, test-inc, test-dec): New macros. * txr.1: Documented.
* Fix poorly chosen :postinit order.Kaz Kylheku2016-09-071-13/+24
| | | | | | | | | * struct.c (call_postinitfun_chain): call base handlers before derived ones, except in backward compatibility mode. * txr.1: Updated documentation of :postinit, and added compatibility note.
* Bugfix: issue with expansion of place macros.Kaz Kylheku2016-09-071-3/+9
| | | | | | | | | | | | | | | | | | | The expansion of a place macro form should not be subject to a complete macro-expansion (as a regular macro form). Only one round of expansion should be performed, and the results should be re-tried as a place macro. Otherwise an opportunity to expland a place macro will be missed. * share/txr/stdlib/place.tl (sys:pl-expand): Use macroexpand-1 rather than macroexpand. * txr.1: Documentation updated to make the new behavior clear. It's unlikely that anything in the world depends on this, so no backward compatibility switch is being provded to the old behavior. In situations where this makes a difference, the old behavior is likely too wrong to be useful.
* Version 148.txr-148Kaz Kylheku2016-09-011-2/+2
| | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise.
* doc: revised merge directive description.Kaz Kylheku2016-09-011-38/+73
| | | | | * txr.1: Substantially rewrote incorrect and incomplete description of merge directive.
* doc: wording changes regarding usage of "query".Kaz Kylheku2016-08-311-41/+64
| | | | | | | | | | | | * txr.1: The term "query language" is retired; "pattern language" is used everywhere. The script argument can be TXR Lisp or TXR, so is referred to as "script-file" in all contexts where it could be either. Clarifications are added in a few places that the script could be Lisp or that some wording only applies when the script is TXR. Removing incorrect, obsolescent wording which specifies that the leading exclamation mark convention is honored in a file name argument.
* doc: warn about exit methods not saving history.Kaz Kylheku2016-08-301-0/+5
| | | | | | * txr.1: Under INTERACTIVE LISTENER, add remarks that using the exit function, or raising a fatal signal, will prevent the history from being saved.
* doc: revise synopsis; document listener invocation.Kaz Kylheku2016-08-301-2/+11
| | | | | | | | | | | * txr.1: Revise the synopsis so that it doesn't insinuate that the query-file or data-file arguments are mandatory. A formatting issue with the brackets around options is fixed. Under ARGUMENTS AND OPTIONS document that if no arguments are present, the interactive listener is launched. Under INTERACTIVE LISTENER, mention that not only does the -i option run the listener, but so does txr invocation with no arguments.
* doc: verb number agreement in Undo Editing.Kaz Kylheku2016-08-301-1/+1
| | | | | * txr.1: Fix plural subject "lines" paired with singular verb "has".
* doc: bad wording in path-private-to-me-pKaz Kylheku2016-08-301-1/+3
| | | | | * txr.1: Fix sentence talking about two functions, respectively, but just one function as its subject.
* Fix runaway recursion in lazy struct initialization.Kaz Kylheku2016-08-281-0/+6
| | | | | | | | | | | | | | | | | | | | | Staci-blowing test case: (defstruct foo nil bar) (mlet ((f (lnew foo bar (not f.bar)))) (prinl f.bar)) * struct.c (lazy_struct_init): Do not flip the lazy flag to zero here. The problem is that it's being done after the funcall(so->slot[0]), and so the struct is still marked for lazy initialization while that function is running. We could detect the circularity (as done in the force function) but that would create inflexibilities in lazy struct initialization. (check_init_lazy_struct): Flip the lazy flag to zero in this function before calling lazy_struct_init. * txr.1: Document behavior of struct being freely accessible during lazy initialization.
* Fix formatting of list* syntax.Kaz Kylheku2016-08-261-1/+1
| | | | * txr.1: list* symbol was typeset as meta.
* Adding time-parse method.Kaz Kylheku2016-08-251-0/+51
| | | | | | | | | | | | | | | | | | | | * lib.c (time_parse_s): New symbol variable. (tm_to_time_struct): New static function, based on code moved out of broken_time_struct. (broken_time_struct): Bulk of code replaced with call to tm_to_time_struct. (time_struct_to_tm): New parameter, strict. Indicates whether nils in time struct are converted to zeros, or whether they trigger errors. (time_string_meth): Specify strict conversion of argument time struct to to struct tm when calling time_struct_to_tm. (time_parse_meth): New static function. (time_init): Initialize time_parse_s symbol variable; add time-parse static slot to time struct; initialize slot with new method. * txr.1: Document time-parse method.