summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-29 13:03:47 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-29 13:03:47 -0700
commitab99601555d48297af0897c022a8288283318100 (patch)
tree6ea988e2530fc51b731cb66df0283c51645e3aff /eval.c
parent12800700f93639c259757f0f9def1546d215ee95 (diff)
downloadtxr-ab99601555d48297af0897c022a8288283318100.tar.gz
txr-ab99601555d48297af0897c022a8288283318100.tar.bz2
txr-ab99601555d48297af0897c022a8288283318100.zip
json: functions put-json and put-jsonl.
* eval.c (eval_init): Register put-json and put-jsonl intrinsics. * lib.c (out_json_str): Do not output the U+DC01 to U+DCFF code points by masking them and using put_byte. This is unnecessary; if we just send them as-is to the text stream, the UTF-8 encoder does that for us. (put_json, put_jsonl): New functions. * lib.h (put_json, put_jsonl): Declared. * txr.1: Documented. The bulk of tojson is moved under the descriptions of these new functions, and elsewhere where the document pointed to tojson for more information, it now points to put-json. More detailed description of character treatment is given. * share/txr/stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index ca7f09f5..b9055404 100644
--- a/eval.c
+++ b/eval.c
@@ -6875,6 +6875,8 @@ void eval_init(void)
reg_fun(intern(lit("pprinl"), user_package), func_n2o(pprinl, 1));
reg_fun(intern(lit("tprint"), user_package), func_n2o(tprint, 1));
reg_fun(intern(lit("tojson"), user_package), func_n2o(tojson, 1));
+ reg_fun(intern(lit("put-json"), user_package), func_n3o(put_json, 1));
+ reg_fun(intern(lit("put-jsonl"), user_package), func_n3o(put_jsonl, 1));
reg_fun(intern(lit("display-width"), user_package), func_n1(display_width));
reg_fun(intern(lit("fmt-simple"), system_package), func_n5o(fmt_simple, 1));