- Timestamp:
- Apr 14, 2009, 8:39:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_header.cpp
r98 r113 12 12 #include <time.h> 13 13 #include <sstream> 14 #include <fstream> 14 15 15 16 namespace morpheo { … … 21 22 std::string filename) 22 23 { 23 log_ printf(FUNC,Behavioural,FUNCTION,"Begin");24 log_begin(Behavioural,FUNCTION); 24 25 25 26 std::string text; … … 32 33 text += "-- "+toString(_("Date : ")) + ctime (¤t_time ); 33 34 text += "-- "+toString(_("Version : ")) + MORPHEO_HEADER +"\n"; 35 text += "-- "+toString(_("Id : ")) + _id +" \n"; 34 36 text += "-- "+toString(_("Comment : ")) + _("it's a autogenerated file, don't modify") +"\n"; 35 37 text += "-------------------------------------------------------------------------------\n"; 36 38 37 log_ printf(FUNC,Behavioural,FUNCTION,"End");39 log_end(Behavioural,FUNCTION); 38 40 39 41 return text; 42 }; 43 44 #undef FUNCTION 45 #define FUNCTION "vhdl_get_id" 46 std::string vhdl_get_id(std::string model_name) 47 { 48 log_begin(Behavioural,FUNCTION); 49 50 std::string id=""; 51 52 directory(); 53 54 std::string filename = MORPHEO_VHDL + "/" + model_name + VHDL_EXTENSION; 55 std::ifstream file; 56 57 file.open(filename.c_str(),std::ios::in); 58 59 // open file 60 if (!file) 61 { 62 log_printf(INFO,Behavioural,FUNCTION,_("Can't open file : \"%s\""),filename.c_str()); 63 } 64 else 65 { 66 // get line with Id 67 do 68 { 69 std::getline(file,id,'\n'); // comment 70 } while ((id.find("Id :") == std::string::npos) and 71 (not file.eof())); 72 73 if (file.eof()) 74 log_printf(INFO,Behavioural,FUNCTION,_("\"Id\" not find in file : \"%s\""),filename.c_str()); 75 else 76 { 77 // get id 78 id = id.substr(id.find_first_of(':',0)+1,std::string::npos); 79 80 // Erase all ' ' 81 size_t i=id.find_first_of(' ',0); 82 while (i!=std::string::npos) 83 { 84 id.erase(i,i+1); 85 i=id.find_first_of(' ',i); 86 } 87 } 88 } 89 90 log_end(Behavioural,FUNCTION); 91 92 return id; 40 93 }; 41 94
Note: See TracChangeset
for help on using the changeset viewer.