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)
16extern "C" {
17#endif
18
19typedef 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
32void sc_raise(const char *fmt, ...);
33void rt_raise(const char *fmt, ...);
34void err_missing_rp();
35void err_matdim();
36void err_noargs();
37void err_syntax(int keyword, const char *fmt);
38void err_syntax_unknown();
39void err_parm_num(int found, int expected);
40void err_parm_limit(int count);
41void err_typemismatch(void);
42void err_stackmess(void);
43void err_parm_byref(int n);
44void err_out_of_range(void);
45void err_missing_lp(void);
46void err_missing_sep(void);
47void err_missing_comma(void);
48void err_division_by_zero(void);
49void err_matop(void);
50void err_argerr(void);
51void err_stackoverflow(void);
52void err_stackunderflow(void);
53void err_arrmis_lp(void);
54void err_arrmis_rp(void);
55void err_arridx(int i, int m);
56void err_varisarray(void);
57void err_varisnotarray(void);
58void err_vararridx(int i, int m);
59void err_varnotnum(void);
60void err_evsyntax(void);
61void err_evtype(void);
62void err_evargerr(void);
63void err_unsup(void);
64void err_file(uint32_t code);
65void err_file_not_found();
66void err_matsig(void);
67void err_parfmt(const char *fmt);
68void err_fopen(void);
69void err_syntaxsep(const char *seps);
70void err_parsepoly(int idx, int mark);
71void err_bfn_err(long code);
72void err_pcode_err(long pcode);
73void err_const(void);
74void err_notavar(void);
75void err_run_err(const char *file);
76void err_ref_var();
77void err_ref_circ_var();
78void err_array();
79void err_form_input();
80void err_memory();
81void err_network();
82void err_throw(const char *fmt, ...);
83int err_handle_error(const char *err, var_p_t var);
84void inf_done(void);
85void inf_break(int pline);
86void cmd_throw();
87
88#if defined(__cplusplus)
89 }
90#endif
91#endif
92