source: dev/BasicCompiler32/Compile_Statement.cpp@ 82

Last change on this file since 82 was 76, checked in by dai_9181, 18 years ago

TYPEINFO→Typeへのリファクタリングを実施。32bitが未完成。

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