class.c
459 Bytes
#include <stdarg.h>
#include <stdlib.h>
#include "class.h"
#include "interface.h"
void *
class_getInterface(class_ptr * class, iface_ptr _iface)
{
void * iface = (void *)IFACE_GET(*class, _iface);
while(NULL == iface && HAS_PARENT(*class)) {
*class = (*class)->parent;
iface = (void *)IFACE_GET(*class, _iface);
}
return iface;
}
class_ptr
class_getClass(void * object)
{
return *(class_ptr *)(object - sizeof(void*));
}
// vim: set ts=4 sw=4: