egl: drop an indentation level in _eglFindDisplay() by replacing break/if with a...
[mesa.git] / src / mapi / new / gen_gldispatch_mapi.py
index be7b7495909b9033a94ff2a6279e2433ecc9bc25..85596792e13040bfb1f5ea2f504c9f775bfbe03a 100755 (executable)
@@ -33,7 +33,7 @@ Generates the glapi_mapi_tmp.h header file from Khronos's XML file.
 """
 
 import sys
-import xml.etree.cElementTree as etree
+import xml.etree.ElementTree as etree
 
 import genCommon
 
@@ -58,15 +58,18 @@ def _main():
 #ifndef _GLAPI_TMP_H_
 #define _GLAPI_TMP_H_
 typedef int GLclampx;
-typedef void (APIENTRY  *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
 #endif /* _GLAPI_TMP_H_ */
 """.lstrip("\n"))
 
     print(generate_defines(functions))
-    print(generate_table(functions, allFunctions))
-    print(generate_noop_array(functions))
-    print(generate_public_stubs(functions))
+    if target == "gldispatch":
+        print(generate_table(functions, allFunctions))
+        print(generate_noop_array(functions))
+        print(generate_public_stubs(functions))
     print(generate_public_entries(functions))
+    if target == "gldispatch":
+        print(generate_public_entries_table(functions))
+    print(generate_undef_public_entries())
     print(generate_stub_asm_gcc(functions))
 
 def generate_defines(functions):
@@ -154,10 +157,20 @@ GLAPI {f.rt} APIENTRY {f.name}({f.decArgs})
 """.lstrip("\n").format(f=func, retStr=retStr)
 
     text += "\n"
+    text += "#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */\n"
+    return text
+
+def generate_public_entries_table(functions):
+    text = "#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
     text += "static const mapi_func public_entries[] = {\n"
     for func in functions:
         text += "   (mapi_func) %s,\n" % (func.name,)
     text += "};\n"
+    text += "#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */\n"
+    return text
+
+def generate_undef_public_entries():
+    text = "#ifdef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
     text += "#undef MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN\n"
     text += "#endif /* MAPI_TMP_PUBLIC_ENTRIES_NO_HIDDEN */\n"
     return text