blob: c00128a0a3bb71634963e85ff30f47944e3be33a [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001#!/usr/bin/perl
2
3
4print<<EOM;
5/*
6 * This file is automatically generated by $0
7 * DO NOT EDIT MANUALLY, fix the $0 instead if necessary.
8 */
9#ifndef ASN1_PARSER_EXPR_STR_H
10#define ASN1_PARSER_EXPR_STR_H
11
12static char *asn1p_expr_type2str[] __attribute__ ((unused)) = {
13EOM
14
15while(<>) {
16 chomp;
17 next if(/TYPE_MAX/);
18 next unless(/^[ \t]+(ASN_[A-Z]+_([A-Za-z0-9_]+))/);
19
20 print "\t[ $1 ]\t = ";
21
22 $_ = $2;
23 if($_ eq "RELATIVE_OID") {
24 print '"RELATIVE-OID"';
25 } else {
26 s/_/ /;
27 print '"'.$_.'"';
28 }
29
30 print ",\n";
31}
32
33print<<EOM;
34};
35
36/*
37 * Convert the ASN.1 expression type back into the string representation.
38 */
39#define ASN_EXPR_TYPE2STR(type) \\
40 ( \\
41 ((type) < 0 \\
42 || (type) >= sizeof(asn1p_expr_type2str) \\
43 / sizeof(asn1p_expr_type2str[0])) \\
44 ? (char *)0 \\
45 : asn1p_expr_type2str[(type)] \\
46 )
47
48#endif /* ASN1_PARSER_EXPR_STR_H */
49EOM