source: dev/trunk/abdev/BasicCompiler_Common/src/Member.cpp@ 169

Last change on this file since 169 was 159, checked in by dai_9181, 17 years ago

プロジェクト内を整理。jengaライブラリのベースを作成。

File size: 2.1 KB
Line 
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
9CMember::CMember( CClass *pobj_c, Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine )
10 : MemberPrototype( accessibility )
11{
12 extern int cp;
13
14 //構文を解析
15 char VarName[VN_SIZE];
16 char initBuffer[VN_SIZE];
17 char lpszConstructParameter[VN_SIZE];
18 GetDimentionFormat(buffer,VarName,SubScripts,type,initBuffer,lpszConstructParameter);
19
20 //重複チェック
21 if(pobj_c->DupliCheckAll(VarName)){
22 SetError(15,VarName,cp);
23 }
24
25 //メンバ名
26 name = VarName;
27
28 //定数扱いかどうか
29 this->isConst = isConst;
30
31 //初期データ
32 initializeExpression = initBuffer;
33
34 //コンストラクタ用のパラメータ
35 constructParameter = lpszConstructParameter;
36
37 //ソースコードの位置
38 source_code_address=nowLine;
39}
40CMember::CMember(CMember &member)
41 : MemberPrototype( member.GetAccessibility() )
42 , name( member.GetName() )
43 , type( member.GetType() )
44 , isConst( member.IsConst() )
45{
46 //SubScripts
47 memcpy(SubScripts,member.SubScripts,MAX_ARRAYDIM*sizeof(int));
48
49 //ソースコードの位置
50 source_code_address=member.source_code_address;
51}
52CMember::~CMember(){
53}
54
55void CMember::InitStaticMember(void){
56 //静的メンバをグローバル領域に作成
57
58 //イテレータをリセット
59 extern Classes *pobj_DBClass;
60 pobj_DBClass->Iterator_Reset();
61
62 int back_cp=cp;
63
64 while(pobj_DBClass->Iterator_HasNext()){
65 CClass &objClass = *pobj_DBClass->Iterator_GetNext();
66
67 // 名前空間をセット
68 Smoothie::Lexical::liveingNamespaceScopes = objClass.GetNamespaceScopes();
69
70 int i=0;
71 foreach( CMember *member, objClass.staticMembers ){
72 char temporary[VN_SIZE];
73 sprintf(temporary,"%s.%s",objClass.GetName().c_str(),member->GetName().c_str());
74 dim(
75 temporary,
76 member->SubScripts,
77 member->GetType(),
78 member->GetInitializeExpression().c_str(),
79 member->GetConstructParameter().c_str(),
80 0);
81
82 //ネイティブコードバッファの再確保
83 ReallocNativeCodeBuffer();
84
85 i++;
86 }
87 }
88
89 Smoothie::Lexical::liveingNamespaceScopes.clear();
90
91 cp=back_cp;
92}
Note: See TracBrowser for help on using the repository browser.