source: dev/BasicCompiler_Common/Object.cpp@ 72

Last change on this file since 72 was 63, checked in by dai_9181, 18 years ago

CClass::GetSize、CClass::GetMemberOffsetを追加

File size: 1.7 KB
Line 
1#include "../BasicCompiler_Common/common.h"
2
3#ifdef _AMD64_
4#include "../BasicCompiler64/opcode.h"
5#else
6#include "../BasicCompiler32/opcode.h"
7#endif
8
9extern HANDLE hHeap;
10
11void CallConstructor(char *ObjectName,int *SubScripts,TYPEINFO &TypeInfo,char *Parameter){
12 if(TypeInfo.type!=DEF_OBJECT) return;
13
14 /////////////////////////////////////
15 // クラスオブジェクトの場合
16 // ※コンストラクタの呼び出し
17 /////////////////////////////////////
18 CClass *pobj_c;
19 pobj_c=(CClass *)TypeInfo.u.lpIndex;
20
21 SUBINFO *psi;
22 psi=GetMethodHash(ObjectName,pobj_c->name,Parameter);
23 if(!psi){
24 if(Parameter[0]) SetError(113,pobj_c->name,cp);
25 return;
26 }
27
28
29 char temporary[VN_SIZE];
30
31 if(SubScripts[0]!=-1){
32 int ss[MAX_ARRAYDIM];
33 memset(ss,0,MAX_ARRAYDIM*sizeof(int));
34 while(1){
35 int i3;
36 for(i3=0;;i3++){
37 if(SubScripts[i3]==-1) break;
38
39 if(ss[i3]>SubScripts[i3]){
40 ss[i3]=0;
41 ss[i3+1]++;
42 }
43 else break;
44 }
45 if(SubScripts[i3]==-1) break;
46 sprintf(temporary,"%s[%d",ObjectName,ss[0]);
47 for(i3=1;;i3++){
48 if(SubScripts[i3]==-1) break;
49
50 sprintf(temporary+lstrlen(temporary),",%d",ss[i3]);
51 }
52 lstrcat(temporary,"]");
53
54 LONG_PTR lp;
55 sprintf(temporary+lstrlen(temporary),".%s",pobj_c->name);
56 CallProc(PROC_DEFAULT,
57 psi,
58 temporary,
59 Parameter,
60 &lp);
61
62 ss[0]++;
63
64
65 //ネイティブコードバッファの再確保
66 extern int obp_AllocSize;
67 if(obp_AllocSize<obp+8192){
68 obp_AllocSize+=8192;
69 OpBuffer=(char *)HeapReAlloc(hHeap,0,OpBuffer,obp_AllocSize); //matea
70 }
71 }
72 }
73 else{
74 LONG_PTR lp;
75 sprintf(temporary,"%s.%s",ObjectName,pobj_c->name);
76 CallProc(PROC_DEFAULT,
77 psi,
78 temporary,
79 Parameter,
80 &lp);
81 }
82}
Note: See TracBrowser for help on using the repository browser.