class.c
473 Bytes
#include <stdarg.h>
#include <stdlib.h>
#include "class.h"
#include "interface.h"
inline
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;
}
inline
class_ptr
class_getClass(void * object)
{
return *(class_ptr *)(object - sizeof(void*));
}
// vim: set ts=4 sw=4: