| 1 | // ============================================================ // |
|---|
| 2 | // // |
|---|
| 3 | // File : awti_imp_local.hxx // |
|---|
| 4 | // Purpose : local definitions for import // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // www.arb-home.de // |
|---|
| 8 | // // |
|---|
| 9 | // ============================================================ // |
|---|
| 10 | |
|---|
| 11 | #ifndef AWTI_IMP_LOCAL_HXX |
|---|
| 12 | #define AWTI_IMP_LOCAL_HXX |
|---|
| 13 | |
|---|
| 14 | #ifndef _CPP_STRING |
|---|
| 15 | #include <string> |
|---|
| 16 | #endif |
|---|
| 17 | |
|---|
| 18 | #ifndef ARBDBT_H |
|---|
| 19 | #include <arbdbt.h> |
|---|
| 20 | #endif |
|---|
| 21 | #ifndef AW_ROOT_HXX |
|---|
| 22 | #include <aw_root.hxx> |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | #ifndef AWTI_IMPORT_HXX |
|---|
| 26 | #include <awti_import.hxx> |
|---|
| 27 | #endif |
|---|
| 28 | #ifndef SMARTPTR_H |
|---|
| 29 | #include <smartptr.h> |
|---|
| 30 | #endif |
|---|
| 31 | |
|---|
| 32 | #define awti_assert(cond) arb_assert(cond) |
|---|
| 33 | |
|---|
| 34 | #define AWAR_FILE_BASE "tmp/import/pattern" |
|---|
| 35 | #define AWAR_FILE AWAR_FILE_BASE"/file_name" |
|---|
| 36 | #define AWAR_FORM "tmp/import/form" |
|---|
| 37 | #define AWAR_ALI "tmp/import/alignment" |
|---|
| 38 | #define AWAR_ALI_TYPE "tmp/import/alignment_type" |
|---|
| 39 | #define AWAR_ALI_PROTECTION "tmp/import/alignment_protection" |
|---|
| 40 | |
|---|
| 41 | #define GB_MAIN awtcig.gb_main |
|---|
| 42 | #define AWTC_IMPORT_CHECK_BUFFER_SIZE 10000 |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | struct input_format_per_line { |
|---|
| 46 | char *match; |
|---|
| 47 | char *aci; |
|---|
| 48 | char *srt; |
|---|
| 49 | char *mtag; |
|---|
| 50 | char *append; |
|---|
| 51 | char *write; |
|---|
| 52 | char *setvar; |
|---|
| 53 | GB_TYPES type; |
|---|
| 54 | |
|---|
| 55 | char *defined_at; // where was match defined |
|---|
| 56 | |
|---|
| 57 | struct input_format_per_line *next; |
|---|
| 58 | |
|---|
| 59 | struct input_format_per_line *reverse(struct input_format_per_line *to_append) { |
|---|
| 60 | struct input_format_per_line *rest = next; |
|---|
| 61 | next = to_append; |
|---|
| 62 | return rest ? rest->reverse(this) : this; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | input_format_per_line(); |
|---|
| 66 | ~input_format_per_line(); |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | #define IFS_VARIABLES 26 // 'a'-'z' |
|---|
| 70 | |
|---|
| 71 | // typedef std::map<char, std::string> SetVariables; |
|---|
| 72 | |
|---|
| 73 | class SetVariables { |
|---|
| 74 | typedef SmartPtr<std::string> StringPtr; |
|---|
| 75 | StringPtr value[IFS_VARIABLES]; |
|---|
| 76 | |
|---|
| 77 | public: |
|---|
| 78 | SetVariables() {} |
|---|
| 79 | |
|---|
| 80 | void set(char c, const char *s) { |
|---|
| 81 | awti_assert(c >= 'a' && c <= 'z'); |
|---|
| 82 | value[c-'a'] = new std::string(s); |
|---|
| 83 | } |
|---|
| 84 | const std::string *get(char c) const { |
|---|
| 85 | awti_assert(c >= 'a' && c <= 'z'); |
|---|
| 86 | StringPtr v = value[c-'a']; |
|---|
| 87 | return v.Null() ? NULL : &*v; |
|---|
| 88 | } |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | struct input_format_struct { |
|---|
| 93 | char *autodetect; |
|---|
| 94 | char *system; |
|---|
| 95 | char *new_format; |
|---|
| 96 | size_t new_format_lineno; |
|---|
| 97 | size_t tab; |
|---|
| 98 | |
|---|
| 99 | char *begin; |
|---|
| 100 | |
|---|
| 101 | char *sequencestart; |
|---|
| 102 | int read_this_sequence_line_too; |
|---|
| 103 | char *sequenceend; |
|---|
| 104 | char *sequencesrt; |
|---|
| 105 | char *sequenceaci; |
|---|
| 106 | char *filetag; |
|---|
| 107 | char *autotag; |
|---|
| 108 | size_t sequencecolumn; |
|---|
| 109 | int autocreateacc; |
|---|
| 110 | int noautonames; |
|---|
| 111 | |
|---|
| 112 | char *end; |
|---|
| 113 | |
|---|
| 114 | SetVariables global_variables; // values of global variables |
|---|
| 115 | SetVariables variable_errors; // user-defined errors (used when var not set) |
|---|
| 116 | |
|---|
| 117 | char *b1; |
|---|
| 118 | char *b2; |
|---|
| 119 | |
|---|
| 120 | input_format_per_line *pl; |
|---|
| 121 | |
|---|
| 122 | input_format_struct(void); |
|---|
| 123 | ~input_format_struct(void); |
|---|
| 124 | }; |
|---|
| 125 | |
|---|
| 126 | struct awtcig_struct { |
|---|
| 127 | struct input_format_struct *ifo; // main input format |
|---|
| 128 | struct input_format_struct *ifo2; // symlink to input format |
|---|
| 129 | GBDATA *gb_main; // import database |
|---|
| 130 | AW_CL cd1,cd2; |
|---|
| 131 | AWTC_RCB(func); |
|---|
| 132 | char **filenames; |
|---|
| 133 | char **current_file; |
|---|
| 134 | FILE *in; |
|---|
| 135 | bool doExit; // whether import window 'close' does exit |
|---|
| 136 | GBDATA *gb_other_main; // main DB |
|---|
| 137 | }; |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | #else |
|---|
| 141 | #error awti_imp_local.hxx included twice |
|---|
| 142 | #endif // AWTI_IMP_LOCAL_HXX |
|---|