ScummVM API documentation
cc_common.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22// Script options and error reporting.
23
24#ifndef AGS_SHARED_SCRIPT_CC_COMMON_H
25#define AGS_SHARED_SCRIPT_CC_COMMON_H
26
27#include "ags/shared/util/string.h"
28
29namespace AGS3 {
30
31#define SCOPT_EXPORTALL 1 // export all functions automatically
32#define SCOPT_SHOWWARNINGS 2 // printf warnings to console
33#define SCOPT_LINENUMBERS 4 // include line numbers in compiled code
34#define SCOPT_AUTOIMPORT 8 // when creating instance, export funcs to other scripts
35#define SCOPT_DEBUGRUN 0x10 // write instructions as they are procssed to log file
36#define SCOPT_NOIMPORTOVERRIDE 0x20 // do not allow an import to be re-declared
37#define SCOPT_LEFTTORIGHT 0x40 // left-to-right operator precedance
38#define SCOPT_OLDSTRINGS 0x80 // allow old-style strings
39#define SCOPT_UTF8 0x100 // UTF-8 text mode
40
41extern void ccSetOption(int, int);
42extern int ccGetOption(int);
43
44// error reporting
45
47 bool HasError = false; // set if error occurs
48 bool IsUserError = false; // marks script use errors
49 AGS::Shared::String ErrorString; // description of the error
50 int Line = 0; // line number of the error
51 AGS::Shared::String CallStack; // callstack where error happened
52};
53
54void cc_clear_error();
55bool cc_has_error();
56const ScriptError &cc_get_error();
57// Returns callstack of the last recorded script error, or a callstack
58// of a current execution point, if no script error is currently saved in memory.
59AGS::Shared::String cc_get_err_callstack(int max_lines = INT_MAX);
60void cc_error(const char *, ...);
61void cc_error(const ScriptError &err);
62// Project-dependent script error formatting
63AGS::Shared::String cc_format_error(const AGS::Shared::String &message);
64
65} // namespace AGS3
66
67#endif
Definition: string.h:60
Definition: geometry.h:118
Definition: cc_common.h:46