34 lines
774 B
C
34 lines
774 B
C
#pragma once
|
|
|
|
#include "header.h"
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
char* ident;
|
|
const char* filename;
|
|
uint16_t offset;
|
|
bool resolved;
|
|
} Sym;
|
|
|
|
void sym_destroy(Sym* sym);
|
|
|
|
typedef struct {
|
|
Sym* syms;
|
|
size_t syms_capacity;
|
|
size_t syms_size;
|
|
} SymTable;
|
|
|
|
void sym_table_construct(SymTable* table);
|
|
void sym_table_destroy(SymTable* table);
|
|
Sym* sym_table_find(SymTable* table, const char* ident);
|
|
void sym_table_add_unresolved(
|
|
SymTable* table, char* ident, const char* filename);
|
|
void sym_table_add_resolved(
|
|
SymTable* table, char* ident, const char* filename, uint16_t offset);
|
|
int sym_table_walk_header(SymTable* syms,
|
|
Header* header,
|
|
uint16_t offset,
|
|
const char* input_filename);
|