vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
| 2 | |
| 3 | |
| 4 | print<<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 | |
| 12 | static char *asn1p_expr_type2str[] __attribute__ ((unused)) = { |
| 13 | EOM |
| 14 | |
| 15 | while(<>) { |
| 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 | |
| 33 | print<<EOM; |
| 34 | }; |
| 35 | |
| 36 | /* |
| 37 | * Convert the ASN.1 expression type back into the string representation. |
| 38 | */ |
vlm | bacb731 | 2004-06-28 21:20:50 +0000 | [diff] [blame] | 39 | #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 \\ |
vlm | 74ce239 | 2004-09-23 22:21:07 +0000 | [diff] [blame] | 45 | : asn1p_expr_type2str[(int)(type)] \\ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 46 | ) |
| 47 | |
| 48 | #endif /* ASN1_PARSER_EXPR_STR_H */ |
| 49 | EOM |