#define BASETYPE_MAGIC 0x12345
struct _person {
char *name;
};
typedef struct _person person;
#define SUBTYPE_MAGIC 0x3333
struct _pilot {
person base;
char *callsign;
};
typedef struct _pilot pilot;
person *
person_new(const char *name)
{
person *ptr = malloc(sizeof(person));
ptr->name = strdup(name);
return ptr;
}
void
person_free(person *ptr) {
{
return;
}
free(ptr->name);
free(ptr);
}
pilot *
pilot_new(const char *name, const char *callsign)
{
pilot *ptr = malloc(sizeof(pilot));
ptr->base.name = strdup(name);
ptr->callsign = strdup(callsign);
return ptr;
}
void
pilot_free(pilot *ptr) {
{
return;
}
free(ptr->base.name);
free(ptr->callsign);
free(ptr);
}
void
print_person(person *ptr)
{
return;
}
printf("name: %s\n", ptr->name);
}
void
print_pilot(pilot *ptr)
{
return;
}
print_person(&ptr->base);
printf("callsign: %s\n", ptr->callsign);
}
int
{
person *base;
pilot *sub;
base = person_new("Tyrol");
sub = pilot_new("thrace", "starbuck");
print_person(base);
print_person((person *)sub);
print_pilot((pilot *)base);
print_pilot(sub);
}
EINA_API Eina_Bool eina_magic_string_static_set(Eina_Magic magic, const char *magic_name)
Sets the string associated with the given magic identifier.
Definition: eina_magic.c:238
#define EINA_MAGIC_NONE
Definition of a random value for specifying that a structure using the magic feature has already been...
Definition: eina_magic.h:197
#define EINA_MAGIC_CHECK(d, m)
Definition to test if d is NULL or not, and if not NULL, if d->__eina_magic is equal to m.
Definition: eina_magic.h:247
#define EINA_MAGIC
Definition of of a variable of type Eina_Magic.
Definition: eina_magic.h:224
#define EINA_MAGIC_SET(d, m)
Definition to set the magic number of d to m.
Definition: eina_magic.h:235
EINA_API Eina_Bool eina_magic_string_set(Eina_Magic magic, const char *magic_name)
Sets the string associated with the given magic identifier.
Definition: eina_magic.c:213
#define EINA_MAGIC_FAIL(d, m)
Definition to call eina_magic_fail() with the parameters d, d->__magic, m, FILE, func,...
Definition: eina_magic.h:259
EINA_API int eina_shutdown(void)
Shuts down the Eina library.
Definition: eina_main.c:379
EINA_API int eina_init(void)
Initializes the Eina library.
Definition: eina_main.c:291
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339