Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -23,13 +23,11 @@ subject to the following restrictions:
|
||||
//this define will force traversal of structures, to check backward (and forward) compatibility
|
||||
//#define TEST_BACKWARD_FORWARD_COMPATIBILITY
|
||||
|
||||
|
||||
using namespace bParse;
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
bDNA::bDNA()
|
||||
: mPtrLen(0)
|
||||
: mPtrLen(0)
|
||||
{
|
||||
// --
|
||||
}
|
||||
@@ -43,7 +41,7 @@ bDNA::~bDNA()
|
||||
// ----------------------------------------------------- //
|
||||
bool bDNA::lessThan(bDNA *file)
|
||||
{
|
||||
return ( m_Names.size() < file->m_Names.size());
|
||||
return (m_Names.size() < file->m_Names.size());
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
@@ -53,36 +51,31 @@ char *bDNA::getName(int ind)
|
||||
return m_Names[ind].m_name;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
char *bDNA::getType(int ind)
|
||||
{
|
||||
assert(ind<= (int)mTypes.size());
|
||||
assert(ind <= (int)mTypes.size());
|
||||
return mTypes[ind];
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
short *bDNA::getStruct(int ind)
|
||||
{
|
||||
assert(ind <= (int)mStructs.size());
|
||||
assert(ind <= (int)mStructs.size());
|
||||
return mStructs[ind];
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
short bDNA::getLength(int ind)
|
||||
{
|
||||
assert(ind <= (int)mTlens.size());
|
||||
assert(ind <= (int)mTlens.size());
|
||||
return mTlens[ind];
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
int bDNA::getReverseType(short type)
|
||||
{
|
||||
|
||||
int* intPtr = mStructReverse.find(type);
|
||||
int *intPtr = mStructReverse.find(type);
|
||||
if (intPtr)
|
||||
return *intPtr;
|
||||
|
||||
@@ -92,12 +85,11 @@ int bDNA::getReverseType(short type)
|
||||
// ----------------------------------------------------- //
|
||||
int bDNA::getReverseType(const char *type)
|
||||
{
|
||||
|
||||
btHashString key(type);
|
||||
int* valuePtr = mTypeLookup.find(key);
|
||||
int *valuePtr = mTypeLookup.find(key);
|
||||
if (valuePtr)
|
||||
return *valuePtr;
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -110,22 +102,22 @@ int bDNA::getNumStructs()
|
||||
// ----------------------------------------------------- //
|
||||
bool bDNA::flagNotEqual(int dna_nr)
|
||||
{
|
||||
assert(dna_nr <= (int)mCMPFlags.size());
|
||||
assert(dna_nr <= (int)mCMPFlags.size());
|
||||
return mCMPFlags[dna_nr] == FDF_STRUCT_NEQU;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
bool bDNA::flagEqual(int dna_nr)
|
||||
{
|
||||
assert(dna_nr <= (int)mCMPFlags.size());
|
||||
assert(dna_nr <= (int)mCMPFlags.size());
|
||||
int flag = mCMPFlags[dna_nr];
|
||||
return flag == FDF_STRUCT_EQU;
|
||||
return flag == FDF_STRUCT_EQU;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
bool bDNA::flagNone(int dna_nr)
|
||||
{
|
||||
assert(dna_nr <= (int)mCMPFlags.size());
|
||||
assert(dna_nr <= (int)mCMPFlags.size());
|
||||
return mCMPFlags[dna_nr] == FDF_NONE;
|
||||
}
|
||||
|
||||
@@ -143,15 +135,15 @@ void bDNA::initRecurseCmpFlags(int iter)
|
||||
short *oldStrc = mStructs[iter];
|
||||
short type = oldStrc[0];
|
||||
|
||||
for (int i=0; i<(int)mStructs.size(); i++)
|
||||
for (int i = 0; i < (int)mStructs.size(); i++)
|
||||
{
|
||||
if (i != iter && mCMPFlags[i] == FDF_STRUCT_EQU )
|
||||
if (i != iter && mCMPFlags[i] == FDF_STRUCT_EQU)
|
||||
{
|
||||
short *curStruct = mStructs[i];
|
||||
int eleLen = curStruct[1];
|
||||
curStruct+=2;
|
||||
curStruct += 2;
|
||||
|
||||
for (int j=0; j<eleLen; j++, curStruct+=2)
|
||||
for (int j = 0; j < eleLen; j++, curStruct += 2)
|
||||
{
|
||||
if (curStruct[0] == type)
|
||||
{
|
||||
@@ -171,19 +163,15 @@ void bDNA::initRecurseCmpFlags(int iter)
|
||||
// ----------------------------------------------------- //
|
||||
void bDNA::initCmpFlags(bDNA *memDNA)
|
||||
{
|
||||
|
||||
// compare the file to memory
|
||||
// compare the file to memory
|
||||
// this ptr should be the file data
|
||||
|
||||
|
||||
assert(!(m_Names.size() == 0));//DNA empty!
|
||||
assert(!(m_Names.size() == 0)); //DNA empty!
|
||||
|
||||
mCMPFlags.resize(mStructs.size(), FDF_NONE);
|
||||
|
||||
|
||||
|
||||
int i;
|
||||
for ( i=0; i<(int)mStructs.size(); i++)
|
||||
for (i = 0; i < (int)mStructs.size(); i++)
|
||||
{
|
||||
short *oldStruct = mStructs[i];
|
||||
|
||||
@@ -197,7 +185,7 @@ void bDNA::initCmpFlags(bDNA *memDNA)
|
||||
|
||||
//#define SLOW_FORWARD_COMPATIBLE 1
|
||||
#ifdef SLOW_FORWARD_COMPATIBLE
|
||||
char* typeName = mTypes[oldLookup];
|
||||
char *typeName = mTypes[oldLookup];
|
||||
int newLookup = memDNA->getReverseType(typeName);
|
||||
if (newLookup == -1)
|
||||
{
|
||||
@@ -211,71 +199,61 @@ void bDNA::initCmpFlags(bDNA *memDNA)
|
||||
if (oldLookup < memDNA->mStructs.size())
|
||||
{
|
||||
short *curStruct = memDNA->mStructs[oldLookup];
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// rebuild...
|
||||
mCMPFlags[i] = FDF_STRUCT_NEQU;
|
||||
// rebuild...
|
||||
mCMPFlags[i] = FDF_STRUCT_NEQU;
|
||||
|
||||
#ifndef TEST_BACKWARD_FORWARD_COMPATIBILITY
|
||||
|
||||
if (curStruct[1] == oldStruct[1])
|
||||
if (curStruct[1] == oldStruct[1])
|
||||
{
|
||||
// type len same ...
|
||||
if (mTlens[oldStruct[0]] == memDNA->mTlens[curStruct[0]])
|
||||
{
|
||||
// type len same ...
|
||||
if (mTlens[oldStruct[0]] == memDNA->mTlens[curStruct[0]])
|
||||
bool isSame = true;
|
||||
int elementLength = oldStruct[1];
|
||||
|
||||
curStruct += 2;
|
||||
oldStruct += 2;
|
||||
|
||||
for (int j = 0; j < elementLength; j++, curStruct += 2, oldStruct += 2)
|
||||
{
|
||||
bool isSame = true;
|
||||
int elementLength = oldStruct[1];
|
||||
|
||||
|
||||
curStruct+=2;
|
||||
oldStruct+=2;
|
||||
|
||||
|
||||
for (int j=0; j<elementLength; j++, curStruct+=2, oldStruct+=2)
|
||||
// type the same
|
||||
//const char* typeFileDNA = mTypes[oldStruct[0]];
|
||||
//const char* typeMemDNA = mTypes[curStruct[0]];
|
||||
if (strcmp(mTypes[oldStruct[0]], memDNA->mTypes[curStruct[0]]) != 0)
|
||||
{
|
||||
// type the same
|
||||
//const char* typeFileDNA = mTypes[oldStruct[0]];
|
||||
//const char* typeMemDNA = mTypes[curStruct[0]];
|
||||
if (strcmp(mTypes[oldStruct[0]], memDNA->mTypes[curStruct[0]])!=0)
|
||||
{
|
||||
isSame=false;
|
||||
break;
|
||||
}
|
||||
|
||||
// name the same
|
||||
if (strcmp(m_Names[oldStruct[1]].m_name, memDNA->m_Names[curStruct[1]].m_name)!=0)
|
||||
{
|
||||
isSame=false;
|
||||
break;
|
||||
}
|
||||
isSame = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// name the same
|
||||
if (strcmp(m_Names[oldStruct[1]].m_name, memDNA->m_Names[curStruct[1]].m_name) != 0)
|
||||
{
|
||||
isSame = false;
|
||||
break;
|
||||
}
|
||||
// flag valid ==
|
||||
if (isSame)
|
||||
mCMPFlags[i] = FDF_STRUCT_EQU;
|
||||
}
|
||||
// flag valid ==
|
||||
if (isSame)
|
||||
mCMPFlags[i] = FDF_STRUCT_EQU;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// recurse in
|
||||
for ( i=0; i<(int)mStructs.size(); i++)
|
||||
{
|
||||
if (mCMPFlags[i] == FDF_STRUCT_NEQU)
|
||||
initRecurseCmpFlags(i);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// recurse in
|
||||
for (i = 0; i < (int)mStructs.size(); i++)
|
||||
{
|
||||
if (mCMPFlags[i] == FDF_STRUCT_NEQU)
|
||||
initRecurseCmpFlags(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int name_is_array(char* name, int* dim1, int* dim2) {
|
||||
static int name_is_array(char *name, int *dim1, int *dim2)
|
||||
{
|
||||
int len = strlen(name);
|
||||
/*fprintf(stderr,"[%s]",name);*/
|
||||
/*if (len >= 1) {
|
||||
@@ -285,58 +263,77 @@ static int name_is_array(char* name, int* dim1, int* dim2) {
|
||||
return 0;*/
|
||||
char *bp;
|
||||
int num;
|
||||
if (dim1) {
|
||||
if (dim1)
|
||||
{
|
||||
*dim1 = 1;
|
||||
}
|
||||
if (dim2) {
|
||||
if (dim2)
|
||||
{
|
||||
*dim2 = 1;
|
||||
}
|
||||
bp = strchr(name, '[');
|
||||
if (!bp) {
|
||||
if (!bp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
num = 0;
|
||||
while (++bp < name+len-1) {
|
||||
while (++bp < name + len - 1)
|
||||
{
|
||||
const char c = *bp;
|
||||
if (c == ']') {
|
||||
if (c == ']')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (c <= '9' && c >= '0') {
|
||||
if (c <= '9' && c >= '0')
|
||||
{
|
||||
num *= 10;
|
||||
num += (c - '0');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("array parse error.\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (dim2) {
|
||||
if (dim2)
|
||||
{
|
||||
*dim2 = num;
|
||||
}
|
||||
|
||||
/* find second dim, if any. */
|
||||
bp = strchr(bp, '[');
|
||||
if (!bp) {
|
||||
if (!bp)
|
||||
{
|
||||
return 1; /* at least we got the first dim. */
|
||||
}
|
||||
num = 0;
|
||||
while (++bp < name+len-1) {
|
||||
while (++bp < name + len - 1)
|
||||
{
|
||||
const char c = *bp;
|
||||
if (c == ']') {
|
||||
if (c == ']')
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (c <= '9' && c >= '0') {
|
||||
if (c <= '9' && c >= '0')
|
||||
{
|
||||
num *= 10;
|
||||
num += (c - '0');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("array2 parse error.\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (dim1) {
|
||||
if (dim2) {
|
||||
if (dim1)
|
||||
{
|
||||
if (dim2)
|
||||
{
|
||||
*dim1 = *dim2;
|
||||
*dim2 = num;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
*dim1 = num;
|
||||
}
|
||||
}
|
||||
@@ -344,14 +341,15 @@ static int name_is_array(char* name, int* dim1, int* dim2) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
void bDNA::init(char *data, int len, bool swap)
|
||||
{
|
||||
int *intPtr=0;short *shtPtr=0;
|
||||
char *cp = 0;int dataLen =0;
|
||||
int *intPtr = 0;
|
||||
short *shtPtr = 0;
|
||||
char *cp = 0;
|
||||
int dataLen = 0;
|
||||
//long nr=0;
|
||||
intPtr = (int*)data;
|
||||
intPtr = (int *)data;
|
||||
|
||||
/*
|
||||
SDNA (4 bytes) (magic number)
|
||||
@@ -361,39 +359,36 @@ void bDNA::init(char *data, int len, bool swap)
|
||||
<string>
|
||||
*/
|
||||
|
||||
if (strncmp(data, "SDNA", 4)==0)
|
||||
if (strncmp(data, "SDNA", 4) == 0)
|
||||
{
|
||||
// skip ++ NAME
|
||||
intPtr++; intPtr++;
|
||||
intPtr++;
|
||||
intPtr++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Parse names
|
||||
if (swap)
|
||||
if (swap)
|
||||
{
|
||||
*intPtr = ChunkUtils::swapInt(*intPtr);
|
||||
}
|
||||
dataLen = *intPtr;
|
||||
intPtr++;
|
||||
|
||||
cp = (char*)intPtr;
|
||||
cp = (char *)intPtr;
|
||||
int i;
|
||||
for ( i=0; i<dataLen; i++)
|
||||
for (i = 0; i < dataLen; i++)
|
||||
{
|
||||
bNameInfo info;
|
||||
info.m_name = cp;
|
||||
info.m_isPointer = (info.m_name[0] == '*') || (info.m_name[1] == '*');
|
||||
name_is_array(info.m_name,&info.m_dim0,&info.m_dim1);
|
||||
name_is_array(info.m_name, &info.m_dim0, &info.m_dim1);
|
||||
m_Names.push_back(info);
|
||||
while (*cp)cp++;
|
||||
while (*cp) cp++;
|
||||
cp++;
|
||||
}
|
||||
|
||||
cp = btAlignPointer(cp, 4);
|
||||
|
||||
|
||||
cp = btAlignPointer(cp,4);
|
||||
|
||||
/*
|
||||
TYPE (4 bytes)
|
||||
<nr> amount of types (int)
|
||||
@@ -401,26 +396,27 @@ void bDNA::init(char *data, int len, bool swap)
|
||||
<string>
|
||||
*/
|
||||
|
||||
intPtr = (int*)cp;
|
||||
assert(strncmp(cp, "TYPE", 4)==0); intPtr++;
|
||||
intPtr = (int *)cp;
|
||||
assert(strncmp(cp, "TYPE", 4) == 0);
|
||||
intPtr++;
|
||||
|
||||
if (swap)
|
||||
if (swap)
|
||||
{
|
||||
*intPtr = ChunkUtils::swapInt(*intPtr);
|
||||
}
|
||||
dataLen = *intPtr;
|
||||
intPtr++;
|
||||
|
||||
cp = (char*)intPtr;
|
||||
for ( i=0; i<dataLen; i++)
|
||||
cp = (char *)intPtr;
|
||||
for (i = 0; i < dataLen; i++)
|
||||
{
|
||||
mTypes.push_back(cp);
|
||||
while (*cp)cp++;
|
||||
while (*cp) cp++;
|
||||
cp++;
|
||||
}
|
||||
|
||||
cp = btAlignPointer(cp,4);
|
||||
|
||||
cp = btAlignPointer(cp, 4);
|
||||
|
||||
/*
|
||||
TLEN (4 bytes)
|
||||
<len> (short) the lengths of types
|
||||
@@ -428,13 +424,14 @@ void bDNA::init(char *data, int len, bool swap)
|
||||
*/
|
||||
|
||||
// Parse type lens
|
||||
intPtr = (int*)cp;
|
||||
assert(strncmp(cp, "TLEN", 4)==0); intPtr++;
|
||||
intPtr = (int *)cp;
|
||||
assert(strncmp(cp, "TLEN", 4) == 0);
|
||||
intPtr++;
|
||||
|
||||
dataLen = (int)mTypes.size();
|
||||
|
||||
shtPtr = (short*)intPtr;
|
||||
for ( i=0; i<dataLen; i++, shtPtr++)
|
||||
shtPtr = (short *)intPtr;
|
||||
for (i = 0; i < dataLen; i++, shtPtr++)
|
||||
{
|
||||
if (swap)
|
||||
shtPtr[0] = ChunkUtils::swapShort(shtPtr[0]);
|
||||
@@ -454,94 +451,89 @@ void bDNA::init(char *data, int len, bool swap)
|
||||
<namenr>
|
||||
*/
|
||||
|
||||
intPtr = (int*)shtPtr;
|
||||
cp = (char*)intPtr;
|
||||
assert(strncmp(cp, "STRC", 4)==0); intPtr++;
|
||||
intPtr = (int *)shtPtr;
|
||||
cp = (char *)intPtr;
|
||||
assert(strncmp(cp, "STRC", 4) == 0);
|
||||
intPtr++;
|
||||
|
||||
if (swap)
|
||||
if (swap)
|
||||
{
|
||||
*intPtr = ChunkUtils::swapInt(*intPtr);
|
||||
}
|
||||
dataLen = *intPtr;
|
||||
intPtr++;
|
||||
|
||||
|
||||
shtPtr = (short*)intPtr;
|
||||
for ( i=0; i<dataLen; i++)
|
||||
shtPtr = (short *)intPtr;
|
||||
for (i = 0; i < dataLen; i++)
|
||||
{
|
||||
mStructs.push_back (shtPtr);
|
||||
mStructs.push_back(shtPtr);
|
||||
if (swap)
|
||||
{
|
||||
shtPtr[0]= ChunkUtils::swapShort(shtPtr[0]);
|
||||
shtPtr[1]= ChunkUtils::swapShort(shtPtr[1]);
|
||||
shtPtr[0] = ChunkUtils::swapShort(shtPtr[0]);
|
||||
shtPtr[1] = ChunkUtils::swapShort(shtPtr[1]);
|
||||
|
||||
int len = shtPtr[1];
|
||||
shtPtr+= 2;
|
||||
shtPtr += 2;
|
||||
|
||||
for (int a=0; a<len; a++, shtPtr+=2)
|
||||
for (int a = 0; a < len; a++, shtPtr += 2)
|
||||
{
|
||||
shtPtr[0]= ChunkUtils::swapShort(shtPtr[0]);
|
||||
shtPtr[1]= ChunkUtils::swapShort(shtPtr[1]);
|
||||
shtPtr[0] = ChunkUtils::swapShort(shtPtr[0]);
|
||||
shtPtr[1] = ChunkUtils::swapShort(shtPtr[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
shtPtr+= (2*shtPtr[1])+2;
|
||||
shtPtr += (2 * shtPtr[1]) + 2;
|
||||
}
|
||||
|
||||
|
||||
// build reverse lookups
|
||||
for ( i=0; i<(int)mStructs.size(); i++)
|
||||
for (i = 0; i < (int)mStructs.size(); i++)
|
||||
{
|
||||
short *strc = mStructs.at(i);
|
||||
if (!mPtrLen && strcmp(mTypes[strc[0]],"ListBase")==0)
|
||||
if (!mPtrLen && strcmp(mTypes[strc[0]], "ListBase") == 0)
|
||||
{
|
||||
mPtrLen = mTlens[strc[0]]/2;
|
||||
mPtrLen = mTlens[strc[0]] / 2;
|
||||
}
|
||||
|
||||
mStructReverse.insert(strc[0], i);
|
||||
mTypeLookup.insert(btHashString(mTypes[strc[0]]),i);
|
||||
mTypeLookup.insert(btHashString(mTypes[strc[0]]), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------- //
|
||||
int bDNA::getArraySize(char* string)
|
||||
int bDNA::getArraySize(char *string)
|
||||
{
|
||||
int ret = 1;
|
||||
int len = strlen(string);
|
||||
|
||||
|
||||
char* next = 0;
|
||||
for (int i=0; i<len; i++)
|
||||
char *next = 0;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
char c = string[i];
|
||||
|
||||
if (c == '[')
|
||||
next = &string[i+1];
|
||||
else if (c==']')
|
||||
next = &string[i + 1];
|
||||
else if (c == ']')
|
||||
if (next)
|
||||
ret *= atoi(next);
|
||||
}
|
||||
|
||||
// print (string << ' ' << ret);
|
||||
// print (string << ' ' << ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void bDNA::dumpTypeDefinitions()
|
||||
{
|
||||
int i;
|
||||
|
||||
int numTypes = mTypes.size();
|
||||
|
||||
for (i=0;i<numTypes;i++)
|
||||
{
|
||||
|
||||
for (i = 0; i < numTypes; i++)
|
||||
{
|
||||
}
|
||||
|
||||
for ( i=0; i<(int)mStructs.size(); i++)
|
||||
for (i = 0; i < (int)mStructs.size(); i++)
|
||||
{
|
||||
int totalBytes=0;
|
||||
int totalBytes = 0;
|
||||
short *oldStruct = mStructs[i];
|
||||
|
||||
int oldLookup = getReverseType(oldStruct[0]);
|
||||
@@ -551,44 +543,46 @@ void bDNA::dumpTypeDefinitions()
|
||||
continue;
|
||||
}
|
||||
|
||||
short* newStruct = mStructs[oldLookup];
|
||||
char* typeName = mTypes[newStruct[0]];
|
||||
printf("%3d: %s ",i,typeName);
|
||||
|
||||
short *newStruct = mStructs[oldLookup];
|
||||
char *typeName = mTypes[newStruct[0]];
|
||||
printf("%3d: %s ", i, typeName);
|
||||
|
||||
//char *name = mNames[oldStruct[1]];
|
||||
int len = oldStruct[1];
|
||||
printf(" (%d fields) ",len);
|
||||
oldStruct+=2;
|
||||
printf(" (%d fields) ", len);
|
||||
oldStruct += 2;
|
||||
|
||||
printf("{");
|
||||
int j;
|
||||
for (j=0; j<len; ++j,oldStruct+=2) {
|
||||
const char* name = m_Names[oldStruct[1]].m_name;
|
||||
printf("%s %s", mTypes[oldStruct[0]],name);
|
||||
int elemNumBytes= 0;
|
||||
for (j = 0; j < len; ++j, oldStruct += 2)
|
||||
{
|
||||
const char *name = m_Names[oldStruct[1]].m_name;
|
||||
printf("%s %s", mTypes[oldStruct[0]], name);
|
||||
int elemNumBytes = 0;
|
||||
int arrayDimensions = getArraySizeNew(oldStruct[1]);
|
||||
|
||||
if (m_Names[oldStruct[1]].m_isPointer)
|
||||
{
|
||||
elemNumBytes = VOID_IS_8 ? 8 : 4;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
elemNumBytes = getLength(oldStruct[0]);
|
||||
}
|
||||
printf(" /* %d bytes */",elemNumBytes*arrayDimensions);
|
||||
|
||||
if (j == len-1) {
|
||||
printf(" /* %d bytes */", elemNumBytes * arrayDimensions);
|
||||
|
||||
if (j == len - 1)
|
||||
{
|
||||
printf(";}");
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("; ");
|
||||
}
|
||||
totalBytes+=elemNumBytes*arrayDimensions;
|
||||
totalBytes += elemNumBytes * arrayDimensions;
|
||||
}
|
||||
printf("\ntotalBytes=%d\n\n",totalBytes);
|
||||
|
||||
printf("\ntotalBytes=%d\n\n", totalBytes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/* dump out display of types and their sizes */
|
||||
@@ -618,12 +612,6 @@ void bDNA::dumpTypeDefinitions()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//eof
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user