[206] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[455] | 3 | #include <shlwapi.h>
|
---|
| 4 |
|
---|
[308] | 5 | #include <jenga/include/common/Path.h>
|
---|
| 6 |
|
---|
[182] | 7 | #include <jenga/include/smoothie/Smoothie.h>
|
---|
| 8 |
|
---|
[167] | 9 | #include <Program.h>
|
---|
[266] | 10 | #include <Compiler.h>
|
---|
[312] | 11 | #include <ver.h>
|
---|
[165] | 12 |
|
---|
[14] | 13 | #include "BasicCompiler.h"
|
---|
[4] | 14 |
|
---|
| 15 | #if defined HeapAlloc
|
---|
| 16 | #define MEM_MAX 65536
|
---|
| 17 | LPVOID pCheckMem[MEM_MAX];
|
---|
| 18 | int now;
|
---|
| 19 | #undef HeapAlloc
|
---|
| 20 | #undef HeapReAlloc
|
---|
| 21 | LPVOID CheckHeapAlloc(HANDLE hf,DWORD dwFlags,DWORD dwBytes){
|
---|
| 22 | LPVOID ret;
|
---|
| 23 | ret=HeapAlloc(hf,dwFlags,dwBytes);
|
---|
| 24 | pCheckMem[now]=ret;
|
---|
| 25 |
|
---|
| 26 | //この部分にnowのチェックを挿入
|
---|
| 27 |
|
---|
| 28 | now++;
|
---|
| 29 | if(now>=MEM_MAX){
|
---|
| 30 | MessageBox(0,"pCheckMemの最大値を超えました","Check - BasicCompiler.exe",0);
|
---|
| 31 | }
|
---|
| 32 | return ret;
|
---|
| 33 | }
|
---|
| 34 | LPVOID CheckHeapReAlloc(HANDLE hf,DWORD dwFlags,LPVOID lpMem,DWORD dwBytes){
|
---|
| 35 | int i;
|
---|
| 36 | LPVOID ret;
|
---|
| 37 | for(i=0;;i++){
|
---|
| 38 | if(lpMem==pCheckMem[i]) break;
|
---|
| 39 | if(i>=MEM_MAX){
|
---|
| 40 | MessageBox(0,"エラー","Check - BasicCompiler.exe",0);
|
---|
| 41 | break;
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 | ret=HeapReAlloc(hf,dwFlags,lpMem,dwBytes);
|
---|
| 45 | pCheckMem[i]=ret;
|
---|
| 46 | return ret;
|
---|
| 47 | }
|
---|
| 48 | void HeapDefaultFree(LPVOID lpMem){
|
---|
| 49 | int i;
|
---|
| 50 | for(i=0;;i++){
|
---|
| 51 | if(lpMem==pCheckMem[i]) break;
|
---|
| 52 | if(i>=MEM_MAX||lpMem==0){
|
---|
| 53 | MessageBox(0,"エラー","Check - BasicCompiler.exe",0);
|
---|
| 54 | break;
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
| 57 | pCheckMem[i]=0;
|
---|
| 58 | HeapFree(hHeap,0,lpMem);
|
---|
| 59 | }
|
---|
| 60 | void CheckHeapCheck(){
|
---|
| 61 | int i,i2;
|
---|
| 62 | char temp[100];
|
---|
| 63 | temp[0]=0;
|
---|
| 64 | for(i=0,i2=0;i<MEM_MAX;i++){
|
---|
| 65 | if(pCheckMem[i]){
|
---|
| 66 | sprintf(temp+lstrlen(temp),"%d\r\n",i);
|
---|
| 67 | i2++;
|
---|
| 68 | if(i2==10){
|
---|
| 69 | lstrcat(temp,"これ以上の未解放が確認されています");
|
---|
| 70 | break;
|
---|
| 71 | }
|
---|
| 72 | }
|
---|
| 73 | }
|
---|
| 74 | if(temp[0]) MessageBox(0,temp,"Check - BasicCompiler.exe",0);
|
---|
| 75 | }
|
---|
| 76 | #define HeapAlloc CheckHeapAlloc
|
---|
| 77 | #define HeapReAlloc CheckHeapReAlloc
|
---|
| 78 | #else
|
---|
| 79 | void HeapDefaultFree(LPVOID lpMem){
|
---|
| 80 | HeapFree(hHeap,0,lpMem);
|
---|
| 81 | }
|
---|
| 82 | #endif
|
---|
| 83 |
|
---|
| 84 | void ts(int i){
|
---|
| 85 | char temporary[255];
|
---|
| 86 | sprintf(temporary,"0x%08x",i);
|
---|
| 87 | MessageBox(0,temporary,"TestMessage",0);
|
---|
| 88 | }
|
---|
| 89 | void ts(int i,int i2){
|
---|
| 90 | char temporary[255];
|
---|
| 91 | sprintf(temporary,"0x%08x\r\n0x%08x",i,i2);
|
---|
| 92 | MessageBox(0,temporary,"TestMessage",0);
|
---|
| 93 | }
|
---|
[322] | 94 | void ts(const char *msg){
|
---|
[378] | 95 | MessageBox(0,FormatEscapeSequenceStringToDefaultString(msg).c_str(),"TestMessage",0);
|
---|
[4] | 96 | }
|
---|
[322] | 97 | void ts(const char *msg,const char *title){
|
---|
[378] | 98 | MessageBox(0,FormatEscapeSequenceStringToDefaultString(msg).c_str(),title,0);
|
---|
[4] | 99 | }
|
---|
| 100 |
|
---|
| 101 | void epi_check(){
|
---|
| 102 | //この部分にobpのチェックを挿入
|
---|
| 103 | //※例 … epi=0x41999 → obp>=0x0999
|
---|
[276] | 104 | /*
|
---|
[4] | 105 | extern int obp;
|
---|
[232] | 106 | if(obp>=0x988DE){
|
---|
| 107 | int test=0;
|
---|
[276] | 108 | }*/
|
---|
[4] | 109 | }
|
---|
| 110 |
|
---|
| 111 | void GetRelationalPath(char *path,char *dir){
|
---|
| 112 | //相対パスを取得
|
---|
| 113 | int i,i2,i3,i4,i5;
|
---|
| 114 | char temporary[MAX_PATH],temp2[MAX_PATH],temp3[MAX_PATH],temp4[MAX_PATH];
|
---|
| 115 |
|
---|
| 116 | //ドライブ名をチェック
|
---|
| 117 | _splitpath(path,temporary,0,0,0);
|
---|
| 118 | _splitpath(dir,temp2,0,0,0);
|
---|
| 119 | if(lstrcmpi(temporary,temp2)!=0) return;
|
---|
| 120 |
|
---|
| 121 | _splitpath(path,0,temporary,0,0);
|
---|
| 122 | _splitpath(dir,0,temp2,0,0);
|
---|
| 123 | i=1;i2=1;
|
---|
| 124 | while(1){
|
---|
| 125 | i4=i;
|
---|
| 126 | if(temporary[i-1]=='\\'&&temporary[i]){ //path側
|
---|
| 127 | for(i3=0;;i++,i3++){
|
---|
| 128 | if(temporary[i]=='\\'){
|
---|
| 129 | temp3[i3]=0;
|
---|
| 130 | i++;
|
---|
| 131 | break;
|
---|
| 132 | }
|
---|
| 133 | temp3[i3]=temporary[i];
|
---|
| 134 | }
|
---|
| 135 | }
|
---|
| 136 | else temp3[0]=0;
|
---|
| 137 |
|
---|
| 138 | i5=i2;
|
---|
| 139 | if(temp2[i2-1]=='\\'&&temp2[i2]){ //dir側
|
---|
| 140 | for(i3=0;;i2++,i3++){
|
---|
| 141 | if(temp2[i2]=='\\'){
|
---|
| 142 | temp4[i3]=0;
|
---|
| 143 | i2++;
|
---|
| 144 | break;
|
---|
| 145 | }
|
---|
| 146 | temp4[i3]=temp2[i2];
|
---|
| 147 | }
|
---|
| 148 | }
|
---|
| 149 | else temp4[0]=0;
|
---|
| 150 |
|
---|
| 151 | if(temp3[0]=='\0'&&temp4[0]=='\0'){
|
---|
| 152 | lstrcpy(temp3,".\\");
|
---|
| 153 | break;
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | if(lstrcmpi(temp3,temp4)!=0){
|
---|
| 157 | for(i3=0;;i5++){
|
---|
| 158 | if(temp2[i5]=='\0') break;
|
---|
| 159 | if(temp2[i5]=='\\') i3++;
|
---|
| 160 | }
|
---|
| 161 | if(i3==0) lstrcpy(temp3,".\\");
|
---|
| 162 | else{
|
---|
| 163 | temp3[0]=0;
|
---|
| 164 | for(i2=0;i2<i3;i2++) lstrcat(temp3,"..\\");
|
---|
| 165 | }
|
---|
| 166 | lstrcat(temp3,temporary+i4);
|
---|
| 167 | break;
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 | _splitpath(path,0,0,temporary,temp2);
|
---|
| 171 | lstrcat(temp3,temporary);
|
---|
| 172 | lstrcat(temp3,temp2);
|
---|
| 173 | lstrcpy(path,temp3);
|
---|
| 174 | }
|
---|
[167] | 175 | void GetFullPath( char *path, const string &baseDirPath ){
|
---|
[4] | 176 | int i,i2,i3,i4;
|
---|
| 177 | char temporary[MAX_PATH];
|
---|
| 178 |
|
---|
[139] | 179 | // '/'→'\'
|
---|
| 180 | for( i=0;path[i];i++ ){
|
---|
| 181 | if( path[i] == '/' ){
|
---|
| 182 | path[i]='\\';
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
| 185 |
|
---|
[4] | 186 | if(strstr(path,":")||strstr(path,"\\\\")) return;
|
---|
| 187 |
|
---|
| 188 | i=0;i2=0;
|
---|
| 189 | while(1){
|
---|
| 190 | if(path[i]=='.'&&path[i+1]=='\\') i+=2;
|
---|
| 191 | if(path[i]=='.'&&path[i+1]=='.'&&path[i+2]=='\\'){
|
---|
| 192 | i2++;
|
---|
| 193 | i+=3;
|
---|
| 194 | }
|
---|
| 195 | else break;
|
---|
| 196 | }
|
---|
| 197 |
|
---|
[182] | 198 | i3=(int)baseDirPath.size();i4=0;
|
---|
[4] | 199 | while(i4<i2){
|
---|
| 200 | for(i3--;;i3--){
|
---|
[167] | 201 | if(baseDirPath[i3-1]=='\\'){
|
---|
[4] | 202 | i4++;
|
---|
| 203 | break;
|
---|
| 204 | }
|
---|
| 205 | }
|
---|
| 206 | }
|
---|
[167] | 207 | memcpy(temporary,baseDirPath.c_str(),i3);
|
---|
[4] | 208 | temporary[i3]=0;
|
---|
| 209 | lstrcat(temporary,path+i);
|
---|
| 210 | lstrcpy(path,temporary);
|
---|
| 211 | }
|
---|
[322] | 212 | std::string GetApplicationBaseFullPath( const std::string &relationalPath )
|
---|
| 213 | {
|
---|
| 214 | char fullPath[1024];
|
---|
| 215 | lstrcpy( fullPath, relationalPath.c_str() );
|
---|
| 216 | GetFullPath( fullPath, Jenga::Common::Environment::GetAppDir() );
|
---|
| 217 | return fullPath;
|
---|
| 218 | }
|
---|
[4] | 219 |
|
---|
[279] | 220 | void ShowErrorLine(int LineNum,const char *constFileName){
|
---|
[4] | 221 | HANDLE hFile;
|
---|
| 222 | DWORD dw;
|
---|
[279] | 223 | char FileName[MAX_PATH];
|
---|
[4] | 224 | char temporary[MAX_PATH];
|
---|
| 225 |
|
---|
[279] | 226 | lstrcpy( FileName, constFileName );
|
---|
| 227 |
|
---|
[4] | 228 | if(LineNum==-1) return;
|
---|
| 229 |
|
---|
| 230 | if(IsWindow(hOwnerEditor)){
|
---|
| 231 | if(FileName){
|
---|
| 232 |
|
---|
[279] | 233 | while( !IsFileExist( FileName ) ){
|
---|
[4] | 234 | char temp2[MAX_PATH],temp3[MAX_PATH];
|
---|
| 235 | _splitpath(FileName,NULL,NULL,temp2,temp3);
|
---|
| 236 | lstrcat(temp2,temp3);
|
---|
| 237 |
|
---|
| 238 | sprintf(temporary,"\"%s\" が見つかりません。格納されているディレクトリを指定してください。",temp2);
|
---|
| 239 | if(!GetFolder(hOwnerEditor,temp3,temporary)) return;
|
---|
| 240 |
|
---|
| 241 | if(temp3[lstrlen(temp3)-1]!='\\') lstrcat(temp3,"\\");
|
---|
| 242 |
|
---|
| 243 | sprintf(FileName,"%s%s",temp3,temp2);
|
---|
| 244 | }
|
---|
| 245 |
|
---|
[165] | 246 | hFile=CreateFile(
|
---|
| 247 | ( Jenga::Common::Environment::GetAppDir() + "\\pgm.tmp" ).c_str(),
|
---|
| 248 | GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_TEMPORARY,NULL);
|
---|
[4] | 249 | WriteFile(hFile,FileName,lstrlen(FileName),&dw,NULL);
|
---|
| 250 | CloseHandle(hFile);
|
---|
| 251 |
|
---|
| 252 | SendMessage(hOwnerEditor,WM_SHOWERROR,LineNum,0);
|
---|
| 253 | }
|
---|
| 254 | }
|
---|
| 255 | }
|
---|
| 256 |
|
---|
| 257 | BOOL GetFilePathDialog(HWND hwnd,char *filename,LPSTR Filter,LPSTR Title,BOOL bOpen){
|
---|
| 258 | OPENFILENAME ofstr;
|
---|
| 259 | filename[0]=0;
|
---|
| 260 | ofstr.lStructSize=sizeof(OPENFILENAME);
|
---|
| 261 | ofstr.hwndOwner=hwnd;
|
---|
| 262 | ofstr.hInstance=0;
|
---|
| 263 | ofstr.lpstrFilter=Filter;
|
---|
| 264 | ofstr.lpstrCustomFilter=NULL;
|
---|
| 265 | ofstr.nMaxCustFilter=0;
|
---|
| 266 | ofstr.nFilterIndex=1;
|
---|
| 267 | ofstr.lpstrFile=filename;
|
---|
| 268 | ofstr.nMaxFile=MAX_PATH;
|
---|
| 269 | ofstr.lpstrFileTitle=NULL;
|
---|
| 270 | ofstr.nMaxFileTitle=0;
|
---|
| 271 | ofstr.lpstrInitialDir=0;
|
---|
| 272 | ofstr.lpstrTitle=Title;
|
---|
| 273 | ofstr.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST;
|
---|
| 274 | ofstr.nFileOffset=0;
|
---|
| 275 | ofstr.nFileExtension=0;
|
---|
| 276 | ofstr.lpstrDefExt="*";
|
---|
| 277 | ofstr.lCustData=NULL;
|
---|
| 278 | ofstr.lpfnHook=NULL;
|
---|
| 279 | ofstr.lpTemplateName=NULL;
|
---|
| 280 | if(bOpen){
|
---|
| 281 | if(!GetOpenFileName(&ofstr)) return FALSE;
|
---|
| 282 | }
|
---|
| 283 | else{
|
---|
| 284 | if(!GetSaveFileName(&ofstr)) return FALSE;
|
---|
| 285 | }
|
---|
| 286 | return TRUE;
|
---|
| 287 | }
|
---|
| 288 |
|
---|
| 289 | LRESULT CALLBACK ErrorListProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
| 290 | int i,pos;
|
---|
| 291 | int StartPos,EndPos;
|
---|
| 292 |
|
---|
| 293 | switch(message){
|
---|
| 294 | case WM_CHAR:
|
---|
| 295 | if(GetKeyState(VK_CONTROL)&0x8000){
|
---|
| 296 | //アクセラレータキーの場合を考慮
|
---|
| 297 | break;
|
---|
| 298 | }
|
---|
| 299 | return 0;
|
---|
| 300 | case WM_LBUTTONDBLCLK:
|
---|
| 301 | SendMessage(hwnd,EM_GETSEL,(WPARAM)&pos,0);
|
---|
| 302 | i=(int)SendMessage(hwnd,EM_LINEFROMCHAR,pos,0);
|
---|
| 303 | ShowErrorLine(pErrorInfo[i].line,pErrorInfo[i].FileName);
|
---|
| 304 |
|
---|
| 305 | StartPos=(int)SendMessage(hwnd,EM_LINEINDEX,i,0);
|
---|
| 306 | EndPos=StartPos+(int)SendMessage(hwnd,EM_LINELENGTH,pos,0);
|
---|
| 307 | SendMessage(hwnd,EM_SETSEL,StartPos,EndPos);
|
---|
| 308 | return 0;
|
---|
| 309 | }
|
---|
| 310 | return CallWindowProc(OldErrorListProc,hwnd,message,wParam,lParam);
|
---|
| 311 | }
|
---|
| 312 | LRESULT CALLBACK DebugListProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
| 313 | switch(message){
|
---|
| 314 | case WM_CHAR:
|
---|
| 315 | if(GetKeyState(VK_CONTROL)&0x8000){
|
---|
| 316 | //アクセラレータキーの場合を考慮
|
---|
| 317 | break;
|
---|
| 318 | }
|
---|
| 319 | return 0;
|
---|
| 320 | }
|
---|
| 321 | return CallWindowProc(OldDebugListProc,hwnd,message,wParam,lParam);
|
---|
| 322 | }
|
---|
| 323 | void MakeMessageText(char *buffer,char *msg,int flag){
|
---|
| 324 | char temporary[MAX_PATH];
|
---|
| 325 | if(bClipCompileView){
|
---|
| 326 | //ProjectView埋め込みがたインターフェイスのとき
|
---|
| 327 |
|
---|
| 328 | //生成するファイルの相対パスを取得
|
---|
| 329 | lstrcpy(temporary,OutputFileName);
|
---|
| 330 | GetRelationalPath(temporary,BasicCurDir);
|
---|
| 331 |
|
---|
| 332 | //////////
|
---|
| 333 | // 合成
|
---|
| 334 |
|
---|
| 335 | #if defined(JPN)
|
---|
| 336 | //日本語
|
---|
| 337 | if(flag==0){
|
---|
[266] | 338 | if(compiler.IsDll())
|
---|
| 339 | {
|
---|
| 340 | sprintf(buffer,"DLLファイル \"%s\" [ %s ]",temporary,msg);
|
---|
| 341 | }
|
---|
[4] | 342 | else sprintf(buffer,"実行ファイル \"%s\" [ %s ]",temporary,msg);
|
---|
| 343 | }
|
---|
| 344 | if(flag==1) sprintf(buffer,"\"%s\" を生成しています [ %s ]",temporary,msg);
|
---|
| 345 | if(flag==2) lstrcpy(buffer,msg);
|
---|
| 346 | #else
|
---|
| 347 | //英語
|
---|
| 348 | if(flag==0){
|
---|
[266] | 349 | if(compiler.IsDll()) sprintf(buffer,"DLL file \"%s\" [ %s ]",temporary,msg);
|
---|
[4] | 350 | else sprintf(buffer,"Execution file \"%s\" [ %s ]",temporary,msg);
|
---|
| 351 | }
|
---|
| 352 | if(flag==1) sprintf(buffer,"Creating \"%s\" [ %s ]",temporary,msg);
|
---|
| 353 | if(flag==2) lstrcpy(buffer,msg);
|
---|
| 354 | #endif
|
---|
| 355 | }
|
---|
| 356 | else{
|
---|
| 357 | //通常ダイアログのとき
|
---|
| 358 | lstrcpy(buffer,msg);
|
---|
| 359 | }
|
---|
| 360 | }
|
---|
| 361 |
|
---|
| 362 | void SetPosCenter(HWND hwnd){
|
---|
| 363 | RECT OwnerRect,rect;
|
---|
| 364 | int x,y;
|
---|
| 365 |
|
---|
| 366 | if(IsWindow(hOwnerEditor)) GetWindowRect(hOwnerEditor,&OwnerRect);
|
---|
| 367 | else{
|
---|
| 368 | OwnerRect.left=0;
|
---|
| 369 | OwnerRect.top=0;
|
---|
| 370 | OwnerRect.right=ScreenX;
|
---|
| 371 | OwnerRect.bottom=ScreenY;
|
---|
| 372 | }
|
---|
| 373 | GetWindowRect(hwnd,&rect);
|
---|
| 374 |
|
---|
| 375 | x=((OwnerRect.right-OwnerRect.left)-(rect.right-rect.left))/2+OwnerRect.left;
|
---|
| 376 | y=((OwnerRect.bottom-OwnerRect.top)-(rect.bottom-rect.top))/2+OwnerRect.top;
|
---|
| 377 | SetWindowPos(hwnd,0,x,y,0,0,SWP_NOSIZE);
|
---|
| 378 | }
|
---|
| 379 | BOOL CALLBACK DlgCompile(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
| 380 | extern HANDLE hDebugProcess;
|
---|
| 381 | char temporary[MAX_PATH];
|
---|
| 382 | DWORD dw;
|
---|
| 383 | RECT rect;
|
---|
| 384 | POINT pos;
|
---|
| 385 | SIZE size;
|
---|
| 386 | static POINT pos_List,pos_Progress;
|
---|
[5] | 387 | static int height_Progress;
|
---|
[4] | 388 |
|
---|
| 389 | switch(message){
|
---|
| 390 | case WM_INITDIALOG:
|
---|
| 391 | pos=pobj_nv->MainDlgPos;
|
---|
| 392 | GetWindowRect(hwnd,&rect);
|
---|
| 393 | size.cx=rect.right-rect.left;
|
---|
| 394 | size.cy=rect.bottom-rect.top;
|
---|
| 395 | MoveWindow(hwnd,pos.x,pos.y,size.cx,size.cy,1);
|
---|
| 396 |
|
---|
| 397 | lstrcpy(temporary,OutputFileName);
|
---|
| 398 | GetRelationalPath(temporary,BasicCurDir);
|
---|
| 399 | SetDlgItemText(hwnd,IDC_EXEPATH,temporary);
|
---|
| 400 |
|
---|
| 401 | //"エラー無し"
|
---|
| 402 | SetDlgItemText(hwnd,IDC_ERRORLIST,STRING_NOERROR);
|
---|
| 403 |
|
---|
| 404 | //"デバッグ情報無し"
|
---|
| 405 | SetDlgItemText(hwnd,IDC_DEBUGLIST,STRING_NODEBUGMSG);
|
---|
| 406 |
|
---|
| 407 | //リストボックスの初期位置
|
---|
| 408 | GetWindowRect(GetDlgItem(hwnd,IDC_ERRORLIST),&rect);
|
---|
| 409 | pos_List.x=rect.left;
|
---|
| 410 | pos_List.y=rect.top;
|
---|
| 411 | ScreenToClient(hwnd,&pos_List);
|
---|
| 412 |
|
---|
| 413 | //プログレスバーの初期位置と高さ
|
---|
| 414 | GetWindowRect(GetDlgItem(hwnd,IDC_PROGRESS),&rect);
|
---|
| 415 | pos_Progress.x=rect.left;
|
---|
| 416 | pos_Progress.y=rect.top;
|
---|
| 417 | ScreenToClient(hwnd,&pos_Progress);
|
---|
| 418 | height_Progress=rect.bottom-rect.top;
|
---|
| 419 |
|
---|
| 420 | //バージョン表記
|
---|
| 421 | sprintf(temporary,"Version %d.%02d.%02d %s",MAJOR_VER,MINOR_VER,REVISION_VER,VER_INFO);
|
---|
| 422 | SetDlgItemText(hwnd,IDC_STATIC_VERSION,temporary);
|
---|
| 423 |
|
---|
| 424 | break;
|
---|
| 425 | case WM_COMMAND:
|
---|
| 426 | switch(LOWORD(wParam)){
|
---|
| 427 | case IDOK:
|
---|
| 428 | GetDlgItemText(hwnd,IDOK,temporary,MAX_PATH);
|
---|
| 429 |
|
---|
| 430 | //STRING_COMPILE = "コンパイル"
|
---|
| 431 | if(lstrcmp(temporary,STRING_COMPILE)==0){
|
---|
| 432 | GetDlgItemText(hwnd,IDC_EXEPATH,OutputFileName,MAX_PATH);
|
---|
| 433 | GetFullPath(OutputFileName,BasicCurDir);
|
---|
| 434 | CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)MainThread,0,0,&dw);
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 | //STRING_STOP = "中断"
|
---|
| 438 | else if(lstrcmp(temporary,STRING_STOP)==0){
|
---|
| 439 | if(hDebugProcess){
|
---|
| 440 | //デバッグ中のとき
|
---|
| 441 |
|
---|
| 442 | //プロセスを終了
|
---|
| 443 | TerminateProcess(hDebugProcess,0);
|
---|
| 444 | hDebugProcess=0;
|
---|
| 445 |
|
---|
| 446 | //デバッグダイアログを終了
|
---|
| 447 | if(hDebugWnd){
|
---|
| 448 | DestroyWindow(hDebugWnd);
|
---|
| 449 | }
|
---|
| 450 | }
|
---|
| 451 | else{
|
---|
| 452 | //コンパイル中のとき
|
---|
| 453 | bStopCompile=1;
|
---|
| 454 |
|
---|
| 455 | /* メインスレッドで「閉じる」ボタンに変更することで、
|
---|
| 456 | コンパイルを中断中の早いタイミングでも終了することが可能 */
|
---|
| 457 | //"閉じる"
|
---|
| 458 | SetDlgItemText(hwnd,IDOK,STRING_CLOSE);
|
---|
| 459 | }
|
---|
| 460 | }
|
---|
| 461 |
|
---|
| 462 | else{
|
---|
| 463 | SetFocus(hOwnerEditor);
|
---|
| 464 | DestroyWindow(hwnd);
|
---|
| 465 | }
|
---|
| 466 | return 1;
|
---|
| 467 | case IDCANCEL:
|
---|
| 468 | //×ボタン用
|
---|
| 469 |
|
---|
| 470 | if(hDebugProcess){
|
---|
| 471 | //デバッグ中のとき
|
---|
| 472 |
|
---|
| 473 | //プロセスを終了
|
---|
| 474 | TerminateProcess(hDebugProcess,0);
|
---|
| 475 | hDebugProcess=0;
|
---|
| 476 |
|
---|
| 477 | //デバッグダイアログを終了
|
---|
| 478 | if(hDebugWnd){
|
---|
| 479 | DestroyWindow(hDebugWnd);
|
---|
| 480 | }
|
---|
| 481 | }
|
---|
| 482 |
|
---|
| 483 | SetFocus(hOwnerEditor);
|
---|
| 484 | DestroyWindow(hwnd);
|
---|
| 485 | return 1;
|
---|
| 486 | case IDC_SHOWERROR:
|
---|
| 487 | ShowWindow(GetDlgItem(hwnd,IDC_ERRORLIST),SW_SHOW);
|
---|
| 488 | ShowWindow(GetDlgItem(hwnd,IDC_DEBUGLIST),SW_HIDE);
|
---|
| 489 | return 1;
|
---|
| 490 | case IDC_SHOWDEBUG:
|
---|
| 491 | ShowWindow(GetDlgItem(hwnd,IDC_ERRORLIST),SW_HIDE);
|
---|
| 492 | ShowWindow(GetDlgItem(hwnd,IDC_DEBUGLIST),SW_SHOW);
|
---|
| 493 | return 1;
|
---|
| 494 | }
|
---|
| 495 | break;
|
---|
| 496 | case WM_SHOWVARLIST:
|
---|
| 497 | if(bClipCompileView){
|
---|
| 498 | //埋め込み表示
|
---|
| 499 | CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_DEBUGGER),hOwnerEditor,(DLGPROC)DlgDebugger,lParam);
|
---|
| 500 | ShowWindow(hDebugWnd,SW_SHOW);
|
---|
| 501 |
|
---|
| 502 | SendMessage(hOwnerEditor,WM_SETDEBUGGERVIEW,0,(LPARAM)hDebugWnd);
|
---|
| 503 | }
|
---|
| 504 | else{
|
---|
| 505 | //ポップアップ表示
|
---|
| 506 | CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_VARLIST),hOwnerEditor,(DLGPROC)DlgVarList,lParam);
|
---|
| 507 | SetForegroundWindow(hDebugWnd);
|
---|
| 508 | }
|
---|
| 509 | return 1;
|
---|
| 510 | case WM_SIZE:
|
---|
| 511 | if(bClipCompileView){
|
---|
| 512 | //エラーリストの位置
|
---|
| 513 | MoveWindow(GetDlgItem(hwnd,IDC_ERRORLIST),
|
---|
| 514 | pos_List.x,
|
---|
| 515 | pos_List.y,
|
---|
| 516 | LOWORD(lParam)-pos_List.x,
|
---|
| 517 | HIWORD(lParam)-pos_List.y,
|
---|
| 518 | 1);
|
---|
| 519 |
|
---|
| 520 | //デバッグリストの位置
|
---|
| 521 | MoveWindow(GetDlgItem(hwnd,IDC_DEBUGLIST),
|
---|
| 522 | pos_List.x,
|
---|
| 523 | pos_List.y,
|
---|
| 524 | LOWORD(lParam)-pos_List.x,
|
---|
| 525 | HIWORD(lParam)-pos_List.y,
|
---|
| 526 | 1);
|
---|
| 527 |
|
---|
| 528 | //プログレスバーの位置
|
---|
| 529 | MoveWindow(GetDlgItem(hwnd,IDC_PROGRESS),
|
---|
| 530 | pos_Progress.x,
|
---|
| 531 | pos_Progress.y,
|
---|
| 532 | LOWORD(lParam)-pos_Progress.x,
|
---|
| 533 | height_Progress,
|
---|
| 534 | 1);
|
---|
| 535 | }
|
---|
| 536 | return 1;
|
---|
| 537 | case WM_DESTROY:
|
---|
| 538 | GetWindowRect(hwnd,&rect);
|
---|
| 539 |
|
---|
| 540 | if(!bClipCompileView){
|
---|
| 541 | pobj_nv->MainDlgPos.x=rect.left;
|
---|
| 542 | pobj_nv->MainDlgPos.y=rect.top;
|
---|
| 543 | }
|
---|
| 544 |
|
---|
| 545 | PostQuitMessage(0);
|
---|
| 546 | return 1;
|
---|
| 547 |
|
---|
| 548 |
|
---|
| 549 |
|
---|
| 550 | ///////////////////////
|
---|
| 551 | // デバッグコマンド
|
---|
| 552 | ///////////////////////
|
---|
| 553 |
|
---|
| 554 | case WM_DEBUG_STOP:
|
---|
| 555 | Debugger_Stop();
|
---|
| 556 | return 1;
|
---|
| 557 | case WM_DEBUG_PAUSE:
|
---|
| 558 | Debugger_Pause();
|
---|
| 559 | return 1;
|
---|
| 560 |
|
---|
| 561 |
|
---|
| 562 | case WM_CLOSE_DEBUGGER:
|
---|
| 563 | if(hDebugWnd){
|
---|
| 564 | DestroyWindow(hDebugWnd);
|
---|
| 565 | }
|
---|
| 566 | return 1;
|
---|
| 567 | }
|
---|
| 568 | return 0;
|
---|
| 569 | }
|
---|
| 570 |
|
---|
[206] | 571 | void _Test()
|
---|
| 572 | {
|
---|
| 573 | Jenga::Common::LoggerSetting loggerSetting;
|
---|
[212] | 574 | bool result = loggerSetting.WriteXml( Jenga::Common::Environment::GetAppDir() + "\\logger.setting.xml" );
|
---|
[206] | 575 | }
|
---|
| 576 |
|
---|
[455] | 577 | int main()
|
---|
| 578 | {
|
---|
[4] | 579 | int i,i2;
|
---|
| 580 | char temporary[1024],temp2[MAX_PATH];
|
---|
| 581 |
|
---|
[455] | 582 | hInst = GetModuleHandle( NULL );
|
---|
| 583 | LPSTR lpCmdLine = PathGetArgs( GetCommandLine() );
|
---|
| 584 |
|
---|
[206] | 585 | //_Test();
|
---|
| 586 |
|
---|
[269] | 587 | //MessageBox(0,"starting compiler/debugger","ActiveBasic",MB_OK);
|
---|
[140] | 588 | trace( "Start ActiveBasic Compiler!" );
|
---|
[78] | 589 |
|
---|
[4] | 590 | //コモンコントロールを初期化
|
---|
| 591 | InitCommonControls();
|
---|
| 592 |
|
---|
| 593 | hHeap=GetProcessHeap();
|
---|
| 594 | ScreenX=GetSystemMetrics(SM_CXSCREEN);
|
---|
| 595 | ScreenY=GetSystemMetrics(SM_CYSCREEN);
|
---|
| 596 |
|
---|
| 597 | //不揮発性データを取得
|
---|
| 598 | pobj_nv=new CNonVolatile;
|
---|
| 599 | pobj_nv->load();
|
---|
| 600 |
|
---|
| 601 | //ソースファイル名を取得
|
---|
| 602 | i=0;
|
---|
| 603 | if(lpCmdLine[0]!='/'){
|
---|
| 604 | if(lpCmdLine[0]=='\"'){
|
---|
| 605 | for(i=1,i2=0;;i++,i2++){
|
---|
| 606 | if(lpCmdLine[i]=='\"'){
|
---|
| 607 | SourceFileName[i2]=0;
|
---|
| 608 | break;
|
---|
| 609 | }
|
---|
| 610 | SourceFileName[i2]=lpCmdLine[i];
|
---|
| 611 | if(lpCmdLine[i]=='\0') break;
|
---|
| 612 | }
|
---|
| 613 | i++;
|
---|
| 614 | while(lpCmdLine[i]==' ') i++;
|
---|
| 615 | }
|
---|
| 616 | else{
|
---|
| 617 | for(i=0;;i++){
|
---|
| 618 | if(lpCmdLine[i]==' '){
|
---|
| 619 | SourceFileName[i]=0;
|
---|
| 620 | break;
|
---|
| 621 | }
|
---|
| 622 | SourceFileName[i]=lpCmdLine[i];
|
---|
| 623 | if(lpCmdLine[i]=='\0') break;
|
---|
| 624 | }
|
---|
| 625 | while(lpCmdLine[i]==' ') i++;
|
---|
| 626 | }
|
---|
| 627 | }
|
---|
| 628 |
|
---|
| 629 | BOOL bFromEditor=0;
|
---|
| 630 | OutputFileName[0]=0;
|
---|
| 631 | if(lpCmdLine[i]&&lpCmdLine[i]!='/'){
|
---|
| 632 | if(lpCmdLine[i]=='\"'){
|
---|
| 633 | for(i++,i2=0;;i++,i2++){
|
---|
| 634 | if(lpCmdLine[i]=='\"'){
|
---|
| 635 | OutputFileName[i2]=0;
|
---|
| 636 | break;
|
---|
| 637 | }
|
---|
| 638 | OutputFileName[i2]=lpCmdLine[i];
|
---|
| 639 | if(lpCmdLine[i]=='\0') break;
|
---|
| 640 | }
|
---|
| 641 | i++;
|
---|
| 642 | while(lpCmdLine[i]==' ') i++;
|
---|
| 643 | }
|
---|
| 644 | else{
|
---|
| 645 | for(i2=0;;i++,i2++){
|
---|
| 646 | if(lpCmdLine[i]==' '){
|
---|
| 647 | OutputFileName[i2]=0;
|
---|
| 648 | break;
|
---|
| 649 | }
|
---|
| 650 | OutputFileName[i2]=lpCmdLine[i];
|
---|
| 651 | if(lpCmdLine[i]=='\0') break;
|
---|
| 652 | }
|
---|
| 653 | while(lpCmdLine[i]==' ') i++;
|
---|
| 654 | }
|
---|
| 655 | }
|
---|
| 656 |
|
---|
| 657 | KillSpaces(lpCmdLine+i,temporary);
|
---|
| 658 | i=0;
|
---|
| 659 | while(temporary[i]=='/'){
|
---|
| 660 | for(i++,i2=0;;i++,i2++){
|
---|
| 661 | if(temporary[i]=='/'){
|
---|
| 662 | temp2[i2]=0;
|
---|
| 663 | break;
|
---|
| 664 | }
|
---|
| 665 | if(temporary[i]==':'){
|
---|
| 666 | temp2[i2]=0;
|
---|
| 667 | break;
|
---|
| 668 | }
|
---|
| 669 | temp2[i2]=temporary[i];
|
---|
| 670 | if(temporary[i]=='\0') break;
|
---|
| 671 | }
|
---|
| 672 |
|
---|
| 673 | char temp3[MAX_PATH];
|
---|
| 674 | if(temporary[i]==':'){
|
---|
| 675 | i++;
|
---|
| 676 | if(temporary[i]=='\"'){
|
---|
| 677 | for(i++,i2=0;;i++,i2++){
|
---|
| 678 | if(temporary[i]=='\"'){
|
---|
| 679 | temp3[i2]=0;
|
---|
| 680 | RemoveStringQuotes(temp3);
|
---|
| 681 | i++;
|
---|
| 682 | break;
|
---|
| 683 | }
|
---|
| 684 | temp3[i2]=temporary[i];
|
---|
| 685 | if(temporary[i]=='\0') break;
|
---|
| 686 | }
|
---|
| 687 | }
|
---|
| 688 | else{
|
---|
| 689 | for(i2=0;;i++,i2++){
|
---|
| 690 | if(temporary[i]=='/'){
|
---|
| 691 | temp3[i2]=0;
|
---|
| 692 | break;
|
---|
| 693 | }
|
---|
| 694 | if(temporary[i]==':'){
|
---|
| 695 | temp3[i2]=0;
|
---|
| 696 | break;
|
---|
| 697 | }
|
---|
| 698 | temp3[i2]=temporary[i];
|
---|
| 699 | if(temporary[i]=='\0') break;
|
---|
| 700 | }
|
---|
| 701 | }
|
---|
| 702 | }
|
---|
| 703 | else temp3[0]=0;
|
---|
| 704 |
|
---|
| 705 |
|
---|
| 706 | /////////////////////////
|
---|
| 707 | // コマンドラインを調査
|
---|
| 708 | /////////////////////////
|
---|
| 709 |
|
---|
| 710 | //ウィンドウハンドル
|
---|
| 711 | if(lstrcmp(temp2,"wnd")==0){
|
---|
| 712 | bFromEditor=1;
|
---|
| 713 |
|
---|
| 714 | if(temp3[0]) sscanf(temp3,"%08x",&hOwnerEditor);
|
---|
| 715 | }
|
---|
| 716 |
|
---|
| 717 | //デバッグコンパイル
|
---|
| 718 | else if(lstrcmp(temp2,"debug")==0) bDebugCompile=1;
|
---|
| 719 |
|
---|
| 720 | //デバッグ実行
|
---|
| 721 | else if(lstrcmp(temp2,"run")==0) bDebugRun=1;
|
---|
| 722 |
|
---|
| 723 | //デバッグ実行(アタッチする)
|
---|
| 724 | else if(lstrcmp(temp2,"attach")==0){
|
---|
| 725 | bDebugRun=1;
|
---|
| 726 | bAttach=1;
|
---|
| 727 |
|
---|
| 728 | if(temp3[0]) sscanf(temp3,"%08x",&dwAttachProcessId);
|
---|
| 729 | }
|
---|
| 730 |
|
---|
| 731 | //DLL生成
|
---|
[266] | 732 | else if(lstrcmp(temp2,"dll")==0)
|
---|
| 733 | {
|
---|
| 734 | compiler.SetTargetModuleType( Compiler::Dll );
|
---|
| 735 | }
|
---|
[4] | 736 |
|
---|
[266] | 737 | // StaticLibrary生成
|
---|
| 738 | else if( lstrcmp( temp2, "static_library" ) ==0 )
|
---|
| 739 | {
|
---|
| 740 | compiler.SetTargetModuleType( Compiler::StaticLibrary );
|
---|
| 741 | }
|
---|
| 742 |
|
---|
[55] | 743 | //Unicode
|
---|
[69] | 744 | else if( lstrcmp( temp2, "unicode" ) ==0 ){
|
---|
[182] | 745 | Smoothie::SetUnicodeMark( true );
|
---|
[69] | 746 | typeOfPtrChar = MAKE_PTR_TYPE(DEF_WORD,1);
|
---|
[97] | 747 | typeOfPtrUChar = MAKE_PTR_TYPE(DEF_WORD,1);
|
---|
[69] | 748 | }
|
---|
[55] | 749 |
|
---|
[4] | 750 | //埋め込み型コンパイラビュー
|
---|
| 751 | else if(lstrcmp(temp2,"clip_compile_view")==0) bClipCompileView=1;
|
---|
| 752 |
|
---|
| 753 | //インクルードディレクトリ
|
---|
| 754 | else if(lstrcmp(temp2,"include_dir")==0){
|
---|
| 755 | lstrcpy(szIncludeDir,temp3);
|
---|
| 756 | }
|
---|
| 757 | }
|
---|
| 758 |
|
---|
| 759 | //ソースファイル名が与えられなかったとき
|
---|
| 760 | if(SourceFileName[0]=='\0'){
|
---|
| 761 | if(!GetFilePathDialog(0,SourceFileName,BasicFileFilter,"コンパイルするファイルを指定して下さい",1))
|
---|
| 762 | return 0;
|
---|
| 763 | }
|
---|
| 764 |
|
---|
| 765 | //出力ファイル名が与えられなかったとき
|
---|
| 766 | if(OutputFileName[0]=='\0'){
|
---|
| 767 | _splitpath(SourceFileName,OutputFileName,temporary,temp2,0);
|
---|
| 768 | lstrcat(OutputFileName,temporary);
|
---|
| 769 | lstrcat(OutputFileName,temp2);
|
---|
[269] | 770 | if( compiler.IsStaticLibrary() )
|
---|
| 771 | {
|
---|
| 772 | if(bDebugCompile||bDebugRun)
|
---|
| 773 | {
|
---|
| 774 | lstrcat(OutputFileName,"_debug.abobj");
|
---|
| 775 | }
|
---|
| 776 | else
|
---|
| 777 | {
|
---|
| 778 | lstrcat(OutputFileName,".abobj");
|
---|
| 779 | }
|
---|
| 780 | }
|
---|
| 781 | else
|
---|
| 782 | {
|
---|
| 783 | if(bDebugCompile||bDebugRun)
|
---|
| 784 | {
|
---|
| 785 | lstrcat(OutputFileName,"_debug.exe");
|
---|
| 786 | }
|
---|
| 787 | else
|
---|
| 788 | {
|
---|
| 789 | lstrcat(OutputFileName,".exe");
|
---|
| 790 | }
|
---|
| 791 | }
|
---|
[4] | 792 | }
|
---|
| 793 |
|
---|
[294] | 794 | {
|
---|
| 795 | // カレントディレクトリを取得
|
---|
[302] | 796 | std::string baseDirPath = Jenga::Common::Environment::GetAppDir()+"\\";
|
---|
[294] | 797 |
|
---|
| 798 | // インクルードディレクトリが指定されなかったとき
|
---|
| 799 | if(szIncludeDir[0]=='\0'){
|
---|
| 800 | lstrcpy(szIncludeDir,".\\Include\\");
|
---|
| 801 |
|
---|
| 802 | // インクルードディレクトリを絶対パスに変更
|
---|
[302] | 803 | GetFullPath(szIncludeDir,baseDirPath.c_str());
|
---|
[294] | 804 | }
|
---|
| 805 | else
|
---|
| 806 | {
|
---|
| 807 | // インクルードディレクトリを絶対パスに変更
|
---|
[302] | 808 | GetFullPath(szIncludeDir,baseDirPath.c_str());
|
---|
[294] | 809 | }
|
---|
| 810 |
|
---|
| 811 | // ソースファイル名を絶対パスに変換
|
---|
[302] | 812 | GetFullPath(SourceFileName,baseDirPath.c_str());
|
---|
[294] | 813 |
|
---|
| 814 | // 出力ファイル名を絶対パスに変換
|
---|
[302] | 815 | GetFullPath(OutputFileName,baseDirPath.c_str());
|
---|
[308] | 816 |
|
---|
| 817 | // モジュール名をセット
|
---|
| 818 | compiler.SetModuleName( Jenga::Common::Path( OutputFileName ).GetFileName() );
|
---|
[4] | 819 | }
|
---|
| 820 |
|
---|
[266] | 821 | if( compiler.IsDll() ){
|
---|
[4] | 822 | //DLLファイル名を取得
|
---|
| 823 | _splitpath(OutputFileName,NULL,NULL,szDllName,temporary);
|
---|
| 824 | lstrcat(szDllName,temporary);
|
---|
| 825 | }
|
---|
| 826 |
|
---|
| 827 | if(bDebugRun){
|
---|
| 828 | //コマンドライン、DLLの実行可能アプリケーションを取得
|
---|
| 829 | HANDLE hFile;
|
---|
| 830 | DWORD dwAccessBytes;
|
---|
[165] | 831 | hFile=CreateFile(
|
---|
| 832 | ( Jenga::Common::Environment::GetAppDir() + "\\pgm.tmp" ).c_str(),
|
---|
| 833 | GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
---|
[4] | 834 | if(hFile!=INVALID_HANDLE_VALUE){
|
---|
| 835 | ReadFile(hFile,temporary,MAX_PATH,&dwAccessBytes,NULL);
|
---|
| 836 | CloseHandle(hFile);
|
---|
| 837 | temporary[dwAccessBytes]=0;
|
---|
| 838 | }
|
---|
| 839 | else temporary[0]=0;
|
---|
| 840 |
|
---|
| 841 | for(i=0;;i++){
|
---|
| 842 | if(temporary[i]=='\r'&&temporary[i+1]=='\n'||temporary[i]=='\0'){
|
---|
| 843 | szDebugExeForDll[i]=0;
|
---|
| 844 | break;
|
---|
| 845 | }
|
---|
| 846 | szDebugExeForDll[i]=temporary[i];
|
---|
| 847 | }
|
---|
| 848 | if(temporary[i]){
|
---|
| 849 | lstrcpy(szDebugCmdLine,temporary+i+2);
|
---|
| 850 | }
|
---|
| 851 | }
|
---|
| 852 |
|
---|
| 853 | _splitpath(SourceFileName,BasicCurDir,temporary,NULL,NULL);
|
---|
| 854 | lstrcat(BasicCurDir,temporary);
|
---|
| 855 |
|
---|
| 856 | //エラーリスト情報を初期化
|
---|
| 857 | pErrorInfo=(ERRORINFO *)HeapAlloc(hHeap,0,1);
|
---|
| 858 | ErrorNum=0;
|
---|
| 859 | CompileMsgNum=0;
|
---|
| 860 | WarningNum=0;
|
---|
| 861 | bError=0;
|
---|
| 862 |
|
---|
| 863 | if(bClipCompileView){
|
---|
| 864 | //ProjectEditor埋め込み型インターフェイス
|
---|
| 865 | hMainDlg=CreateDialog(hInst,MAKEINTRESOURCE(IDD_CLIPMAIN),hOwnerEditor,(DLGPROC)DlgCompile);
|
---|
| 866 | ShowWindow(hMainDlg,SW_SHOW);
|
---|
| 867 | SendMessage(hOwnerEditor,WM_SETCOMPILEVIEW,0,(LPARAM)hMainDlg);
|
---|
| 868 |
|
---|
| 869 | //プログレスバーの色をセットする
|
---|
| 870 | PostMessage(GetDlgItem(hMainDlg,IDC_PROGRESS),PBM_SETBARCOLOR,0,RGB(255,220,192));
|
---|
| 871 | PostMessage(GetDlgItem(hMainDlg,IDC_PROGRESS),PBM_SETBKCOLOR,0,RGB(255,255,255));
|
---|
| 872 | }
|
---|
| 873 | else{
|
---|
| 874 | //通常ダイアログインターフェイス
|
---|
| 875 | hMainDlg=CreateDialog(hInst,MAKEINTRESOURCE(IDD_MAIN),hOwnerEditor,(DLGPROC)DlgCompile);
|
---|
[92] | 876 |
|
---|
| 877 | #ifdef _DEBUG
|
---|
| 878 | // VC++によるデバッグの場合は画面を出さない
|
---|
| 879 | // ※別スレッドのウィンドウ ループとの不整合性がデッドロックを生む場合がある(特にステップ実行時など)
|
---|
| 880 | PostMessage( hMainDlg, WM_COMMAND, IDOK, 0 );
|
---|
| 881 | #else
|
---|
[4] | 882 | ShowWindow(hMainDlg,SW_SHOW);
|
---|
[92] | 883 | #endif
|
---|
[4] | 884 | }
|
---|
| 885 | SendDlgItemMessage(hMainDlg,IDC_SHOWERROR,BM_SETCHECK,BST_CHECKED,0);
|
---|
| 886 |
|
---|
| 887 | //エラーリストをサブクラス化
|
---|
| 888 | OldErrorListProc=(WNDPROC)GetWindowLongPtr(GetDlgItem(hMainDlg,IDC_ERRORLIST),GWLP_WNDPROC);
|
---|
| 889 | SetWindowLongPtr(GetDlgItem(hMainDlg,IDC_ERRORLIST),GWLP_WNDPROC,(LONG_PTR)ErrorListProc);
|
---|
| 890 |
|
---|
| 891 | //デバッグリストをサブクラス化
|
---|
| 892 | OldDebugListProc=(WNDPROC)GetWindowLongPtr(GetDlgItem(hMainDlg,IDC_DEBUGLIST),GWLP_WNDPROC);
|
---|
| 893 | SetWindowLongPtr(GetDlgItem(hMainDlg,IDC_DEBUGLIST),GWLP_WNDPROC,(LONG_PTR)DebugListProc);
|
---|
| 894 |
|
---|
| 895 | if(bFromEditor) SendMessage(hMainDlg,WM_COMMAND,IDOK,0);
|
---|
| 896 |
|
---|
| 897 | MSG msg;
|
---|
| 898 | while(GetMessage(&msg,0,0,0)){
|
---|
| 899 | if(IsDialogMessage(hMainDlg,&msg)) continue;
|
---|
| 900 | TranslateMessage(&msg);
|
---|
| 901 | DispatchMessage(&msg);
|
---|
| 902 | }
|
---|
| 903 |
|
---|
| 904 | //エラーリスト情報を解放
|
---|
| 905 | for(i=0;i<ErrorNum;i++){
|
---|
| 906 | if(pErrorInfo[i].FileName) HeapDefaultFree(pErrorInfo[i].FileName);
|
---|
| 907 | }
|
---|
| 908 | HeapDefaultFree(pErrorInfo);
|
---|
| 909 |
|
---|
| 910 | //不揮発性データを保存
|
---|
| 911 | pobj_nv->save();
|
---|
| 912 | delete pobj_nv;
|
---|
| 913 | pobj_nv=0;
|
---|
| 914 |
|
---|
| 915 | #if defined HeapAlloc
|
---|
| 916 | CheckHeapCheck();
|
---|
| 917 | #endif
|
---|
| 918 |
|
---|
| 919 | if(bClipCompileView){
|
---|
| 920 | SendMessage(hOwnerEditor,WM_DESTROYCOMPILEVIEW,0,0);
|
---|
| 921 | }
|
---|
| 922 |
|
---|
[140] | 923 | trace("Complete ActiveBasic Compiler!");
|
---|
[4] | 924 |
|
---|
[455] | 925 | ExitProcess( 0 );
|
---|
[140] | 926 |
|
---|
[4] | 927 | return 0;
|
---|
| 928 | }
|
---|