Changeset 279 in dev for trunk/abdev/BasicCompiler_Common/include
- Timestamp:
- Aug 14, 2007, 3:22:02 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/include
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/include/BoostSerializationSupport.h
r264 r279 25 25 bool ReadXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true ); 26 26 bool WriteXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true ) const; 27 bool ReadXmlString( const std::string &xmlString ); 28 bool WriteXmlString( std::string &xmlString ) const; 27 29 28 30 bool ReadBinary( const std::string &filePath, bool isShowExceptionMessage = true ); -
trunk/abdev/BasicCompiler_Common/include/Compiler.h
r270 r279 46 46 return namespaceSupporter; 47 47 } 48 49 // ソースコード50 BasicSource source;51 48 52 49 // コード生成機構 -
trunk/abdev/BasicCompiler_Common/include/DataTable.h
r273 r279 28 28 for( int i=0; i<size; i++ ) 29 29 { 30 if( _buffer[i*3+2] != ',' ) 31 { 32 //エラー 33 DebugBreak(); 34 } 35 ULONG_PTR l; 36 sscanf( _buffer.c_str() + i*3, "%02x,", &l ); 37 buffer[i] = (char)l; 30 ULONG_PTR l1 = ( ( _buffer[i*3] >= 'a' ) ? ( _buffer[i*3] - 'a' + 0x0a ) : ( _buffer[i*3] - '0' ) ) * 0x10; 31 ULONG_PTR l2 = ( _buffer[i*3+1] >= 'a' ) ? ( _buffer[i*3+1] - 'a' + 0x0a ) : ( _buffer[i*3+1] - '0' ); 32 ULONG_PTR l = l1 + l2; 33 buffer[i] = static_cast<char>(l); 38 34 } 39 35 } -
trunk/abdev/BasicCompiler_Common/include/NativeCode.h
r278 r279 219 219 for( int i=0; i<size; i++ ) 220 220 { 221 ULONG_PTR l; 222 sscanf( code.c_str() + i*3, "%02x,", &l ); 223 codeBuffer[i] = (char)l; 221 ULONG_PTR l1 = ( ( code[i*3] >= 'a' ) ? ( code[i*3] - 'a' + 0x0a ) : ( code[i*3] - '0' ) ) * 0x10; 222 ULONG_PTR l2 = ( code[i*3+1] >= 'a' ) ? ( code[i*3+1] - 'a' + 0x0a ) : ( code[i*3+1] - '0' ); 223 ULONG_PTR l = l1 + l2; 224 codeBuffer[i] = static_cast<char>(l); 224 225 } 225 226 } -
trunk/abdev/BasicCompiler_Common/include/ObjectModule.h
r273 r279 12 12 // データテーブル 13 13 DataTable dataTable; 14 15 // ソースコード 16 BasicSource source; 14 17 15 18 // XMLシリアライズ用 … … 27 30 ar & BOOST_SERIALIZATION_NVP( globalNativeCode ); 28 31 ar & BOOST_SERIALIZATION_NVP( dataTable ); 32 ar & BOOST_SERIALIZATION_NVP( source ); 29 33 } 30 34 31 35 public: 32 36 void StaticLink( ObjectModule &objectModule ); 37 38 bool Read( const std::string &filePath ); 39 bool Write( const std::string &filePath ) const; 40 bool ReadString( const std::string &str ); 41 bool WriteString( std::string &str ) const; 33 42 }; 34 43 typedef std::vector<ObjectModule *> ObjectModules; -
trunk/abdev/BasicCompiler_Common/include/Source.h
r268 r279 18 18 int FilesNum; 19 19 int LineOfFile[MAX_LEN]; 20 }; 21 22 class IncludedFilesRelation 23 { 24 std::vector<std::string> filePaths; 25 std::vector<int> lineFileNumbers; 26 27 // XMLシリアライズ用 28 private: 29 friend class boost::serialization::access; 30 template<class Archive> void serialize(Archive& ar, const unsigned int version) 31 { 32 trace_for_serialize( "serializing - IncludedFilesRelation" ); 33 34 ar & BOOST_SERIALIZATION_NVP( filePaths ); 35 ar & BOOST_SERIALIZATION_NVP( lineFileNumbers ); 36 } 37 38 public: 39 IncludedFilesRelation() 40 { 41 } 42 ~IncludedFilesRelation() 43 { 44 } 45 46 const int GetFileNumber( int lineNumber ) const 47 { 48 return lineFileNumbers[lineNumber]; 49 } 50 const std::string &GetFilePath( int lineNumber ) const 51 { 52 return filePaths[GetFileNumber( lineNumber )]; 53 } 54 const std::string &GetFilePathFromFileNumber( int fileNumber ) const 55 { 56 return filePaths[fileNumber]; 57 } 58 int GetFileCounts() const 59 { 60 return filePaths.size(); 61 } 62 63 int AddFile( const std::string &filePath ) 64 { 65 filePaths.push_back( filePath ); 66 return filePaths.size()-1; 67 } 68 void AddLine( int fileNumber ) 69 { 70 lineFileNumbers.push_back( fileNumber ); 71 } 72 73 int GetLineCounts() const 74 { 75 return lineFileNumbers.size(); 76 } 20 77 }; 21 78 … … 66 123 static const string generateDirectiveName; 67 124 125 IncludedFilesRelation includedFilesRelation; 126 127 // XMLシリアライズ用 128 private: 129 friend class boost::serialization::access; 130 BOOST_SERIALIZATION_SPLIT_MEMBER(); 131 template<class Archive> void load(Archive& ar, const unsigned int version) 132 { 133 trace_for_serialize( "serializing(load) - BasicSource" ); 134 135 std::string _buffer; 136 ar & BOOST_SERIALIZATION_NVP( _buffer ); 137 ar & BOOST_SERIALIZATION_NVP( length ); 138 ar & BOOST_SERIALIZATION_NVP( includedFilesRelation ); 139 140 // 読み込み後の処理 141 Realloc( length ); 142 for( int i=0; i<length; i++ ) 143 { 144 ULONG_PTR l1 = ( ( _buffer[i*3] >= 'a' ) ? ( _buffer[i*3] - 'a' + 0x0a ) : ( _buffer[i*3] - '0' ) ) * 0x10; 145 ULONG_PTR l2 = ( _buffer[i*3+1] >= 'a' ) ? ( _buffer[i*3+1] - 'a' + 0x0a ) : ( _buffer[i*3+1] - '0' ); 146 ULONG_PTR l = l1 + l2; 147 buffer[i] = static_cast<char>(l); 148 } 149 buffer[length] = 0; 150 } 151 template<class Archive> void save(Archive& ar, const unsigned int version) const 152 { 153 trace_for_serialize( "serializing(save) - BasicSource" ); 154 155 // 保存準備 156 char *tempCode = (char *)calloc( (length+1) * 3, 1 ); 157 for( int i=0; i<length; i++ ) 158 { 159 char temp[32]; 160 sprintf( temp, "%02x,", (unsigned char)buffer[i] ); 161 tempCode[i*3] = temp[0]; 162 tempCode[i*3+1] = temp[1]; 163 tempCode[i*3+2] = temp[2]; 164 } 165 166 std::string _buffer = tempCode; 167 free( tempCode ); 168 169 ar & BOOST_SERIALIZATION_NVP( _buffer ); 170 ar & BOOST_SERIALIZATION_NVP( length ); 171 ar & BOOST_SERIALIZATION_NVP( includedFilesRelation ); 172 } 173 174 private: 68 175 void Realloc( int newLength ){ 69 176 buffer = (char *)realloc( buffer, newLength + 255 ); … … 102 209 } 103 210 211 const IncludedFilesRelation &GetIncludedFilesRelation() const 212 { 213 return includedFilesRelation; 214 } 215 104 216 void SetBuffer( const char *buffer ); 105 217 … … 109 221 110 222 void Addition( const char *buffer ); 223 224 bool GetLineInfo( int sourceCodePos, int &line, std::string &fileName ); 111 225 112 226 void operator = ( const BasicSource &source ){
Note:
See TracChangeset
for help on using the changeset viewer.