diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-07-27 13:26:15 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-07-27 13:26:15 -0400 |
commit | d9ba5ec2f86dd69eae4edac586a889fccd8d31b1 (patch) | |
tree | f912572d25e416c4940507f415287c7949eaa32a | |
parent | 0e835d9b8f97087810dddb9743aa84b6431ff3a7 (diff) |
Fix typos & errors
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | node.c | 4 | ||||
-rw-r--r-- | scope.c | 27 | ||||
-rw-r--r-- | scope.h | 4 |
4 files changed, 19 insertions, 18 deletions
@@ -2,6 +2,8 @@ #include <stdlib.h> #include <assert.h> +#include "node.h" +#include "scope.h" #include "y.tab.h" #include "pc.h" @@ -19,7 +19,7 @@ char *str; } /* helpers */ -node* search(root, str) +node* list_search(root, str) node *root; char *str; { @@ -33,7 +33,7 @@ char *str; return NULL; } -node* insert(root, str) /*TODO change to accept double pointer*/ +node* list_insert(root, str) /*TODO change to accept double pointer*/ node *root; char * str; { @@ -6,8 +6,7 @@ #include "node.h" #include "scope.h" -scope* mkscope(prev) -scope* prev; +scope* mkscope() { int i; @@ -17,7 +16,7 @@ scope* prev; for (i = 0; i < HASH_SIZE; i++) p->table[i] = NULL; - p->next = next; + p->next = NULL; p->function_boundry = 0; return p; @@ -32,7 +31,7 @@ scope *s; return; for (i = 0; i < HASH_SIZE; i++) { - free_nodes(s->table[i]); + free_list(s->table[i]); } free(s); @@ -57,15 +56,15 @@ char* s; return h % HASH_SIZE; } -scope* push_scope(root); -scope* root; +scope* push_scope(root) +scope *root; { scope *p = mkscope(); p->next = root; return p; } -scope* pop_scope(root); +scope* pop_scope(root) scope *root; { scope *p; @@ -79,11 +78,11 @@ scope *root; return p; } -node* scope_insert(s, name) -scope *s; +node* scope_insert(root, name) +scope *root; char *name; { - int hash = hashpwj(name); + int hash = hashpjw(name); node *tmp = root->table[hash]; return root->table[hash] = list_insert(tmp, name); @@ -93,7 +92,7 @@ node* scope_search(root, name) scope *root; char *name; { - int hash = hashpwj(name); + int hash = hashpjw(name); node *tmp = root->table[hash]; return list_search(tmp, name); @@ -123,8 +122,8 @@ char *name; for (p = root; p; p = p->next) { if (tmp = scope_search(p, name)) return tmp; - if (p->f) - return NULL + if (p->function_boundry) + return NULL; } return NULL; @@ -134,7 +133,7 @@ void print_scope(s) scope *s; { int i; - node_t * tmp; + node * tmp; for (i = 0; i < HASH_SIZE; i++) { for( tmp=s->table[i]; tmp; tmp = tmp->next) { fprintf(stderr, "\t%s\n", tmp->name); @@ -9,7 +9,7 @@ typedef struct hash { char function_boundry; } scope; -scope* mkscope(scope*); +scope* mkscope(); void free_scope(scope*); /*stack routines*/ @@ -23,5 +23,5 @@ node* scope_search(scope*, char*); node* scope_safe_search_all(scope*, char*); /*hash function*/ -int hash_pwj(char*); +int hashpjw(char*); #endif |