replicant-frameworks_native/opengl/libs/GLES2_dbg/generate_GLFunction_java.py

35 lines
849 B
Python
Raw Normal View History

#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
if __name__ == "__main__":
externs = []
lines = open("gl2_api.in").readlines()
i = 0
print "// auto generated by generate_GLFunction_java.py"
print """package GLESv2Debugger;
public enum GLFunction
{"""
index = 0
for line in lines:
if line.find("API_ENTRY(") >= 0: # a function prototype
returnType = line[0: line.find(" API_ENTRY(")]
functionName = line[line.find("(") + 1: line.find(")")] #extract GL function name
print "\t%s(%d, DebuggerMessage.Message.Function.%s)," % (functionName, index, functionName)
index += 1
print """\t;
\tpublic final int index;
\tpublic final DebuggerMessage.Message.Function function;
\tGLFunction(final int index, final DebuggerMessage.Message.Function function)
\t{
\t\tthis.index = index;
\t\tthis.function = function;
\t}
}"""