blob: 8b1e0805225fa59049fae15a97aa1e035899f426 [file] [log] [blame]
Lev Walkin27fd0b62007-08-27 23:57:45 +00001#!/usr/bin/env perl
Lev Walkinf15320b2004-06-03 03:38:44 +00002
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
Lev Walkin4efbfb72005-02-25 14:20:30 +000012#ifndef __GNUC__
13#define __attribute__(x) /* unused */
14#endif
15
Lev Walkinf15320b2004-06-03 03:38:44 +000016static char *asn1p_expr_type2str[] __attribute__ ((unused)) = {
17EOM
18
19while(<>) {
20 chomp;
21 next if(/TYPE_MAX/);
22 next unless(/^[ \t]+(ASN_[A-Z]+_([A-Za-z0-9_]+))/);
23
24 print "\t[ $1 ]\t = ";
25
26 $_ = $2;
27 if($_ eq "RELATIVE_OID") {
28 print '"RELATIVE-OID"';
29 } else {
30 s/_/ /;
31 print '"'.$_.'"';
32 }
33
34 print ",\n";
35}
36
37print<<EOM;
38};
39
40/*
41 * Convert the ASN.1 expression type back into the string representation.
42 */
Lev Walkin4ef7c322004-06-28 21:20:50 +000043#define ASN_EXPR_TYPE2STR(type) \\
44 ( \\
45 (((ssize_t)(type)) < 0 \\
46 || ((size_t)(type)) >= sizeof(asn1p_expr_type2str) \\
47 / sizeof(asn1p_expr_type2str[0])) \\
48 ? (char *)0 \\
Lev Walkin61f89c42004-09-23 22:21:07 +000049 : asn1p_expr_type2str[(int)(type)] \\
Lev Walkinf15320b2004-06-03 03:38:44 +000050 )
51
52#endif /* ASN1_PARSER_EXPR_STR_H */
53EOM