diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-03-28 19:14:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-03-28 19:14:53 -0700 |
commit | 084bde656bac142bba5311b519c7bb78e2c45dad (patch) | |
tree | 4966a7893b0d06768ca530ebf6ed97fe4d3c8a28 /txr.c | |
parent | 051bf360110a5b9649fe9a2b5b35b2dcfed868d6 (diff) | |
download | txr-084bde656bac142bba5311b519c7bb78e2c45dad.tar.gz txr-084bde656bac142bba5311b519c7bb78e2c45dad.tar.bz2 txr-084bde656bac142bba5311b519c7bb78e2c45dad.zip |
* eval.c (prinl, pprinl): Become external functions.
(tprint): New function.
(eval_init): Register tprint as intrinsic.
* eval.h (prinl, pprinl, tprint): Declared.
* txr.c (txr_main): New option, -t.
* txr.1: Documented tprint and -t option.
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -127,6 +127,7 @@ static void help(void) "-p expression Like -e, but prints the result of the expression\n" " using the prinl function.\n" "-P expression Like -p, but prints using pprinl.\n" +"-t expression Like -p, but prints using tprint.\n" "-C N Request backward-compatible behavior to the\n" " specified version of TXR.\n" "--help You already know!\n" @@ -503,7 +504,7 @@ int txr_main(int argc, char **argv) /* Single letter options with args: non-clumping. */ - if (length(arg) == two && find(ref(arg, one), lit("acfepPC"), nil, nil)) + if (length(arg) == two && find(ref(arg, one), lit("acfepPtC"), nil, nil)) { val opt = chr_str(arg, one); @@ -536,12 +537,15 @@ int txr_main(int argc, char **argv) break; case 'p': case 'P': + case 't': { val (*pf)(val obj, val out) = if3(c_chr(opt) == 'p', - obj_print, obj_pprint); + prinl, + if3(c_chr(opt) == 'P', + pprinl, + tprint)); pf(eval_intrinsic(lisp_parse(arg, std_error, colon_k), make_env(bindings, nil, nil)), std_output); - put_char(chr('\n'), std_output); evaled = t; } break; @@ -590,6 +594,7 @@ int txr_main(int argc, char **argv) case 'P': case 'f': case 'C': + case 't': case 'D': format(std_error, lit("~a: option -~a does not clump\n"), prog_string, opch, nao); |