unoidl2

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

commit e2b612e7d23c2e25782e2d27c1139d5477897d17
parent 9ab3cda1e6f95d2f214c3d7dccda6d9281d26d17
Author: Tomas Hlavaty <tom@logand.com>
Date:   Tue, 20 Mar 2012 01:29:53 +0100

some 2java fixes

Diffstat:
Munoidl2java.c | 52+++++++++++++++++++++++-----------------------------
1 file changed, 23 insertions(+), 29 deletions(-)

diff --git a/unoidl2java.c b/unoidl2java.c @@ -99,7 +99,7 @@ static void pr_enum(Any x) { // (enum Name T ONE TWO (THREE 3)) Any v = explicit1 ? cadr(value) : mkinum(n++); pr(" public static final "); pp(k); pr(" "); pp(k2); pr(" = new "); pp(k); pr("("); pp(v); pl(");"); - pr(" public static final int "); pp(k); pr("_value = "); + pr(" public static final int "); pp(k2); pr("_value = "); if(!explicit || explicit1) pp(v); // syntax error if not //else {pr("@@@"); print(v);} pl(";"); @@ -183,21 +183,21 @@ static void pr_default_slots(Any slots) { mapc(pr_default_slot, slots); } -static int pr_slots_rec1(Any super) { +static int pr_slots_rec1(Any super) { // (absolute|relative com.sun...) if(NIL == super) return 0; - Any s = find(super, structs, equal, id); - if(pr_slots_rec1(cadr(s))) pr(", "); - pr_args(cddr(s)); + Any s = cdddr(get2(find(cadr(super), structs, equal, id))); + if(pr_slots_rec1(car(s))) pr(", "); + pr_args(cdr(s)); return 1; } static int pr_slots_rec2(Any super) { if(NIL == super) return 0; - Any s = find(super, structs, equal, id); - int z = pr_slots_rec2(cadr(s)); - for(Any y = cddr(s); NIL != y; y = cdr(y)) { + Any s = cdddr(get2(find(cadr(super), structs, equal, id))); + int z = pr_slots_rec2(car(s)); + for(Any y = cdr(s); NIL != y; y = cdr(y)) { if(0 < z++) pr(", "); - pp(car(car(y))); + pp(caar(y)); } return 1; } @@ -388,8 +388,8 @@ static void pr_exception(Any x) { pr_package(x); Any k = sym2k(name); pr("public class "); pp(k); - int e = k == com_sun_star_uno_Exception; - int r = k == com_sun_star_uno_RuntimeException; + int e = name == com_sun_star_uno_Exception; + int r = name == com_sun_star_uno_RuntimeException; if(e) pr(" extends java.lang.Exception"); else if(r) @@ -635,20 +635,13 @@ static void pr_const(Any x) { pl(";"); } -static void pr_absolute(Any x) { - if(!use_XInterface && x == com_sun_star_uno_XInterface) +static void pr_absolute(Any x) { // (absolute|relative com.sun...) + Any s = cadr(x); + if(!use_XInterface && s == com_sun_star_uno_XInterface) pr("java.lang.Object"); else { - Any y = find(x, typedefs, equal, id); - if(NIL != y) { - Any a = car(y); // (ServiceContextList iop corba star sun com) - Any d = cdr(y); // (sequence (relative ServiceContext)) - rel_package = cons(cdr(a), rel_package); - pp(d); - rel_package = cdr(rel_package); - return; - } - pp(cadr(x)); + Any y = cadddr(get2(find(s, typedefs, equal, id))); + pp(NIL == y ? cadr(x) : y); } } @@ -663,16 +656,17 @@ static void pr_property(Any x) { } } -static void pr_deftemplate(Any x) { +static void pr_deftemplate(Any x) { // (deftemplate com.sun.star.beans.Optional NIL (T) (IsPresent (boolean)) (Value T)) Any name = cadr(x); Any published = caddr(x); if(1 || NIL != published) { Any args = cadddr(x); Any slots = cddddr(x); pr_package(x); - pr("public class "); pp(name); + Any k = sym2k(name); + pr("public class "); pp(k); pr("<"); pp_list(args, ", "); pr(">"); pl(" {"); - pr_slots(slots, name, NIL); + pr_slots(slots, k, NIL); pr_TypeInfo(slots); pl("}"); } @@ -779,9 +773,9 @@ static Any pp(Any x) { static Any subst2java(Any v) { v = subst2_rel_abs(v); switch(kind(car(v))) { - case ENUM: enums = cons(subst2_x, enums); - case STRUCT: structs = cons(subst2_x, structs); - case TYPEDEF: typedefs = cons(subst2_x, typedefs); + case ENUM: enums = cons(subst2_x, enums); break; + case STRUCT: structs = cons(subst2_x, structs); break; + case TYPEDEF: typedefs = cons(subst2_x, typedefs); break; } return v; }