unoidl2

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

commit a0e0978b6044a69fc3c28759fbbcc45da7bfac7f
parent ffc9d113e722f27996752dae2d98256c86590943
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sun, 18 Mar 2012 11:17:07 +0100

no env arg to mapc anymore, simpler this way

Diffstat:
Munoidl2.c | 14+++++++-------
Munoidl2.h | 4++--
Munoidl2ast.c | 12++++++------
Munoidl2java.c | 26+++++++++++++-------------
4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/unoidl2.c b/unoidl2.c @@ -235,10 +235,10 @@ Any some(Fn1 test, Any lst) { return NIL; } -Any mapc(void *env, Any (*fn)(void *env, Any e), Any x) { +Any mapc(Fn1 fn, Any x) { Any z = NIL; for(Any y = x; NIL != y; y = cdr(y)) - z = fn(env, car(y)); + z = fn(car(y)); return z; } @@ -291,11 +291,11 @@ static void run1_module(Any x) { Any v = get2(module2); if(NIL == v) set2(module2, car(x)); - mapc(NULL, run1, cddr(x)); + mapc(run1, cddr(x)); module2 = p; } -static Any subst2(void *env, Any x) { +static Any subst2(Any x) { Any y; if(consp(x)) { switch(kind(car(x))) { @@ -309,7 +309,7 @@ static Any subst2(void *env, Any x) { con(y, NIL); break; default: - mapc(NULL, subst2, x); + mapc(subst2, x); } } return x; @@ -320,10 +320,10 @@ static void run1_leave(Any x) { if(NIL != get2(s)) printf("@@@ run1_leave error: duplicate "); set(cdr(x), s); - set2(s, subst2(NULL, x)); + set2(s, subst2(x)); } -Any run1(void *env, Any x) { +Any run1(Any x) { switch(kind(car(x))) { case MODULE: run1_module(x); break; case DEFINTERFACE: diff --git a/unoidl2.h b/unoidl2.h @@ -61,9 +61,9 @@ int equal_(Any x, Any y); Any equal(Any x, Any y); Any print(Any x); Any some(Fn1 test, Any lst); -Any mapc(void *env, Any (*fn)(void *env, Any e), Any x); +Any mapc(Fn1 fn, Any x); Any find(Any elt, Any lst, Fn2 cmp, Fn1 key); Any reverse(Any x, Any a); Any id(Any x); -Any run1(void *env, Any x); +Any run1(Any x); void init(); diff --git a/unoidl2ast.c b/unoidl2ast.c @@ -26,21 +26,21 @@ extern int yyparse(); extern const Any NIL; extern const Any ast; -static Any pr1(void *env, Any x) { +static Any pr1(Any x) { print(x); printf("\n\n"); } -static Any print2cell(void *env, Any x) { +static Any print2cell(Any x) { Any c = cdr(x); Any kpv = car(x); Any k = car(kpv); Any p = cadr(kpv); Any v = cddr(kpv); if(NIL == v) { - mapc(NULL, print2cell, c); + mapc(print2cell, c); } else if(MODULE == kind(v)) { - mapc(NULL, print2cell, c); + mapc(print2cell, c); } else if(NIL == c) { print(v); } else { @@ -56,8 +56,8 @@ int main() { init(); yyparse(); //mapc(NULL, pr1, ast); - mapc(NULL, run1, ast); - print2cell(NULL, root2); + mapc(run1, ast); + print2cell(root2); //print(ast); //printf("\n"); return 0; diff --git a/unoidl2java.c b/unoidl2java.c @@ -166,7 +166,7 @@ static Any find_struct(Any x) {return find(x, structs, matching_struct_p, car);} static Any resolve_typedef(Any x) {return find(x, typedefs, equal, car);} -static Any pr_default_slot(void *env, Any slot) { +static Any pr_default_slot(Any slot) { Any n = car(slot); Any t = cadr(slot); Any e; @@ -206,7 +206,7 @@ static Any pr_default_slot(void *env, Any slot) { } static void pr_default_slots(Any slots) { - mapc(NULL, pr_default_slot, slots); + mapc(pr_default_slot, slots); } static int pr_slots_rec1(Any super) { @@ -305,7 +305,7 @@ static Any kindeq(Kind k, Any a) {return k == kind(a) ? T : NIL;} static Any readonlyp(Any a) {return kindeq(READONLY, a);} -static Any pr_TypeInfo1(void *env, Any x) { +static Any pr_TypeInfo1(Any x) { int f = 0; Any t = NIL; switch(kind(car(x))) { @@ -350,7 +350,7 @@ static Any pr_TypeInfo1(void *env, Any x) { return NIL; } -static Any pr_TypeInfo1_attribute(void *env, Any x) { +static Any pr_TypeInfo1_attribute(Any x) { if(ATTRIBUTE == kind(car(x))) { pr_TypeInfo1(env, x); if(NIL == some(readonlyp, cadddr(x))) @@ -359,7 +359,7 @@ static Any pr_TypeInfo1_attribute(void *env, Any x) { return NIL; } -static Any pr_TypeInfo1_nonattribute(void *env, Any x) { +static Any pr_TypeInfo1_nonattribute(Any x) { if(ATTRIBUTE != kind(car(x))) pr_TypeInfo1(env, x); return NIL; @@ -471,13 +471,13 @@ static void pr_exception(Any x) { } } -static Any pr_definterface_attribute(void *env, Any x) { +static Any pr_definterface_attribute(Any x) { if(ATTRIBUTE == kind(car(x))) pp(x); return NIL; } -static Any pr_definterface_nonattribute(void *env, Any x) { +static Any pr_definterface_nonattribute(Any x) { if(ATTRIBUTE != kind(car(x))) pp(x); return NIL; @@ -507,8 +507,8 @@ static void pr_definterface(Any x) { use_XInterface = 0; pl(" {"); if(!(equal_(name, XInterface) && equal_(module, uno_star_sun_com))) { - mapc(NULL, pr_definterface_attribute, body); - mapc(NULL, pr_definterface_nonattribute, body); + mapc(pr_definterface_attribute, body); + mapc(pr_definterface_nonattribute, body); pr_TypeInfo(body); } pl("}"); @@ -528,14 +528,14 @@ static void pr_method(Any x) { pl(";"); } -static Any pr_attribute_get(void *env, Any e) { +static Any pr_attribute_get(Any e) { if(GET == kind(car(e))) { pr(" throws "); pp_list(cadr(e), ", "); } } -static Any pr_attribute_set(void *env, Any e) { +static Any pr_attribute_set(Any e) { if(SET == kind(car(e))) { pr(" throws "); pp_list(cadr(e), ", "); @@ -549,11 +549,11 @@ static void pr_attribute(Any x) { // (attribute (string) KeyName (readonly)) Any b = cddddr(x); // (attribute (string) HyperLinkTarget (bound) (set ((relative com sun star beans UnknownPropertyException))) (get ((relative com sun star beans UnknownPropertyException)))) pr(" public abstract "); pp(t); pr(" get"); pp(n); pr("()"); - mapc(NULL, pr_attribute_get, b); + mapc(pr_attribute_get, b); pl(";"); if(NIL == some(readonlyp, o)) { pr(" public abstract void set"); pp(n); pr("("); pp(t); pr(" x)"); - mapc(NULL, pr_attribute_set, b); + mapc(pr_attribute_set, b); pl(";"); } }