Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

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?

RASCAN 0.1.0

Yet an­oth­er lit­tle pro­gram.

In this case, it's called ras­can, and it's a re­write of In­ter7's sim­scan.

What does it do? It eas­i­ly hooks cla­mav and spa­mas­sas­sin in­to your qmail-smt­pd se­tup, so you will not ac­cept virus­es in your server, and tag spam.

It still lacks some fea­tures, like bounc­ing mes­sages based on spa­mas­sas­sin hit­s, or block­ing at­tach­ments, but it has at least one fea­ture sim­scan lacks (adding foot­ers to mes­sages).

It's still al­pha, so I would­n't put it on a pro­duc­tion server, but it may even work ;-)

Now I understand!

Rad­ing an in­ter­view with Bruce Perens has been a re­al eye open­er.

Con­sid­er this:

For ex­am­ple, when I con­sid­ered be­ing an em­ploy­ee one of the things stand­ing in the way was the fact that Mark does­n't give his em­ploy­ees stock in his com­pa­nies. If I'm go­ing to work for some­one I'm go­ing to be a lit­tle en­tre­pre­neur­ial about it, so I felt that al­though Ubun­tu and Canon­i­cal could do a great deal for De­bian and be ex­cel­lent com­mu­ni­ty mem­ber­s, they were nev­er go­ing to be the core, and we could ac­tu­al­ly get clos­er to the core by fol­low­ing what I have set up for User­Lin­ux.

Now I un­der­stand! In or­der to be "the core", a com­pa­ny should give Bruce Perens stock.

Contents © 2000-2022 Roberto Alsina