[Kde-bindings] Qt bindings for Lua update and new XML generator

Mauro Iazzi mauro.iazzi at gmail.com
Mon Oct 15 13:19:41 UTC 2007


Hi all,

in the past weeks I have changed my Qt bindings a lot, and now I feel
I can show something more than the last time.

I have put my code in the git repository http://repo.or.cz/w/lqt.git .
Anyone who want to see it can use
git clone git://repo.or.cz/lqt.git
or get the snapshot of the last commit.

Some of the changes made are:
 * removed dependency from LuaExpat. Lqt now uses Roberto
Ierusalimschy XML parser (as suggested by Ariel Manzur). Thanks to it
I can build indices of the entries while parsing, reducing generation
time from several minutes to few seconds. (I praise myself for having
put in place a method for caching searches from the beginning)
 * included an old lqtscript code, for "historical" reasons. The code
binds the  meta-object system of Qt to Lua and does not require
parsing the headers at all. Some of the code was reused by the full
binder.
 * the generated code can now be built with cmake. The generator spits
out a src directory which should contain everything needed to bind the
choosen classes. To build use
  cmake .
  make
 * X11 specific code should have gone. Actually at least members named
syncX are still there, so it is not completely true. However if that
is the only bit left it is easy to get rid of it.
 * fixed a big number of bugs in the generator code. Most of the
generated code compiles cleanly now and in some cases where it doesn't
it is gccxml fault, not mine. There are no evdent bugs anymore (this
does not mean there's no room for improvement, the code is far from
perfect)

Moreover I've written a little demo for lqt. It is a little text
editor modeled over vim.
It features:
 - a vim style command line (which has history, and accepts both Lua
code and a few vim commands like :e :w :s);
 - syntax highlighting "support" (qt's one...) which is now used only
for keyword highlighting;
 - it is written in pure Lua (plus lqt either compiled in the
interpreter or loaded as modules), and it is 500 lines of code;
 - and most of all, has a little tetris game in it, to demonstrate the
use of Timers and shortcuts, all in other 350 lines.

The editor is in http://repo.or.cz/w/Leditor.git . (it would be
interesting to know if and how it can be combined with a complete
editor core, like the new WordGrinder one from David Given).

Moreover, as suggested by Richard Dale during the discussion over
gccxml, I started to write a replacement starting from the QtJambi
parser (originally written by Roberto Raggi for kdevelop: praise to him
for it is wondeful).
In 350 lines of new code I have now a full C++ to XML translator. It
describes everything I need (slots and signals included). Its format is
not the same of gccxml because the internal representation of the parser
is different from gcc's one. Thus I cannot use it yet with Lqt, which uses
the other format. Anyway, it will work as soon as possible.
I actually do not export template parameters description for I have no
idea of the best way to represent it. Anyway, the information is reachable
during the parsing, and in a convenient format, so this is not a long term
issue.

Cheers to all,

Mauro



More information about the Kde-bindings mailing list