00001
00002
00003
00004
00005
00006
00007
00008 #ifndef LIBAEGIS_COMMON_H
00009 #define LIBAEGIS_COMMON_H
00010
00011 #include <common/str.h>
00012 #include <libaegis/output.h>
00013 #include <libaegis/meta_lex.h>
00014 #include <libaegis/meta_parse.h>
00015 #include <libaegis/meta_type.h>
00016
00017 class nstring;
00018
00019 #ifndef change_cause_DEF
00020 #define change_cause_DEF
00021 enum change_cause_ty
00022 {
00023 change_cause_external_bug,
00024 change_cause_external_enhancement,
00025 change_cause_external_improvement,
00026 change_cause_internal_bug,
00027 change_cause_internal_enhancement,
00028 change_cause_internal_improvement,
00029 change_cause_chain
00030 };
00031 #define change_cause_max 7
00032 #endif // change_cause_DEF
00033
00034 extern meta_type change_cause_type;
00035
00036 void change_cause_write(const output::pointer &fp, const char *name, change_cause_ty value, bool show);
00037 void change_cause_write_xml(const output::pointer &fp, const char *name, change_cause_ty value, bool show);
00038 const char *change_cause_ename(change_cause_ty);
00039
00040 #ifndef file_action_DEF
00041 #define file_action_DEF
00042 enum file_action_ty
00043 {
00044 file_action_create,
00045 file_action_modify,
00046 file_action_remove,
00047 file_action_insulate,
00048 file_action_transparent
00049 };
00050 #define file_action_max 5
00051 #endif // file_action_DEF
00052
00053 extern meta_type file_action_type;
00054
00055 void file_action_write(const output::pointer &fp, const char *name, file_action_ty value, bool show);
00056 void file_action_write_xml(const output::pointer &fp, const char *name, file_action_ty value, bool show);
00057 const char *file_action_ename(file_action_ty);
00058
00059 #ifndef file_usage_DEF
00060 #define file_usage_DEF
00061 enum file_usage_ty
00062 {
00063 file_usage_source,
00064 file_usage_config,
00065 file_usage_build,
00066 file_usage_test,
00067 file_usage_manual_test
00068 };
00069 #define file_usage_max 5
00070 #endif // file_usage_DEF
00071
00072 extern meta_type file_usage_type;
00073
00074 void file_usage_write(const output::pointer &fp, const char *name, file_usage_ty value, bool show);
00075 void file_usage_write_xml(const output::pointer &fp, const char *name, file_usage_ty value, bool show);
00076 const char *file_usage_ename(file_usage_ty);
00077
00078 #ifndef metric_DEF
00079 #define metric_DEF
00080
00081 #define metric_name_mask ((unsigned long)0)
00082 #define metric_value_mask ((unsigned long)1 << 0)
00083
00084 struct metric_ty
00085 {
00086 long reference_count;
00087 unsigned long mask;
00088 string_ty *errpos;
00089 string_ty *name;
00090 double value;
00091 };
00092 #endif // metric_DEF
00093
00094 extern meta_type metric_type;
00095
00096 void metric_write(const output::pointer &fp, const char *name, metric_ty *value);
00097 void metric_write_xml(const output::pointer &fp, const char *name, metric_ty *value);
00098 metric_ty *metric_copy(metric_ty *);
00099 metric_ty *metric_clone(metric_ty *);
00100 #ifdef DEBUG
00101 void metric_trace_real(const char *name, const metric_ty *value);
00102 #define metric_trace(x) ((void)(trace_pretest_ && (trace_where_, metric_trace_real(trace_stringize(x), x), 0)))
00103 #else
00104 #define metric_trace(x)
00105 #endif
00106
00107 #ifndef metric_list_DEF
00108 #define metric_list_DEF
00109 struct metric_list_ty
00110 {
00111 size_t length;
00112 size_t maximum;
00113 metric_ty **list;
00114 };
00115 #endif // metric_list_DEF
00116
00117 extern meta_type metric_list_type;
00118
00119 metric_list_ty *metric_list_copy(metric_list_ty *);
00120 metric_list_ty *metric_list_clone(metric_list_ty *);
00121 void metric_list_write(const output::pointer &fp, const char *name, metric_list_ty *value);
00122 void metric_list_write_xml(const output::pointer &fp, const char *name, metric_list_ty *value);
00123 #ifdef DEBUG
00124 void metric_list_trace_real(const char *name, const metric_list_ty *value);
00125 #define metric_list_trace(x) ((void)(trace_pretest_ && (trace_where_, metric_list_trace_real(trace_stringize(x), x), 0)))
00126 #else
00127 #define metric_list_trace(x)
00128 #endif
00129
00130 #ifndef history_version_encoding_DEF
00131 #define history_version_encoding_DEF
00132 enum history_version_encoding_ty
00133 {
00134 history_version_encoding_none,
00135 history_version_encoding_quoted_printable,
00136 history_version_encoding_base64
00137 };
00138 #define history_version_encoding_max 3
00139 #endif // history_version_encoding_DEF
00140
00141 extern meta_type history_version_encoding_type;
00142
00143 void history_version_encoding_write(const output::pointer &fp, const char *name, history_version_encoding_ty value, bool show);
00144 void history_version_encoding_write_xml(const output::pointer &fp, const char *name, history_version_encoding_ty value, bool show);
00145 const char *history_version_encoding_ename(history_version_encoding_ty);
00146
00147 #ifndef history_version_DEF
00148 #define history_version_DEF
00149
00150 #define history_version_revision_mask ((unsigned long)0)
00151 #define history_version_encoding_mask ((unsigned long)1 << 0)
00152
00153 struct history_version_ty
00154 {
00155 long reference_count;
00156 unsigned long mask;
00157 string_ty *errpos;
00158 string_ty *revision;
00159 history_version_encoding_ty encoding;
00160 };
00161 #endif // history_version_DEF
00162
00163 extern meta_type history_version_type;
00164
00165 void history_version_write(const output::pointer &fp, const char *name, history_version_ty *value);
00166 void history_version_write_xml(const output::pointer &fp, const char *name, history_version_ty *value);
00167 history_version_ty *history_version_copy(history_version_ty *);
00168 history_version_ty *history_version_clone(history_version_ty *);
00169 #ifdef DEBUG
00170 void history_version_trace_real(const char *name, const history_version_ty *value);
00171 #define history_version_trace(x) ((void)(trace_pretest_ && (trace_where_, history_version_trace_real(trace_stringize(x), x), 0)))
00172 #else
00173 #define history_version_trace(x)
00174 #endif
00175
00176 #ifndef attributes_DEF
00177 #define attributes_DEF
00178
00179 #define attributes_name_mask ((unsigned long)0)
00180 #define attributes_value_mask ((unsigned long)0)
00181
00182 struct attributes_ty
00183 {
00184 long reference_count;
00185 unsigned long mask;
00186 string_ty *errpos;
00187 string_ty *name;
00188 string_ty *value;
00189 };
00190 #endif // attributes_DEF
00191
00192 extern meta_type attributes_type;
00193
00194 void attributes_write(const output::pointer &fp, const char *name, attributes_ty *value);
00195 void attributes_write_xml(const output::pointer &fp, const char *name, attributes_ty *value);
00196 attributes_ty *attributes_copy(attributes_ty *);
00197 attributes_ty *attributes_clone(attributes_ty *);
00198 #ifdef DEBUG
00199 void attributes_trace_real(const char *name, const attributes_ty *value);
00200 #define attributes_trace(x) ((void)(trace_pretest_ && (trace_where_, attributes_trace_real(trace_stringize(x), x), 0)))
00201 #else
00202 #define attributes_trace(x)
00203 #endif
00204
00205 #ifndef attributes_list_DEF
00206 #define attributes_list_DEF
00207 struct attributes_list_ty
00208 {
00209 size_t length;
00210 size_t maximum;
00211 attributes_ty **list;
00212 };
00213 #endif // attributes_list_DEF
00214
00215 extern meta_type attributes_list_type;
00216
00217 attributes_list_ty *attributes_list_copy(attributes_list_ty *);
00218 attributes_list_ty *attributes_list_clone(attributes_list_ty *);
00219 void attributes_list_write(const output::pointer &fp, const char *name, attributes_list_ty *value);
00220 void attributes_list_write_xml(const output::pointer &fp, const char *name, attributes_list_ty *value);
00221 #ifdef DEBUG
00222 void attributes_list_trace_real(const char *name, const attributes_list_ty *value);
00223 #define attributes_list_trace(x) ((void)(trace_pretest_ && (trace_where_, attributes_list_trace_real(trace_stringize(x), x), 0)))
00224 #else
00225 #define attributes_list_trace(x)
00226 #endif
00227
00228 #ifndef common_DEF
00229 #define common_DEF
00230
00231
00232 struct common_ty
00233 {
00234 long reference_count;
00235 unsigned long mask;
00236 string_ty *errpos;
00237 };
00238 #endif // common_DEF
00239
00240 extern meta_type common_type;
00241
00242 void common_write(const output::pointer &fp, common_ty *value);
00243 void common_write_xml(const output::pointer &fp, common_ty *value);
00244 common_ty *common_copy(common_ty *);
00245 common_ty *common_clone(common_ty *);
00246 #ifdef DEBUG
00247 void common_trace_real(const char *name, const common_ty *value);
00248 #define common_trace(x) ((void)(trace_pretest_ && (trace_where_, common_trace_real(trace_stringize(x), x), 0)))
00249 #else
00250 #define common_trace(x)
00251 #endif
00252
00269 void common_write_file(string_ty *filename, common_ty *value, int comp);
00270
00287 void common_write_file(const nstring &filnam, common_ty *value, bool comp);
00288
00305 common_ty *common_read_file(string_ty *filename);
00306
00323 common_ty *common_read_file(const nstring &filename);
00324 void common__rpt_init(void);
00325
00326 #endif // LIBAEGIS_COMMON_H