| 1 | // ==================================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : ad_config.h // |
|---|
| 4 | // Purpose : Read/write editor configurations // |
|---|
| 5 | // // |
|---|
| 6 | // // |
|---|
| 7 | // Coded by Ralf Westram (coder@reallysoft.de) in May 2005 // |
|---|
| 8 | // Copyright Department of Microbiology (Technical University Munich) // |
|---|
| 9 | // // |
|---|
| 10 | // Visit our web site at: http://www.arb-home.de/ // |
|---|
| 11 | // // |
|---|
| 12 | // ==================================================================== // |
|---|
| 13 | |
|---|
| 14 | #ifndef AD_CONFIG_H |
|---|
| 15 | #define AD_CONFIG_H |
|---|
| 16 | |
|---|
| 17 | #ifdef __cplusplus |
|---|
| 18 | extern "C" { |
|---|
| 19 | #endif |
|---|
| 20 | |
|---|
| 21 | #define AWAR_CONFIG_DATA "configuration_data" |
|---|
| 22 | #define AWAR_CONFIG "configuration" |
|---|
| 23 | |
|---|
| 24 | GBDATA *GBT_find_configuration(GBDATA *gb_main,const char *name); |
|---|
| 25 | GBDATA *GBT_create_configuration(GBDATA *gb_main, const char *name); |
|---|
| 26 | |
|---|
| 27 | char **GBT_get_configuration_names(GBDATA *gb_main); |
|---|
| 28 | char **GBT_get_configuration_names_and_count(GBDATA *gb_main, int *countPtr); |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | typedef struct s_gbt_config { |
|---|
| 32 | char *top_area; |
|---|
| 33 | char *middle_area; |
|---|
| 34 | } GBT_config; |
|---|
| 35 | |
|---|
| 36 | GBT_config *GBT_load_configuration_data(GBDATA *gb_main, const char *name, GB_ERROR *error); |
|---|
| 37 | |
|---|
| 38 | GB_ERROR GBT_save_configuration_data(GBT_config *data, GBDATA *gb_main, const char *name); |
|---|
| 39 | void GBT_free_configuration_data(GBT_config *data); |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | typedef enum { |
|---|
| 43 | CI_UNKNOWN = 1, |
|---|
| 44 | CI_GROUP = 2, |
|---|
| 45 | CI_FOLDED_GROUP = 4, |
|---|
| 46 | CI_SPECIES = 8, |
|---|
| 47 | CI_SAI = 16, |
|---|
| 48 | CI_CLOSE_GROUP = 32, |
|---|
| 49 | CI_END_OF_CONFIG = 64, |
|---|
| 50 | } gbt_config_item_type; |
|---|
| 51 | |
|---|
| 52 | typedef struct s_gbt_config_item { |
|---|
| 53 | gbt_config_item_type type; |
|---|
| 54 | char *name; |
|---|
| 55 | } GBT_config_item; |
|---|
| 56 | |
|---|
| 57 | typedef struct s_gbt_config_parser { |
|---|
| 58 | char *config_string; |
|---|
| 59 | int parse_pos; |
|---|
| 60 | } GBT_config_parser; |
|---|
| 61 | |
|---|
| 62 | GBT_config_parser *GBT_start_config_parser(const char *config_string); |
|---|
| 63 | void GBT_free_config_parser(GBT_config_parser *parser); |
|---|
| 64 | |
|---|
| 65 | GB_ERROR GBT_parse_next_config_item(GBT_config_parser *parser, GBT_config_item *item); |
|---|
| 66 | void GBT_append_to_config_string(const GBT_config_item *item, void *strstruct); |
|---|
| 67 | |
|---|
| 68 | GBT_config_item *GBT_create_config_item(); |
|---|
| 69 | void GBT_free_config_item(GBT_config_item *item); |
|---|
| 70 | |
|---|
| 71 | #if defined(DEBUG) |
|---|
| 72 | void GBT_test_config_parser(GBDATA *gb_main); |
|---|
| 73 | #endif // DEBUG |
|---|
| 74 | |
|---|
| 75 | #ifdef __cplusplus |
|---|
| 76 | } |
|---|
| 77 | #endif |
|---|
| 78 | |
|---|
| 79 | #else |
|---|
| 80 | #error ad_config.h included twice |
|---|
| 81 | #endif // AD_CONFIG_H |
|---|
| 82 | |
|---|