codex
Loading...
Searching...
No Matches
ooc.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for ooc.c:

Classes

struct  Class
 
struct  Object
 
struct  AClass
 
struct  BClass
 
struct  CClass
 
struct  A
 
struct  B
 
struct  C
 

Macros

#define get_method(C, c, m)   (((const struct C*)c)->m)
 
#define call_method(C, m, o, ...)    (get_method(C, get_class(o), m)(o __VA_OPT__(,) __VA_ARGS__))
 
#define call_super_method(SC, c, m, o, ...)    (get_method(SC, get_super(c), m)(o __VA_OPT__(,) __VA_ARGS__))
 

Functions

const void * get_class (const void *self)
 
const void * get_super (const void *self)
 
void * new (void *class_p,...)
 
void delete (void *self)
 
int cmp (const void *self, const void *p)
 
void dump (const void *self, FILE *f)
 
void * object_new (void *self, va_list *)
 
void * object_delete (void *self)
 
int object_cmp (const void *self, const void *p)
 
void object_dump (const void *self, FILE *f)
 
void * class_delete (void *)
 
void * class_new (void *self_p, va_list *args)
 
void * a_new (void *self, va_list *args)
 
void a_dump (const void *self, FILE *f)
 
int a_a (const void *self)
 
void * a_class_new (void *self, va_list *args)
 
void * b_new (void *self, va_list *args)
 
void b_dump (const void *self, FILE *f)
 
int b_b (const void *self)
 
void * b_class_new (void *self, va_list *args)
 
void * c_new (void *self, va_list *args)
 
void c_dump (const void *self, FILE *f)
 
int c_c (const void *self)
 
void * c_class_new (void *self, va_list *args)
 
int main (int argc, char **argv, char **env)
 

Variables

static struct Class base [2]
 
static struct ClassObject = base
 
static struct Class * Class = base + 1
 
void * AClass
 
void * A
 
void * BClass
 
void * B
 
void * CClass
 
void * C
 

Macro Definition Documentation

◆ call_method

#define call_method ( C,
m,
o,
... )    (get_method(C, get_class(o), m)(o __VA_OPT__(,) __VA_ARGS__))

◆ call_super_method

#define call_super_method ( SC,
c,
m,
o,
... )    (get_method(SC, get_super(c), m)(o __VA_OPT__(,) __VA_ARGS__))

◆ get_method

#define get_method ( C,
c,
m )   (((const struct C*)c)->m)

Function Documentation

◆ a_a()

int a_a ( const void * self)
Here is the caller graph for this function:

◆ a_class_new()

void * a_class_new ( void * self,
va_list * args )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ a_dump()

void a_dump ( const void * self,
FILE * f )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ a_new()

void * a_new ( void * self,
va_list * args )
Here is the caller graph for this function:

◆ b_b()

int b_b ( const void * self)
Here is the caller graph for this function:

◆ b_class_new()

void * b_class_new ( void * self,
va_list * args )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ b_dump()

void b_dump ( const void * self,
FILE * f )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ b_new()

void * b_new ( void * self,
va_list * args )
Here is the caller graph for this function:

◆ c_c()

int c_c ( const void * self)
Here is the caller graph for this function:

◆ c_class_new()

void * c_class_new ( void * self,
va_list * args )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_dump()

void c_dump ( const void * self,
FILE * f )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_new()

void * c_new ( void * self,
va_list * args )
Here is the caller graph for this function:

◆ class_delete()

void * class_delete ( void * )

◆ class_new()

void * class_new ( void * self_p,
va_list * args )
Here is the call graph for this function:

◆ cmp()

int cmp ( const void * self,
const void * p )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete()

void delete ( void * self)

◆ dump()

void dump ( const void * self,
FILE * f )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_class()

const void * get_class ( const void * self)

◆ get_super()

const void * get_super ( const void * self)

◆ main()

int main ( int argc,
char ** argv,
char ** env )
Here is the call graph for this function:

◆ new()

void * new ( void * class_p,
... )
Here is the caller graph for this function:

◆ object_cmp()

int object_cmp ( const void * self,
const void * p )

◆ object_delete()

void * object_delete ( void * self)

◆ object_dump()

void object_dump ( const void * self,
FILE * f )
Here is the call graph for this function:

◆ object_new()

void * object_new ( void * self,
va_list *  )

Variable Documentation

◆ A

void * A

◆ AClass

void* AClass

◆ B

void * B

◆ base

struct Class base[2]
static
Initial value:
= {{
.super = base,
.name = "Object",
.size = sizeof(struct Object),
.delete = object_delete,
.cmp = object_cmp,
.dump = object_dump,
}, {
.super = base,
.name = "Class",
.size = sizeof(struct Class),
.delete = class_delete,
.cmp = object_cmp,
.dump = object_dump,
}}
void * new(void *class_p,...)
Definition ooc.c:60
void * class_delete(void *)
Definition ooc.c:102
void * class_new(void *self_p, va_list *args)
Definition ooc.c:104
void * object_delete(void *self)
Definition ooc.c:89
int object_cmp(const void *self, const void *p)
Definition ooc.c:91
void * object_new(void *self, va_list *)
Definition ooc.c:88
static struct Class base[2]
Definition ooc.c:128
void object_dump(const void *self, FILE *f)
Definition ooc.c:97
Definition ooc.c:15
const char * name
Definition ooc.c:17
Definition ooc.c:25

◆ BClass

void * BClass

◆ C

void * C

◆ CClass

void * CClass

◆ Class

struct Class* Class = base + 1
static

◆ Object

struct Class* Object = base
static