20 #ifndef COMPS_OBJECT_H
21 #define COMPS_OBJECT_H
59 #define COMPS_OBJECT_CREATE(objtype, args)\
60 (objtype*)comps_object_create(&objtype##_ObjInfo, args)
63 #define COMPS_OBJECT_CMP(obj1,obj2)\
64 comps_object_cmp((COMPS_Object*)obj1, (COMPS_Object*)obj2)
66 #define COMPS_OBJECT_DESTROY(obj1)\
67 comps_object_destroy((COMPS_Object*)obj1)
69 #define COMPS_OBJECT_COPY(obj)\
70 comps_object_copy(((COMPS_Object*)obj))
72 #define COMPS_OBJECT_INCREF(obj)\
73 comps_object_incref(((COMPS_Object*)obj))
75 #define COMPS_OBJECT_REPLACE(oldobj, TYPE, new_obj)\
76 COMPS_OBJECT_DESTROY(oldobj);\
77 oldobj = (TYPE*)COMPS_OBJECT_INCREF(new_obj);
80 #define COMPS_CAST_CONSTR void (*)(COMPS_Object*, COMPS_Object**)
81 #define COMPS_CAST_DESTR void (*)(COMPS_Object*)
86 #define COMPS_Object_HEAD COMPS_RefC *refc;\
87 COMPS_ObjectInfo *obj_info
89 #define COMPS_Object_TAIL(obj) extern COMPS_ObjectInfo obj##_ObjInfo
93 typedef struct COMPS_Packed COMPS_Packed;
164 void comps_object_destroy_v(
void *comps_obj);
185 char comps_object_cmp_v(
void *obj1,
void *obj2);
void comps_object_destroy(COMPS_Object *comps_obj)
void(* copy)(COMPS_Object *, COMPS_Object *)
Definition: comps_obj.h:108
#define COMPS_Object_HEAD
Definition: comps_obj.h:86
COMPS_ObjectInfo * obj_info
Definition: comps_obj.h:126
char * val
Definition: comps_obj.h:145
Definition: comps_obj.h:124
void comps_str_set(COMPS_Str *str, char *s)
char * comps_object_tostr(COMPS_Object *obj1)
#define COMPS_Object_TAIL(obj)
insert "extern COMPS_ObjectInfo <obj>_ObjInfo" statement. Use this macro in combination with COMPS_OB...
Definition: comps_obj.h:89
COMPS_Object * comps_object_incref(COMPS_Object *obj)
size_t obj_size
Definition: comps_obj.h:103
signed char comps_str_fnmatch_o(COMPS_Str *str, COMPS_Str *pattern, int flags)
COMPS_Object * comps_object_create(COMPS_ObjectInfo *obj_info, COMPS_Object **args)
Definition: comps_obj.h:143
int val
Definition: comps_obj.h:135
COMPS_Str * comps_str(const char *s)
Definition: comps_obj.h:133
COMPS_RefC * refc
Definition: comps_obj.h:125
COMPS memory management(reference counter) file.
COMPS_Num * comps_num(int n)
Definition: comps_obj.h:102
void(* destructor)(COMPS_Object *)
Definition: comps_obj.h:106
signed char comps_str_fnmatch(COMPS_Str *str, char *pattern, int flags)
signed char comps_object_cmp(COMPS_Object *obj1, COMPS_Object *obj2)
COMPS_Str * comps_str_x(char *s)
COMPS_Object * comps_object_copy(COMPS_Object *comps_obj)
void(* constructor)(COMPS_Object *, COMPS_Object **)
Definition: comps_obj.h:104
Definition: comps_mm.h:36
signed char(* obj_cmp)(COMPS_Object *, COMPS_Object *)
Definition: comps_obj.h:112