#include "config.h" #include using namespace std; // predefined functions list predefined_functions; int predefined_function_count=0; // contexts to be excluded list excluded_contexts; void read_predefined_functions(ifstream &file) { bool complete=false; char function_name[100]; char module_name[100]; while (!complete) { if (!file.getline(function_name,100,' ')) { // end of file complete=true; } else { if (strcmp(function_name,"")!=0) { // no empty line if (!file.getline(module_name,100)) { // Syntax error cerr << "Syntax Error in predefined_functions section of config-file.\n"; exit(-1); } predefined_function pred_temp(function_name,module_name); predefined_functions.push_back(pred_temp); predefined_function_count++; // cout << "Predefined function : " << function_name << endl; } else { // end of section complete=true; } } } } void read_connect_outside_functions(ifstream &file) { bool complete=false; char function_name[100]; while (!complete) { if (!file.getline(function_name,100)) { // end of file complete=true; } else { if (strcmp(function_name,"")!=0) { // füge die Funktion in der Liste der nach außen zu verbindenden Funktionen ein connect_outside connect_out; connect_out.functionname=function_name; connect_out.original_functionname=function_name; connect_out.feedthrough_functions.push_back(function_name); connect_out.first=true; connect_out.parameterstring=""; connect_outsides.push_back(connect_out); } else { // end of section complete=true; } } } } void read_excluded_contexts(ifstream &file) { char context_name[100]; bool complete=false; while (!complete) { if (!file.getline(context_name,100)) { // end of file complete=true; } else { if (strcmp(context_name,"")==0) { // end of section complete=true; } else { excluded_contexts.push_back(context_name); } } } } // read configuration from file void read_config_file() { ifstream file; char s1[100],s2[100]; bool complete=false; file.open("pvs2hdl.conf"); if (!file) { cerr << "Warning!!! Configuration-file pvs2hdl.conf could not be opened!\n"; return; } while (!complete) { if ( (!file.getline(s1,100,' ')) || (strcmp(s1,"SECTION")!=0) ) { // Syntax error // cerr << "Could not find section marker in pvs2hdl.conf.\n"; // exit(-1); complete=true; } else { if (!file.getline(s2,100)) { // Syntax error // cerr << "Could not find section marker in pvs2hdl.conf.\n"; // exit(-1); complete=true; } else { // cout << "Section : " << s2 << endl; if (strcmp(s2,"predefined_functions")==0) read_predefined_functions(file); if (strcmp(s2,"connect_outside_functions")==0) read_connect_outside_functions(file); // if (strcmp(s2,"context_exclude")==0) read_excluded_contexts(file); } } } file.close(); } ostream &operator << (ostream& ostr, const predefined_function &x) { return ostr << x.function_name << " => " << x.module_name; }