unregister eventhandler
[m6w6/ext-pq] / php_pq_type.awk
1 #!/usr/bin/awk -f
2
3 BEGIN {
4 printf "#ifndef PHP_PQ_TYPE\n"
5 printf "# define PHP_PQ_TYPE(t,o)\n"
6 printf "#endif\n"
7 }
8
9 END {
10 printf "#ifndef PHP_PQ_TYPE_IS_ARRAY\n"
11 printf "# define PHP_PQ_TYPE_IS_ARRAY(oid) (\\\n\t\t0 \\\n"
12 for (oid in arrays) {
13 printf "\t||\t((oid) == %d) \\\n", oid
14 }
15 printf ")\n#endif\n"
16 printf "#ifndef PHP_PQ_TYPE_OF_ARRAY\n"
17 printf "# define PHP_PQ_TYPE_OF_ARRAY(oid) ("
18 for (oid in arrays) {
19 printf "\\\n\t(oid) == %d ? %s : ", oid, arrays[oid]
20 }
21 printf "0 \\\n)\n#endif\n"
22 }
23
24 /^DATA/ {
25 oid = $4
26 name = toupper($6)
27 atypoid = $17
28 if (sub("^_", "", name)) {
29 arrays[oid] = atypoid
30 name = name "ARRAY"
31 }
32 printf "#ifndef PHP_PQ_OID_%s\n", name
33 printf "# define PHP_PQ_OID_%s %d\n", name, oid
34 printf "#endif\n"
35 printf "PHP_PQ_TYPE(\"%s\", %d)\n", name, oid
36 }