Skip to main content

Ralsina.Me — Roberto Alsina's website

IUP/Qt is advancing

I have call­backs (some), ge­om­e­try man­age­men­t, LED files load­ing (re­source files) and it seems no hard parts are left.

That would mean the re­main­ing work is routi­nary, even if it's a large amount of it.

It's nice that I can switch back and forth be­tween the Mo­tif and Qt im­ple­men­ta­tions just by set­ting LD_LI­BRARY_­PATH to com­pare :-)

IUP/Qt shows a window

Of course you know that means noth­ing, but yes, af­ter a few hours of hack­ing, I got enough of a Qt back­end for IUP so a win­dow can be dis­played.

//ralsina.me/lateral/static/diup1.png

Of course those are all the wid­gets that are im­ple­ment­ed cur­rent­ly.

If by im­ple­ment­ed you ac­cept "can't con­nect call­backs and 90% of the at­tributes are in­ac­ces­si­ble", that is!

But af­ter I get the call­backs work­ing (that's the hairy part), the rest is sim­ple mo­not­o­nous repet­i­tive work.

It's in­ter­est­ing that the Qt back­end is, of course, look­ing quite sim­pler than the Mo­tif one, and in fac­t, a fair bit sim­pler than the IUP pro­grams look.

But hey, you get a sort of LUA bind­ings for Qt at the same price...

OTO­H, the third step is a nicer OOP, D, wrap­per around IUP.

Or some­thing like that ;-)

More IUP fun

Af­ter I hacked the D/I­UP bind­ing I thought... how­come I can not build IUP on my PC?

Well, their in­fra­struc­ture is not au­to*, but some­thing they made which I re­al­ly just don't un­der­stand.

So, I de­cid­ed to hack the build sys­tem. if I in­tend to play with IUP, I should be able to pack­age it!

So, af­ter 30 min­utes and some qmake doc read­ing, I have some­thing I can build.

Oh, sure, I mer­ci­less­ly hacked off the win32 sources, but that's not my in­ter­est ;-)

I will not up­load it, but if any­one needs it, just email me.

My first adventure in D-Land

Yes­ter­day (or rather, like 10 hours ago?) I post­ed about my quest for a spe­cif­ic lan­guage, and men­tioned one of the can­di­dates, called D which I had found ap­peal­ing.

Well, be­cause I am a quick coder (not good, but quick) I de­cid­ed, af­ter look­ing around for about 5 min­utes, to take as my first project giv­ing the D com­mu­ni­ty a UI tool­kit.

My first choice would have been Qt, of course, but D does­n't in­ter­face well (or at al­l) with C++, and I was not about to hack a QtC bind­ing, be­cause it would be un­us­able.

So, I looked around the web for a small mul­ti­plat­form C toolk­it, and I found there are very few of those left!

You have Gtk+ and ... well, al­most noth­ing else! I found IUP though, and de­cid­ed to bind it.

Since bind­ing C libs to D is quite sim­ple, I did it most­ly by hand. And 76 files and 8872 lines of code lat­er, here is DI­UP, a D bind­ing for IUP.

Now, how do you use it?

Get IUP, then get DC, then get D, then get DI­UP, then open it, and check the ex­am­ples.

The bind­ing mod­ules them­selves are in the bind­ing fold­er, so you can com­pile ex­am­ples like this:

[ralsina@monty iupbinding]$ cd examples/elem/iupbutton/
[ralsina@monty iupbutton]$ dmd -g -I../../../binding/ iupbutton.d  -L-liup -L-liupcontrols -L-L/usr/lib/iup -L-lcdiup ;
gcc iupbutton.o -o iupbutton -g -lphobos -lpthread -lm -Xlinker -liup -Xlinker -liupcontrols -Xlinker -L/usr/lib/iup -Xlinker -lcdiup
[ralsina@monty iupbutton]$ ls -lh iupbutton
-rwxrwxr-x  1 ralsina ralsina 217K Apr 18 02:30 iupbutton

You will prob­a­bly be link­ing a few libs too many, but don't wor­ry yet.

The good news:

  • IUP works on win­­dows and Unix.

  • IUP is an or­der of mag­ni­­tude smal­l­­er than WxWid­get­s.

  • Most of it seems to be work­ing.

The bad news:

  • IUP looks ug­­ly be­­cause it's mo­tif on unix.

  • IUP is pret­­ty lim­it­ed.

Some­day, when I have a free af­ter­noon, I could write a Qt back­end for IUP and avoid the suck­age plus port­ing it to OSX in the pro­cess, but...

  • IUP is damn hard to build. Luck­­i­­ly they have bi­­na­ries.

Manda­to­ry screen­shot!

So, en­joy and com­men­t!

The missing language

In the last month or two I have been writ­ing a fair bit of C code.

I re­al­ly dis­like C. But I have not been able to find a lan­guage to re­place it with, ex­cept C++, and that's not much of an im­prove­ment for what I did.

Maybe some­one can read this and help me. I don't mind learn­ing a new lan­guage. Re­al­ly, it's no prob­lem.

The goal is writ­ing small pro­grams (in the hun­dreds of lines re­gion), which have the fol­low­ing re­quire­ments:

  1. The pro­­gram MUST be cor­rec­t. Can nev­er seg­­fault or crash in some oth­­er way.

Since the code is short, I think I have man­aged, us­ing bstr­lib, to get this, af­ter quite a bit of pain, by au­dit­ing and unit-test­ing. But I am not sure, and I will nev­er be.

It would be awe­some if the lan­guage could be garbage-­col­lect­ed for this rea­son.

  1. It MUST have a de­­cent string han­dling.

The pro­grams han­dle mail. So, it's strings ga­lore.

  1. It MUST have very low over­­head. The pro­­grams should run and end quick­­­ly. Very quick­­­ly, be­­cause peo­­ple may be wait­­ing for them to end.

  2. It MUST be a rea­­son­ably sim­­ple lan­guage. I am not a great pro­­gram­mer, and these tools will be hacked at by peo­­ple with lim­it­ed pro­­gram­ming skills (sysad­mins like me!)

  3. Triv­ial ac­cess to C li­braries.

So, let's see.

C: gives 3, 4 (in a fash­ion), and 5

C++: 2, 3, maybe 4, and 5

D: It seems to give me all of the­se, along with a C-­like syn­tax... but I can't get it to work yet (cor­rec­tion, I got dmd to work, so it's look­ing good for D!).

So, any tak­er­s?


Contents © 2000-2023 Roberto Alsina