From 892e8fe2954f64c6d129c57f86d1d4348f2fe23e Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 16 Jul 2007 11:11:41 +0300 Subject: [PATCH] Automatic return types for header tags. Derived from rpm5.org work of Jeff Johnsson --- rpmdb/Makefile.am | 3 ++- rpmdb/header.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rpmdb/Makefile.am b/rpmdb/Makefile.am index 0f017f9..4a8d094 100644 --- a/rpmdb/Makefile.am +++ b/rpmdb/Makefile.am @@ -66,10 +66,11 @@ tagtbl.c: Makefile.am $(top_srcdir)/lib/rpmlib.h @echo '/*@-bounds@*/' > $@ @echo '#include "system.h"' >> $@ @echo '#include ' >> $@ + @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 '' >> $@ diff --git a/rpmdb/header.h b/rpmdb/header.h index ad144d1..554940a 100644 --- a/rpmdb/header.h +++ b/rpmdb/header.h @@ -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). -- 2.7.4