/* Header to label list handler.
Copyright 2014 Molnár Károly
Copyright 2016 Molnár Károly
*/
#pragma once
#define DSECTION_MAX 50
#define DSYMBOL_MAX 10000
#define SECT_NAME_GLOBAL "GLOBAL"
enum {
SECT_SPEC_CODE = 0,
SECT_SPEC_DATA,
SECT_SPEC_EEDATA
};
#define SECT_SPEC_MAX_NUM (SECT_SPEC_EEDATA + 1)
enum {
CSYM_START = 1<<0, // The start of the symbol.
CSYM_END = 1<<1, // The symbol an area.
CSYM_DATA = 1<<2, // The symbol a data in the code area.
CSYM_ORG = 1<<15, // Internal use only unto the ORG directive. (Does not belong to the input parser.)
CSYM_USED = 1<<16, // The symbol used in the disassembled source.
};
struct lset_symbol_t {
char *name;
long start;
long end;
unsigned attr; /* CSYM_yyyy */
int line_number;
lset_symbol_t *prev;
lset_symbol_t *next;
void list() const;
};
struct lset_section_t {
char *name;
unsigned symbol_number;
int line_number;
lset_symbol_t *symbol_first;
lset_symbol_t *symbol_actual;
lset_symbol_t *symbol_last;
lset_symbol_t **symbol_table;
lset_section_t *prev;
lset_section_t *next;
void lset_symbol_list_all(bool Use_table) const;
};
struct lset_section_root_t {
char *file_name;
unsigned is_data;
unsigned section_number;
lset_section_t *section_global;
lset_section_t *section_first;
lset_section_t *section_actual;
lset_section_t *section_last;
lset_section_t *sections[SECT_SPEC_MAX_NUM];
void lset_section_full_list(bool Use_table) const;
};
void lset_init(lset_section_root_t *Root, const char *File_name);
lset_symbol_t* lset_symbol_find(const lset_section_t *Section, const char *Name);
lset_symbol_t* lset_symbol_find_addr(const lset_section_t *Section, long Start_addr, long End_addr, int Use_table);
lset_symbol_t* lset_symbol_new(lset_section_t *Section, const char *Name, long Start, long End,
unsigned Attr, int Line_number);
void lset_symbol_make_table(lset_section_t *Section);
void lset_symbol_check_bounds(const lset_section_t *Section);
void lset_symbol_check_absolute_limits(const lset_section_t *Section, long Min, long Max);
void lset_symbol_check_align(const lset_section_t *Section, long Align);
void lset_symbol_free_all(lset_section_t *Section);
void lset_section_list(const lset_section_root_t *Root);
lset_section_t* lset_section_find(const lset_section_root_t *Root, const char *Name);
lset_section_t* lset_section_make_global(lset_section_root_t *Root);
lset_section_t* lset_section_new(lset_section_root_t *Root, const char *Name, int Line_number);
void lset_section_make_symbol_tables(lset_section_root_t *Root);
void lset_section_check_bounds(const lset_section_root_t *Root);
void lset_sections_choose(lset_section_root_t *Root);
void lset_delete(lset_section_root_t *Root);
Vorgefundene Kodierung: UTF-8 | 0
|