commit f8d200b395d8a00728b50d64242fc8f26f8df00a
parent 16aa13df0ef2328cc56b5e787d254183230c02e7
Author: Tomas Hlavaty <tom@logand.com>
Date:   Mon, 16 Jan 2012 20:59:23 +0100
more typeinfo improvements
Diffstat:
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/unoidl2java.c b/unoidl2java.c
@@ -196,8 +196,9 @@ static Any mapc(void *env, Any (*fn)(void *env, Any e), Any x) {
 }
 
 static Any method;
+static int k;
 
-static void pr_TypeInfo2(char *kind, Any name, int flags, int *i, int j) {
+static void pr_TypeInfo2(char *kind, Any name, Any type, int flags, int *i, int j) {
   pl(*i < 0 && j < 0 ? "" : ",");
   pr("      new com.sun.star.lib.uno.typeinfo."); pr(kind); pr("TypeInfo(\"");
   pp(name); pr("\", ");
@@ -205,7 +206,11 @@ static void pr_TypeInfo2(char *kind, Any name, int flags, int *i, int j) {
     pr("\""); pp(method); pr("\", ");
   }
   pi(++*i); pr(", ");
-  pi(flags); pr(")");
+  pi(flags);
+  if(!consp(type)) {
+    pr(", null, "); pi(++k);
+  }
+  pr(")");
 }
 
 enum flags { // ridljar/com/sun/star/lib/uno/typeinfo.TypeInfo.java
@@ -238,39 +243,45 @@ static int readonlyp(void *env, Any x) {return READONLY == kind(x);}
 
 static Any pr_TypeInfo1(void *env, Any x) {
   int f = 0;
+  Any t = NIL;
   switch(kind(car(x))) {
   case ATTRIBUTE: // (attribute (string) KeyName (readonly))
-    f |= type_flags(cadr(x));
+    t = cadr(x);
+    f |= type_flags(t);
     if(some(NULL, readonlyp, cadddr(x))) f |= _READONLY;
-    pr_TypeInfo2("Attribute", caddr(x), f, env, -1);
+    pr_TypeInfo2("Attribute", caddr(x), t, f, env, -1);
     break;
   case ID: // (NewValue (any))
-    f |= type_flags(cadr(x));
-    // TODO TYPE_PARAMETER
-    pr_TypeInfo2("Member", car(x), f, env, -1);
+    t = cadr(x);
+    f |= type_flags(t);
+    pr_TypeInfo2("Member", car(x), t, f, env, -1);
     break;
   case METHOD: // (method queryInterface NIL (any) ((in aType (type))))
     method = cadr(x);
-    f |= type_flags(cadddr(x));
+    t = cadddr(x);
+    f |= type_flags(t);
     if(!null(caddr(x))) f |= _ONEWAY;
-    pr_TypeInfo2("Method", method, f, env, -1);
+    pr_TypeInfo2("Method", method, t, f, env, -1);
     int i = -1;
     mapc(&i, pr_TypeInfo1, caddddr(x));
     break;
   case IN: // (in aType (type))
-    f |= _IN | type_flags(caddr(x));
+    t = caddr(x);
+    f |= _IN | type_flags(t);
     if(f != _IN && f != (_IN | _ANY))
-      pr_TypeInfo2("Parameter", cadr(x), f, env, 0);
+      pr_TypeInfo2("Parameter", cadr(x), t, f, env, 0);
     else
       ++*((int *) env);
     break;
   case OUT:
-    f |= _OUT | type_flags(caddr(x));
-    pr_TypeInfo2("Parameter", cadr(x), f, env, 0);
+    t = caddr(x);
+    f |= _OUT | type_flags(t);
+    pr_TypeInfo2("Parameter", cadr(x), t, f, env, 0);
     break;
   case INOUT:
-    f |= _IN | _OUT | type_flags(caddr(x));
-    pr_TypeInfo2("Parameter", cadr(x), f, env, 0);
+    t = caddr(x);
+    f |= _IN | _OUT | type_flags(t);
+    pr_TypeInfo2("Parameter", cadr(x), t, f, env, 0);
   }
   return NIL;
 }
@@ -295,6 +306,7 @@ static void pr_TypeInfo(Any body) {
   if(some(NULL, pr_TypeInfo_p, body)) {
     pr("   public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = {");
     int i = -1;
+    k = -1;
     mapc(&i, pr_TypeInfo1_attribute, body);
     mapc(&i, pr_TypeInfo1_nonattribute, body);
     pl("");