#!/usr/bin/perl -w # # gen-gdkglwglext-h.pl # # Script for generating gdk/win32/gdkglwglext.h from SGI's OpenGL extension # header. # # written by Naofumi Yasufuku # @input_headers = ("wglext.h", "wglext-extra.h"); #--------------- open(IN, "common-header.h") || die "cannot open common-header.h"; print while (); close(IN); print < #ifdef G_OS_WIN32 #define WIN32_LEAN_AND_MEAN 1 #include #endif #include #include #include #include #undef __wglext_h_ #undef WGL_WGLEXT_VERSION #include #include G_BEGIN_DECLS EOF #--------------- foreach $in (@input_headers) { open(IN, $in) || die "cannot open $in"; while () { if (/#ifndef\s+WGL_[a-zA-Z0-9]+_[a-z0-9_]+/) { @line = split; $_ = ; if (/#define\s+$line[1]/) { while () { if (/#ifdef\s+WGL_WGLEXT_PROTOTYPES/) { $extension = $line[1]; # function prototypes @functions = (); while () { last if (/#endif/); ($func) = /(wgl\w+)/; push(@functions, $func); } # typedefs @typedefs = (); while () { last if (/#endif/); chomp; push(@typedefs, $_); } generate_code(); last; } elsif (/#endif/) { last; } } } } } close(IN); } #--------------- print <