source: dev/trunk/abdev/BasicCompiler_Common/Compile.cpp@ 245

Last change on this file since 245 was 241, checked in by dai_9181, 17 years ago
File size: 17.5 KB
RevLine 
[206]1#include "stdafx.h"
2
[182]3#include <jenga/include/smoothie/Smoothie.h>
4#include <jenga/include/smoothie/LexicalAnalysis.h>
5#include <jenga/include/smoothie/SmoothieException.h>
6
7#include <LexicalScopingImpl.h>
8#include <CodeGenerator.h>
[193]9#include <Compiler.h>
[195]10#include <NamespaceSupporter.h>
[182]11
[4]12#include "../BasicCompiler_Common/common.h"
13
14#ifdef _AMD64_
15#include "../BasicCompiler64/opcode.h"
16#else
[5]17#include "../BasicCompiler32/opcode.h"
[4]18#endif
19
[182]20#include <Exception.h>
21
[4]22//ラベルアドレス
23LABEL *pLabelNames;
24int MaxLabelNum;
25
26//Caseスケジュール
27DWORD *pCaseSchedule;
28int CaseScheduleNum;
29int NowCaseSchedule;
30
31//プロシージャ抜け出しスケジュール(Exit Sub/Function)
32DWORD *pExitSubSchedule;
33int ExitSubScheduleNum;
34
35//Goto未知ラベル スケジュール
36GOTOLABELSCHEDULE *pGotoLabelSchedule;
37int GotoLabelScheduleNum;
38
39//グローバル変数初期バッファ
40BYTE *initGlobalBuf;
41
42//With情報
43WITHINFO WithInfo;
44
45
[89]46
[16]47///////////////////////////////////////////////////
[17]48// トークンを取得
49///////////////////////////////////////////////////
50void GetIdentifierToken( char *token, const char *source, int &pos ){
51 for( int i=0; ; i++, pos++ ){
52 if( ! IsVariableChar( source[pos] ) ){
53 token[i] = 0;
54 break;
55 }
56 token[i] = source[pos];
57 }
58}
59
60
61///////////////////////////////////////////////////
[16]62// 対になっているステートメントを飛び越す
63// ※グローバル領域用
64///////////////////////////////////////////////////
65int JumpStatement(const char *source, int &pos){
66 if( source[pos] != 1 ) return 0;
67
68 if( ! IsCommandDelimitation( source[pos - 1] ) ){
69 //直前がコマンド区切りではない場合
70 return 0;
71 }
72
73 char cStatement = source[pos + 1];
74
75 char cEnd = GetEndXXXCommand( cStatement );
76 if( cEnd == 0 ) return 0;
77
78 pos += 2;
79 while( ! ( source[pos] == 1 && source[pos + 1] == cEnd ) ){
80
81 if( source[pos] == '\0' ){
82 char temporary[64];
83 GetDefaultNameFromES( cStatement, temporary );
84 SetError( 22, temporary, pos );
85 return -1;
86 }
87
88 pos++;
89 }
90 if( ! ( source[pos] == '\0' || source[pos + 2] == '\0' ) ){
91 pos += 2;
92 }
93
94 return 1;
95}
96
97
[4]98void NextLine(void){
99 extern HANDLE hHeap;
100 extern int MaxLineInfoNum;
101 extern LINEINFO *pLineInfo;
102 if(MaxLineInfoNum){
103 if(pLineInfo[MaxLineInfoNum-1].TopObp==obp){
104 pLineInfo[MaxLineInfoNum-1].TopCp=cp;
105 return;
106 }
107 }
108 pLineInfo=(LINEINFO *)HeapReAlloc(hHeap,0,pLineInfo,(MaxLineInfoNum+1)*sizeof(LINEINFO));
109 pLineInfo[MaxLineInfoNum].TopCp=cp;
110 pLineInfo[MaxLineInfoNum].TopObp=obp;
111
112 extern BOOL bDebugSupportProc;
113 extern BOOL bSystemProc;
114 pLineInfo[MaxLineInfoNum].dwCodeType=0;
115 if(bDebugSupportProc)
116 pLineInfo[MaxLineInfoNum].dwCodeType|=CODETYPE_DEBUGPROC;
117 if(bSystemProc)
118 pLineInfo[MaxLineInfoNum].dwCodeType|=CODETYPE_SYSTEMPROC;
119
120 MaxLineInfoNum++;
121}
122
123void ChangeOpcode(char *Command){
124 extern HANDLE hHeap;
125 int i,i2;
126
[206]127 if(Command[0]=='\0')
128 {
129 return;
130 }
131
132 trace_for_sourcecodestep( FormatEscapeSequenceStringToDefaultString(Command) );
133
[4]134 if(Command[0]=='*'&&IsVariableTopChar(Command[1])){
135 //Goto先ラベル
136 pLabelNames=(LABEL *)HeapReAlloc(hHeap,0,pLabelNames,(MaxLabelNum+1)*sizeof(LABEL));
137 pLabelNames[MaxLabelNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Command+1)+1);
138 lstrcpy(pLabelNames[MaxLabelNum].pName,Command+1);
139 pLabelNames[MaxLabelNum].address=obp;
140 MaxLabelNum++;
141
142 //書き込みスケジュール
143 for(i=0;i<GotoLabelScheduleNum;i++){
144 if(lstrcmp(pGotoLabelSchedule[i].pName,Command+1)==0){
145 *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long));
146
147 HeapDefaultFree(pGotoLabelSchedule[i].pName);
148
149 //詰める
150 GotoLabelScheduleNum--;
151 for(i2=i;i2<GotoLabelScheduleNum;i2++){
152 pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName;
153 pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line;
154 pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos;
155 }
156 i--;
157 continue;
158 }
159 }
160 return;
161 }
162 if(Command[0]==1){
163 switch(Command[1]){
164 case ESC_CONST:
[7]165 OpcodeDim(Command+2, DIMFLAG_CONST);
166 break;
167
[4]168 case ESC_TYPEDEF:
[113]169 if( UserProc::IsLocalAreaCompiling() ){
170 // ローカル領域をコンパイルしているとき
171 SetError(65,"TypeDef",cp );
172 }
173
[78]174 //既に収集済み
[4]175 break;
176
177 case ESC_STATIC:
178 OpcodeDim(Command+2,DIMFLAG_STATIC);
179 break;
180
181 case ESC_IF:
182 OpcodeIf(Command+2);
183 break;
184 case ESC_EXITWHILE:
[182]185 {
186 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_WHILE );
187 if( !pScope ){
188 SetError(12,"Exit While",cp);
189 return;
190 }
191 pScope->Break();
192 }
[4]193 break;
194 case ESC_EXITFOR:
[182]195 {
196 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_FOR );
197 if( !pScope ){
198 SetError(12,"Exit For",cp);
199 return;
200 }
201 pScope->Break();
202 }
[4]203 break;
204 case ESC_EXITDO:
[182]205 {
206 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_DO );
207 if( !pScope ){
208 SetError(12,"Exit Do",cp);
209 return;
210 }
211 pScope->Break();
212 }
[4]213 break;
214 case ESC_CONTINUE:
215 OpcodeContinue();
216 break;
217
218 case ESC_EXITSUB:
219 case ESC_EXITFUNCTION:
220 case ESC_EXITMACRO:
221 OpcodeExitSub();
222 break;
223
224 case ESC_SELECTCASE:
225 OpcodeSelect(Command+2);
226 break;
227 case ESC_CASE:
228 case ESC_CASEELSE:
229 OpcodeCase(Command+2);
230 break;
231
232 case ESC_WITH:
233 extern WITHINFO WithInfo;
234
235 WithInfo.ppName=(char **)HeapReAlloc(hHeap,0,WithInfo.ppName,(WithInfo.num+1)*sizeof(char **));
236 WithInfo.ppName[WithInfo.num]=(char *)HeapAlloc(hHeap,0,lstrlen(Command+2)+1);
237 lstrcpy(WithInfo.ppName[WithInfo.num],Command+2);
238
239 WithInfo.pWithCp=(int *)HeapReAlloc(hHeap,0,WithInfo.pWithCp,(WithInfo.num+1)*sizeof(int));
240 WithInfo.pWithCp[WithInfo.num]=cp;
241
242 WithInfo.num++;
243 break;
244 case ESC_ENDWITH:
245 if(WithInfo.num<=0){
246 SetError(12,"End With",cp);
247 return;
248 }
249 WithInfo.num--;
250 HeapDefaultFree(WithInfo.ppName[WithInfo.num]);
251 break;
252 case ESC_DECLARE:
[113]253 if( UserProc::IsLocalAreaCompiling() ){
254 // ローカル領域をコンパイルしているとき
255 SetError(65,"Declare",cp );
256 }
[4]257 break;
[26]258
[99]259 case ESC_NAMESPACE:
[199]260 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().push_back( Command + 2 );
[103]261 break;
[99]262 case ESC_ENDNAMESPACE:
[199]263 if( compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().size() <= 0 ){
[103]264 SetError(12,"End Namespace",cp);
265 }
[199]266 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().pop_back();
[99]267 break;
[107]268 case ESC_IMPORTS:
[199]269 compiler.GetNamespaceSupporter().ImportsNamespace( Command + 2 );
[107]270 break;
271 case ESC_CLEARNAMESPACEIMPORTED:
[199]272 compiler.GetNamespaceSupporter().GetImportedNamespaces().clear();
[107]273 break;
[99]274
[26]275 //Tryによる例外処理
276 case ESC_TRY:
277 Exception::TryCommand();
278 break;
279 case ESC_CATCH:
280 Exception::CatchCommand();
281 break;
282 case ESC_FINALLY:
283 Exception::FinallyCommand();
284 break;
285 case ESC_ENDTRY:
286 Exception::EndTryCommand();
287 break;
288 case ESC_THROW:
289 Exception::ThrowCommand( Command + 2 );
290 break;
291
[4]292 default:
293 char temporary[64];
294 GetDefaultNameFromES(Command[1],temporary);
295 SetError(30,temporary,cp);
296 break;
297 }
298 return;
299 }
300 switch(MAKEWORD(Command[1],Command[0])){
301 case COM_DIM:
302 OpcodeDim(Command+2,0);
303 break;
304 case COM_DELETE:
[64]305 OpcodeDelete(Command+2, false);
[4]306 break;
[64]307 case COM_SWEEPINGDELETE:
308 OpcodeDelete(Command+2, true);
309 break;
[4]310
311 case COM_GOTO:
312 OpcodeGoto(Command+2);
313 break;
314 case COM_WHILE:
315 OpcodeWhile(Command+2);
316 break;
317 case COM_FOR:
318 OpcodeFor(Command+2);
319 break;
320 case COM_DO:
321 OpcodeDo(Command+2);
322 break;
323
324 case COM_GOSUB:
325 OpcodeGosub(Command+2);
326 break;
327 case COM_RETURN:
328 OpcodeReturn(Command+2);
329 break;
330
331 case COM_SETDOUBLE:
332 OpcodeSetPtrData(Command+2,DEF_DOUBLE);
333 break;
334 case COM_SETSINGLE:
335 OpcodeSetPtrData(Command+2,DEF_SINGLE);
336 break;
337 case COM_SETQWORD:
338 OpcodeSetPtrData(Command+2,DEF_QWORD);
339 break;
340 case COM_SETDWORD:
341 OpcodeSetPtrData(Command+2,DEF_DWORD);
342 break;
343 case COM_SETWORD:
344 OpcodeSetPtrData(Command+2,DEF_WORD);
345 break;
346 case COM_SETBYTE:
347 OpcodeSetPtrData(Command+2,DEF_BYTE);
348 break;
349
350 case COM_DEBUG:
351 extern BOOL bDebugCompile;
352 //int 3
353 if(bDebugCompile) OpBuffer[obp++]=(char)0xCC;
354#if defined(_DEBUG)
355 else OpBuffer[obp++]=(char)0xCC;
356#endif
357 break;
358
359 case COM_LET:
360 OpcodeCalc(Command+2);
361 break;
362 default:
363 OpcodeOthers(Command);
364 break;
365 }
366}
367
368void GetGlobalDataForDll(void){
369 extern char *basbuf;
370 extern HANDLE hHeap;
371 int i2,BufferSize;
372 char *Command;
373 DWORD dwRetCode;
374
375 dwRetCode=0;
376 BufferSize=128;
377 Command=(char *)HeapAlloc(hHeap,0,BufferSize);
378 for(cp++,i2=0;;cp++,i2++){
379 if(i2>=BufferSize){
380 //バッファ領域が足りなくなった場合はバッファを増量する
381 BufferSize+=128;
382 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
383 }
384 if(basbuf[cp]=='\"'){
385 Command[i2]=basbuf[cp];
386 for(cp++,i2++;;cp++,i2++){
387 if(i2>=BufferSize){
388 //バッファ領域が足りなくなった場合はバッファを増量する
389 BufferSize+=128;
390 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
391 }
392 Command[i2]=basbuf[cp];
393 if(basbuf[cp]=='\"') break;
394 }
395 continue;
396 }
397 if(IsCommandDelimitation(basbuf[cp])){
398 Command[i2]=0;
399
400 if(Command[0]==1&&Command[1]==ESC_SUB){
401 i2=cp;
402 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDSUB)){
403 if(basbuf[cp]=='\0'){
404 SetError(22,"Sub",i2);
405 break;
406 }
407 cp++;
408 }
409 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
410 cp+=2;
411 i2=-1;
412 continue;
413 }
414 if(Command[0]==1&&Command[1]==ESC_FUNCTION){
415 i2=cp;
416 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDFUNCTION)){
417 if(basbuf[cp]=='\0'){
418 SetError(22,"Function",i2);
419 break;
420 }
421 cp++;
422 }
423 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
424 cp+=2;
425 i2=-1;
426 continue;
427 }
428 if(Command[0]==1&&Command[1]==ESC_MACRO){
429 i2=cp;
430 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDMACRO)){
431 if(basbuf[cp]=='\0'){
432 SetError(22,"Macro",i2);
433 break;
434 }
435 cp++;
436 }
437 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
438 cp+=2;
439 i2=-1;
440 continue;
441 }
442 if(Command[0]==1&&Command[1]==ESC_TYPE){
443 i2=cp;
444 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDTYPE)){
445 if(basbuf[cp]=='\0'){
446 SetError(22,"Type",i2);
447 break;
448 }
449 cp++;
450 }
451 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
452 cp+=2;
453 i2=-1;
454 continue;
455 }
456 if(Command[0]==1&&Command[1]==ESC_CLASS){
457 i2=cp;
458 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDCLASS)){
459 if(basbuf[cp]=='\0'){
460 SetError(22,"Class",i2);
461 break;
462 }
463 cp++;
464 }
465 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
466 cp+=2;
467 i2=-1;
468 continue;
469 }
470 if(Command[0]==1&&Command[1]==ESC_INTERFACE){
471 i2=cp;
472 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDINTERFACE)){
473 if(basbuf[cp]=='\0'){
474 SetError(22,"Interface",i2);
475 break;
476 }
477 cp++;
478 }
479 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
480 cp+=2;
481 i2=-1;
482 continue;
483 }
484
485 //DLLのグローバルデータに必要なコマンドだけ
486 if(MAKEWORD(Command[1],Command[0])==COM_DIM)
487 OpcodeDim(Command+2,0);
488
[89]489 // ネイティブコードバッファの再確保
490 ReallocNativeCodeBuffer();
[4]491
492 if(basbuf[cp]=='\0') break;
493 i2=-1;
494 continue;
495 }
496 Command[i2]=basbuf[cp];
497 }
498 HeapDefaultFree(Command);
499}
500DWORD CompileBuffer(char Return_Sequence,WORD Return_Command){
501 extern char *basbuf;
502 extern HANDLE hHeap;
503 int i,i2,i3,i4,BufferSize,ScopeStart;
504 char *Command,temporary[VN_SIZE],*temp2,temp3[32];
505 DWORD dwRetCode;
506
507 ScopeStart=cp;
508
509 dwRetCode=0;
510 BufferSize=128;
511 Command=(char *)HeapAlloc(hHeap,0,BufferSize);
[15]512
[4]513 for(cp++,i2=0;;cp++,i2++){
514 if(i2>=BufferSize){
515 //バッファ領域が足りなくなった場合はバッファを増量する
516 BufferSize+=128;
517 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
518 }
519 if(basbuf[cp]=='\"'){
520 Command[i2]=basbuf[cp];
521 for(cp++,i2++;;cp++,i2++){
522 if(i2>=BufferSize){
523 //バッファ領域が足りなくなった場合はバッファを増量する
524 BufferSize+=128;
525 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
526 }
527 Command[i2]=basbuf[cp];
528 if(basbuf[cp]=='\"') break;
529 }
530 continue;
531 }
532 if(IsCommandDelimitation(basbuf[cp])){
533 Command[i2]=0;
534
535 if(Command[0]==1&&Command[1]==ESC_LINENUM){
536 for(i=2,i2=0;;i++,i2++){
537 if(Command[i]==','){
538 temporary[i2]=0;
539 break;
540 }
541 temporary[i2]=Command[i];
542 }
543 i3=atoi(temporary);
544 i4=i+1;
545
546 //Goto先ラベル
547 pLabelNames=(LABEL *)HeapReAlloc(hHeap,0,pLabelNames,(MaxLabelNum+1)*sizeof(LABEL));
548 pLabelNames[MaxLabelNum].pName=0;
549 pLabelNames[MaxLabelNum].line=i3;
550 pLabelNames[MaxLabelNum].address=obp;
551 MaxLabelNum++;
552
553 //書き込みスケジュール
554 for(i=0;i<GotoLabelScheduleNum;i++){
555 if(pGotoLabelSchedule[i].pName==0&&
556 pGotoLabelSchedule[i].line==i3){
557 *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long));
558
559 //詰める
560 GotoLabelScheduleNum--;
561 for(i2=i;i2<GotoLabelScheduleNum;i2++){
562 pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName;
563 pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line;
564 pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos;
565 }
566 i--;
567 }
568 }
569
570 temp2=(char *)HeapAlloc(hHeap,0,lstrlen(Command+i4)+1);
571 lstrcpy(temp2,Command+i4);
572 lstrcpy(Command,temp2);
573 HeapDefaultFree(temp2);
574 }
575
576 if(Command[0]==1&&
577 (((Command[1]==ESC_VIRTUAL||Command[1]==ESC_OVERRIDE)&&Command[2]==1&&(Command[3]==ESC_SUB||Command[3]==ESC_FUNCTION))||
578 Command[1]==ESC_SUB||
579 Command[1]==ESC_FUNCTION||
580 Command[1]==ESC_MACRO||
581 Command[1]==ESC_TYPE||
582 Command[1]==ESC_CLASS||
583 Command[1]==ESC_INTERFACE||
584 Command[1]==ESC_ENUM||
585 (Command[1]==ESC_CONST&&Command[2]==1&&Command[3]==ESC_ENUM)
586 )
587 ){
588 if(Command[1]==ESC_VIRTUAL||Command[1]==ESC_OVERRIDE||Command[1]==ESC_CONST){
589 GetDefaultNameFromES(Command[3],temporary);
590 }
591 else{
592 GetDefaultNameFromES(Command[1],temporary);
593 }
594 if(Return_Sequence){
595 SetError(12,temporary,cp);
596 break;
597 }
598
599 if(Command[1]==ESC_CONST) i3=GetEndXXXCommand(Command[3]);
600 else i3=GetEndXXXCommand(Command[1]);
601 for(i2=cp;;cp++){
602 if(basbuf[cp]==1){
603 if(basbuf[cp+1]==i3) break;
604 if(Command[1]==ESC_CLASS||Command[1]==ESC_INTERFACE){
605 //クラス、インターフェイスではSub、Functionの定義を可能にしておく
606 if(basbuf[cp+1]==ESC_MACRO||
607 basbuf[cp+1]==ESC_TYPE||
608 basbuf[cp+1]==ESC_CLASS||
609 basbuf[cp+1]==ESC_INTERFACE||
610 basbuf[cp+1]==ESC_ENUM){
611 GetDefaultNameFromES(basbuf[cp+1],temp3);
612 SetError(12,temp3,cp);
613 }
614 }
615 else{
616 if(basbuf[cp-1]!='*'&&(
617 basbuf[cp+1]==ESC_VIRTUAL||
618 basbuf[cp+1]==ESC_OVERRIDE||
619 basbuf[cp+1]==ESC_SUB||
620 basbuf[cp+1]==ESC_FUNCTION||
621 basbuf[cp+1]==ESC_MACRO||
622 basbuf[cp+1]==ESC_TYPE||
623 basbuf[cp+1]==ESC_CLASS||
624 basbuf[cp+1]==ESC_INTERFACE||
625 basbuf[cp+1]==ESC_ENUM)){
626 GetDefaultNameFromES(basbuf[cp+1],temp3);
627 SetError(12,temp3,cp);
628 }
629 }
630 }
631 if(basbuf[cp]=='\0'){
632 //error
633 //既にエラー発行済みのため、何もせずに抜ける
634 break;
635 }
636 }
637 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
638 cp+=2;
639 i2=-1;
640 continue;
641 }
642
643 if(Command[0]==0x10||Command[0]==0x11){
644 //Wend、Next、Loopなど
645 if(Return_Command==MAKEWORD(Command[1],Command[0])){
646 if(Return_Command==COM_NEXT){
647 //Nextの場合は、パラメータ(省略化)の整合性を判断する必要がある(OpcodeFor関数を参照)
648 extern char szNextVariable[VN_SIZE];
649 if(Command[2]) lstrcpy(szNextVariable,Command+2);
650 else szNextVariable[0]=0;
651 }
652 break;
653 }
654 }
655
656 NextLine();
657
658 if(Command[0]==1){
659 if(Return_Sequence==ESC_ENDIF&&Command[1]==ESC_ELSE){
660 dwRetCode=ESC_ELSE;
661 break;
662 }
663
664 if(Command[1]==Return_Sequence){
665 dwRetCode=Command[1];
666 break;
667 }
668 }
669
[182]670 try
671 {
672 ChangeOpcode(Command);
673 }
674 catch( const SmoothieException &smoothieException )
675 {
676 SetError(
677 smoothieException.GetErrorCode(),
678 smoothieException.GetKeyword(),
679 smoothieException.GetNowLine()
680 );
681 }
[4]682
[232]683
[4]684 epi_check();
685
[232]686
[4]687 //コンパイルを中断するとき
688 extern BOOL bStopCompile;
689 if(bStopCompile) return 0;
690
[182]691 ReallocNativeCodeBuffer();
[4]692
693 if(basbuf[cp]=='\0'){
694 switch(Return_Command){
695 case COM_WEND:
696 SetError(4,"\"While\" - \"Wend\" ",ScopeStart);
697 break;
698 case COM_NEXT:
699 SetError(4,"\"For\" - \"Next\" ",ScopeStart);
700 break;
701 case COM_LOOP:
702 SetError(4,"\"Do\" - \"Loop\" ",ScopeStart);
703 break;
704 }
705 switch(Return_Sequence){
706 case ESC_ENDSUB:
707 SetError(4,"\"Sub\" - \"End Sub\" ",ScopeStart);
708 break;
709 case ESC_ENDFUNCTION:
710 SetError(4,"\"Function\" - \"End Function\" ",ScopeStart);
711 break;
712 case ESC_ENDMACRO:
713 SetError(4,"\"Macro\" - \"End Macro\" ",ScopeStart);
714 break;
715 case ESC_ENDIF:
716 SetError(22,"If",ScopeStart);
717 break;
718 }
719 break;
720 }
721 i2=-1;
722 continue;
723 }
724 Command[i2]=basbuf[cp];
725 }
726 HeapDefaultFree(Command);
727
728 return dwRetCode;
729}
Note: See TracBrowser for help on using the repository browser.