00001
00010 #ifndef _CLASS_H_
00011 #define _CLASS_H_
00012
00013 #include <gtk/gtk.h>
00014 #include "value.h"
00015 #include "mem.h"
00016
00017
00018 typedef enum {
00019 CLASS_PROC,
00020 CLASS_VAR,
00021 CLASS_INSTR,
00022 CLASS_CONST,
00023 CLASS_LIST
00024 } classtype_t;
00025
00026
00027 struct s_class {
00028 classtype_t classtype;
00029 struct s_value value;
00031 gshort refcnt;
00032 };
00033
00034
00035 #define CLASS(noclass) ((struct s_class *)noclass)
00036 #define CLASS_TYPE(class) ((CLASS(class))->classtype)
00037 #define CLASS_VALUE(noclass) ((CLASS(noclass))->value)
00038
00039 #define class_subdebug(noclass) \
00040 ({ \
00041 gchar *str = NULL; \
00042 \
00043 if(noclass != NULL) \
00044 { \
00045 switch(CLASS_TYPE(noclass)) \
00046 { \
00047 case CLASS_PROC : str = proc_subdebug(noclass); break; \
00048 case CLASS_VAR : str = var_subdebug(noclass); break; \
00049 case CLASS_INSTR: str = instr_subdebug(noclass); break; \
00050 case CLASS_CONST: str = const_subdebug(noclass); break; \
00051 case CLASS_LIST : str = list_subdebug(noclass); \
00052 } \
00053 \
00054 } \
00055 \
00056 str; \
00057 })
00058
00059 #define class_ref(class) (CLASS(class)->refcnt++)
00060 #define class_unref(class) (CLASS(class)->refcnt--)
00061
00062
00063 void class_free_from_list(gpointer, gpointer);
00064
00065 #endif