Changeset 92 in dev for BasicCompiler_Common
- Timestamp:
- Apr 8, 2007, 2:07:31 AM (18 years ago)
- Location:
- BasicCompiler_Common
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler_Common/BasicCompiler.cpp
r78 r92 785 785 //通常ダイアログインターフェイス 786 786 hMainDlg=CreateDialog(hInst,MAKEINTRESOURCE(IDD_MAIN),hOwnerEditor,(DLGPROC)DlgCompile); 787 788 #ifdef _DEBUG 789 // VC++によるデバッグの場合は画面を出さない 790 // ※別スレッドのウィンドウ ループとの不整合性がデッドロックを生む場合がある(特にステップ実行時など) 791 PostMessage( hMainDlg, WM_COMMAND, IDOK, 0 ); 792 #else 787 793 ShowWindow(hMainDlg,SW_SHOW); 794 #endif 788 795 } 789 796 SendDlgItemMessage(hMainDlg,IDC_SHOWERROR,BM_SETCHECK,BST_CHECKED,0); -
BasicCompiler_Common/Class.cpp
r91 r92 607 607 608 608 609 609 610 ////////////////////////////////////// 610 611 // 存在しないときは新たに生成する … … 626 627 ppsi[i2]=0; 627 628 } 628 else ppsi[i2]=method->pUserProc; 629 else{ 630 ppsi[i2]=method->pUserProc; 631 } 629 632 i2++; 630 633 } … … 886 889 } 887 890 891 bool isEnum = false; 892 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ){ 893 // 列挙型の場合 894 isEnum = true; 895 896 i+=2; 897 } 898 888 899 int i2; 889 900 char temporary[VN_SIZE]; … … 900 911 if( pClass ){ 901 912 if( basbuf[nowLine+1] == ESC_CLASS ){ 902 pClass->classType = CClass::Class; 913 if( isEnum ){ 914 pClass->classType = CClass::Enum; 915 } 916 else{ 917 pClass->classType = CClass::Class; 918 } 903 919 } 904 920 else if( basbuf[nowLine+1] == ESC_INTERFACE ){ … … 1221 1237 } 1222 1238 1239 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ){ 1240 // 列挙型の場合 1241 i+=2; 1242 } 1223 1243 1224 1244 //クラス名を取得 -
BasicCompiler_Common/Diagnose.cpp
r91 r92 11 11 char temporary[8192]; 12 12 13 // グローバル / ローカル コード領域のサイズを調べる 14 extern int obp; 15 extern int GlobalOpBufferSize; 16 sprintf(temporary, "%d", GlobalOpBufferSize/1024 ); 17 Smoothie::Logger::Put( (string)"グローバル領域のコードサイズ: " + temporary + "KB" ); 18 sprintf(temporary, "%d", (obp-GlobalOpBufferSize)/1024 ); 19 Smoothie::Logger::Put( (string)"ローカル領域のコードサイズ: " + temporary + "KB" ); 13 { 14 /////////////////////////////////////////////////////////////////// 15 // グローバル / ローカル コード領域のサイズを調べる 16 /////////////////////////////////////////////////////////////////// 17 18 extern int obp; 19 extern int GlobalOpBufferSize; 20 sprintf(temporary, "%d", GlobalOpBufferSize/1024 ); 21 Smoothie::Logger::Put( (string)"グローバル領域のコードサイズ: " + temporary + "KB" ); 22 sprintf(temporary, "%d", (obp-GlobalOpBufferSize)/1024 ); 23 Smoothie::Logger::Put( (string)"ローカル領域のコードサイズ: " + temporary + "KB" ); 24 sprintf(temporary, "%d", obp/1024 ); 25 Smoothie::Logger::Put( (string)"コードサイズ総量: " + temporary + "KB" ); 26 } 20 27 21 28 { 29 /////////////////////////////////////////////////////////////////// 22 30 // グローバル関数、クラスメソッドのサイズを調べる 31 /////////////////////////////////////////////////////////////////// 32 23 33 int codeSizeOfGlobalProc = 0; 24 34 int codeSizeOfClassMethod = 0; … … 44 54 sprintf(temporary, "%d", codeSizeOfClassMethod/1024 ); 45 55 Smoothie::Logger::Put( (string)"クラスメソッドのコードサイズ総量: " + temporary + "KB" ); 46 47 Smoothie::Logger::Put( "\n\n" );48 56 } 49 57 50 58 { 59 /////////////////////////////////////////////////////////////////// 60 // Enumに必要なのコードサイズを調べる 61 /////////////////////////////////////////////////////////////////// 62 int codeSizeOfEnum = 0; 63 64 // イテレータをリセット 65 extern CDBClass *pobj_DBClass; 66 pobj_DBClass->Iterator_Reset(); 67 68 while( pobj_DBClass->Iterator_HasNext() ){ 69 int codeSizeOfClass = 0; 70 71 CClass &objClass = *pobj_DBClass->Iterator_GetNext(); 72 73 if( !objClass.IsEnum() ){ 74 // 列挙型以外は無視 75 continue; 76 } 77 78 // 動的メソッド 79 foreach( const CMethod &method, objClass.GetMethods() ){ 80 if( method.pUserProc->IsCompiled() ){ 81 codeSizeOfClass += method.pUserProc->GetCodeSize(); 82 } 83 } 84 85 // 静的メソッド 86 foreach( const CMethod &method, objClass.GetStaticMethods() ){ 87 codeSizeOfClass += method.pUserProc->GetCodeSize(); 88 } 89 90 codeSizeOfEnum += codeSizeOfClass; 91 } 92 93 sprintf(temporary, "%d", codeSizeOfEnum/1024 ); 94 Smoothie::Logger::Put( (string)"Enumのコードサイズ総量: " + temporary + "KB" ); 95 } 96 97 Smoothie::Logger::Put( "\n\n" ); 98 99 { 100 /////////////////////////////////////////////////////////////////// 51 101 // クラスのサイズを調べる 102 /////////////////////////////////////////////////////////////////// 52 103 53 104 // イテレータをリセット … … 82 133 } 83 134 } 84 85 135 } 86 136 } -
BasicCompiler_Common/Enum.cpp
r88 r92 147 147 parent=ppobj_EnumParent[i]; 148 148 149 sprintf(buffer+length,"Class %s\n",parent->TypeName);149 sprintf(buffer+length,"Class Enum %s\n",parent->TypeName); 150 150 length+=lstrlen(buffer+length); 151 151 lstrcpy(buffer+length,"\tInherits EnumBase\n"); 152 152 length+=lstrlen(buffer+length); 153 sprintf(buffer+length,"\tSub %s(value As Long,lpszName As LPSTR)\n",parent->TypeName); 154 length+=lstrlen(buffer+length); 155 lstrcpy(buffer+length,"\t\tEnumBase(value,lpszName)\n"); 156 length+=lstrlen(buffer+length); 157 lstrcpy(buffer+length,"\tEnd Sub\n"); 158 length+=lstrlen(buffer+length); 153 159 lstrcpy(buffer+length,"Public\n"); 154 160 length+=lstrlen(buffer+length); … … 156 162 length+=lstrlen(buffer+length); 157 163 if(parent->iEnumMemberNum){ 158 sprintf(buffer+length,"\t\tEnumBase(%d)\n", 159 parent->ppobj_EnumMember[0]->m_value); 160 length+=lstrlen(buffer+length); 161 } 162 lstrcpy(buffer+length,"\tEnd Sub\n"); 163 length+=lstrlen(buffer+length); 164 sprintf(buffer+length,"\tSub %s(ByRef e As %s)\n",parent->TypeName,parent->TypeName); 165 length+=lstrlen(buffer+length); 166 lstrcpy(buffer+length,"\t\tEnumBase(e.m_Value)\n"); 167 length+=lstrlen(buffer+length); 168 lstrcpy(buffer+length,"\tEnd Sub\n"); 169 length+=lstrlen(buffer+length); 170 sprintf(buffer+length,"\tSub %s(value As Long)\n",parent->TypeName); 171 length+=lstrlen(buffer+length); 172 lstrcpy(buffer+length,"\t\tEnumBase(value)\n"); 173 length+=lstrlen(buffer+length); 164 sprintf(buffer+length,"\t\tEnumBase(%d,\"%s\")\n", 165 parent->ppobj_EnumMember[0]->m_value, 166 parent->ppobj_EnumMember[0]->m_name); 167 length+=lstrlen(buffer+length); 168 } 174 169 lstrcpy(buffer+length,"\tEnd Sub\n"); 175 170 length+=lstrlen(buffer+length); … … 183 178 member=parent->ppobj_EnumMember[i2]; 184 179 185 sprintf(buffer+length,"\tStatic %s As %s(%d )\n",180 sprintf(buffer+length,"\tStatic %s As %s(%d,\"%s\")\n", 186 181 member->m_name, 187 182 parent->TypeName, 188 member->m_value); 189 length+=lstrlen(buffer+length); 190 } 191 183 member->m_value, 184 member->m_name); 185 length+=lstrlen(buffer+length); 186 } 187 188 /* 192 189 sprintf(buffer+length,"\tOverride Function ToString() As String\n",parent->TypeName); 193 190 length+=lstrlen(buffer+length); 194 lstrcpy(buffer+length,"\t\tSelect Case m_Value\n");191 lstrcpy(buffer+length,"\t\tSelect Case value\n"); 195 192 length+=lstrlen(buffer+length); 196 193 for(i2=0;i2<parent->iEnumMemberNum;i2++){ … … 208 205 length+=lstrlen(buffer+length); 209 206 207 210 208 sprintf(buffer+length,"\tSub Operator= (ByRef value As %s)\n",parent->TypeName); 211 209 length+=lstrlen(buffer+length); … … 215 213 length+=lstrlen(buffer+length); 216 214 217 /*sprintf(buffer+length,"\tSub Operator= (ByRef value As String)\n",parent->TypeName);215 sprintf(buffer+length,"\tSub Operator= (ByRef value As String)\n",parent->TypeName); 218 216 length+=lstrlen(buffer+length); 219 217 lstrcpy(buffer+length,"\t\tSelect Case value\n"); … … 231 229 length+=lstrlen(buffer+length); 232 230 lstrcpy(buffer+length,"\tEnd Sub\n"); 231 length+=lstrlen(buffer+length); 232 233 sprintf(buffer+length,"\tSub Operator= (value As Long)\n",parent->TypeName); 234 length+=lstrlen(buffer+length); 235 lstrcpy(buffer+length,"\t\tm_Value=value\n"); 236 length+=lstrlen(buffer+length); 237 lstrcpy(buffer+length,"\tEnd Sub\n"); 233 238 length+=lstrlen(buffer+length);*/ 234 235 sprintf(buffer+length,"\tSub Operator= (value As Long)\n",parent->TypeName);236 length+=lstrlen(buffer+length);237 lstrcpy(buffer+length,"\t\tm_Value=value\n");238 length+=lstrlen(buffer+length);239 lstrcpy(buffer+length,"\tEnd Sub\n");240 length+=lstrlen(buffer+length);241 242 sprintf(buffer+length,"\tFunction Operator== (ByRef e As %s) As Boolean\n",parent->TypeName);243 length+=lstrlen(buffer+length);244 lstrcpy(buffer+length,"\t\tReturn ( e.m_Value = m_Value )\n");245 length+=lstrlen(buffer+length);246 lstrcpy(buffer+length,"\tEnd Function\n");247 length+=lstrlen(buffer+length);248 239 249 240 lstrcpy(buffer+length,"End Class\n"); … … 258 249 } 259 250 251 // ログを生成 252 Smoothie::Logger::PutFile( "enum_generated.log", buffer ); 253 260 254 return buffer; 261 255 } -
BasicCompiler_Common/Intermediate_Step2.cpp
r78 r92 386 386 case ESC_CLASS: 387 387 KillStringSpaces(Command+2); 388 i2 = 2; 389 if( Command[i2] == 1 && Command[i2+1] == ESC_ENUM ){ 390 i2 += 2; 391 } 388 392 389 393 //コンストラクタ、デストラクタを暗黙的に生成 390 MakeConstructorAndDestructor(buffer,nowLine,Command +2);394 MakeConstructorAndDestructor(buffer,nowLine,Command + i2); 391 395 break; 392 396 case ESC_INTERFACE: -
BasicCompiler_Common/MakeExe.cpp
r91 r92 253 253 SetDlgItemText(hMainDlg,IDOK,STRING_CLOSE); 254 254 255 #ifdef _DEBUG 256 // デバッグモードのときはダイアログが隠れている 257 ShowWindow(hMainDlg,SW_SHOW); 258 #endif 259 255 260 //#include情報を解放 256 261 extern INCLUDEFILEINFO IncludeFileInfo; -
BasicCompiler_Common/Procedure.h
r91 r92 117 117 isAutoGeneration( false ), 118 118 isCompiled( false ), 119 pNextData( NULL ) 119 pNextData( NULL ), 120 beginOpAddress( 0 ), 121 endOpAddress( 0 ) 120 122 { 121 123 } -
BasicCompiler_Common/VarList.cpp
r85 r92 90 90 else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS); 91 91 } 92 else if(type.IsQWord()|| type.IsPointer()){92 else if(type.IsQWord()||(type.IsPointer()&&PTR_SIZE==sizeof(_int64))){ 93 93 if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&accessBytes)){ 94 94 _ui64toa(i64data,temporary,10); … … 100 100 } 101 101 else if(type.IsLong()){ 102 long l; 103 if(ReadProcessMemory(hDebugProcess,(void *)offset,&l,sizeof(long),&accessBytes)){ 104 sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,l,l); 105 } 106 else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS); 107 } 108 else if(type.IsDWord()||(type.IsPointer()&&PTR_SIZE==sizeof(long))){ 102 109 if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&accessBytes)){ 103 sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,i64data,i64data); 104 } 105 else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS); 106 } 107 else if(type.IsDWord()){ 108 if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&accessBytes)){ 109 sprintf(lptv->item.pszText,"%s %u(&H%X)",VarName,i64data,i64data); 110 sprintf(lptv->item.pszText,"%s %u(&H%X)",VarName,(int)i64data,(int)i64data); 110 111 } 111 112 else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS); -
BasicCompiler_Common/include/Smoothie.h
r91 r92 29 29 #endif 30 30 } 31 static void PutFile( const string &fileName, const string &buffer ){ 32 ofstream ofs( ( (string)BasicSystemDir + fileName ).c_str() ); 33 ofs << buffer << endl; 34 ofs.close(); 35 } 31 36 }; 32 37
Note:
See TracChangeset
for help on using the changeset viewer.