fxos/include/fxos/load.h

47 lines
1.5 KiB
C++

//---
// fxos.load: Data file lexers and loaders
//---
#ifndef LIBFXOS_LOAD_H
#define LIBFXOS_LOAD_H
#include <fxos/util.h>
#include <string>
#include <map>
namespace FxOS {
using Header = std::map<std::string, std::string>;
/* Load any fxos data file.
@file Data file, assumed to follow the fxos header and data format.
This function reads the header with load_header() then calls the appropriate
lexer and loader depending on the type specified in the header. */
void load(std::string path);
/* Load the header of a data file.
@file Data file, assumed with an fxos header type-specific contents
@offset Will be set to the byte offset where content starts
@line Will be set to the liner number where content starts
This function is used when reading all data files for fxos. The header
indicates the file type, thus the syntax of the contents. Some metadata can
also be specified here.
The parameters [offset] and [line] are set to reflect the location in the
file where the raw content starts. These parameters are used to initialize
the lexers in all other load functions. */
Header load_header(File &file, size_t &offset, int &line);
/* Load an assembly instruction table for the disassembler.
@file Data file, presumably analyzed with lex_header()
@start_offset Offset of assembly data in the file
@start_line Line where assembly data starts in the file (for errors) */
void load_asm(File &file, size_t start_offset, size_t start_line);
} /* namespace FxOS */
#endif /* LIBFXOS_LOAD_H */