summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2011-10-16 14:15:36 +0100
committerJosé Fonseca <jose.r.fonseca@gmail.com>2011-10-16 14:15:36 +0100
commit06e85193037ea678ddfb78e23fe65a13516448e0 (patch)
treeec741a26d331df7b7c364901a9fb182c38a03fb8
parent2f2ea48c8f1729bf20936d550b6294bafadb6140 (diff)
Generated code formatting improvements.
-rw-r--r--common/trace_parser.cpp8
-rw-r--r--glstate.py2
-rw-r--r--gltrace.py14
-rw-r--r--trace.py14
4 files changed, 19 insertions, 19 deletions
diff --git a/common/trace_parser.cpp b/common/trace_parser.cpp
index 530c19a..17f4a15 100644
--- a/common/trace_parser.cpp
+++ b/common/trace_parser.cpp
@@ -171,7 +171,7 @@ void Parser::setBookmark(const ParseBookmark &bookmark) {
Call *Parser::parse_call(Mode mode) {
do {
int c = read_byte();
- switch(c) {
+ switch (c) {
case Trace::EVENT_ENTER:
parse_enter(mode);
break;
@@ -373,7 +373,7 @@ Call *Parser::parse_leave(Mode mode) {
bool Parser::parse_call_details(Call *call, Mode mode) {
do {
int c = read_byte();
- switch(c) {
+ switch (c) {
case Trace::CALL_END:
return true;
case Trace::CALL_ARG:
@@ -409,7 +409,7 @@ Value *Parser::parse_value(void) {
int c;
Value *value;
c = read_byte();
- switch(c) {
+ switch (c) {
case Trace::TYPE_NULL:
value = new Null;
break;
@@ -470,7 +470,7 @@ Value *Parser::parse_value(void) {
void Parser::scan_value(void) {
int c = read_byte();
- switch(c) {
+ switch (c) {
case Trace::TYPE_NULL:
case Trace::TYPE_FALSE:
case Trace::TYPE_TRUE:
diff --git a/glstate.py b/glstate.py
index 79cf2de..7ab2dd1 100644
--- a/glstate.py
+++ b/glstate.py
@@ -249,7 +249,7 @@ class StateDumper:
print 'const char *'
print 'enumToString(GLenum pname)'
print '{'
- print ' switch(pname) {'
+ print ' switch (pname) {'
for name in GLenum.values:
print ' case %s:' % name
print ' return "%s";' % name
diff --git a/gltrace.py b/gltrace.py
index e5be57d..5933b9e 100644
--- a/gltrace.py
+++ b/gltrace.py
@@ -233,7 +233,7 @@ class GlTracer(Tracer):
print
print 'static inline struct buffer_mapping *'
print 'get_buffer_mapping(GLenum target) {'
- print ' switch(target) {'
+ print ' switch (target) {'
for target in self.buffer_targets:
print ' case GL_%s:' % target
print ' return & __%s_mapping;' % target.lower()
@@ -248,7 +248,7 @@ class GlTracer(Tracer):
# refers to a symbolic value or not
print 'static bool'
print 'is_symbolic_pname(GLenum pname) {'
- print ' switch(pname) {'
+ print ' switch (pname) {'
for function, type, count, name in glparams.parameters:
if type is glapi.GLenum:
print ' case %s:' % name
@@ -272,7 +272,7 @@ class GlTracer(Tracer):
# Generate a helper function to know how many elements a parameter has
print 'static size_t'
print '__gl_param_size(GLenum pname) {'
- print ' switch(pname) {'
+ print ' switch (pname) {'
for function, type, count, name in glparams.parameters:
if type is not None:
print ' case %s: return %u;' % (name, count)
@@ -692,7 +692,7 @@ class GlTracer(Tracer):
binding_name = 'GL_%s_ARRAY_BUFFER_BINDING' % uppercase_name
function = api.get_function_by_name(function_name)
- print ' // %s' % function.name
+ print ' // %s' % function.prototype()
self.array_trace_prolog(api, uppercase_name)
self.array_prolog(api, uppercase_name)
print ' if (__glIsEnabled(%s)) {' % enable_name
@@ -749,7 +749,9 @@ class GlTracer(Tracer):
else:
SUFFIX = suffix
function_name = 'glVertexAttribPointer' + suffix
- print ' // %s' % function_name
+ function = api.get_function_by_name(function_name)
+
+ print ' // %s' % function.prototype()
print ' if (__vertex_attrib == VERTEX_ATTRIB%s) {' % SUFFIX
if suffix == 'NV':
print ' GLint __max_vertex_attribs = 16;'
@@ -769,8 +771,6 @@ class GlTracer(Tracer):
print ' __glGetVertexAttribiv%s(index, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING%s, &__binding);' % (suffix, SUFFIX)
print ' if (!__binding) {'
- function = api.get_function_by_name(function_name)
-
# Get the arguments via glGet*
for arg in function.args[1:]:
if suffix == 'NV':
diff --git a/trace.py b/trace.py
index 2cb11e5..ccd709c 100644
--- a/trace.py
+++ b/trace.py
@@ -52,7 +52,7 @@ class DumpDeclarator(stdapi.OnceVisitor):
def visit_struct(self, struct):
for type, name in struct.members:
self.visit(type)
- print 'static void __traceStruct%s(const %s &value) {' % (struct.tag, struct.expr)
+ print 'static void _write__%s(const %s &value) {' % (struct.tag, struct.expr)
print ' static const char * members[%u] = {' % (len(struct.members),)
for type, name, in struct.members:
print ' "%s",' % (name,)
@@ -76,14 +76,14 @@ class DumpDeclarator(stdapi.OnceVisitor):
__enum_id = 0
def visit_enum(self, enum):
- print 'static void __traceEnum%s(const %s value) {' % (enum.tag, enum.expr)
+ print 'static void _write__%s(const %s value) {' % (enum.tag, enum.expr)
n = len(enum.values)
for i in range(n):
value = enum.values[i]
print ' static const Trace::EnumSig sig%u = {%u, "%s", %s};' % (i, DumpDeclarator.__enum_id, value, value)
DumpDeclarator.__enum_id += 1
print ' const Trace::EnumSig *sig;'
- print ' switch(value) {'
+ print ' switch (value) {'
for i in range(n):
value = enum.values[i]
print ' case %s:' % value
@@ -136,7 +136,7 @@ class DumpDeclarator(stdapi.OnceVisitor):
print
def visit_polymorphic(self, polymorphic):
- print 'static void __tracePolymorphic%s(int selector, const %s & value) {' % (polymorphic.tag, polymorphic.expr)
+ print 'static void _write__%s(int selector, const %s & value) {' % (polymorphic.tag, polymorphic.expr)
print ' switch (selector) {'
for cases, type in polymorphic.iterswitch():
for case in cases:
@@ -164,7 +164,7 @@ class DumpImplementer(stdapi.Visitor):
self.visit(const.type, instance)
def visit_struct(self, struct, instance):
- print ' __traceStruct%s(%s);' % (struct.tag, instance)
+ print ' _write__%s(%s);' % (struct.tag, instance)
def visit_array(self, array, instance):
length = '__c' + array.type.tag
@@ -186,7 +186,7 @@ class DumpImplementer(stdapi.Visitor):
print ' Trace::localWriter.writeBlob(%s, %s);' % (instance, blob.size)
def visit_enum(self, enum, instance):
- print ' __traceEnum%s(%s);' % (enum.tag, instance)
+ print ' _write__%s(%s);' % (enum.tag, instance)
def visit_bitmask(self, bitmask, instance):
print ' Trace::localWriter.writeBitmask(&__bitmask%s_sig, %s);' % (bitmask.tag, instance)
@@ -215,7 +215,7 @@ class DumpImplementer(stdapi.Visitor):
print ' Trace::localWriter.writeOpaque((const void *)&%s);' % instance
def visit_polymorphic(self, polymorphic, instance):
- print ' __tracePolymorphic%s(%s, %s);' % (polymorphic.tag, polymorphic.switch_expr, instance)
+ print ' _write__%s(%s, %s);' % (polymorphic.tag, polymorphic.switch_expr, instance)
dump_instance = DumpImplementer().visit