1 /********************************************************************
3 block.h - structures and functions used to hold program
6 Niksa Orlic, 2004-04-23
8 ********************************************************************/
13 The structure to hold description for
18 struct block_struct
*parent_block
;
24 int next_variable_index
;
25 int next_parameter_index
;
29 struct block_struct
**children
;
33 typedef struct block_struct block
;
41 block
* block_create(block
*, string
*);
42 void block_destroy(block
*);
44 int block_check_name(block
*, char*);
46 void add_real_constant(block
*, float, char*);
47 void add_integer_constant(block
*, long int, char*);
48 void add_char_constant(block
*, char, char*);
49 void add_boolean_constant(block
*, char, char*);
50 void add_string_constant(block
*, string
*, char*);
52 void add_variables(block
*, string_list
*, type
*);
54 void add_type(block
*, string
*, type
*);
56 void add_procedure(block
*, string
*, type_list
*, int, int);
57 void add_function(block
*, string
*, type_list
*,type
*, int, int);
59 void load_extern_library(string
*);
60 void read_library_file(FILE*, struct unit_struct
*);
61 void read_symbol_file(FILE*, struct unit_struct
*);
63 void add_parameters(block
*, string_list
*, type
*, int);
65 void check_forward_declaration(identifier
*, type_list
*,
67 void check_unmatched_forward_declarations(block
*, name_table
*);
69 void transform_break_stmts(bytecode
*, int, int, int);
71 type
*type_from_name(block
*, char*);
72 type
*get_constant_type(block
*, char*);
73 type
*get_variable_type(block
*, char*);
74 identifier
*get_constant_identifier(block
*, char*);
75 identifier
*get_identifier(block
*, char*);
77 void initialize_variable(block
*, identifier
*, char*, int, char*);
79 void create_class_file(block
*root_block
, FILE *fp
);
80 void write_method(block
*current_block
, FILE *fp
);
81 void write_block_fields(name_table
*, FILE*);
83 void write_paint_method(FILE *fp
);
84 void write_constructor(FILE *fp
);
85 void write_run_method(FILE *fp
);
86 void write_keypressed_method(FILE *fp
);
87 void write_keyreleased_method(FILE *fp
);
89 void write_locals_stackmap(FILE *fp
, identifier
*block_identifier
, int* stack_map_size
);
90 void write_stackmap(FILE *fp
, type_list
*it
, int *stack_map_size
);