00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef LIBAEGIS_META_TYPE_H
00021 #define LIBAEGIS_META_TYPE_H
00022
00023 #include <common/ac/stddef.h>
00024
00025 #include <common/main.h>
00026 #include <common/str.h>
00027 #include <libaegis/aer/value.h>
00028
00029 class meta_type;
00030
00031 struct type_table_ty
00032 {
00033 const char *name;
00034 size_t offset;
00035 meta_type *type;
00036 unsigned long mask;
00037 int redefinition_ok;
00038 string_ty *fast_name;
00039 };
00040
00045 class meta_type
00046 {
00047 public:
00048 const char *name;
00049
00050 void *(*alloc)(void);
00051 void (*free)(void *this_thing);
00052 bool (*enum_parse)(string_ty *name, void *);
00053 void *(*list_parse)(void *this_thing, meta_type **type_pp);
00054 void *(*struct_parse)(void *this_thing, string_ty *name,
00055 meta_type **type_pp, unsigned long *maskp, int *redefinition_ok_p);
00056 string_ty *(*fuzzy)(string_ty *name);
00057 rpt_value::pointer (*convert)(void *this_thing);
00058 bool (*is_set)(void *);
00059 };
00060
00065 class generic_struct
00066 {
00067 public:
00068 long reference_count;
00069 unsigned long mask;
00070 string_ty *errpos;
00071 };
00072
00073 extern meta_type boolean_type;
00074 #define boolean_copy(x) (x)
00075 const char *boolean_ename(bool);
00076 extern meta_type integer_type;
00077 #define integer_copy(x) (x)
00078 extern meta_type real_type;
00079 #define real_copy(x) (x)
00080 extern meta_type string_type;
00081 #define string_copy(x) str_copy(x)
00082 extern meta_type time_type;
00083 #define time_copy(x) (x)
00084
00085 void *generic_struct_parse(void *, string_ty *, meta_type **, unsigned long *,
00086 int *, type_table_ty *, size_t);
00087 string_ty *generic_struct_fuzzy(string_ty *, type_table_ty *, size_t);
00088 bool generic_struct_is_set(void *);
00089 string_ty *generic_enum_fuzzy(string_ty *, string_ty **, size_t);
00090 rpt_value::pointer generic_struct_convert(void *, type_table_ty *,
00091 size_t);
00092 rpt_value::pointer generic_enum_convert(int, string_ty **, size_t);
00093 void generic_enum__init(const char *const *, size_t);
00094
00095 void type_enum_option_set(void);
00096 void type_enum_option_clear(void);
00097 int type_enum_option_query(void);
00098
00099 #endif // LIBAEGIS_META_TYPE_H