From: | "Greg Sabino Mullane" <greg(at)turnstep(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Exporting type OID macros in a cleaner fashion |
Date: | 2006-06-24 15:55:53 |
Message-ID: | 89565e3a3e23b7186f5ceca763dbf8e8@biglumber.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> The alternative I'm currently thinking about is to build and install an
> auto-generated file comparable to fmgroids.h, containing *only* the type
> OID macro #defines extracted from pg_type.h. This would require just a
> trivial amount of sed hacking.
FWIW, that's exactly what we currently do in DBD::Pg to generate an up to
date list of types:
## $file = "pg_type.h"
open(F, $file) or die qq{Could not open file "$file": $!\n};
my %oid;
my $maxlen = 1;
while(<F>) {
next unless /^#define\s+([A-Z0-9_]*OID)\s+(\d+)/o;
$oid{$1} = $2;
length($1) > $maxlen and $maxlen = length($1);
}
close(F);
We actually go on from there to build a bunch of custom C structs. The maxlen
is simply there to make our final "types.c" line up pretty.
Installing it at the top-level sounds good, although I don't think
we'd see a need to switch to it since we already parse pg_types.h ourselves. ;)
- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200606241151
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFEnWAfvJuQZxSWSsgRAjgqAKClEDrahFG5NCSrK47Ae7P13QCD+ACg1KHe
XS2uYrmI5wf6i8Mpttpi1U8=
=wlUx
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2006-06-24 16:06:46 | Gist does not build with VC++ anymore |
Previous Message | Jonah H. Harris | 2006-06-24 15:37:02 | Re: vacuum, performance, and MVCC |