csomh / source-git / rpm

Forked from source-git/rpm 4 years ago
Clone
2ff057
#!/bin/sh
2ff057
2ff057
cat << EOF
2ff057
static const struct headerTagTableEntry_s rpmTagTable[] = {
2ff057
EOF
2ff057
2ff057
${AWK} '/[\t ](RPMTAG_[A-Z0-9]*)[ \t]+([0-9]*)/ && !/internal/ && !/unimplemented/ {
2ff057
	tt = "NULL"
2ff057
	ta = "ANY"
2ff057
	ext = "0"
2ff057
	if ($5 == "c") {
2ff057
		tt = "CHAR"
2ff057
		ta = "SCALAR"
2ff057
	}
2ff057
	if ($5 == "c[]") {
2ff057
		tt = "CHAR"
2ff057
		ta = "ARRAY"
2ff057
	} 
2ff057
	if ($5 == "h") {
2ff057
		tt = "INT16"
2ff057
		ta = "SCALAR"
2ff057
	}
2ff057
	if ($5 == "h[]") {
2ff057
		tt = "INT16"
2ff057
		ta = "ARRAY"
2ff057
	}
2ff057
	if ($5 == "i") {
2ff057
		tt = "INT32"
2ff057
		ta = "SCALAR"
2ff057
	}
2ff057
	if ($5 == "i[]") {
2ff057
		tt = "INT32"
2ff057
		ta = "ARRAY"
2ff057
	}
2ff057
	if ($5 == "l") {
2ff057
		tt = "INT64"
2ff057
		ta = "SCALAR"
2ff057
	}
2ff057
	if ($5 == "l[]") {
2ff057
		tt = "INT64"
2ff057
		ta = "ARRAY"
2ff057
	}
2ff057
	if ($5 == "s") {
2ff057
		tt = "STRING"
2ff057
		ta = "SCALAR"
2ff057
	}
2ff057
	if ($5 == "s[]") {
2ff057
		tt = "STRING_ARRAY"
2ff057
		ta = "ARRAY"
2ff057
	}
2ff057
	if ($5 == "s{}") {
2ff057
		tt = "I18NSTRING"
2ff057
		ta = "SCALAR"
2ff057
	} 
2ff057
	if ($5 == "x") {
2ff057
		tt = "BIN"
2ff057
		ta = "SCALAR"
2ff057
	}
2ff057
	if ($6 == "extension") {
2ff057
		ext = "1"
2ff057
	}
2ff057
	if ($2 == "=") {
2ff057
		tnarg = $1
2ff057
	} else {
2ff057
		tnarg = $2
2ff057
	}
2ff057
	tn = substr(tnarg, index(tnarg, "_") + 1)
2ff057
	sn = (substr(tn, 1, 1) tolower(substr(tn, 2)))
2ff057
	if ($2 == "=") {
2ff057
		printf("    { \"%s\", \"%s\", %s, RPM_%s_TYPE, RPM_%s_RETURN_TYPE, %d },\n", tnarg, sn, tnarg, tt, ta, ext)
2ff057
	} else {
2ff057
		printf("    { \"%s\", \"%s\", %s, RPM_%s_TYPE, RPM_%s_RETURN_TYPE, %d },\n", tnarg, sn, $3, tt, ta, ext)
2ff057
	}
2ff057
}' < $1 | sort
2ff057
2ff057
cat << EOF
2ff057
    { NULL, NULL, RPMTAG_NOT_FOUND, RPM_NULL_TYPE, 0 }
2ff057
};
2ff057
EOF
2ff057