Re: Exporting type OID macros in a cleaner fashion
От | Greg Sabino Mullane |
---|---|
Тема | Re: Exporting type OID macros in a cleaner fashion |
Дата | |
Msg-id | 89565e3a3e23b7186f5ceca763dbf8e8@biglumber.com обсуждение исходный текст |
Ответ на | Exporting type OID macros in a cleaner fashion (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | 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@turnstep.com PGP Key: 0x14964AC8 200606241151 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFEnWAfvJuQZxSWSsgRAjgqAKClEDrahFG5NCSrK47Ae7P13QCD+ACg1KHe XS2uYrmI5wf6i8Mpttpi1U8= =wlUx -----END PGP SIGNATURE-----
В списке pgsql-hackers по дате отправления: