unoidl2

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/unoidl2.git/
Log | Files | Refs

commit 12a1595a92bd0d44937e18a3b6bea27ea4161b8a
parent 8cdaced40bf4b913d8ae8831ac46b72857efe4a8
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 18 Mar 2012 12:36:47 +0100

print_sym2_custom introduced

Diffstat:
Munoidl2.c | 13+++++++++++--
Munoidl2.h | 1+
Munoidl2java.c | 7++-----
3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/unoidl2.c b/unoidl2.c @@ -179,17 +179,26 @@ void print_sym1(Any x) { } } -void print_sym2(Any x) { +static char *print_sym2_sep = "."; + +static void print_sym2(Any x) { Any kpv = car(x); if(NIL != kpv) { Any k = car(kpv); Any p = cadr(kpv); print_sym2(p); - if(NIL != car(p)) printf("."); + if(NIL != car(p)) printf("%s", print_sym2_sep); print_sym1(k); } } +void print_sym2_custom(Any x, char *sep) { + char *s = print_sym2_sep; + print_sym2_sep = sep; + print_sym2(x); + print_sym2_sep = s; +} + Any print(Any x) { if(NIL == x) printf("NIL"); diff --git a/unoidl2.h b/unoidl2.h @@ -58,6 +58,7 @@ Any cdddddr(Any x); Any caar(Any x); int equal_(Any x, Any y); Any equal(Any x, Any y); +void print_sym2_custom(Any x, char *sep); Any print(Any x); Any some(Fn1 test, Any lst); Any mapc(Fn1 fn, Any x); diff --git a/unoidl2java.c b/unoidl2java.c @@ -55,11 +55,8 @@ static void pp_list(Any x, char *sep) { } static void pr_module(Any x, char *sep, int dot) { - if(NIL != x) { - pr_module(cdr(x), sep, 1); - pp(car(x)); - if(dot) pr(sep); - } + print_sym2_custom(x, sep); + if(dot) pr(sep); } static Any last(Any x) {