Automatic return types for header tags.
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 16 Jul 2007 08:11:41 +0000 (11:11 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 16 Jul 2007 08:11:41 +0000 (11:11 +0300)
Derived from rpm5.org work of Jeff Johnsson

rpmdb/Makefile.am
rpmdb/header.h

index 0f017f9..4a8d094 100644 (file)
@@ -66,10 +66,11 @@ tagtbl.c: Makefile.am $(top_srcdir)/lib/rpmlib.h
        @echo '/*@-bounds@*/' > $@
        @echo '#include "system.h"' >> $@
        @echo '#include <rpmlib.h>' >> $@
+       @echo '#include "debug.h"' >> $@
        @echo '' >> $@
        @echo '/*@observer@*/ /*@unchecked@*/' >> $@
        @echo 'static const struct headerTagTableEntry_s rpmTagTbl[] = {' >> $@
-       ${AWK} '/(RPMTAG_[A-Z0-9]*)[ \t]+([0-9]*)/ && !/internal/ { tt = "NULL"; if ($$5 == "c") {tt = "CHAR"} if ($$5 == "h") {tt = "INT16"} if ($$5 == "i") {tt = "INT32"} if ($$5 == "l") {tt = "INT64"} if ($$5 == "s") {tt = "STRING"} if ($$5 == "x") {tt = "BIN"} if ($$5 == "s[]") {tt = "STRING_ARRAY"} if ($$5 == "s{}") {tt = "I18NSTRING"} if ($$2 == "=") { printf("\t{ \"%s\",    %s      RPM_%s_TYPE },\n", $$1, $$3, tt) } else { printf("\t{ \"%s\",   %s,     RPM_%s_TYPE },\n", $$2, $$3, tt) } }' < $(top_srcdir)/lib/rpmlib.h >> $@
+       ${AWK} '/(RPMTAG_[A-Z0-9]*)[ \t]+([0-9]*)/ && !/internal/ {tt = "NULL"; ta = "ANY"; if ($$5 == "c") {tt = "CHAR"; ta = "SCALAR"} if ($$5 == "c[]") {tt = "CHAR"; ta = "ARRAY"} if ($$5 == "h") {tt = "INT16"; ta = "SCALAR"} if ($$5 == "h[]") {tt = "INT16"; ta = "ARRAY"} if ($$5 == "i") {tt = "INT32"; ta = "SCALAR"} if ($$5 == "i[]") {tt = "INT32"; ta = "ARRAY"} if ($$5 == "l") {tt = "INT64"; ta = "SCALAR"} if ($$5 == "l[]") {tt = "INT64"; ta = "ARRAY"} if ($$5 == "s") {tt = "STRING"; ta = "SCALAR"} if ($$5 == "s[]") {tt = "STRING_ARRAY"; ta = "ARRAY"} if ($$5 == "s{}") {tt = "I18NSTRING"; ta = "SCALAR"} if ($$5 == "x") {tt = "BIN"; ta = "SCALAR"} if ($$2 == "=") { printf("\t{ \"%s\",       %s      RPM_%s_TYPE + RPM_%s_RETURN_TYPE },\n", $$1, $$3, tt, ta) } else { printf("\t{ \"%s\",  %s,     RPM_%s_TYPE + RPM_%s_RETURN_TYPE  },\n", $$2, $$3, tt, ta) } }' < ${top_srcdir}/lib/rpmlib.h | sort >> $@
        @echo ' { NULL, 0, 0 }' >> $@
        @echo '};' >> $@
        @echo '' >> $@
index ad144d1..554940a 100644 (file)
@@ -247,6 +247,19 @@ typedef enum rpmSubTagType_e {
 } rpmSubTagType;
 /*@=enummemuse =typeuse @*/
 
+/** \ingroup header
+ *  * Identify how to return the header data type.
+ *   */
+/*@-enummemuse -typeuse @*/
+typedef enum rpmTagReturnType_e {
+    RPM_ANY_RETURN_TYPE         = 0,
+    RPM_SCALAR_RETURN_TYPE      = 0x00010000,
+    RPM_ARRAY_RETURN_TYPE       = 0x00020000,
+    RPM_MAPPING_RETURN_TYPE     = 0x00040000,
+    RPM_MASK_RETURN_TYPE        = 0xffff0000
+} rpmTagReturnType;
+/*@=enummemuse =typeuse @*/
+
 /**
  * Header private tags.
  * @note General use tags should start at 1000 (RPM's tag space starts there).