Re: signal/properties/enums/flags defs



> >
> > Probably the best way to structure this tool would be to put all these
> > helper functions for outputing defs into a small static library, then have
> > a script that scans for a list of types in a library, outputs a small
> > program and links it against the helper library and the lib being scanned,
> > and then runs the resulting program.
>
> Couldn't you just use the libary from h2defs.py?

The idea is that the functions that extract the defs information would be
put into a small library (say libdefsextract.a), and have a single entry
point like write_defs(GType type).

We then have a script (be it python, perl, sh+sed, whatever), which scans
headers to find *_TYPE_* variables/macros in the headers.  It writes out a
small program like this (this example uses gtk):
  #include <gtk/gtk.h>
  int
  main()
  {
      write_defs(GTK_TYPE_OBJECT);
      write_defs(GTK_TYPE_WIDGET);
      write_defs(GTK_TYPE_WIDGET_FLAGS);
      ...
      return 0;
  }

It would then compile this program:
  gcc writedefs.c -ldefsextract `pkg-config --cflags --libs gtk+-2.0` \
     -o writedefs

And finally runs the writedefs script (then cleans up the temporary
program it created).

So essentially, you could just call the script, and it will scan for
types, compile the program that extracts the info, and then prints it to
stdout.

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]