lua-users home
lua-l archive

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


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 ifand how it can be combined with a complete
editor core, like the new WordGrinder one from David Given).

Last one, the use of gccxml for bindings was discussed in the
kdebindings mailing list.
While the (indipendent from me) proposal was rejected, Richard Dale
(soul of kdebindings) was kind enough to suggest another solution:
using one of the C++ parser written by Roberto Raggi for kdevelop. He
tagged this solution as too hard for the short-to-middle period.

However, given that lqt is quite stable and gives me little or no
problems (depending on weather), I actually wrote this parser and now
it is bundled with lqt's code. It is in the directory parser/ and is
built with qmake:
qmake
make

I used the version of the parser that came with qtjambi (qt java
bindings generator) which is included (unmodified) with the source. It
works quite well and every information I need is there. Unfortunately
the output format is not the same of gccxml thus it is not a drop-in
replacement, but in the future I will make lqt work with it, and
remove the dependency on gccxml. In this way the bindings will
ultimately be a lot more portable.

I hope to hear comments and suggestions.

Cheers to all,

Mauro