From: Fredrik Tolf Date: Wed, 18 Jul 2007 23:26:24 +0000 (+0200) Subject: Compile .gtkh header files from .desc files. X-Git-Tag: 1.0~106^2~6 X-Git-Url: http://dolda2000.com/gitweb/?p=doldaconnect.git;a=commitdiff_plain;h=4dda7bfaad18c2d4bf23d7b85641c34a632c3ae6 Compile .gtkh header files from .desc files. --- diff --git a/.gitignore b/.gitignore index b56d617..cb9c624 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ Makefile.in .deps .libs *.gtk +*.gtkh /m4 /configure diff --git a/clients/gtk2/Makefile.am b/clients/gtk2/Makefile.am index 32a9349..67e7646 100644 --- a/clients/gtk2/Makefile.am +++ b/clients/gtk2/Makefile.am @@ -9,7 +9,7 @@ dolcon_SOURCES= dolcon.c \ EXTRA_DIST=mainwnd.desc inpdialog.desc pref.desc reslist.desc dolcon.desktop -BUILT_SOURCES=mainwnd.gtk inpdialog.gtk pref.gtk reslist.gtk +BUILT_SOURCES= mainwnd.gtk inpdialog.gtk pref.gtk reslist.gtk main.c: mainwnd.gtk inpdialog.gtk pref.gtk reslist.gtk @@ -20,8 +20,10 @@ dolcon_CPPFLAGS=@GTK2_CFLAGS@ @LIBXML_CFLAGS@ \ -DLOCALEDIR=\"$(localedir)\" .desc.gtk: $(top_srcdir)/common/makegdesc - cpp $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $< | $(top_srcdir)/common/makegdesc >$@ + target="$@"; \ + basename="$${target%.gtk}"; \ + cpp $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< \ + | $(top_srcdir)/common/makegdesc -h "$${basename}.gtkh" >$@ mainwnd.desc: ../../config.h diff --git a/common/makegdesc b/common/makegdesc index 0eaf7c7..32271fb 100755 --- a/common/makegdesc +++ b/common/makegdesc @@ -1,5 +1,10 @@ #!/usr/bin/perl +use Getopt::Long; +use IO::File; + +GetOptions(\%args, "h=s") || exit 1; + $tempvar = 0; sub printwidgets @@ -423,6 +428,20 @@ sub printwidgets } } +sub printheader +{ + my($widget, $handle); + $handle = $_[1]; + foreach $widget (@{$_[0]}) + { + if($widget->{"var"}) + { + $handle->print("extern GtkWidget *" . $options{"prefix"} . $widget->{"name"} .";\n"); + } + printheader($widget->{"subwidgets"}, $handle) if($widget->{"subwidgets"}); + } +} + sub printvars { my($widget); @@ -488,6 +507,13 @@ while(<>) } } +if($args{"h"}) +{ + $hfile = IO::File->new($args{"h"}, "w") || die; + printheader $rootwidgets, $hfile; + $hfile->close(); +} + printvars $rootwidgets; print "\n"; print "GtkWidget *create_" . $options{"prefix"} . "wnd(void)\n";