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