summaryrefslogtreecommitdiff
path: root/masm/asm.h
blob: 1bc7cf541fca2ec277828f9b78502cea636b27a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Copyright (c) 2024 Freya Murphy */

#ifndef __ASM_H__
#define __ASM_H__

#include <stddef.h>

struct str_table {
        char *ptr;
        size_t size;
};

/* initalize a string table */
void strtbl_init(struct str_table *str_tbl);

/* free a string table */
void strtbl_free(struct str_table *str_tbl);

/* get a string form the string table */
int strtbl_get_str(struct str_table *str_tbl, const char *str, size_t *res);

/* get or append a string into the string table */
int strtbl_write_str(struct str_table *str_tbl, const char *str, size_t *res);

struct assembler {
        struct parser *parser;
        struct str_table str_tbl;
};

/* assemble a mips32 file*/
int assemble_file_mips32(char *path);

#endif /* __ASM_H__ */