summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Going back to unmodified 2-Clause BSD License.Kaz Kylheku2016-09-229-75/+67
| | | | | | | | | | | | | | | | | | | | | | | | | * LICENSE: Reverted to Two-Clause BSD license. The copyright of the Linenoise library are included, because it uses exactly the same license. A note is added about MPI being in the public domain. * LICENSE-CYG: Revised text to clarify the situation that Cygnal is only bundled with a particular Windows build of TXR. * METALICENSE: Revised text. All references to modifications to the BSD license are removed. Gives pointers to the MPI and linenoise license files. Notes that linenoise is under the Two-Clause BSD also. Makes a note about Cygnal and points to LICENSE-CYG. * inst.nsi: Remove the text which tells the user that use of the program requires agreement with the license; refer only to redistribution. The "Agree" buttons are renamed "Acknowledge". * mpi/make-logtab, mpi/mpi.c, mpi/mpi.h, mpi/mplogic.c, mpi/mplogic.h: Remove copyright notices and "all rights reserved", since the author had placed this into the public domain, as made explicit in the README file.
* 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-222-6/+110
| | | | | | | | * 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-222-27/+59
| | | | | | | | | * 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-212-2/+29
| | | | | | | | | * 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.
* Move regex intrinsic registrations to regex.c.Kaz Kylheku2016-09-212-14/+14
| | | | | | | | * eval.c (eval_init): Remove all regex-related function registrations from here. * regex.c (regex_init): Move regex-related function registrations here.
* Use rlet in a few place macros for better code.Kaz Kylheku2016-09-211-3/+3
| | | | | | * share/txr/stdlib/place.tl (pset, push, pushnew): Use rlet for binding the assigned or pushed value to a temporary, so the temporary can disappear if the value is a constant.
* Fix broken sys:rslot place.Kaz Kylheku2016-09-211-4/+4
| | | | | | | | | | | | This is used in the awk macro. Breaking test case is an update modification of f, like (push 3 f); a broken call to sys:rslotset is generated with a too few arguments. * share/txr/stdlib/struct.tl (defplace sys:rslot): Fix name clash between gensym and parameter. Add the meth-slot-sym parameter into the sys:rslotset call where it is missing as a required parameter.
* 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.
* awk macro: streamline field splitting.Kaz Kylheku2016-09-211-13/+7
| | | | | | | | | * share/txr/awk.tl (sys:awk-state rec-to-f): Check for empty record only in the fs case; it's not necessary when tokenizing with ft. Check (not self.kfs) first, since it's the common case. Handle default case (no fs or ft) using tok-str using the regex #/[^ \t\n]+/, which requires no trim-str and no empty record check.
* New library feature: imperative list building.Kaz Kylheku2016-09-203-0/+403
| | | | | | | | | | | * 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-186-354/+396
| | | | | | | | | | * 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-183-1/+201
| | | | | | | | | * 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.
* linenoise: use USERPROFILE for home dir on Cygnal.Kaz Kylheku2016-09-171-1/+18
| | | | | | | * linenoise/linenoise.c (get_home): New static function. (edit_in_editor): Call get_home instead of getenv("HOME").
* New awk variable: krs.Kaz Kylheku2016-09-172-7/+30
| | | | | | | | | | | * 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.
* Tests for tok-str.Kaz Kylheku2016-09-172-0/+73
| | | | * tests/015/split.tl: New cases added.
* Adding tests for split-str.Kaz Kylheku2016-09-173-0/+127
| | | | | | | | * Makefile (TXR_DBG_OPTS): Disable for tst/tests/015. * tests/common.tl (mtest): New macro. * tests/015/split.tl: New file.
* Bugfix in tok-str: empty-match regexes.Kaz Kylheku2016-09-161-10/+7
| | | | | | | | | | | | | | * lib.c (tok_str): Only continue the loop if the new position isn't past the end of the string. This fixes the problem of recognizing an empty token past the last character in the string. Also, advance new_pos by one if there is a zero length match. Then don't advance pos by one later in that case. This fixes the bug that we collect empty separator pieces *and* empty tokens, and also prevents empty matches before the first character of the string. Logic in tok_str is now very similar to that in split_str_keep.
* New awk variables: ft and kfs.Kaz Kylheku2016-09-162-14/+164
| | | | | | | | | | * 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-162-6/+12
| | | | | | | | | | | * 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-164-3/+29
| | | | | | | | | | | | | | | * 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.
* regex: optimize double complement.Kaz Kylheku2016-09-161-40/+46
| | | | * regex.c (reg_optimize): Implement ~~R -> R reduction.
* Merge macro expanders for while and until.Kaz Kylheku2016-09-161-27/+14
| | | | | | | | | | | * eval.c (me_while, me_until, me_while_star, me_until_star): Functions removed. (me_while_until, me_while_until_star): New functions. Here we just check the form symbol and add the negation to the test. Also: use of (zap flag) in the while* and until* expansion has been replaced with (set flag nil), because zap wastefully arranges to yield the prior value, which is not used at all.
* fix broken while* and until*.Kaz Kylheku2016-09-161-2/+2
| | | | | eval.c (me_while_star, me_until_star): for loop test must be a sequence of forms, not a single form.
* regex: add case to complement optimization.Kaz Kylheku2016-09-151-0/+2
| | | | | | | | * regex.c (reg_optimize): Based on the reasoning in the previous commit, we can also statically optimize a complement whose argument is the t regex: match nothing. We convert that to match everything: the .* regex. Now (regex-compile "~[]") -> #/.*/.
* regex: fix broken complement operator.Kaz Kylheku2016-09-151-1/+3
| | | | | | | | | | | | | | | | | | | The form (match-regex "xy" #/~ab/) should return 2 (full match) because "xy" is in the complement of the set { "ab" }. It wrongly returns 1. * regex.c (reg_derivative): Handle the case when the derivative of the complement's constituent expression yields nil. This means that the complemented regex matches the input. In this case, the complement must lapse to the .+ regex: match one or more characters. That is to say, if the input has at least one more character, there is a match, which covers all such characters. Otherwise there is no match: the input matches the complemented regex. In the t case, the return value is also wrong. If the complemented regex hits a brick wall (matches nothing, not even the empty string), the correct complement is "match everything": the .* regex. Not the match empty string regex!
* key function argument on remq, remql and remqual.Kaz Kylheku2016-09-156-23/+48
| | | | | | | | | | | | | | | | | * 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-154-0/+110
| | | | | | | | | * 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-142-15/+7
| | | | | | | | * 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-143-1/+40
| | | | | | | | * 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.
* Fix broken keep/remove functions.Kaz Kylheku2016-09-141-19/+10
| | | | | | | | * lib.c (remq, remql, remqual, remove_if, keep_if): Bug: functions don't work correctly for strings. Anyway, the ldiff-based algorithm is ugly on vectors and strings. Patching things upp by converting input to list with tolist.
* Version 149.txr-149Kaz Kylheku2016-09-126-362/+422
| | | | | | | | | | * 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-122-31/+45
| | | | | | | | | | | | * 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-122-1/+20
| | | | | | | | | | * 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-122-13/+44
| | | | | | | | | | * 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-122-1/+70
| | | | | | | * 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-122-23/+15
| | | | | | | | | | * 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: don't use cat-str to update rec.Kaz Kylheku2016-09-111-1/+1
| | | | | | * share/txr/stdlib/awk.tl (sys:awk-state f-to-rec): Use quasiliteral to combine fields to reconstitute rec; cat-str works only with characters and strings.
* awk macro: field splitting more Awk-like.Kaz Kylheku2016-09-112-17/+58
| | | | | | | | | | | * 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-112-7/+18
| | | | | | | | | * 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.
* Replace some rlet and slet uses with alet.Kaz Kylheku2016-09-111-13/+15
| | | | | | | | | | | * share/txr/stdlib/place.tl (nthcdr): Fix a potentially wrong order of evaluation by using a temporary symbol for the list and using alet. If the list form could potentially modify the index, then we now avoid a bug here. (vecref, chr-str, ref, gethash, slot): Optimise the expansion of these two-expression places using alet. If both expressions are symbols, which is often the case, temporaries are avoided.
* New alet macro.Kaz Kylheku2016-09-113-1/+32
| | | | | | | | | * 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.