[cairo] Reducing .data
Behdad Esfahbod
behdad at behdad.org
Mon Dec 18 17:16:20 PST 2006
On Mon, 2006-12-18 at 14:59 -0800, Carl Worth wrote:
>
> I'm of mixed feelings here. Ulrich's triple-including scheme allows
> for generating a table like this using nothing but the pre-processor,
> correct?
Right. However, the downsides I see are:
1) Need to put the table into a separate file. Ugly. I'm been down
that road in FriBidi, and while I appreciate the flexibility, I much
more like the current directory structure in cairo.
2) Uses a union initialization. Not sure how portable that is.
3) It uses offsetof, though offsetof can be defined using Ansi C.
> That definitely seems a lot better than a perl script that would have
> to be extracted out of the C source if we ever wanted to change
> anything in the table.
>
> But, if the justification for using the perl script is that we never
> expect to edit the table at all, then why is that perl code even here?
> Can't we just let the generated tables stand on their own in that
> case? (And just trust our code history to hold on to a more "obvious"
> form of the table if anyone ever really needs to look for it).
The perl code sure can go (I'll put it in the commit message :-D). I
adapted it from pango/tools/gen-color-table.pl. However, the reason I
made this choice was mainly to keep the uncompressed table around, in a
comment, to not decrease the readability of the code. So you still map
glyph names and values by reading source code.
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo
mailing list