source: dev/BasicCompiler32/Compile_Statement.cpp@ 95

Last change on this file since 95 was 88, checked in by dai_9181, 18 years ago

House→Smoothie
Sourceクラスを用意した。

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