diff options
Diffstat (limited to 'src/as_analyzer.c')
| -rw-r--r-- | src/as_analyzer.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/as_analyzer.c b/src/as_analyzer.c index a3e7ea4..f48353f 100644 --- a/src/as_analyzer.c +++ b/src/as_analyzer.c @@ -3,7 +3,7 @@ #include <stddef.h> #include <string.h> -const char * compose_section_label(allocator_t alct, const char * section, const char * name) { +const char * compose_section_label(struct allocator * alct, const char * section, const char * name) { size_t section_len = strlen(section); size_t name_len = strlen(name); size_t sz = section_len + name_len; @@ -14,9 +14,9 @@ const char * compose_section_label(allocator_t alct, const char * section, const return buf; } -void process_section_label(allocator_t alct, prog_t prog) { +void process_section_label(struct allocator * alct, struct prog * prog) { const char * section = ""; - stmt_t* stmts = prog->stmts->stmts; + struct stmt ** stmts = prog->stmts->stmts; for (size_t i = 0; ; i++) { if (stmts[i] == NULL) break; if (stmts[i]->label == NULL) continue; @@ -30,11 +30,11 @@ void process_section_label(allocator_t alct, prog_t prog) { } } -size_t instr_size(instr_t instr) { +size_t instr_size(struct instr * instr) { return op_size(instr->op); } -struct sym_table new_sym_table(allocator_t alct) { +struct sym_table new_sym_table(struct allocator * alct) { struct sym_table tbl; tbl.cap = 16; tbl.size = 0; @@ -42,7 +42,7 @@ struct sym_table new_sym_table(allocator_t alct) { return tbl; } -void sym_table_add(allocator_t alct, struct sym_table* tbl, const char* name, int pos) { +void sym_table_add(struct allocator * alct, struct sym_table* tbl, const char* name, int pos) { if (tbl->cap == tbl->size) { void *old_buf = tbl->buf; tbl->buf = allocate(alct, sizeof(struct sym_table_entry) * tbl->cap * 2); @@ -53,14 +53,14 @@ void sym_table_add(allocator_t alct, struct sym_table* tbl, const char* name, in tbl->size += 1; } -struct sym_table analyze_prog(allocator_t alct, prog_t prog) { +struct sym_table analyze_prog(struct allocator * alct, struct prog * prog) { process_section_label(alct, prog); - stmt_t * stmts = prog->stmts->stmts; + struct stmt * * stmts = prog->stmts->stmts; struct sym_table tbl = new_sym_table(alct); size_t cur_pos = 0; for (int i = 0; ; i++) { if (stmts[i] == NULL) break; - stmt_t stmt = stmts[i]; + struct stmt * stmt = stmts[i]; if (stmt->label) { sym_table_add(alct, &tbl, stmt->label->name, cur_pos); } |
