00001
00002
00003
00004
00005
00006
00007
00008 #ifndef LIBAEGIS_UCONF_H
00009 #define LIBAEGIS_UCONF_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 uconf_delete_file_preference_DEF
00229 #define uconf_delete_file_preference_DEF
00230 enum uconf_delete_file_preference_ty
00231 {
00232 uconf_delete_file_preference_no_keep,
00233 uconf_delete_file_preference_interactive,
00234 uconf_delete_file_preference_keep
00235 };
00236 #define uconf_delete_file_preference_max 3
00237 #endif // uconf_delete_file_preference_DEF
00238
00239 extern meta_type uconf_delete_file_preference_type;
00240
00241 void uconf_delete_file_preference_write(const output::pointer &fp, const char *name, uconf_delete_file_preference_ty value, bool show);
00242 void uconf_delete_file_preference_write_xml(const output::pointer &fp, const char *name, uconf_delete_file_preference_ty value, bool show);
00243 const char *uconf_delete_file_preference_ename(uconf_delete_file_preference_ty);
00244
00245 #ifndef uconf_diff_preference_DEF
00246 #define uconf_diff_preference_DEF
00247 enum uconf_diff_preference_ty
00248 {
00249 uconf_diff_preference_automatic_merge,
00250 uconf_diff_preference_no_merge,
00251 uconf_diff_preference_only_merge
00252 };
00253 #define uconf_diff_preference_max 3
00254 #endif // uconf_diff_preference_DEF
00255
00256 extern meta_type uconf_diff_preference_type;
00257
00258 void uconf_diff_preference_write(const output::pointer &fp, const char *name, uconf_diff_preference_ty value, bool show);
00259 void uconf_diff_preference_write_xml(const output::pointer &fp, const char *name, uconf_diff_preference_ty value, bool show);
00260 const char *uconf_diff_preference_ename(uconf_diff_preference_ty);
00261
00262 #ifndef uconf_pager_preference_DEF
00263 #define uconf_pager_preference_DEF
00264 enum uconf_pager_preference_ty
00265 {
00266 uconf_pager_preference_foreground,
00267 uconf_pager_preference_never
00268 };
00269 #define uconf_pager_preference_max 2
00270 #endif // uconf_pager_preference_DEF
00271
00272 extern meta_type uconf_pager_preference_type;
00273
00274 void uconf_pager_preference_write(const output::pointer &fp, const char *name, uconf_pager_preference_ty value, bool show);
00275 void uconf_pager_preference_write_xml(const output::pointer &fp, const char *name, uconf_pager_preference_ty value, bool show);
00276 const char *uconf_pager_preference_ename(uconf_pager_preference_ty);
00277
00278 #ifndef uconf_persevere_preference_DEF
00279 #define uconf_persevere_preference_DEF
00280 enum uconf_persevere_preference_ty
00281 {
00282 uconf_persevere_preference_all,
00283 uconf_persevere_preference_stop
00284 };
00285 #define uconf_persevere_preference_max 2
00286 #endif // uconf_persevere_preference_DEF
00287
00288 extern meta_type uconf_persevere_preference_type;
00289
00290 void uconf_persevere_preference_write(const output::pointer &fp, const char *name, uconf_persevere_preference_ty value, bool show);
00291 void uconf_persevere_preference_write_xml(const output::pointer &fp, const char *name, uconf_persevere_preference_ty value, bool show);
00292 const char *uconf_persevere_preference_ename(uconf_persevere_preference_ty);
00293
00294 #ifndef uconf_log_file_preference_DEF
00295 #define uconf_log_file_preference_DEF
00296 enum uconf_log_file_preference_ty
00297 {
00298 uconf_log_file_preference_snuggle,
00299 uconf_log_file_preference_append,
00300 uconf_log_file_preference_replace,
00301 uconf_log_file_preference_never
00302 };
00303 #define uconf_log_file_preference_max 4
00304 #endif // uconf_log_file_preference_DEF
00305
00306 extern meta_type uconf_log_file_preference_type;
00307
00308 void uconf_log_file_preference_write(const output::pointer &fp, const char *name, uconf_log_file_preference_ty value, bool show);
00309 void uconf_log_file_preference_write_xml(const output::pointer &fp, const char *name, uconf_log_file_preference_ty value, bool show);
00310 const char *uconf_log_file_preference_ename(uconf_log_file_preference_ty);
00311
00312 #ifndef uconf_lock_wait_preference_DEF
00313 #define uconf_lock_wait_preference_DEF
00314 enum uconf_lock_wait_preference_ty
00315 {
00316 uconf_lock_wait_preference_always,
00317 uconf_lock_wait_preference_background,
00318 uconf_lock_wait_preference_never
00319 };
00320 #define uconf_lock_wait_preference_max 3
00321 #endif // uconf_lock_wait_preference_DEF
00322
00323 extern meta_type uconf_lock_wait_preference_type;
00324
00325 void uconf_lock_wait_preference_write(const output::pointer &fp, const char *name, uconf_lock_wait_preference_ty value, bool show);
00326 void uconf_lock_wait_preference_write_xml(const output::pointer &fp, const char *name, uconf_lock_wait_preference_ty value, bool show);
00327 const char *uconf_lock_wait_preference_ename(uconf_lock_wait_preference_ty);
00328
00329 #ifndef uconf_symbolic_link_preference_DEF
00330 #define uconf_symbolic_link_preference_DEF
00331 enum uconf_symbolic_link_preference_ty
00332 {
00333 uconf_symbolic_link_preference_verify,
00334 uconf_symbolic_link_preference_assume
00335 };
00336 #define uconf_symbolic_link_preference_max 2
00337 #endif // uconf_symbolic_link_preference_DEF
00338
00339 extern meta_type uconf_symbolic_link_preference_type;
00340
00341 void uconf_symbolic_link_preference_write(const output::pointer &fp, const char *name, uconf_symbolic_link_preference_ty value, bool show);
00342 void uconf_symbolic_link_preference_write_xml(const output::pointer &fp, const char *name, uconf_symbolic_link_preference_ty value, bool show);
00343 const char *uconf_symbolic_link_preference_ename(uconf_symbolic_link_preference_ty);
00344
00345 #ifndef uconf_relative_filename_preference_DEF
00346 #define uconf_relative_filename_preference_DEF
00347 enum uconf_relative_filename_preference_ty
00348 {
00349 uconf_relative_filename_preference_current,
00350 uconf_relative_filename_preference_base
00351 };
00352 #define uconf_relative_filename_preference_max 2
00353 #endif // uconf_relative_filename_preference_DEF
00354
00355 extern meta_type uconf_relative_filename_preference_type;
00356
00357 void uconf_relative_filename_preference_write(const output::pointer &fp, const char *name, uconf_relative_filename_preference_ty value, bool show);
00358 void uconf_relative_filename_preference_write_xml(const output::pointer &fp, const char *name, uconf_relative_filename_preference_ty value, bool show);
00359 const char *uconf_relative_filename_preference_ename(uconf_relative_filename_preference_ty);
00360
00361 #ifndef uconf_whiteout_preference_DEF
00362 #define uconf_whiteout_preference_DEF
00363 enum uconf_whiteout_preference_ty
00364 {
00365 uconf_whiteout_preference_always,
00366 uconf_whiteout_preference_never
00367 };
00368 #define uconf_whiteout_preference_max 2
00369 #endif // uconf_whiteout_preference_DEF
00370
00371 extern meta_type uconf_whiteout_preference_type;
00372
00373 void uconf_whiteout_preference_write(const output::pointer &fp, const char *name, uconf_whiteout_preference_ty value, bool show);
00374 void uconf_whiteout_preference_write_xml(const output::pointer &fp, const char *name, uconf_whiteout_preference_ty value, bool show);
00375 const char *uconf_whiteout_preference_ename(uconf_whiteout_preference_ty);
00376
00377 #ifndef uconf_DEF
00378 #define uconf_DEF
00379
00380 #define uconf_default_project_name_mask ((unsigned long)0)
00381 #define uconf_default_change_number_mask ((unsigned long)1 << 0)
00382 #define uconf_default_development_directory_mask ((unsigned long)0)
00383 #define uconf_default_project_directory_mask ((unsigned long)0)
00384 #define uconf_delete_file_preference_mask ((unsigned long)1 << 1)
00385 #define uconf_diff_preference_mask ((unsigned long)1 << 2)
00386 #define uconf_pager_preference_mask ((unsigned long)1 << 3)
00387 #define uconf_persevere_preference_mask ((unsigned long)1 << 4)
00388 #define uconf_log_file_preference_mask ((unsigned long)1 << 5)
00389 #define uconf_lock_wait_preference_mask ((unsigned long)1 << 6)
00390 #define uconf_symbolic_link_preference_mask ((unsigned long)1 << 7)
00391 #define uconf_relative_filename_preference_mask ((unsigned long)1 << 8)
00392 #define uconf_email_address_mask ((unsigned long)0)
00393 #define uconf_whiteout_preference_mask ((unsigned long)1 << 9)
00394 #define uconf_editor_command_mask ((unsigned long)0)
00395 #define uconf_visual_command_mask ((unsigned long)0)
00396 #define uconf_pager_command_mask ((unsigned long)0)
00397 #define uconf_attribute_mask ((unsigned long)0)
00398
00399 struct uconf_ty
00400 {
00401 long reference_count;
00402 unsigned long mask;
00403 string_ty *errpos;
00404 string_ty *default_project_name;
00405 long default_change_number;
00406 string_ty *default_development_directory;
00407 string_ty *default_project_directory;
00408 uconf_delete_file_preference_ty delete_file_preference;
00409 uconf_diff_preference_ty diff_preference;
00410 uconf_pager_preference_ty pager_preference;
00411 uconf_persevere_preference_ty persevere_preference;
00412 uconf_log_file_preference_ty log_file_preference;
00413 uconf_lock_wait_preference_ty lock_wait_preference;
00414 uconf_symbolic_link_preference_ty symbolic_link_preference;
00415 uconf_relative_filename_preference_ty relative_filename_preference;
00416 string_ty *email_address;
00417 uconf_whiteout_preference_ty whiteout_preference;
00418 string_ty *editor_command;
00419 string_ty *visual_command;
00420 string_ty *pager_command;
00421 attributes_list_ty *attribute;
00422 };
00423 #endif // uconf_DEF
00424
00425 extern meta_type uconf_type;
00426
00427 void uconf_write(const output::pointer &fp, uconf_ty *value);
00428 void uconf_write_xml(const output::pointer &fp, uconf_ty *value);
00429 uconf_ty *uconf_copy(uconf_ty *);
00430 uconf_ty *uconf_clone(uconf_ty *);
00431 #ifdef DEBUG
00432 void uconf_trace_real(const char *name, const uconf_ty *value);
00433 #define uconf_trace(x) ((void)(trace_pretest_ && (trace_where_, uconf_trace_real(trace_stringize(x), x), 0)))
00434 #else
00435 #define uconf_trace(x)
00436 #endif
00437
00454 void uconf_write_file(string_ty *filename, uconf_ty *value, int comp);
00455
00472 void uconf_write_file(const nstring &filnam, uconf_ty *value, bool comp);
00473
00490 uconf_ty *uconf_read_file(string_ty *filename);
00491
00508 uconf_ty *uconf_read_file(const nstring &filename);
00509 void uconf__rpt_init(void);
00510
00511 #endif // LIBAEGIS_UCONF_H