Archive for January, 2006


Friday, January 20th, 2006

I have to confess that i have never tried to debug the perl interpreter before, however, after 10 hours of hacking on something for my thesis which ultimately caused the interpretter to SEGV when it ran, i was willing to give it a go (if only so the damded code would run, and i wouldn’t have to write it in another silly scripting language like python).

Anyway i did the obvious things first (look for newer version of perl – no, try with older version of perl – no) then i grabbed perl and did the obvious things with that out of the box (like turning threading off). After about 20 minutes (and christ it the perl build environment stupid) of that i gave up and started looking at the code.

The first thing i noticed is that actually perl is not written in C (contrary to popular belief); it is actually written in cpp. Any given statement in perl which looks like a function is almost certainly a macro, which itself probably references 2 or 3 macros which in turn reference a couple of defines, and so on and so on.

The second thing is that the code is full of wonderful things like:

'Perl_croak(aTHX_ "%"SVf, ERRSV);' anyway...

Eventually I found the bug (or at least the cause of the segv) which was either a corrupted heap or a double free (not really sure, as its something to do with perls horrible internal memory framework). This was causing the parser to crash while freeing some memory during fatal syntax error handling which was happening before the parse error was being reported (duh). I hacked out the offending free and fixed the syntax errors, and am now working again.

If i can be bothered i will post a bug.

The real question is perhaps: should people who write languages like perl be allowed to write interpreters for languages like perl? More to the point is letting them write a new version in C++ a better idea?

** update**
I eventually got around to filing the bug (ticket 38299)

Very cool hack

Wednesday, January 11th, 2006

I saw this on hackaday the idea is to use the DAC on your VGA card to modulate a DVBT signal which can then be decoded on any digibox and was vaguely impressed. Shame he doesn’t publish the code for generating the images which generate the signal itself.

How do they make clothes?

Wednesday, January 4th, 2006

No really, is it really just thousands and thousands of chinese, indian and sri-lankan people slaving over sewing machines?

I guess we have ways of cutting fabric (laser,water etc) which could make the component parts fairly efficiently but i can’t see how you could automate stiching in such a way as to be reliable. unless you are just making flat garments or bits therof…