-
Notifications
You must be signed in to change notification settings - Fork 1
/
ClassDes.cpp
executable file
·110 lines (95 loc) · 2.12 KB
/
ClassDes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include "clib.h"
#include "os/CSS_LOCKEX.h"
#include "memory.h"
#include "ScriptFuncTable.h"
#include "PubFuncTable.h"
#include "cocor/cp.hpp"
#include "ClassDes.h"
CClassDes::CClassDes(cParser* p)
{
//m_lMemberNum = 0;
//m_lTableSize = 0;
memset(this->m_szName, 0, 1024);
memset(this->szParentName, 0, 1024);
m_pParser = p;
//m_MemberTable = NULL;
//m_lCurSize = 0;
//CFunction* pfn = new CFunction();
//pfn->AddCommand
//this->fnTable.AddFunction(pfh);
}
CClassDes::~CClassDes(void)
{
/*if (m_MemberTable)
delete m_MemberTable;*/
}
/*BOOL CClassDes::AddMember(char *szName, TYPEDES& dt)
{
if (strlen(szName) > 20)
{
nLOG("member name too long", 300);
return FALSE;
}
//检查是否重定义
for (int i= 0; i< this->m_lMemberNum; i++)
{
if (!strcmp(this->m_MemberTable[i].szName, szName))
{
nLOG("Class member redefined", 300);
return FALSE;
}
}
if (this->m_lMemberNum == this->m_lTableSize)
{
OBJMEMDES* pNewTable = NULL;
pNewTable = new OBJMEMDES[m_lTableSize+50];
if (pNewTable == NULL)
{
REPORT_MEM_ERROR("Memory allocation failed\r\n");
return FALSE;
}
memcpy(pNewTable, this->m_MemberTable, sizeof(OBJMEMDES)*m_lMemberNum);
delete m_MemberTable;
this->m_MemberTable = pNewTable;
m_lTableSize += 50;
}
m_MemberTable[m_lMemberNum].offset = this->m_lCurSize;
long size = m_pParser->UnitSize(dt);
if (dt.dim > 0)
{
for (int i= 0 ; i< dt.dim; i++)
{
size *= dt.dimsize[i];
}
}
m_lCurSize += size;
strcpy(m_MemberTable[m_lMemberNum].szName, szName);
memcpy(&m_MemberTable[m_lMemberNum].dt, &dt, sizeof(TYPEDES));
this->m_lMemberNum++;
return TRUE;
}
*/
BOOL CClassDes::SetName(char* szName)
{
if (strlen(m_szName) > 1024)
{
nLOG("member name too long", 300);
return FALSE;
}
strcpy(m_szName, szName);
return TRUE;
}
/*
OBJMEMDES *CClassDes::GetMemberByName(char* szName)
{
// find
for (int i= 0; i< this->m_lMemberNum; i++)
{
if (!strcmp(this->m_MemberTable[i].szName, szName))
{
return &m_MemberTable[i];
}
}
return NULL;
}
*/