Friday, July 22, 2005

Lazzyness is not a bad habit! Slothfullness is :)

So what’s the difference?

Hehe… in my world, I classify Laziness as the unwillingness to do more work than you feel you need to do. Slothfulness, in this same world of mine, is the unwillingness to do work that must be done.

You still don’t see the difference? Lemme explain. I’m slothfull about my Laundry (trust me… you don’t want to stick your nose near my laundry bad :) ), but I’m totally Lazy about Programming.

Porting XLib to D, is a case in point. From my limited understanding of the conversion process, I jumped in, took one look at Xlib.h, saw that it included X.h, and Xmd.h, and I decided to start by converting X.h to X.d

All well, and good, till I started doing the actual conversion. I started seriously replacing complex #defines, #ifndefs, etc, with version() statements, etc, and got stomped on a number of them, put TODO: markers on them for a next iteration, and tried to move as fast as I could. In the first two days, I completely had X.h converted to X.d (a whooping 3000+ line file!!!). That proves I’m not slothfull by my definition.

Well, next was Xmd.h to Xmd.d, and I started… full of energy and enthusiasm… and then I realized… heck… at this rate… I’ll NEVER finish this stuff!!! How did I come to that realization? Well, all this files are VERY LARGE. Then my lazy side kicked it… my hands just REFUSED to move on the keyboard again, and I started thinking… there MUST be something I’m not doing correctly. I considered writing a bash or python script to take the drudgery away, but then there were still so many special cases, and my RegEx is not FBI class RegEx (whatever FBI class RegEx is :) ).

It was then I started looking closely at the docs and found that there was a recommended step I was indeed missing out.

There is a recommendation to run the Preprocessor before conversion actually starts.. hmm… how did I ever miss that? Will it simplify my work? I went to find out.

I ran gcc –E on X.h and OMG!!! The result was less than 20 lines of code… I immediately began to suspect the process.
I repeated this on Xmd.h and DAMN! The same thing… all the code was disappearing, and some files like Xosdefs.h turned up totally empty. I popped into irc, asked around a bit, and someone said I may have empty files if I’m not referencing anything from those files.

Keeping that in mind, I reapeted that on Xlib.h, which pulled in code from X.h and Xmd.h, and I compared the sections it pulled in, and they were the same as the ones I got when I ran gcc –E on the independent files. Also, Xlib.h wasn’t empty like the other files, but it was just left with struct defs and typedefs…

Wow!!! That is a whole lot less work than my previous approach. So I’ve already clobbered the old sources, and started again. I’m almost certain I may start afresh at least once more as things get clearer, but it’s a whole lot more clearer. What I want to do is to download digital mars C compiler and use that to run the Preproccessor stage and compare the two outputs.

Currently my work is cut out for me, I’ve written a quick and dirty bash script, that does most of the typedef replacements that are obvious, and the type mappings (unsigned long long -> ulong for instance).

I’m sure I’ll be able to test my example code this weekend, so I’m still shooting for that.

Back to laziness and sloth. I was lazy about continuing, but not slothfull about doing the necessary research. Also, my continuing along with my HARD WORK approach, will seem to prove that I’m not lazy and not slothfull. The truth is, once I refuse to AT LEAST CONFIRM a suspicion, then I’m slothfull. This is probably one of the key factors that separate smart hackers from the regular drone next desk :).

Maybe I’m not your uberKewl smart hacker, but hey…I’m MY UberKewl smart hacker :)

Essien… Out.


At Sunday, July 24, 2005 6:17:00 PM, Blogger Mfoniso said...

Ah shut-up before you piss me off! :D I'm having a real hard time these days, school work is killing me and here you are hacking away like sey tomorrow no dey!

Needless to say, my idle blog has been put on hold indefinitely. (but you might wanna check out the last entry) I need to get lots of important thing in order. Yeah, I could blog about that but there really isn't any time. I spend all my time reading and replying mails. Maybe I'll continue the blog someday, maybe. For now, I'll just watch Essiene recompile and preprocess and laze away, of course after cleverly differentiating it from slothing. Bah! (Lazy == Slothful) Period :P

Even Vai is on hold now, I'll only listen, not much playing (it's that bad). OK, over and out.

PS. Seeing as this is my first stop whenever I'm online, (sometimes, it's, but hey Essien is a guru too) You'd better keep those loooong entries coming regularly, else I'll come after you. I ain't kidding! OK, gotta split.

At Monday, July 25, 2005 9:38:00 AM, Blogger Essien Ita Essien said...

hehehe :)

Okay.. so you found me out, and Lazy == Slothfull... so what? ;)

At Monday, July 25, 2005 9:44:00 AM, Blogger Ugo said...

Hey Essien,

I just went through your entire blog. Awesome stuff!

Even I could learn a lot from the content.

At Monday, July 25, 2005 7:20:00 PM, Blogger Essien Ita Essien said...

awww.. you guys are making me blush :)

Especially Ugo... he's really one bad guy like this.

Anyways... its good to know i'm not just 'blabbing crap'.


At Tuesday, July 26, 2005 7:32:00 PM, Blogger Ugo said...


I'm not Uber like you yet Essien. I'm spending summer teaching myself crap so I could come close.

Still...thanks for the complement. Your site is going to be a staple for me from now on.



Post a Comment

<< Home