[136] | 1 | #include "../common.h"
|
---|
| 2 | #ifdef _AMD64_
|
---|
| 3 | #include "../../BasicCompiler64/opcode.h"
|
---|
| 4 | #else
|
---|
| 5 | #include "../../BasicCompiler32/opcode.h"
|
---|
| 6 | #endif
|
---|
| 7 | #include <Member.h>
|
---|
| 8 |
|
---|
| 9 | CMember::CMember( CClass *pobj_c, DWORD access, bool isConst, bool isRef, char *buffer, int nowLine ){
|
---|
| 10 | extern int cp;
|
---|
| 11 |
|
---|
| 12 | //構文を解析
|
---|
| 13 | char VarName[VN_SIZE];
|
---|
| 14 | char init_buf[VN_SIZE];
|
---|
| 15 | char constract_parameter[VN_SIZE];
|
---|
| 16 | GetDimentionFormat(buffer,VarName,SubScripts,*this,init_buf,constract_parameter);
|
---|
| 17 |
|
---|
| 18 | //重複チェック
|
---|
| 19 | if(pobj_c->DupliCheckAll(VarName)){
|
---|
| 20 | SetError(15,VarName,cp);
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | //メンバ名
|
---|
| 24 | name = VarName;
|
---|
| 25 |
|
---|
| 26 | //アクセス権
|
---|
| 27 | dwAccess=access;
|
---|
| 28 |
|
---|
| 29 | //定数扱いかどうか
|
---|
| 30 | this->isConst = isConst;
|
---|
| 31 |
|
---|
| 32 | //初期データ
|
---|
| 33 | InitBuf=(char *)HeapAlloc(hHeap,0,lstrlen(init_buf)+1);
|
---|
| 34 | lstrcpy(InitBuf,init_buf);
|
---|
| 35 |
|
---|
| 36 | //コンストラクタ用のパラメータ
|
---|
| 37 | ConstractParameter=(char *)HeapAlloc(hHeap,0,lstrlen(constract_parameter)+1);
|
---|
| 38 | lstrcpy(ConstractParameter,constract_parameter);
|
---|
| 39 |
|
---|
| 40 | //ソースコードの位置
|
---|
| 41 | source_code_address=nowLine;
|
---|
| 42 | }
|
---|
| 43 | CMember::CMember(CMember &member):
|
---|
| 44 | Type( member )
|
---|
| 45 | {
|
---|
| 46 |
|
---|
| 47 | //name
|
---|
| 48 | name = member.name;
|
---|
| 49 |
|
---|
| 50 | //定数扱いかどうか
|
---|
| 51 | isConst = member.isConst;
|
---|
| 52 |
|
---|
| 53 | //SubScripts
|
---|
| 54 | memcpy(SubScripts,member.SubScripts,MAX_ARRAYDIM*sizeof(int));
|
---|
| 55 |
|
---|
| 56 | //ソースコードの位置
|
---|
| 57 | source_code_address=member.source_code_address;
|
---|
| 58 | }
|
---|
| 59 | CMember::~CMember(){
|
---|
| 60 | if(InitBuf) HeapDefaultFree(InitBuf);
|
---|
| 61 | if(ConstractParameter) HeapDefaultFree(ConstractParameter);
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | void CMember::InitStaticMember(void){
|
---|
| 65 | //静的メンバをグローバル領域に作成
|
---|
| 66 |
|
---|
| 67 | //イテレータをリセット
|
---|
| 68 | extern CDBClass *pobj_DBClass;
|
---|
| 69 | pobj_DBClass->Iterator_Reset();
|
---|
| 70 |
|
---|
| 71 | int back_cp=cp;
|
---|
| 72 |
|
---|
| 73 | while(pobj_DBClass->Iterator_HasNext()){
|
---|
| 74 | CClass &objClass = *pobj_DBClass->Iterator_GetNext();
|
---|
| 75 |
|
---|
| 76 | // 名前空間をセット
|
---|
| 77 | Smoothie::Lexical::liveingNamespaceScopes = objClass.GetNamespaceScopes();
|
---|
| 78 |
|
---|
| 79 | int i=0;
|
---|
| 80 | foreach( CMember *member, objClass.staticMembers ){
|
---|
| 81 | char temporary[VN_SIZE];
|
---|
| 82 | sprintf(temporary,"%s.%s",objClass.GetName().c_str(),member->GetName().c_str());
|
---|
| 83 | dim(
|
---|
| 84 | temporary,
|
---|
| 85 | member->SubScripts,
|
---|
| 86 | *member,
|
---|
| 87 | member->InitBuf,
|
---|
| 88 | member->ConstractParameter,
|
---|
| 89 | 0);
|
---|
| 90 |
|
---|
| 91 | //ネイティブコードバッファの再確保
|
---|
| 92 | ReallocNativeCodeBuffer();
|
---|
| 93 |
|
---|
| 94 | i++;
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | Smoothie::Lexical::liveingNamespaceScopes.clear();
|
---|
| 99 |
|
---|
| 100 | cp=back_cp;
|
---|
| 101 | }
|
---|