diff options
| -rw-r--r-- | glstate.py | 4 | ||||
| -rw-r--r-- | retrace.py | 3 | ||||
| -rw-r--r-- | specs/stdapi.py | 8 | ||||
| -rw-r--r-- | specs/winapi.py | 2 | ||||
| -rw-r--r-- | trace.py | 2 |
5 files changed, 11 insertions, 8 deletions
@@ -189,9 +189,9 @@ class JsonWriter(Visitor): It expects a previously declared JSONWriter instance named "json".''' def visit_literal(self, literal, instance): - if literal.format == 'Bool': + if literal.kind == 'Bool': print ' json.writeBool(%s);' % instance - elif literal.format in ('SInt', 'Uint', 'Float', 'Double'): + elif literal.kind in ('SInt', 'Uint', 'Float', 'Double'): print ' json.writeNumber(%s);' % instance else: raise NotImplementedError @@ -53,8 +53,7 @@ def handle_entry(handle, value): class ValueExtractor(stdapi.Visitor): def visit_literal(self, literal, lvalue, rvalue): - #if literal.format in ('Bool', 'UInt'): - print ' %s = (%s).to%s();' % (lvalue, rvalue, literal.format) + print ' %s = (%s).to%s();' % (lvalue, rvalue, literal.kind) def visit_const(self, const, lvalue, rvalue): self.visit(const.type, lvalue, rvalue) diff --git a/specs/stdapi.py b/specs/stdapi.py index 7044c38..0b2fe82 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -80,10 +80,14 @@ Void = _Void() class Literal(Type): + """Class to describe literal types. - def __init__(self, expr, format): + Types which are not defined in terms of other types, such as integers and + floats.""" + + def __init__(self, expr, kind): Type.__init__(self, expr) - self.format = format + self.kind = kind def visit(self, visitor, *args, **kwargs): return visitor.visit_literal(self, *args, **kwargs) diff --git a/specs/winapi.py b/specs/winapi.py index 8f96799..6e3c609 100644 --- a/specs/winapi.py +++ b/specs/winapi.py @@ -49,7 +49,7 @@ BYTE = Alias("BYTE", UInt8) WORD = Alias("WORD", UInt16) DWORD = Alias("DWORD", UInt32) -WCHAR = Literal("WCHAR", "SInt") +WCHAR = Alias("WCHAR", Short) BOOL = Alias("BOOL", Bool) @@ -152,7 +152,7 @@ class DumpImplementer(stdapi.Visitor): '''Dump an instance.''' def visit_literal(self, literal, instance): - print ' Trace::localWriter.write%s(%s);' % (literal.format, instance) + print ' Trace::localWriter.write%s(%s);' % (literal.kind, instance) def visit_string(self, string, instance): if string.length is not None: |
