Commit 08508d66 authored by Sergio Costas's avatar Sergio Costas

Now reinitializates all the global variables after freeing memory. Needed to...

Now reinitializates all the global variables after freeing memory. Needed to be able to process a new file after having processed one.
parent 7ca11a46
......@@ -4,9 +4,11 @@ import glob
import sys
from crusty import crusty
lib = crusty.crusty("lexyacclib/crusty.h","lexyacclib/crusty.so")
def process_file(filename):
global lib
print("Processing file {:s}".format(filename))
lib = crusty.crusty("lexyacclib/crusty.h","lexyacclib/crusty.so")
tree = lib.read_file(filename,False)
if tree is None:
return
......
......@@ -251,6 +251,15 @@ void free_all() {
free(types_list);
types_list = to_delete;
}
types_list = NULL;
full_tree = NULL;
char *previous_data_line = NULL;
char *current_data_line = NULL;
int current_data_length = 0;
current_file = NULL;
column = 0;
current_line = 1;
}
void check_tree(struct AST *tree) {
......
......@@ -77,6 +77,7 @@ extern struct AST *types_list;
extern char *token_list[];
extern struct AST *full_tree;
extern char do_verbose;
extern int column;
void set_code_tree(struct AST *tree);
......
......@@ -24,6 +24,11 @@ char *previous_data_line = NULL;
char *current_data_line = NULL;
int current_data_length = 0;
int column = 0;
int current_line = 1;
char *current_file = NULL;
char do_verbose = 0;
%}
......@@ -192,10 +197,6 @@ int yywrap(void)
return 1;
}
int column = 0;
int current_line = 1;
char *current_file = NULL;
char do_verbose = 0;
void set_current_line() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment