2013-04-24 12:24:54 +02:00
|
|
|
#!/usr/bin/awk -f
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
printf "#ifndef PHP_PQ_TYPE\n"
|
|
|
|
printf "# define PHP_PQ_TYPE(t,o)\n"
|
|
|
|
printf "#endif\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
printf "#ifndef PHP_PQ_TYPE_IS_ARRAY\n"
|
|
|
|
printf "# define PHP_PQ_TYPE_IS_ARRAY(oid) (\\\n\t\t0 \\\n"
|
2013-04-29 14:23:56 +02:00
|
|
|
for (oid in arrays) {
|
|
|
|
printf "\t||\t((oid) == %d) \\\n", oid
|
2013-04-24 12:24:54 +02:00
|
|
|
}
|
|
|
|
printf ")\n#endif\n"
|
2015-05-22 12:31:21 +02:00
|
|
|
|
2013-04-29 14:23:56 +02:00
|
|
|
printf "#ifndef PHP_PQ_TYPE_OF_ARRAY\n"
|
|
|
|
printf "# define PHP_PQ_TYPE_OF_ARRAY(oid) ("
|
|
|
|
for (oid in arrays) {
|
|
|
|
printf "\\\n\t(oid) == %d ? %s : ", oid, arrays[oid]
|
|
|
|
}
|
|
|
|
printf "0 \\\n)\n#endif\n"
|
2015-05-22 12:31:21 +02:00
|
|
|
|
|
|
|
printf "#ifndef PHP_PQ_DELIM_OF_ARRAY\n"
|
|
|
|
printf "# define PHP_PQ_DELIM_OF_ARRAY(oid) ("
|
|
|
|
for (oid in delims) {
|
|
|
|
printf "\\\n\t(oid) == %d ? '%s' : ", oid, delims[oid]
|
|
|
|
}
|
|
|
|
printf "0 \\\n)\n#endif\n"
|
2013-04-24 12:24:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/^DATA/ {
|
|
|
|
oid = $4
|
|
|
|
name = toupper($6)
|
2015-05-22 12:31:21 +02:00
|
|
|
adelim = $15
|
2013-04-29 14:23:56 +02:00
|
|
|
atypoid = $17
|
2013-04-24 12:24:54 +02:00
|
|
|
if (sub("^_", "", name)) {
|
2013-04-29 14:23:56 +02:00
|
|
|
arrays[oid] = atypoid
|
2013-04-24 12:24:54 +02:00
|
|
|
name = name "ARRAY"
|
|
|
|
}
|
2015-05-22 12:31:21 +02:00
|
|
|
delims[oid] = adelim
|
2013-04-24 12:24:54 +02:00
|
|
|
printf "#ifndef PHP_PQ_OID_%s\n", name
|
|
|
|
printf "# define PHP_PQ_OID_%s %d\n", name, oid
|
|
|
|
printf "#endif\n"
|
|
|
|
printf "PHP_PQ_TYPE(\"%s\", %d)\n", name, oid
|
|
|
|
}
|