|
@@ -30,7 +30,9 @@
|
|
|
#define PACKAGE_STRING "<unknown>"
|
|
|
#endif
|
|
|
|
|
|
-#if HAVE_GPERF
|
|
|
+#define USE_GPERF HAVE_GPERF && !defined(_WIN32)
|
|
|
+
|
|
|
+#if USE_GPERF
|
|
|
#include <unistd.h>
|
|
|
#include <sys/wait.h>
|
|
|
#include <sys/types.h>
|
|
@@ -555,6 +557,7 @@ void print_interface_declaration(struct interface *iface, FILE *header_file)
|
|
|
|
|
|
FOREACH (val, iface->enums, enums_type) {
|
|
|
enum_map_type::iterator iter = g_enum_map.find(*val);
|
|
|
+ fprintf(header_file, "#undef %s%s\n", enumeration_prefix, *val);
|
|
|
if (iter != g_enum_map.end()) {
|
|
|
fprintf(header_file, "#define %s%s 0x%x\n",
|
|
|
enumeration_prefix, *val,
|
|
@@ -575,6 +578,7 @@ void print_interface_declaration(struct interface *iface, FILE *header_file)
|
|
|
}
|
|
|
FOREACH (iter, iface->commands, commands_type) {
|
|
|
command *command = iter->second;
|
|
|
+ fprintf(header_file, "#undef %s%s\n", g_command_prefix, command->name);
|
|
|
fprintf(header_file, "#define %s%s _%s_%s%s\n",
|
|
|
g_command_prefix, command->name,
|
|
|
g_prefix, g_command_prefix, command->name);
|
|
@@ -756,6 +760,7 @@ void bindify(const char *header_name, int min_version, FILE *header_file , FILE
|
|
|
fprintf(source_file, "#define %s_%sVERSION %d\n", g_macro_prefix, g_enumeration_prefix, max_version);
|
|
|
|
|
|
FOREACH (iter, g_extension_interfaces, extension_interfaces_type) {
|
|
|
+ indent_fprintf(source_file, "#undef %s_ENABLE_%s%s\n", g_macro_prefix, g_enumeration_prefix, iter->first);
|
|
|
indent_fprintf(source_file, "#define %s_ENABLE_%s%s\n", g_macro_prefix, g_enumeration_prefix, iter->first);
|
|
|
}
|
|
|
|
|
@@ -772,7 +777,7 @@ void bindify(const char *header_name, int min_version, FILE *header_file , FILE
|
|
|
is_gl_api ? "false" : "true");
|
|
|
}
|
|
|
|
|
|
-#if HAVE_GPERF
|
|
|
+#if USE_GPERF
|
|
|
if (is_gl_api) {
|
|
|
//
|
|
|
// Have gperf make a hash table for extension names. We can write the output
|
|
@@ -840,7 +845,7 @@ void bindify(const char *header_name, int min_version, FILE *header_file , FILE
|
|
|
indent_fprintf(source_file, "if (actual_version < req_version) return false;\n");
|
|
|
indent_fprintf(source_file, "for (i = 0; i < num_extensions; i++) {\n");
|
|
|
indent_fprintf(source_file, "\tconst char *extname = (const char *)glGetStringi(GL_EXTENSIONS, i);\n");
|
|
|
-#if HAVE_GPERF
|
|
|
+#if USE_GPERF
|
|
|
indent_fprintf(source_file, "\tstruct extension_match *match = %s_find_extension(extname, strlen(extname));\n", g_prefix);
|
|
|
indent_fprintf(source_file, "\tif (match)\n");
|
|
|
indent_fprintf(source_file, "\t\t*match->support_flag = true;\n");
|
|
@@ -898,7 +903,8 @@ static void print_help(const char *program_name)
|
|
|
" -n,--namespace <Namespace> Namespace for generated bindings. This is the first\n"
|
|
|
" part of the name of every function and macro.\n"
|
|
|
" -s,--srcdir <dir> Directory to find XML sources\n"
|
|
|
- " -v,--version Print version information\n");
|
|
|
+ " -v,--version Print version information\n"
|
|
|
+ " -h,--help Display this page\n");
|
|
|
}
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
@@ -924,8 +930,8 @@ int main(int argc, char **argv)
|
|
|
static struct option options [] = {
|
|
|
{"api" , 1, 0, 'a' },
|
|
|
{"srcdir" , 1, 0, 's' },
|
|
|
- {"version" , 1, 0, 'v' },
|
|
|
- {"namespace" , 1, 0, 'n' },
|
|
|
+ {"version" , 1, 0, 'v' },
|
|
|
+ {"namespace" , 0, 0, 'n' },
|
|
|
{"help" , 0, 0, 'h' }
|
|
|
};
|
|
|
|
|
@@ -1040,14 +1046,8 @@ int main(int argc, char **argv)
|
|
|
|
|
|
char header_name[100];
|
|
|
char c_name[100];
|
|
|
- snprintf(header_name, sizeof(header_name), "%s-%s%s",
|
|
|
- g_prefix,
|
|
|
- g_variant_name,
|
|
|
- ".h");
|
|
|
- snprintf(c_name, sizeof(c_name), "%s-%s%s",
|
|
|
- g_prefix,
|
|
|
- g_variant_name,
|
|
|
- ".c");
|
|
|
+ snprintf(header_name, sizeof(header_name), "%s.h", g_variant_name);
|
|
|
+ snprintf(c_name, sizeof(c_name), "%s.c", g_variant_name);
|
|
|
|
|
|
FILE *header_file = fopen(header_name, "w+");
|
|
|
if (!header_file) {
|