Fixed some errors in type.c. Now to see why uiControl is being registered twice...
This commit is contained in:
parent
97cb70527e
commit
0019681b02
10
redo/types.c
10
redo/types.c
|
@ -28,7 +28,7 @@ uintmax_t uiRegisterType(const char *name, uintmax_t parent)
|
||||||
void *uiIsA(void *p, uintmax_t id, int fail)
|
void *uiIsA(void *p, uintmax_t id, int fail)
|
||||||
{
|
{
|
||||||
uiTyped *t;
|
uiTyped *t;
|
||||||
struct typeinfo *ti;
|
struct typeinfo *ti, *ti2;
|
||||||
uintmax_t compareTo;
|
uintmax_t compareTo;
|
||||||
|
|
||||||
if (id == 0 || id >= types->len)
|
if (id == 0 || id >= types->len)
|
||||||
|
@ -42,14 +42,16 @@ void *uiIsA(void *p, uintmax_t id, int fail)
|
||||||
complain("invalid type ID in uiIsA()", t);
|
complain("invalid type ID in uiIsA()", t);
|
||||||
if (compareTo == id)
|
if (compareTo == id)
|
||||||
return t;
|
return t;
|
||||||
ti = ptrArrayIndex(types, struct typeinfo *, t->Type);
|
ti = ptrArrayIndex(types, struct typeinfo *, compareTo);
|
||||||
|
printf("%d %d %d\n", (int)compareTo, (int)(ti->parent), (int)id);
|
||||||
if (ti->parent == 0)
|
if (ti->parent == 0)
|
||||||
break;
|
break;
|
||||||
compareTo = ti->parent;
|
compareTo = ti->parent;
|
||||||
}
|
}
|
||||||
if (fail) {
|
if (fail) {
|
||||||
ti = ptrArrayIndex(types, struct typeinfo *, t->Type);
|
ti = ptrArrayIndex(types, struct typeinfo *, id);
|
||||||
complain("object %p not a %s in uiIsA()", t, ti->name);
|
ti2 = ptrArrayIndex(types, struct typeinfo *, t->Type);
|
||||||
|
complain("object %p not a %s in uiIsA() (is a %s)", t, ti->name, ti2->name);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue