44 lines
839 B
C
44 lines
839 B
C
#ifndef FZL_VM_READER_H
|
|
#define FZL_VM_READER_H
|
|
|
|
#include <common/fzl_extern.h>
|
|
#include <common/fzl_value.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
// Binary file reader descriptor
|
|
typedef struct
|
|
{
|
|
char *filepath;
|
|
|
|
fzl_value_t *consts;
|
|
uint16_t consts_count;
|
|
|
|
size_t *ops;
|
|
size_t ops_count;
|
|
|
|
char **extern_libs;
|
|
uint16_t extern_libs_count;
|
|
|
|
fzl_extern_type_t *extern_types;
|
|
uint16_t extern_types_count;
|
|
|
|
fzl_extern_fn_t *extern_fns;
|
|
uint16_t extern_fns_count;
|
|
} fzl_vm_reader_t;
|
|
|
|
// Allocate binary file reader
|
|
fzl_vm_reader_t *fzl_vm_mkreader(char *filepath);
|
|
|
|
// Read the file
|
|
bool fzl_vm_read(fzl_vm_reader_t *reader);
|
|
|
|
// Get last error message from the reader
|
|
char *fzl_vm_getreadererror();
|
|
|
|
// Free file reader
|
|
void fzl_vm_freereader(fzl_vm_reader_t *reader);
|
|
|
|
#endif // FZL_VM_READER_H
|