X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=php_pq_type.awk;h=93c4a8db75688e2884358155f0d484b4e23c6972;hp=15ffd1b975198924334508e074ea31fac7638142;hb=11075db860470f36eafe93257972e5f7db9632fa;hpb=8f0022e027a5412e5d404ee62a0c0346481748b4 diff --git a/php_pq_type.awk b/php_pq_type.awk index 15ffd1b..93c4a8d 100755 --- a/php_pq_type.awk +++ b/php_pq_type.awk @@ -13,22 +13,32 @@ END { printf "\t||\t((oid) == %d) \\\n", oid } printf ")\n#endif\n" + 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" + + 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 "\\\n\t0 \\\n)\n#endif\n" } /^DATA/ { oid = $4 name = toupper($6) + adelim = $15 atypoid = $17 if (sub("^_", "", name)) { arrays[oid] = atypoid name = name "ARRAY" } + delims[oid] = adelim printf "#ifndef PHP_PQ_OID_%s\n", name printf "# define PHP_PQ_OID_%s %d\n", name, oid printf "#endif\n"