[fetter-devel] QT, MOC, and Verrazano

C Y smustudent1 at yahoo.com
Wed Nov 2 01:36:05 UTC 2005


Sorry to reply to my own post, but I have a question/half baked idea
about MOC and QT I want to get down before I lose it.

QT is intended as a C++ toolkit, but apparently uses structures above
and beyond those of C++.  This requires both user applications and the
libraries themselves? to utilize a pre-processor tool which translates
QT code into valid C++ code.  

When Verrazano generates bindings, does it work solely from the xml
output of the gcc-xml compile?  E.g., does it look at the original
files in question or just the gcc-xml data?  (Sorry, I should know
this...)

If it DOES look at the actual source code or header files to generate
the actual bindings, is there any way a second layer could be inserted?
 I'm thinking something like this:

a)  Verrazano scans the QT files in question, generating bindings for
the toplevel QT calls.  These do not correspond to the actual C++
compiled output of course, any more than any user level code does
before being translated by MOC.

b)  On a per-binding basic, call moc on the C++ associated with the
binding to generate a post-MOC set of bindings.  Run Verrazano in a
second pass to generate bindings for the results.  Automatically link
up the top level QT FFI to the post-MOC FFI bindings generated
(hopefully this will be possible.)

c)  use the post-MOC generated FFI to link up with the results of the
normal gcc-xml build information.

In effect, rather than implement the entire MOC in Lisp, the idea would
be to use it as a converter on a per-entry basis and work with the
results.  This has an advantage in that a Lisp verson of the MOC won't
have to be written, maintained and updated.  Of course the
disadvantages are:  a) Verrazano may not work in a way that makes this
even remotely feasible b) the MOC output may not have inputs that are
easily relatible to the inputs given to the QT level FFI (although
hopefully this will either be apparent or easily deduced) c) the MOC
may not care to be run on such small parts of a file d) it might be a
very slow way to generate bindings and e) the QT files themselves may
not be readable from Verrazano's perspective, depending on how
different they actually are compared to regular C++ syntax.  Maybe
gcc-xml could be tweaked to output xml for them without trying to
compile them (which obviously wouldn't work?)  It would be a shame to
have to write a special generator just for QT files.

Anyway, probably total nonsense but I thought it was an idea worth
mentioning in case someone knowing more about QT could judge how bad of
an idea it really is.  Maybe if it's a workable idea it would even be a
useful mechanism to have in place, in case of other pre-processed C++
libraries?  (just replace moc with the name of the preprocessor for the
particular library in question?)

Cheers,
CY


		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com



More information about the fetter-devel mailing list