Perl dying? Well now I don't care

It is a bit of a long story how I got burned by bad perl internal politics.

For many years I wanted images in Pod. And many others wanted too. And of course, each time I raised this in lists and on facebook, an answer was, if you want it, go and write it yourself. I would tell that myself, the classic "patches are welcome". Until one day I said, well, now, why actually not, right? Especially that I do have experience in creating and actively using images in pod using various hacks, such as direct inclusion of html with images, and even writing a standalone POD viewer capable of showi…

Prima: release v1.59 adds major text rendering functionality

  1. Previously it was only possible to output text with strings using text_out() method. Now, a more versatile and modern way is added with text_shape() method that converts text string in a series of glyphs, that allows the following:

    • Full unicode bidi processing
    • Support for font ligatures
    • Native support for right-to-left text
    • Transparent font substituion where a single font does not contain necessary glyphs

    In addition to that, infrastructure was added to support RTL and shaping in all standard Prima widgets. Run podview Prima::Drawable::Glyphs and check out the examples in the end of the document.

  2. PostScript backend rewritten to generate embedded Type1 fonts. This allows to generate unicode text in PostScript documents.

  3. In X11 backend, standard key combination (Ctrl+Shift+U) accepts unicode hex number as a character input. Try typing "a" then Ctrl+Shift+U 300 ENTER.

  4. Prima::*Dialog packages are moved to Prima::Dialog::* namespace

glyphs.png

adventure with PVS-Studio C/C++ analyzer

I've recently read a promo article about a static C/C++ analyzer called PVS-Studio by viva64.com, where the readers were urged to use the product, and I did just that. Evgeniy Ryzhkov, the creator of the program kindly sent me a one-week key, and I immediately started testing some of my C/XS code.

I'm also using valgrind and was rather sure that all major problems were long gone, but how wrong I was. There were also a couple nasties, in cases not covered by tests, and thus valgrind had no chance to detect them. There were also a couple of WTFs, such as

void * x = result();
x-> something++;
if (!x) return;

where the logic was clearly there, but somehow on wrong lines. A shame really.

I did like the output of the analyzer, and not content with that, tried to run it against the latest perl sources. Retroactively, an idea struck me, that there's little chance that I'm the first person trying to do that, but google only gave me a last-year mail from Jarkko Hientaniemi where he asked the p5-porters if anyone could do this. Feeling like a necromancer (i.e. the one who loves reviving dead threads) I produces this: http://karasik.eu.org/misc/pvs/perl.log . It's mostly noise, but there are a interesting remarks as well, for example:

src/blead/toke.c:10975
Uninitialized variable 'len' was used. The variable was used to initialize itself.
CvOUTSIDE(PL_compcv) = MUTABLE_CV(SvREFCNT_inc_simple(outsidecv));

...and good luck figuring out where there is this _p and whether it was indeed uninitialzied or it was false alarm.

I also tried to run it against a couple larger perl distros (same directory online), but it's much less interesting.

All in all I think PVS is a decent tool in the box (John Carmark of Doom's fame apparently loves it), it runs on both linux and win32, but for the price of over $5k it not something one decides to use easily. On the downside there were lots of noise errors, that are not errors at all, it took really long time to munch on a 200K+ C file from rakudo, so the way the company advocates to use the tool, as a part of build process, might not always be practical.

If you're interested to run your pet C project through it, I've read on the company site that open-source tools might be given a short evaluation key without support for exactly that purpose. However there's one thing that I couldn't stop thinking about. Statical text analyzers like this should've been written in perl, should've been a perl killer app, but somehow ... they haven't. I wonder why.

playing with Cairo

I was recently reading a brilliant post A first-person engine in 265 lines by Hunter Loftis, and instantly wanted to port it to Perl. After doing half of work, though, I figured out that the original code uses alpha blending technique to achieve wall shading, rain, and drawing images with 8-bit transparency channel.

I've used Prima to write the port, even though it doesn't support alpha channel, because native x11 API doesn't do that. Goog…

how I learned to plot a mandelbrot set

When I first met fractals in the school, I thought that they were if not magic, then something very close to it. The concept of a fractal dimension was something I couldn't react to logically, but only emotionally, basically, with a "wow" and nothing much else. I never tried though to write a program that plots the set, even though there plenty of examples around; a deity isn't there to be analyzed, only to be awed at.

Enter year 2013, and I find myself reading PDL mailing list where someone has post…