From 58e4ec577f3168eba282e9ad36257e9bee0702f2 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 15 Oct 2014 16:41:14 -0700 Subject: Always print symbols if known for pointers --- src/map/magic-expr.py | 2 +- src/map/magic-interpreter.py | 4 ++-- src/map/magic-stmt.py | 2 +- src/map/script-persist.py | 18 +++++++++++++----- 4 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src/map') diff --git a/src/map/magic-expr.py b/src/map/magic-expr.py index 0d9db55..c48b79b 100644 --- a/src/map/magic-expr.py +++ b/src/map/magic-expr.py @@ -34,5 +34,5 @@ class fun_t(object): ('static_cast(nullptr)', '(fun_t *) nullptr'), ('new tmwa::magic::fun_t{"name"_s, "sig"_s, \'\\0\', nullptr}', - 'regex:\(fun_t \*\) = \{->name = "name", ->signature = "sig", ->ret_ty = 0 \'\\\\000\', ->fun = (0x)?0}'), + '(fun_t *) = {->name = "name", ->signature = "sig", ->ret_ty = 0 \'\\000\', ->fun = nullptr}'), ] diff --git a/src/map/magic-interpreter.py b/src/map/magic-interpreter.py index bbf135c..141cd22 100644 --- a/src/map/magic-interpreter.py +++ b/src/map/magic-interpreter.py @@ -177,7 +177,7 @@ class effect_t(object): ('tmwa::magic::effect_t(tmwa::magic::EffectEnd{}, tmwa::dumb_ptr())', '{> = {(tmwa::magic::EffectEnd) = {}}, next = 0x0}'), ('tmwa::magic::effect_t(tmwa::magic::EffectCall{nullptr, tmwa::dumb_ptr>>(), tmwa::dumb_ptr()}, tmwa::dumb_ptr())', - '{> = {(tmwa::magic::EffectCall) = {formalv = 0x0, actualvp = 0x0, body = 0x0}}, next = 0x0}'), + '{> = {(tmwa::magic::EffectCall) = {formalv = nullptr, actualvp = 0x0, body = 0x0}}, next = 0x0}'), ] @@ -211,5 +211,5 @@ class cont_activation_record_t(object): ('tmwa::magic::cont_activation_record_t(tmwa::magic::CarFor{42, tmwa::dumb_ptr(), 123, 456}, tmwa::dumb_ptr())', '{> = {(tmwa::magic::CarFor) = {id = 42, body = 0x0, current = 123, stop = 456}}, return_location = 0x0}'), ('tmwa::magic::cont_activation_record_t(tmwa::magic::CarProc{123, nullptr, tmwa::dumb_ptr()}, tmwa::dumb_ptr())', - '{> = {(tmwa::magic::CarProc) = {args_nr = 123, formalap = 0x0, old_actualpa = 0x0 = {sz = 0}}}, return_location = 0x0}'), + '{> = {(tmwa::magic::CarProc) = {args_nr = 123, formalap = nullptr, old_actualpa = 0x0 = {sz = 0}}}, return_location = 0x0}'), ] diff --git a/src/map/magic-stmt.py b/src/map/magic-stmt.py index 14289ef..65f44a7 100644 --- a/src/map/magic-stmt.py +++ b/src/map/magic-stmt.py @@ -33,5 +33,5 @@ class op_t(object): ('static_cast(nullptr)', '(op_t *) nullptr'), ('new tmwa::magic::op_t{"name"_s, "sig"_s, nullptr}', - 'regex:\(op_t \*\) = \{->name = "name", ->signature = "sig", ->op = (0x)?0}'), + '(op_t *) = {->name = "name", ->signature = "sig", ->op = nullptr}'), ] diff --git a/src/map/script-persist.py b/src/map/script-persist.py index 454c828..df60cf4 100644 --- a/src/map/script-persist.py +++ b/src/map/script-persist.py @@ -3,7 +3,17 @@ class script_data(object): test_extra = ''' using tmwa::operator "" _s; - #include "../map/script-parse.hpp" + + #include "../map/script-parse-internal.hpp" + + static + tmwa::Borrowed fake_script() + { + static + const std::vector buffer; + return borrow(reinterpret_cast(buffer)); + } + ''' tests = [ @@ -19,10 +29,8 @@ class script_data(object): '{> = {(tmwa::ScriptDataArg) = {numi = 0}}, }'), ('tmwa::script_data(tmwa::ScriptDataVariable{tmwa::SIR()})', '{> = {(tmwa::ScriptDataVariable) = {reg = {impl = 0}}}, }'), - # the {script = } is almost certainly a bug in gdb's 'set print address' - # but the most I can do is check for changes. - ('tmwa::script_data(tmwa::ScriptDataRetInfo{tmwa::borrow(*tmwa::parse_script("{}"_s, 1, true).release())})', - 'regex:\{> = \{\(tmwa::ScriptDataRetInfo\) = \{script = \}\}, \}'), + ('tmwa::script_data(tmwa::ScriptDataRetInfo{fake_script()})', + '{> = {(tmwa::ScriptDataRetInfo) = {script = }}, }'), ('tmwa::script_data(tmwa::ScriptDataFuncRef{404})', '{> = {(tmwa::ScriptDataFuncRef) = {numi = 404}}, }'), ] -- cgit v1.2.3-70-g09d2