From 3fa6f4b4c400c7354e05ac7bae128d4d9ee30e5c Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 14 Oct 2013 15:00:12 -0700 Subject: Add infrastructure for debug pretty printers --- src/strings/zstring.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/strings/zstring.py (limited to 'src/strings/zstring.py') diff --git a/src/strings/zstring.py b/src/strings/zstring.py new file mode 100644 index 0000000..5021e1c --- /dev/null +++ b/src/strings/zstring.py @@ -0,0 +1,18 @@ +class ZString(object): + ''' print a ZString + ''' + __slots__ = ('_value') + name = 'strings::ZString' + enabled = True + + def __init__(self, value): + self._value = value + + def children(self): + yield 'base', self._value['_base'] + + def to_string(self): + b = self._value['_b']['_ptr'] + e = self._value['_e']['_ptr'] + d = e - b + return b.lazy_string(length=d) -- cgit v1.2.3-70-g09d2