#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2011, The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if __name__ == "__main__": externs = [] lines = open("../../../frameworks/base/opengl/libs/GLES2_dbg/gl2_api_annotated.in").readlines() output = open("src/com/android/glesv2debugger/GLFunction.java", "w") i = 0 output.write( """/* ** Copyright 2011, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ // auto generated by generate_GLFunction_java.py" package com.android.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 output.write(" %s(%d, DebuggerMessage.Message.Function.%s),\n" % (functionName, index, functionName)) index += 1 output.write(""" ; public final int index; public final DebuggerMessage.Message.Function function; GLFunction(final int index, final DebuggerMessage.Message.Function function) { this.index = index; this.function = function; } }""")