blob: 99520b6bed4cfbab54bcf650bb2986319e14bad4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/usr/bin/env 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
#include <assert.h>
#ifndef __GNUC__
#define __attribute__(x) /* unused */
#endif
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) _asn1p_expr_type2string(type)
static inline char * __attribute__((unused))
_asn1p_expr_type2string(asn1p_expr_type_e type) {
assert((signed int)type >= 0);
if(type < sizeof(asn1p_expr_type2str)/sizeof(asn1p_expr_type2str[0]))
return asn1p_expr_type2str[type];
return NULL;
}
#endif /* ASN1_PARSER_EXPR_STR_H */
EOM
|