| 1 | // This file is part of SmallBASIC |
| 2 | // |
| 3 | // SmallBASIC run-time errors |
| 4 | // |
| 5 | // This program is distributed under the terms of the GPL v2.0 or later |
| 6 | // Download the GNU Public License (GPL) from www.gnu.org |
| 7 | // |
| 8 | // Copyright(C) 2000 Nicholas Christopoulos |
| 9 | |
| 10 | #if !defined(_sberr_h) |
| 11 | #define _sberr_h |
| 12 | |
| 13 | #include "common/smbas.h" |
| 14 | |
| 15 | #if defined(__cplusplus) |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| 19 | typedef enum { |
| 20 | errNone = 0, |
| 21 | errEnd, |
| 22 | errBreak, |
| 23 | errThrow, |
| 24 | errCompile, |
| 25 | errRuntime, |
| 26 | errSyntax |
| 27 | } ErrorState; |
| 28 | |
| 29 | #define IF_ERR_RETURN if (prog_error) {return;} |
| 30 | #define IF_ERR_RETURN_0 if (prog_error) {return 0;} |
| 31 | |
| 32 | void sc_raise(const char *fmt, ...); |
| 33 | void rt_raise(const char *fmt, ...); |
| 34 | void err_missing_rp(); |
| 35 | void err_matdim(); |
| 36 | void err_noargs(); |
| 37 | void err_syntax(int keyword, const char *fmt); |
| 38 | void err_syntax_unknown(); |
| 39 | void err_parm_num(int found, int expected); |
| 40 | void err_parm_limit(int count); |
| 41 | void err_typemismatch(void); |
| 42 | void err_stackmess(void); |
| 43 | void err_parm_byref(int n); |
| 44 | void err_out_of_range(void); |
| 45 | void err_missing_lp(void); |
| 46 | void err_missing_sep(void); |
| 47 | void err_missing_comma(void); |
| 48 | void err_division_by_zero(void); |
| 49 | void err_matop(void); |
| 50 | void err_argerr(void); |
| 51 | void err_stackoverflow(void); |
| 52 | void err_stackunderflow(void); |
| 53 | void err_arrmis_lp(void); |
| 54 | void err_arrmis_rp(void); |
| 55 | void err_arridx(int i, int m); |
| 56 | void err_varisarray(void); |
| 57 | void err_varisnotarray(void); |
| 58 | void err_vararridx(int i, int m); |
| 59 | void err_varnotnum(void); |
| 60 | void err_evsyntax(void); |
| 61 | void err_evtype(void); |
| 62 | void err_evargerr(void); |
| 63 | void err_unsup(void); |
| 64 | void err_file(uint32_t code); |
| 65 | void err_file_not_found(); |
| 66 | void err_matsig(void); |
| 67 | void err_parfmt(const char *fmt); |
| 68 | void err_fopen(void); |
| 69 | void err_syntaxsep(const char *seps); |
| 70 | void err_parsepoly(int idx, int mark); |
| 71 | void err_bfn_err(long code); |
| 72 | void err_pcode_err(long pcode); |
| 73 | void err_const(void); |
| 74 | void err_notavar(void); |
| 75 | void err_run_err(const char *file); |
| 76 | void err_ref_var(); |
| 77 | void err_ref_circ_var(); |
| 78 | void err_array(); |
| 79 | void err_form_input(); |
| 80 | void err_memory(); |
| 81 | void err_network(); |
| 82 | void err_throw(const char *fmt, ...); |
| 83 | int err_handle_error(const char *err, var_p_t var); |
| 84 | void inf_done(void); |
| 85 | void inf_break(int pline); |
| 86 | void cmd_throw(); |
| 87 | |
| 88 | #if defined(__cplusplus) |
| 89 | } |
| 90 | #endif |
| 91 | #endif |
| 92 | |