added get number of entries function
This commit is contained in:
@ -103,6 +103,14 @@ AdInfo *CreatePrimitiveInfo(int size) {
|
||||
|
||||
// only gets the size of a primitive type
|
||||
int getPrimSize(TableNode *definition) {
|
||||
if (definition == NULL){
|
||||
printf("passed an NULL entry to getPrimSize function. Invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
if (definition->additionalinfo == NULL){
|
||||
printf("node has NULL additionalinfo. Invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(getType(definition), "primitive") != 0) {
|
||||
printf("not checking the size of a primitive -- invalid op\n");
|
||||
return 0;
|
||||
@ -133,6 +141,11 @@ AdInfo *CreateArrayInfo(int dim, /*int* sizes,*/ TableNode *type) {
|
||||
}
|
||||
// This gets the number of dimensions from array info
|
||||
int getNumArrDim(TableNode *definition) {
|
||||
if (definition == NULL){
|
||||
printf("passed an NULL entry to getNumArrDim function. Invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
if(
|
||||
if (strcmp(getType(definition), "array") != 0) {
|
||||
printf("not checking the dim of an array -- invalid op\n");
|
||||
return 0;
|
||||
@ -181,6 +194,16 @@ SymbolTable *getRecList(TableNode *definition) {
|
||||
return definition->additionalinfo->RecAdInfo->recordScope;
|
||||
}
|
||||
|
||||
int getRecSize(SymbolTable* tn){
|
||||
int s = 0;
|
||||
TableNode* cur = getFirstEntry(tn);
|
||||
while(getNextEntry(cur) != NULL){
|
||||
s++;
|
||||
cur = getNextEntry(cur);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// below function takes a bool to see if parameter should be decomposed or not
|
||||
// note that functions only take one input and have one output
|
||||
// using "as" the input record can be decomposed to give the illusion of
|
||||
@ -484,7 +507,7 @@ char *getName(TableNode *tn) {
|
||||
printf("passed a NULL table entry to getName\n");
|
||||
return "";
|
||||
}
|
||||
if(tn->theType == NULL){
|
||||
if(tn->theName == NULL){
|
||||
printf("name of entry is currently NULL, undefined \n");
|
||||
return "";
|
||||
}
|
||||
|
Reference in New Issue
Block a user