commit 2ff5770c9538a9c02cabb9260f3a3e302ebfb725
parent 16a9d8b07bd7eee4708980312f2b863f56618520
Author: Tomas Hlavaty <tom@logand.com>
Date: Tue, 17 Jan 2012 00:38:03 +0100
equal_ introduced
Diffstat:
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/unoidl2.c b/unoidl2.c
@@ -114,12 +114,12 @@ Any cddddr(Any x) {return cdr(cdr(cdr(cdr(x))));}
Any caddddr(Any x) {return car(cdr(cdr(cdr(cdr(x)))));}
Any cdddddr(Any x) {return cdr(cdr(cdr(cdr(cdr(x)))));}
-int equal(Any x, Any y) {
+int equal_(Any x, Any y) {
if(NIL == x) return NIL == y;
switch(x->tag) {
case CONS:
for(; NIL != x && NIL != y; x = cdr(x), y = cdr(y))
- if(!equal(car(x), car(y))) return 0;
+ if(!equal_(car(x), car(y))) return 0;
return NIL == x && NIL == y;
case TOKEN:
return TOKEN == y->tag && kind(x) == kind(y) && 0 == strcmp(token(x), token(y));
@@ -129,6 +129,8 @@ int equal(Any x, Any y) {
return 0;
}
+Any equal(Any x, Any y) {return equal_(x, y) ? T : NIL;}
+
Any print(Any x) {
if(NIL == x)
printf("NIL");
diff --git a/unoidl2.h b/unoidl2.h
@@ -53,7 +53,8 @@ Any cadddr(Any x);
Any cddddr(Any x);
Any caddddr(Any x);
Any cdddddr(Any x);
-int equal(Any x, Any y);
+int equal_(Any x, Any y);
+Any equal(Any x, Any y);
Any print(Any x);
int some(void *env, int (*fn)(void *env, Any e), Any x);
Any mapc(void *env, Any (*fn)(void *env, Any e), Any x);
diff --git a/unoidl2java.c b/unoidl2java.c
@@ -219,7 +219,7 @@ static int type_flags(Any x) {
case SEQUENCE: return type_flags(cadr(x));
case RELATIVE:
case ABSOLUTE:
- return equal(com_sun_star_uno_XInterface, cdr(x)) ? _INTERFACE : 0;
+ return equal_(com_sun_star_uno_XInterface, cdr(x)) ? _INTERFACE : 0;
}
}
return 0;
@@ -334,9 +334,9 @@ static void pr_exception(Any x) {
Any body = cddddr(x);
pr_package(name);
pr("public class "); pp(name);
- int m = equal(module, uno_star_sun_com);
- int e = equal(name, Exception) && m;
- int r = equal(name, RuntimeException) && m;
+ int m = equal_(module, uno_star_sun_com);
+ int e = equal_(name, Exception) && m;
+ int r = equal_(name, RuntimeException) && m;
if(e)
pr(" extends java.lang.Exception");
else if(r)
@@ -409,11 +409,11 @@ static void pr_definterface(Any x) {
}
}
if(NIL == super && i <= 0
- && !(equal(name, XInterface) && equal(module, uno_star_sun_com)))
+ && !(equal_(name, XInterface) && equal_(module, uno_star_sun_com)))
pr(" extends com.sun.star.uno.XInterface");
use_XInterface = 0;
pl(" {");
- if(!(equal(name, XInterface) && equal(module, uno_star_sun_com))) {
+ if(!(equal_(name, XInterface) && equal_(module, uno_star_sun_com))) {
mapc(NULL, pr_definterface_attribute, body);
mapc(NULL, pr_definterface_nonattribute, body);
pr_TypeInfo(body);
@@ -517,7 +517,7 @@ static void pr_typedef(Any x) {
static Any resolve_typedef(Any x) {return find(x, typedefs, equal);}
static void pr_relative(Any x) {
- if(!use_XInterface && equal(com_sun_star_uno_XInterface, cdr(x)))
+ if(!use_XInterface && equal_(com_sun_star_uno_XInterface, cdr(x)))
pr("java.lang.Object");
else {
if(NIL == cddr(x)) { // local typedef
@@ -545,7 +545,7 @@ static void pr_relative(Any x) {
}
static void pr_absolute(Any x) {
- if(!use_XInterface && equal(com_sun_star_uno_XInterface, cdr(x)))
+ if(!use_XInterface && equal_(com_sun_star_uno_XInterface, cdr(x)))
pr("java.lang.Object");
else {
Any y = resolve_typedef(reverse(cdr(x), NIL));