mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
better failure reporting
This commit is contained in:
parent
34675f0cb7
commit
963e286f49
9 changed files with 184 additions and 63 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "utils.h"
|
||||
|
||||
const char *read_cmd(char *ip);
|
||||
|
||||
bytefile *read_file(char *fname);
|
||||
|
||||
void dump_file(FILE *f, bytefile *bf);
|
||||
|
|
|
|||
|
|
@ -49,13 +49,16 @@ struct State {
|
|||
|
||||
bool is_closure_call;
|
||||
|
||||
char *ip; // instruction pointer
|
||||
char *call_ip; // prev instruction pointer (to remember jmp locations)
|
||||
char *ip; // instruction pointer
|
||||
char *instr_ip; // poiter to current instruction
|
||||
char *call_ip; // prev instruction pointer (to remember jmp locations)
|
||||
};
|
||||
|
||||
void init_state(bytefile *bf, struct State *s);
|
||||
void cleanup_state(struct State *state);
|
||||
|
||||
void s_failure(struct State *state, const char *msg);
|
||||
|
||||
// ------ VarCategory ------
|
||||
|
||||
enum VarCategory {
|
||||
|
|
@ -65,6 +68,4 @@ enum VarCategory {
|
|||
VAR_CLOSURE = 3
|
||||
};
|
||||
|
||||
enum VarCategory to_var_category(uint8_t category);
|
||||
|
||||
void print_stack(struct State *s);
|
||||
enum VarCategory to_var_category(struct State *s, uint8_t category);
|
||||
|
|
|
|||
|
|
@ -27,4 +27,6 @@ char *get_public_name(bytefile *f, size_t i);
|
|||
/* Gets an offset for a public symbol */
|
||||
size_t get_public_offset(bytefile *f, size_t i);
|
||||
|
||||
void exec_failure(const char *cmd, int line, aint offset, const char *msg);
|
||||
|
||||
// ---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue