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

Last change on this file since 204 was 183, checked in by dai_9181, 17 years ago
File size: 30.9 KB
Line 
1#include <jenga/include/smoothie/LexicalAnalysis.h>
2
3#include <LexicalScopingImpl.h>
4#include <Compiler.h>
5
6#include "../BasicCompiler_Common/common.h"
7#include "Opcode.h"
8
9void OpcodeOthers( const char *Command ){
10 int i,i2;
11 UserProc *pUserProc;
12
13 char leftTerm[8192];
14 int lastParePos = 0;
15 for(i=0;;i++){
16 if(Command[i]=='\"'){
17 //ダブルクォートは不正なのでエラー扱い
18 leftTerm[i]=0;
19 SetError(3,leftTerm,cp);
20 return;
21 }
22
23 if(Command[i]=='('){
24 lastParePos = i;
25 i2=GetStringInPare(leftTerm+i,Command+i);
26 i+=i2-1;
27 continue;
28 }
29 if(Command[i]=='['){
30 i2=GetStringInBracket(leftTerm+i,Command+i);
31 i+=i2-1;
32 continue;
33 }
34 if(Command[i]=='\0'){
35 leftTerm[i] = 0;
36 break;
37 }
38
39 if( IsNumCalcMark( Command, i ) ){
40 leftTerm[i] = 0;
41 break;
42 }
43
44 leftTerm[i]=Command[i];
45 }
46 if(!(
47 IsVariableTopChar(leftTerm[0])||
48 leftTerm[0]=='.'||
49 (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM)
50 )){
51 SetError(1,NULL,cp);
52 return;
53 }
54
55
56 if(Command[i]=='\0' && lastParePos == 0){
57 //////////////////////////////
58 // パラメータ無しのマクロ検索
59 //////////////////////////////
60
61 pUserProc=GetSubHash(Command);
62
63 //GetSubHash内でエラー提示が行われた場合
64 if(pUserProc==(UserProc *)-1) return;
65
66 if(pUserProc==0){
67 char temporary[VN_SIZE];
68 lstrcpy(temporary,Command);
69
70 CharUpper(temporary);
71 pUserProc=GetSubHash(temporary);
72
73 //GetSubHash内でエラー提示が行われた場合
74 if(pUserProc==(UserProc *)-1) return;
75 }
76
77 if(pUserProc){
78 if( !pUserProc->IsMacro() ){
79 SetError(10,Command,cp);
80 }
81
82 Opcode_CallProc("",pUserProc,0,"",0);
83
84 return;
85 }
86 }
87 else if(IsNumCalcMark(Command,i)){
88 //代入演算
89 OpcodeCalc(Command);
90 return;
91 }
92
93
94 Type resultType;
95 bool isLiteral;
96 BOOL bUseHeap;
97 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
98 if( result ){
99
100 /////////////////////
101 // 戻り値の処理
102 /////////////////////
103
104 if( resultType.IsReal() ){
105 //fstp st(0)
106 OpBuffer[obp++]=(char)0xDD;
107 OpBuffer[obp++]=(char)0xD8;
108 }
109 else if( resultType.IsStruct() ){
110 //mov ebx,eax
111 op_mov_RR(REG_EBX,REG_EAX);
112
113 FreeTempObject(REG_EBX,&resultType.GetClass());
114 }
115
116 //成功
117 return;
118 }
119
120 // 失敗
121 SetError(1, NULL,cp);
122}
123
124void OpcodeIf(char *Parameter){
125 int i,i2,i3,i4;
126 Type tempType;
127
128 for(i=0;;i++){
129 if(Parameter[i]=='\0'){
130 SetError(21,NULL,cp);
131 return;
132 }
133 if(Parameter[i]==1&&Parameter[i+1]==ESC_THEN){
134 Parameter[i]=0;
135 break;
136 }
137 }
138
139 if( !NumOpe(Parameter,Type(),tempType) ){
140 //NumOpe内でエラー
141 i3=-1; //ダミー
142 }
143 else if( tempType.IsDouble() ){
144 //fld qword ptr[esp]
145 op_fld_ptr_esp(DEF_DOUBLE);
146
147 //push 0
148 op_push_V(0);
149
150 //fild dword ptr[esp]
151 op_fld_ptr_esp(DEF_LONG);
152
153 //add esp,sizeof(double)+sizeof(long)
154 op_add_esp(sizeof(double)+sizeof(long));
155
156 //fcompp
157 OpBuffer[obp++]=(char)0xDE;
158 OpBuffer[obp++]=(char)0xD9;
159
160 //fnstsw ax
161 OpBuffer[obp++]=(char)0xDF;
162 OpBuffer[obp++]=(char)0xE0;
163
164 //test ah,40
165 OpBuffer[obp++]=(char)0xF6;
166 OpBuffer[obp++]=(char)0xC4;
167 OpBuffer[obp++]=(char)0x40;
168
169 //jne (endif、または else まで)
170 OpBuffer[obp++]=(char)0x0F;
171 OpBuffer[obp++]=(char)0x85;
172 obp+=sizeof(long);
173
174 //jneの番地
175 i3=obp;
176 }
177 else if( tempType.IsSingle() ){
178 //fld dword ptr[esp]
179 op_fld_ptr_esp(DEF_SINGLE);
180
181 //push 0
182 op_push_V(0);
183
184 //fild dword ptr[esp]
185 op_fld_ptr_esp(DEF_LONG);
186
187 //add esp,sizeof(float)+sizeof(long)
188 op_add_esp(sizeof(float)+sizeof(long));
189
190 //fcompp
191 OpBuffer[obp++]=(char)0xDE;
192 OpBuffer[obp++]=(char)0xD9;
193
194 //fnstsw ax
195 OpBuffer[obp++]=(char)0xDF;
196 OpBuffer[obp++]=(char)0xE0;
197
198 //test ah,40
199 OpBuffer[obp++]=(char)0xF6;
200 OpBuffer[obp++]=(char)0xC4;
201 OpBuffer[obp++]=(char)0x40;
202
203 //jne (endif、または else まで)
204 OpBuffer[obp++]=(char)0x0F;
205 OpBuffer[obp++]=(char)0x85;
206 obp+=sizeof(long);
207
208 //jneの番地
209 i3=obp;
210 }
211 else if( tempType.Is64() ){
212 //64ビット型
213
214 //pop eax
215 op_pop(REG_EAX);
216
217 //pop ebx
218 op_pop(REG_EBX);
219
220 //cmp eax,0
221 OpBuffer[obp++]=(char)0x83;
222 OpBuffer[obp++]=(char)0xF8;
223 OpBuffer[obp++]=(char)0x00;
224
225 //jne
226 OpBuffer[obp++]=(char)0x0F;
227 OpBuffer[obp++]=(char)0x85;
228 obp+=sizeof(long);
229 i3=obp;
230
231
232 //cmp ebx,0
233 OpBuffer[obp++]=(char)0x83;
234 OpBuffer[obp++]=(char)0xFB;
235 OpBuffer[obp++]=(char)0x00;
236
237 //jne
238 OpBuffer[obp++]=(char)0x0F;
239 OpBuffer[obp++]=(char)0x85;
240 obp+=sizeof(long);
241 i4=obp;
242
243
244
245 //jmp (endif、または else までジャンプ)
246 OpBuffer[obp++]=(char)0xE9;
247 obp+=sizeof(long);
248
249 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;
250 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
251
252 //jmpの番地
253 i3=obp;
254 }
255 else{
256 //32ビット型
257
258 //pop eax
259 op_pop(REG_EAX);
260
261 //cmp eax,0
262 OpBuffer[obp++]=(char)0x83;
263 OpBuffer[obp++]=(char)0xF8;
264 OpBuffer[obp++]=(char)0x00;
265
266 //je (endif、または else まで条件ジャンプ)
267 OpBuffer[obp++]=(char)0x0F;
268 OpBuffer[obp++]=(char)0x84;
269 obp+=sizeof(long);
270
271 //jeの番地
272 i3=obp;
273 }
274
275
276 /////////////////////////
277 // If内をコード化
278 /////////////////////////
279
280 //レキシカルスコープをレベルアップ
281 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF );
282
283 i2=CompileBuffer(ESC_ENDIF,0);
284
285 //レキシカルスコープをレベルダウン
286 GetLexicalScopes().End();
287
288
289 if(i3==-1) return;
290
291 if(i2==ESC_ELSE){
292 //jmp (endifまで)
293 OpBuffer[obp++]=(char)0xE9;
294 obp+=sizeof(long);
295
296 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //ifからelseへのジャンプ先のオフセット値
297
298 i3=obp;
299
300
301 /////////////////////////
302 // Else内をコード化
303 /////////////////////////
304
305 //レキシカルスコープをレベルアップ
306 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF );
307
308 CompileBuffer(ESC_ENDIF,0);
309
310 //レキシカルスコープをレベルダウン
311 GetLexicalScopes().End();
312
313
314 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //jmpジャンプ先のオフセット値
315 }
316 else{
317 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3; //jeジャンプ先のオフセット値
318 }
319}
320
321int GetLabelAddress(char *LabelName,int LineNum){
322 extern int MaxLabelNum;
323 extern LABEL *pLabelNames;
324 int i;
325
326 if(LabelName){
327 for(i=0;i<MaxLabelNum;i++){
328 if(pLabelNames[i].pName){
329 if(lstrcmp(LabelName,pLabelNames[i].pName)==0) return pLabelNames[i].address;
330 }
331 }
332 }
333 else{
334 for(i=0;i<MaxLabelNum;i++){
335 if(pLabelNames[i].pName==0){
336 if(LineNum==pLabelNames[i].line) return pLabelNames[i].address;
337 }
338 }
339 }
340 return -1;
341}
342void OpcodeGoto(char *Parameter){
343 extern HANDLE hHeap;
344 extern GOTOLABELSCHEDULE *pGotoLabelSchedule;
345 extern int GotoLabelScheduleNum;
346 int i,LineNum;
347
348 if(Parameter[0]=='*'){
349 i=GetLabelAddress(Parameter+1,0);
350
351 //jmp ...
352 OpBuffer[obp++]=(char)0xE9;
353 if(i==-1){
354 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
355 pGotoLabelSchedule[GotoLabelScheduleNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Parameter+1)+1);
356 lstrcpy(pGotoLabelSchedule[GotoLabelScheduleNum].pName,Parameter+1);
357 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
358 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
359 GotoLabelScheduleNum++;
360 }
361 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
362 obp+=sizeof(long);
363 }
364 else{
365 LineNum=atoi(Parameter);
366 i=GetLabelAddress(0,LineNum);
367
368 //jmp ...
369 OpBuffer[obp++]=(char)0xE9;
370 if(i==-1){
371 pGotoLabelSchedule=(GOTOLABELSCHEDULE *)HeapReAlloc(hHeap,0,pGotoLabelSchedule,(GotoLabelScheduleNum+1)*sizeof(GOTOLABELSCHEDULE));
372 pGotoLabelSchedule[GotoLabelScheduleNum].pName=0;
373 pGotoLabelSchedule[GotoLabelScheduleNum].line=LineNum;
374 pGotoLabelSchedule[GotoLabelScheduleNum].pos=obp;
375 pGotoLabelSchedule[GotoLabelScheduleNum].now_cp=cp;
376 GotoLabelScheduleNum++;
377 }
378 *((long *)(OpBuffer+obp))=i-(obp+sizeof(long));
379 obp+=sizeof(long);
380 }
381}
382void OpcodeWhile(char *Parameter){
383 extern HANDLE hHeap;
384 int i2,i3 = 0;
385
386 //Continueアドレスのバックアップとセット
387 extern DWORD dwContinueAddress;
388 DWORD dwTempContinue;
389 dwTempContinue=dwContinueAddress;
390 dwContinueAddress=obp;
391
392 if(!Parameter[0]) SetError(10,"While",cp);
393
394 int je_schedule;
395 Type tempType;
396 if( !NumOpe(Parameter,Type(),tempType) ){
397 //ダミー
398 i3=-1;
399 }
400 else if( tempType.IsDouble() ){
401 //fld qword ptr[esp]
402 op_fld_ptr_esp(DEF_DOUBLE);
403
404 //push 0
405 op_push_V(0);
406
407 //fild dword ptr[esp]
408 op_fld_ptr_esp(DEF_LONG);
409
410 //add esp,sizeof(double)+sizeof(long)
411 op_add_esp(sizeof(double)+sizeof(long));
412
413 //fcompp
414 OpBuffer[obp++]=(char)0xDE;
415 OpBuffer[obp++]=(char)0xD9;
416
417 //fnstsw ax
418 OpBuffer[obp++]=(char)0xDF;
419 OpBuffer[obp++]=(char)0xE0;
420
421 //test ah,40
422 OpBuffer[obp++]=(char)0xF6;
423 OpBuffer[obp++]=(char)0xC4;
424 OpBuffer[obp++]=(char)0x40;
425
426 //jne (Wend まで)
427 OpBuffer[obp++]=(char)0x0F;
428 OpBuffer[obp++]=(char)0x85;
429 obp+=sizeof(long);
430
431 //jeの番地
432 je_schedule=obp;
433 }
434 else if( tempType.IsSingle() ){
435 //fld dword ptr[esp]
436 op_fld_ptr_esp(DEF_SINGLE);
437
438 //push 0
439 op_push_V(0);
440
441 //fild dword ptr[esp]
442 op_fld_ptr_esp(DEF_LONG);
443
444 //add esp,sizeof(float)+sizeof(long)
445 op_add_esp(sizeof(float)+sizeof(long));
446
447 //fcompp
448 OpBuffer[obp++]=(char)0xDE;
449 OpBuffer[obp++]=(char)0xD9;
450
451 //fnstsw ax
452 OpBuffer[obp++]=(char)0xDF;
453 OpBuffer[obp++]=(char)0xE0;
454
455 //test ah,40
456 OpBuffer[obp++]=(char)0xF6;
457 OpBuffer[obp++]=(char)0xC4;
458 OpBuffer[obp++]=(char)0x40;
459
460 //jne (Wend まで)
461 OpBuffer[obp++]=(char)0x0F;
462 OpBuffer[obp++]=(char)0x85;
463 obp+=sizeof(long);
464
465 //jeの番地
466 je_schedule=obp;
467 }
468 else if( tempType.Is64() ){
469 //64ビット型
470
471 //pop eax
472 op_pop(REG_EAX);
473
474 //pop ebx
475 op_pop(REG_EBX);
476
477 //cmp eax,0
478 OpBuffer[obp++]=(char)0x83;
479 OpBuffer[obp++]=(char)0xF8;
480 OpBuffer[obp++]=(char)0x00;
481
482 //jne
483 OpBuffer[obp++]=(char)0x0F;
484 OpBuffer[obp++]=(char)0x85;
485 obp+=sizeof(long);
486 i2=obp;
487
488
489 //cmp ebx,0
490 OpBuffer[obp++]=(char)0x83;
491 OpBuffer[obp++]=(char)0xFB;
492 OpBuffer[obp++]=(char)0x00;
493
494 //jne
495 OpBuffer[obp++]=(char)0x0F;
496 OpBuffer[obp++]=(char)0x85;
497 obp+=sizeof(long);
498 i3=obp;
499
500
501 //jmp (endif、または else までジャンプ)
502 OpBuffer[obp++]=(char)0xE9;
503 obp+=sizeof(long);
504
505 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
506 *((long *)(OpBuffer+i3-sizeof(long)))=obp-i3;
507
508 //jmpの番地
509 je_schedule=obp;
510 }
511 else{
512 //その他整数型
513
514 //pop eax
515 op_pop(REG_EAX);
516
517 //cmp eax,0
518 OpBuffer[obp++]=(char)0x83;
519 OpBuffer[obp++]=(char)0xF8;
520 OpBuffer[obp++]=(char)0x00;
521
522 //je (Wend まで)
523 OpBuffer[obp++]=(char)0x0F;
524 OpBuffer[obp++]=(char)0x84;
525 obp+=sizeof(long);
526
527 //実行中の番地
528 je_schedule=obp;
529 }
530
531 //レキシカルスコープをレベルアップ
532 GetLexicalScopes().Start( obp, SCOPE_TYPE_WHILE );
533
534 //While内をコンパイル
535 CompileBuffer(0,COM_WEND);
536
537 GetLexicalScopes().CallDestructorsOfScopeEnd();
538
539 if( i3 == -1 ){
540 return;
541 }
542
543 //jmp ...
544 OpBuffer[obp++]=(char)0xE9;
545 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
546 obp+=sizeof(long);
547
548 //レキシカルスコープをレベルダウン
549 GetLexicalScopes().End();
550
551 *((long *)(OpBuffer+je_schedule-sizeof(long)))=obp-je_schedule; //jeジャンプ先のオフセット値
552
553 //Continueアドレスを復元
554 dwContinueAddress=dwTempContinue;
555}
556
557char szNextVariable[VN_SIZE];
558void OpcodeFor(char *Parameter){
559 extern HANDLE hHeap;
560 int i,i2,i3;
561 char temporary[VN_SIZE],variable[VN_SIZE],JudgeNum[VN_SIZE],StepNum[VN_SIZE];
562
563 //第1パラメータを取得
564 i=GetOneParameter(Parameter,0,temporary);
565 if(!Parameter[i]){
566 SetError(12,"For",cp);
567 goto ErrorStep;
568 }
569
570 for(i2=0;;i2++){
571 if(temporary[i2]=='='){
572 variable[i2]=0;
573
574 //カウンタ初期化
575 OpcodeCalc(temporary);
576 break;
577 }
578 if(temporary[i2]=='\0'){
579 SetError(12,"For",cp);
580 goto ErrorStep;
581 }
582 variable[i2]=temporary[i2];
583 }
584
585 //jmp ...
586 OpBuffer[obp++]=(char)0xE9;
587 i2=obp;
588 obp+=sizeof(long);
589
590 //Continueアドレスのバックアップとセット
591 extern DWORD dwContinueAddress;
592 DWORD dwTempContinue;
593 dwTempContinue=dwContinueAddress;
594 dwContinueAddress=obp;
595
596 //第2パラメータを取得(to~)
597 i=GetOneParameter(Parameter,i,JudgeNum);
598
599 //第3パラメータを取得(step~)
600 if(Parameter[i]){
601 i=GetOneParameter(Parameter,i,StepNum);
602 if(Parameter[i]) SetError(12,"For",cp);
603 }
604 else lstrcpy(StepNum,"1");
605
606 //カウンタを増加させる
607 sprintf(temporary,"%s=(%s)+(%s)",variable,variable,StepNum);
608 OpcodeCalc(temporary);
609
610 *((long *)(OpBuffer+i2))=obp-(i2+sizeof(long));
611
612 //増加か減少かを区別する
613 sprintf(temporary,"(%s)>=0",StepNum);
614 NumOpe(temporary,Type(),Type());
615
616 //pop eax
617 op_pop(REG_EAX);
618
619 //cmp eax,0
620 OpBuffer[obp++]=(char)0x83;
621 OpBuffer[obp++]=(char)0xF8;
622 OpBuffer[obp++]=(char)0x00;
623
624 //je [カウンタ減少の場合の判定]
625 OpBuffer[obp++]=(char)0x0F;
626 OpBuffer[obp++]=(char)0x84;
627 i2=obp;
628 obp+=sizeof(long);
629
630 //判定(カウンタ増加の場合)
631 sprintf(temporary,"%s<=(%s)",variable,JudgeNum);
632 NumOpe(temporary,Type(),Type());
633
634 //pop eax
635 op_pop(REG_EAX);
636
637 //jmp [カウンタ減少の場合の判定を飛び越す]
638 OpBuffer[obp++]=(char)0xE9;
639 i3=obp;
640 obp+=sizeof(long);
641
642 *((long *)(OpBuffer+i2))=obp-(i2+sizeof(long)); //jeジャンプ先のオフセット値
643
644 //判定(カウンタ減少の場合)
645 sprintf(temporary,"%s>=(%s)",variable,JudgeNum);
646 NumOpe(temporary,Type(),Type());
647
648 //pop eax
649 op_pop(REG_EAX);
650
651 *((long *)(OpBuffer+i3))=obp-(i3+sizeof(long)); //jmpジャンプ先のオフセット値
652
653 //cmp eax,0
654 OpBuffer[obp++]=(char)0x83;
655 OpBuffer[obp++]=(char)0xF8;
656 OpBuffer[obp++]=(char)0x00;
657
658ErrorStep:
659
660 //je ...
661 OpBuffer[obp++]=(char)0x0F;
662 OpBuffer[obp++]=(char)0x84;
663 int je_schedule=obp;
664 obp+=sizeof(long);
665
666 //レキシカルスコープをレベルアップ
667 GetLexicalScopes().Start( obp, SCOPE_TYPE_FOR );
668
669 //For内をコンパイル
670 CompileBuffer(0,COM_NEXT);
671
672 GetLexicalScopes().CallDestructorsOfScopeEnd();
673
674 if(szNextVariable[0]){
675 if(lstrcmp(szNextVariable,variable)!=0){
676 SetError(55,szNextVariable,cp);
677 }
678 }
679
680 //jmp ...
681 OpBuffer[obp++]=(char)0xE9;
682 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
683 obp+=sizeof(long);
684
685 //レキシカルスコープをレベルダウン
686 GetLexicalScopes().End();
687
688 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jeジャンプ先のオフセット値
689
690 //Continueアドレスを復元
691 dwContinueAddress=dwTempContinue;
692}
693
694void OpcodeDo(char *Parameter){
695 extern HANDLE hHeap;
696 int i,i2,i3,i4;
697
698 if(Parameter[0]) SetError(10,"Do",cp);
699
700 //Continueアドレスのバックアップとセット
701 extern DWORD dwContinueAddress;
702 DWORD dwTempContinue;
703 dwTempContinue=dwContinueAddress;
704 dwContinueAddress=obp;
705
706 //レキシカルスコープをレベルアップ
707 GetLexicalScopes().Start( obp, SCOPE_TYPE_DO );
708
709 //Do内をコンパイル
710 CompileBuffer(0,COM_LOOP);
711
712 GetLexicalScopes().CallDestructorsOfScopeEnd();
713
714 extern char *basbuf;
715 char temporary[VN_SIZE];
716 for(i=cp-1;;i--){
717 if(IsCommandDelimitation(basbuf[i])){
718 i+=3;
719 if(!(basbuf[i]=='0'||basbuf[i]=='1')){
720 //無条件ループ
721 break;
722 }
723 i3=i;
724
725 for(i+=2,i2=0;;i++,i2++){
726 if(IsCommandDelimitation(basbuf[i])){
727 temporary[i2]=0;
728 break;
729 }
730 temporary[i2]=basbuf[i];
731 }
732
733 Type tempType;
734 NumOpe(temporary,Type(),tempType);
735
736 if( tempType.IsDouble() ){
737 //fld qword ptr[esp]
738 op_fld_ptr_esp(DEF_DOUBLE);
739
740 //push 0
741 op_push_V(0);
742
743 //fild dword ptr[esp]
744 op_fld_ptr_esp(DEF_LONG);
745
746 //add esp,sizeof(double)+sizeof(long)
747 op_add_esp(sizeof(double)+sizeof(long));
748
749 //fcompp
750 OpBuffer[obp++]=(char)0xDE;
751 OpBuffer[obp++]=(char)0xD9;
752
753 //fnstsw ax
754 OpBuffer[obp++]=(char)0xDF;
755 OpBuffer[obp++]=(char)0xE0;
756
757 //test ah,40
758 OpBuffer[obp++]=(char)0xF6;
759 OpBuffer[obp++]=(char)0xC4;
760 OpBuffer[obp++]=(char)0x40;
761
762 if(basbuf[i3]=='0'){
763 //While
764
765 //jne 5(ループ終了)
766 OpBuffer[obp++]=(char)0x75;
767 OpBuffer[obp++]=(char)0x05;
768 }
769 else if(basbuf[i3]=='1'){
770 //Until
771
772 //je 5(ループ終了)
773 OpBuffer[obp++]=(char)0x74;
774 OpBuffer[obp++]=(char)0x05;
775 }
776 }
777 else if( tempType.IsSingle() ){
778 //fld dword ptr[esp]
779 op_fld_ptr_esp(DEF_SINGLE);
780
781 //push 0
782 op_push_V(0);
783
784 //fild dword ptr[esp]
785 op_fld_ptr_esp(DEF_LONG);
786
787 //add esp,sizeof(float)+sizeof(long)
788 op_add_esp(sizeof(float)+sizeof(long));
789
790 //fcompp
791 OpBuffer[obp++]=(char)0xDE;
792 OpBuffer[obp++]=(char)0xD9;
793
794 //fnstsw ax
795 OpBuffer[obp++]=(char)0xDF;
796 OpBuffer[obp++]=(char)0xE0;
797
798 //test ah,40
799 OpBuffer[obp++]=(char)0xF6;
800 OpBuffer[obp++]=(char)0xC4;
801 OpBuffer[obp++]=(char)0x40;
802
803 if(basbuf[i3]=='0'){
804 //While
805
806 //jne 5(ループ終了)
807 OpBuffer[obp++]=(char)0x75;
808 OpBuffer[obp++]=(char)0x05;
809 }
810 else if(basbuf[i3]=='1'){
811 //Until
812
813 //je 5(ループ終了)
814 OpBuffer[obp++]=(char)0x74;
815 OpBuffer[obp++]=(char)0x05;
816 }
817 }
818 else if( tempType.Is64() ){
819 //64ビット型
820
821 //pop eax
822 op_pop(REG_EAX);
823
824 //pop ebx
825 op_pop(REG_EBX);
826
827 //cmp eax,0
828 OpBuffer[obp++]=(char)0x83;
829 OpBuffer[obp++]=(char)0xF8;
830 OpBuffer[obp++]=(char)0x00;
831
832 //jne
833 OpBuffer[obp++]=(char)0x0F;
834 OpBuffer[obp++]=(char)0x85;
835 obp+=sizeof(long);
836 i2=obp;
837
838
839 //cmp ebx,0
840 OpBuffer[obp++]=(char)0x83;
841 OpBuffer[obp++]=(char)0xFB;
842 OpBuffer[obp++]=(char)0x00;
843
844 //jne
845 OpBuffer[obp++]=(char)0x0F;
846 OpBuffer[obp++]=(char)0x85;
847 obp+=sizeof(long);
848 i4=obp;
849
850
851 if(basbuf[i3]=='0'){
852 //While
853
854 //jmp 5(ループ終了)
855 OpBuffer[obp++]=(char)0xEB;
856 OpBuffer[obp++]=(char)0x05;
857
858 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
859 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
860 }
861 else if(basbuf[i3]=='1'){
862 //Until
863
864 //jmp 2(ループを続ける)
865 OpBuffer[obp++]=(char)0xEB;
866 OpBuffer[obp++]=(char)0x02;
867
868 *((long *)(OpBuffer+i2-sizeof(long)))=obp-i2;
869 *((long *)(OpBuffer+i4-sizeof(long)))=obp-i4;
870
871 //jmp 5(ループ終了)
872 OpBuffer[obp++]=(char)0xEB;
873 OpBuffer[obp++]=(char)0x05;
874 }
875 }
876 else{
877 //pop eax
878 op_pop(REG_EAX);
879
880 //cmp eax,0
881 OpBuffer[obp++]=(char)0x83;
882 OpBuffer[obp++]=(char)0xF8;
883 OpBuffer[obp++]=(char)0x00;
884
885 if(basbuf[i3]=='0'){
886 //While
887
888 //je 5(ループ終了)
889 OpBuffer[obp++]=(char)0x74;
890 OpBuffer[obp++]=(char)0x05;
891 }
892 else if(basbuf[i3]=='1'){
893 //Until
894
895 //jne 5(ループ終了)
896 OpBuffer[obp++]=(char)0x75;
897 OpBuffer[obp++]=(char)0x05;
898 }
899 }
900 break;
901 }
902 }
903
904 //jmp ...
905 OpBuffer[obp++]=(char)0xE9;
906 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
907 obp+=sizeof(long);
908
909 //jmp ...
910 OpBuffer[obp++]=(char)0xE9;
911 int je_schedule=obp;
912 obp+=sizeof(long);
913
914 //レキシカルスコープをレベルダウン
915 GetLexicalScopes().End();
916
917 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jmpジャンプ先のオフセット値
918
919
920 //Continueアドレスを復元
921 dwContinueAddress=dwTempContinue;
922}
923void OpcodeContinue(void){
924 extern DWORD dwContinueAddress;
925
926 if(dwContinueAddress==-1){
927 SetError(12,"Continue",cp);
928 return;
929 }
930
931 //jmp ...(Continue addr)
932 OpBuffer[obp++]=(char)0xE9;
933
934 *((long *)(OpBuffer+obp))=dwContinueAddress-(obp+sizeof(long));
935 obp+=sizeof(long);
936}
937
938void OpcodeExitSub(void){
939 extern DWORD *pExitSubSchedule;
940 extern int ExitSubScheduleNum;
941 extern HANDLE hHeap;
942
943 if( UserProc::IsGlobalAreaCompiling() ){
944 SetError(12,"Exit Sub/Function",cp);
945 return;
946 }
947
948 //未解放のローカルオブジェクトのデストラクタを呼び出す
949 GetLexicalScopes().CallDestructorsOfReturn();
950
951 //jmp ...(End Sub/Function)
952 OpBuffer[obp++]=(char)0xE9;
953
954 pExitSubSchedule=(DWORD *)HeapReAlloc(hHeap,0,pExitSubSchedule,(ExitSubScheduleNum+1)*sizeof(DWORD));
955 pExitSubSchedule[ExitSubScheduleNum]=obp;
956 ExitSubScheduleNum++;
957
958 obp+=sizeof(long);
959}
960
961void AddCaseSchedule(void){
962 extern DWORD *pCaseSchedule;
963 extern int CaseScheduleNum;
964 extern HANDLE hHeap;
965
966 pCaseSchedule=(DWORD *)HeapReAlloc(hHeap,0,pCaseSchedule,(CaseScheduleNum+1)*sizeof(DWORD));
967 pCaseSchedule[CaseScheduleNum]=obp;
968 CaseScheduleNum++;
969}
970
971int CaseTypeSize;
972void OpcodeSelect(const char *lpszParms){
973 extern DWORD *pCaseSchedule;
974 extern int CaseScheduleNum;
975 extern int NowCaseSchedule;
976 extern int CaseTypeSize;
977 extern HANDLE hHeap;
978 extern char *basbuf;
979 int i,i2,i3,sw,NowCaseCp;
980 char temporary[VN_SIZE];
981
982 DWORD *temp_pCaseSchedule;
983 int temp_CaseScheduleNum;
984 int temp_NowCaseSchedule;
985 int temp_CaseTypeSize;
986
987 temp_pCaseSchedule=pCaseSchedule;
988 temp_CaseScheduleNum=CaseScheduleNum;
989 temp_NowCaseSchedule=NowCaseSchedule;
990 temp_CaseTypeSize=CaseTypeSize;
991 pCaseSchedule=(DWORD *)HeapAlloc(hHeap,0,1);
992 CaseScheduleNum=0;
993 NowCaseSchedule=0;
994
995 Type type1;
996 if( !NumOpe(lpszParms,Type(), type1 ) ){
997 return;
998 }
999
1000 CaseTypeSize = type1.GetSize();
1001 if( CaseTypeSize < sizeof(long) ){
1002 CaseTypeSize=sizeof(long);
1003 }
1004
1005 for(i=cp,sw=0;;i++){
1006 if(basbuf[i]=='\0'){
1007 HeapDefaultFree(pCaseSchedule);
1008 pCaseSchedule=temp_pCaseSchedule;
1009 CaseScheduleNum=temp_CaseScheduleNum;
1010 NowCaseSchedule=temp_NowCaseSchedule;
1011 CaseTypeSize=temp_CaseTypeSize;
1012 SetError(22,"Select",cp);
1013 return;
1014 }
1015 if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE){
1016 for(i2=0;;i++){
1017 if(basbuf[i]==1&&basbuf[i+1]==ESC_SELECTCASE) i2++;
1018 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
1019 i2--;
1020 if(i2==0) break;
1021 }
1022 }
1023 continue;
1024 }
1025 if(basbuf[i]==1&&basbuf[i+1]==ESC_ENDSELECT){
1026 if(sw==0){
1027 //add esp,CaseTypeSize
1028 op_add_esp(CaseTypeSize);
1029 }
1030 break;
1031 }
1032 if(basbuf[i]==1&&basbuf[i+1]==ESC_CASE){
1033 NowCaseCp=i;
1034
1035 i++;
1036 while(1){
1037 for(i++,i2=0;;i++,i2++){
1038 if(basbuf[i]=='\"'){
1039 i3=GetStringInQuotation(temporary+i2,basbuf+i);
1040 i+=i3-1;
1041 i2+=i3-1;
1042 continue;
1043 }
1044 if(basbuf[i]=='('){
1045 i3=GetStringInPare(temporary+i2,basbuf+i);
1046 i+=i3-1;
1047 i2+=i3-1;
1048 continue;
1049 }
1050 if(basbuf[i]=='['){
1051 i3=GetStringInBracket(temporary+i2,basbuf+i);
1052 i+=i3-1;
1053 i2+=i3-1;
1054 continue;
1055 }
1056
1057 if(IsCommandDelimitation(basbuf[i])){
1058 temporary[i2]=0;
1059 break;
1060 }
1061 if(basbuf[i]==','){
1062 temporary[i2]=0;
1063 break;
1064 }
1065
1066 temporary[i2]=basbuf[i];
1067 }
1068
1069 //エラー用
1070 i2=cp;
1071 cp=NowCaseCp;
1072
1073 Type type2;
1074 if( !NumOpe(temporary,type1,type2) ){
1075 return;
1076 }
1077
1078 cp=i2;
1079
1080 if(type1.IsObject()){
1081 std::vector<UserProc *> subs;
1082 type1.GetClass().GetMethods().Enum( CALC_EQUAL, subs );
1083 if( subs.size() == 0 ){
1084 return;
1085 }
1086
1087 Parameters params;
1088 params.push_back( new Parameter( "", Type( type2 ) ) );
1089
1090 //オーバーロードを解決
1091 UserProc *pUserProc;
1092 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 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.