1111#include <stdio.h>
1212
1313
14+ CVEC_NEW_DEFS2 (function , RESIZE )
1415
1516
1617expression * make_expression (program_state * prog )
@@ -208,7 +209,7 @@ void parse_program_string(program_state* prog, char* string)
208209prog -> pc = NULL ;
209210prog -> stmt_list = NULL ;
210211prog -> bindings = NULL ;
211- cvec_void (& prog -> functions , 0 , 10 , sizeof ( function ) , free_function , init_function );
212+ cvec_function (& prog -> functions , 0 , 10 , free_function , init_function );
212213cvec_str (& prog -> global_variables , 0 , 20 );
213214cvec_void (& prog -> global_values , 0 , 20 , sizeof (var_value ), free_var_value , NULL );
214215
@@ -268,7 +269,7 @@ void parse_program_file(program_state* prog, FILE* file)
268269prog -> pc = NULL ;
269270prog -> stmt_list = NULL ;
270271prog -> bindings = NULL ;
271- cvec_void (& prog -> functions , 0 , 10 , sizeof ( function ) , free_function , init_function );
272+ cvec_function (& prog -> functions , 0 , 10 , free_function , init_function );
272273cvec_str (& prog -> global_variables , 0 , 20 );
273274cvec_void (& prog -> global_values , 0 , 20 , sizeof (var_value ), free_var_value , NULL );
274275
@@ -359,7 +360,7 @@ void function_declarator(parsing_state* p, program_state* prog, var_type vtype)
359360//TODO make sure it's not already defined and make sure it matches previous declarations
360361
361362function * func_ptr ;
362- cvec_push_void (& prog -> functions , NULL ); //initialization is done automatically in init_function
363+ cvec_push_function (& prog -> functions , NULL ); //initialization is done automatically in init_function
363364assert (prog -> functions .size <= 10 ); //for now prevent possibility of bug TODO what was this for?
364365
365366var_value var ;
@@ -369,7 +370,7 @@ void function_declarator(parsing_state* p, program_state* prog, var_type vtype)
369370cvec_push_str (& prog -> global_variables , tok -> v .id );
370371cvec_push_void (& prog -> global_values , & var );
371372
372- func_ptr = cvec_back_void (& prog -> functions );
373+ func_ptr = cvec_back_function (& prog -> functions );
373374
374375func_ptr -> n_params = 0 ;
375376func_ptr -> ret_val .type = vtype ;
0 commit comments