commit 8f4fc49140f534ef6de2788127b441850a0cd9e4
parent 13f9a5c5bd6ca668673cc9130cb6ac0413a70747
Author: Tomas Hlavaty <tom@logand.com>
Date: Tue, 27 Mar 2012 01:03:45 +0200
improved 2java pr_TypeInfo2
Diffstat:
M | unoidl2java.c | | | 60 | +++++++++++++++++++++++++++++++++++++++++++++++++----------- |
1 file changed, 49 insertions(+), 11 deletions(-)
diff --git a/unoidl2java.c b/unoidl2java.c
@@ -237,9 +237,28 @@ typedef enum {_ATTRIBUTE, _METHOD, _MEMBER, _PARAMETER} _Kind;
static char *__kind[] = {"Attribute", "Method", "Member", "Parameter"};
-static Any pr_TypeInfo2_internal(Any x) {
- if(consp(x)) pp_list(x, " ", print);
- else print(x);
+static int pr_TypeInfo_signature_test = 0;
+
+static Any pr_TypeInfo_signature(Any x) {
+ if(consp(x)) {
+ switch(kind(car(x))) {
+ case ABSOLUTE:
+ case RELATIVE: if(!pr_TypeInfo_signature_test) pp(x); break;
+ case SEQUENCE:
+ if(!pr_TypeInfo_signature_test) pr("[]");
+ return pr_TypeInfo_signature(cadr(x));
+ case TEMPLATE:
+ if(!pr_TypeInfo_signature_test) {
+ pp(cadr(x)); pr("<");
+ pp_list(caddr(x), ",", pr_TypeInfo_signature);
+ pr(">");
+ }
+ return T;
+ default:
+ if(!pr_TypeInfo_signature_test) pp_list(x, " ", print);
+ }
+ }
+ return NIL;
}
static void pr_TypeInfo2(_Kind _kind, Any name, Any type, int flags, int *i, int j) {
@@ -249,18 +268,37 @@ static void pr_TypeInfo2(_Kind _kind, Any name, Any type, int flags, int *i, int
if(!j) {pr("\""); pp(method); pr("\", ");}
pi(++*i); pr(", ");
pi(flags);
- switch(_kind) {
- case _MEMBER: if(!consp(type)) {pr(", null, "); pi(++k);} break;
- case _METHOD:
- if(consp(type)) {
+ if(!(consp(type))) {pr(", null, "); pi(++k);}
+ else
+ switch(_kind) {
+ case _ATTRIBUTE:
+ case _MEMBER:
+ case _METHOD:
switch(kind(car(type))) {
+ case SEQUENCE:
case TEMPLATE:
- pr(", new com.sun.star.uno.Type(\""); pp(cadr(type)); pr("<");
- pp_list(caddr(type), ",", pr_TypeInfo2_internal);
- pr(">\", com.sun.star.uno.TypeClass.STRUCT)");
+ pr_TypeInfo_signature_test = 1;
+ if(NIL != pr_TypeInfo_signature(type)) {
+ pr_TypeInfo_signature_test = 0;
+ pr(", new com.sun.star.uno.Type(\"");
+ pr_TypeInfo_signature(type);
+ pr("\", com.sun.star.uno.TypeClass.");
+ switch(kind(car(type))) {
+ case SEQUENCE: pr("SEQUENCE"); break;
+ default: pr("STRUCT");
+ }
+ pr(")");
+ switch(_kind) {
+ case _MEMBER:
+ pr(", -1");
+ }
+ }
+ }
+ switch(_kind) {
+ case _METHOD:
+ // TODO _PARAMETER
}
}
- }
pr(")");
}