source: dev/trunk/abdev/BasicCompiler32/Compile_Statement.cpp@ 233

Last change on this file since 233 was 227, checked in by dai_9181, 17 years ago
File size: 31.8 KB
Line 
1#include "stdafx.h"
2
3#include <jenga/include/smoothie/LexicalAnalysis.h>
4
5#include <LexicalScopingImpl.h>
6#include <Compiler.h>
7
8#include "../BasicCompiler_Common/common.h"
9#include "Opcode.h"
10
11void OpcodeOthers( const char *Command ){
12 int i,i2;
13
14 char leftTerm[8192];
15 int lastParePos = 0;
16 for(i=0;;i++){
17 if(Command[i]=='\"'){
18 //ダブルクォートは不正なのでエラー扱い
19 leftTerm[i]=0;
20 SetError(3,leftTerm,cp);
21 return;
22 }
23
24 if(Command[i]=='('){
25 lastParePos = i;
26 i2=GetStringInPare(leftTerm+i,Command+i);
27 i+=i2-1;
28 continue;
29 }
30 if(Command[i]=='['){
31 i2=GetStringInBracket(leftTerm+i,Command+i);
32 i+=i2-1;
33 continue;
34 }
35 if(Command[i]=='\0'){
36 leftTerm[i] = 0;
37 break;
38 }
39
40 if( IsNumCalcMark( Command, i ) ){
41 leftTerm[i] = 0;
42 break;
43 }
44
45 leftTerm[i]=Command[i];
46 }
47 if(!(
48 IsVariableTopChar(leftTerm[0])||
49 leftTerm[0]=='.'||
50 (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM)
51 )){
52 SetError(1,NULL,cp);
53 return;
54 }
55
56
57 if(Command[i]=='\0' && lastParePos == 0){
58 //////////////////////////////
59 // パラメータ無しのマクロ検索
60 //////////////////////////////
61
62 const UserProc *pUserProc = GetSubHash(Command);
63
64 //GetSubHash内でエラー提示が行われた場合
65 if(pUserProc==(UserProc *)-1) return;
66
67 if(pUserProc==0){
68 char temporary[VN_SIZE];
69 lstrcpy(temporary,Command);
70
71 CharUpper(temporary);
72 pUserProc=GetSubHash(temporary);
73
74 //GetSubHash内でエラー提示が行われた場合
75 if(pUserProc==(UserProc *)-1) return;
76 }
77
78 if(pUserProc){
79 if( !pUserProc->IsMacro() ){
80 SetError(10,Command,cp);
81 }
82
83 Opcode_CallProc("",pUserProc,0,"",0);
84
85 return;
86 }
87 }
88 else if(IsNumCalcMark(Command,i)){
89 //代入演算
90 OpcodeCalc(Command);
91 return;
92 }
93
94
95 Type resultType;
96 bool isLiteral;
97 BOOL bUseHeap;
98 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
99 if( result ){
100
101 /////////////////////
102 // 戻り値の処理
103 /////////////////////
104
105 if( resultType.IsReal() ){
106 //fstp st(0)
107 OpBuffer[obp++]=(char)0xDD;
108 OpBuffer[obp++]=(char)0xD8;
109 }
110 else if( resultType.IsStruct() ){
111 //mov ebx,eax
112 compiler.codeGenerator.op_mov_RR(REG_EBX,REG_EAX);
113
114 FreeTempObject(REG_EBX,&resultType.GetClass());
115 }
116
117 //成功
118 return;
119 }
120
121 // 失敗
122 SetError(1, NULL,cp);
123}
124
125void OpcodeIf(char *Parameter){
126 int i,i2,i3,i4;
127 Type tempType;
128
129 for(i=0;;i++){
130 if(Parameter[i]=='\0'){
131 SetError(21,NULL,cp);
132 return;
133 }
134 if(Parameter[i]==1&&Parameter[i+1]==ESC_THEN){
135 Parameter[i]=0;
136 break;
137 }
138 }
139
140 if( !NumOpe(Parameter,Type(),tempType) ){
141 //NumOpe内でエラー
142 i3=-1; //ダミー
143 }
144 else if( tempType.IsDouble() ){
145 //fld qword ptr[esp]
146 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE);
147
148 //push 0
149 compiler.codeGenerator.op_push_V(0);
150
151 //fild dword ptr[esp]
152 compiler.codeGenerator.op_fld_ptr_esp(DEF_LONG);
153
154 //add esp,sizeof(double)+sizeof(long)
155 compiler.codeGenerator.op_add_esp(sizeof(double)+sizeof(long));
156
157 //fcompp
158 compiler.codeGenerator.op_fcompp();
159
160 //fnstsw ax
161 compiler.codeGenerator.op_fnstsw_ax();
162
163 //test ah,40
164 compiler.codeGenerator.op_test_ah( (char)0x40 );
165
166 //jne (endif、または else まで)
167 OpBuffer[obp++]=(char)0x0F;
168 OpBuffer[obp++]=(char)0x85;
169 obp+=sizeof(long);
170
171 //jneの番地
172 i3=obp;
173 }
174 else if( tempType.IsSingle() ){
175 //fld dword ptr[esp]
176 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE);
177
178 //push 0
179 compiler.codeGenerator.op_push_V(0);
180
181 //fild dword ptr[esp]
182 compiler.codeGenerator.op_fld_ptr_esp(DEF_LONG);
183
184 //add esp,sizeof(float)+sizeof(long)
185 compiler.codeGenerator.op_add_esp(sizeof(float)+sizeof(long));
186
187 //fcompp
188 compiler.codeGenerator.op_fcompp();
189
190 //fnstsw ax
191 compiler.codeGenerator.op_fnstsw_ax();
192
193 //test ah,40
194 compiler.codeGenerator.op_test_ah( (char)0x40 );
195
196 //jne (endif、または else まで)
197 OpBuffer[obp++]=(char)0x0F;
198 OpBuffer[obp++]=(char)0x85;
199 obp+=sizeof(long);
200
201 //jneの番地
202 i3=obp;
203 }
204 else if( tempType.Is64() ){
205 //64ビット型
206
207 //pop eax
208 compiler.codeGenerator.op_pop(REG_EAX);
209
210 //pop ebx
211 compiler.codeGenerator.op_pop(REG_EBX);
212
213 //cmp eax,0
214 OpBuffer[obp++]=(char)0x83;
215 OpBuffer[obp++]=(char)0xF8;
216 OpBuffer[obp++]=(char)0x00;
217
218 //jne
219 OpBuffer[obp++]=(char)0x0F;
220 OpBuffer[obp++]=(char)0x85;
221 obp+=sizeof(long);
222 i3=obp;
223
224
225 //cmp ebx,0
226 OpBuffer[obp++]=(char)0x83;
227 OpBuffer[obp++]=(char)0xFB;
228 OpBuffer[obp++]=(char)0x00;
229
230 //jne
231 OpBuffer[obp++]=(char)0x0F;
232 OpBuffer[obp++]=(char)0x85;
233 obp+=sizeof(long);
234 i4=obp;
235
236
237
238 //jmp (endif、または else までジャンプ)
239 OpBuffer[obp++]=(char)0xE9;
240 obp+=sizeof(long);
241
242 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;
243 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
244
245 //jmpの番地
246 i3=obp;
247 }
248 else{
249 //32ビット型
250
251 //pop eax
252 compiler.codeGenerator.op_pop(REG_EAX);
253
254 //cmp eax,0
255 OpBuffer[obp++]=(char)0x83;
256 OpBuffer[obp++]=(char)0xF8;
257 OpBuffer[obp++]=(char)0x00;
258
259 //je (endif、または else まで条件ジャンプ)
260 OpBuffer[obp++]=(char)0x0F;
261 OpBuffer[obp++]=(char)0x84;
262 obp+=sizeof(long);
263
264 //jeの番地
265 i3=obp;
266 }
267
268
269 /////////////////////////
270 // If内をコード化
271 /////////////////////////
272
273 //レキシカルスコープをレベルアップ
274 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF );
275
276 i2=CompileBuffer(ESC_ENDIF,0);
277
278 //レキシカルスコープをレベルダウン
279 GetLexicalScopes().End();
280
281
282 if(i3==-1) return;
283
284 if(i2==ESC_ELSE){
285 //jmp (endifまで)
286 OpBuffer[obp++]=(char)0xE9;
287 obp+=sizeof(long);
288
289 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //ifからelseへのジャンプ先のオフセット値
290
291 i3=obp;
292
293
294 /////////////////////////
295 // Else内をコード化
296 /////////////////////////
297
298 //レキシカルスコープをレベルアップ
299 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF );
300
301 CompileBuffer(ESC_ENDIF,0);
302
303 //レキシカルスコープをレベルダウン
304 GetLexicalScopes().End();
305
306
307 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //jmpジャンプ先のオフセット値
308 }
309 else{
310 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //jeジャンプ先のオフセット値
311 }
312}
313
314int GetLabelAddress(char *LabelName,int LineNum){
315 extern int MaxLabelNum;
316 extern LABEL *pLabelNames;
317 int i;
318
319 if(LabelName){
320 for(i=0;i<MaxLabelNum;i++){
321 if(pLabelNames[i].pName){
322 if(lstrcmp(LabelName,pLabelNames[i].pName)==0) return pLabelNames[i].address;
323 }
324 }
325 }
326 else{
327 for(i=0;i<MaxLabelNum;i++){
328 if(pLabelNames[i].pName==0){
329 if(LineNum==pLabelNames[i].line) return pLabelNames[i].address;
330 }
331 }
332 }
333 return -1;
334}
335void OpcodeGoto(char *Parameter){
336 extern HANDLE hHeap;
337 extern GOTOLABELSCHEDULE *pGotoLabelSchedule;
338 extern int GotoLabelScheduleNum;
339 int i,LineNum;
340
341 if(Parameter[0]=='*'){
342 i=GetLabelAddress(Parameter+1,0);
343
344 //jmp ...
345 OpBuffer[obp++]=(char)0xE9;
346 if(i==-1){
347 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
348 pGotoLabelSchedule[GotoLabelScheduleNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Parameter+1)+1);
349 lstrcpy(pGotoLabelSchedule[GotoLabelScheduleNum].pName,Parameter+1);
350 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
351 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
352 GotoLabelScheduleNum++;
353 }
354 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
355 obp+=sizeof(long);
356 }
357 else{
358 LineNum=atoi(Parameter);
359 i=GetLabelAddress(0,LineNum);
360
361 //jmp ...
362 OpBuffer[obp++]=(char)0xE9;
363 if(i==-1){
364 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
365 pGotoLabelSchedule[GotoLabelScheduleNum].pName=0;
366 pGotoLabelSchedule[GotoLabelScheduleNum].line=LineNum;
367 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
368 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
369 GotoLabelScheduleNum++;
370 }
371 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
372 obp+=sizeof(long);
373 }
374}
375void OpcodeWhile(char *Parameter){
376 extern HANDLE hHeap;
377 int i2,i3 = 0;
378
379 //Continueアドレスのバックアップとセット
380 extern DWORD dwContinueAddress;
381 DWORD dwTempContinue;
382 dwTempContinue=dwContinueAddress;
383 dwContinueAddress=obp;
384
385 if(!Parameter[0]) SetError(10,"While",cp);
386
387 int je_schedule;
388 Type tempType;
389 if( !NumOpe(Parameter,Type(),tempType) ){
390 //ダミー
391 i3=-1;
392 }
393 else if( tempType.IsDouble() ){
394 //fld qword ptr[esp]
395 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE);
396
397 //push 0
398 compiler.codeGenerator.op_push_V(0);
399
400 //fild dword ptr[esp]
401 compiler.codeGenerator.op_fld_ptr_esp(DEF_LONG);
402
403 //add esp,sizeof(double)+sizeof(long)
404 compiler.codeGenerator.op_add_esp(sizeof(double)+sizeof(long));
405
406 //fcompp
407 compiler.codeGenerator.op_fcompp();
408
409 //fnstsw ax
410 compiler.codeGenerator.op_fnstsw_ax();
411
412 //test ah,40
413 compiler.codeGenerator.op_test_ah( (char)0x40 );
414
415 //jne (Wend まで)
416 OpBuffer[obp++]=(char)0x0F;
417 OpBuffer[obp++]=(char)0x85;
418 obp+=sizeof(long);
419
420 //jeの番地
421 je_schedule=obp;
422 }
423 else if( tempType.IsSingle() ){
424 //fld dword ptr[esp]
425 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE);
426
427 //push 0
428 compiler.codeGenerator.op_push_V(0);
429
430 //fild dword ptr[esp]
431 compiler.codeGenerator.op_fld_ptr_esp(DEF_LONG);
432
433 //add esp,sizeof(float)+sizeof(long)
434 compiler.codeGenerator.op_add_esp(sizeof(float)+sizeof(long));
435
436 //fcompp
437 compiler.codeGenerator.op_fcompp();
438
439 //fnstsw ax
440 compiler.codeGenerator.op_fnstsw_ax();
441
442 //test ah,40
443 compiler.codeGenerator.op_test_ah( (char)0x40 );
444
445 //jne (Wend まで)
446 OpBuffer[obp++]=(char)0x0F;
447 OpBuffer[obp++]=(char)0x85;
448 obp+=sizeof(long);
449
450 //jeの番地
451 je_schedule=obp;
452 }
453 else if( tempType.Is64() ){
454 //64ビット型
455
456 //pop eax
457 compiler.codeGenerator.op_pop(REG_EAX);
458
459 //pop ebx
460 compiler.codeGenerator.op_pop(REG_EBX);
461
462 //cmp eax,0
463 OpBuffer[obp++]=(char)0x83;
464 OpBuffer[obp++]=(char)0xF8;
465 OpBuffer[obp++]=(char)0x00;
466
467 //jne
468 OpBuffer[obp++]=(char)0x0F;
469 OpBuffer[obp++]=(char)0x85;
470 obp+=sizeof(long);
471 i2=obp;
472
473
474 //cmp ebx,0
475 OpBuffer[obp++]=(char)0x83;
476 OpBuffer[obp++]=(char)0xFB;
477 OpBuffer[obp++]=(char)0x00;
478
479 //jne
480 OpBuffer[obp++]=(char)0x0F;
481 OpBuffer[obp++]=(char)0x85;
482 obp+=sizeof(long);
483 i3=obp;
484
485
486 //jmp (endif、または else までジャンプ)
487 OpBuffer[obp++]=(char)0xE9;
488 obp+=sizeof(long);
489
490 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
491 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;
492
493 //jmpの番地
494 je_schedule=obp;
495 }
496 else{
497 //その他整数型
498
499 //pop eax
500 compiler.codeGenerator.op_pop(REG_EAX);
501
502 //cmp eax,0
503 OpBuffer[obp++]=(char)0x83;
504 OpBuffer[obp++]=(char)0xF8;
505 OpBuffer[obp++]=(char)0x00;
506
507 //je (Wend まで)
508 OpBuffer[obp++]=(char)0x0F;
509 OpBuffer[obp++]=(char)0x84;
510 obp+=sizeof(long);
511
512 //実行中の番地
513 je_schedule=obp;
514 }
515
516 //レキシカルスコープをレベルアップ
517 GetLexicalScopes().Start( obp, SCOPE_TYPE_WHILE );
518
519 //While内をコンパイル
520 CompileBuffer(0,COM_WEND);
521
522 GetLexicalScopes().CallDestructorsOfScopeEnd();
523
524 if( i3 == -1 ){
525 return;
526 }
527
528 //jmp ...
529 OpBuffer[obp++]=(char)0xE9;
530 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
531 obp+=sizeof(long);
532
533 //レキシカルスコープをレベルダウン
534 GetLexicalScopes().End();
535
536 *((long *)(OpBuffer+je_schedule-sizeof(long)))=obp-je_schedule; //jeジャンプ先のオフセット値
537
538 //Continueアドレスを復元
539 dwContinueAddress=dwTempContinue;
540}
541
542char szNextVariable[VN_SIZE];
543void OpcodeFor(char *Parameter){
544 extern HANDLE hHeap;
545 int i,i2,i3;
546 char temporary[VN_SIZE],variable[VN_SIZE],JudgeNum[VN_SIZE],StepNum[VN_SIZE];
547
548 //第1パラメータを取得
549 i=GetOneParameter(Parameter,0,temporary);
550 if(!Parameter[i]){
551 SetError(12,"For",cp);
552 goto ErrorStep;
553 }
554
555 for(i2=0;;i2++){
556 if(temporary[i2]=='='){
557 variable[i2]=0;
558
559 //カウンタ初期化
560 OpcodeCalc(temporary);
561 break;
562 }
563 if(temporary[i2]=='\0'){
564 SetError(12,"For",cp);
565 goto ErrorStep;
566 }
567 variable[i2]=temporary[i2];
568 }
569
570 //jmp ...
571 OpBuffer[obp++]=(char)0xE9;
572 i2=obp;
573 obp+=sizeof(long);
574
575 //Continueアドレスのバックアップとセット
576 extern DWORD dwContinueAddress;
577 DWORD dwTempContinue;
578 dwTempContinue=dwContinueAddress;
579 dwContinueAddress=obp;
580
581 //第2パラメータを取得(to~)
582 i=GetOneParameter(Parameter,i,JudgeNum);
583
584 //第3パラメータを取得(step~)
585 if(Parameter[i]){
586 i=GetOneParameter(Parameter,i,StepNum);
587 if(Parameter[i]) SetError(12,"For",cp);
588 }
589 else lstrcpy(StepNum,"1");
590
591 //カウンタを増加させる
592 sprintf(temporary,"%s=(%s)+(%s)",variable,variable,StepNum);
593 OpcodeCalc(temporary);
594
595 *((long *)(OpBuffer+i2))=obp-(i2+sizeof(long));
596
597 //増加か減少かを区別する
598 sprintf(temporary,"(%s)>=0",StepNum);
599 NumOpe(temporary,Type(),Type());
600
601 //pop eax
602 compiler.codeGenerator.op_pop(REG_EAX);
603
604 //cmp eax,0
605 OpBuffer[obp++]=(char)0x83;
606 OpBuffer[obp++]=(char)0xF8;
607 OpBuffer[obp++]=(char)0x00;
608
609 //je [カウンタ減少の場合の判定]
610 OpBuffer[obp++]=(char)0x0F;
611 OpBuffer[obp++]=(char)0x84;
612 i2=obp;
613 obp+=sizeof(long);
614
615 //判定(カウンタ増加の場合)
616 sprintf(temporary,"%s<=(%s)",variable,JudgeNum);
617 NumOpe(temporary,Type(),Type());
618
619 //pop eax
620 compiler.codeGenerator.op_pop(REG_EAX);
621
622 //jmp [カウンタ減少の場合の判定を飛び越す]
623 OpBuffer[obp++]=(char)0xE9;
624 i3=obp;
625 obp+=sizeof(long);
626
627 *((long *)(OpBuffer+i2))=obp-(i2+sizeof(long)); //jeジャンプ先のオフセット値
628
629 //判定(カウンタ減少の場合)
630 sprintf(temporary,"%s>=(%s)",variable,JudgeNum);
631 NumOpe(temporary,Type(),Type());
632
633 //pop eax
634 compiler.codeGenerator.op_pop(REG_EAX);
635
636 *((long *)(OpBuffer+i3))=obp-(i3+sizeof(long)); //jmpジャンプ先のオフセット値
637
638 //cmp eax,0
639 OpBuffer[obp++]=(char)0x83;
640 OpBuffer[obp++]=(char)0xF8;
641 OpBuffer[obp++]=(char)0x00;
642
643ErrorStep:
644
645 //je ...
646 OpBuffer[obp++]=(char)0x0F;
647 OpBuffer[obp++]=(char)0x84;
648 int je_schedule=obp;
649 obp+=sizeof(long);
650
651 //レキシカルスコープをレベルアップ
652 GetLexicalScopes().Start( obp, SCOPE_TYPE_FOR );
653
654 //For内をコンパイル
655 CompileBuffer(0,COM_NEXT);
656
657 GetLexicalScopes().CallDestructorsOfScopeEnd();
658
659 if(szNextVariable[0]){
660 if(lstrcmp(szNextVariable,variable)!=0){
661 SetError(55,szNextVariable,cp);
662 }
663 }
664
665 //jmp ...
666 OpBuffer[obp++]=(char)0xE9;
667 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
668 obp+=sizeof(long);
669
670 //レキシカルスコープをレベルダウン
671 GetLexicalScopes().End();
672
673 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jeジャンプ先のオフセット値
674
675 //Continueアドレスを復元
676 dwContinueAddress=dwTempContinue;
677}
678
679void OpcodeDo(char *Parameter){
680 extern HANDLE hHeap;
681 int i,i2,i3,i4;
682
683 if(Parameter[0]) SetError(10,"Do",cp);
684
685 //Continueアドレスのバックアップとセット
686 extern DWORD dwContinueAddress;
687 DWORD dwTempContinue;
688 dwTempContinue=dwContinueAddress;
689 dwContinueAddress=obp;
690
691 //レキシカルスコープをレベルアップ
692 GetLexicalScopes().Start( obp, SCOPE_TYPE_DO );
693
694 //Do内をコンパイル
695 CompileBuffer(0,COM_LOOP);
696
697 GetLexicalScopes().CallDestructorsOfScopeEnd();
698
699 extern char *basbuf;
700 char temporary[VN_SIZE];
701 for(i=cp-1;;i--){
702 if(IsCommandDelimitation(basbuf[i])){
703 i+=3;
704 if(!(basbuf[i]=='0'||basbuf[i]=='1')){
705 //無条件ループ
706 break;
707 }
708 i3=i;
709
710 for(i+=2,i2=0;;i++,i2++){
711 if(IsCommandDelimitation(basbuf[i])){
712 temporary[i2]=0;
713 break;
714 }
715 temporary[i2]=basbuf[i];
716 }
717
718 Type tempType;
719 NumOpe(temporary,Type(),tempType);
720
721 if( tempType.IsDouble() ){
722 //fld qword ptr[esp]
723 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE);
724
725 //push 0
726 compiler.codeGenerator.op_push_V(0);
727
728 //fild dword ptr[esp]
729 compiler.codeGenerator.op_fld_ptr_esp(DEF_LONG);
730
731 //add esp,sizeof(double)+sizeof(long)
732 compiler.codeGenerator.op_add_esp(sizeof(double)+sizeof(long));
733
734 //fcompp
735 compiler.codeGenerator.op_fcompp();
736
737 //fnstsw ax
738 compiler.codeGenerator.op_fnstsw_ax();
739
740 //test ah,40
741 compiler.codeGenerator.op_test_ah( (char)0x40 );
742
743 if(basbuf[i3]=='0'){
744 //While
745
746 //jne 5(ループ終了)
747 OpBuffer[obp++]=(char)0x75;
748 OpBuffer[obp++]=(char)0x05;
749 }
750 else if(basbuf[i3]=='1'){
751 //Until
752
753 //je 5(ループ終了)
754 OpBuffer[obp++]=(char)0x74;
755 OpBuffer[obp++]=(char)0x05;
756 }
757 }
758 else if( tempType.IsSingle() ){
759 //fld dword ptr[esp]
760 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE);
761
762 //push 0
763 compiler.codeGenerator.op_push_V(0);
764
765 //fild dword ptr[esp]
766 compiler.codeGenerator.op_fld_ptr_esp(DEF_LONG);
767
768 //add esp,sizeof(float)+sizeof(long)
769 compiler.codeGenerator.op_add_esp(sizeof(float)+sizeof(long));
770
771 //fcompp
772 compiler.codeGenerator.op_fcompp();
773
774 //fnstsw ax
775 compiler.codeGenerator.op_fnstsw_ax();
776
777 //test ah,40
778 compiler.codeGenerator.op_test_ah( (char)0x40 );
779
780 if(basbuf[i3]=='0'){
781 //While
782
783 //jne 5(ループ終了)
784 OpBuffer[obp++]=(char)0x75;
785 OpBuffer[obp++]=(char)0x05;
786 }
787 else if(basbuf[i3]=='1'){
788 //Until
789
790 //je 5(ループ終了)
791 OpBuffer[obp++]=(char)0x74;
792 OpBuffer[obp++]=(char)0x05;
793 }
794 }
795 else if( tempType.Is64() ){
796 //64ビット型
797
798 //pop eax
799 compiler.codeGenerator.op_pop(REG_EAX);
800
801 //pop ebx
802 compiler.codeGenerator.op_pop(REG_EBX);
803
804 //cmp eax,0
805 OpBuffer[obp++]=(char)0x83;
806 OpBuffer[obp++]=(char)0xF8;
807 OpBuffer[obp++]=(char)0x00;
808
809 //jne
810 OpBuffer[obp++]=(char)0x0F;
811 OpBuffer[obp++]=(char)0x85;
812 obp+=sizeof(long);
813 i2=obp;
814
815
816 //cmp ebx,0
817 OpBuffer[obp++]=(char)0x83;
818 OpBuffer[obp++]=(char)0xFB;
819 OpBuffer[obp++]=(char)0x00;
820
821 //jne
822 OpBuffer[obp++]=(char)0x0F;
823 OpBuffer[obp++]=(char)0x85;
824 obp+=sizeof(long);
825 i4=obp;
826
827
828 if(basbuf[i3]=='0'){
829 //While
830
831 //jmp 5(ループ終了)
832 OpBuffer[obp++]=(char)0xEB;
833 OpBuffer[obp++]=(char)0x05;
834
835 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
836 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
837 }
838 else if(basbuf[i3]=='1'){
839 //Until
840
841 //jmp 2(ループを続ける)
842 OpBuffer[obp++]=(char)0xEB;
843 OpBuffer[obp++]=(char)0x02;
844
845 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
846 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
847
848 //jmp 5(ループ終了)
849 OpBuffer[obp++]=(char)0xEB;
850 OpBuffer[obp++]=(char)0x05;
851 }
852 }
853 else{
854 //pop eax
855 compiler.codeGenerator.op_pop(REG_EAX);
856
857 //cmp eax,0
858 OpBuffer[obp++]=(char)0x83;
859 OpBuffer[obp++]=(char)0xF8;
860 OpBuffer[obp++]=(char)0x00;
861
862 if(basbuf[i3]=='0'){
863 //While
864
865 //je 5(ループ終了)
866 OpBuffer[obp++]=(char)0x74;
867 OpBuffer[obp++]=(char)0x05;
868 }
869 else if(basbuf[i3]=='1'){
870 //Until
871
872 //jne 5(ループ終了)
873 OpBuffer[obp++]=(char)0x75;
874 OpBuffer[obp++]=(char)0x05;
875 }
876 }
877 break;
878 }
879 }
880
881 //jmp ...
882 OpBuffer[obp++]=(char)0xE9;
883 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
884 obp+=sizeof(long);
885
886 //jmp ...
887 OpBuffer[obp++]=(char)0xE9;
888 int je_schedule=obp;
889 obp+=sizeof(long);
890
891 //レキシカルスコープをレベルダウン
892 GetLexicalScopes().End();
893
894 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jmpジャンプ先のオフセット値
895
896
897 //Continueアドレスを復元
898 dwContinueAddress=dwTempContinue;
899}
900void OpcodeContinue(void){
901 extern DWORD dwContinueAddress;
902
903 if(dwContinueAddress==-1){
904 SetError(12,"Continue",cp);
905 return;
906 }
907
908 //jmp ...(Continue addr)
909 OpBuffer[obp++]=(char)0xE9;
910
911 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
912 obp+=sizeof(long);
913}
914
915void OpcodeExitSub(void){
916 extern DWORD *pExitSubSchedule;
917 extern int ExitSubScheduleNum;
918 extern HANDLE hHeap;
919
920 if( UserProc::IsGlobalAreaCompiling() ){
921 SetError(12,"Exit Sub/Function",cp);
922 return;
923 }
924
925 //未解放のローカルオブジェクトのデストラクタを呼び出す
926 GetLexicalScopes().CallDestructorsOfReturn();
927
928 //jmp ...(End Sub/Function)
929 OpBuffer[obp++]=(char)0xE9;
930
931 pExitSubSchedule=(DWORD *)HeapReAlloc(hHeap,0,pExitSubSchedule,(ExitSubScheduleNum+1)*sizeof(DWORD));
932 pExitSubSchedule[ExitSubScheduleNum]=obp;
933 ExitSubScheduleNum++;
934
935 obp+=sizeof(long);
936}
937
938void AddCaseSchedule(void){
939 extern DWORD *pCaseSchedule;
940 extern int CaseScheduleNum;
941 extern HANDLE hHeap;
942
943 pCaseSchedule=(DWORD *)HeapReAlloc(hHeap,0,pCaseSchedule,(CaseScheduleNum+1)*sizeof(DWORD));
944 pCaseSchedule[CaseScheduleNum]=obp;
945 CaseScheduleNum++;
946}
947
948int CaseTypeSize;
949void OpcodeSelect(const char *lpszParms){
950 extern DWORD *pCaseSchedule;
951 extern int CaseScheduleNum;
952 extern int NowCaseSchedule;
953 extern int CaseTypeSize;
954 extern HANDLE hHeap;
955 extern char *basbuf;
956 int i,i2,i3,sw,NowCaseCp;
957 char temporary[VN_SIZE];
958
959 DWORD *temp_pCaseSchedule;
960 int temp_CaseScheduleNum;
961 int temp_NowCaseSchedule;
962 int temp_CaseTypeSize;
963
964 temp_pCaseSchedule=pCaseSchedule;
965 temp_CaseScheduleNum=CaseScheduleNum;
966 temp_NowCaseSchedule=NowCaseSchedule;
967 temp_CaseTypeSize=CaseTypeSize;
968 pCaseSchedule=(DWORD *)HeapAlloc(hHeap,0,1);
969 CaseScheduleNum=0;
970 NowCaseSchedule=0;
971
972 Type type1;
973 if( !NumOpe(lpszParms,Type(), type1 ) ){
974 return;
975 }
976
977 CaseTypeSize = type1.GetSize();
978 if( CaseTypeSize < sizeof(long) ){
979 CaseTypeSize=sizeof(long);
980 }
981
982 for(i=cp,sw=0;;i++){
983 if(basbuf[i]=='\0'){
984 HeapDefaultFree(pCaseSchedule);
985 pCaseSchedule=temp_pCaseSchedule;
986 CaseScheduleNum=temp_CaseScheduleNum;
987 NowCaseSchedule=temp_NowCaseSchedule;
988 CaseTypeSize=temp_CaseTypeSize;
989 SetError(22,"Select",cp);
990 return;
991 }
992 if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE){
993 for(i2=0;;i++){
994 if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE) i2++;
995 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
996 i2--;
997 if(i2==0) break;
998 }
999 }
1000 continue;
1001 }
1002 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
1003 if(sw==0){
1004 //add esp,CaseTypeSize
1005 compiler.codeGenerator.op_add_esp(CaseTypeSize);
1006 }
1007 break;
1008 }
1009 if(basbuf[i]==1&&basbuf[i+1]==ESC_CASE){
1010 NowCaseCp=i;
1011
1012 i++;
1013 while(1){
1014 for(i++,i2=0;;i++,i2++){
1015 if(basbuf[i]=='\"'){
1016 i3=GetStringInQuotation(temporary+i2,basbuf+i);
1017 i+=i3-1;
1018 i2+=i3-1;
1019 continue;
1020 }
1021 if(basbuf[i]=='('){
1022 i3=GetStringInPare(temporary+i2,basbuf+i);
1023 i+=i3-1;
1024 i2+=i3-1;
1025 continue;
1026 }
1027 if(basbuf[i]=='['){
1028 i3=GetStringInBracket(temporary+i2,basbuf+i);
1029 i+=i3-1;
1030 i2+=i3-1;
1031 continue;
1032 }
1033
1034 if(IsCommandDelimitation(basbuf[i])){
1035 temporary[i2]=0;
1036 break;
1037 }
1038 if(basbuf[i]==','){
1039 temporary[i2]=0;
1040 break;
1041 }
1042
1043 temporary[i2]=basbuf[i];
1044 }
1045
1046 //エラー用
1047 i2=cp;
1048 cp=NowCaseCp;
1049
1050 Type type2;
1051 if( !NumOpe(temporary,type1,type2) ){
1052 return;
1053 }
1054
1055 cp=i2;
1056
1057 if(type1.IsObject()){
1058 std::vector<const UserProc *> subs;
1059 type1.GetClass().GetMethods().Enum( CALC_EQUAL, subs );
1060 if( subs.size() == 0 ){
1061 return;
1062 }
1063
1064 Parameters params;
1065 params.push_back( new Parameter( "", Type( type2 ) ) );
1066
1067 //オーバーロードを解決
1068 const UserProc *pUserProc = OverloadSolution("==",subs, params, NULL);
1069
1070 delete params[0];
1071
1072 if(!pUserProc){
1073 //エラー
1074 return;
1075 }
1076
1077
1078 //pop edx
1079 compiler.codeGenerator.op_pop(REG_EDX);
1080
1081 //mov ecx,dword ptr[esp]
1082 compiler.codeGenerator.op_mov_RM(sizeof(long),REG_ECX,REG_ESP,0,MOD_BASE);
1083
1084 //push edx
1085 compiler.codeGenerator.op_push(REG_EDX);
1086
1087 //push ecx
1088 compiler.codeGenerator.op_push(REG_ECX);
1089
1090 //call operator_proc ※ ==演算子
1091 compiler.codeGenerator.op_call(pUserProc);
1092
1093 //test eax,eax
1094 compiler.codeGenerator.op_test(REG_EAX,REG_EAX);
1095
1096 //jne ...
1097 OpBuffer[obp++]=(char)0x0F;
1098 OpBuffer[obp++]=(char)0x85;
1099 AddCaseSchedule();
1100 obp+=sizeof(long);
1101 }
1102 else if(type1.IsDouble()){
1103 ChangeTypeToDouble(type2.GetBasicType());
1104
1105 //fld qword ptr[esp]
1106 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE);
1107
1108 //add esp,CaseTypeSize
1109 compiler.codeGenerator.op_add_esp(CaseTypeSize);
1110
1111 //fld qword ptr[esp]
1112 compiler.codeGenerator.op_fld_ptr_esp(DEF_DOUBLE);
1113
1114 //fcompp
1115 compiler.codeGenerator.op_fcompp();
1116
1117 //fnstsw ax
1118 compiler.codeGenerator.op_fnstsw_ax();
1119
1120 //test ah,40
1121 compiler.codeGenerator.op_test_ah( (char)0x40 );
1122
1123 //jne ...
1124 OpBuffer[obp++]=(char)0x0F;
1125 OpBuffer[obp++]=(char)0x85;
1126 AddCaseSchedule();
1127 obp+=sizeof(long);
1128 }
1129 else if(type1.IsSingle()){
1130 ChangeTypeToSingle(type2.GetBasicType());
1131
1132 //fld dword ptr[esp]
1133 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE);
1134
1135 //add esp,CaseTypeSize
1136 compiler.codeGenerator.op_add_esp(CaseTypeSize);
1137
1138 //fld dword ptr[esp]
1139 compiler.codeGenerator.op_fld_ptr_esp(DEF_SINGLE);
1140
1141 //fcompp
1142 compiler.codeGenerator.op_fcompp();
1143
1144 //fnstsw ax
1145 compiler.codeGenerator.op_fnstsw_ax();
1146
1147 //test ah,40
1148 compiler.codeGenerator.op_test_ah( (char)0x40 );
1149
1150 //jne ...
1151 OpBuffer[obp++]=(char)0x0F;
1152 OpBuffer[obp++]=(char)0x85;
1153 AddCaseSchedule();
1154 obp+=sizeof(long);
1155 }
1156 else{
1157 //その他整数型
1158
1159 //pop ebx
1160 compiler.codeGenerator.op_pop(REG_EBX);
1161
1162 //mov eax,dword ptr[esp]
1163 OpBuffer[obp++]=(char)0x8B;
1164 OpBuffer[obp++]=(char)0x04;
1165 OpBuffer[obp++]=(char)0x24;
1166
1167 //cmp eax,ebx
1168 compiler.codeGenerator.op_cmp_RR( REG_EAX, REG_EBX );
1169
1170 //je ...
1171 OpBuffer[obp++]=(char)0x0F;
1172 OpBuffer[obp++]=(char)0x84;
1173 AddCaseSchedule();
1174 obp+=sizeof(long);
1175 }
1176
1177 if(basbuf[i]!=',') break;
1178 }
1179 }
1180 if(basbuf[i]==1&&basbuf[i+1]==ESC_CASEELSE){
1181 sw=1;
1182
1183 //jmp ...
1184 OpBuffer[obp++]=(char)0xE9;
1185 AddCaseSchedule();
1186 obp+=sizeof(long);
1187 }
1188 }
1189
1190 //レキシカルスコープをレベルアップ
1191 GetLexicalScopes().Start( obp, SCOPE_TYPE_SELECT );
1192
1193 //Select Case内をコンパイル
1194 CompileBuffer(ESC_ENDSELECT,0);
1195
1196 //jmp EndSelect
1197 OpBuffer[obp++]=(char)0xE9;
1198 AddCaseSchedule();
1199 obp+=sizeof(long);
1200
1201 //最終スケジュール
1202 for(i=NowCaseSchedule;i<CaseScheduleNum;i++){
1203 *(long *)(OpBuffer+pCaseSchedule[i])=obp-(pCaseSchedule[i]+sizeof(long));
1204 }
1205 HeapDefaultFree(pCaseSchedule);
1206
1207 //レキシカルスコープをレベルダウン
1208 GetLexicalScopes().End();
1209
1210 pCaseSchedule=temp_pCaseSchedule;
1211 CaseScheduleNum=temp_CaseScheduleNum;
1212 NowCaseSchedule=temp_NowCaseSchedule;
1213 CaseTypeSize=temp_CaseTypeSize;
1214}
1215void OpcodeCase(char *Parameter){
1216 extern DWORD *pCaseSchedule;
1217 extern int NowCaseSchedule;
1218 extern int CaseTypeSize;
1219 int i;
1220
1221 if(!pCaseSchedule){
1222 SetError(30,"Case",cp);
1223 return;
1224 }
1225
1226 //jmp EndSelect
1227 OpBuffer[obp++]=(char)0xE9;
1228 AddCaseSchedule();
1229 obp+=sizeof(long);
1230
1231 i=0;
1232 while(1){
1233 //Caseスケジュール
1234 *(long *)(OpBuffer+pCaseSchedule[NowCaseSchedule])=obp-(pCaseSchedule[NowCaseSchedule]+sizeof(long));
1235 NowCaseSchedule++;
1236
1237 i=JumpOneParameter(Parameter,i);
1238 if(Parameter[i]=='\0') break;
1239 }
1240
1241 //add esp,CaseTypeSize
1242 compiler.codeGenerator.op_add_esp(CaseTypeSize);
1243}
1244
1245void OpcodeGosub(char *Parameter){
1246 extern HANDLE hHeap;
1247 extern GOTOLABELSCHEDULE *pGotoLabelSchedule;
1248 extern int GotoLabelScheduleNum;
1249 int i,LineNum;
1250
1251 if(Parameter[0]=='*'){
1252 i=GetLabelAddress(Parameter+1,0);
1253
1254 //call ...
1255 OpBuffer[obp++]=(char)0xE8;
1256 if(i==-1){
1257 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
1258 pGotoLabelSchedule[GotoLabelScheduleNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Parameter+1)+1);
1259 lstrcpy(pGotoLabelSchedule[GotoLabelScheduleNum].pName,Parameter+1);
1260 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
1261 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
1262 GotoLabelScheduleNum++;
1263 }
1264 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
1265 obp+=sizeof(long);
1266 }
1267 else{
1268 LineNum=atoi(Parameter);
1269 i=GetLabelAddress(0,LineNum);
1270
1271 //call ...
1272 OpBuffer[obp++]=(char)0xE8;
1273 if(i==-1){
1274 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
1275 pGotoLabelSchedule[GotoLabelScheduleNum].pName=0;
1276 pGotoLabelSchedule[GotoLabelScheduleNum].line=LineNum;
1277 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
1278 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
1279 GotoLabelScheduleNum++;
1280 }
1281 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
1282 obp+=sizeof(long);
1283 }
1284}
1285void OpcodeReturn(char *Parameter){
1286 if( UserProc::IsGlobalAreaCompiling() ){
1287 //Gosub~Returnとして扱う
1288
1289 //ret
1290 compiler.codeGenerator.op_ret();
1291 }
1292 else{
1293 //戻り値をセット
1294 if(Parameter[0]){
1295 const UserProc &proc = UserProc::CompilingUserProc();
1296
1297 const char *temp = "_System_ReturnValue";
1298 if(proc.GetName()[0]==1&&proc.GetName()[1]==ESC_OPERATOR)
1299 {
1300 }
1301 else{
1302 temp=proc.GetName().c_str();
1303 }
1304
1305 char temporary[VN_SIZE];
1306 sprintf(temporary,"%s=%s",temp,Parameter);
1307 OpcodeCalc(temporary);
1308 }
1309
1310 //プロシージャを抜け出す(C言語のreturnと同様の処理を行う)
1311 OpcodeExitSub();
1312 }
1313}
1314
1315
1316////////////
1317// ポインタ
1318
1319void OpcodeSetPtrData(char *Parameter,int type){
1320 int i;
1321 char temporary[VN_SIZE];
1322
1323 if(Parameter[0]=='('){
1324 i=JumpStringInPare(Parameter,1);
1325 if(Parameter[i+1]=='\0'){
1326 for(i=0;;i++){
1327 Parameter[i]=Parameter[i+1];
1328 if(Parameter[i]=='\0') break;
1329 }
1330 Parameter[i-1]=0;
1331 }
1332 }
1333
1334 //第1パラメータを取得
1335 i=GetOneParameter(Parameter,0,temporary);
1336 if(!Parameter[i]){
1337 SetError(1,NULL,cp);
1338 return;
1339 }
1340
1341 Type resultType;
1342 if( !NumOpe(temporary,Type(),resultType) ){
1343 return;
1344 }
1345 if(!resultType.IsWhole()){
1346 SetError(11,Parameter,cp);
1347 return;
1348 }
1349
1350 ChangeTypeToLong( resultType.GetBasicType() );
1351
1352 //第2パラメータを取得
1353 i=GetOneParameter(Parameter,i,temporary);
1354 if(Parameter[i]){
1355 SetError(1,NULL,cp);
1356 return;
1357 }
1358
1359 if( !NumOpe(temporary,Type(),resultType) ){
1360 return;
1361 }
1362
1363 if(type==DEF_DOUBLE){
1364 ChangeTypeToDouble_ToFpuReg( resultType.GetBasicType() );
1365
1366 //pop eax
1367 compiler.codeGenerator.op_pop(REG_EAX);
1368
1369 //fstp qword ptr[eax]
1370 OpBuffer[obp++]=(char)0xDD;
1371 OpBuffer[obp++]=(char)0x18;
1372 }
1373 else if(type==DEF_SINGLE){
1374 ChangeTypeToSingle( resultType.GetBasicType() );
1375
1376 //pop ebx
1377 compiler.codeGenerator.op_pop(REG_EBX);
1378
1379 //pop eax
1380 compiler.codeGenerator.op_pop(REG_EAX);
1381
1382 //mov dword ptr[eax],ebx
1383 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EBX, REG_EAX, 0, MOD_BASE );
1384 }
1385 else if(type==DEF_QWORD){
1386 ChangeTypeToInt64( resultType.GetBasicType() );
1387
1388 //pop ecx
1389 compiler.codeGenerator.op_pop(REG_ECX);
1390
1391 //pop ebx
1392 compiler.codeGenerator.op_pop(REG_EBX);
1393
1394 //pop eax
1395 compiler.codeGenerator.op_pop(REG_EAX);
1396
1397 //mov dword ptr[eax],ecx
1398 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_ECX, REG_EAX, 0, MOD_BASE );
1399
1400 //mov dword ptr[eax+sizeof(long)],ebx
1401 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EBX, REG_EAX, 0x04, MOD_BASE_DISP8 );
1402 }
1403 else if(type==DEF_DWORD){
1404 ChangeTypeToLong( resultType.GetBasicType() );
1405
1406 //pop ebx
1407 compiler.codeGenerator.op_pop(REG_EBX);
1408
1409 //pop eax
1410 compiler.codeGenerator.op_pop(REG_EAX);
1411
1412 //mov dword ptr[eax],ebx
1413 compiler.codeGenerator.op_mov_MR( sizeof(long), REG_EBX, REG_EAX, 0, MOD_BASE );
1414 }
1415 else if(type==DEF_WORD){
1416 ChangeTypeToLong( resultType.GetBasicType() );
1417
1418 //pop ebx
1419 compiler.codeGenerator.op_pop(REG_EBX);
1420
1421 //pop eax
1422 compiler.codeGenerator.op_pop(REG_EAX);
1423
1424 //mov word ptr[eax],bx
1425 OpBuffer[obp++]=(char)0x66;
1426 OpBuffer[obp++]=(char)0x89;
1427 OpBuffer[obp++]=(char)0x18;
1428 }
1429 else if(type==DEF_BYTE){
1430 ChangeTypeToLong( resultType.GetBasicType() );
1431
1432 //pop ebx
1433 compiler.codeGenerator.op_pop(REG_EBX);
1434
1435 //pop eax
1436 compiler.codeGenerator.op_pop(REG_EAX);
1437
1438 //mov byte ptr[eax],bl
1439 OpBuffer[obp++]=(char)0x88;
1440 OpBuffer[obp++]=(char)0x18;
1441 }
1442}
Note: See TracBrowser for help on using the repository browser.