Changeset 322 in dev
- Timestamp:
- Sep 24, 2007, 2:58:10 PM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 3 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/BasicCompiler.vcproj
r312 r322 1305 1305 </File> 1306 1306 <File 1307 RelativePath="..\BasicCompiler_Common\src\Delegate.cpp" 1308 > 1309 </File> 1310 <File 1307 1311 RelativePath="..\BasicCompiler_Common\src\Exception.cpp" 1308 1312 > … … 1334 1338 <File 1335 1339 RelativePath="..\BasicCompiler_Common\src\ObjectModule.cpp" 1340 > 1341 </File> 1342 <File 1343 RelativePath="..\BasicCompiler_Common\src\Parameter.cpp" 1336 1344 > 1337 1345 </File> … … 1478 1486 </File> 1479 1487 <File 1488 RelativePath="..\BasicCompiler_Common\include\Delegate.h" 1489 > 1490 </File> 1491 <File 1480 1492 RelativePath="..\BasicCompiler_Common\include\Exception.h" 1481 1493 > -
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r308 r322 150 150 SynonymErrorWords=(char **)HeapAlloc(hHeap,0,1); 151 151 152 //列挙体に関する情報 の初期化152 //列挙体に関する情報を収集 153 153 CEnumParent::InitEnum(); 154 154 155 155 //列挙体からクラスコードを生成 156 156 char *temp; 157 temp=CEnumParent::Generate Codes();157 temp=CEnumParent::GenerateSourceCode(); 158 158 AddSourceCode(temp); 159 159 HeapDefaultFree(temp); … … 164 164 compiler.GetObjectModule().meta.GetNamespaces() 165 165 ); 166 167 // デリゲートに関する情報を収集 168 { 169 compiler.GetObjectModule().meta.GetDelegates().Collect( 170 compiler.GetObjectModule().GetCurrentSource() 171 ); 172 compiler.GetObjectModule().meta.GetDelegates().Iterator_Init(); 173 174 // デリゲートからクラスコードを生成 175 std::string tempSource; 176 compiler.GetObjectModule().meta.GetDelegates().GenerateSourceCode( tempSource ); 177 AddSourceCode( tempSource.c_str() ); 178 } 166 179 167 180 //クラス名を取得(詳細情報はGetAllClassInfoで取得) -
trunk/abdev/BasicCompiler32/stdafx.h
r299 r322 1 1 #pragma once 2 2 3 #include <map> 3 4 #include <string> 4 5 #include <vector> … … 18 19 19 20 #include <jenga/include/common/String.h> 21 #include <jenga/include/common/File.h> 20 22 21 23 #include "../BasicCompiler_Common/common.h" -
trunk/abdev/BasicCompiler64/BasicCompiler.vcproj
r318 r322 340 340 </File> 341 341 <File 342 RelativePath="..\BasicCompiler_Common\include\Delegate.h" 343 > 344 </File> 345 <File 342 346 RelativePath="..\BasicCompiler_Common\include\Exception.h" 343 347 > … … 1284 1288 </File> 1285 1289 <File 1290 RelativePath="..\BasicCompiler_Common\src\Delegate.cpp" 1291 > 1292 </File> 1293 <File 1286 1294 RelativePath="..\BasicCompiler_Common\src\Exception.cpp" 1287 1295 > … … 1313 1321 <File 1314 1322 RelativePath="..\BasicCompiler_Common\src\ObjectModule.cpp" 1323 > 1324 </File> 1325 <File 1326 RelativePath="..\BasicCompiler_Common\src\Parameter.cpp" 1315 1327 > 1316 1328 </File> -
trunk/abdev/BasicCompiler64/MakePeHdr.cpp
r318 r322 139 139 SynonymErrorWords=(char **)HeapAlloc(hHeap,0,1); 140 140 141 //列挙体に関する情報 の初期化141 //列挙体に関する情報を収集 142 142 CEnumParent::InitEnum(); 143 143 144 144 //列挙体からクラスコードを生成 145 145 char *temp; 146 temp=CEnumParent::Generate Codes();146 temp=CEnumParent::GenerateSourceCode(); 147 147 AddSourceCode(temp); 148 148 HeapDefaultFree(temp); … … 153 153 compiler.GetObjectModule().meta.GetNamespaces() 154 154 ); 155 156 // デリゲートに関する情報を収集 157 { 158 compiler.GetObjectModule().meta.GetDelegates().Collect( 159 compiler.GetObjectModule().GetCurrentSource() 160 ); 161 compiler.GetObjectModule().meta.GetDelegates().Iterator_Init(); 162 163 // デリゲートからクラスコードを生成 164 std::string tempSource; 165 compiler.GetObjectModule().meta.GetDelegates().GenerateSourceCode( tempSource ); 166 AddSourceCode( tempSource.c_str() ); 167 } 155 168 156 169 //クラス名を取得(詳細情報はGetAllClassInfoで取得) -
trunk/abdev/BasicCompiler64/stdafx.h
r308 r322 1 1 #pragma once 2 2 3 #include <map> 3 4 #include <string> 4 5 #include <vector> … … 18 19 19 20 #include <jenga/include/common/String.h> 21 #include <jenga/include/common/File.h> 20 22 21 23 #include "../BasicCompiler_Common/common.h" -
trunk/abdev/BasicCompiler_Common/BasicCompiler.cpp
r312 r322 90 90 MessageBox(0,temporary,"TestMessage",0); 91 91 } 92 void ts(c har *msg){92 void ts(const char *msg){ 93 93 MessageBox(0,msg,"TestMessage",0); 94 94 } 95 void ts(c har *msg,char *title){95 void ts(const char *msg,const char *title){ 96 96 MessageBox(0,msg,title,0); 97 97 } … … 207 207 lstrcat(temporary,path+i); 208 208 lstrcpy(path,temporary); 209 } 210 std::string GetApplicationBaseFullPath( const std::string &relationalPath ) 211 { 212 char fullPath[1024]; 213 lstrcpy( fullPath, relationalPath.c_str() ); 214 GetFullPath( fullPath, Jenga::Common::Environment::GetAppDir() ); 215 return fullPath; 209 216 } 210 217 -
trunk/abdev/BasicCompiler_Common/Compile.cpp
r299 r322 181 181 // ローカル領域をコンパイルしているとき 182 182 SetError(65,"TypeDef",cp ); 183 } 184 185 //既に収集済み 186 break; 187 188 case ESC_DELEGATE: 189 if( UserProc::IsLocalAreaCompiling() ){ 190 // ローカル領域をコンパイルしているとき 191 SetError(65,"Delegate",cp ); 183 192 } 184 193 -
trunk/abdev/BasicCompiler_Common/Enum.cpp
r302 r322 168 168 } 169 169 170 char *CEnumParent::Generate Codes(void){170 char *CEnumParent::GenerateSourceCode(void){ 171 171 char *buffer; 172 172 int MaxSize,length; -
trunk/abdev/BasicCompiler_Common/Enum.h
r215 r322 37 37 static void DestroyEnum(void); 38 38 39 static char *Generate Codes(void);39 static char *GenerateSourceCode(void); 40 40 }; 41 41 extern CEnumParent **ppobj_EnumParent; -
trunk/abdev/BasicCompiler_Common/Intermediate_Step1.cpp
r294 r322 674 674 temporary[i2]=ESC_DEF; 675 675 } 676 else if( lstrcmpi(temporary+i3,"Delegate")==0 ) 677 { 678 i2=i3; 679 temporary[i2++]=1; 680 temporary[i2]=ESC_DELEGATE; 681 } 676 682 break; 677 683 case 'e': -
trunk/abdev/BasicCompiler_Common/Intermediate_Step2.cpp
r290 r322 261 261 KillStringSpaces(Command+2); 262 262 i2 = 2; 263 if( Command[i2] == 1 && Command[i2+1] == ESC_ENUM ){ 263 if( Command[i2] == 1 && Command[i2+1] == ESC_ENUM ) 264 { 264 265 i2 += 2; 265 266 } 266 else if( memicmp( Command + i2, "Blittable(", 10 ) == 0 ){ 267 else if( Command[i2] == 1 && Command[i2+1] == ESC_DELEGATE ) 268 { 269 i2 += 2; 270 } 271 else if( memicmp( Command + i2, "Blittable(", 10 ) == 0 ) 272 { 267 273 i2 += 10; 268 274 i2 = JumpStringInPare(Command,i2)+1; … … 316 322 case ESC_NAMESPACE: 317 323 case ESC_IMPORTS: 324 case ESC_DELEGATE: 318 325 KillStringSpaces(Command+2); 319 326 break; -
trunk/abdev/BasicCompiler_Common/MakeExe.cpp
r315 r322 13 13 } 14 14 15 void AddSourceCode(c har *buffer){15 void AddSourceCode(const char *buffer){ 16 16 char *temp; 17 17 temp=(char *)HeapAlloc(hHeap,0,lstrlen(buffer)+8192); 18 18 lstrcpy(temp,buffer); 19 20 // 改行コードをCRLFからLFにする 21 ChangeReturnCode(temp); 22 23 // コメントを除去 24 DeleteComment( temp ); 19 25 20 26 //エスケープシーケンス設定 -
trunk/abdev/BasicCompiler_Common/common.h
r316 r322 216 216 void ts(int i); 217 217 void ts(int i,int i2); 218 void ts(c har *msg);219 void ts(c har *msg,char *title);218 void ts(const char *msg); 219 void ts(const char *msg,const char *title); 220 220 void epi_check(); 221 221 void GetRelationalPath(char *path,char *dir); 222 222 void GetFullPath( char *path, const string &baseDirPath ); 223 std::string GetApplicationBaseFullPath( const std::string &relationalPath ); 223 224 void ShowErrorLine(int LineNum,const char *FileName); 224 225 BOOL GetFilePathDialog(HWND hwnd,char *filename,LPSTR Filter,LPSTR Title,BOOL bOpen); … … 273 274 //MakeExe.cpp 274 275 void StepCompileProgress(void); 275 void AddSourceCode(c har *buffer);276 void AddSourceCode(const char *buffer); 276 277 void OutputExe(void); 277 278 int MainThread(DWORD dummy); -
trunk/abdev/BasicCompiler_Common/include/BoostSerializationSupport.h
r279 r322 28 28 bool WriteXmlString( std::string &xmlString ) const; 29 29 30 bool ReadBinary( const std::string &filePath, bool isShowExceptionMessage = true ); 31 bool WriteBinary( const std::string &filePath, bool isShowExceptionMessage = true ) const; 30 bool ReadBinaryFile( const std::string &filePath, bool isShowExceptionMessage = true ); 31 bool WriteBinaryFile( const std::string &filePath, bool isShowExceptionMessage = true ) const; 32 bool ReadBinaryString( const std::string &binaryString ); 33 bool WriteBinaryString( std::string &binaryString ) const; 32 34 33 35 bool ReadText( const std::string &filePath, bool isShowExceptionMessage = true ); -
trunk/abdev/BasicCompiler_Common/include/Compiler.h
r308 r322 8 8 #include <ObjectModule.h> 9 9 #include <Linker.h> 10 #include <Delegate.h> 10 11 11 12 class Compiler -
trunk/abdev/BasicCompiler_Common/include/Meta.h
r288 r322 10 10 #include <Variable.h> 11 11 #include <Const.h> 12 #include <Delegate.h> 12 13 13 14 class Meta … … 43 44 ProcPointers procPointers; 44 45 46 // デリゲート 47 Delegates delegates; 48 45 49 // XMLシリアライズ用 46 50 private: … … 60 64 ar & BOOST_SERIALIZATION_NVP( typeDefs ); 61 65 ar & BOOST_SERIALIZATION_NVP( procPointers ); 66 ar & BOOST_SERIALIZATION_NVP( delegates ); 62 67 } 63 68 … … 150 155 } 151 156 152 // 関数ポインタ153 157 ProcPointers &GetProcPointers() 154 158 { 155 159 return procPointers; 156 160 } 161 162 Delegates &GetDelegates() 163 { 164 return delegates; 165 } 157 166 }; -
trunk/abdev/BasicCompiler_Common/include/Parameter.h
r206 r322 144 144 return (int)this->size() * PTR_SIZE; 145 145 } 146 147 bool Analyze( const char *sourceOfParams, int nowLine ); 146 148 }; -
trunk/abdev/BasicCompiler_Common/include/Source.h
r308 r322 1 1 #pragma once 2 2 3 #include <map> 4 #include <string> 3 5 #include <vector> 4 #include <string>5 6 6 7 #include <windows.h> … … 202 203 void RemoveReturnLineUnderbar(); 203 204 205 void Initialize( const std::string &source ); 206 204 207 public: 205 208 BasicSource(){} … … 209 212 { 210 213 } 214 BasicSource( const std::string &source ) 215 { 216 Initialize( source ); 217 } 211 218 ~BasicSource(){} 212 219 … … 257 264 }; 258 265 typedef std::vector<BasicSource> BasicSources; 266 267 class SourceTemplate 268 { 269 std::string source; 270 public: 271 SourceTemplate( const std::string &filePath ); 272 ~SourceTemplate() 273 { 274 } 275 276 std::string GetResult( const std::map<std::string,std::string> &values ); 277 }; -
trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
r299 r322 190 190 } 191 191 192 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinary ( const string &filePath, bool isShowExceptionMessage )193 { 194 // 入力アーカイブの作成 195 std::ifstream ifs( filePath.c_str() );192 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinaryFile( const string &filePath, bool isShowExceptionMessage ) 193 { 194 // 入力アーカイブの作成 195 std::ifstream ifs( filePath.c_str(), ios::in | ios::binary ); 196 196 197 197 bool isSuccessful = false; … … 228 228 return true; 229 229 } 230 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteBinary ( const string &filePath, bool isShowExceptionMessage ) const231 { 232 // 出力アーカイブの作成 233 std::ofstream ofs( filePath.c_str() );230 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteBinaryFile( const string &filePath, bool isShowExceptionMessage ) const 231 { 232 // 出力アーカイブの作成 233 std::ofstream ofs( filePath.c_str(), ios::out | ios::binary ); 234 234 235 235 bool isSuccessful = false; … … 267 267 } 268 268 269 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinaryString( const std::string &binaryString ) 270 { 271 bool isSuccessful = false; 272 273 // 入力アーカイブの作成 274 std::istringstream iss( binaryString, ios::in | ios::binary ); 275 276 try{ 277 boost::archive::binary_iarchive ia(iss); 278 279 // 文字列ストリームから読込 280 ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 281 282 isSuccessful = true; 283 } 284 catch( boost::archive::archive_exception e ) 285 { 286 echo( e.what() ); 287 } 288 catch(...){ 289 echo( "archive_exception以外の不明な例外" ); 290 } 291 292 return isSuccessful; 293 } 294 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteBinaryString( std::string &binaryString ) const 295 { 296 // 出力アーカイブの作成 297 std::ostringstream oss( "", ios::out | ios::binary ); 298 299 bool isSuccessful = false; 300 try{ 301 boost::archive::binary_oarchive oa(oss); 302 303 // 文字列ストリームに書き出し 304 oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 305 306 isSuccessful = true; 307 } 308 catch( boost::archive::archive_exception e ) 309 { 310 echo( e.what() ); 311 } 312 catch(...){ 313 echo( "archive_exception以外の不明な例外" ); 314 } 315 316 binaryString = oss.str(); 317 318 return isSuccessful; 319 } 320 269 321 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadText( const string &filePath, bool isShowExceptionMessage ) 270 322 { -
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r310 r322 957 957 958 958 bool isEnum = false; 959 bool isDelegate = false; 959 960 if( source[i] == 1 && source[i+1] == ESC_ENUM ){ 960 961 // 列挙型の場合 961 962 isEnum = true; 962 963 963 i+=2; 964 i += 2; 965 } 966 else if( source[i] == 1 && source[i+1] == ESC_DELEGATE ) 967 { 968 // デリゲートの場合 969 isDelegate = true; 970 971 i += 2; 964 972 } 965 973 … … 976 984 if( pClass ){ 977 985 if( source[nowLine+1] == ESC_CLASS ){ 978 if( isEnum ){ 986 if( isEnum ) 987 { 979 988 pClass->SetClassType( CClass::Enum ); 989 } 990 else if( isDelegate ) 991 { 992 pClass->SetClassType( CClass::Delegate ); 980 993 } 981 994 else{ … … 1310 1323 } 1311 1324 1312 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ){ 1325 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ) 1326 { 1313 1327 // 列挙型の場合 1314 i+=2; 1328 i += 2; 1329 } 1330 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_DELEGATE ) 1331 { 1332 // デリゲートの場合 1333 i += 2; 1315 1334 } 1316 1335 -
trunk/abdev/BasicCompiler_Common/src/ObjectModule.cpp
r308 r322 9 9 ObjectModuleDataTypeBinaly, 10 10 }; 11 const ObjectModuleDataType objectModuleDataType = ObjectModuleDataType Text;11 const ObjectModuleDataType objectModuleDataType = ObjectModuleDataTypeBinaly; 12 12 13 13 … … 48 48 return ReadText( filePath ); 49 49 case ObjectModuleDataTypeBinaly: 50 return ReadBinary ( filePath );50 return ReadBinaryFile( filePath ); 51 51 default: 52 52 Jenga::Throw( "" ); … … 64 64 return WriteText( filePath ); 65 65 case ObjectModuleDataTypeBinaly: 66 return WriteBinary ( filePath );66 return WriteBinaryFile( filePath ); 67 67 default: 68 68 Jenga::Throw( "" ); … … 80 80 return ReadTextString( str ); 81 81 case ObjectModuleDataTypeBinaly: 82 Jenga::Throw( "" ); 83 break; 82 return ReadBinaryString( str ); 84 83 default: 85 84 Jenga::Throw( "" ); … … 97 96 return WriteTextString( str ); 98 97 case ObjectModuleDataTypeBinaly: 99 Jenga::Throw( "" ); 100 break; 98 return WriteBinaryString( str ); 101 99 default: 102 100 Jenga::Throw( "" ); -
trunk/abdev/BasicCompiler_Common/src/Procedure.cpp
r311 r322 55 55 //ソースコードの位置 56 56 this->codePos = nowLine; 57 if( nowLine == 0x10b ) 58 { 59 int test=0; 60 } 57 61 58 62 //パラメータ -
trunk/abdev/BasicCompiler_Common/src/Source.cpp
r305 r322 422 422 int i,i2; 423 423 424 bool isMustChange = false; 425 for( i=0; ; i++ ){ 426 if( buffer[i] == '\0' ){ 427 break; 428 } 429 if( buffer[i]=='\n' ) 430 { 431 if( i>0 ) 432 { 433 if( buffer[i-1] == '\r' ) 434 { 435 isMustChange = true; 436 } 437 } 438 } 439 } 440 441 if( !isMustChange ) 442 { 443 // 改行コードの変換は必要ない 444 return; 445 } 446 424 447 #ifdef _DEBUG 425 448 //改行コードの整合性チェック … … 806 829 } 807 830 831 void BasicSource::Initialize( const std::string &source ) 832 { 833 Clear(); 834 Add( source ); 835 836 // 改行コードをCRLFからLFに変換 837 ChangeReturnLineChar(); 838 839 // コメントを削除 840 RemoveComments(); 841 842 //最終行には文字を含ませないようにする 843 if( lstrlen(buffer)>0 && buffer[lstrlen(buffer)-1] != '\n' ) 844 { 845 Realloc( length + 1 ); 846 lstrcat( buffer, "\n" ); 847 } 848 849 // アンダーバーによる改行を正規表現に戻す 850 RemoveReturnLineUnderbar(); 851 } 852 808 853 void BasicSource::SetBuffer( const char *buffer ){ 809 854 this->buffer = (char *)calloc( lstrlen(buffer) + 1, 1 ); … … 987 1032 return 1; 988 1033 } 1034 1035 1036 SourceTemplate::SourceTemplate( const std::string &filePath ) 1037 { 1038 Jenga::Common::File file = Jenga::Common::File( GetApplicationBaseFullPath( filePath ) ); 1039 source = file.Read(); 1040 } 1041 std::string SourceTemplate::GetResult( const std::map<std::string,std::string> &values ) 1042 { 1043 std::string result = source; 1044 1045 std::map<std::string,std::string>::const_iterator it = values.begin(); 1046 while( it != values.end() ) 1047 { 1048 while( true ) 1049 { 1050 std::string::size_type index = result.find( "#" + it->first + "#" ); 1051 if( index == std::string::npos ) 1052 { 1053 break; 1054 } 1055 1056 result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() + 2 ); 1057 } 1058 it++; 1059 } 1060 1061 return result; 1062 }
Note:
See TracChangeset
for help on using the changeset viewer.