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

Last change on this file since 218 was 206, checked in by dai_9181, 17 years ago

コード全体のリファクタリングを実施

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