diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-07-19 06:46:22 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-07-19 17:17:40 -0700 |
commit | 5d224bc42497072c259eb0696db5497312ac0b6c (patch) | |
tree | 80740728d60ebfb8201983d53c0d08b6110fc0e6 /txr.1 | |
parent | 33c0a11858294c7888de4f37038bbdc691e8d2dc (diff) | |
download | txr-5d224bc42497072c259eb0696db5497312ac0b6c.tar.gz txr-5d224bc42497072c259eb0696db5497312ac0b6c.tar.bz2 txr-5d224bc42497072c259eb0696db5497312ac0b6c.zip |
Named filters now stored in new *filters* hash.
* filter.c (filters): Global variable removed.
(filter_s): New symbol variable.
(filter_init): Remove gc-protection from removed variable.
Intern the *filters* symbol. Use local variable for filters
hash, create the *filters* special variable and store the hash
into that.
* filter.h (filters): Variable declaraton removed.
(filters): New macro: expands to an expression designating
the current value of *filters* in the dynamic environment.
* txr.1: Documented *filters*, adding a forward reference to
it from the description of filtering.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -3473,6 +3473,9 @@ have different special characters or other syntax, requiring escaping or similar treatment. Note that it is also possible to use a function as a filter. See Function Filters below. +Named filters are stored in the hash table held in the Lisp special variable +.codn *filters* . + .coIP @(filter) The .code filter @@ -52160,6 +52163,42 @@ results in more compact syntax. Note: this function is useful for creating a compact, prefix-compressed regular expression which matches a list of strings. +.coNP Special variable @ *filters* +.desc +The +.code *filters* +special variable holds a hash table which associates symbols with +filters. This hash table defines the named filters used in the +\*(TX pattern language. The names are the hash table keys, and filter +objects are the values. Filter objects are one of three representations. +The value +.code nil +represents a null filter, which performs no filtering, passing the input +string through. A filter object may be a raw or compressed trie. +It may also be a Lisp function, which must be callable with one argument +of string type, and must return a string. + +The application may define new filters by associating symbolic keys in +.code *filters* +with values which conform to the above representation of filters. + +The behavior is unspecified if any of the predefined filters +are removed or redefined, and are subsequently used, or if the +.code *filters* +variable is replaced or rebound with a hash table value which omits +those keys, or associates them with different values. + +Note that functions +.codn html-encode , +.code html-encode* +and +.code html-decode +use, respectively, the HTML-related +.codn :tohtml , +.code :tohtml* +and +.codn :fromhtml . + .SS* Access To TXR Pattern Language From Lisp It is useful to be able to invoke the abilities of the \*(TX pattern Language |