Ready for Dev! 🎉
This commit is contained in:
@ -186,7 +186,7 @@ int getRecSize(SymbolTable *tn) {
|
||||
"passed in NULL SymbolTable for getRecSize. Invalid");
|
||||
return -1;
|
||||
}
|
||||
int s = 0;
|
||||
int s = 1;
|
||||
TableNode *cur = getFirstEntry(tn);
|
||||
if (cur != NULL) {
|
||||
while (getNextEntry(cur) != NULL) {
|
||||
@ -772,7 +772,6 @@ TableNode *look_up(SymbolTable *table, char *x) {
|
||||
}
|
||||
|
||||
void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
|
||||
if (table == NULL) {
|
||||
printdebug(
|
||||
"%s[FATAL] passed in NULL table to print_symbol_table",
|
||||
@ -781,14 +780,14 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
}
|
||||
|
||||
if (table->Parent_Scope == NULL) {
|
||||
fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME",
|
||||
fprintf(file_ptr, "%-25s: %-6s : %-6s : %-25s: %-30s\n", "NAME",
|
||||
"SCOPE", "PARENT", "TYPE", "Extra annotation");
|
||||
}
|
||||
|
||||
TableNode *entrie = table->entries;
|
||||
fprintf(file_ptr, "-----------------:--------:--------:----------------"
|
||||
"------:---------"
|
||||
"--------------------\n");
|
||||
fprintf(file_ptr,
|
||||
"-------------------------:--------:--------:------------------"
|
||||
"--------:------------------------------\n");
|
||||
int parant_scope = 0;
|
||||
int current_scope = 0;
|
||||
if (table->Parent_Scope != NULL) {
|
||||
@ -800,7 +799,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
current_scope = 1001;
|
||||
}
|
||||
if (entrie == NULL) {
|
||||
fprintf(file_ptr, "%-17s: %06d : %06d : %-21s: %-28s\n", "",
|
||||
fprintf(file_ptr, "%-25s: %06d : %06d : %-25s: %-30s\n", "",
|
||||
current_scope, parant_scope, "", "Empty Scope");
|
||||
}
|
||||
for (; entrie != NULL; entrie = getNextEntry(entrie)) {
|
||||
@ -808,8 +807,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
if (parant_scope == 0) {
|
||||
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : : %-21d -> "
|
||||
"%-21s: %-28s\n",
|
||||
"%-25s: %06d : : %d -> %-20s: "
|
||||
"%-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
entrie->additionalinfo->ArrayAdInfo
|
||||
->numofdimensions,
|
||||
@ -818,8 +817,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
"Type of Array");
|
||||
} else {
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : %06d : %-21d -> %-21s: "
|
||||
"%-28s\n",
|
||||
"%-25s: %06d : : %d -> %-20s: "
|
||||
"%-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
parant_scope,
|
||||
entrie->additionalinfo->ArrayAdInfo
|
||||
@ -833,16 +832,16 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
if (parant_scope == 0) {
|
||||
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : :%-21s: "
|
||||
"elements-%-28d\n",
|
||||
"%-25s: %06d : : %-25s: "
|
||||
"elements-%-30d\n",
|
||||
entrie->theName, current_scope,
|
||||
"record",
|
||||
entrie->additionalinfo->RecAdInfo
|
||||
->numofelements);
|
||||
} else {
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : %06d : %-21s: "
|
||||
"elements-%-28d\n",
|
||||
"%-25s: %06d : %06d : %-25s: "
|
||||
"elements-%-30d\n",
|
||||
entrie->theName, current_scope,
|
||||
parant_scope, "record",
|
||||
entrie->additionalinfo->RecAdInfo
|
||||
@ -854,14 +853,14 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
|
||||
fprintf(
|
||||
file_ptr,
|
||||
"%-17s: %06d : :%-21s: size-%-28d "
|
||||
"%-25s: %06d : : %-25s: size-%d "
|
||||
"bytes\n",
|
||||
entrie->theName, current_scope, "Primitive",
|
||||
entrie->additionalinfo->PrimAdInfo->size);
|
||||
} else {
|
||||
fprintf(
|
||||
file_ptr,
|
||||
"%-17s: %06d : %06d : %-21s: size-%-28d "
|
||||
"%-25s: %06d : %06d : %-25s: size-%-30d "
|
||||
"bytes\n",
|
||||
entrie->theName, current_scope,
|
||||
parant_scope, "Primitive",
|
||||
@ -872,8 +871,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
if (parant_scope == 0) {
|
||||
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : : %-21s -> "
|
||||
"%-21s: %-28s\n",
|
||||
"%-25s: %06d : : %-25s -> "
|
||||
"%-25s: %-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
entrie->additionalinfo->FunTypeAdInfo
|
||||
->parameter->theName,
|
||||
@ -882,8 +881,8 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
"Type of Function");
|
||||
} else {
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : %06d : %-21s -> %-21s: "
|
||||
"%-28s\n",
|
||||
"%-25s: %06d : %06d : %-25s -> %-21s: "
|
||||
"%-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
parant_scope,
|
||||
entrie->additionalinfo->FunTypeAdInfo
|
||||
@ -897,12 +896,12 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
if (parant_scope == 0) {
|
||||
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : :%-21s: %-28s\n",
|
||||
"%-25s: %06d : : %-25s: %-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
getType(entrie), "User Defined");
|
||||
} else {
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : %06d : %-21s: %-28s\n",
|
||||
"%-25s: %06d : %06d : %-25s: %-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
parant_scope, getType(entrie),
|
||||
"User Defined");
|
||||
@ -912,12 +911,12 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
if (parant_scope == 0) {
|
||||
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : :%-21s: %-28s\n",
|
||||
"%-25s: %06d : : %-25s: %-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
"undefined", "undefined entry");
|
||||
} else {
|
||||
fprintf(file_ptr,
|
||||
"%-17s: %06d : %06d : %-21s: %-28s\n",
|
||||
"%-25s: %06d : %06d : %-25s: %-30s\n",
|
||||
entrie->theName, current_scope,
|
||||
parant_scope, "undefined",
|
||||
"undefined entry");
|
||||
@ -940,9 +939,9 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
}
|
||||
}
|
||||
if (getParent(table) == NULL) {
|
||||
fprintf(file_ptr, "-----------------:--------:--------:--------"
|
||||
"--------------:-------"
|
||||
"----------------------\n");
|
||||
fprintf(file_ptr,
|
||||
"-------------------------:--------:--------:----------"
|
||||
"----------------:------------------------------\n");
|
||||
}
|
||||
}
|
||||
// get top most symbol table
|
||||
|
Reference in New Issue
Block a user