From b5475eb38b8b79a13a0a9e8a6cb68755b84f0c7b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 7 Mar 2023 01:39:42 +1100 Subject: Various updates, mostly around Lua: Compile Lua as C++. When Lua is compiled as C, it uses setjmp/longjmp for error handling, resulting in failure to unwind intermediate stack frames. Trying to ensure no objects with non-trivial destructors are in scope when raising a Lua error is error-prone. In particular, converting an exception to a Lua error becomes convoluted, and raising a Lua error from a constructor is effectively impossible. Updated Lua to 5.4.4 - this includes a brand-new garbage collector implementation with better performance. The main thing removed is the deprecated bitlib. Updated sol2 to version 3.3.0 - this adds support for Lua 5.4 and fixes a number of issues, including not correctly handling errors when Lua is built as C++. Updated LuaFileSystem to version 1.8.0 - this adds support for symbolic links on Windows, as well as Lua 5.4 compatibility. Updated LuaSQLite3 to version 0.9.5 - this fixes issues in multi-threaded environments, as well as Lua 5.4 compatibility. Fixed double-free after attempting to construct a debugger expression from Lua with an invalid string, and exposed expression error to Lua in a better way. Added warning level print function to Lua. Fixed saving cheats with shift operators in expressions, although this code isn't actually used as there's no cheat editor. --- docs/source/techspecs/luareference.rst | 35 +++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'docs/source/techspecs') diff --git a/docs/source/techspecs/luareference.rst b/docs/source/techspecs/luareference.rst index 8ca4e984517..28ee0c08c75 100644 --- a/docs/source/techspecs/luareference.rst +++ b/docs/source/techspecs/luareference.rst @@ -3953,8 +3953,9 @@ emu.parsed_expression(symbols, string, [default_base]) Creates an expression by parsing the supplied string, looking up symbols in the supplied :ref:`symbol table `. If the default base for interpreting integer literals is not supplied, 16 is used - (hexadecimal). Raises an error if the string contains syntax errors or uses - undefined symbols. + (hexadecimal). Raises an :ref:`expression error + ` if the string contains syntax errors + or uses undefined symbols. Methods ^^^^^^^ @@ -3964,13 +3965,14 @@ expression:set_default_base(base) positive integer. expression:parse(string) Parse a debugger expression string. Replaces the current contents of the - expression if it is not empty. Raises an error if the string contains - syntax errors or uses undefined symbols. The previous content of the - expression is not preserved when attempting to parse an invalid expression - string. + expression if it is not empty. Raises an :ref:`expression error + ` if the string contains syntax errors + or uses undefined symbols. The previous content of the expression is not + preserved when attempting to parse an invalid expression string. expression:execute() Evaluates the expression, returning an unsigned integer result. Raises an - error if the expression cannot be evaluated (e.g. calling a function with an + :ref:`expression error ` if the + expression cannot be evaluated (e.g. attempting to call a function with an invalid number of arguments). Properties @@ -4224,3 +4226,22 @@ watchpoint.condition (read-only) watchpoint.action (read-only) An action the debugger will run when the watchpoint is hit and the condition evaluates to a non-zero value. An empty string if no action was specified. + +.. _luareference-debug-expressionerror: + +Expression error +~~~~~~~~~~~~~~~~ + +Wraps MAME’s ``expression_error`` class, describing an error occurring while +parsing or executing a debugger expression. Raised on errors when using +:ref:`parsed expressions `. Can be converted to +a string to provide a description of the error. + +Properties +^^^^^^^^^^ + +err.code (read-only) + An implementation-dependent number representing the category of error. + Should not be displayed to the user. +err.offset (read-only) + The offset within the expression string where the error was encountered. -- cgit v1.2.3-70-g09d2