169 {
170
171 string chksum_start=( "/CHECKSUM/START");
172 string chksum_end=( "/CHECKSUM/END");
173 string chksum_include=( "#include ");
174 fstream new_file;
175 new_file.open(filename, ios::in);
176
177
178 if (level > 15) return 0;
179
180 if ( !new_file.is_open() ) {
181 return -1;
182 }
183
184 string line;
185 while (getline(new_file, line)) {
186
188
189 if (line == chksum_start) {
190 string title;
191 getline(new_file, title);
194 continue;
195 }
196
197 if (line == chksum_end) {
199 continue;
200 }
201
202 string comp=line.substr(0,chksum_include.length());
203 if (
comp == chksum_include) {
204
205 string include_file = line.substr(chksum_include.length());
206 if (deck_directory.length() > 0){
207 include_file = deck_directory+
separator()+include_file;
208 }
210 cout << "Include file: " << include_file << endl;
211 }
212
213
214 file_read(include_file,deck_directory, level + 1,md5_states_tmp);
215 continue;
216 }
217
218 if (line[0] == '#') {
219
220 continue;
221 }
223
224 }
225 new_file.close();
226 return 0;
227 }
void end_checksum(std::list< std::tuple< int, std::string, md5_state_t, std::string > > *md5_states_tmp)
void process_checksum(std::string line, std::list< std::tuple< int, std::string, md5_state_t, std::string > > *md5_states_tmp)
int file_read(std::string filename, std::string deck_directory, int level, std::list< std::tuple< int, std::string, md5_state_t, std::string > > *md5_states_tmp)
void new_checksum(std::string title, std::list< std::tuple< int, std::string, md5_state_t, std::string > > *md5_states_tmp)
void remove_carriage_return(std::string &line)