David Li | 5d710c2 | 2011-03-04 17:47:18 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # -*- coding: utf-8 -*- |
| 3 | |
| 4 | # |
| 5 | # Copyright 2011, The Android Open Source Project |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | # |
| 19 | |
| 20 | if __name__ == "__main__": |
| 21 | externs = [] |
| 22 | lines = open("../../../frameworks/base/opengl/libs/GLES2_dbg/gl2_api_annotated.in").readlines() |
| 23 | output = open("src/com/android/glesv2debugger/GLFunction.java", "w") |
| 24 | i = 0 |
| 25 | output.write( |
| 26 | """/* |
| 27 | ** Copyright 2011, The Android Open Source Project |
| 28 | ** |
| 29 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 30 | ** you may not use this file except in compliance with the License. |
| 31 | ** You may obtain a copy of the License at |
| 32 | ** |
| 33 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 34 | ** |
| 35 | ** Unless required by applicable law or agreed to in writing, software |
| 36 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 37 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 38 | ** See the License for the specific language governing permissions and |
| 39 | ** limitations under the License. |
| 40 | */ |
| 41 | |
| 42 | // auto generated by generate_GLFunction_java.py" |
| 43 | |
| 44 | package com.android.glesv2debugger; |
| 45 | |
| 46 | public enum GLFunction { |
| 47 | """) |
| 48 | |
| 49 | index = 0 |
| 50 | for line in lines: |
| 51 | if line.find("API_ENTRY(") >= 0: # a function prototype |
| 52 | returnType = line[0: line.find(" API_ENTRY(")] |
| 53 | functionName = line[line.find("(") + 1: line.find(")")] #extract GL function name |
| 54 | output.write(" %s(%d, DebuggerMessage.Message.Function.%s),\n" % (functionName, index, functionName)) |
| 55 | index += 1 |
| 56 | output.write(""" ; |
| 57 | |
| 58 | public final int index; |
| 59 | public final DebuggerMessage.Message.Function function; |
| 60 | |
| 61 | GLFunction(final int index, final DebuggerMessage.Message.Function function) { |
| 62 | this.index = index; |
| 63 | this.function = function; |
| 64 | } |
| 65 | }""") |
| 66 | |
| 67 | |