out.write("\nExtension::SupportLevel init_%s()\n{\n"%target_ext.name.lower())
if core_version:
out.write("\tif(is_disabled(\"GL_%s\"))\n\t\treturn Extension::UNSUPPORTED;\n"%target_ext.name)
+ out.write("#if !defined(__APPLE__) || defined(GL_VERSION_%d_%d)\n"%tuple(core_version))
out.write("\tif(")
if backport_ext:
out.write("is_supported(\"GL_%s\") || "%backport_ext.name)
out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS%s(%s));\n"%(f.name, f.typedef, gpa_suffix, f.name))
out.write("\t\treturn Extension::CORE;\n")
out.write("\t}\n")
+ out.write("#endif\n")
if source_ext and source_ext!=backport_ext:
+ out.write("#if !defined(__APPLE__) || defined(GL_%s)\n"%target_ext.name)
out.write("\tif(is_supported(\"GL_%s\"))\n\t{\n"%(source_ext.name))
for f in funcs:
if f.sources:
out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS(%s));\n"%(f.name, f.typedef, src.name))
out.write("\t\treturn Extension::EXTENSION;\n")
out.write("\t}\n")
+ out.write("#endif\n")
out.write("\treturn Extension::UNSUPPORTED;\n")
out.write("}\n")