From 9951ad78c80e144c166a7d476cad7ffdf84332a9 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 13 Aug 2014 14:55:49 -0700 Subject: Debug debugging --- src/mmo/core.cpp | 4 +++- src/mmo/core.hpp | 4 ++++ src/mmo/ids.py | 30 ++++++++++++++++++++++++++++++ src/mmo/strs.py | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/mmo/ids.py create mode 100644 src/mmo/strs.py (limited to 'src/mmo') diff --git a/src/mmo/core.cpp b/src/mmo/core.cpp index f1a8d07..ff12f17 100644 --- a/src/mmo/core.cpp +++ b/src/mmo/core.cpp @@ -106,7 +106,7 @@ void sig_proc(int) */ } // namespace tmwa -int main(int argc, char **argv) +int tmwa_main(int argc, char **argv) { using namespace tmwa; @@ -156,4 +156,6 @@ int main(int argc, char **argv) do_sendrecv(next); do_parsepacket(); } + + return 0; } diff --git a/src/mmo/core.hpp b/src/mmo/core.hpp index 5b2dbbb..259dd90 100644 --- a/src/mmo/core.hpp +++ b/src/mmo/core.hpp @@ -43,3 +43,7 @@ extern int do_init(Slice); /// or when if we manage to exit() gracefully. extern void term_func(void); } // namespace tmwa + +/// grumble grumble stupid intertwined includes mumble mumble +__attribute__((warn_unused_result)) +extern int tmwa_main(int argc, char **argv); diff --git a/src/mmo/ids.py b/src/mmo/ids.py new file mode 100644 index 0000000..2d26215 --- /dev/null +++ b/src/mmo/ids.py @@ -0,0 +1,30 @@ +for s in [ + 'Species', + 'AccountId', + 'CharId', + 'PartyId', + 'ItemNameId', + 'BlockId', +]: + class OtherId(object): + __slots__ = ('_value') + name = 'tmwa::%s' % s + enabled = True + + def __init__(self, value): + self._value = value + + def to_string(self): + value = self._value + fields = value.type.fields() + field0 = fields[-1] + return '%s' % (value[field0]) + + tests = [ + ('tmwa::wrap(123)' % s, '123'), + ] + globals()[s] = OtherId + del OtherId + +class GmLevel(object): + pass diff --git a/src/mmo/strs.py b/src/mmo/strs.py new file mode 100644 index 0000000..3e39ef4 --- /dev/null +++ b/src/mmo/strs.py @@ -0,0 +1,35 @@ +for s in [ + 'AccountName', + 'AccountPass', + 'AccountCrypt', + 'AccountEmail', + 'ServerName', + 'PartyName', + 'VarName', + 'MapName', + 'CharName', +]: + class OtherString(object): + __slots__ = ('_value') + name = 'tmwa::%s' % s + enabled = True + + def __init__(self, value): + self._value = value + + def to_string(self): + value = self._value + fields = value.type.fields() + field0 = fields[-1] + return '%s' % value[field0] + + test_extra = ''' + #include "../strings/fwd.hpp" + using tmwa::operator "" _s; + ''' + + tests = [ + ('tmwa::stringish("Hello"_s)' % s, '"Hello"'), + ] + globals()[s] = OtherString + del OtherString -- cgit v1.2.3-60-g2f50