diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-11-17 20:06:13 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-11-20 16:17:19 -0800 |
commit | 49b863afbd7e78dcc07d20df6652a969d919921e (patch) | |
tree | 00212d2a05792a822e8f8e2d3475f7f6193f0632 /filter.c | |
parent | e557d7bc37def93fb56196dd286b6a337fdfa0c4 (diff) | |
download | txr-49b863afbd7e78dcc07d20df6652a969d919921e.tar.gz txr-49b863afbd7e78dcc07d20df6652a969d919921e.tar.bz2 txr-49b863afbd7e78dcc07d20df6652a969d919921e.zip |
Renaming html filters to get rid of underscore.
* filter.c (to_html_k, from_html_k, to_html_relaxed_k):
Variables removed.
(tohtml_k, tohtml_star_k, fromhtml_k): New keyword
symbol variables.
(to_html_table): Array renamed to tohtml_table.
(to_html_relaxed_table): Renamed to tohtml_star_table.
(from_html_table): Renamed to fromhtml_table.
(html_encode): Refers to tohtml_k.
(html_encode_star): Refers to tohtml_star_k.
(html_decode): Refers to fromhtml_k.
(filter_init): Initialize new symbol variables. Remove old
registrations. Register filters under old names too.
* txr.1: Document new names.
Diffstat (limited to 'filter.c')
-rw-r--r-- | filter.c | 34 |
1 files changed, 19 insertions, 15 deletions
@@ -44,8 +44,8 @@ #include "stream.h" val filters; -val filter_k, lfilt_k, rfilt_k, to_html_k, from_html_k; -val to_html_relaxed_k; +val filter_k, lfilt_k, rfilt_k, tohtml_k, fromhtml_k; +val tohtml_star_k; val upcase_k, downcase_k; val topercent_k, frompercent_k, tourl_k, fromurl_k; val tonumber_k, toint_k, tofloat_k, hextoint_k; @@ -276,7 +276,7 @@ val register_filter(val sym, val table) return sethash(filters, sym, build_filter_from_list(table)); } -static struct filter_pair to_html_table[] = { +static struct filter_pair tohtml_table[] = { { wli("<"), wli("<") }, { wli(">"), wli(">") }, { wli("&"), wli("&") }, @@ -285,14 +285,14 @@ static struct filter_pair to_html_table[] = { { 0, 0 } }; -static struct filter_pair to_html_relaxed_table[] = { +static struct filter_pair tohtml_star_table[] = { { wli("<"), wli("<") }, { wli(">"), wli(">") }, { wli("&"), wli("&") }, { 0, 0 } }; -static struct filter_pair from_html_table[] = { +static struct filter_pair fromhtml_table[] = { { wli("""), wli("\"") }, { wli("&"), wli("&") }, { wli("'"), wli("'") }, @@ -680,17 +680,17 @@ val url_decode(val str, val space_plus) static val html_encode(val str) { - return trie_filter_string(get_filter(to_html_k), str); + return trie_filter_string(get_filter(tohtml_k), str); } static val html_encode_star(val str) { - return trie_filter_string(get_filter(to_html_relaxed_k), str); + return trie_filter_string(get_filter(tohtml_star_k), str); } static val html_decode(val str) { - return trie_filter_string(get_filter(from_html_k), str); + return trie_filter_string(get_filter(fromhtml_k), str); } void filter_init(void) @@ -701,9 +701,9 @@ void filter_init(void) filter_k = intern(lit("filter"), keyword_package); lfilt_k = intern(lit("lfilt"), keyword_package); rfilt_k = intern(lit("rfilt"), keyword_package); - to_html_k = intern(lit("to_html"), keyword_package); - to_html_relaxed_k = intern(lit("to_html_relaxed"), keyword_package); - from_html_k = intern(lit("from_html"), keyword_package); + tohtml_k = intern(lit("tohtml"), keyword_package); + tohtml_star_k = intern(lit("tohtml*"), keyword_package); + fromhtml_k = intern(lit("fromhtml"), keyword_package); upcase_k = intern(lit("upcase"), keyword_package); downcase_k = intern(lit("downcase"), keyword_package); topercent_k = intern(lit("topercent"), keyword_package); @@ -715,14 +715,18 @@ void filter_init(void) tofloat_k = intern(lit("tofloat"), keyword_package); hextoint_k = intern(lit("hextoint"), keyword_package); - sethash(filters, to_html_k, build_filter(to_html_table, t)); - sethash(filters, to_html_relaxed_k, build_filter(to_html_relaxed_table, t)); + sethash(filters, tohtml_k, build_filter(tohtml_table, t)); + sethash(filters, tohtml_star_k, build_filter(tohtml_star_table, t)); { - val trie = build_filter(from_html_table, nil); + val trie = build_filter(fromhtml_table, nil); trie_add(trie, lit("&#"), func_n1(html_numeric_handler)); trie_compress(mkcloc(trie)); - sethash(filters, from_html_k, trie); + sethash(filters, fromhtml_k, trie); } + sethash(filters, intern(lit("to_html"), keyword_package), + get_filter(tohtml_k)); + sethash(filters, intern(lit("from_html"), keyword_package), + get_filter(fromhtml_k)); sethash(filters, upcase_k, func_n1(upcase_str)); sethash(filters, downcase_k, func_n1(downcase_str)); sethash(filters, topercent_k, curry_12_1(func_n2(url_encode), nil)); |