blob: a66425a8ef51b3f2e8036f9cc2d73bb78d9a2d76 [file] [log] [blame]
Lev Walkinf15320b2004-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 */
Lev Walkin4ef7c322004-06-28 21:20:50 +000039#define ASN_EXPR_TYPE2STR(type) \\
40 ( \\
41 (((ssize_t)(type)) < 0 \\
42 || ((size_t)(type)) >= sizeof(asn1p_expr_type2str) \\
43 / sizeof(asn1p_expr_type2str[0])) \\
44 ? (char *)0 \\
Lev Walkin61f89c42004-09-23 22:21:07 +000045 : asn1p_expr_type2str[(int)(type)] \\
Lev Walkinf15320b2004-06-03 03:38:44 +000046 )
47
48#endif /* ASN1_PARSER_EXPR_STR_H */
49EOM