aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1parser/expr-h.pl
diff options
context:
space:
mode:
Diffstat (limited to 'libasn1parser/expr-h.pl')
-rwxr-xr-xlibasn1parser/expr-h.pl49
1 files changed, 49 insertions, 0 deletions
diff --git a/libasn1parser/expr-h.pl b/libasn1parser/expr-h.pl
new file mode 100755
index 00000000..c00128a0
--- /dev/null
+++ b/libasn1parser/expr-h.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+
+print<<EOM;
+/*
+ * This file is automatically generated by $0
+ * DO NOT EDIT MANUALLY, fix the $0 instead if necessary.
+ */
+#ifndef ASN1_PARSER_EXPR_STR_H
+#define ASN1_PARSER_EXPR_STR_H
+
+static char *asn1p_expr_type2str[] __attribute__ ((unused)) = {
+EOM
+
+while(<>) {
+ chomp;
+ next if(/TYPE_MAX/);
+ next unless(/^[ \t]+(ASN_[A-Z]+_([A-Za-z0-9_]+))/);
+
+ print "\t[ $1 ]\t = ";
+
+ $_ = $2;
+ if($_ eq "RELATIVE_OID") {
+ print '"RELATIVE-OID"';
+ } else {
+ s/_/ /;
+ print '"'.$_.'"';
+ }
+
+ print ",\n";
+}
+
+print<<EOM;
+};
+
+/*
+ * Convert the ASN.1 expression type back into the string representation.
+ */
+#define ASN_EXPR_TYPE2STR(type) \\
+ ( \\
+ ((type) < 0 \\
+ || (type) >= sizeof(asn1p_expr_type2str) \\
+ / sizeof(asn1p_expr_type2str[0])) \\
+ ? (char *)0 \\
+ : asn1p_expr_type2str[(type)] \\
+ )
+
+#endif /* ASN1_PARSER_EXPR_STR_H */
+EOM