summaryrefslogtreecommitdiffstats
path: root/filter.h
Commit message (Collapse)AuthorAgeFilesLines
* Bumping copyrights to 2014 and expressing them as year ranges.Kaz Kylheku2013-12-101-1/+1
| | | | Fixing some errors in copyright comments.
* Filtering on lists and nested lists is hereby made to work.Kaz Kylheku2012-03-261-1/+1
| | | | | | | | | | | | | | | | | | For instance given @(bind a ("a" "b" "c")) it is now possible to do @(filter :upcase a) whereby a promptly takes on the value ("A" "B" "C"). * filter.c (string_filter): Function renamed to string_tree_filter. (compound_filter): Follows rename. (filter_string): Function renamed to filter string tree. Can filter tree of strings, or possibly other objects, if the filter function allows. (filter_equal): No special case test for objects that are strings. Just put them through the filter. * filter.h (filter_string): Declaration updated. * match.c (format_field, subst_vars, v_filter): Follow rename.
* * eval.c (eval_init): New intrinsic num-str registered.Kaz Kylheku2012-03-261-0/+1
| | | | | | | | | | | | | | | * filter.c (tonumber_k, tointeger_k, tofloat_k, hextoint_k): New keyword variables. (filter_init): New variables initialized; new filters registered. * filter.h (tonumber_k, tointeger_k, tofloat_k, hextoint_k): Declared. * lib.c (num_str): New function. * lib.h (num_str): Declared. * txr.1: New filters documented.
* * eval.c (eval_init): url_decode has two parameters now,Kaz Kylheku2012-03-181-3/+3
| | | | | | | | | | | | | | | | | | so we make the second one optional. * filter.c (topercent_k, frompercent_k): New keyword variables. (url_encode, url_decode): Take a second parameter, space_plus. This determines whether or not to apply the rule that a space encodes as a + character. (filter_init): Initialize new keyword variables, and register :topercent and :frompercent filters. Fix the previous registrations of :tourl and :fromurl using currying. * filter.h (urlencode, urldecode): Declarations updated. (topercent_k, frompercent_k): Declared. * txr.1: Documented.
* Implementing URL filtering.Kaz Kylheku2012-03-131-0/+5
| | | | | | | | | | | | | | | | * eval.c (eval_init): New intrinsic functions: url-encode, url-decode. * filter.c (tourl_k, fromurl_k): New keyword variables. (is_url_reserved, digit_value): New static functions. (url_encode, url_decode): New functions. (filter_init): Intialize new keyword variables and register new :tourl and :fromurl filters. * filter.h (tourl_k, fromurl_k, url_encode, url_decode): Declared. * txr.1: Updated. * txr.vim: Likewise.
* * arith.c: Updated copyright year.Kaz Kylheku2012-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * arith.h: Likewise. * debug.c: Added copyright header. * debug.h: Updated copyright year. * eval.c: Likewise. * eval.h: Likewise. * filter.c: Likewise. * filter.h: Likewise. * gc.c: Likewise. * gc.h: Likewise. * hash.c: Likewise. * hash.h: Likewise. * lib.c: Likewise. * lib.h: Likewise. * match.c: Likewise. * match.h: Likewise. * parser.h: Likewise. * regex.c: Likewise. * regex.h: Likewise. * stream.c: Likewise. * stream.h: Likewise. * txr.c: Likewise, and e-mail address. * txr.h: Updated copyright year. * unwind.c: Likewise. * unwind.h: Likewise.
* * filter.c (fun_k): New keyword variable.Kaz Kylheku2011-10-251-0/+1
| | | | | | | (function_filter): Use :fun keyword symbol instead of fun. (filter_init): New keyword variable initialized. * filter.h (upcase_k, downcase_k, fun_k): Declared.
* Task #11474Kaz Kylheku2011-10-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * filter.c (filter_equal): Takes two filters instead of one. (lfilt_k, rfilt_k): New keyword variables. (filter_init): New keyword variables initialized. * filter.h (filter_equal): Declaration updated. (lfilt_k, rfilt_k): Declared. * lib.c (funcall4): New function. (do_curry_1234_34): New static function. (curry_1234_34): New function. (do_swap_12_21): New static function. (swap_12_21): New function. * lib.h (funcall4, curry_1234_34, swap_12_21): Declared. * match.c (dest_bind): Swap use the function argument swapping combinator when calling tree find such that the value being searched is on the left and pattern material is on the right. (v_bind): Implemented :lfilt and :rfilt. * txr.1: Documented :lfilt and :rfilt.
* * filter.c (get_filter_trie): Function renamed to get_filter. A filterKaz Kylheku2011-10-221-1/+1
| | | | | | | | | | | | | | is not necessarily a trie. (string_filter, compound_filter): New functions. (get_filter): Recognize a compound filters and return a function which implements it. * filter.h (get_filter_trie): Declaration renamed. * match.c (format_field, v_bind, v_output): Follow get_filter_trie rename. Error message text updated. * txr.1: Describe compound filters.
* Task #11474Kaz Kylheku2011-10-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | * filter.c (filter_equal): New function. (upcase_k, downcase_k): New keyword variables. (filter_init): New keyword variables initialized, and new upcase and downcase filters registered. * filter.h (filter_equal): Declared. * lib.c (tree_find): Takes new argument, the equality test function. (upcase_str, downcase_str): New functions. (do_curry_123_23): New static function. (curry_123_23): New function. * lib.h (tree_find): Declaration updated. (upcase_str, downcase_str, curry_123_23): Declared. * match.c (dest_bind): Updated to take equality function. Uses it and passes it down to tree_find. (v_bind): Filter feature implemented. (h_var, v_try): Add equal_f to dest_bind argument list. * txr.1: Updated to describe new filters and bind arguments.
* * LICENSE, Makefile, configure, filter.c, filter.h, gc.c, gc.h, hash.c,Kaz Kylheku2011-10-041-1/+1
| | | | | | hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y, regex.c, regex.h, stream.c, stream.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Updated e-mail address.
* New feature: @(deffilter)Kaz Kylheku2011-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Bugfix in @(throw) when non-symbol is thrown: exception message referred to the symbol throw rather than the erroneous object. * filter.c (build_filter_from_list, register_filter): New functions. * filter.h (register_filter): New function declared. * lib.c (deffilter_s): New variable defined. (chain): Function changed from single list argument to variable argument list to reduce the complexity of use. (do_and, and): New functions. (obj_init): deffilter_s initializatio added. * lib.h (deffilter_s, and): New declarations. (chain): Declaration updated to new function signature. (eq): Changed from macro to inline function. * match.c (do_output_line): Simplified expression involving chain. (do_output): Likewise. (match_files): Bugfix in error handling of throw. Implementation of deffilter. * txr.1: Documented deffilter.
* Filtering from HTML implemented.Kaz Kylheku2011-09-251-1/+1
| | | | | | | * filter.c (from_html_k): New variable. (to_html_table): New static array. (filter_init): Intern new symbol. Instantiate new filter and store in filters hash.
* Filtering feature for variable substitution in output.Kaz Kylheku2011-09-251-0/+36
* filter.c, filter.h: New files. * Makefile (OBJS): filter.o added. * gc.c (mark_obj): Mark new alloc field of string objets. * hash.c (struct hash): New member, userdata. (hash_mark): Mark new userdata member of hash. (make_hash): Initialize userdata. (get_hash_userdata, set_hash_userdata, hashp): New functions. * hash.h (get_hash_userdata, set_hash_userdata, hashp): New functions declared. * lib.c (getplist, string_extend, cobjp): New functions. (string_own, string, string_utf8): Initialize new alloc field to nil. (mkstring, mkustring): Initialize new alloc field to actual size. (length_str): When length is computed and cached, also compute and cache alloc. (init): Call filter_init. * lib.h (string string): New member, alloc. (num_fast): Macro converted to inline function. (getplist, string_extend, cobjp): New functions declared. * match.c (match_line): Follows change of modifier s-exp syntax. (format_field): New parameter, filter. New modifier syntax parsed. Filter retrieved, and applied. (subst_vars): New parameter, filter. Filter is either applied in this function or passed to format_field, as needed. (eval_form): Pass nil to new parameter of subst_vars. (do_output_line): New parameter, filter. Passed down to subst_vars. (do_output): New parameter, filter. Passed down to do_output_line. (match_files): Pass nil filter to subst_vars in cat directive. Output directive refactored to parse keywords, extract the filter and pass down to do_output. * parser.y (regex): Generate (sys:regex regex syntax ...) instead of (regex syntax ...). (elem, expr): Updated w.r.t. regex syntax change. (var): Cases '{' IDENT regex '}' and '{' IDENT NUMBER '}' are removed. new syntax '{' IDENT exprs '}' to handle these more generally and allow for keywords. * txr.1: Updated.